[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250204092532.000001ca@huawei.com>
Date: Tue, 4 Feb 2025 09:25:32 +0000
From: Jonathan Cameron <Jonathan.Cameron@...wei.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
CC: "Rafael J. Wysocki" <rafael@...nel.org>, Danilo Krummrich
<dakr@...nel.org>, Lyude Paul <lyude@...hat.com>, Alexander Lobakin
<aleksander.lobakin@...el.com>, Andy Shevchenko
<andriy.shevchenko@...ux.intel.com>, Bjorn Helgaas <bhelgaas@...gle.com>,
Liam Girdwood <lgirdwood@...il.com>, Lukas Wunner <lukas@...ner.de>, "Mark
Brown" <broonie@...nel.org>, MaĆra Canal
<mairacanal@...eup.net>, Robin Murphy <robin.murphy@....com>, Simona Vetter
<simona.vetter@...ll.ch>, Zijun Hu <quic_zijuhu@...cinc.com>,
<linux-kernel@...r.kernel.org>, <linux-usb@...r.kernel.org>,
<rust-for-linux@...r.kernel.org>
Subject: Re: [PATCH 1/3] driver core: add a faux bus for use when a simple
device/bus is needed
On Mon, 3 Feb 2025 15:25:17 +0100
Greg Kroah-Hartman <gregkh@...uxfoundation.org> 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@...uxfoundation.org>
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 =
> + if (error)
> + device_unregister(&faux_bus_root);
> +
> + return error;
> +}
Powered by blists - more mailing lists