* [PATCH v7 3/9] software node: allow referencing firmware nodes
2025-11-20 13:23 [PATCH v7 0/9] reset: rework reset-gpios handling Bartosz Golaszewski
@ 2025-11-20 13:23 ` Bartosz Golaszewski
2025-11-20 13:27 ` Charles Keepax
0 siblings, 1 reply; 9+ messages in thread
From: Bartosz Golaszewski @ 2025-11-20 13:23 UTC (permalink / raw)
To: Linus Walleij, Bartosz Golaszewski, Andy Shevchenko,
Daniel Scally, Heikki Krogerus, Sakari Ailus, Greg Kroah-Hartman,
Rafael J. Wysocki, Danilo Krummrich, Philipp Zabel,
Krzysztof Kozlowski, David Rhodes, Richard Fitzgerald, Mark Brown,
Maciej Strozek, Charles Keepax, Andy Shevchenko,
Bartosz Golaszewski
Cc: linux-gpio, linux-kernel, linux-acpi, linux-sound, patches,
linux-spi, Bartosz Golaszewski
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
At the moment software nodes can only reference other software nodes.
This is a limitation for devices created, for instance, on the auxiliary
bus with a dynamic software node attached which cannot reference devices
the firmware node of which is "real" (as an OF node or otherwise).
Make it possible for a software node to reference all firmware nodes in
addition to static software nodes. To that end: add a second pointer to
struct software_node_ref_args of type struct fwnode_handle. The core
swnode code will first check the swnode pointer and if it's NULL, it
will assume the fwnode pointer should be set.
Software node graphs remain the same, as in: the remote endpoints still
have to be software nodes.
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
drivers/base/swnode.c | 24 ++++++++++++++++++++++--
include/linux/property.h | 13 ++++++++++---
2 files changed, 32 insertions(+), 5 deletions(-)
diff --git a/drivers/base/swnode.c b/drivers/base/swnode.c
index 6b1ee75a908fbf272f29dbe65529ce69ce03a021..16a8301c25d6390ba304c66411d1a261345184f3 100644
--- a/drivers/base/swnode.c
+++ b/drivers/base/swnode.c
@@ -535,7 +535,24 @@ software_node_get_reference_args(const struct fwnode_handle *fwnode,
ref_array = prop->pointer;
ref = &ref_array[index];
- refnode = software_node_fwnode(ref->node);
+ /*
+ * A software node can reference other software nodes or firmware
+ * nodes (which are the abstraction layer sitting on top of them).
+ * This is done to ensure we can create references to static software
+ * nodes before they're registered with the firmware node framework.
+ * At the time the reference is being resolved, we expect the swnodes
+ * in question to already have been registered and to be backed by
+ * a firmware node. This is why we use the fwnode API below to read the
+ * relevant properties and bump the reference count.
+ */
+
+ if (ref->swnode)
+ refnode = software_node_fwnode(ref->swnode);
+ else if (ref->fwnode)
+ refnode = ref->fwnode;
+ else
+ return -EINVAL;
+
if (!refnode)
return -ENOENT;
@@ -633,7 +650,10 @@ software_node_graph_get_remote_endpoint(const struct fwnode_handle *fwnode)
ref = prop->pointer;
- return software_node_get(software_node_fwnode(ref[0].node));
+ if (!ref->swnode)
+ return NULL;
+
+ return software_node_get(software_node_fwnode(ref->swnode));
}
static struct fwnode_handle *
diff --git a/include/linux/property.h b/include/linux/property.h
index 50b26589dd70d1756f3b8644255c24a011e2617c..272bfbdea7bf4ab1143159fa49fc29dcdde0ef9d 100644
--- a/include/linux/property.h
+++ b/include/linux/property.h
@@ -355,19 +355,26 @@ struct software_node;
/**
* struct software_node_ref_args - Reference property with additional arguments
- * @node: Reference to a software node
+ * @swnode: Reference to a software node
+ * @fwnode: Alternative reference to a firmware node handle
* @nargs: Number of elements in @args array
* @args: Integer arguments
*/
struct software_node_ref_args {
- const struct software_node *node;
+ const struct software_node *swnode;
+ struct fwnode_handle *fwnode;
unsigned int nargs;
u64 args[NR_FWNODE_REFERENCE_ARGS];
};
#define SOFTWARE_NODE_REFERENCE(_ref_, ...) \
(const struct software_node_ref_args) { \
- .node = _ref_, \
+ .swnode = _Generic(_ref_, \
+ const struct software_node *: _ref_, \
+ default: NULL), \
+ .fwnode = _Generic(_ref_, \
+ struct fwnode_handle *: _ref_, \
+ default: NULL), \
.nargs = COUNT_ARGS(__VA_ARGS__), \
.args = { __VA_ARGS__ }, \
}
--
2.51.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v7 3/9] software node: allow referencing firmware nodes
2025-11-20 13:23 ` [PATCH v7 3/9] software node: allow referencing firmware nodes Bartosz Golaszewski
@ 2025-11-20 13:27 ` Charles Keepax
0 siblings, 0 replies; 9+ messages in thread
From: Charles Keepax @ 2025-11-20 13:27 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Linus Walleij, Andy Shevchenko, Daniel Scally, Heikki Krogerus,
Sakari Ailus, Greg Kroah-Hartman, Rafael J. Wysocki,
Danilo Krummrich, Philipp Zabel, Krzysztof Kozlowski,
David Rhodes, Richard Fitzgerald, Mark Brown, Maciej Strozek,
Andy Shevchenko, Bartosz Golaszewski, linux-gpio, linux-kernel,
linux-acpi, linux-sound, patches, linux-spi, Bartosz Golaszewski
On Thu, Nov 20, 2025 at 02:23:58PM +0100, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
>
> At the moment software nodes can only reference other software nodes.
> This is a limitation for devices created, for instance, on the auxiliary
> bus with a dynamic software node attached which cannot reference devices
> the firmware node of which is "real" (as an OF node or otherwise).
>
> Make it possible for a software node to reference all firmware nodes in
> addition to static software nodes. To that end: add a second pointer to
> struct software_node_ref_args of type struct fwnode_handle. The core
> swnode code will first check the swnode pointer and if it's NULL, it
> will assume the fwnode pointer should be set.
>
> Software node graphs remain the same, as in: the remote endpoints still
> have to be software nodes.
>
> Acked-by: Linus Walleij <linus.walleij@linaro.org>
> Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> ---
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Tested-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Thanks,
Charles
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v7 3/9] software node: allow referencing firmware nodes
@ 2025-12-23 7:39 Jiawen Wu
2025-12-23 8:09 ` Bartosz Golaszewski
0 siblings, 1 reply; 9+ messages in thread
From: Jiawen Wu @ 2025-12-23 7:39 UTC (permalink / raw)
To: 'Bartosz Golaszewski'
Cc: andriy.shevchenko, andy, brgl, broonie, ckeepax, dakr,
david.rhodes, djrscally, gregkh, heikki.krogerus, krzk,
linus.walleij, linux-acpi, linux-gpio, linux-kernel, linux-sound,
linux-spi, mstrozek, p.zabel, patches, rafael, rf, sakari.ailus
Hi Bartosz Golaszewski,
> diff --git a/include/linux/property.h b/include/linux/property.h
> index 50b26589dd70d1..272bfbdea7bf4a 100644
> --- a/include/linux/property.h
> +++ b/include/linux/property.h
> @@ -355,19 +355,26 @@ struct software_node;
>
> /**
> * struct software_node_ref_args - Reference property with additional arguments
> - * @node: Reference to a software node
> + * @swnode: Reference to a software node
> + * @fwnode: Alternative reference to a firmware node handle
> * @nargs: Number of elements in @args array
> * @args: Integer arguments
> */
> struct software_node_ref_args {
> - const struct software_node *node;
> + const struct software_node *swnode;
> + struct fwnode_handle *fwnode;
> unsigned int nargs;
> u64 args[NR_FWNODE_REFERENCE_ARGS];
> };
>
> #define SOFTWARE_NODE_REFERENCE(_ref_, ...) \
> (const struct software_node_ref_args) { \
> - .node = _ref_, \
> + .swnode = _Generic(_ref_, \
> + const struct software_node *: _ref_, \
> + default: NULL), \
> + .fwnode = _Generic(_ref_, \
> + struct fwnode_handle *: _ref_, \
> + default: NULL), \
> .nargs = COUNT_ARGS(__VA_ARGS__), \
> .args = { __VA_ARGS__ }, \
> }
This change seems incompatible with my driver txgbe, since the software nodes
are registered in " struct software_node * " but not " const struct software_node * ".
So when I pulled the net-next-6.19-rc1 that merged this patch, to probe my driver.
The error logs shows:
[ 5.243396] txgbe 0000:10:00.0 (unnamed net_device) (uninitialized): unable to attach SFP bus: -EINVAL
[ 5.243399] txgbe 0000:10:00.0: failed to init phylink
[ 5.576008] txgbe 0000:10:00.0: probe with driver txgbe failed with error -22
[ 6.109548] txgbe 0000:10:00.1 (unnamed net_device) (uninitialized): unable to attach SFP bus: -EINVAL
[ 6.109551] txgbe 0000:10:00.1: failed to init phylink
[ 6.442044] txgbe 0000:10:00.1: probe with driver txgbe failed with error -22
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v7 3/9] software node: allow referencing firmware nodes
2025-12-23 7:39 [PATCH v7 3/9] software node: allow referencing firmware nodes Jiawen Wu
@ 2025-12-23 8:09 ` Bartosz Golaszewski
2025-12-23 8:44 ` Jiawen Wu
0 siblings, 1 reply; 9+ messages in thread
From: Bartosz Golaszewski @ 2025-12-23 8:09 UTC (permalink / raw)
To: Jiawen Wu
Cc: Bartosz Golaszewski, andriy.shevchenko, andy, broonie, ckeepax,
dakr, david.rhodes, djrscally, gregkh, heikki.krogerus, krzk,
linus.walleij, linux-acpi, linux-gpio, linux-kernel, linux-sound,
linux-spi, mstrozek, p.zabel, patches, rafael, rf, sakari.ailus
On Tue, Dec 23, 2025 at 8:39 AM Jiawen Wu <jiawenwu@trustnetic.com> wrote:
>
> >
> > #define SOFTWARE_NODE_REFERENCE(_ref_, ...) \
> > (const struct software_node_ref_args) { \
> > - .node = _ref_, \
> > + .swnode = _Generic(_ref_, \
> > + const struct software_node *: _ref_, \
> > + default: NULL), \
> > + .fwnode = _Generic(_ref_, \
> > + struct fwnode_handle *: _ref_, \
> > + default: NULL), \
> > .nargs = COUNT_ARGS(__VA_ARGS__), \
> > .args = { __VA_ARGS__ }, \
> > }
>
> This change seems incompatible with my driver txgbe, since the software nodes
> are registered in " struct software_node * " but not " const struct software_node * ".
>
> So when I pulled the net-next-6.19-rc1 that merged this patch, to probe my driver.
> The error logs shows:
>
> [ 5.243396] txgbe 0000:10:00.0 (unnamed net_device) (uninitialized): unable to attach SFP bus: -EINVAL
> [ 5.243399] txgbe 0000:10:00.0: failed to init phylink
> [ 5.576008] txgbe 0000:10:00.0: probe with driver txgbe failed with error -22
> [ 6.109548] txgbe 0000:10:00.1 (unnamed net_device) (uninitialized): unable to attach SFP bus: -EINVAL
> [ 6.109551] txgbe 0000:10:00.1: failed to init phylink
> [ 6.442044] txgbe 0000:10:00.1: probe with driver txgbe failed with error -22
>
This shouldn't have changed anything for existing software nodes - the
pointer in struct software_node_ref_args has always been const. This
would have failed at build-time if this was an issue. Have you
bisected it to this very commit? What line is the -EINVAL assigned and
for what reason?
Bart
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [PATCH v7 3/9] software node: allow referencing firmware nodes
2025-12-23 8:09 ` Bartosz Golaszewski
@ 2025-12-23 8:44 ` Jiawen Wu
2025-12-23 9:36 ` Bartosz Golaszewski
0 siblings, 1 reply; 9+ messages in thread
From: Jiawen Wu @ 2025-12-23 8:44 UTC (permalink / raw)
To: 'Bartosz Golaszewski'
Cc: 'Bartosz Golaszewski', andriy.shevchenko, andy, broonie,
ckeepax, dakr, david.rhodes, djrscally, gregkh, heikki.krogerus,
krzk, linus.walleij, linux-acpi, linux-gpio, linux-kernel,
linux-sound, linux-spi, mstrozek, p.zabel, patches, rafael, rf,
sakari.ailus, 'Bartosz Golaszewski', andriy.shevchenko,
andy, broonie, ckeepax, dakr, david.rhodes, djrscally, gregkh,
heikki.krogerus, krzk, linus.walleij, linux-acpi, linux-gpio,
linux-kernel, linux-sound, linux-spi, mstrozek, p.zabel, patches,
rafael, rf, sakari.ailus
On Tue, Dec 23, 2025 4:09 PM, Bartosz Golaszewski wrote:
> On Tue, Dec 23, 2025 at 8:39 AM Jiawen Wu <jiawenwu@trustnetic.com> wrote:
> >
> > >
> > > #define SOFTWARE_NODE_REFERENCE(_ref_, ...) \
> > > (const struct software_node_ref_args) { \
> > > - .node = _ref_, \
> > > + .swnode = _Generic(_ref_, \
> > > + const struct software_node *: _ref_, \
> > > + default: NULL), \
> > > + .fwnode = _Generic(_ref_, \
> > > + struct fwnode_handle *: _ref_, \
> > > + default: NULL), \
> > > .nargs = COUNT_ARGS(__VA_ARGS__), \
> > > .args = { __VA_ARGS__ }, \
> > > }
> >
> > This change seems incompatible with my driver txgbe, since the software nodes
> > are registered in " struct software_node * " but not " const struct software_node * ".
> >
> > So when I pulled the net-next-6.19-rc1 that merged this patch, to probe my driver.
> > The error logs shows:
> >
> > [ 5.243396] txgbe 0000:10:00.0 (unnamed net_device) (uninitialized): unable to attach SFP bus: -EINVAL
> > [ 5.243399] txgbe 0000:10:00.0: failed to init phylink
> > [ 5.576008] txgbe 0000:10:00.0: probe with driver txgbe failed with error -22
> > [ 6.109548] txgbe 0000:10:00.1 (unnamed net_device) (uninitialized): unable to attach SFP bus: -EINVAL
> > [ 6.109551] txgbe 0000:10:00.1: failed to init phylink
> > [ 6.442044] txgbe 0000:10:00.1: probe with driver txgbe failed with error -22
> >
>
> This shouldn't have changed anything for existing software nodes - the
> pointer in struct software_node_ref_args has always been const. This
> would have failed at build-time if this was an issue. Have you
> bisected it to this very commit? What line is the -EINVAL assigned and
> for what reason?
The -EINVAL is assigned software_node_get_reference_args():
if (ref->swnode)
refnode = software_node_fwnode(ref->swnode);
else if (ref->fwnode)
refnode = ref->fwnode;
else
return -EINVAL;
I think the reason is that _Generic selection is restrictive, it only accept
exactly const struct software_node for software node references. So the
macro SOFTWARE_NODE_REFERENCE fall back to the default to set .swnode = NULL.
And I temporarily added this line to fix it:
diff --git a/include/linux/property.h b/include/linux/property.h
index 272bfbdea7bf..e30ef23a9af3 100644
--- a/include/linux/property.h
+++ b/include/linux/property.h
@@ -371,6 +371,7 @@ struct software_node_ref_args {
(const struct software_node_ref_args) { \
.swnode = _Generic(_ref_, \
const struct software_node *: _ref_, \
+ struct software_node *: _ref_, \
default: NULL), \
.fwnode = _Generic(_ref_, \
struct fwnode_handle *: _ref_, \
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v7 3/9] software node: allow referencing firmware nodes
2025-12-23 8:44 ` Jiawen Wu
@ 2025-12-23 9:36 ` Bartosz Golaszewski
2025-12-23 9:48 ` Jiawen Wu
0 siblings, 1 reply; 9+ messages in thread
From: Bartosz Golaszewski @ 2025-12-23 9:36 UTC (permalink / raw)
To: Jiawen Wu
Cc: Bartosz Golaszewski, andriy.shevchenko, andy, broonie, ckeepax,
dakr, david.rhodes, djrscally, gregkh, heikki.krogerus, krzk,
linus.walleij, linux-acpi, linux-gpio, linux-kernel, linux-sound,
linux-spi, mstrozek, p.zabel, patches, rafael, rf, sakari.ailus
On Tue, Dec 23, 2025 at 9:44 AM Jiawen Wu <jiawenwu@trustnetic.com> wrote:
>
> On Tue, Dec 23, 2025 4:09 PM, Bartosz Golaszewski wrote:
> > On Tue, Dec 23, 2025 at 8:39 AM Jiawen Wu <jiawenwu@trustnetic.com> wrote:
> > >
> > > >
> > > > #define SOFTWARE_NODE_REFERENCE(_ref_, ...) \
> > > > (const struct software_node_ref_args) { \
> > > > - .node = _ref_, \
> > > > + .swnode = _Generic(_ref_, \
> > > > + const struct software_node *: _ref_, \
> > > > + default: NULL), \
> > > > + .fwnode = _Generic(_ref_, \
> > > > + struct fwnode_handle *: _ref_, \
> > > > + default: NULL), \
> > > > .nargs = COUNT_ARGS(__VA_ARGS__), \
> > > > .args = { __VA_ARGS__ }, \
> > > > }
> > >
> > > This change seems incompatible with my driver txgbe, since the software nodes
> > > are registered in " struct software_node * " but not " const struct software_node * ".
> > >
> > > So when I pulled the net-next-6.19-rc1 that merged this patch, to probe my driver.
> > > The error logs shows:
> > >
> > > [ 5.243396] txgbe 0000:10:00.0 (unnamed net_device) (uninitialized): unable to attach SFP bus: -EINVAL
> > > [ 5.243399] txgbe 0000:10:00.0: failed to init phylink
> > > [ 5.576008] txgbe 0000:10:00.0: probe with driver txgbe failed with error -22
> > > [ 6.109548] txgbe 0000:10:00.1 (unnamed net_device) (uninitialized): unable to attach SFP bus: -EINVAL
> > > [ 6.109551] txgbe 0000:10:00.1: failed to init phylink
> > > [ 6.442044] txgbe 0000:10:00.1: probe with driver txgbe failed with error -22
> > >
> >
> > This shouldn't have changed anything for existing software nodes - the
> > pointer in struct software_node_ref_args has always been const. This
> > would have failed at build-time if this was an issue. Have you
> > bisected it to this very commit? What line is the -EINVAL assigned and
> > for what reason?
>
> The -EINVAL is assigned software_node_get_reference_args():
>
> if (ref->swnode)
> refnode = software_node_fwnode(ref->swnode);
> else if (ref->fwnode)
> refnode = ref->fwnode;
> else
> return -EINVAL;
>
> I think the reason is that _Generic selection is restrictive, it only accept
> exactly const struct software_node for software node references. So the
> macro SOFTWARE_NODE_REFERENCE fall back to the default to set .swnode = NULL.
>
> And I temporarily added this line to fix it:
>
> diff --git a/include/linux/property.h b/include/linux/property.h
> index 272bfbdea7bf..e30ef23a9af3 100644
> --- a/include/linux/property.h
> +++ b/include/linux/property.h
> @@ -371,6 +371,7 @@ struct software_node_ref_args {
> (const struct software_node_ref_args) { \
> .swnode = _Generic(_ref_, \
> const struct software_node *: _ref_, \
> + struct software_node *: _ref_, \
> default: NULL), \
> .fwnode = _Generic(_ref_, \
> struct fwnode_handle *: _ref_, \
>
Ah I see, we'd assign struct software_node * to const struct
software_node * and it used to work but with _Generic() we need the
exact type. I agree with this approach, do you want to send a proper
patch?
Bart
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [PATCH v7 3/9] software node: allow referencing firmware nodes
2025-12-23 9:36 ` Bartosz Golaszewski
@ 2025-12-23 9:48 ` Jiawen Wu
2025-12-23 10:41 ` Danilo Krummrich
0 siblings, 1 reply; 9+ messages in thread
From: Jiawen Wu @ 2025-12-23 9:48 UTC (permalink / raw)
To: 'Bartosz Golaszewski'
Cc: 'Bartosz Golaszewski', andriy.shevchenko, andy, broonie,
ckeepax, dakr, david.rhodes, djrscally, gregkh, heikki.krogerus,
krzk, linus.walleij, linux-acpi, linux-gpio, linux-kernel,
linux-sound, linux-spi, mstrozek, p.zabel, patches, rafael, rf,
sakari.ailus
On Tue, Dec 23, 2025 5:37 PM, Bartosz Golaszewski wrote:
> On Tue, Dec 23, 2025 at 9:44 AM Jiawen Wu <jiawenwu@trustnetic.com> wrote:
> >
> > On Tue, Dec 23, 2025 4:09 PM, Bartosz Golaszewski wrote:
> > > On Tue, Dec 23, 2025 at 8:39 AM Jiawen Wu <jiawenwu@trustnetic.com> wrote:
> > > >
> > > > >
> > > > > #define SOFTWARE_NODE_REFERENCE(_ref_, ...) \
> > > > > (const struct software_node_ref_args) { \
> > > > > - .node = _ref_, \
> > > > > + .swnode = _Generic(_ref_, \
> > > > > + const struct software_node *: _ref_, \
> > > > > + default: NULL), \
> > > > > + .fwnode = _Generic(_ref_, \
> > > > > + struct fwnode_handle *: _ref_, \
> > > > > + default: NULL), \
> > > > > .nargs = COUNT_ARGS(__VA_ARGS__), \
> > > > > .args = { __VA_ARGS__ }, \
> > > > > }
> > > >
> > > > This change seems incompatible with my driver txgbe, since the software nodes
> > > > are registered in " struct software_node * " but not " const struct software_node * ".
> > > >
> > > > So when I pulled the net-next-6.19-rc1 that merged this patch, to probe my driver.
> > > > The error logs shows:
> > > >
> > > > [ 5.243396] txgbe 0000:10:00.0 (unnamed net_device) (uninitialized): unable to attach SFP bus: -EINVAL
> > > > [ 5.243399] txgbe 0000:10:00.0: failed to init phylink
> > > > [ 5.576008] txgbe 0000:10:00.0: probe with driver txgbe failed with error -22
> > > > [ 6.109548] txgbe 0000:10:00.1 (unnamed net_device) (uninitialized): unable to attach SFP bus: -EINVAL
> > > > [ 6.109551] txgbe 0000:10:00.1: failed to init phylink
> > > > [ 6.442044] txgbe 0000:10:00.1: probe with driver txgbe failed with error -22
> > > >
> > >
> > > This shouldn't have changed anything for existing software nodes - the
> > > pointer in struct software_node_ref_args has always been const. This
> > > would have failed at build-time if this was an issue. Have you
> > > bisected it to this very commit? What line is the -EINVAL assigned and
> > > for what reason?
> >
> > The -EINVAL is assigned software_node_get_reference_args():
> >
> > if (ref->swnode)
> > refnode = software_node_fwnode(ref->swnode);
> > else if (ref->fwnode)
> > refnode = ref->fwnode;
> > else
> > return -EINVAL;
> >
> > I think the reason is that _Generic selection is restrictive, it only accept
> > exactly const struct software_node for software node references. So the
> > macro SOFTWARE_NODE_REFERENCE fall back to the default to set .swnode = NULL.
> >
> > And I temporarily added this line to fix it:
> >
> > diff --git a/include/linux/property.h b/include/linux/property.h
> > index 272bfbdea7bf..e30ef23a9af3 100644
> > --- a/include/linux/property.h
> > +++ b/include/linux/property.h
> > @@ -371,6 +371,7 @@ struct software_node_ref_args {
> > (const struct software_node_ref_args) { \
> > .swnode = _Generic(_ref_, \
> > const struct software_node *: _ref_, \
> > + struct software_node *: _ref_, \
> > default: NULL), \
> > .fwnode = _Generic(_ref_, \
> > struct fwnode_handle *: _ref_, \
> >
>
> Ah I see, we'd assign struct software_node * to const struct
> software_node * and it used to work but with _Generic() we need the
> exact type. I agree with this approach, do you want to send a proper
> patch?
It might be more appropriate for you to send the patch, and could also
check if there are any other missed details, like for fwnode...
I'm not very proficient in this field. :)
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v7 3/9] software node: allow referencing firmware nodes
2025-12-23 9:48 ` Jiawen Wu
@ 2025-12-23 10:41 ` Danilo Krummrich
2025-12-24 1:59 ` Jiawen Wu
0 siblings, 1 reply; 9+ messages in thread
From: Danilo Krummrich @ 2025-12-23 10:41 UTC (permalink / raw)
To: Jiawen Wu
Cc: 'Bartosz Golaszewski', 'Bartosz Golaszewski',
andriy.shevchenko, andy, broonie, ckeepax, david.rhodes,
djrscally, gregkh, heikki.krogerus, krzk, linus.walleij,
linux-acpi, linux-gpio, linux-kernel, linux-sound, linux-spi,
mstrozek, p.zabel, patches, rafael, rf, sakari.ailus
On Tue Dec 23, 2025 at 10:48 AM CET, Jiawen Wu wrote:
> On Tue, Dec 23, 2025 5:37 PM, Bartosz Golaszewski wrote:
>> On Tue, Dec 23, 2025 at 9:44 AM Jiawen Wu <jiawenwu@trustnetic.com> wrote:
>> > And I temporarily added this line to fix it:
>> >
>> > diff --git a/include/linux/property.h b/include/linux/property.h
>> > index 272bfbdea7bf..e30ef23a9af3 100644
>> > --- a/include/linux/property.h
>> > +++ b/include/linux/property.h
>> > @@ -371,6 +371,7 @@ struct software_node_ref_args {
>> > (const struct software_node_ref_args) { \
>> > .swnode = _Generic(_ref_, \
>> > const struct software_node *: _ref_, \
>> > + struct software_node *: _ref_, \
>> > default: NULL), \
>> > .fwnode = _Generic(_ref_, \
>> > struct fwnode_handle *: _ref_, \
>> >
>>
>> Ah I see, we'd assign struct software_node * to const struct
>> software_node * and it used to work but with _Generic() we need the
>> exact type. I agree with this approach, do you want to send a proper
>> patch?
>
> It might be more appropriate for you to send the patch, and could also
> check if there are any other missed details, like for fwnode...
> I'm not very proficient in this field. :)
There is already [1], which I queued up in the driver-core tree to send as fix
for -rc3.
[1] https://lore.kernel.org/lkml/20251219083638.2454138-1-sakari.ailus@linux.intel.com/
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [PATCH v7 3/9] software node: allow referencing firmware nodes
2025-12-23 10:41 ` Danilo Krummrich
@ 2025-12-24 1:59 ` Jiawen Wu
0 siblings, 0 replies; 9+ messages in thread
From: Jiawen Wu @ 2025-12-24 1:59 UTC (permalink / raw)
To: 'Danilo Krummrich'
Cc: 'Bartosz Golaszewski', 'Bartosz Golaszewski',
andriy.shevchenko, andy, broonie, ckeepax, david.rhodes,
djrscally, gregkh, heikki.krogerus, krzk, linus.walleij,
linux-acpi, linux-gpio, linux-kernel, linux-sound, linux-spi,
mstrozek, p.zabel, patches, rafael, rf, sakari.ailus,
'Bartosz Golaszewski', 'Bartosz Golaszewski',
andriy.shevchenko, andy, broonie, ckeepax, david.rhodes,
djrscally, gregkh, heikki.krogerus, krzk, linus.walleij,
linux-acpi, linux-gpio, linux-kernel, linux-sound, linux-spi,
mstrozek, p.zabel, patches, rafael, rf, sakari.ailus
On Tue, Dec 23, 2025 6:42 PM, Danilo Krummrich wrote:
> On Tue Dec 23, 2025 at 10:48 AM CET, Jiawen Wu wrote:
> > On Tue, Dec 23, 2025 5:37 PM, Bartosz Golaszewski wrote:
> >> On Tue, Dec 23, 2025 at 9:44 AM Jiawen Wu <jiawenwu@trustnetic.com> wrote:
> >> > And I temporarily added this line to fix it:
> >> >
> >> > diff --git a/include/linux/property.h b/include/linux/property.h
> >> > index 272bfbdea7bf..e30ef23a9af3 100644
> >> > --- a/include/linux/property.h
> >> > +++ b/include/linux/property.h
> >> > @@ -371,6 +371,7 @@ struct software_node_ref_args {
> >> > (const struct software_node_ref_args) { \
> >> > .swnode = _Generic(_ref_, \
> >> > const struct software_node *: _ref_, \
> >> > + struct software_node *: _ref_, \
> >> > default: NULL), \
> >> > .fwnode = _Generic(_ref_, \
> >> > struct fwnode_handle *: _ref_, \
> >> >
> >>
> >> Ah I see, we'd assign struct software_node * to const struct
> >> software_node * and it used to work but with _Generic() we need the
> >> exact type. I agree with this approach, do you want to send a proper
> >> patch?
> >
> > It might be more appropriate for you to send the patch, and could also
> > check if there are any other missed details, like for fwnode...
> > I'm not very proficient in this field. :)
>
> There is already [1], which I queued up in the driver-core tree to send as fix
> for -rc3.
>
> [1] https://lore.kernel.org/lkml/20251219083638.2454138-1-sakari.ailus@linux.intel.com/
I apologize for not noticing this patch... I did something superfluous.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2025-12-24 1:59 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-23 7:39 [PATCH v7 3/9] software node: allow referencing firmware nodes Jiawen Wu
2025-12-23 8:09 ` Bartosz Golaszewski
2025-12-23 8:44 ` Jiawen Wu
2025-12-23 9:36 ` Bartosz Golaszewski
2025-12-23 9:48 ` Jiawen Wu
2025-12-23 10:41 ` Danilo Krummrich
2025-12-24 1:59 ` Jiawen Wu
-- strict thread matches above, loose matches on Subject: below --
2025-11-20 13:23 [PATCH v7 0/9] reset: rework reset-gpios handling Bartosz Golaszewski
2025-11-20 13:23 ` [PATCH v7 3/9] software node: allow referencing firmware nodes Bartosz Golaszewski
2025-11-20 13:27 ` Charles Keepax
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).