Loading drivers/char/misc.c +3 −9 Original line number Diff line number Diff line Loading @@ -114,7 +114,7 @@ static int misc_open(struct inode * inode, struct file * file) int minor = iminor(inode); struct miscdevice *c; int err = -ENODEV; const struct file_operations *old_fops, *new_fops = NULL; const struct file_operations *new_fops = NULL; mutex_lock(&misc_mtx); Loading @@ -141,17 +141,11 @@ static int misc_open(struct inode * inode, struct file * file) } err = 0; old_fops = file->f_op; file->f_op = new_fops; replace_fops(file, new_fops); if (file->f_op->open) { file->private_data = c; err = file->f_op->open(inode,file); if (err) { fops_put(file->f_op); file->f_op = fops_get(old_fops); } } fops_put(old_fops); fail: mutex_unlock(&misc_mtx); return err; Loading drivers/gpu/drm/drm_fops.c +6 −11 Original line number Diff line number Diff line Loading @@ -148,7 +148,7 @@ int drm_stub_open(struct inode *inode, struct file *filp) struct drm_minor *minor; int minor_id = iminor(inode); int err = -ENODEV; const struct file_operations *old_fops; const struct file_operations *new_fops; DRM_DEBUG("\n"); Loading @@ -163,18 +163,13 @@ int drm_stub_open(struct inode *inode, struct file *filp) if (drm_device_is_unplugged(dev)) goto out; old_fops = filp->f_op; filp->f_op = fops_get(dev->driver->fops); if (filp->f_op == NULL) { filp->f_op = old_fops; new_fops = fops_get(dev->driver->fops); if (!new_fops) goto out; } if (filp->f_op->open && (err = filp->f_op->open(inode, filp))) { fops_put(filp->f_op); filp->f_op = fops_get(old_fops); } fops_put(old_fops); replace_fops(filp, new_fops); if (filp->f_op->open) err = filp->f_op->open(inode, filp); out: mutex_unlock(&drm_global_mutex); return err; Loading drivers/media/dvb-core/dvbdev.c +6 −13 Original line number Diff line number Diff line Loading @@ -74,22 +74,15 @@ static int dvb_device_open(struct inode *inode, struct file *file) if (dvbdev && dvbdev->fops) { int err = 0; const struct file_operations *old_fops; const struct file_operations *new_fops; file->private_data = dvbdev; old_fops = file->f_op; file->f_op = fops_get(dvbdev->fops); if (file->f_op == NULL) { file->f_op = old_fops; new_fops = fops_get(dvbdev->fops); if (!new_fops) goto fail; } file->private_data = dvbdev; replace_fops(file, new_fops); if (file->f_op->open) err = file->f_op->open(inode,file); if (err) { fops_put(file->f_op); file->f_op = fops_get(old_fops); } fops_put(old_fops); up_read(&minor_rwsem); mutex_unlock(&dvbdev_mutex); return err; Loading drivers/usb/core/file.c +4 −12 Original line number Diff line number Diff line Loading @@ -29,27 +29,19 @@ static DECLARE_RWSEM(minor_rwsem); static int usb_open(struct inode * inode, struct file * file) { int minor = iminor(inode); const struct file_operations *c; int err = -ENODEV; const struct file_operations *old_fops, *new_fops = NULL; const struct file_operations *new_fops; down_read(&minor_rwsem); c = usb_minors[minor]; new_fops = fops_get(usb_minors[iminor(inode)]); if (!c || !(new_fops = fops_get(c))) if (!new_fops) goto done; old_fops = file->f_op; file->f_op = new_fops; replace_fops(file, new_fops); /* Curiouser and curiouser... NULL ->open() as "no device" ? */ if (file->f_op->open) err = file->f_op->open(inode,file); if (err) { fops_put(file->f_op); file->f_op = fops_get(old_fops); } fops_put(old_fops); done: up_read(&minor_rwsem); return err; Loading fs/char_dev.c +4 −2 Original line number Diff line number Diff line Loading @@ -368,6 +368,7 @@ void cdev_put(struct cdev *p) */ static int chrdev_open(struct inode *inode, struct file *filp) { const struct file_operations *fops; struct cdev *p; struct cdev *new = NULL; int ret = 0; Loading Loading @@ -400,10 +401,11 @@ static int chrdev_open(struct inode *inode, struct file *filp) return ret; ret = -ENXIO; filp->f_op = fops_get(p->ops); if (!filp->f_op) fops = fops_get(p->ops); if (!fops) goto out_cdev_put; replace_fops(filp, fops); if (filp->f_op->open) { ret = filp->f_op->open(inode, filp); if (ret) Loading Loading
drivers/char/misc.c +3 −9 Original line number Diff line number Diff line Loading @@ -114,7 +114,7 @@ static int misc_open(struct inode * inode, struct file * file) int minor = iminor(inode); struct miscdevice *c; int err = -ENODEV; const struct file_operations *old_fops, *new_fops = NULL; const struct file_operations *new_fops = NULL; mutex_lock(&misc_mtx); Loading @@ -141,17 +141,11 @@ static int misc_open(struct inode * inode, struct file * file) } err = 0; old_fops = file->f_op; file->f_op = new_fops; replace_fops(file, new_fops); if (file->f_op->open) { file->private_data = c; err = file->f_op->open(inode,file); if (err) { fops_put(file->f_op); file->f_op = fops_get(old_fops); } } fops_put(old_fops); fail: mutex_unlock(&misc_mtx); return err; Loading
drivers/gpu/drm/drm_fops.c +6 −11 Original line number Diff line number Diff line Loading @@ -148,7 +148,7 @@ int drm_stub_open(struct inode *inode, struct file *filp) struct drm_minor *minor; int minor_id = iminor(inode); int err = -ENODEV; const struct file_operations *old_fops; const struct file_operations *new_fops; DRM_DEBUG("\n"); Loading @@ -163,18 +163,13 @@ int drm_stub_open(struct inode *inode, struct file *filp) if (drm_device_is_unplugged(dev)) goto out; old_fops = filp->f_op; filp->f_op = fops_get(dev->driver->fops); if (filp->f_op == NULL) { filp->f_op = old_fops; new_fops = fops_get(dev->driver->fops); if (!new_fops) goto out; } if (filp->f_op->open && (err = filp->f_op->open(inode, filp))) { fops_put(filp->f_op); filp->f_op = fops_get(old_fops); } fops_put(old_fops); replace_fops(filp, new_fops); if (filp->f_op->open) err = filp->f_op->open(inode, filp); out: mutex_unlock(&drm_global_mutex); return err; Loading
drivers/media/dvb-core/dvbdev.c +6 −13 Original line number Diff line number Diff line Loading @@ -74,22 +74,15 @@ static int dvb_device_open(struct inode *inode, struct file *file) if (dvbdev && dvbdev->fops) { int err = 0; const struct file_operations *old_fops; const struct file_operations *new_fops; file->private_data = dvbdev; old_fops = file->f_op; file->f_op = fops_get(dvbdev->fops); if (file->f_op == NULL) { file->f_op = old_fops; new_fops = fops_get(dvbdev->fops); if (!new_fops) goto fail; } file->private_data = dvbdev; replace_fops(file, new_fops); if (file->f_op->open) err = file->f_op->open(inode,file); if (err) { fops_put(file->f_op); file->f_op = fops_get(old_fops); } fops_put(old_fops); up_read(&minor_rwsem); mutex_unlock(&dvbdev_mutex); return err; Loading
drivers/usb/core/file.c +4 −12 Original line number Diff line number Diff line Loading @@ -29,27 +29,19 @@ static DECLARE_RWSEM(minor_rwsem); static int usb_open(struct inode * inode, struct file * file) { int minor = iminor(inode); const struct file_operations *c; int err = -ENODEV; const struct file_operations *old_fops, *new_fops = NULL; const struct file_operations *new_fops; down_read(&minor_rwsem); c = usb_minors[minor]; new_fops = fops_get(usb_minors[iminor(inode)]); if (!c || !(new_fops = fops_get(c))) if (!new_fops) goto done; old_fops = file->f_op; file->f_op = new_fops; replace_fops(file, new_fops); /* Curiouser and curiouser... NULL ->open() as "no device" ? */ if (file->f_op->open) err = file->f_op->open(inode,file); if (err) { fops_put(file->f_op); file->f_op = fops_get(old_fops); } fops_put(old_fops); done: up_read(&minor_rwsem); return err; Loading
fs/char_dev.c +4 −2 Original line number Diff line number Diff line Loading @@ -368,6 +368,7 @@ void cdev_put(struct cdev *p) */ static int chrdev_open(struct inode *inode, struct file *filp) { const struct file_operations *fops; struct cdev *p; struct cdev *new = NULL; int ret = 0; Loading Loading @@ -400,10 +401,11 @@ static int chrdev_open(struct inode *inode, struct file *filp) return ret; ret = -ENXIO; filp->f_op = fops_get(p->ops); if (!filp->f_op) fops = fops_get(p->ops); if (!fops) goto out_cdev_put; replace_fops(filp, fops); if (filp->f_op->open) { ret = filp->f_op->open(inode, filp); if (ret) Loading