All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Ujfalusi <peter.ujfalusi@ti.com>
To: Axel Lin <axel.lin@ingics.com>, Mark Brown <broonie@kernel.org>
Cc: "Vipin Kumar" <vipin.kumar@st.com>,
	alsa-devel@alsa-project.org,
	"Thomas Niederprüm" <niederp@physik.uni-kl.de>,
	"Jyri Sarha" <jsarha@ti.com>,
	"Liam Girdwood" <lgirdwood@gmail.com>
Subject: Re: [PATCH 1/3] ASoC: davinci: Convert to use devm_ioremap_resource
Date: Mon, 24 Aug 2015 13:27:48 +0300	[thread overview]
Message-ID: <55DAF1A4.4080303@ti.com> (raw)
In-Reply-To: <1440406056.27868.0.camel@ingics.com>

On 08/24/2015 11:47 AM, Axel Lin wrote:
> Use devm_ioremap_resource() instead of open code.

Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com>

> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> ---
>  sound/soc/davinci/davinci-i2s.c   | 25 ++++++-------------------
>  sound/soc/davinci/davinci-mcasp.c | 18 ++++--------------
>  2 files changed, 10 insertions(+), 33 deletions(-)
> 
> diff --git a/sound/soc/davinci/davinci-i2s.c b/sound/soc/davinci/davinci-i2s.c
> index 56cb4d9..ec98548 100644
> --- a/sound/soc/davinci/davinci-i2s.c
> +++ b/sound/soc/davinci/davinci-i2s.c
> @@ -651,23 +651,15 @@ static const struct snd_soc_component_driver davinci_i2s_component = {
>  static int davinci_i2s_probe(struct platform_device *pdev)
>  {
>  	struct davinci_mcbsp_dev *dev;
> -	struct resource *mem, *ioarea, *res;
> +	struct resource *mem, *res;
> +	void __iomem *io_base;
>  	int *dma;
>  	int ret;
>  
>  	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -	if (!mem) {
> -		dev_err(&pdev->dev, "no mem resource?\n");
> -		return -ENODEV;
> -	}
> -
> -	ioarea = devm_request_mem_region(&pdev->dev, mem->start,
> -					 resource_size(mem),
> -					 pdev->name);
> -	if (!ioarea) {
> -		dev_err(&pdev->dev, "McBSP region already claimed\n");
> -		return -EBUSY;
> -	}
> +	io_base = devm_ioremap_resource(&pdev->dev, mem);
> +	if (IS_ERR(io_base))
> +		return PTR_ERR(io_base);
>  
>  	dev = devm_kzalloc(&pdev->dev, sizeof(struct davinci_mcbsp_dev),
>  			   GFP_KERNEL);
> @@ -679,12 +671,7 @@ static int davinci_i2s_probe(struct platform_device *pdev)
>  		return -ENODEV;
>  	clk_enable(dev->clk);
>  
> -	dev->base = devm_ioremap(&pdev->dev, mem->start, resource_size(mem));
> -	if (!dev->base) {
> -		dev_err(&pdev->dev, "ioremap failed\n");
> -		ret = -ENOMEM;
> -		goto err_release_clk;
> -	}
> +	dev->base = io_base;
>  
>  	dev->dma_data[SNDRV_PCM_STREAM_PLAYBACK].addr =
>  	    (dma_addr_t)(mem->start + DAVINCI_MCBSP_DXR_REG);
> diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c
> index b960e62..add6bb9 100644
> --- a/sound/soc/davinci/davinci-mcasp.c
> +++ b/sound/soc/davinci/davinci-mcasp.c
> @@ -1613,7 +1613,7 @@ static int davinci_mcasp_get_dma_type(struct davinci_mcasp *mcasp)
>  static int davinci_mcasp_probe(struct platform_device *pdev)
>  {
>  	struct snd_dmaengine_dai_dma_data *dma_data;
> -	struct resource *mem, *ioarea, *res, *dat;
> +	struct resource *mem, *res, *dat;
>  	struct davinci_mcasp_pdata *pdata;
>  	struct davinci_mcasp *mcasp;
>  	char *irq_name;
> @@ -1648,22 +1648,12 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
>  		}
>  	}
>  
> -	ioarea = devm_request_mem_region(&pdev->dev, mem->start,
> -			resource_size(mem), pdev->name);
> -	if (!ioarea) {
> -		dev_err(&pdev->dev, "Audio region already claimed\n");
> -		return -EBUSY;
> -	}
> +	mcasp->base = devm_ioremap_resource(&pdev->dev, mem);
> +	if (IS_ERR(mcasp->base))
> +		return PTR_ERR(mcasp->base);
>  
>  	pm_runtime_enable(&pdev->dev);
>  
> -	mcasp->base = devm_ioremap(&pdev->dev, mem->start, resource_size(mem));
> -	if (!mcasp->base) {
> -		dev_err(&pdev->dev, "ioremap failed\n");
> -		ret = -ENOMEM;
> -		goto err;
> -	}
> -
>  	mcasp->op_mode = pdata->op_mode;
>  	/* sanity check for tdm slots parameter */
>  	if (mcasp->op_mode == DAVINCI_MCASP_IIS_MODE) {
> 


-- 
Péter
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

  parent reply	other threads:[~2015-08-24 10:27 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 ` [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 ` Peter Ujfalusi [this message]
2015-08-25  9:36 ` Applied "ASoC: davinci: " 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=55DAF1A4.4080303@ti.com \
    --to=peter.ujfalusi@ti.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=axel.lin@ingics.com \
    --cc=broonie@kernel.org \
    --cc=jsarha@ti.com \
    --cc=lgirdwood@gmail.com \
    --cc=niederp@physik.uni-kl.de \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.