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>
This commit is contained in:
parent
b29900e625
commit
d89995db5f
@ -908,7 +908,7 @@ free_clk:
|
||||
|
||||
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);
|
||||
|
@ -422,7 +422,7 @@ err_put:
|
||||
|
||||
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)
|
||||
|
@ -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) {
|
||||
|
@ -177,7 +177,7 @@ err:
|
||||
|
||||
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);
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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 @@ error_exit_with_cleanup:
|
||||
|
||||
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;
|
||||
|
@ -825,7 +825,7 @@ cleanup:
|
||||
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user