Writing Device Drivers

Using Mutexes

Every section of the driver code that needs to read or write the shared data structure must do the following tasks:

The scope of a mutex, that is, the data the mutex protects, is entirely up to the programmer. A mutex protects a data structure only if every code path that accesses the data structure does so while holding the mutex.