[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sun, 6 Jun 2010 19:17:32 +0200
From: Kay Sievers <kay.sievers@...y.org>
To: Johannes Berg <johannes@...solutions.net>
Cc: "Eric W. Biederman" <ebiederm@...ssion.com>,
Greg KH <greg@...ah.com>, netdev <netdev@...r.kernel.org>
Subject: Re: [RFC][PATCH] Fix another namespace issue with devices assigned to
classes
On Sun, Jun 6, 2010 at 15:08, Johannes Berg <johannes@...solutions.net> wrote:
> On Fri, 2010-06-04 at 10:34 +0200, Kay Sievers wrote:
>> Actually there is not much reason to ever use "struct class" today.
>> The layout for classes in /sys is not extendable like it is for buses
>> which put all devices in a devices/ subdir and have the main subsystem
>> directory to add custom things.
>
> Ok, I don't get it.
>
> For hwsim, we create entirely virtual "struct device"s. I think we just
> need that so userspace like network-manager doesn't get completely
> confused. BUT: device_create() needs a struct class parameter as the
> first parameter. So should we have a virtual class _and_ a virtual bus??
>
> Similarly for wireless itself (net/wireless/), we use
> device_initialize() and set up the dev.class and dev.platform_data (not
> sure why platform data?) since this is a virtual abstraction. Basically
> we want to show in sysfs that
>
> physical device
> +--- (virtual) wireless phy device 1
> +--- netdev 1
> +--- netdev 2
> +--- netdev 3
> +--- (virtual) wireless phy device 2
> +--- netdev 4
>
> Although the second wireless phy device is only done by ath9k and will
> be removed soon. Still we should show that those netdevs all belong to
> the given wireless phy device.
>
> So ... what should I do? How can I do device_create/device_initialize
> without a struct class?
There is no real difference between classes and buses. Actually we're
working on merging them completely inside the kernel. Just declare a
"struct bus_type" instead of a "struct class".
> And why a bus instead? It's not like there are
> devices that need to be discovered and bound to it etc.
Because class devices are not meat to ever have children from other
classes. This is just not what they should be used like.
Also the flat directories in /sys/class/<name>/* are not extendable
with other stuff, and they should not be used for new stuff. You can
never put subsystem-wide properties to that directory without
confusing userspace. That is not a problem at all with buses, as they
have a dedicated devices/ subdir in the bus directory. If there are no
legacy reason, or things which are already a class, and they should
look similar, no new classes should be added to the kernel.
Kay
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists