summaryrefslogtreecommitdiff
path: root/drivers/base/platform.c
diff options
context:
space:
mode:
authorBartosz Golaszewski <bgolaszewski@baylibre.com>2019-10-22 10:43:16 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-11-05 18:33:13 +0100
commitc9c8641d3ebd79274af75f7df3e6a9c6cc8a66e9 (patch)
treed14690c74beef6a0d8a9a4e15700791abee97b0f /drivers/base/platform.c
parent444b0111f3bc8f3b2bc83dc15f85123034a79bc2 (diff)
drivers: provide devm_platform_ioremap_resource_byname()
Provide a variant of devm_platform_ioremap_resource() that allows to lookup resources from platform devices by name rather than by index. Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Link: https://lore.kernel.org/r/20191022084318.22256-7-brgl@bgdev.pl Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/base/platform.c')
-rw-r--r--drivers/base/platform.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index 28eb71967f17..1b8a20466eef 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -95,6 +95,26 @@ void __iomem *devm_platform_ioremap_resource_wc(struct platform_device *pdev,
res = platform_get_resource(pdev, IORESOURCE_MEM, index);
return devm_ioremap_resource_wc(&pdev->dev, res);
}
+
+/**
+ * devm_platform_ioremap_resource_byname - call devm_ioremap_resource for
+ * a platform device, retrieve the
+ * resource by name
+ *
+ * @pdev: platform device to use both for memory resource lookup as well as
+ * resource management
+ * @name: name of the resource
+ */
+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 */
/**