]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
V4L/DVB (9069): cx88: Bugfix: all client disconnects put the frontend to sleep.
authorDarron Broad <darron@kewl.org>
Thu, 25 Sep 2008 19:51:11 +0000 (16:51 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sun, 12 Oct 2008 11:37:11 +0000 (09:37 -0200)
From the author:

"This fixes the problem where previously all client disconnects
put the analogue frontend into standby.

In the following example, the first command is succesfully
watching TV but the second command which returns EBUSY
detunes the receiver by entering it into the standby state.

tvtime -d /dev/video0 &
cat /dev/video0
"

Signed-off-by: Steven Toth <stoth@linuxtv.org>
Signed-off-by: Darron Broad <darron@kewl.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/cx88/cx88-video.c
drivers/media/video/cx88/cx88.h

index 61e03d4703f6184bd0579ec45c0c6902c7aad3a2..be45955dff686ebb38d598c8fb7e86d62ef6ca2f 100644 (file)
@@ -839,6 +839,8 @@ static int video_open(struct inode *inode, struct file *file)
        }
        unlock_kernel();
 
+       atomic_inc(&core->users);
+
        return 0;
 }
 
@@ -926,7 +928,8 @@ static int video_release(struct inode *inode, struct file *file)
        file->private_data = NULL;
        kfree(fh);
 
-       cx88_call_i2c_clients (dev->core, TUNER_SET_STANDBY, NULL);
+       if(atomic_dec_and_test(&dev->core->users))
+               cx88_call_i2c_clients (dev->core, TUNER_SET_STANDBY, NULL);
 
        return 0;
 }
index 6420fb7615b16a1ce6133760f62bd84ed08c52ff..dce7d36edb426a4d1a462bb5645a60b9c60ff734 100644 (file)
@@ -349,6 +349,7 @@ struct cx88_core {
        struct mutex               lock;
        /* various v4l controls */
        u32                        freq;
+       atomic_t                   users;
 
        /* cx88-video needs to access cx8802 for hybrid tuner pll access. */
        struct cx8802_dev          *dvbdev;