Re: [PATCH 1/3] driver core: add a faux bus for use when a simple device/bus is needed

From: Greg Kroah-Hartman
Date: Tue Feb 04 2025 - 05:14:25 EST


On Tue, Feb 04, 2025 at 09:25:32AM +0000, Jonathan Cameron wrote:
> On Mon, 3 Feb 2025 15:25:17 +0100
> Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> wrote:
>
> > Many drivers abuse the platform driver/bus system as it provides a
> > simple way to create and bind a device to a driver-specific set of
> > probe/release functions. Instead of doing that, and wasting all of the
> > memory associated with a platform device, here is a "faux" bus that
> > can be used instead.
> >
> > Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
>
> Nice. One trivial thing inline.
>
>
> > diff --git a/drivers/base/faux.c b/drivers/base/faux.c
> > new file mode 100644
> > index 000000000000..0eba89a5cd57
> > --- /dev/null
> > +++ b/drivers/base/faux.c
> > @@ -0,0 +1,189 @@
>
>
> > +int __init faux_bus_init(void)
> > +{
> > + int error;
> > +
> > + error = device_register(&faux_bus_root);
> > + if (error) {
> > + put_device(&faux_bus_root);
> > + return error;
> > + }
> > +
> > + error = bus_register(&faux_bus_type);
>
> Odd bonus space after =

Thanks! I caught that when I just rewrote this function, and I finally
got around to running checkpatch which found another error in it that I
missed. It's sometimes easier to notice changes in other's code than
your own :)

greg k-h