Skip to content

Commit caa5a5d

Browse files
makb-juniperlag-linaro
authored andcommitted
mfd: core: Preserve OF node when ACPI handle is present
Switch device_set_node to set_primary_fwnode, so that the ACPI fwnode does not overwrite the of_node with NULL. This allows MFD children with both OF nodes and ACPI handles to have OF nodes again. Cc: [email protected] Fixes: 51e3b25 ("mfd: core: Make use of device_set_node()") Signed-off-by: Brian Mak <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Lee Jones <[email protected]>
1 parent 70910aa commit caa5a5d

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

drivers/mfd/mfd-core.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,17 @@ static void mfd_acpi_add_device(const struct mfd_cell *cell,
8888
}
8989
}
9090

91-
device_set_node(&pdev->dev, acpi_fwnode_handle(adev ?: parent));
91+
/*
92+
* NOTE: The fwnode design doesn't allow proper stacking/sharing. This
93+
* should eventually turn into a device fwnode API call that will allow
94+
* prepending to a list of fwnodes (with ACPI taking precedence).
95+
*
96+
* set_primary_fwnode() is used here, instead of device_set_node(), as
97+
* device_set_node() will overwrite the existing fwnode, which may be an
98+
* OF node that was populated earlier. To support a use case where ACPI
99+
* and OF is used in conjunction, we call set_primary_fwnode() instead.
100+
*/
101+
set_primary_fwnode(&pdev->dev, acpi_fwnode_handle(adev ?: parent));
92102
}
93103
#else
94104
static inline void mfd_acpi_add_device(const struct mfd_cell *cell,

0 commit comments

Comments
 (0)