“In the last Driving Me Nuts column… we introduced the kernel
driver model framework with an explanation of how the generic bus
and driver and device code works. The i2c core was used as an
example to show how these different subsystems work. This month, we
cover how the driver class code works, again using the i2c code to
provide some working examples.“As discussed in the last column, device classes do not meet the
general object-oriented definition of a class; rather they are
something that provides a single type of function to the user. For
example, kernel classes are used for tty devices, block devices,
network devices, SCSI hosts and, in the near future,
filesystems.“In the 2.5.69 kernel, the driver class support was rewritten
radically. In previous kernel versions, class support was tied
tightly to the driver and device support. A class would be bound to
the device at the same time it was registered to a driver. This did
work for a number of devices and classes, but some real-world
devices did not fit very well into this model. Now, class support
is tied only loosely to devices and drivers; in fact, a device or
driver is not even needed to use the class code now, as the tty
class code shows. The class code is now split into three different
types of structures: classes, class devices and class
interfaces…”
Linux Journal: Device Classes
By
Greg Kroah-Hartman
Get the Free Newsletter!
Subscribe to Developer Insider for top news, trends, & analysis