All of lore.kernel.org
 help / color / mirror / Atom feed
From: sergei.shtylyov@cogentembedded.com (Sergei Shtylyov)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: davinci: dma: Convert to devm_* api
Date: Thu, 16 May 2013 17:17:30 +0400	[thread overview]
Message-ID: <5194DC6A.8080609@cogentembedded.com> (raw)
In-Reply-To: <1368687502-15551-1-git-send-email-prabhakar.csengg@gmail.com>

Hello.

On 16-05-2013 10:58, Lad Prabhakar wrote:

> From: Lad, Prabhakar <prabhakar.csengg@gmail.com>

> Use devm_ioremap_resource instead of reques_mem_region()/ioremap() and
> devm_request_irq() instead of request_irq().

> This ensures more consistent error values and simplifies error paths.

> Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
> ---
>   NOte:- Boot tested on Logic-PD OMAP-L138 EVM

>   arch/arm/mach-davinci/dma.c |   63 ++++++++++++++++--------------------------
>   1 files changed, 24 insertions(+), 39 deletions(-)

> diff --git a/arch/arm/mach-davinci/dma.c b/arch/arm/mach-davinci/dma.c
> index 45b7c71..aeda496 100644
> --- a/arch/arm/mach-davinci/dma.c
> +++ b/arch/arm/mach-davinci/dma.c
[...]
> @@ -1422,25 +1421,16 @@ static int __init edma_probe(struct platform_device *pdev)
>   			found = 1;
>   		}
>
> -		len[j] = resource_size(r[j]);
> -
> -		r[j] = request_mem_region(r[j]->start, len[j],
> -			dev_name(&pdev->dev));
> -		if (!r[j]) {
> -			status = -EBUSY;
> -			goto fail1;
> -		}
> -
> -		edmacc_regs_base[j] = ioremap(r[j]->start, len[j]);
> -		if (!edmacc_regs_base[j]) {
> +		edmacc_regs_base[j] = devm_ioremap_resource(&pdev->dev, r[j]);
> +		if (IS_ERR(edmacc_regs_base[j])) {
>   			status = -EBUSY;

    And you call that "more consistent error values"? Why not:

			status = PTR_ERR(edmacc_regs_base[j]);

>  		edma_cc[j] = kzalloc(sizeof(struct edma), GFP_KERNEL);

    Maybe it's worth using devm_kzalloc() too?

WBR, Sergei

WARNING: multiple messages have this Message-ID (diff)
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Lad Prabhakar <prabhakar.csengg@gmail.com>
Cc: Sekhar Nori <nsekhar@ti.com>,
	DLOS <davinci-linux-open-source@linux.davincidsp.com>,
	LAK <linux-arm-kernel@lists.infradead.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] ARM: davinci: dma: Convert to devm_* api
Date: Thu, 16 May 2013 17:17:30 +0400	[thread overview]
Message-ID: <5194DC6A.8080609@cogentembedded.com> (raw)
In-Reply-To: <1368687502-15551-1-git-send-email-prabhakar.csengg@gmail.com>

Hello.

On 16-05-2013 10:58, Lad Prabhakar wrote:

> From: Lad, Prabhakar <prabhakar.csengg@gmail.com>

> Use devm_ioremap_resource instead of reques_mem_region()/ioremap() and
> devm_request_irq() instead of request_irq().

> This ensures more consistent error values and simplifies error paths.

> Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
> ---
>   NOte:- Boot tested on Logic-PD OMAP-L138 EVM

>   arch/arm/mach-davinci/dma.c |   63 ++++++++++++++++--------------------------
>   1 files changed, 24 insertions(+), 39 deletions(-)

> diff --git a/arch/arm/mach-davinci/dma.c b/arch/arm/mach-davinci/dma.c
> index 45b7c71..aeda496 100644
> --- a/arch/arm/mach-davinci/dma.c
> +++ b/arch/arm/mach-davinci/dma.c
[...]
> @@ -1422,25 +1421,16 @@ static int __init edma_probe(struct platform_device *pdev)
>   			found = 1;
>   		}
>
> -		len[j] = resource_size(r[j]);
> -
> -		r[j] = request_mem_region(r[j]->start, len[j],
> -			dev_name(&pdev->dev));
> -		if (!r[j]) {
> -			status = -EBUSY;
> -			goto fail1;
> -		}
> -
> -		edmacc_regs_base[j] = ioremap(r[j]->start, len[j]);
> -		if (!edmacc_regs_base[j]) {
> +		edmacc_regs_base[j] = devm_ioremap_resource(&pdev->dev, r[j]);
> +		if (IS_ERR(edmacc_regs_base[j])) {
>   			status = -EBUSY;

    And you call that "more consistent error values"? Why not:

			status = PTR_ERR(edmacc_regs_base[j]);

>  		edma_cc[j] = kzalloc(sizeof(struct edma), GFP_KERNEL);

    Maybe it's worth using devm_kzalloc() too?

WBR, Sergei


  reply	other threads:[~2013-05-16 13:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-16  6:58 [PATCH] ARM: davinci: dma: Convert to devm_* api Lad Prabhakar
2013-05-16  6:58 ` Lad Prabhakar
2013-05-16 13:17 ` Sergei Shtylyov [this message]
2013-05-16 13:17   ` Sergei Shtylyov
2013-05-17  4:58   ` Prabhakar Lad
2013-05-17  4:58     ` Prabhakar Lad

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=5194DC6A.8080609@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.com \
    --cc=linux-arm-kernel@lists.infradead.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 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.