[RFC 04/13] driver core: plafrom: Introduce platform_mmio_configure()

Nicolas Saenz Julienne nsaenzjulienne at suse.de
Fri Feb 26 09:02:56 EST 2021


The function will traverse the platform device's bus hierarchy and set
the relevant MMIO access flags.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne at suse.de>
---
 drivers/base/platform.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index 6e1f8e0b661c..31772fd4ca1d 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -1504,6 +1504,14 @@ int platform_dma_configure(struct device *dev)
 	return ret;
 }
 
+static int platform_mmio_configure(struct device *dev)
+{
+	if (dev->parent && dev->parent->of_node)
+		return of_mmio_configure(dev, dev->parent->of_node);
+
+	return 0;
+}
+
 static const struct dev_pm_ops platform_dev_pm_ops = {
 	.runtime_suspend = pm_generic_runtime_suspend,
 	.runtime_resume = pm_generic_runtime_resume,
@@ -1519,6 +1527,7 @@ struct bus_type platform_bus_type = {
 	.remove		= platform_remove,
 	.shutdown	= platform_shutdown,
 	.dma_configure	= platform_dma_configure,
+	.mmio_configure = platform_mmio_configure,
 	.pm		= &platform_dev_pm_ops,
 };
 EXPORT_SYMBOL_GPL(platform_bus_type);
-- 
2.30.1




More information about the linux-arm-kernel mailing list