[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <2026012143-married-monoxide-16cf@gregkh>
Date: Wed, 21 Jan 2026 18:03:19 +0100
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: David Laight <david.laight.linux@...il.com>
Cc: dakr@...nel.org, rafael@...nel.org, linux-kernel@...r.kernel.org,
driver-core@...ts.linux.dev, Gui-Dong Han <hanguidong02@...il.com>
Subject: Re: [PATCH] driver core: faux: stop using static struct device
On Wed, Jan 21, 2026 at 02:55:24PM +0000, David Laight wrote:
> On Wed, 21 Jan 2026 11:29:45 +0100
> Greg Kroah-Hartman <gregkh@...uxfoundation.org> wrote:
>
> > faux_bus_root should not have been a static struct device, but rather a
> > dynamically created structure so that lockdep and other testing tools do
> > not trip over it (as well as being the right thing overall to do.) Fix
> > this up by making it properly dynamic.
> >
> > Reported-by: Gui-Dong Han <hanguidong02@...il.com>
> > Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
> > ---
> > drivers/base/faux.c | 18 +++++++++++-------
> > 1 file changed, 11 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/base/faux.c b/drivers/base/faux.c
> > index 21dd02124231..23d725817232 100644
> > --- a/drivers/base/faux.c
> > +++ b/drivers/base/faux.c
> > @@ -29,9 +29,7 @@ struct faux_object {
> > };
> > #define to_faux_object(dev) container_of_const(dev, struct faux_object, faux_dev.dev)
> >
> > -static struct device faux_bus_root = {
> > - .init_name = "faux",
> > -};
> > +static struct device *faux_bus_root;
> >
> > static int faux_match(struct device *dev, const struct device_driver *drv)
> > {
> > @@ -152,7 +150,7 @@ struct faux_device *faux_device_create_with_groups(const char *name,
> > if (parent)
> > dev->parent = parent;
> > else
> > - dev->parent = &faux_bus_root;
> > + dev->parent = faux_bus_root;
> > dev->bus = &faux_bus_type;
> > dev_set_name(dev, "%s", name);
> > device_set_pm_not_required(dev);
> > @@ -236,9 +234,15 @@ int __init faux_bus_init(void)
> > {
> > int ret;
>
> Should there be:
> if (faux_bus_root)
> return -EBUSY;
> here?
How can that happen?
> While I guess there shouldn't be two of these, better be safe.
It can't, no need for that :)
thanks,
greg k-h
Powered by blists - more mailing lists