From 607559123926c97eda4e7f7920ddd392408fd1e3 Mon Sep 17 00:00:00 2001 From: Steven Toth Date: Thu, 25 Sep 2008 15:51:11 -0400 Subject: cx88: Bugfix: all client disconnects put the frontend to sleep. From: Darron Broad 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 " Priority: normal Signed-off-by: Steven Toth Signed-off-by: Darron Broad --- linux/drivers/media/video/cx88/cx88-video.c | 5 ++++- linux/drivers/media/video/cx88/cx88.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'linux/drivers/media/video') diff --git a/linux/drivers/media/video/cx88/cx88-video.c b/linux/drivers/media/video/cx88/cx88-video.c index 3a7a9ed17..c4fdb6da2 100644 --- a/linux/drivers/media/video/cx88/cx88-video.c +++ b/linux/drivers/media/video/cx88/cx88-video.c @@ -1065,6 +1065,8 @@ static int video_open(struct inode *inode, struct file *file) } unlock_kernel(); + atomic_inc(&core->users); + return 0; } @@ -1152,7 +1154,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; } diff --git a/linux/drivers/media/video/cx88/cx88.h b/linux/drivers/media/video/cx88/cx88.h index 238370681..38702eb4f 100644 --- a/linux/drivers/media/video/cx88/cx88.h +++ b/linux/drivers/media/video/cx88/cx88.h @@ -352,6 +352,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; -- cgit v1.2.3