October 2017
Intermediate to advanced
586 pages
14h 8m
English
The release method is called when the device gets closed, the reverse of the open method. You must then undo everything you have done in the open task. What you have to do is roughly:
The following is an excerpt from a release function:
static int sram_release(struct inode *inode, struct file *filp) { struct pcf2127 *pcf = NULL; pcf = container_of(inode->i_cdev, struct pcf2127, cdev); mutex_lock(&device_list_lock); filp->private_data = NULL; /* last close? */ pcf2127->users--; if (!pcf2127->users) ...