Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bec43661 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab
Browse files

V4L/DVB (10135): v4l2: introduce v4l2_file_operations.



Introduce a struct v4l2_file_operations for v4l2 drivers.

Remove the unnecessary inode argument.

Move compat32 handling (and llseek) into the v4l2-dev core: this is now
handled in the v4l2 core and no longer in the drivers themselves.

Note that this changeset reverts an earlier patch that changed the return
type of__video_ioctl2 from int to long. This change will be reinstated
later in a much improved version.

Signed-off-by: default avatarHans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent dfa9a5ae
Loading
Loading
Loading
Loading
+10 −11
Original line number Diff line number Diff line
@@ -192,9 +192,9 @@ void saa7146_buffer_timeout(unsigned long data)
/********************************************************************************/
/* file operations */

static int fops_open(struct inode *inode, struct file *file)
static int fops_open(struct file *file)
{
	unsigned int minor = iminor(inode);
	unsigned int minor = video_devdata(file)->minor;
	struct saa7146_dev *h = NULL, *dev = NULL;
	struct list_head *list;
	struct saa7146_fh *fh = NULL;
@@ -202,7 +202,7 @@ static int fops_open(struct inode *inode, struct file *file)

	enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE;

	DEB_EE(("inode:%p, file:%p, minor:%d\n",inode,file,minor));
	DEB_EE(("file:%p, minor:%d\n", file, minor));

	if (mutex_lock_interruptible(&saa7146_devices_lock))
		return -ERESTARTSYS;
@@ -255,7 +255,7 @@ static int fops_open(struct inode *inode, struct file *file)
		if (dev->ext_vv_data->capabilities & V4L2_CAP_VBI_CAPTURE)
			result = saa7146_vbi_uops.open(dev,file);
		if (dev->ext_vv_data->vbi_fops.open)
			dev->ext_vv_data->vbi_fops.open(inode, file);
			dev->ext_vv_data->vbi_fops.open(file);
	} else {
		DEB_S(("initializing video...\n"));
		result = saa7146_video_uops.open(dev,file);
@@ -280,12 +280,12 @@ static int fops_open(struct inode *inode, struct file *file)
	return result;
}

static int fops_release(struct inode *inode, struct file *file)
static int fops_release(struct file *file)
{
	struct saa7146_fh  *fh  = file->private_data;
	struct saa7146_dev *dev = fh->dev;

	DEB_EE(("inode:%p, file:%p\n",inode,file));
	DEB_EE(("file:%p\n", file));

	if (mutex_lock_interruptible(&saa7146_devices_lock))
		return -ERESTARTSYS;
@@ -294,7 +294,7 @@ static int fops_release(struct inode *inode, struct file *file)
		if (dev->ext_vv_data->capabilities & V4L2_CAP_VBI_CAPTURE)
			saa7146_vbi_uops.release(dev,file);
		if (dev->ext_vv_data->vbi_fops.release)
			dev->ext_vv_data->vbi_fops.release(inode, file);
			dev->ext_vv_data->vbi_fops.release(file);
	} else {
		saa7146_video_uops.release(dev,file);
	}
@@ -308,10 +308,10 @@ static int fops_release(struct inode *inode, struct file *file)
	return 0;
}

static int fops_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
static int fops_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
/*
	DEB_EE(("inode:%p, file:%p, cmd:%d, arg:%li\n",inode, file, cmd, arg));
	DEB_EE(("file:%p, cmd:%d, arg:%li\n", file, cmd, arg));
*/
	return video_usercopy(file, cmd, arg, saa7146_video_do_ioctl);
}
@@ -416,7 +416,7 @@ static ssize_t fops_write(struct file *file, const char __user *data, size_t cou
	}
}

static const struct file_operations video_fops =
static const struct v4l2_file_operations video_fops =
{
	.owner		= THIS_MODULE,
	.open		= fops_open,
@@ -426,7 +426,6 @@ static const struct file_operations video_fops =
	.poll		= fops_poll,
	.mmap		= fops_mmap,
	.ioctl		= fops_ioctl,
	.llseek		= no_llseek,
};

static void vv_callback(struct saa7146_dev *dev, unsigned long status)
+1 −1
Original line number Diff line number Diff line
@@ -567,7 +567,7 @@ static int av7110_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
	return 0;
}

static int av7110_vbi_reset(struct inode *inode, struct file *file)
static int av7110_vbi_reset(struct file *file)
{
	struct saa7146_fh *fh = file->private_data;
	struct saa7146_dev *dev = fh->dev;
+5 −9
Original line number Diff line number Diff line
@@ -154,8 +154,8 @@ devices, that would be 76 and 91. */
static int usb_dsbr100_probe(struct usb_interface *intf,
			     const struct usb_device_id *id);
static void usb_dsbr100_disconnect(struct usb_interface *intf);
static int usb_dsbr100_open(struct inode *inode, struct file *file);
static int usb_dsbr100_close(struct inode *inode, struct file *file);
static int usb_dsbr100_open(struct file *file);
static int usb_dsbr100_close(struct file *file);
static int usb_dsbr100_suspend(struct usb_interface *intf,
						pm_message_t message);
static int usb_dsbr100_resume(struct usb_interface *intf);
@@ -566,7 +566,7 @@ static int vidioc_s_audio(struct file *file, void *priv,
	return 0;
}

static int usb_dsbr100_open(struct inode *inode, struct file *file)
static int usb_dsbr100_open(struct file *file)
{
	struct dsbr100_device *radio = video_drvdata(file);
	int retval;
@@ -593,7 +593,7 @@ static int usb_dsbr100_open(struct inode *inode, struct file *file)
	return 0;
}

static int usb_dsbr100_close(struct inode *inode, struct file *file)
static int usb_dsbr100_close(struct file *file)
{
	struct dsbr100_device *radio = video_drvdata(file);
	int retval;
@@ -653,15 +653,11 @@ static void usb_dsbr100_video_device_release(struct video_device *videodev)
}

/* File system interface */
static const struct file_operations usb_dsbr100_fops = {
static const struct v4l2_file_operations usb_dsbr100_fops = {
	.owner		= THIS_MODULE,
	.open		= usb_dsbr100_open,
	.release	= usb_dsbr100_close,
	.ioctl		= video_ioctl2,
#ifdef CONFIG_COMPAT
	.compat_ioctl	= v4l_compat_ioctl32,
#endif
	.llseek		= no_llseek,
};

static const struct v4l2_ioctl_ops usb_dsbr100_ioctl_ops = {
+3 −7
Original line number Diff line number Diff line
@@ -374,26 +374,22 @@ static int vidioc_s_audio(struct file *file, void *priv,

static struct rt_device rtrack_unit;

static int rtrack_exclusive_open(struct inode *inode, struct file *file)
static int rtrack_exclusive_open(struct file *file)
{
	return test_and_set_bit(0, &rtrack_unit.in_use) ? -EBUSY : 0;
}

static int rtrack_exclusive_release(struct inode *inode, struct file *file)
static int rtrack_exclusive_release(struct file *file)
{
	clear_bit(0, &rtrack_unit.in_use);
	return 0;
}

static const struct file_operations rtrack_fops = {
static const struct v4l2_file_operations rtrack_fops = {
	.owner		= THIS_MODULE,
	.open           = rtrack_exclusive_open,
	.release        = rtrack_exclusive_release,
	.ioctl		= video_ioctl2,
#ifdef CONFIG_COMPAT
	.compat_ioctl	= v4l_compat_ioctl32,
#endif
	.llseek         = no_llseek,
};

static const struct v4l2_ioctl_ops rtrack_ioctl_ops = {
+3 −7
Original line number Diff line number Diff line
@@ -338,26 +338,22 @@ static int vidioc_s_ctrl (struct file *file, void *priv,

static struct az_device aztech_unit;

static int aztech_exclusive_open(struct inode *inode, struct file *file)
static int aztech_exclusive_open(struct file *file)
{
	return test_and_set_bit(0, &aztech_unit.in_use) ? -EBUSY : 0;
}

static int aztech_exclusive_release(struct inode *inode, struct file *file)
static int aztech_exclusive_release(struct file *file)
{
	clear_bit(0, &aztech_unit.in_use);
	return 0;
}

static const struct file_operations aztech_fops = {
static const struct v4l2_file_operations aztech_fops = {
	.owner		= THIS_MODULE,
	.open           = aztech_exclusive_open,
	.release        = aztech_exclusive_release,
	.ioctl		= video_ioctl2,
#ifdef CONFIG_COMPAT
	.compat_ioctl	= v4l_compat_ioctl32,
#endif
	.llseek         = no_llseek,
};

static const struct v4l2_ioctl_ops aztech_ioctl_ops = {
Loading