The release function, tdd_release(),is called when the last process that is holding open each of the device special files associated with this device driver closes it with a close() call. In fact, since only one process at a time can open each of the device special files for this driver, then a close() from this process will also call the driver release routine (tdd_release()):
static void tdd_release(struct mode *inode, struct file *file) { TRACE_TXT("tdd_release") switch (MIN0R(inode->i_rdev)) { case TDD_WRITE: write_busy = FALSE; return; case TDD_READ: read_busy = FALSE; return; } }
All that tdd_release() does is to reset the appropriate read or write busy flag, ready for the next open() operation to take place on the device special file.