public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: David Laight <david.laight.linux@gmail.com>
Cc: dakr@kernel.org, rafael@kernel.org, linux-kernel@vger.kernel.org,
	driver-core@lists.linux.dev,
	Gui-Dong Han <hanguidong02@gmail.com>
Subject: Re: [PATCH] driver core: faux: stop using static struct device
Date: Wed, 21 Jan 2026 18:03:19 +0100	[thread overview]
Message-ID: <2026012143-married-monoxide-16cf@gregkh> (raw)
In-Reply-To: <20260121145524.2ecd29eb@pumpkin>

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@linuxfoundation.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@gmail.com>
> > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.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

      reply	other threads:[~2026-01-21 17:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-21 10:29 [PATCH] driver core: faux: stop using static struct device Greg Kroah-Hartman
2026-01-21 12:12 ` Danilo Krummrich
2026-01-21 14:55 ` David Laight
2026-01-21 17:03   ` Greg Kroah-Hartman [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2026012143-married-monoxide-16cf@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=dakr@kernel.org \
    --cc=david.laight.linux@gmail.com \
    --cc=driver-core@lists.linux.dev \
    --cc=hanguidong02@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox