From: Rob Herring <robherring2@gmail.com>
To: "Karicheri, Muralidharan" <m-karicheri2@ti.com>
Cc: "grant.likely@secretlab.ca" <grant.likely@secretlab.ca>,
"devicetree-discuss@lists.ozlabs.org"
<devicetree-discuss@lists.ozlabs.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] of: add devres version of of_iomap
Date: Thu, 30 Aug 2012 21:53:03 -0500 [thread overview]
Message-ID: <5040270F.6060302@gmail.com> (raw)
In-Reply-To: <3E54258959B69E4282D79E01AB1F32B7041AD91C@DFLE12.ent.ti.com>
On 08/30/2012 05:09 PM, Karicheri, Muralidharan wrote:
>>> -----Original Message-----
>>> From: Rob Herring [mailto:robherring2@gmail.com]
>>> Sent: Thursday, August 30, 2012 2:27 PM
>>> To: Karicheri, Muralidharan
>>> Cc: grant.likely@secretlab.ca; devicetree-discuss@lists.ozlabs.org; linux-
>>> kernel@vger.kernel.org
>>> Subject: Re: [PATCH] of: add devres version of of_iomap
>>>
>>> On 08/30/2012 10:32 AM, Murali Karicheri wrote:
>>>> This adds devres version of the of_iomap() to allow resource to be cleaned
>>>> through devres.
>>>
>>> If you have a struct device, then don't you already have a resource and
>>> can just use devm_ioremap in a driver? New drivers should not be using
>>> of_iomap.
>>>
>
> That is the point. If you do a grep under driver, there are many drivers using the pattern
> like this. This helper function is mean to replace this code.
>
> From dma/sirf-dma.c
>
> ret = of_address_to_resource(dn, 0, &res);
> if (ret) {
> dev_err(dev, "Error parsing memory region!\n");
> goto error;
> }
>
> regs_start = res.start;
> regs_size = resource_size(&res);
>
> base = devm_ioremap(dev, regs_start, regs_size);
> if (!base) {
> dev_err(dev, "Error mapping memory region!\n");
> goto error;
> }
>
That's wrong and should be fixed. The resource is already setup and
available to the probe function.
> Other instances.
>
> edac/mpc85xx_edac.c
> media/video/fsl-viu.c
> mtd/nand/mpc5121_nfc.c
All PPC drivers that used the old of_platform_driver and also need to be
updated.
>
> Some of these code uses devm_request_mem_region() as well. Isn't a good idea to add this helper
> that can be called by new drivers to replace this sequence? I could update the patch to do this call
> as well?
devm_request_and_ioremap
Rob
prev parent reply other threads:[~2012-08-31 2:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1346340744-22218-1-git-send-email-m-karicheri2@ti.com>
2012-08-30 18:27 ` [PATCH] of: add devres version of of_iomap Rob Herring
2012-08-30 22:09 ` Karicheri, Muralidharan
2012-08-31 2:53 ` Rob Herring [this message]
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=5040270F.6060302@gmail.com \
--to=robherring2@gmail.com \
--cc=devicetree-discuss@lists.ozlabs.org \
--cc=grant.likely@secretlab.ca \
--cc=linux-kernel@vger.kernel.org \
--cc=m-karicheri2@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;
as well as URLs for NNTP newsgroup(s).