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: alsa-devel@alsa-project.org,
	"Kuninori Morimoto" <kuninori.morimoto.gx@renesas.com>,
	"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 3/3] ASoC: SPEAr: Convert to use devm_ioremap_resource
Date: Mon, 24 Aug 2015 16:52:30 +0800	[thread overview]
Message-ID: <1440406350.27868.5.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/spear/spdif_in.c | 20 +++++---------------
 1 file changed, 5 insertions(+), 15 deletions(-)

diff --git a/sound/soc/spear/spdif_in.c b/sound/soc/spear/spdif_in.c
index a402860..977a078 100644
--- a/sound/soc/spear/spdif_in.c
+++ b/sound/soc/spear/spdif_in.c
@@ -203,35 +203,25 @@ static int spdif_in_probe(struct platform_device *pdev)
 	struct spdif_in_dev *host;
 	struct spear_spdif_platform_data *pdata;
 	struct resource *res, *res_fifo;
+	void __iomem *io_base;
 	int ret;
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!res)
-		return -EINVAL;
+	io_base = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(io_base))
+		return PTR_ERR(io_base);
 
 	res_fifo = platform_get_resource(pdev, IORESOURCE_IO, 0);
 	if (!res_fifo)
 		return -EINVAL;
 
-	if (!devm_request_mem_region(&pdev->dev, res->start,
-				resource_size(res), pdev->name)) {
-		dev_warn(&pdev->dev, "Failed to get memory resourse\n");
-		return -ENOENT;
-	}
-
 	host = devm_kzalloc(&pdev->dev, sizeof(*host), GFP_KERNEL);
 	if (!host) {
 		dev_warn(&pdev->dev, "kzalloc fail\n");
 		return -ENOMEM;
 	}
 
-	host->io_base = devm_ioremap(&pdev->dev, res->start,
-				resource_size(res));
-	if (!host->io_base) {
-		dev_warn(&pdev->dev, "ioremap failed\n");
-		return -ENOMEM;
-	}
-
+	host->io_base = io_base;
 	host->irq = platform_get_irq(pdev, 0);
 	if (host->irq < 0)
 		return -EINVAL;
-- 
2.1.0

  parent reply	other threads:[~2015-08-24  8:52 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 ` [PATCH 2/3] ASoC: omap-mcbsp: " Axel Lin
2015-08-24 10:28   ` 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 ` Axel Lin [this message]
2015-08-25  9:36   ` Applied "ASoC: SPEAr: " 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=1440406350.27868.5.camel@ingics.com \
    --to=axel.lin@ingics.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=jsarha@ti.com \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=lgirdwood@gmail.com \
    --cc=niederp@physik.uni-kl.de \
    --cc=peter.ujfalusi@ti.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