aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/gspca/gspca.c
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2010-12-30 18:20:09 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-01-19 08:44:56 -0500
commit7f6eb118df84715b128e25e99dc6a3ebc5b133d6 (patch)
treea7f173f466b80ff97f027663ffd62a03b44f345b /drivers/media/video/gspca/gspca.c
parent4a82bc60a9abbfca0c899366ff30c592e8020520 (diff)
[media] gspca_main: Remove no longer used users variable
Remove the no longer used / useful users variable, and with that gone there also is no longer a need to take queue_lock in dev_open. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Jean-Francois Moine <moinejf@free.fr> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/gspca/gspca.c')
-rw-r--r--drivers/media/video/gspca/gspca.c32
1 files changed, 5 insertions, 27 deletions
diff --git a/drivers/media/video/gspca/gspca.c b/drivers/media/video/gspca/gspca.c
index fbc5666ee29e..0ba42dd4b99b 100644
--- a/drivers/media/video/gspca/gspca.c
+++ b/drivers/media/video/gspca/gspca.c
@@ -1210,29 +1210,15 @@ static void gspca_release(struct video_device *vfd)
1210static int dev_open(struct file *file) 1210static int dev_open(struct file *file)
1211{ 1211{
1212 struct gspca_dev *gspca_dev; 1212 struct gspca_dev *gspca_dev;
1213 int ret;
1214 1213
1215 PDEBUG(D_STREAM, "[%s] open", current->comm); 1214 PDEBUG(D_STREAM, "[%s] open", current->comm);
1216 gspca_dev = (struct gspca_dev *) video_devdata(file); 1215 gspca_dev = (struct gspca_dev *) video_devdata(file);
1217 if (mutex_lock_interruptible(&gspca_dev->queue_lock)) 1216 if (!gspca_dev->present)
1218 return -ERESTARTSYS; 1217 return -ENODEV;
1219 if (!gspca_dev->present) {
1220 ret = -ENODEV;
1221 goto out;
1222 }
1223
1224 if (gspca_dev->users > 4) { /* (arbitrary value) */
1225 ret = -EBUSY;
1226 goto out;
1227 }
1228 1218
1229 /* protect the subdriver against rmmod */ 1219 /* protect the subdriver against rmmod */
1230 if (!try_module_get(gspca_dev->module)) { 1220 if (!try_module_get(gspca_dev->module))
1231 ret = -ENODEV; 1221 return -ENODEV;
1232 goto out;
1233 }
1234
1235 gspca_dev->users++;
1236 1222
1237 file->private_data = gspca_dev; 1223 file->private_data = gspca_dev;
1238#ifdef GSPCA_DEBUG 1224#ifdef GSPCA_DEBUG
@@ -1244,14 +1230,7 @@ static int dev_open(struct file *file)
1244 gspca_dev->vdev.debug &= ~(V4L2_DEBUG_IOCTL 1230 gspca_dev->vdev.debug &= ~(V4L2_DEBUG_IOCTL
1245 | V4L2_DEBUG_IOCTL_ARG); 1231 | V4L2_DEBUG_IOCTL_ARG);
1246#endif 1232#endif
1247 ret = 0; 1233 return 0;
1248out:
1249 mutex_unlock(&gspca_dev->queue_lock);
1250 if (ret != 0)
1251 PDEBUG(D_ERR|D_STREAM, "open failed err %d", ret);
1252 else
1253 PDEBUG(D_STREAM, "open done");
1254 return ret;
1255} 1234}
1256 1235
1257static int dev_close(struct file *file) 1236static int dev_close(struct file *file)
@@ -1261,7 +1240,6 @@ static int dev_close(struct file *file)
1261 PDEBUG(D_STREAM, "[%s] close", current->comm); 1240 PDEBUG(D_STREAM, "[%s] close", current->comm);
1262 if (mutex_lock_interruptible(&gspca_dev->queue_lock)) 1241 if (mutex_lock_interruptible(&gspca_dev->queue_lock))
1263 return -ERESTARTSYS; 1242 return -ERESTARTSYS;
1264 gspca_dev->users--;
1265 1243
1266 /* if the file did the capture, free the streaming resources */ 1244 /* if the file did the capture, free the streaming resources */
1267 if (gspca_dev->capt_file == file) { 1245 if (gspca_dev->capt_file == file) {