Chapter 5. Port drivers

To recap, then:

  • The device driver registers itself with parport.

  • A low-level driver finds a parallel port and registers it with parport (these first two things can happen in either order). This registration creates a struct parport which is linked onto a list of known ports.

  • parport calls the attach function of each registered device driver, passing it the pointer to the new struct parport.

  • The device driver gets a handle from parport, for use with parport_claim/release. This handle takes the form of a pointer to a struct pardevice, representing a particular device on the parallel port, and is acquired using parport_register_device.

  • The device driver claims the port using parport_claim (or function_claim_or_block).

  • Then it goes ahead and uses the port. When finished it releases the port.

The purpose of the low-level drivers, then, is to detect parallel ports and provide methods of accessing them (i.e. implementing the operations in struct parport_operations).

A more complete description of which operation is supposed to do what is available in Documentation/parport-lowlevel.txt.