TEXT   7

extension.txt

Guest on 10th August 2021 01:15:34 AM

  1.  
  2. Device Extensions
  3.  
  4.  
  5. Introduction
  6. ~~~~~~~~~~~~
  7.  
  8. Device extensions are internal extensions to a device, bus, or class
  9. driver. Extensions may or may not have an external interface
  10. associated with them and typically apply to every of a particular driver.
  11.  
  12. An example of an extension is the procfs or driverfs interface for PCI
  13. devices. Each PCI device gets a procfs file and two driverfs files.
  14. These extensions may or may not be present based on configuration
  15. options; or they may be included in a module. Instead of hard coding
  16. calls to add the devices to these interfaces, the extensions can be
  17. registered with the driver and each device added implicitly.
  18.  
  19.  
  20. Programming Interface
  21. ~~~~~~~~~~~~~~~~~~~~~
  22.  
  23. struct device_extension {
  24.         char                    * name;
  25.         rwlock_t                lock;
  26.         struct list_head        node;
  27.         dev_add_t               add_device;
  28.         dev_remove_t            remove_device;
  29. };
  30.  
  31. extern int dev_ext_register(struct device_extension *);
  32. extern void dev_ext_unregister(struct device_extension *);
  33.  
  34. extern int bus_ext_register(struct bus_type *, struct device_extension *);
  35. extern void bus_ext_unregister(struct bus_type *, struct device_extension *);
  36.  
  37. extern int class_ext_register(struct device_class *, struct device_extension *);
  38. extern void class_ext_unregister(struct device_class *, struct device_extension *);
  39.  
  40.  
  41. Extensions are specific to a particular driver, but the structure is
  42. common for each type of extension. So, a pointer to the entity that
  43. the extension belongs to must be passed to the registration function.
  44.  
  45.  
  46. Devices
  47. ~~~~~~~
  48. As devices are added to the various drivers, it is added to each
  49. extension of that driver. Extensions don't have to be applied to each
  50. device, but it is up to the extension to determine that.

Raw Paste


Login or Register to edit or fork this paste. It's free.