Re: [PATCH v2 1/2] driver core: make fwnode_is_primary() public

From: Rafael J. Wysocki

Date: Mon Feb 23 2026 - 14:47:13 EST


On Mon, Feb 23, 2026 at 8:32 PM Andy Shevchenko
<andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:
>
> On Mon, Feb 23, 2026 at 07:28:48PM +0100, Bartosz Golaszewski wrote:
> > On Mon, Feb 23, 2026 at 6:54 PM Andy Shevchenko
> > <andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:
> > >
> > > On Mon, Feb 23, 2026 at 04:40:52PM +0100, Bartosz Golaszewski wrote:
> > > > Export fwnode_is_primary() in fwnode.h for use in driver code.
>
> ...
>
> > > > --- a/include/linux/fwnode.h
> > > > +++ b/include/linux/fwnode.h
> > > > @@ -230,4 +230,9 @@ void fwnode_links_purge(struct fwnode_handle *fwnode);
> > > > void fw_devlink_purge_absent_suppliers(struct fwnode_handle *fwnode);
> > > > bool fw_devlink_is_strict(void);
> > > >
> > > > +static inline bool fwnode_is_primary(struct fwnode_handle *fwnode)
> > > > +{
> > > > + return fwnode && !IS_ERR(fwnode->secondary);
> > > > +}
> > >
> > > This is inconsistent. Please, split out fwnode stuff from device.h to
> > > device/fwnode.h and share it there.
> > >
> > > This reminds me to look what I have locally in development...
> > >
> > >
> > > (With your patch it will be in device.h and fwnode.h and in the latter
> > > it's even not properly grouped with other non-fwdevlink related stuff.)
> >
> > Please rephrase the entire email because I have no idea what you mean. :(
>
> The primary/secondary and other device-fwnode related stuff is currently
> exposed via include/linux/device.h. The problem is that device.h is overloaded
> and starves for more splitting, which I'm doing (very slowly, though).
> The idea is to have all device-fwnode (and maybe of_node) stuff to be gathered in
> include/linux/device/fwnode.h

I don't see "struct device" anywhere in fwnode_is_primary(). This
check is only about whether or not the given fwnode has a valid
secondary fwnode.

> You, guys, missed the keyword 'device' in the pathname for the proposed
> [include/linux/device/]fwnode.h.

Why do you think we missed it?