@@ -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)