V4L/DVB (12776): tm6000: decrement users count
authorMauro Carvalho Chehab <mchehab@redhat.com>
Sun, 17 Jun 2007 20:14:12 +0000 (17:14 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Tue, 18 May 2010 03:39:28 +0000 (00:39 -0300)
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/staging/tm6000/tm6000-video.c

index 5697be06ddd72f0bf6381b1022360b55e36f9545..df3d835ce750f638dd584b694f24b280f71cbd90 100644 (file)
@@ -1441,8 +1441,12 @@ static int tm6000_release(struct inode *inode, struct file *file)
 
        dprintk(dev, V4L2_DEBUG_OPEN, "tm6000: close called (minor=%d, users=%d)\n",minor,dev->users);
 
-       tm6000_stop_thread(vidq);
-       videobuf_mmap_free(&fh->vb_vidq);
+       dev->users--;
+
+       if (!dev->users) {
+               tm6000_stop_thread(vidq);
+               videobuf_mmap_free(&fh->vb_vidq);
+       }
 
        kfree (fh);