diff options
author | Jingoo Han <jg1.han@samsung.com> | 2013-05-23 06:41:21 -0400 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2013-05-23 21:26:13 -0400 |
commit | d89995db5f238e618389604b848b431da240eb69 (patch) | |
tree | b9d7d30ea21b911705f061b10ac3bc2460380c91 | |
parent | b29900e62598cecd519c9ab2b8e4d03f8ebf702d (diff) |
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>
-rw-r--r-- | drivers/ata/pata_arasan_cf.c | 2 | ||||
-rw-r--r-- | drivers/ata/pata_at91.c | 2 | ||||
-rw-r--r-- | drivers/ata/pata_bf54x.c | 10 | ||||
-rw-r--r-- | drivers/ata/pata_imx.c | 2 | ||||
-rw-r--r-- | drivers/ata/pata_mpc52xx.c | 4 | ||||
-rw-r--r-- | drivers/ata/pata_pxa.c | 2 | ||||
-rw-r--r-- | drivers/ata/sata_fsl.c | 14 | ||||
-rw-r--r-- | drivers/ata/sata_rcar.c | 2 |
8 files changed, 16 insertions, 22 deletions
diff --git a/drivers/ata/pata_arasan_cf.c b/drivers/ata/pata_arasan_cf.c index 7638121cb5d1..848ed3254ddd 100644 --- a/drivers/ata/pata_arasan_cf.c +++ b/drivers/ata/pata_arasan_cf.c | |||
@@ -908,7 +908,7 @@ free_clk: | |||
908 | 908 | ||
909 | static int arasan_cf_remove(struct platform_device *pdev) | 909 | static int arasan_cf_remove(struct platform_device *pdev) |
910 | { | 910 | { |
911 | struct ata_host *host = dev_get_drvdata(&pdev->dev); | 911 | struct ata_host *host = platform_get_drvdata(pdev); |
912 | struct arasan_cf_dev *acdev = host->ports[0]->private_data; | 912 | struct arasan_cf_dev *acdev = host->ports[0]->private_data; |
913 | 913 | ||
914 | ata_host_detach(host); | 914 | ata_host_detach(host); |
diff --git a/drivers/ata/pata_at91.c b/drivers/ata/pata_at91.c index 033f3f4c20ad..5364f97b42c6 100644 --- a/drivers/ata/pata_at91.c +++ b/drivers/ata/pata_at91.c | |||
@@ -422,7 +422,7 @@ err_put: | |||
422 | 422 | ||
423 | static int pata_at91_remove(struct platform_device *pdev) | 423 | static int pata_at91_remove(struct platform_device *pdev) |
424 | { | 424 | { |
425 | struct ata_host *host = dev_get_drvdata(&pdev->dev); | 425 | struct ata_host *host = platform_get_drvdata(pdev); |
426 | struct at91_ide_info *info; | 426 | struct at91_ide_info *info; |
427 | 427 | ||
428 | if (!host) | 428 | if (!host) |
diff --git a/drivers/ata/pata_bf54x.c b/drivers/ata/pata_bf54x.c index 8d43510c6bec..ba0d8a29dc23 100644 --- a/drivers/ata/pata_bf54x.c +++ b/drivers/ata/pata_bf54x.c | |||
@@ -1596,7 +1596,7 @@ static int bfin_atapi_probe(struct platform_device *pdev) | |||
1596 | return -ENODEV; | 1596 | return -ENODEV; |
1597 | } | 1597 | } |
1598 | 1598 | ||
1599 | dev_set_drvdata(&pdev->dev, host); | 1599 | platform_set_drvdata(pdev, host); |
1600 | 1600 | ||
1601 | return 0; | 1601 | return 0; |
1602 | } | 1602 | } |
@@ -1610,11 +1610,9 @@ static int bfin_atapi_probe(struct platform_device *pdev) | |||
1610 | */ | 1610 | */ |
1611 | static int bfin_atapi_remove(struct platform_device *pdev) | 1611 | static int bfin_atapi_remove(struct platform_device *pdev) |
1612 | { | 1612 | { |
1613 | struct device *dev = &pdev->dev; | 1613 | struct ata_host *host = platform_get_drvdata(pdev); |
1614 | struct ata_host *host = dev_get_drvdata(dev); | ||
1615 | 1614 | ||
1616 | ata_host_detach(host); | 1615 | ata_host_detach(host); |
1617 | dev_set_drvdata(&pdev->dev, NULL); | ||
1618 | 1616 | ||
1619 | peripheral_free_list(atapi_io_port); | 1617 | peripheral_free_list(atapi_io_port); |
1620 | 1618 | ||
@@ -1624,7 +1622,7 @@ static int bfin_atapi_remove(struct platform_device *pdev) | |||
1624 | #ifdef CONFIG_PM | 1622 | #ifdef CONFIG_PM |
1625 | static int bfin_atapi_suspend(struct platform_device *pdev, pm_message_t state) | 1623 | static int bfin_atapi_suspend(struct platform_device *pdev, pm_message_t state) |
1626 | { | 1624 | { |
1627 | struct ata_host *host = dev_get_drvdata(&pdev->dev); | 1625 | struct ata_host *host = platform_get_drvdata(pdev); |
1628 | if (host) | 1626 | if (host) |
1629 | return ata_host_suspend(host, state); | 1627 | return ata_host_suspend(host, state); |
1630 | else | 1628 | else |
@@ -1633,7 +1631,7 @@ static int bfin_atapi_suspend(struct platform_device *pdev, pm_message_t state) | |||
1633 | 1631 | ||
1634 | static int bfin_atapi_resume(struct platform_device *pdev) | 1632 | static int bfin_atapi_resume(struct platform_device *pdev) |
1635 | { | 1633 | { |
1636 | struct ata_host *host = dev_get_drvdata(&pdev->dev); | 1634 | struct ata_host *host = platform_get_drvdata(pdev); |
1637 | int ret; | 1635 | int ret; |
1638 | 1636 | ||
1639 | if (host) { | 1637 | if (host) { |
diff --git a/drivers/ata/pata_imx.c b/drivers/ata/pata_imx.c index aa3d166e02eb..4ec7c04b3f82 100644 --- a/drivers/ata/pata_imx.c +++ b/drivers/ata/pata_imx.c | |||
@@ -177,7 +177,7 @@ err: | |||
177 | 177 | ||
178 | static int pata_imx_remove(struct platform_device *pdev) | 178 | static int pata_imx_remove(struct platform_device *pdev) |
179 | { | 179 | { |
180 | struct ata_host *host = dev_get_drvdata(&pdev->dev); | 180 | struct ata_host *host = platform_get_drvdata(pdev); |
181 | struct pata_imx_priv *priv = host->private_data; | 181 | struct pata_imx_priv *priv = host->private_data; |
182 | 182 | ||
183 | ata_host_detach(host); | 183 | ata_host_detach(host); |
diff --git a/drivers/ata/pata_mpc52xx.c b/drivers/ata/pata_mpc52xx.c index 3a8fb28b71f2..0024ced3e200 100644 --- a/drivers/ata/pata_mpc52xx.c +++ b/drivers/ata/pata_mpc52xx.c | |||
@@ -825,7 +825,7 @@ mpc52xx_ata_remove(struct platform_device *op) | |||
825 | static int | 825 | static int |
826 | mpc52xx_ata_suspend(struct platform_device *op, pm_message_t state) | 826 | mpc52xx_ata_suspend(struct platform_device *op, pm_message_t state) |
827 | { | 827 | { |
828 | struct ata_host *host = dev_get_drvdata(&op->dev); | 828 | struct ata_host *host = platform_get_drvdata(op); |
829 | 829 | ||
830 | return ata_host_suspend(host, state); | 830 | return ata_host_suspend(host, state); |
831 | } | 831 | } |
@@ -833,7 +833,7 @@ mpc52xx_ata_suspend(struct platform_device *op, pm_message_t state) | |||
833 | static int | 833 | static int |
834 | mpc52xx_ata_resume(struct platform_device *op) | 834 | mpc52xx_ata_resume(struct platform_device *op) |
835 | { | 835 | { |
836 | struct ata_host *host = dev_get_drvdata(&op->dev); | 836 | struct ata_host *host = platform_get_drvdata(op); |
837 | struct mpc52xx_ata_priv *priv = host->private_data; | 837 | struct mpc52xx_ata_priv *priv = host->private_data; |
838 | int rv; | 838 | int rv; |
839 | 839 | ||
diff --git a/drivers/ata/pata_pxa.c b/drivers/ata/pata_pxa.c index b0ac9e0c5e01..942ef94b29e6 100644 --- a/drivers/ata/pata_pxa.c +++ b/drivers/ata/pata_pxa.c | |||
@@ -371,7 +371,7 @@ static int pxa_ata_probe(struct platform_device *pdev) | |||
371 | 371 | ||
372 | static int pxa_ata_remove(struct platform_device *pdev) | 372 | static int pxa_ata_remove(struct platform_device *pdev) |
373 | { | 373 | { |
374 | struct ata_host *host = dev_get_drvdata(&pdev->dev); | 374 | struct ata_host *host = platform_get_drvdata(pdev); |
375 | struct pata_pxa_data *data = host->ports[0]->private_data; | 375 | struct pata_pxa_data *data = host->ports[0]->private_data; |
376 | 376 | ||
377 | pxa_free_dma(data->dma_channel); | 377 | pxa_free_dma(data->dma_channel); |
diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c index d40e403e82dd..19720a0a4a65 100644 --- a/drivers/ata/sata_fsl.c +++ b/drivers/ata/sata_fsl.c | |||
@@ -1532,7 +1532,7 @@ static int sata_fsl_probe(struct platform_device *ofdev) | |||
1532 | ata_host_activate(host, irq, sata_fsl_interrupt, SATA_FSL_IRQ_FLAG, | 1532 | ata_host_activate(host, irq, sata_fsl_interrupt, SATA_FSL_IRQ_FLAG, |
1533 | &sata_fsl_sht); | 1533 | &sata_fsl_sht); |
1534 | 1534 | ||
1535 | dev_set_drvdata(&ofdev->dev, host); | 1535 | platform_set_drvdata(ofdev, host); |
1536 | 1536 | ||
1537 | host_priv->intr_coalescing.show = fsl_sata_intr_coalescing_show; | 1537 | host_priv->intr_coalescing.show = fsl_sata_intr_coalescing_show; |
1538 | host_priv->intr_coalescing.store = fsl_sata_intr_coalescing_store; | 1538 | host_priv->intr_coalescing.store = fsl_sata_intr_coalescing_store; |
@@ -1558,10 +1558,8 @@ static int sata_fsl_probe(struct platform_device *ofdev) | |||
1558 | 1558 | ||
1559 | error_exit_with_cleanup: | 1559 | error_exit_with_cleanup: |
1560 | 1560 | ||
1561 | if (host) { | 1561 | if (host) |
1562 | dev_set_drvdata(&ofdev->dev, NULL); | ||
1563 | ata_host_detach(host); | 1562 | ata_host_detach(host); |
1564 | } | ||
1565 | 1563 | ||
1566 | if (hcr_base) | 1564 | if (hcr_base) |
1567 | iounmap(hcr_base); | 1565 | iounmap(hcr_base); |
@@ -1572,7 +1570,7 @@ error_exit_with_cleanup: | |||
1572 | 1570 | ||
1573 | static int sata_fsl_remove(struct platform_device *ofdev) | 1571 | static int sata_fsl_remove(struct platform_device *ofdev) |
1574 | { | 1572 | { |
1575 | struct ata_host *host = dev_get_drvdata(&ofdev->dev); | 1573 | struct ata_host *host = platform_get_drvdata(ofdev); |
1576 | struct sata_fsl_host_priv *host_priv = host->private_data; | 1574 | struct sata_fsl_host_priv *host_priv = host->private_data; |
1577 | 1575 | ||
1578 | device_remove_file(&ofdev->dev, &host_priv->intr_coalescing); | 1576 | device_remove_file(&ofdev->dev, &host_priv->intr_coalescing); |
@@ -1580,8 +1578,6 @@ static int sata_fsl_remove(struct platform_device *ofdev) | |||
1580 | 1578 | ||
1581 | ata_host_detach(host); | 1579 | ata_host_detach(host); |
1582 | 1580 | ||
1583 | dev_set_drvdata(&ofdev->dev, NULL); | ||
1584 | |||
1585 | irq_dispose_mapping(host_priv->irq); | 1581 | irq_dispose_mapping(host_priv->irq); |
1586 | iounmap(host_priv->hcr_base); | 1582 | iounmap(host_priv->hcr_base); |
1587 | kfree(host_priv); | 1583 | kfree(host_priv); |
@@ -1592,13 +1588,13 @@ static int sata_fsl_remove(struct platform_device *ofdev) | |||
1592 | #ifdef CONFIG_PM | 1588 | #ifdef CONFIG_PM |
1593 | static int sata_fsl_suspend(struct platform_device *op, pm_message_t state) | 1589 | static int sata_fsl_suspend(struct platform_device *op, pm_message_t state) |
1594 | { | 1590 | { |
1595 | struct ata_host *host = dev_get_drvdata(&op->dev); | 1591 | struct ata_host *host = platform_get_drvdata(op); |
1596 | return ata_host_suspend(host, state); | 1592 | return ata_host_suspend(host, state); |
1597 | } | 1593 | } |
1598 | 1594 | ||
1599 | static int sata_fsl_resume(struct platform_device *op) | 1595 | static int sata_fsl_resume(struct platform_device *op) |
1600 | { | 1596 | { |
1601 | struct ata_host *host = dev_get_drvdata(&op->dev); | 1597 | struct ata_host *host = platform_get_drvdata(op); |
1602 | struct sata_fsl_host_priv *host_priv = host->private_data; | 1598 | struct sata_fsl_host_priv *host_priv = host->private_data; |
1603 | int ret; | 1599 | int ret; |
1604 | void __iomem *hcr_base = host_priv->hcr_base; | 1600 | void __iomem *hcr_base = host_priv->hcr_base; |
diff --git a/drivers/ata/sata_rcar.c b/drivers/ata/sata_rcar.c index 4799868bd733..889c25a6337e 100644 --- a/drivers/ata/sata_rcar.c +++ b/drivers/ata/sata_rcar.c | |||
@@ -825,7 +825,7 @@ cleanup: | |||
825 | 825 | ||
826 | static int sata_rcar_remove(struct platform_device *pdev) | 826 | static int sata_rcar_remove(struct platform_device *pdev) |
827 | { | 827 | { |
828 | struct ata_host *host = dev_get_drvdata(&pdev->dev); | 828 | struct ata_host *host = platform_get_drvdata(pdev); |
829 | struct sata_rcar_priv *priv = host->private_data; | 829 | struct sata_rcar_priv *priv = host->private_data; |
830 | 830 | ||
831 | ata_host_detach(host); | 831 | ata_host_detach(host); |