patch-2.4.21 linux-2.4.21/drivers/media/video/videodev.c
Next file: linux-2.4.21/drivers/media/video/w9966.c
Previous file: linux-2.4.21/drivers/media/video/tvmixer.c
Back to the patch index
Back to the overall index
- Lines: 27
- Date:
2003-06-13 07:51:34.000000000 -0700
- Orig file:
linux-2.4.20/drivers/media/video/videodev.c
- Orig date:
2002-08-02 17:39:44.000000000 -0700
diff -urN linux-2.4.20/drivers/media/video/videodev.c linux-2.4.21/drivers/media/video/videodev.c
@@ -186,14 +186,21 @@
static int video_release(struct inode *inode, struct file *file)
{
struct video_device *vfl;
+ struct module *owner;
- down(&videodev_lock);
vfl = video_devdata(file);
- if(vfl->close)
+ owner = vfl->owner;
+ if (vfl->close)
vfl->close(vfl);
- vfl->users--;
- if(vfl->owner)
- __MOD_DEC_USE_COUNT(vfl->owner);
+
+ down(&videodev_lock);
+ /* ->close() might have called video_device_unregister()
+ in case of a hot unplug, thus we have to get vfl again */
+ vfl = video_devdata(file);
+ if (NULL != vfl)
+ vfl->users--;
+ if (owner)
+ __MOD_DEC_USE_COUNT(owner);
up(&videodev_lock);
return 0;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)