~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/Documentation/driver-api/driver-model/overview.rst

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /Documentation/driver-api/driver-model/overview.rst (Version linux-6.12-rc7) and /Documentation/driver-api/driver-model/overview.rst (Version linux-4.17.19)


  1 =============================                     
  2 The Linux Kernel Device Model                     
  3 =============================                     
  4                                                   
  5 Patrick Mochel  <mochel@digitalimplant.org>        
  6                                                   
  7 Drafted 26 August 2002                            
  8 Updated 31 January 2006                           
  9                                                   
 10                                                   
 11 Overview                                          
 12 ~~~~~~~~                                          
 13                                                   
 14 The Linux Kernel Driver Model is a unification    
 15 models that were previously used in the kernel    
 16 bus-specific drivers for bridges and devices b    
 17 and operations into globally accessible data s    
 18                                                   
 19 Traditional driver models implemented some sor    
 20 (sometimes just a list) for the devices they c    
 21 uniformity across the different bus types.        
 22                                                   
 23 The current driver model provides a common, un    
 24 a bus and the devices that can appear under th    
 25 model includes a set of common attributes whic    
 26 of common callbacks, such as device discovery     
 27 shutdown, bus power management, etc.              
 28                                                   
 29 The common device and bridge interface reflect    
 30 computer: namely the ability to do seamless de    
 31 management, and hot plug. In particular, the m    
 32 Microsoft (namely ACPI) ensures that almost ev    
 33 on an x86-compatible system can work within th    
 34 not every bus is able to support all such oper    
 35 buses support most of those operations.           
 36                                                   
 37                                                   
 38 Downstream Access                                 
 39 ~~~~~~~~~~~~~~~~~                                 
 40                                                   
 41 Common data fields have been moved out of indi    
 42 data structure. These fields must still be acc    
 43 and sometimes by the device-specific drivers.     
 44                                                   
 45 Other bus layers are encouraged to do what has    
 46 struct pci_dev now looks like this::              
 47                                                   
 48   struct pci_dev {                                
 49         ...                                       
 50                                                   
 51         struct device dev;     /* Generic devi    
 52         ...                                       
 53   };                                              
 54                                                   
 55 Note first that the struct device dev within t    
 56 statically allocated. This means only one allo    
 57                                                   
 58 Note also that that struct device dev is not n    
 59 front of the pci_dev structure.  This is to ma    
 60 they're doing when switching between the bus d    
 61 and to discourage meaningless and incorrect ca    
 62                                                   
 63 The PCI bus layer freely accesses the fields o    
 64 the structure of struct pci_dev, and it should    
 65 device. Individual PCI device drivers that hav    
 66 driver model generally do not and should not t    
 67 unless there is a compelling reason to do so.     
 68                                                   
 69 The above abstraction prevents unnecessary pai    
 70 If it were not done this way, then when a fiel    
 71 downstream driver would break.  On the other h    
 72 (and not the device layer) accesses the struct    
 73 layer that needs to change.                       
 74                                                   
 75                                                   
 76 User Interface                                    
 77 ~~~~~~~~~~~~~~                                    
 78                                                   
 79 By virtue of having a complete hierarchical vi    
 80 system, exporting a complete hierarchical view    
 81 easy. This has been accomplished by implementi    
 82 file system named sysfs.                          
 83                                                   
 84 Almost all mainstream Linux distros mount this    
 85 can see some variation of the following in the    
 86                                                   
 87   $ mount                                         
 88   ...                                             
 89   none on /sys type sysfs (rw,noexec,nosuid,no    
 90   ...                                             
 91   $                                               
 92                                                   
 93 The auto-mounting of sysfs is typically accomp    
 94 the following in the /etc/fstab file::            
 95                                                   
 96   none          /sys    sysfs    defaults         
 97                                                   
 98 or something similar in the /lib/init/fstab fi    
 99                                                   
100   none            /sys    sysfs    nodev,noexe    
101                                                   
102 If sysfs is not automatically mounted, you can    
103                                                   
104         # mount -t sysfs sysfs /sys               
105                                                   
106 Whenever a device is inserted into the tree, a    
107 This directory may be populated at each layer     
108 the bus layer, or the device layer.               
109                                                   
110 The global layer currently creates two files -    
111 former only reports the name of the device. Th    
112 current power state of the device. It will als    
113 power state.                                      
114                                                   
115 The bus layer may also create files for the de    
116 bus. For example, the PCI layer currently crea    
117 for each PCI device.                              
118                                                   
119 A device-specific driver may also export files    
120 device-specific data or tunable interfaces.       
121                                                   
122 More information about the sysfs directory lay    
123 the other documents in this directory and in t    
124 Documentation/filesystems/sysfs.rst.              
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php