Introduce struct device_interface.
Device interfaces are the logical interfaces of device classes that correlate directly to userspace interfaces, like device nodes. 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. 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. Interfaces get a directory in driverfs under their class's directory. Each time a device is added to the interface, a symlink is created in that directory that points to the device's directory in the physical hierarchy. The name of this symlink is the interface-enumerated value of the device.
Showing
drivers/base/fs/intf.c
0 → 100644
drivers/base/intf.c
0 → 100644
Please register or sign in to comment