diff mbox

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

Message ID 08691f479316008d298aa0628ecef8958abf734a.1294493428.git.hverkuil@xs4all.nl (mailing list archive)
State RFC
Headers show

Commit Message

Hans Verkuil Jan. 8, 2011, 1:36 p.m. UTC
None
diff mbox

Patch

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)