[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y44SA2sY44mQ58OM@kroah.com>
Date: Mon, 5 Dec 2022 16:45:07 +0100
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Allen Webb <allenwebb@...gle.com>
Cc: "linux-modules@...r.kernel.org" <linux-modules@...r.kernel.org>,
"linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Luis Chamberlain <mcgrof@...nel.org>,
"Rafael J. Wysocki" <rafael@...nel.org>
Subject: Re: [PATCH v6 2/5] drivers: Add bus_for_each for iterating over the
subsystems
On Fri, Dec 02, 2022 at 04:47:41PM -0600, Allen Webb wrote:
> In order to print the match-id-based modaliases it must be possible to
> reach the match id tables of each driver. With this function it becomes
> possible to iterate over each subsystem which can be paired with
> iterating over each driver.
>
> Signed-off-by: Allen Webb <allenwebb@...gle.com>
> ---
> drivers/base/bus.c | 42 ++++++++++++++++++++++++++++++++++++++
> include/linux/device/bus.h | 1 +
> 2 files changed, 43 insertions(+)
>
> diff --git a/drivers/base/bus.c b/drivers/base/bus.c
> index 7ca47e5b3c1f4..4e0c5925545e5 100644
> --- a/drivers/base/bus.c
> +++ b/drivers/base/bus.c
> @@ -178,6 +178,48 @@ static const struct kset_uevent_ops bus_uevent_ops = {
>
> static struct kset *bus_kset;
>
> +/**
> + * bus_for_each - bus iterator.
> + * @start: bus to start iterating from.
> + * @data: data for the callback.
> + * @fn: function to be called for each device.
> + *
> + * Iterate over list of buses, and call @fn for each,
> + * passing it @data. If @start is not NULL, we use that bus to
> + * begin iterating from.
Where is there a list of all busses in the system? This feels very odd.
A bus can list all devices on it, but busses have no relationship to
each other at all and are independent.
So to iterate over all busses in the system feels very wrong, and again,
a layering violation as that would allow non-dependant busses to poke
around in other busses. Not something you want to do at all.
I guess I don't understand why this is needed, so some justification is
required.
thanks,
greg k-h
Powered by blists - more mailing lists