When working with the Linux's doubly linked list interface, we should always bear in mind that these list functions perform no locking, so there is a possibility that our device driver (or other kernel entities) could attempt to perform concurrent operations on the same list. That's why we must be sure to implement a good locking scheme to protect our data against race conditions.
To use the list mechanism, our driver must include the header file linux/include/linux/list.h; this file includes the header, linux/include/linux/types.h, where a simple structure of the struct list_head type is defined as follows:
struct list_head {
struct list_head *next, *prev;
};
As we can see, this structure contains two pointers (prev and next) to a list_head structure; these two pointers implement the doubly linked list functionality. However, the interesting...