Skip to content

Commit d89995d

Browse files
Jingoo Hanhtejun
authored andcommitted
ata: 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: Tejun Heo <tj@kernel.org>
1 parent b29900e commit d89995d

8 files changed

Lines changed: 16 additions & 22 deletions

File tree

‎drivers/ata/pata_arasan_cf.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -908,7 +908,7 @@ static int arasan_cf_probe(struct platform_device *pdev)
908908

909909
static int arasan_cf_remove(struct platform_device *pdev)
910910
{
911-
struct ata_host *host = dev_get_drvdata(&pdev->dev);
911+
struct ata_host *host = platform_get_drvdata(pdev);
912912
struct arasan_cf_dev *acdev = host->ports[0]->private_data;
913913

914914
ata_host_detach(host);

‎drivers/ata/pata_at91.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ static int pata_at91_probe(struct platform_device *pdev)
422422

423423
static int pata_at91_remove(struct platform_device *pdev)
424424
{
425-
struct ata_host *host = dev_get_drvdata(&pdev->dev);
425+
struct ata_host *host = platform_get_drvdata(pdev);
426426
struct at91_ide_info *info;
427427

428428
if (!host)

‎drivers/ata/pata_bf54x.c‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1596,7 +1596,7 @@ static int bfin_atapi_probe(struct platform_device *pdev)
15961596
return -ENODEV;
15971597
}
15981598

1599-
dev_set_drvdata(&pdev->dev, host);
1599+
platform_set_drvdata(pdev, host);
16001600

16011601
return 0;
16021602
}
@@ -1610,11 +1610,9 @@ static int bfin_atapi_probe(struct platform_device *pdev)
16101610
*/
16111611
static int bfin_atapi_remove(struct platform_device *pdev)
16121612
{
1613-
struct device *dev = &pdev->dev;
1614-
struct ata_host *host = dev_get_drvdata(dev);
1613+
struct ata_host *host = platform_get_drvdata(pdev);
16151614

16161615
ata_host_detach(host);
1617-
dev_set_drvdata(&pdev->dev, NULL);
16181616

16191617
peripheral_free_list(atapi_io_port);
16201618

@@ -1624,7 +1622,7 @@ static int bfin_atapi_remove(struct platform_device *pdev)
16241622
#ifdef CONFIG_PM
16251623
static int bfin_atapi_suspend(struct platform_device *pdev, pm_message_t state)
16261624
{
1627-
struct ata_host *host = dev_get_drvdata(&pdev->dev);
1625+
struct ata_host *host = platform_get_drvdata(pdev);
16281626
if (host)
16291627
return ata_host_suspend(host, state);
16301628
else
@@ -1633,7 +1631,7 @@ static int bfin_atapi_suspend(struct platform_device *pdev, pm_message_t state)
16331631

16341632
static int bfin_atapi_resume(struct platform_device *pdev)
16351633
{
1636-
struct ata_host *host = dev_get_drvdata(&pdev->dev);
1634+
struct ata_host *host = platform_get_drvdata(pdev);
16371635
int ret;
16381636

16391637
if (host) {

‎drivers/ata/pata_imx.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ static int pata_imx_probe(struct platform_device *pdev)
177177

178178
static int pata_imx_remove(struct platform_device *pdev)
179179
{
180-
struct ata_host *host = dev_get_drvdata(&pdev->dev);
180+
struct ata_host *host = platform_get_drvdata(pdev);
181181
struct pata_imx_priv *priv = host->private_data;
182182

183183
ata_host_detach(host);

‎drivers/ata/pata_mpc52xx.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -825,15 +825,15 @@ mpc52xx_ata_remove(struct platform_device *op)
825825
static int
826826
mpc52xx_ata_suspend(struct platform_device *op, pm_message_t state)
827827
{
828-
struct ata_host *host = dev_get_drvdata(&op->dev);
828+
struct ata_host *host = platform_get_drvdata(op);
829829

830830
return ata_host_suspend(host, state);
831831
}
832832

833833
static int
834834
mpc52xx_ata_resume(struct platform_device *op)
835835
{
836-
struct ata_host *host = dev_get_drvdata(&op->dev);
836+
struct ata_host *host = platform_get_drvdata(op);
837837
struct mpc52xx_ata_priv *priv = host->private_data;
838838
int rv;
839839

‎drivers/ata/pata_pxa.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ static int pxa_ata_probe(struct platform_device *pdev)
371371

372372
static int pxa_ata_remove(struct platform_device *pdev)
373373
{
374-
struct ata_host *host = dev_get_drvdata(&pdev->dev);
374+
struct ata_host *host = platform_get_drvdata(pdev);
375375
struct pata_pxa_data *data = host->ports[0]->private_data;
376376

377377
pxa_free_dma(data->dma_channel);

‎drivers/ata/sata_fsl.c‎

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1532,7 +1532,7 @@ static int sata_fsl_probe(struct platform_device *ofdev)
15321532
ata_host_activate(host, irq, sata_fsl_interrupt, SATA_FSL_IRQ_FLAG,
15331533
&sata_fsl_sht);
15341534

1535-
dev_set_drvdata(&ofdev->dev, host);
1535+
platform_set_drvdata(ofdev, host);
15361536

15371537
host_priv->intr_coalescing.show = fsl_sata_intr_coalescing_show;
15381538
host_priv->intr_coalescing.store = fsl_sata_intr_coalescing_store;
@@ -1558,10 +1558,8 @@ static int sata_fsl_probe(struct platform_device *ofdev)
15581558

15591559
error_exit_with_cleanup:
15601560

1561-
if (host) {
1562-
dev_set_drvdata(&ofdev->dev, NULL);
1561+
if (host)
15631562
ata_host_detach(host);
1564-
}
15651563

15661564
if (hcr_base)
15671565
iounmap(hcr_base);
@@ -1572,16 +1570,14 @@ static int sata_fsl_probe(struct platform_device *ofdev)
15721570

15731571
static int sata_fsl_remove(struct platform_device *ofdev)
15741572
{
1575-
struct ata_host *host = dev_get_drvdata(&ofdev->dev);
1573+
struct ata_host *host = platform_get_drvdata(ofdev);
15761574
struct sata_fsl_host_priv *host_priv = host->private_data;
15771575

15781576
device_remove_file(&ofdev->dev, &host_priv->intr_coalescing);
15791577
device_remove_file(&ofdev->dev, &host_priv->rx_watermark);
15801578

15811579
ata_host_detach(host);
15821580

1583-
dev_set_drvdata(&ofdev->dev, NULL);
1584-
15851581
irq_dispose_mapping(host_priv->irq);
15861582
iounmap(host_priv->hcr_base);
15871583
kfree(host_priv);
@@ -1592,13 +1588,13 @@ static int sata_fsl_remove(struct platform_device *ofdev)
15921588
#ifdef CONFIG_PM
15931589
static int sata_fsl_suspend(struct platform_device *op, pm_message_t state)
15941590
{
1595-
struct ata_host *host = dev_get_drvdata(&op->dev);
1591+
struct ata_host *host = platform_get_drvdata(op);
15961592
return ata_host_suspend(host, state);
15971593
}
15981594

15991595
static int sata_fsl_resume(struct platform_device *op)
16001596
{
1601-
struct ata_host *host = dev_get_drvdata(&op->dev);
1597+
struct ata_host *host = platform_get_drvdata(op);
16021598
struct sata_fsl_host_priv *host_priv = host->private_data;
16031599
int ret;
16041600
void __iomem *hcr_base = host_priv->hcr_base;

‎drivers/ata/sata_rcar.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -825,7 +825,7 @@ static int sata_rcar_probe(struct platform_device *pdev)
825825

826826
static int sata_rcar_remove(struct platform_device *pdev)
827827
{
828-
struct ata_host *host = dev_get_drvdata(&pdev->dev);
828+
struct ata_host *host = platform_get_drvdata(pdev);
829829
struct sata_rcar_priv *priv = host->private_data;
830830

831831
ata_host_detach(host);

0 commit comments

Comments
 (0)