]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
ata: use platform_{get,set}_drvdata()
authorJingoo Han <jg1.han@samsung.com>
Thu, 23 May 2013 10:41:21 +0000 (19:41 +0900)
committerTejun Heo <tj@kernel.org>
Fri, 24 May 2013 01:26:13 +0000 (10:26 +0900)
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>
drivers/ata/pata_arasan_cf.c
drivers/ata/pata_at91.c
drivers/ata/pata_bf54x.c
drivers/ata/pata_imx.c
drivers/ata/pata_mpc52xx.c
drivers/ata/pata_pxa.c
drivers/ata/sata_fsl.c
drivers/ata/sata_rcar.c

index 7638121cb5d1eb0447836f47f8ffbef9734d5ef6..848ed3254ddd6892f9f26cf3be0ab7efcb1a8f79 100644 (file)
@@ -908,7 +908,7 @@ static int arasan_cf_probe(struct platform_device *pdev)
 
 static int arasan_cf_remove(struct platform_device *pdev)
 {
-       struct ata_host *host = dev_get_drvdata(&pdev->dev);
+       struct ata_host *host = platform_get_drvdata(pdev);
        struct arasan_cf_dev *acdev = host->ports[0]->private_data;
 
        ata_host_detach(host);
index 033f3f4c20adc9def5cca1a683bdd7e08e5a1fa7..5364f97b42c6b9d6fcac4e130d3172913aa7c80a 100644 (file)
@@ -422,7 +422,7 @@ static int pata_at91_probe(struct platform_device *pdev)
 
 static int pata_at91_remove(struct platform_device *pdev)
 {
-       struct ata_host *host = dev_get_drvdata(&pdev->dev);
+       struct ata_host *host = platform_get_drvdata(pdev);
        struct at91_ide_info *info;
 
        if (!host)
index 8d43510c6becbb14a2e66ae54b92200c568af96a..ba0d8a29dc235ab33de62e5e9eb233afcba47a83 100644 (file)
@@ -1596,7 +1596,7 @@ static int bfin_atapi_probe(struct platform_device *pdev)
                return -ENODEV;
        }
 
-       dev_set_drvdata(&pdev->dev, host);
+       platform_set_drvdata(pdev, host);
 
        return 0;
 }
@@ -1610,11 +1610,9 @@ static int bfin_atapi_probe(struct platform_device *pdev)
  */
 static int bfin_atapi_remove(struct platform_device *pdev)
 {
-       struct device *dev = &pdev->dev;
-       struct ata_host *host = dev_get_drvdata(dev);
+       struct ata_host *host = platform_get_drvdata(pdev);
 
        ata_host_detach(host);
-       dev_set_drvdata(&pdev->dev, NULL);
 
        peripheral_free_list(atapi_io_port);
 
@@ -1624,7 +1622,7 @@ static int bfin_atapi_remove(struct platform_device *pdev)
 #ifdef CONFIG_PM
 static int bfin_atapi_suspend(struct platform_device *pdev, pm_message_t state)
 {
-       struct ata_host *host = dev_get_drvdata(&pdev->dev);
+       struct ata_host *host = platform_get_drvdata(pdev);
        if (host)
                return ata_host_suspend(host, state);
        else
@@ -1633,7 +1631,7 @@ static int bfin_atapi_suspend(struct platform_device *pdev, pm_message_t state)
 
 static int bfin_atapi_resume(struct platform_device *pdev)
 {
-       struct ata_host *host = dev_get_drvdata(&pdev->dev);
+       struct ata_host *host = platform_get_drvdata(pdev);
        int ret;
 
        if (host) {
index aa3d166e02eb87ae698f4abe5bb69c14ea293166..4ec7c04b3f8279dff1f2e39f356106e92815e39f 100644 (file)
@@ -177,7 +177,7 @@ static int pata_imx_probe(struct platform_device *pdev)
 
 static int pata_imx_remove(struct platform_device *pdev)
 {
-       struct ata_host *host = dev_get_drvdata(&pdev->dev);
+       struct ata_host *host = platform_get_drvdata(pdev);
        struct pata_imx_priv *priv = host->private_data;
 
        ata_host_detach(host);
index 3a8fb28b71f28df9129277167703c96706b79d96..0024ced3e2008e7a2e38b6a8715ee95fee405b2b 100644 (file)
@@ -825,7 +825,7 @@ mpc52xx_ata_remove(struct platform_device *op)
 static int
 mpc52xx_ata_suspend(struct platform_device *op, pm_message_t state)
 {
-       struct ata_host *host = dev_get_drvdata(&op->dev);
+       struct ata_host *host = platform_get_drvdata(op);
 
        return ata_host_suspend(host, state);
 }
@@ -833,7 +833,7 @@ mpc52xx_ata_suspend(struct platform_device *op, pm_message_t state)
 static int
 mpc52xx_ata_resume(struct platform_device *op)
 {
-       struct ata_host *host = dev_get_drvdata(&op->dev);
+       struct ata_host *host = platform_get_drvdata(op);
        struct mpc52xx_ata_priv *priv = host->private_data;
        int rv;
 
index b0ac9e0c5e01e647d205e6597f33614098d66a42..942ef94b29e6658a115935c64cc3e81bdf8c1e6b 100644 (file)
@@ -371,7 +371,7 @@ static int pxa_ata_probe(struct platform_device *pdev)
 
 static int pxa_ata_remove(struct platform_device *pdev)
 {
-       struct ata_host *host = dev_get_drvdata(&pdev->dev);
+       struct ata_host *host = platform_get_drvdata(pdev);
        struct pata_pxa_data *data = host->ports[0]->private_data;
 
        pxa_free_dma(data->dma_channel);
index d40e403e82dd259a34ab6a155a88619ba3b3542a..19720a0a4a65ff5c6198ab4e37df7e756ce85717 100644 (file)
@@ -1532,7 +1532,7 @@ static int sata_fsl_probe(struct platform_device *ofdev)
        ata_host_activate(host, irq, sata_fsl_interrupt, SATA_FSL_IRQ_FLAG,
                          &sata_fsl_sht);
 
-       dev_set_drvdata(&ofdev->dev, host);
+       platform_set_drvdata(ofdev, host);
 
        host_priv->intr_coalescing.show = fsl_sata_intr_coalescing_show;
        host_priv->intr_coalescing.store = fsl_sata_intr_coalescing_store;
@@ -1558,10 +1558,8 @@ static int sata_fsl_probe(struct platform_device *ofdev)
 
 error_exit_with_cleanup:
 
-       if (host) {
-               dev_set_drvdata(&ofdev->dev, NULL);
+       if (host)
                ata_host_detach(host);
-       }
 
        if (hcr_base)
                iounmap(hcr_base);
@@ -1572,7 +1570,7 @@ static int sata_fsl_probe(struct platform_device *ofdev)
 
 static int sata_fsl_remove(struct platform_device *ofdev)
 {
-       struct ata_host *host = dev_get_drvdata(&ofdev->dev);
+       struct ata_host *host = platform_get_drvdata(ofdev);
        struct sata_fsl_host_priv *host_priv = host->private_data;
 
        device_remove_file(&ofdev->dev, &host_priv->intr_coalescing);
@@ -1580,8 +1578,6 @@ static int sata_fsl_remove(struct platform_device *ofdev)
 
        ata_host_detach(host);
 
-       dev_set_drvdata(&ofdev->dev, NULL);
-
        irq_dispose_mapping(host_priv->irq);
        iounmap(host_priv->hcr_base);
        kfree(host_priv);
@@ -1592,13 +1588,13 @@ static int sata_fsl_remove(struct platform_device *ofdev)
 #ifdef CONFIG_PM
 static int sata_fsl_suspend(struct platform_device *op, pm_message_t state)
 {
-       struct ata_host *host = dev_get_drvdata(&op->dev);
+       struct ata_host *host = platform_get_drvdata(op);
        return ata_host_suspend(host, state);
 }
 
 static int sata_fsl_resume(struct platform_device *op)
 {
-       struct ata_host *host = dev_get_drvdata(&op->dev);
+       struct ata_host *host = platform_get_drvdata(op);
        struct sata_fsl_host_priv *host_priv = host->private_data;
        int ret;
        void __iomem *hcr_base = host_priv->hcr_base;
index 4799868bd7339c40ad863a317e92e2d0ddfffe9a..889c25a6337ee11ee90b725a8f4d539cd0a0dab1 100644 (file)
@@ -825,7 +825,7 @@ static int sata_rcar_probe(struct platform_device *pdev)
 
 static int sata_rcar_remove(struct platform_device *pdev)
 {
-       struct ata_host *host = dev_get_drvdata(&pdev->dev);
+       struct ata_host *host = platform_get_drvdata(pdev);
        struct sata_rcar_priv *priv = host->private_data;
 
        ata_host_detach(host);