Function: lp_release releases a parallel device.
Called from: release (Base driver operation).
Files: drivers/char/lp.c, include/linux/lp.h
This is a fairly simple function. Again, the arguments are just inode and file (same as for open). First, it grabs the minor device number, then frees the memory that was assigned for the buffer (and sets the buffer flag to null). Then it marks the device as no longer busy, and exists.
static int lp_release(struct inode * inode, struct file * file) { unsigned int minor = MINOR(inode->i_rdev); kfree_s(lp_table[minor].lp_buffer, LP_BUFFER_SIZE); lp_table[minor].lp_buffer = NULL; LP_F(minor) &= ~LP_BUSY; MOD_DEC_USE_COUNT; return 0; }