From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Dejin Zheng <zhengdejin5@gmail.com>,
gregkh@linuxfoundation.org, rafael@kernel.org,
hminas@synopsys.com, mathias.nyman@intel.com,
bgolaszewski@baylibre.com, arnd@arndb.de, geert@linux-m68k.org,
mchehab+samsung@kernel.org, treding@nvidia.com,
tglx@linutronix.de, suzuki.poulose@arm.com, hdegoede@redhat.com,
linux-usb@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/4] drivers: provide devm_platform_ioremap_and_get_resource()
Date: Sun, 15 Mar 2020 13:01:14 +0300 [thread overview]
Message-ID: <a7cbeabf-a7c3-b960-7aca-e124e98f9c7f@cogentembedded.com> (raw)
In-Reply-To: <20200314052638.6008-2-zhengdejin5@gmail.com>
Hello!
On 14.03.2020 8:26, Dejin Zheng wrote:
> Since commit "drivers: provide devm_platform_ioremap_resource()",
> It was wrap platform_get_resource() and devm_ioremap_resource() as
^^ it
> single helper devm_platform_ioremap_resource(). but now, many drivers
> still used platform_get_resource() and devm_ioremap_resource()
> together in the kernel tree. The reason can not be replaced is they
> still need use the resource variables obtained by platform_get_resource().
> so provide this helper.
Not really sure that's worth the effort...
> Signed-off-by: Dejin Zheng <zhengdejin5@gmail.com>
> ---
> drivers/base/platform.c | 18 ++++++++++++++++++
> include/linux/platform_device.h | 3 +++
> 2 files changed, 21 insertions(+)
>
> diff --git a/drivers/base/platform.c b/drivers/base/platform.c
> index 7fa654f1288b..b3e2409effae 100644
> --- a/drivers/base/platform.c
> +++ b/drivers/base/platform.c
> @@ -62,6 +62,24 @@ struct resource *platform_get_resource(struct platform_device *dev,
> EXPORT_SYMBOL_GPL(platform_get_resource);
>
> #ifdef CONFIG_HAS_IOMEM
> +/**
> + * devm_platform_ioremap_and_get_resource - call devm_ioremap_resource() for a
> + * platform device and get resource
> + *
> + * @pdev: platform device to use both for memory resource lookup as well as
> + * resource management
> + * @index: resource index
> + * @res: get the resource
> + */
> +void __iomem *
> +devm_platform_ioremap_and_get_resource(struct platform_device *pdev,
> + unsigned int index, struct resource **res)
> +{
> + *res = platform_get_resource(pdev, IORESOURCE_MEM, index);
> + return devm_ioremap_resource(&pdev->dev, *res);
> +}
> +EXPORT_SYMBOL_GPL(devm_platform_ioremap_and_get_resource);
That looks more like devm_platform_get_and_ioremap_resource().
[...]
MBR, Sergei
next prev parent reply other threads:[~2020-03-15 10:01 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-14 5:26 [PATCH v2 0/4] drivers: new helper for ioremapping memory resources Dejin Zheng
2020-03-14 5:26 ` [PATCH v2 1/4] drivers: provide devm_platform_ioremap_and_get_resource() Dejin Zheng
2020-03-15 9:47 ` Geert Uytterhoeven
2020-03-15 10:01 ` Sergei Shtylyov [this message]
2020-03-15 12:38 ` Dejin Zheng
2020-03-14 5:26 ` [PATCH v2 2/4] usb: host: xhci-plat: convert to devm_platform_ioremap_and_get_resource Dejin Zheng
2020-03-14 5:26 ` [PATCH v2 3/4] usb: host: hisilicon: " Dejin Zheng
2020-03-14 5:26 ` [PATCH v2 4/4] usb: dwc2: " Dejin Zheng
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=a7cbeabf-a7c3-b960-7aca-e124e98f9c7f@cogentembedded.com \
--to=sergei.shtylyov@cogentembedded.com \
--cc=arnd@arndb.de \
--cc=bgolaszewski@baylibre.com \
--cc=geert@linux-m68k.org \
--cc=gregkh@linuxfoundation.org \
--cc=hdegoede@redhat.com \
--cc=hminas@synopsys.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@intel.com \
--cc=mchehab+samsung@kernel.org \
--cc=rafael@kernel.org \
--cc=suzuki.poulose@arm.com \
--cc=tglx@linutronix.de \
--cc=treding@nvidia.com \
--cc=zhengdejin5@gmail.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