By Jonathan Corbet
January 11, 2012
Since the early days of the Linux device model, there has been a special
device class for "system devices," typically those built into the platform
itself. For almost as long, the driver core developers have felt that
there was no real need for this device type, which looks weirdly different
from every other type of device. For 3.3, they have actually done
something about it; system devices are no more.
All in-tree system device drivers have been fixed up to use regular devices
instead. The process is relatively simple; it can be seen in, for example,
this
commit updating kernel/time/clocksource.c. In short, the
embedded struct sys_device becomes a simple struct device
instead. Attributes defined with SYSDEV_ATTR() are switched to
DEVICE_ATTR(). The sysdev_class structure is turned into
a nearly empty bus_type structure instead. That is about all that
is required.
These changes, naturally, cause a user-space ABI change; system devices had
their own special area under /sys which goes away. That has the
potential to break programs and scripts, which would not be a good thing.
To avoid this problem, a special function has been added:
int subsys_system_register(struct bus_type *subsys,
const struct attribute_group **groups);
Registering a subsystem in this way will restore its old
/sys/devices/system hierarchy. Needless to say, this function
exists for backward compatibility purposes only; using it in new drivers is
not likely to be received well.
(
Log in to post comments)