Commit eccd9e25 authored by Patrick Mochel's avatar Patrick Mochel

Driver model: doc updates.

From Geert Uytterhoeven
parent 693ccaab
......@@ -11,11 +11,11 @@ structures, most of the binding can take place using common code.
Bus
~~~
The bus type structure contains a list of all devices that on that bus
The bus type structure contains a list of all devices that are on that bus
type in the system. When device_register is called for a device, it is
inserted into the end of this list. The bus object also contains a
list of all drivers of that bus type. When driver_register is called
for a driver, it is inserted into the end of this list. These are the
for a driver, it is inserted at the end of this list. These are the
two events which trigger driver binding.
......@@ -42,7 +42,7 @@ Device Class
~~~~~~~~~~~~
Upon the successful completion of probe, the device is registered with
the class to which it belongs. Device drivers belong to one and only
the class to which it belongs. Device drivers belong to one and only one
class, and that is set in the driver's devclass field.
devclass_add_device is called to enumerate the device within the class
and actually register it with the class, which happens with the
......@@ -61,7 +61,7 @@ driver's list of devices.
sysfs
~~~~~~~~
~~~~~
A symlink is created in the bus's 'devices' directory that points to
the device's directory in the physical hierarchy.
......
......@@ -58,7 +58,7 @@ match(): Attaching Drivers to Devices
The format of device ID structures and the semantics for comparing
them are inherently bus-specific. Drivers typically declare an array
of device IDs of device they support that reside in a bus-specific
of device IDs of devices they support that reside in a bus-specific
driver structure.
The purpose of the match callback is provide the bus an opportunity to
......@@ -153,7 +153,7 @@ directory:
|-- agpgart
`-- e100
Each device that is discovered a bus of that type gets a symlink in
Each device that is discovered on a bus of that type gets a symlink in
the bus's devices directory to the device's directory in the physical
hierarchy:
......
......@@ -105,7 +105,7 @@ default subdirectories:
Drivers registered with the class get a symlink in the drivers/ directory
that points the driver's directory (under its bus directory):
that points to the driver's directory (under its bus directory):
class/
`-- input
......
......@@ -47,11 +47,13 @@ intf_list: List of intf_data. There is one structure allocated for
children: List of child devices.
parent: *** FIXME ***
name: ASCII description of device.
Example: " 3Com Corporation 3c905 100BaseTX [Boomerang]"
bus_id: ASCII representation of device's bus position. This
field should a name unique across all devices on the
field should be a name unique across all devices on the
bus type the device belongs to.
Example: PCI bus_ids are in the form of
......@@ -66,12 +68,12 @@ bus: Pointer to struct bus_type that device belongs to.
dir: Device's sysfs directory.
class_num: Class-enumerated value of the device.
driver: Pointer to struct device_driver that controls the device.
driver_data: Driver-specific data.
class_num: Class-enumerated value of the device.
platform_data: Platform data specific to the device.
current_state: Current power state of the device.
......@@ -108,7 +110,7 @@ get_device() will return a pointer to the struct device passed to it
if the reference is not already 0 (if it's in the process of being
removed already).
A driver can take use the lock in the device structure using:
A driver can access the lock in the device structure using:
void lock_device(struct device * dev);
void unlock_device(struct device * dev);
......
......@@ -63,9 +63,9 @@ Most drivers will not be able to be converted completely to the new
model because the bus they belong to has a bus-specific structure with
bus-specific fields that cannot be generalized.
The most common example this are device ID structures. A driver
The most common example of this are device ID structures. A driver
typically defines an array of device IDs that it supports. The format
of this structure and the semantics for comparing device IDs is
of these structures and the semantics for comparing device IDs are
completely bus-specific. Defining them as bus-specific entities would
sacrifice type-safety, so we keep bus-specific structures around.
......@@ -77,8 +77,8 @@ struct pci_driver {
struct device_driver driver;
};
A definition that included bus-specific fields would look something
like (using the eepro100 driver again):
A definition that included bus-specific fields would look like
(using the eepro100 driver again):
static struct pci_driver eepro100_driver = {
.id_table = eepro100_pci_tbl,
......@@ -109,7 +109,7 @@ struct device_driver object.
Most drivers, however, will have a bus-specific structure and will
need to register with the bus using something like pci_driver_register.
It is important that drivers register their drivers as early as
It is important that drivers register their driver structure as early as
possible. Registration with the core initializes several fields in the
struct device_driver object, including the reference count and the
lock. These fields are assumed to be valid at all times and may be
......@@ -148,7 +148,7 @@ accesses it.
sysfs
~~~~~~~~
~~~~~
When a driver is registered, a sysfs directory is created in its
bus's directory. In this directory, the driver can export an interface
......@@ -205,7 +205,7 @@ management based on the requirements of the system and the
user-defined policy.
SUSPEND_NOTIFY notifies the device that a suspend transition is about
to happen. This happens on system power state transition to verify
to happen. This happens on system power state transitions to verify
that all devices can successfully suspend.
A driver may choose to fail on this call, which should cause the
......
......@@ -82,7 +82,7 @@ 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:
......@@ -120,10 +120,10 @@ 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 get receive a range of minor numbers (like in
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 allocation could happen when the interface
structure. Major and minor allocations could happen when the interface
is registered with the class, or via a helper function.
......@@ -9,7 +9,7 @@ Overview
~~~~~~~~
This driver model is a unification of all the current, disparate driver models
that are currently in the kernel. It is intended is to augment the
that are currently in the kernel. It is intended to augment the
bus-specific drivers for bridges and devices by consolidating a set of data
and operations into globally accessible data structures.
......@@ -23,7 +23,7 @@ tree as well as its local tree. In fact, the local tree becomes just a subset
of the global tree.
Common data fields can also be moved out of the local bus models into the
global model. Some of the manipulation of these fields can also be
global model. Some of the manipulations of these fields can also be
consolidated. Most likely, manipulation functions will become a set
of helper functions, which the bus drivers wrap around to include any
bus-specific items.
......@@ -71,7 +71,7 @@ fields of struct device unless there is a strong compelling reason to do so.
This abstraction is prevention of unnecessary pain during transitional phases.
If the name of the field changes or is removed, then every downstream driver
will break. On the other hand, if only the bus layer (and not the device
layer) accesses struct device, it is only those that need to change.
layer) accesses struct device, it is only that layer that needs to change.
User Interface
......@@ -96,9 +96,9 @@ Whenever a device is inserted into the tree, a directory is created for it.
This directory may be populated at each layer of discovery - the global layer,
the bus layer, or the device layer.
The global layer currently creates two files - name and 'power'. The
The global layer currently creates two files - 'name' and 'power'. The
former only reports the name of the device. The latter reports the
current power state of the device. It also be used to set the current
current power state of the device. It will also be used to set the current
power state.
The bus layer may also create files for the devices it finds while probing the
......
......@@ -10,9 +10,9 @@ host bridges to peripheral buses.
Platform drivers
~~~~~~~~~~~~~~~~
Drivers for platform devices have typically very simple and
Drivers for platform devices are typically very simple and
unstructured. Either the device was present at a particular I/O port
and the driver was loaded, or there was not. There was no possibility
and the driver was loaded, or it was not. There was no possibility
of hotplugging or alternative discovery besides probing at a specific
I/O address and expecting a specific response.
......@@ -49,7 +49,7 @@ devices that it discovers via the bus's add() callback:
Bus IDs
~~~~~~~
Bus IDs are the canonical name for the device. There is no globally
Bus IDs are the canonical names for the devices. There is no globally
standard addressing mechanism for legacy devices. In the IA-32 world,
we have Pnp IDs to use, as well as the legacy I/O ports. However,
neither tell what the device really is or have any meaning on other
......@@ -62,7 +62,7 @@ within the scope of the kernel).
For example, a serial driver might find a device at I/O 0x3f8. The
ACPI firmware might also discover a device with PnP ID (_HID)
PNP0501. Both correspond to the same device should be mapped to the
PNP0501. Both correspond to the same device and should be mapped to the
canonical name 'serial'.
The bus_id field should be a concatenation of the canonical name and
......@@ -88,7 +88,7 @@ Driver Binding
~~~~~~~~~~~~~~
Legacy drivers assume they are bound to the device once they start up
and probe an I/O port. Divorcing them from this will be a difficult
process. However, that shouldn't prevent us from impelementing
process. However, that shouldn't prevent us from implementing
firmware-based enumeration.
The firmware should notify the platform bus about devices before the
......
......@@ -128,7 +128,7 @@ static inline struct pci_dev * to_pci_dev(struct kobject * kobj)
The bus_id is an ASCII string that contains the device's address on
the bus. The format of this string is bus-specific. This is
necessary for representing device in sysfs.
necessary for representing devices in sysfs.
parent is the physical parent of the device. It is important that
the bus driver sets this field correctly.
......@@ -286,7 +286,7 @@ parameters.
It would be difficult and tedious to force every driver on a bus to
simultaneously convert their drivers to generic format. Instead, the
bus driver should define single instances of the generic methods that
forward calls to the bus-specific drivers. For instance:
forward call to the bus-specific drivers. For instance:
static int pci_device_remove(struct device * dev)
......@@ -330,8 +330,8 @@ registered with the bus at any time. When registration happens,
devices must be bound to a driver, or drivers must be bound to all
devices that it supports.
Drivers typically contain a list of device IDs that it supports. The
bus driver compares this ID to the ID of devices registered with it.
A driver typically contains a list of device IDs that it supports. The
bus driver compares these IDs to the IDs of devices registered with it.
The format of the device IDs, and the semantics for comparing them are
bus-specific, so the generic model does attempt to generalize them.
......@@ -396,7 +396,7 @@ This is called immediately before /sbin/hotplug is executed.
Step 7: Cleaning up the bus driver.
The generic bus, device, and driver structures provide several fields
that can replace those define privately to the bus driver.
that can replace those defined privately to the bus driver.
- Device list.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment