From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Dejin Zheng <zhengdejin5@gmail.com>
Cc: Greg KH <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Minas Harutyunyan <hminas@synopsys.com>,
Mathias Nyman <mathias.nyman@intel.com>,
Bartosz Golaszewski <bgolaszewski@baylibre.com>,
Arnd Bergmann <arnd@arndb.de>,
Jeff Kirsher <jeffrey.t.kirsher@intel.com>,
Hans de Goede <hdegoede@redhat.com>,
Thierry Reding <treding@nvidia.com>,
Thomas Gleixner <tglx@linutronix.de>,
"Winkler, Tomas" <tomas.winkler@intel.com>,
Suzuki K Poulose <suzuki.poulose@arm.com>,
Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>,
USB list <linux-usb@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3 1/5] drivers: provide devm_platform_get_and_ioremap_resource()
Date: Mon, 23 Mar 2020 13:44:15 +0100 [thread overview]
Message-ID: <CAMuHMdW_1SP-1Z-y7ejUWM1MhTb1_AOiocvq4JwoOcjerUJwEw@mail.gmail.com> (raw)
In-Reply-To: <20200315140525.21780-2-zhengdejin5@gmail.com>
Hi Dejin,
On Sun, Mar 15, 2020 at 3:05 PM Dejin Zheng <zhengdejin5@gmail.com> wrote:
> Since commit "drivers: provide devm_platform_ioremap_resource()",
> it was wrap platform_get_resource() and devm_ioremap_resource() as
> 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.
>
> Suggested-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Suggested-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
> Signed-off-by: Dejin Zheng <zhengdejin5@gmail.com>
Thanks for your patch!
> --- a/drivers/base/platform.c
> +++ b/drivers/base/platform.c
> @@ -62,6 +62,28 @@ struct resource *platform_get_resource(struct platform_device *dev,
> EXPORT_SYMBOL_GPL(platform_get_resource);
>
> #ifdef CONFIG_HAS_IOMEM
> +/**
> + * devm_platform_get_and_ioremap_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
Optional output parameter to store a pointer to the obtained resource.
With the above changed:
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
> + */
> +void __iomem *
> +devm_platform_get_and_ioremap_resource(struct platform_device *pdev,
> + unsigned int index, struct resource **res)
> +{
> + struct resource *r;
> +
> + r = platform_get_resource(pdev, IORESOURCE_MEM, index);
> + if (res)
> + *res = r;
> + return devm_ioremap_resource(&pdev->dev, r);
> +}
> +EXPORT_SYMBOL_GPL(devm_platform_get_and_ioremap_resource);
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
next prev parent reply other threads:[~2020-03-23 12:44 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-15 14:05 [PATCH v3 0/5] drivers: new helper for ioremapping memory resources Dejin Zheng
2020-03-15 14:05 ` [PATCH v3 1/5] drivers: provide devm_platform_get_and_ioremap_resource() Dejin Zheng
2020-03-17 19:20 ` Greg KH
2020-03-17 19:35 ` Geert Uytterhoeven
2020-03-18 10:10 ` Greg KH
2020-03-20 14:06 ` Dejin Zheng
2020-03-23 12:44 ` Geert Uytterhoeven [this message]
2020-03-15 14:05 ` [PATCH v3 2/5] usb: host: xhci-plat: convert to devm_platform_get_and_ioremap_resource Dejin Zheng
2020-03-18 11:33 ` Mathias Nyman
2020-03-23 12:45 ` Geert Uytterhoeven
2020-03-15 14:05 ` [PATCH v3 3/5] usb: host: hisilicon: " Dejin Zheng
2020-03-18 11:35 ` Mathias Nyman
2020-03-23 12:45 ` Geert Uytterhoeven
2020-03-15 14:05 ` [PATCH v3 4/5] usb: dwc2: " Dejin Zheng
2020-03-18 10:40 ` Minas Harutyunyan
2020-03-23 12:47 ` Geert Uytterhoeven
2020-03-15 14:05 ` [PATCH v3 5/5] driver core: platform: Reimplement devm_platform_ioremap_resource Dejin Zheng
2020-03-23 12:47 ` Geert Uytterhoeven
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=CAMuHMdW_1SP-1Z-y7ejUWM1MhTb1_AOiocvq4JwoOcjerUJwEw@mail.gmail.com \
--to=geert@linux-m68k.org \
--cc=arnd@arndb.de \
--cc=bgolaszewski@baylibre.com \
--cc=gregkh@linuxfoundation.org \
--cc=hdegoede@redhat.com \
--cc=hminas@synopsys.com \
--cc=jeffrey.t.kirsher@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@intel.com \
--cc=rafael@kernel.org \
--cc=sergei.shtylyov@cogentembedded.com \
--cc=suzuki.poulose@arm.com \
--cc=tglx@linutronix.de \
--cc=tomas.winkler@intel.com \
--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;
as well as URLs for NNTP newsgroup(s).