public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
To: Huang Shijie <b32955@freescale.com>
Cc: linux-mtd@lists.infradead.org, computersforpeace@gmail.com,
	dwmw2@infradead.org, dedekind1@gmail.com
Subject: Re: [PATCH 5/8] mtd: gpmi: use devm_ioremap_resource
Date: Thu, 14 Nov 2013 10:50:34 -0300	[thread overview]
Message-ID: <20131114135033.GB7076@localhost> (raw)
In-Reply-To: <1384410351-2169-6-git-send-email-b32955@freescale.com>

On Thu, Nov 14, 2013 at 02:25:48PM +0800, Huang Shijie wrote:
> Use the devm_ioremap_resource to simplify the code.
> 
> Signed-off-by: Huang Shijie <b32955@freescale.com>
> ---
>  drivers/mtd/nand/gpmi-nand/gpmi-nand.c |   26 +++-----------------------
>  1 files changed, 3 insertions(+), 23 deletions(-)
> 
> diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
> index 36ef60a..1f99038 100644
> --- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
> +++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
> @@ -486,16 +486,9 @@ static int acquire_register_block(struct gpmi_nand_data *this,
>  	void __iomem *p;
>  
>  	r = platform_get_resource_byname(pdev, IORESOURCE_MEM, res_name);
> -	if (!r) {
> -		pr_err("Can't get resource for %s\n", res_name);
> -		return -ENODEV;
> -	}
> -
> -	p = ioremap(r->start, resource_size(r));
> -	if (!p) {
> -		pr_err("Can't remap %s\n", res_name);
> -		return -ENOMEM;
> -	}
> +	p = devm_ioremap_resource(&pdev->dev, r);
> +	if (IS_ERR(p))
> +		return PTR_ERR(p);

Hm... devm_ioremap_resource() is not "pin-to-pin" replacement for the
combination of platform_get_resource + ioremap. Instead, you're adding
a request_memory() call.

So, this is an improvement, and it's fine to do so. I'm just warning
about a change in the driver's behavior.
-- 
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com

  reply	other threads:[~2013-11-14 13:50 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-14  6:25 [PATCH 0/8] the clean-up for gpmi Huang Shijie
2013-11-14  6:25 ` [PATCH 1/8] mtd: gpmi: do not use the local array to do the DMA transfer Huang Shijie
2013-11-14 13:46   ` Ezequiel Garcia
2013-11-15  3:53     ` Huang Shijie
2013-11-14 16:23       ` David Woodhouse
2013-11-15  2:14         ` Huang Shijie
2013-11-14  6:25 ` [PATCH 2/8] mtd: gpmi: delete the gpmi_pre_bbt_scan Huang Shijie
2013-11-14  6:25 ` [PATCH 3/8] mtd: gpmi: remove the unused line Huang Shijie
2013-11-14  6:25 ` [PATCH 4/8] mtd: gpmi: rename the functions from gpmi_nfc_* to gpmi_nand_* Huang Shijie
2013-11-14  6:25 ` [PATCH 5/8] mtd: gpmi: use devm_ioremap_resource Huang Shijie
2013-11-14 13:50   ` Ezequiel Garcia [this message]
2013-11-15  3:51     ` Huang Shijie
2013-11-14  6:25 ` [PATCH 6/8] mtd: gpmi: use devm_request_irq Huang Shijie
2013-11-14  6:25 ` [PATCH 7/8] mtd: gpmi: change pr_err to dev_err Huang Shijie
2013-11-18 20:23   ` Brian Norris
2013-11-19  2:30     ` Huang Shijie
2013-11-14  6:25 ` [PATCH 8/8] mtd: gpmi: change pr_debug to dev_dbg Huang Shijie
2013-11-18 20:24   ` Brian Norris
2013-11-18 20:25 ` [PATCH 0/8] the clean-up for gpmi Brian Norris

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=20131114135033.GB7076@localhost \
    --to=ezequiel.garcia@free-electrons.com \
    --cc=b32955@freescale.com \
    --cc=computersforpeace@gmail.com \
    --cc=dedekind1@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=linux-mtd@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox