From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
To: Frank Lee <tiny.windzz@gmail.com>
Cc: treding@nvidia.com, mans@mansr.com,
"Rafael J. Wysocki" <rafael@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
suzuki.poulose@arm.com,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Maxime Ripard <mripard@kernel.org>,
Vladimir Zapolskiy <vz@mleia.com>, Chen-Yu Tsai <wens@csie.org>,
Srini Kandagatla <srinivas.kandagatla@linaro.org>,
Kevin Hilman <khilman@baylibre.com>,
Mauro Carvalho Chehab <mchehab+samsung@kernel.org>,
linux-amlogic@lists.infradead.org,
Thomas Gleixner <tglx@linutronix.de>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Linux ARM <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH] drivers: add devm_platform_ioremap_resource_byname() helper
Date: Sun, 29 Dec 2019 13:13:56 +0100 [thread overview]
Message-ID: <CAMpxmJUQjyCeNvczx_UKNL6PMnNWAPsY5ptCdz24YLXH_63nRg@mail.gmail.com> (raw)
In-Reply-To: <CAEExFWvd1Md-guT=wgZ1-G69r71KBn64k2yGh0Vqjh_-D8yGuQ@mail.gmail.com>
sob., 28 gru 2019 o 18:39 Frank Lee <tiny.windzz@gmail.com> napisał(a):
>
> ping...
>
> On Wed, Dec 11, 2019 at 4:31 AM Yangtao Li <tiny.windzz@gmail.com> wrote:
> >
> > There are currently 300+ instances of using platform_get_resource_byname()
> > and devm_ioremap_resource() together in the kernel tree.
> >
> > This patch wraps these two calls in a single helper.
> >
> > Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
> > ---
> > drivers/base/platform.c | 22 +++++++++++++++++++++-
> > include/linux/platform_device.h | 3 +++
> > 2 files changed, 24 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/base/platform.c b/drivers/base/platform.c
> > index b6c6c7d97d5b..9c4f5e229600 100644
> > --- a/drivers/base/platform.c
> > +++ b/drivers/base/platform.c
> > @@ -60,6 +60,7 @@ struct resource *platform_get_resource(struct platform_device *dev,
> > }
> > EXPORT_SYMBOL_GPL(platform_get_resource);
> >
> > +#ifdef CONFIG_HAS_IOMEM
> > /**
> > * devm_platform_ioremap_resource - call devm_ioremap_resource() for a platform
> > * device
> > @@ -68,7 +69,7 @@ EXPORT_SYMBOL_GPL(platform_get_resource);
> > * resource management
> > * @index: resource index
> > */
> > -#ifdef CONFIG_HAS_IOMEM
> > +
> > void __iomem *devm_platform_ioremap_resource(struct platform_device *pdev,
> > unsigned int index)
> > {
> > @@ -78,6 +79,25 @@ void __iomem *devm_platform_ioremap_resource(struct platform_device *pdev,
> > return devm_ioremap_resource(&pdev->dev, res);
> > }
> > EXPORT_SYMBOL_GPL(devm_platform_ioremap_resource);
> > +
> > +/**
> > + * devm_platform_ioremap_resource_byname - call devm_ioremap_resource() for
> > + * a platform device
> > + *
> > + * @pdev: platform device to use both for memory resource lookup as well as
> > + * resource managemend
> > + * @name: resource name
> > + */
> > +void __iomem *
> > +devm_platform_ioremap_resource_byname(struct platform_device *pdev,
> > + const char *name)
> > +{
> > + struct resource *res;
> > +
> > + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, name);
> > + return devm_ioremap_resource(&pdev->dev, res);
> > +}
> > +EXPORT_SYMBOL_GPL(devm_platform_ioremap_resource_byname);
> > #endif /* CONFIG_HAS_IOMEM */
> >
> > static int __platform_get_irq(struct platform_device *dev, unsigned int num)
> > diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
> > index 1b5cec067533..24ff5da9c532 100644
> > --- a/include/linux/platform_device.h
> > +++ b/include/linux/platform_device.h
> > @@ -63,6 +63,9 @@ extern int platform_irq_count(struct platform_device *);
> > extern struct resource *platform_get_resource_byname(struct platform_device *,
> > unsigned int,
> > const char *);
> > +extern void __iomem *
> > +devm_platform_ioremap_resource_byname(struct platform_device *pdev,
> > + const char *name);
> > extern int platform_get_irq_byname(struct platform_device *, const char *);
> > extern int platform_add_devices(struct platform_device **, int);
> >
> > --
> > 2.17.1
> >
This exact routine has existed upstream since commit c9c8641d3ebd
("drivers: provide devm_platform_ioremap_resource_byname()"). What
version are you working on?
Bart
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
prev parent reply other threads:[~2019-12-29 12:14 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-10 20:31 [PATCH] drivers: add devm_platform_ioremap_resource_byname() helper Yangtao Li
2019-12-10 20:31 ` [PATCH 1/5] nvmem: sunxi_sid: convert to devm_platform_ioremap_resource Yangtao Li
2019-12-10 20:34 ` Frank Lee
2019-12-18 2:46 ` Chen-Yu Tsai
2019-12-10 20:31 ` [PATCH 2/5] nvmem: lpc18xx_otp: " Yangtao Li
2019-12-10 20:31 ` [PATCH 3/5] nvmem: meson-mx-efuse: " Yangtao Li
2019-12-10 20:41 ` Martin Blumenstingl
2019-12-10 20:31 ` [PATCH 4/5] nvmem: bcm-ocotp: " Yangtao Li
2019-12-28 17:39 ` [PATCH] drivers: add devm_platform_ioremap_resource_byname() helper Frank Lee
2019-12-29 12:13 ` Bartosz Golaszewski [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=CAMpxmJUQjyCeNvczx_UKNL6PMnNWAPsY5ptCdz24YLXH_63nRg@mail.gmail.com \
--to=bgolaszewski@baylibre.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=khilman@baylibre.com \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mans@mansr.com \
--cc=mchehab+samsung@kernel.org \
--cc=mripard@kernel.org \
--cc=rafael@kernel.org \
--cc=srinivas.kandagatla@linaro.org \
--cc=suzuki.poulose@arm.com \
--cc=tglx@linutronix.de \
--cc=tiny.windzz@gmail.com \
--cc=treding@nvidia.com \
--cc=vz@mleia.com \
--cc=wens@csie.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;
as well as URLs for NNTP newsgroup(s).