[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200315123855.GB13262@nuc8i5>
Date: Sun, 15 Mar 2020 20:38:55 +0800
From: Dejin Zheng <zhengdejin5@...il.com>
To: Sergei Shtylyov <sergei.shtylyov@...entembedded.com>
Cc: gregkh@...uxfoundation.org, rafael@...nel.org, hminas@...opsys.com,
mathias.nyman@...el.com, bgolaszewski@...libre.com, arnd@...db.de,
geert@...ux-m68k.org, mchehab+samsung@...nel.org,
treding@...dia.com, tglx@...utronix.de, suzuki.poulose@....com,
hdegoede@...hat.com, linux-usb@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 1/4] drivers: provide
devm_platform_ioremap_and_get_resource()
On Sun, Mar 15, 2020 at 01:01:14PM +0300, Sergei Shtylyov wrote:
> 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
Ok and Thanks!
>
> > 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...
>
Many drivers using platform_get_resource() and devm_ioremap_resource() together
in the kernel tree. if use this helper, have one function call less.
> > Signed-off-by: Dejin Zheng <zhengdejin5@...il.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().
>
Thanks for your suggestions. I will do it.
> [...]
>
> MBR, Sergei
BR,
Dejin
Powered by blists - more mailing lists