Skip to content

Commit dd3daca

Browse files
Jingoo HanVinod Koul
authored andcommitted
dma: use platform_{get,set}_drvdata()
Use the wrapper functions for getting and setting the driver data using platform_device instead of using dev_{get,set}_drvdata() with &pdev->dev, so we can directly pass a struct platform_device. Also, unnecessary dev_set_drvdata() is removed, because the driver core clears the driver data to NULL after device_release or on probe failure. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
1 parent d48de6f commit dd3daca

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

drivers/dma/fsldma.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1368,7 +1368,7 @@ static int fsldma_of_probe(struct platform_device *op)
13681368

13691369
dma_set_mask(&(op->dev), DMA_BIT_MASK(36));
13701370

1371-
dev_set_drvdata(&op->dev, fdev);
1371+
platform_set_drvdata(op, fdev);
13721372

13731373
/*
13741374
* We cannot use of_platform_bus_probe() because there is no
@@ -1417,7 +1417,7 @@ static int fsldma_of_remove(struct platform_device *op)
14171417
struct fsldma_device *fdev;
14181418
unsigned int i;
14191419

1420-
fdev = dev_get_drvdata(&op->dev);
1420+
fdev = platform_get_drvdata(op);
14211421
dma_async_device_unregister(&fdev->common);
14221422

14231423
fsldma_free_irqs(fdev);
@@ -1428,7 +1428,6 @@ static int fsldma_of_remove(struct platform_device *op)
14281428
}
14291429

14301430
iounmap(fdev->regs);
1431-
dev_set_drvdata(&op->dev, NULL);
14321431
kfree(fdev);
14331432

14341433
return 0;

drivers/dma/ppc4xx/adma.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4481,7 +4481,7 @@ static int ppc440spe_adma_probe(struct platform_device *ofdev)
44814481
adev->dev = &ofdev->dev;
44824482
adev->common.dev = &ofdev->dev;
44834483
INIT_LIST_HEAD(&adev->common.channels);
4484-
dev_set_drvdata(&ofdev->dev, adev);
4484+
platform_set_drvdata(ofdev, adev);
44854485

44864486
/* create a channel */
44874487
chan = kzalloc(sizeof(*chan), GFP_KERNEL);
@@ -4594,14 +4594,13 @@ static int ppc440spe_adma_probe(struct platform_device *ofdev)
45944594
*/
45954595
static int ppc440spe_adma_remove(struct platform_device *ofdev)
45964596
{
4597-
struct ppc440spe_adma_device *adev = dev_get_drvdata(&ofdev->dev);
4597+
struct ppc440spe_adma_device *adev = platform_get_drvdata(ofdev);
45984598
struct device_node *np = ofdev->dev.of_node;
45994599
struct resource res;
46004600
struct dma_chan *chan, *_chan;
46014601
struct ppc_dma_chan_ref *ref, *_ref;
46024602
struct ppc440spe_adma_chan *ppc440spe_chan;
46034603

4604-
dev_set_drvdata(&ofdev->dev, NULL);
46054604
if (adev->id < PPC440SPE_ADMA_ENGINES_NUM)
46064605
ppc440spe_adma_devices[adev->id] = -1;
46074606

0 commit comments

Comments
 (0)