DOCUMENTATION: Update overview.txt in Doc/driver-model.
A few grammatical fixes, clarifications and corrections in just the overview file for the driver model documentation. Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
e556b8131a
commit
5464e9c721
@ -30,7 +30,7 @@ management, and hot plug. In particular, the model dictated by Intel and
|
|||||||
Microsoft (namely ACPI) ensures that almost every device on almost any bus
|
Microsoft (namely ACPI) ensures that almost every device on almost any bus
|
||||||
on an x86-compatible system can work within this paradigm. Of course,
|
on an x86-compatible system can work within this paradigm. Of course,
|
||||||
not every bus is able to support all such operations, although most
|
not every bus is able to support all such operations, although most
|
||||||
buses support a most of those operations.
|
buses support most of those operations.
|
||||||
|
|
||||||
|
|
||||||
Downstream Access
|
Downstream Access
|
||||||
@ -46,25 +46,29 @@ struct pci_dev now looks like this:
|
|||||||
struct pci_dev {
|
struct pci_dev {
|
||||||
...
|
...
|
||||||
|
|
||||||
struct device dev;
|
struct device dev; /* Generic device interface */
|
||||||
|
...
|
||||||
};
|
};
|
||||||
|
|
||||||
Note first that it is statically allocated. This means only one allocation on
|
Note first that the struct device dev within the struct pci_dev is
|
||||||
device discovery. Note also that it is at the _end_ of struct pci_dev. This is
|
statically allocated. This means only one allocation on device discovery.
|
||||||
to make people think about what they're doing when switching between the bus
|
|
||||||
driver and the global driver; and to prevent against mindless casts between
|
Note also that that struct device dev is not necessarily defined at the
|
||||||
the two.
|
front of the pci_dev structure. This is to make people think about what
|
||||||
|
they're doing when switching between the bus driver and the global driver,
|
||||||
|
and to discourage meaningless and incorrect casts between the two.
|
||||||
|
|
||||||
The PCI bus layer freely accesses the fields of struct device. It knows about
|
The PCI bus layer freely accesses the fields of struct device. It knows about
|
||||||
the structure of struct pci_dev, and it should know the structure of struct
|
the structure of struct pci_dev, and it should know the structure of struct
|
||||||
device. Individual PCI device drivers that have been converted to the current
|
device. Individual PCI device drivers that have been converted to the current
|
||||||
driver model generally do not and should not touch the fields of struct device,
|
driver model generally do not and should not touch the fields of struct device,
|
||||||
unless there is a strong compelling reason to do so.
|
unless there is a compelling reason to do so.
|
||||||
|
|
||||||
This abstraction is prevention of unnecessary pain during transitional phases.
|
The above abstraction prevents unnecessary pain during transitional phases.
|
||||||
If the name of the field changes or is removed, then every downstream driver
|
If it were not done this way, then when a field was renamed or removed, every
|
||||||
will break. On the other hand, if only the bus layer (and not the device
|
downstream driver would break. On the other hand, if only the bus layer
|
||||||
layer) accesses struct device, it is only that layer that needs to change.
|
(and not the device layer) accesses the struct device, it is only the bus
|
||||||
|
layer that needs to change.
|
||||||
|
|
||||||
|
|
||||||
User Interface
|
User Interface
|
||||||
@ -73,15 +77,27 @@ User Interface
|
|||||||
By virtue of having a complete hierarchical view of all the devices in the
|
By virtue of having a complete hierarchical view of all the devices in the
|
||||||
system, exporting a complete hierarchical view to userspace becomes relatively
|
system, exporting a complete hierarchical view to userspace becomes relatively
|
||||||
easy. This has been accomplished by implementing a special purpose virtual
|
easy. This has been accomplished by implementing a special purpose virtual
|
||||||
file system named sysfs. It is hence possible for the user to mount the
|
file system named sysfs.
|
||||||
whole sysfs filesystem anywhere in userspace.
|
|
||||||
|
|
||||||
This can be done permanently by providing the following entry into the
|
Almost all mainstream Linux distros mount this filesystem automatically; you
|
||||||
/etc/fstab (under the provision that the mount point does exist, of course):
|
can see some variation of the following in the output of the "mount" command:
|
||||||
|
|
||||||
none /sys sysfs defaults 0 0
|
$ mount
|
||||||
|
...
|
||||||
|
none on /sys type sysfs (rw,noexec,nosuid,nodev)
|
||||||
|
...
|
||||||
|
$
|
||||||
|
|
||||||
Or by hand on the command line:
|
The auto-mounting of sysfs is typically accomplished by an entry similar to
|
||||||
|
the following in the /etc/fstab file:
|
||||||
|
|
||||||
|
none /sys sysfs defaults 0 0
|
||||||
|
|
||||||
|
or something similar in the /lib/init/fstab file on Debian-based systems:
|
||||||
|
|
||||||
|
none /sys sysfs nodev,noexec,nosuid 0 0
|
||||||
|
|
||||||
|
If sysfs is not automatically mounted, you can always do it manually with:
|
||||||
|
|
||||||
# mount -t sysfs sysfs /sys
|
# mount -t sysfs sysfs /sys
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user