* [PATCH] drivers: provide devm_platform_ioremap_and_get_resource()
@ 2020-03-13 17:19 Dejin Zheng
2020-03-13 17:56 ` Greg KH
0 siblings, 1 reply; 2+ messages in thread
From: Dejin Zheng @ 2020-03-13 17:19 UTC (permalink / raw)
To: gregkh, rafael; +Cc: linux-kernel, Dejin Zheng
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.
Signed-off-by: Dejin Zheng <zhengdejin5@gmail.com>
---
drivers/base/platform.c | 18 ++++++++++++++++++
1 file changed, 18 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);
+
/**
* devm_platform_ioremap_resource - call devm_ioremap_resource() for a platform
* device
--
2.25.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] drivers: provide devm_platform_ioremap_and_get_resource()
2020-03-13 17:19 [PATCH] drivers: provide devm_platform_ioremap_and_get_resource() Dejin Zheng
@ 2020-03-13 17:56 ` Greg KH
0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2020-03-13 17:56 UTC (permalink / raw)
To: Dejin Zheng; +Cc: rafael, linux-kernel
On Sat, Mar 14, 2020 at 01:19:02AM +0800, Dejin Zheng 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.
>
> Signed-off-by: Dejin Zheng <zhengdejin5@gmail.com>
> ---
> drivers/base/platform.c | 18 ++++++++++++++++++
> 1 file changed, 18 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);
> +
> /**
> * devm_platform_ioremap_resource - call devm_ioremap_resource() for a platform
> * device
> --
> 2.25.0
>
I can not take new api functions without some real users of the function
at the same time.
Please make a patch series modifing drivers to use this new function and
I will be glad to review it then.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-03-13 17:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-13 17:19 [PATCH] drivers: provide devm_platform_ioremap_and_get_resource() Dejin Zheng
2020-03-13 17:56 ` Greg KH
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.