Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Jingoo Han and committed by
Tejun Heo
d89995db b29900e6

+16 -22
+1 -1
drivers/ata/pata_arasan_cf.c
··· 908 908 909 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 912 struct arasan_cf_dev *acdev = host->ports[0]->private_data; 913 913 914 914 ata_host_detach(host);
+1 -1
drivers/ata/pata_at91.c
··· 422 422 423 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 426 struct at91_ide_info *info; 427 427 428 428 if (!host)
+4 -6
drivers/ata/pata_bf54x.c
··· 1596 1596 return -ENODEV; 1597 1597 } 1598 1598 1599 - dev_set_drvdata(&pdev->dev, host); 1599 + platform_set_drvdata(pdev, host); 1600 1600 1601 1601 return 0; 1602 1602 } ··· 1610 1610 */ 1611 1611 static int bfin_atapi_remove(struct platform_device *pdev) 1612 1612 { 1613 - struct device *dev = &pdev->dev; 1614 - struct ata_host *host = dev_get_drvdata(dev); 1613 + struct ata_host *host = platform_get_drvdata(pdev); 1615 1614 1616 1615 ata_host_detach(host); 1617 - dev_set_drvdata(&pdev->dev, NULL); 1618 1616 1619 1617 peripheral_free_list(atapi_io_port); 1620 1618 ··· 1622 1624 #ifdef CONFIG_PM 1623 1625 static int bfin_atapi_suspend(struct platform_device *pdev, pm_message_t state) 1624 1626 { 1625 - struct ata_host *host = dev_get_drvdata(&pdev->dev); 1627 + struct ata_host *host = platform_get_drvdata(pdev); 1626 1628 if (host) 1627 1629 return ata_host_suspend(host, state); 1628 1630 else ··· 1631 1633 1632 1634 static int bfin_atapi_resume(struct platform_device *pdev) 1633 1635 { 1634 - struct ata_host *host = dev_get_drvdata(&pdev->dev); 1636 + struct ata_host *host = platform_get_drvdata(pdev); 1635 1637 int ret; 1636 1638 1637 1639 if (host) {
+1 -1
drivers/ata/pata_imx.c
··· 177 177 178 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 181 struct pata_imx_priv *priv = host->private_data; 182 182 183 183 ata_host_detach(host);
+2 -2
drivers/ata/pata_mpc52xx.c
··· 825 825 static int 826 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 830 return ata_host_suspend(host, state); 831 831 } ··· 833 833 static int 834 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 837 struct mpc52xx_ata_priv *priv = host->private_data; 838 838 int rv; 839 839
+1 -1
drivers/ata/pata_pxa.c
··· 371 371 372 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 375 struct pata_pxa_data *data = host->ports[0]->private_data; 376 376 377 377 pxa_free_dma(data->dma_channel);
+5 -9
drivers/ata/sata_fsl.c
··· 1532 1532 ata_host_activate(host, irq, sata_fsl_interrupt, SATA_FSL_IRQ_FLAG, 1533 1533 &sata_fsl_sht); 1534 1534 1535 - dev_set_drvdata(&ofdev->dev, host); 1535 + platform_set_drvdata(ofdev, host); 1536 1536 1537 1537 host_priv->intr_coalescing.show = fsl_sata_intr_coalescing_show; 1538 1538 host_priv->intr_coalescing.store = fsl_sata_intr_coalescing_store; ··· 1558 1558 1559 1559 error_exit_with_cleanup: 1560 1560 1561 - if (host) { 1562 - dev_set_drvdata(&ofdev->dev, NULL); 1561 + if (host) 1563 1562 ata_host_detach(host); 1564 - } 1565 1563 1566 1564 if (hcr_base) 1567 1565 iounmap(hcr_base); ··· 1570 1572 1571 1573 static int sata_fsl_remove(struct platform_device *ofdev) 1572 1574 { 1573 - struct ata_host *host = dev_get_drvdata(&ofdev->dev); 1575 + struct ata_host *host = platform_get_drvdata(ofdev); 1574 1576 struct sata_fsl_host_priv *host_priv = host->private_data; 1575 1577 1576 1578 device_remove_file(&ofdev->dev, &host_priv->intr_coalescing); 1577 1579 device_remove_file(&ofdev->dev, &host_priv->rx_watermark); 1578 1580 1579 1581 ata_host_detach(host); 1580 - 1581 - dev_set_drvdata(&ofdev->dev, NULL); 1582 1582 1583 1583 irq_dispose_mapping(host_priv->irq); 1584 1584 iounmap(host_priv->hcr_base); ··· 1588 1592 #ifdef CONFIG_PM 1589 1593 static int sata_fsl_suspend(struct platform_device *op, pm_message_t state) 1590 1594 { 1591 - struct ata_host *host = dev_get_drvdata(&op->dev); 1595 + struct ata_host *host = platform_get_drvdata(op); 1592 1596 return ata_host_suspend(host, state); 1593 1597 } 1594 1598 1595 1599 static int sata_fsl_resume(struct platform_device *op) 1596 1600 { 1597 - struct ata_host *host = dev_get_drvdata(&op->dev); 1601 + struct ata_host *host = platform_get_drvdata(op); 1598 1602 struct sata_fsl_host_priv *host_priv = host->private_data; 1599 1603 int ret; 1600 1604 void __iomem *hcr_base = host_priv->hcr_base;
+1 -1
drivers/ata/sata_rcar.c
··· 825 825 826 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 829 struct sata_rcar_priv *priv = host->private_data; 830 830 831 831 ata_host_detach(host);