Device interfaces are the logical interfaces of device classes that correlate directly to userspace interfaces, like device nodes. Each device class may have multiple interfaces through which you can access the same device. An input device may support the mouse interface, the 'evdev' interface, and the touchscreen interface. A SCSI disk would support the disk interface, the SCSI generic interface, and possibly a raw device interface.
Device interfaces are registered with the class they belong to. As devices are added to the class, they are added to each interface registered with the class. The interface is responsible for determining whether the device supports the interface or not.
int (*add_device)(struct device *); int (*add_device)(struct intf_data *); };
int interface_register(struct device_interface *); void interface_unregister(struct device_interface *);
An interface must specify the device class it belongs to. It is added to that class's list of interfaces on registration.
Interfaces can be added to a device class at any time. Whenever it is added, each device in the class is passed to the interface's add_device callback. When an interface is removed, each device is removed from the interface.
Devices ~~~~~~~ Once a device is added to a device class, it is added to each interface that is registered with the device class. The class is expected to place a class-specific data structure in struct device::class_data. The interface can use that (along with other fields of struct device) to determine whether or not the driver and/or device support that particular interface.
The interface is responsible for allocating and initializing a struct intf_data and calling interface_add_data() to add it to the device's list of interfaces it belongs to. This list will be iterated over when the device is removed from the class (instead of all possible interfaces for a class). This structure should probably be embedded in whatever per-device data structure the interface is allocating anyway. Devices are enumerated within the interface. This happens in interface_add_data() and the enumerated value is stored in the struct intf_data for that device.
sysfs ~~~~~ Each interface is given a directory in the directory of the device class it belongs to:
Interfaces get a directory in the class's directory as well:
A device interface is correlated directly with a userspace interface for a device, specifically a device node. For instance, a SCSI disk exposes at least two interfaces to userspace: the standard SCSI disk interface and the SCSI generic interface. It might also export a raw device interface.
Many interfaces have a major number associated with them and each device gets a minor number. Or, multiple interfaces might share one major number, and each will receive a range of minor numbers (like in the case of input devices).
These major and minor numbers could be stored in the interface structure. Major and minor allocations could happen when the interface is registered with the class, or via a helper function.
您能有收获就是我们最大的动力
不管多少都是对分享的肯定
打开支付宝扫一扫,即可进行扫码捐赠
不管多少都是对分享的肯定
打开微信扫一扫,即可进行扫码捐赠
文章
Kernel-3.10.0-957.el7_3270
IBM 3270 Display System support This file describes the driver that supports local channel attachmentof IBM 3270 devices. It consists of three section
Kernel-2.6.32-573.12.1.el6_devices
LINUX ALLOCATED DEVICES (2.6+ version) Maintained by Alan Cox <device@lanana.org> Last revised: 6th April 2009 This list is the Linux Device Lis
Kernel-3.10.0-957.el7_3c509
Linux and the 3Com EtherLink III Series Ethercards (driver v1.18c and higher)This file contains the instructions and caveats for v1.18c and higher ver
Kernel-3.10.0-957.el7_4CCs
Guidelines for Linux4Linux pixel format 4CCsGuidelines for Video4Linux 4CC codes defined using v4l2_fourcc() arespecified in this document. First of t
Kernel-3.10.0-957.el7_53c700
General DescriptionThis driver supports the 53c700 and 53c700-66 chips. It also supportsthe 53c710 but only in 53c700 emulation mode. It is full featu