diff options
Diffstat (limited to 'drivers/ata/pata_imx.c')
| -rw-r--r-- | drivers/ata/pata_imx.c | 30 | 
1 files changed, 14 insertions, 16 deletions
diff --git a/drivers/ata/pata_imx.c b/drivers/ata/pata_imx.c index 26386f0b89a..af424573c2f 100644 --- a/drivers/ata/pata_imx.c +++ b/drivers/ata/pata_imx.c @@ -15,7 +15,6 @@   */  #include <linux/kernel.h>  #include <linux/module.h> -#include <linux/init.h>  #include <linux/blkdev.h>  #include <scsi/scsi_host.h>  #include <linux/ata.h> @@ -100,13 +99,9 @@ static int pata_imx_probe(struct platform_device *pdev)  	struct resource *io_res;  	int ret; -	io_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); -	if (io_res == NULL) -		return -EINVAL; -  	irq = platform_get_irq(pdev, 0); -	if (irq <= 0) -		return -EINVAL; +	if (irq < 0) +		return irq;  	priv = devm_kzalloc(&pdev->dev,  				sizeof(struct pata_imx_priv), GFP_KERNEL); @@ -119,7 +114,9 @@ static int pata_imx_probe(struct platform_device *pdev)  		return PTR_ERR(priv->clk);  	} -	clk_prepare_enable(priv->clk); +	ret = clk_prepare_enable(priv->clk); +	if (ret) +		return ret;  	host = ata_host_alloc(&pdev->dev, 1);  	if (!host) { @@ -134,11 +131,10 @@ static int pata_imx_probe(struct platform_device *pdev)  	ap->pio_mask = ATA_PIO0;  	ap->flags |= ATA_FLAG_SLAVE_POSS; -	priv->host_regs = devm_ioremap(&pdev->dev, io_res->start, -		resource_size(io_res)); -	if (!priv->host_regs) { -		dev_err(&pdev->dev, "failed to map IO/CTL base\n"); -		ret = -EBUSY; +	io_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); +	priv->host_regs = devm_ioremap_resource(&pdev->dev, io_res); +	if (IS_ERR(priv->host_regs)) { +		ret = PTR_ERR(priv->host_regs);  		goto err;  	} @@ -189,7 +185,7 @@ static int pata_imx_remove(struct platform_device *pdev)  	return 0;  } -#ifdef CONFIG_PM +#ifdef CONFIG_PM_SLEEP  static int pata_imx_suspend(struct device *dev)  {  	struct ata_host *host = dev_get_drvdata(dev); @@ -212,7 +208,9 @@ static int pata_imx_resume(struct device *dev)  	struct ata_host *host = dev_get_drvdata(dev);  	struct pata_imx_priv *priv = host->private_data; -	clk_prepare_enable(priv->clk); +	int ret = clk_prepare_enable(priv->clk); +	if (ret) +		return ret;  	__raw_writel(priv->ata_ctl, priv->host_regs + PATA_IMX_ATA_CONTROL); @@ -246,7 +244,7 @@ static struct platform_driver pata_imx_driver = {  		.name		= DRV_NAME,  		.of_match_table	= imx_pata_dt_ids,  		.owner		= THIS_MODULE, -#ifdef CONFIG_PM +#ifdef CONFIG_PM_SLEEP  		.pm		= &pata_imx_pm_ops,  #endif  	},  | 
