Linux ATA/IDE development
 help / color / mirror / Atom feed
From: Fabio Estevam <festevam@gmail.com>
To: tj@kernel.org
Cc: linux-ide@vger.kernel.org, sergei.shtylyov@cogentembedded.com,
	Fabio Estevam <fabio.estevam@freescale.com>
Subject: [PATCH v2 1/2] pata_imx: Use devm_ioremap_resource() to simplify code
Date: Mon, 17 Feb 2014 19:05:56 -0300	[thread overview]
Message-ID: <1392674757-1788-1-git-send-email-festevam@gmail.com> (raw)

From: Fabio Estevam <fabio.estevam@freescale.com>

Using devm_ioremap_resource() can lead to code simplication, as we don't need
to explicitily check for error returned by platform_get_resource().

Also, no need to print an error message when devm_ioremap_resource() fails,
as the OOM code code will shout loudly on such condition.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
Changes since v1:
- None

 drivers/ata/pata_imx.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/ata/pata_imx.c b/drivers/ata/pata_imx.c
index 7e69797..3668e78 100644
--- a/drivers/ata/pata_imx.c
+++ b/drivers/ata/pata_imx.c
@@ -99,10 +99,6 @@ 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;
@@ -135,10 +131,9 @@ 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));
+	io_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	priv->host_regs = devm_ioremap_resource(&pdev->dev, io_res);
 	if (!priv->host_regs) {
-		dev_err(&pdev->dev, "failed to map IO/CTL base\n");
 		ret = -EBUSY;
 		goto err;
 	}
-- 
1.8.1.2


             reply	other threads:[~2014-02-17 22:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-17 22:05 Fabio Estevam [this message]
2014-02-17 22:05 ` [PATCH v2 2/2] pata_imx: Propagate the real error code on platform_get_irq() failure Fabio Estevam
2014-02-17 23:12 ` [PATCH v2 1/2] pata_imx: Use devm_ioremap_resource() to simplify code Sergei Shtylyov
2014-02-18 22:41 ` Tejun Heo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1392674757-1788-1-git-send-email-festevam@gmail.com \
    --to=festevam@gmail.com \
    --cc=fabio.estevam@freescale.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=sergei.shtylyov@cogentembedded.com \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox