>From dc204a8644fd4bb7aac9492e6ee304d81be7dbbd Mon Sep 17 00:00:00 2001 From: Heikki Krogerus Date: Mon, 5 Aug 2019 14:54:37 +0300 Subject: [PATCH] mfd: core: Propagate software fwnode to the sub devices When ever device properties are supplied for a sub device, a software node (fwnode) is actually created and then associated with that device. By allowing the drivers to supply the complete software node instead of just the properties in it, the drivers can take advantage of the other features the software nodes have on top of supplying the device properties. Signed-off-by: Heikki Krogerus --- drivers/mfd/mfd-core.c | 8 ++++++++ include/linux/mfd/core.h | 3 +++ 2 files changed, 11 insertions(+) diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c index cb3e0a14bbdd..3fda7e420c5d 100644 --- a/drivers/mfd/mfd-core.c +++ b/drivers/mfd/mfd-core.c @@ -174,6 +174,14 @@ static int mfd_add_device(struct device *parent, int id, goto fail_alias; } + if (cell->node) { + ret = software_node_register(cell->node); + if (ret) + goto fail_alias; + + pdev->dev.fwnode = software_node_fwnode(cell->node); + } + for (r = 0; r < cell->num_resources; r++) { res[r].name = cell->resources[r].name; res[r].flags = cell->resources[r].flags; diff --git a/include/linux/mfd/core.h b/include/linux/mfd/core.h index d01d1299e49d..5ec90ba5865a 100644 --- a/include/linux/mfd/core.h +++ b/include/linux/mfd/core.h @@ -72,6 +72,9 @@ struct mfd_cell { /* device properties passed to the sub devices drivers */ struct property_entry *properties; + /* Software fwnode for the sub device */ + const struct software_node *node; + /* * Device Tree compatible string * See: Documentation/devicetree/usage-model.txt Chapter 2.2 for details -- 2.24.0