Lines Matching full:driver
2 Porting Drivers to the New Driver Model
12 Please refer to `Documentation/driver-api/driver-model/*.rst` for definitions of
13 various driver types and concepts.
16 at the bus driver layer. This was intentional, to minimize the
20 In a nutshell, the driver model consists of a set of objects that can
24 The generic objects must be registered with the driver model core. By
36 Step 1: Registering the bus driver.
39 - Define a struct bus_type for the bus driver::
59 The bus type may be unregistered (if the bus driver may be compiled
128 bus driver should initialize the generic device. The most important
136 the bus driver sets this field correctly.
138 The driver model maintains an ordered list of devices that it uses
153 Optionally, the bus driver may set the device's name and release
160 The release field is a callback that the driver model core calls
168 with the driver model core by doing::
177 If a bus driver unregisters a device, it should not immediately free
178 it. It should instead wait for the driver model core to call the
230 struct device_driver is a simple driver structure that contains a set
231 of operations that the driver model core may call.
234 - Embed a struct device_driver in the bus-specific driver.
240 struct device_driver driver;
244 - Initialize the generic driver structure.
246 When the driver registers with the bus (e.g. doing pci_register_driver()),
247 initialize the necessary fields of the driver: the name and bus
251 - Register the driver.
253 After the generic driver has been initialized, call::
255 driver_register(&drv->driver);
257 to register the driver with the core.
259 When the driver is unregistered from the bus, unregister it from the
262 driver_unregister(&drv->driver);
264 Note that this will block until all references to the driver have
270 Drivers are exported via sysfs in their bus's 'driver's directory.
283 struct device_driver defines a set of operations that the driver model
288 It would be difficult and tedious to force every driver on a bus to
290 bus driver should define single instances of the generic methods that
297 struct pci_driver * drv = pci_dev->driver;
302 pci_dev->driver = NULL;
308 The generic driver should be initialized with these methods before it
311 /* initialize common driver fields */
312 drv->driver.name = drv->name;
313 drv->driver.bus = &pci_bus_type;
314 drv->driver.probe = pci_device_probe;
315 drv->driver.resume = pci_device_resume;
316 drv->driver.suspend = pci_device_suspend;
317 drv->driver.remove = pci_device_remove;
320 driver_register(&drv->driver);
328 Step 5: Support generic driver binding.
330 The model assumes that a device or driver can be dynamically
332 devices must be bound to a driver, or drivers must be bound to all
335 A driver typically contains a list of device IDs that it supports. The
336 bus driver compares these IDs to the IDs of devices registered with it.
345 match should return positive value if the driver supports the device,
347 -EPROBE_DEFER) if determining that given driver supports the device is
353 When a driver is registered, the bus's list of devices is iterated
355 claimed by a driver.
357 When a device is successfully bound to a driver, device->driver is
358 set, the device is added to a per-driver list of devices, and a
359 symlink is created in the driver's sysfs directory that points to the
373 This driver binding should replace the existing driver binding
379 Whenever a device is registered with the driver model core, the
384 The driver model core passes several arguments to userspace via
390 A bus driver may also supply additional parameters for userspace to
400 Step 7: Cleaning up the bus driver.
402 The generic bus, device, and driver structures provide several fields
403 that can replace those defined privately to the bus driver.
418 - Driver list.
421 it. An internal list of drivers that the bus driver maintains may
436 the device and driver lists. This can be used by the bus driver
437 internally, and should be used when accessing the device or driver
441 - Device and driver fields.