drivers: provide devm_platform_ioremap_and_get_resource()
PATCH 1/1 drivers: provide devm_platform_ioremap_and_get_resource()
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.
--- drivers/base/platform.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
drivers/base/platform.c +18 -0
@@ -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
Signature · 1 line
2.25.0
Greg KH
maintainerQuoted 45 lines · Dejin Zheng
Since commit "drivers: provide
devm_platform_ioremap_resource()", It was wrapplatform_get_resource()anddevm_ioremap_resource()as single helperdevm_platform_ioremap_resource(). but now, many drivers still usedplatform_get_resource()anddevm_ioremap_resource()together in the kernel tree. The reason can not be replaced is they still need use the resource variables obtained byplatform_get_resource(). so provide this helper.Signed-off-by Dejin Zheng <[email protected]>--- drivers/base/platform.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)drivers/base/platform.c +18
-0@@ -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 Signature · 1 line
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