int scull_p_release (struct inode *inode, struct file *filp) { Scull_Pipe *dev = filp->private_data; int scull_p_fasync (fasync_file fd, struct file *filp, int mode); # ifdef LINUX_20 scull_p_fasync(inode, filp, 0); # else /* remove this filp from the asynchronously notified filp's */ scull_p_fasync(-1, filp, 0); # endif down (&dev->sem); if (filp->f_mode & FMODE_READ) dev->nreaders--; if (filp->f_mode & FMODE_WRITE) dev->nwriters--; if (dev->nreaders + dev->nwriters == 0) { kfree(dev->buffer); dev->buffer = NULL; /* the other fields are not checked on open */ } up (&dev->sem); MOD_DEC_USE_COUNT; return 0; }
static int scull_p_release(struct inode *inode, struct file *filp) { struct scull_pipe *dev = filp->private_data; /* remove this filp from the asynchronously notified filp's */ scull_p_fasync(-1, filp, 0); down(&dev->sem); if (filp->f_mode & FMODE_READ) dev->nreaders--; if (filp->f_mode & FMODE_WRITE) dev->nwriters--; if (dev->nreaders + dev->nwriters == 0) { kfree(dev->buffer); dev->buffer = NULL; /* the other fields are not checked on open */ } up(&dev->sem); return 0; }
/* Nothing special to do, since we don't have any hardware to shutdown for while */ int scull_p_release(struct inode *inode, struct file *filp) { scull_p_fasync(-1, filp, 0); return 0; }