Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Axel Lin <axel.lin@ingics.com>
To: Mark Brown <broonie@kernel.org>
Cc: "Vipin Kumar" <vipin.kumar@st.com>,
	alsa-devel@alsa-project.org,
	"Liam Girdwood" <lgirdwood@gmail.com>,
	"Jyri Sarha" <jsarha@ti.com>,
	"Peter Ujfalusi" <peter.ujfalusi@ti.com>,
	"Thomas Niederprüm" <niederp@physik.uni-kl.de>
Subject: [PATCH 2/3] ASoC: omap-mcbsp: Convert to use devm_ioremap_resource
Date: Mon, 24 Aug 2015 16:49:05 +0800	[thread overview]
Message-ID: <1440406145.27868.2.camel@ingics.com> (raw)
In-Reply-To: <1440406056.27868.0.camel@ingics.com>

Use devm_ioremap_resource() instead of open code.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 sound/soc/omap/mcbsp.c | 20 +++++---------------
 1 file changed, 5 insertions(+), 15 deletions(-)

diff --git a/sound/soc/omap/mcbsp.c b/sound/soc/omap/mcbsp.c
index 68a1252..c7563e2 100644
--- a/sound/soc/omap/mcbsp.c
+++ b/sound/soc/omap/mcbsp.c
@@ -965,25 +965,15 @@ int omap_mcbsp_init(struct platform_device *pdev)
 	mcbsp->free = true;
 
 	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mpu");
-	if (!res) {
+	if (!res)
 		res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-		if (!res) {
-			dev_err(mcbsp->dev, "invalid memory resource\n");
-			return -ENOMEM;
-		}
-	}
-	if (!devm_request_mem_region(&pdev->dev, res->start, resource_size(res),
-				     dev_name(&pdev->dev))) {
-		dev_err(mcbsp->dev, "memory region already claimed\n");
-		return -ENODEV;
-	}
+
+	mcbsp->io_base = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(mcbsp->io_base))
+		return PTR_ERR(mcbsp->io_base);
 
 	mcbsp->phys_base = res->start;
 	mcbsp->reg_cache_size = resource_size(res);
-	mcbsp->io_base = devm_ioremap(&pdev->dev, res->start,
-				      resource_size(res));
-	if (!mcbsp->io_base)
-		return -ENOMEM;
 
 	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dma");
 	if (!res)
-- 
2.1.0

  reply	other threads:[~2015-08-24  8:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-24  8:47 [PATCH 1/3] ASoC: davinci: Convert to use devm_ioremap_resource Axel Lin
2015-08-24  8:49 ` Axel Lin [this message]
2015-08-24 10:28   ` [PATCH 2/3] ASoC: omap-mcbsp: " Peter Ujfalusi
2015-08-25  9:36   ` Applied "ASoC: omap-mcbsp: Convert to use devm_ioremap_resource" to the asoc tree Mark Brown
2015-08-24  8:52 ` [PATCH 3/3] ASoC: SPEAr: Convert to use devm_ioremap_resource Axel Lin
2015-08-25  9:36   ` Applied "ASoC: SPEAr: Convert to use devm_ioremap_resource" to the asoc tree Mark Brown
2015-08-24 10:27 ` [PATCH 1/3] ASoC: davinci: Convert to use devm_ioremap_resource Peter Ujfalusi
2015-08-25  9:36 ` Applied "ASoC: davinci: Convert to use devm_ioremap_resource" to the asoc tree Mark Brown

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=1440406145.27868.2.camel@ingics.com \
    --to=axel.lin@ingics.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=jsarha@ti.com \
    --cc=lgirdwood@gmail.com \
    --cc=niederp@physik.uni-kl.de \
    --cc=peter.ujfalusi@ti.com \
    --cc=vipin.kumar@st.com \
    /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