From: Mauro Carvalho Chehab <mchehab@redhat.com>
Date: Sun, 17 Jun 2007 20:14:12 +0000 (-0300)
Subject: V4L/DVB (12776): tm6000: decrement users count
X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=a58d35cb933f21a43fbdb5e4f575ff40faba3df2;p=linux.git

V4L/DVB (12776): tm6000: decrement users count

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
---

diff --git a/drivers/staging/tm6000/tm6000-video.c b/drivers/staging/tm6000/tm6000-video.c
index 5697be06ddd72..df3d835ce750f 100644
--- a/drivers/staging/tm6000/tm6000-video.c
+++ b/drivers/staging/tm6000/tm6000-video.c
@@ -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);