* [PATCH v3] mfd: core: Preserve OF node when ACPI handle is present
@ 2026-03-11 19:02 Brian Mak
2026-03-11 20:25 ` Andy Shevchenko
2026-03-19 18:12 ` Lee Jones
0 siblings, 2 replies; 5+ messages in thread
From: Brian Mak @ 2026-03-11 19:02 UTC (permalink / raw)
To: Lee Jones, Herve Codina, Andy Shevchenko, linux-kernel; +Cc: Brian Mak, stable
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.
Fixes: 51e3b257099d ("mfd: core: Make use of device_set_node()")
Cc: stable@vger.kernel.org
Signed-off-by: Brian Mak <makb@juniper.net>
---
v3: Changed FIXME to NOTE, as this will not be addressed in the near
future.
v2: Use open-coded logic for clarity and add FIXME.
drivers/mfd/mfd-core.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c
index 6be58eb5a746..e862448b93b3 100644
--- a/drivers/mfd/mfd-core.c
+++ b/drivers/mfd/mfd-core.c
@@ -88,7 +88,20 @@ static void mfd_acpi_add_device(const struct mfd_cell *cell,
}
}
- device_set_node(&pdev->dev, acpi_fwnode_handle(adev ?: parent));
+ /*
+ * NOTE: The fwnode design doesn't allow proper stacking/sharing. This
+ * should eventually turn into a device fwnode API call that will allow
+ * prepending to a list of fwnodes (with ACPI taking precedence).
+ *
+ * set_primary_fwnode() is used here, instead of device_set_node(), as
+ * device_set_node() will overwrite the existing fwnode, which may be an
+ * OF node that was populated earlier. To support a use case where ACPI
+ * and OF is used in conjunction, we call set_primary_fwnode() instead.
+ */
+ if (adev)
+ set_primary_fwnode(&pdev->dev, acpi_fwnode_handle(adev));
+ else
+ set_primary_fwnode(&pdev->dev, acpi_fwnode_handle(parent));
}
#else
static inline void mfd_acpi_add_device(const struct mfd_cell *cell,
base-commit: d9d32e5bd5a4e57675f2b70ddf73c3dc5cf44fc2
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v3] mfd: core: Preserve OF node when ACPI handle is present
2026-03-11 19:02 [PATCH v3] mfd: core: Preserve OF node when ACPI handle is present Brian Mak
@ 2026-03-11 20:25 ` Andy Shevchenko
2026-03-11 20:36 ` Brian Mak
2026-03-19 18:12 ` Lee Jones
1 sibling, 1 reply; 5+ messages in thread
From: Andy Shevchenko @ 2026-03-11 20:25 UTC (permalink / raw)
To: Brian Mak; +Cc: Lee Jones, Herve Codina, linux-kernel, stable
On Wed, Mar 11, 2026 at 12:02:25PM -0700, Brian Mak wrote:
> 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.
Haven't I given a tag already?
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v3] mfd: core: Preserve OF node when ACPI handle is present
2026-03-11 20:25 ` Andy Shevchenko
@ 2026-03-11 20:36 ` Brian Mak
0 siblings, 0 replies; 5+ messages in thread
From: Brian Mak @ 2026-03-11 20:36 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Lee Jones, Herve Codina, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
On Mar 11, 2026, at 1:25 PM, Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> On Wed, Mar 11, 2026 at 12:02:25PM -0700, Brian Mak wrote:
>> 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.
>
> Haven't I given a tag already?
Sorry, yes you did, I forgot to copy it over, my bad:
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Best,
Brian
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v3] mfd: core: Preserve OF node when ACPI handle is present
2026-03-11 19:02 [PATCH v3] mfd: core: Preserve OF node when ACPI handle is present Brian Mak
2026-03-11 20:25 ` Andy Shevchenko
@ 2026-03-19 18:12 ` Lee Jones
2026-03-20 7:27 ` Andy Shevchenko
1 sibling, 1 reply; 5+ messages in thread
From: Lee Jones @ 2026-03-19 18:12 UTC (permalink / raw)
To: Brian Mak; +Cc: Herve Codina, Andy Shevchenko, linux-kernel, stable
On Wed, 11 Mar 2026, Brian Mak wrote:
> 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.
>
> Fixes: 51e3b257099d ("mfd: core: Make use of device_set_node()")
> Cc: stable@vger.kernel.org
> Signed-off-by: Brian Mak <makb@juniper.net>
> ---
>
> v3: Changed FIXME to NOTE, as this will not be addressed in the near
> future.
>
> v2: Use open-coded logic for clarity and add FIXME.
>
> drivers/mfd/mfd-core.c | 15 ++++++++++++++-
> 1 file changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c
> index 6be58eb5a746..e862448b93b3 100644
> --- a/drivers/mfd/mfd-core.c
> +++ b/drivers/mfd/mfd-core.c
> @@ -88,7 +88,20 @@ static void mfd_acpi_add_device(const struct mfd_cell *cell,
> }
> }
>
> - device_set_node(&pdev->dev, acpi_fwnode_handle(adev ?: parent));
> + /*
> + * NOTE: The fwnode design doesn't allow proper stacking/sharing. This
> + * should eventually turn into a device fwnode API call that will allow
> + * prepending to a list of fwnodes (with ACPI taking precedence).
> + *
> + * set_primary_fwnode() is used here, instead of device_set_node(), as
> + * device_set_node() will overwrite the existing fwnode, which may be an
> + * OF node that was populated earlier. To support a use case where ACPI
> + * and OF is used in conjunction, we call set_primary_fwnode() instead.
> + */
> + if (adev)
> + set_primary_fwnode(&pdev->dev, acpi_fwnode_handle(adev));
> + else
> + set_primary_fwnode(&pdev->dev, acpi_fwnode_handle(parent));
Sorry to mess you around again, but how do you feel about:
set_primary_fwnode(&pdev->dev, acpi_fwnode_handle(adev ?: parent));
> }
> #else
> static inline void mfd_acpi_add_device(const struct mfd_cell *cell,
>
> base-commit: d9d32e5bd5a4e57675f2b70ddf73c3dc5cf44fc2
> --
> 2.25.1
>
--
Lee Jones [李琼斯]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v3] mfd: core: Preserve OF node when ACPI handle is present
2026-03-19 18:12 ` Lee Jones
@ 2026-03-20 7:27 ` Andy Shevchenko
0 siblings, 0 replies; 5+ messages in thread
From: Andy Shevchenko @ 2026-03-20 7:27 UTC (permalink / raw)
To: Lee Jones; +Cc: Brian Mak, Herve Codina, linux-kernel, stable
On Thu, Mar 19, 2026 at 06:12:31PM +0000, Lee Jones wrote:
> On Wed, 11 Mar 2026, Brian Mak wrote:
...
> > + if (adev)
> > + set_primary_fwnode(&pdev->dev, acpi_fwnode_handle(adev));
> > + else
> > + set_primary_fwnode(&pdev->dev, acpi_fwnode_handle(parent));
>
> Sorry to mess you around again, but how do you feel about:
>
> set_primary_fwnode(&pdev->dev, acpi_fwnode_handle(adev ?: parent));
If you think it's better, no objections from me.
Some maintainers prefer avoiding ternary, and specifically Elvis, some not —
hard to remember everybody's preferences :-)
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-03-20 7:27 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-11 19:02 [PATCH v3] mfd: core: Preserve OF node when ACPI handle is present Brian Mak
2026-03-11 20:25 ` Andy Shevchenko
2026-03-11 20:36 ` Brian Mak
2026-03-19 18:12 ` Lee Jones
2026-03-20 7:27 ` Andy Shevchenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox