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

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

V4L/DVB (8482): videodev: move all ioctl callbacks to a new v4l2_ioctl_ops struct



All ioctl callbacks are now stored in a new v4l2_ioctl_ops struct. Drivers fill in
a const struct v4l2_ioctl_ops and video_device just contains a const pointer to it.

This ensures a clean separation between the const ops struct and the non-const
video_device struct.

Signed-off-by: default avatarHans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent b654fcdc
Loading
Loading
Loading
Loading
+11 −8
Original line number Diff line number Diff line
@@ -445,14 +445,7 @@ static const struct file_operations usb_dsbr100_fops = {
	.llseek		= no_llseek,
};

/* V4L2 interface */
static struct video_device dsbr100_videodev_template =
{
	.owner		= THIS_MODULE,
	.name		= "D-Link DSB-R 100",
	.type		= VID_TYPE_TUNER,
	.fops		= &usb_dsbr100_fops,
	.release	= video_device_release,
static const struct v4l2_ioctl_ops usb_dsbr100_ioctl_ops = {
	.vidioc_querycap    = vidioc_querycap,
	.vidioc_g_tuner     = vidioc_g_tuner,
	.vidioc_s_tuner     = vidioc_s_tuner,
@@ -467,6 +460,16 @@ static struct video_device dsbr100_videodev_template =
	.vidioc_s_input     = vidioc_s_input,
};

/* V4L2 interface */
static struct video_device dsbr100_videodev_template = {
	.owner		= THIS_MODULE,
	.name		= "D-Link DSB-R 100",
	.type		= VID_TYPE_TUNER,
	.fops		= &usb_dsbr100_fops,
	.ioctl_ops 	= &usb_dsbr100_ioctl_ops,
	.release	= video_device_release,
};

/* check if the device is present and register with v4l and
usb if it is */
static int usb_dsbr100_probe(struct usb_interface *intf,
+9 −6
Original line number Diff line number Diff line
@@ -389,12 +389,7 @@ static const struct file_operations rtrack_fops = {
	.llseek         = no_llseek,
};

static struct video_device rtrack_radio=
{
	.owner		= THIS_MODULE,
	.name		= "RadioTrack radio",
	.type		= VID_TYPE_TUNER,
	.fops           = &rtrack_fops,
static const struct v4l2_ioctl_ops rtrack_ioctl_ops = {
	.vidioc_querycap    = vidioc_querycap,
	.vidioc_g_tuner     = vidioc_g_tuner,
	.vidioc_s_tuner     = vidioc_s_tuner,
@@ -409,6 +404,14 @@ static struct video_device rtrack_radio=
	.vidioc_s_ctrl      = vidioc_s_ctrl,
};

static struct video_device rtrack_radio = {
	.owner		= THIS_MODULE,
	.name		= "RadioTrack radio",
	.type		= VID_TYPE_TUNER,
	.fops           = &rtrack_fops,
	.ioctl_ops 	= &rtrack_ioctl_ops,
};

static int __init rtrack_init(void)
{
	if(io==-1)
+9 −6
Original line number Diff line number Diff line
@@ -353,12 +353,7 @@ static const struct file_operations aztech_fops = {
	.llseek         = no_llseek,
};

static struct video_device aztech_radio=
{
	.owner		    = THIS_MODULE,
	.name		    = "Aztech radio",
	.type		    = VID_TYPE_TUNER,
	.fops               = &aztech_fops,
static const struct v4l2_ioctl_ops aztech_ioctl_ops = {
	.vidioc_querycap    = vidioc_querycap,
	.vidioc_g_tuner     = vidioc_g_tuner,
	.vidioc_s_tuner     = vidioc_s_tuner,
@@ -373,6 +368,14 @@ static struct video_device aztech_radio=
	.vidioc_s_ctrl      = vidioc_s_ctrl,
};

static struct video_device aztech_radio = {
	.owner		    = THIS_MODULE,
	.name		    = "Aztech radio",
	.type		    = VID_TYPE_TUNER,
	.fops               = &aztech_fops,
	.ioctl_ops 	    = &aztech_ioctl_ops,
};

module_param_named(debug,aztech_radio.debug, int, 0644);
MODULE_PARM_DESC(debug,"activates debug info");

+9 −6
Original line number Diff line number Diff line
@@ -570,12 +570,7 @@ static const struct file_operations cadet_fops = {
	.llseek         = no_llseek,
};

static struct video_device cadet_radio=
{
	.owner		= THIS_MODULE,
	.name		= "Cadet radio",
	.type		= VID_TYPE_TUNER,
	.fops           = &cadet_fops,
static const struct v4l2_ioctl_ops cadet_ioctl_ops = {
	.vidioc_querycap    = vidioc_querycap,
	.vidioc_g_tuner     = vidioc_g_tuner,
	.vidioc_s_tuner     = vidioc_s_tuner,
@@ -590,6 +585,14 @@ static struct video_device cadet_radio=
	.vidioc_s_input     = vidioc_s_input,
};

static struct video_device cadet_radio = {
	.owner		= THIS_MODULE,
	.name		= "Cadet radio",
	.type		= VID_TYPE_TUNER,
	.fops           = &cadet_fops,
	.ioctl_ops 	= &cadet_ioctl_ops,
};

#ifdef CONFIG_PNP

static struct pnp_device_id cadet_pnp_devices[] = {
+9 −5
Original line number Diff line number Diff line
@@ -375,11 +375,7 @@ static const struct file_operations gemtek_pci_fops = {
	.llseek         = no_llseek,
};

static struct video_device vdev_template = {
	.owner         = THIS_MODULE,
	.name          = "Gemtek PCI Radio",
	.type          = VID_TYPE_TUNER,
	.fops          = &gemtek_pci_fops,
static const struct v4l2_ioctl_ops gemtek_pci_ioctl_ops = {
	.vidioc_querycap    = vidioc_querycap,
	.vidioc_g_tuner     = vidioc_g_tuner,
	.vidioc_s_tuner     = vidioc_s_tuner,
@@ -394,6 +390,14 @@ static struct video_device vdev_template = {
	.vidioc_s_ctrl      = vidioc_s_ctrl,
};

static struct video_device vdev_template = {
	.owner         = THIS_MODULE,
	.name          = "Gemtek PCI Radio",
	.type          = VID_TYPE_TUNER,
	.fops          = &gemtek_pci_fops,
	.ioctl_ops     = &gemtek_pci_ioctl_ops,
};

static int __devinit gemtek_pci_probe( struct pci_dev *pci_dev, const struct pci_device_id *pci_id )
{
	struct gemtek_pci_card *card;
Loading