[RFCv3 PATCH 13/16] radio-cadet: use v4l2_fh helper functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This will introduce priority handling.

Signed-off-by: Hans Verkuil <hverkuil@xxxxxxxxx>
---
 drivers/media/radio/radio-cadet.c |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/media/radio/radio-cadet.c b/drivers/media/radio/radio-cadet.c
index 4a37b69..b511854 100644
--- a/drivers/media/radio/radio-cadet.c
+++ b/drivers/media/radio/radio-cadet.c
@@ -42,6 +42,7 @@
 #include <linux/io.h>		/* outb, outb_p			*/
 #include <media/v4l2-device.h>
 #include <media/v4l2-ioctl.h>
+#include <media/v4l2-fh.h>
 
 MODULE_AUTHOR("Fred Gleason, Russell Kroll, Quay Lu, Donald Song, Jason Lewis, Scott McGrath, William McGrath");
 MODULE_DESCRIPTION("A driver for the ADS Cadet AM/FM/RDS radio card.");
@@ -64,7 +65,6 @@ struct cadet {
 	struct v4l2_device v4l2_dev;
 	struct video_device vdev;
 	int io;
-	int users;
 	int curtuner;
 	int tunestat;
 	int sigstrength;
@@ -500,23 +500,22 @@ static int vidioc_s_audio(struct file *file, void *priv,
 static int cadet_open(struct file *file)
 {
 	struct cadet *dev = video_drvdata(file);
+	int ret = v4l2_fh_open(file);
 
-	dev->users++;
-	if (1 == dev->users)
+	if (v4l2_fh_is_singular_file(file))
 		init_waitqueue_head(&dev->read_queue);
-	return 0;
+	return ret;
 }
 
 static int cadet_release(struct file *file)
 {
 	struct cadet *dev = video_drvdata(file);
 
-	dev->users--;
-	if (0 == dev->users) {
+	if (v4l2_fh_is_singular_file(file)) {
 		del_timer_sync(&dev->readtimer);
 		dev->rdsstat = 0;
 	}
-	return 0;
+	return v4l2_fh_release(file);
 }
 
 static unsigned int cadet_poll(struct file *file, struct poll_table_struct *wait)
-- 
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux