Skip to content

Commit

Permalink
V4L/DVB (8482): videodev: move all ioctl callbacks to a new v4l2_ioct…
Browse files Browse the repository at this point in the history
…l_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: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
  • Loading branch information
Hans Verkuil authored and Mauro Carvalho Chehab committed Jul 26, 2008
1 parent b654fcd commit a399810
Show file tree
Hide file tree
Showing 38 changed files with 980 additions and 828 deletions.
19 changes: 11 additions & 8 deletions drivers/media/radio/dsbr100.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
15 changes: 9 additions & 6 deletions drivers/media/radio/radio-aimslab.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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)
Expand Down
15 changes: 9 additions & 6 deletions drivers/media/radio/radio-aztech.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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");

Expand Down
15 changes: 9 additions & 6 deletions drivers/media/radio/radio-cadet.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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[] = {
Expand Down
14 changes: 9 additions & 5 deletions drivers/media/radio/radio-gemtek-pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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;
Expand Down
14 changes: 9 additions & 5 deletions drivers/media/radio/radio-gemtek.c
Original file line number Diff line number Diff line change
Expand Up @@ -553,11 +553,7 @@ static int vidioc_s_audio(struct file *file, void *priv, struct v4l2_audio *a)
return 0;
}

static struct video_device gemtek_radio = {
.owner = THIS_MODULE,
.name = "GemTek Radio card",
.type = VID_TYPE_TUNER,
.fops = &gemtek_fops,
static const struct v4l2_ioctl_ops gemtek_ioctl_ops = {
.vidioc_querycap = vidioc_querycap,
.vidioc_g_tuner = vidioc_g_tuner,
.vidioc_s_tuner = vidioc_s_tuner,
Expand All @@ -572,6 +568,14 @@ static struct video_device gemtek_radio = {
.vidioc_s_ctrl = vidioc_s_ctrl
};

static struct video_device gemtek_radio = {
.owner = THIS_MODULE,
.name = "GemTek Radio card",
.type = VID_TYPE_TUNER,
.fops = &gemtek_fops,
.ioctl_ops = &gemtek_ioctl_ops,
};

/*
* Initialization / cleanup related stuff.
*/
Expand Down
12 changes: 8 additions & 4 deletions drivers/media/radio/radio-maestro.c
Original file line number Diff line number Diff line change
Expand Up @@ -355,10 +355,7 @@ static u16 __devinit radio_power_on(struct radio_device *dev)
return (ofreq == radio_bits_get(dev));
}

static struct video_device maestro_radio = {
.name = "Maestro radio",
.type = VID_TYPE_TUNER,
.fops = &maestro_fops,
static const struct v4l2_ioctl_ops maestro_ioctl_ops = {
.vidioc_querycap = vidioc_querycap,
.vidioc_g_tuner = vidioc_g_tuner,
.vidioc_s_tuner = vidioc_s_tuner,
Expand All @@ -373,6 +370,13 @@ static struct video_device maestro_radio = {
.vidioc_s_ctrl = vidioc_s_ctrl,
};

static struct video_device maestro_radio = {
.name = "Maestro radio",
.type = VID_TYPE_TUNER,
.fops = &maestro_fops,
.ioctl_ops = &maestro_ioctl_ops,
};

static int __devinit maestro_probe(struct pci_dev *pdev,
const struct pci_device_id *ent)
{
Expand Down
16 changes: 9 additions & 7 deletions drivers/media/radio/radio-maxiradio.c
Original file line number Diff line number Diff line change
Expand Up @@ -374,13 +374,7 @@ static int vidioc_s_ctrl (struct file *file, void *priv,
return -EINVAL;
}

static struct video_device maxiradio_radio =
{
.owner = THIS_MODULE,
.name = "Maxi Radio FM2000 radio",
.type = VID_TYPE_TUNER,
.fops = &maxiradio_fops,

static const struct v4l2_ioctl_ops maxiradio_ioctl_ops = {
.vidioc_querycap = vidioc_querycap,
.vidioc_g_tuner = vidioc_g_tuner,
.vidioc_s_tuner = vidioc_s_tuner,
Expand All @@ -395,6 +389,14 @@ static struct video_device maxiradio_radio =
.vidioc_s_ctrl = vidioc_s_ctrl,
};

static struct video_device maxiradio_radio = {
.owner = THIS_MODULE,
.name = "Maxi Radio FM2000 radio",
.type = VID_TYPE_TUNER,
.fops = &maxiradio_fops,
.ioctl_ops = &maxiradio_ioctl_ops,
};

static int __devinit maxiradio_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
{
if(!request_region(pci_resource_start(pdev, 0),
Expand Down
15 changes: 9 additions & 6 deletions drivers/media/radio/radio-rtrack2.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,12 +295,7 @@ static const struct file_operations rtrack2_fops = {
.llseek = no_llseek,
};

static struct video_device rtrack2_radio=
{
.owner = THIS_MODULE,
.name = "RadioTrack II radio",
.type = VID_TYPE_TUNER,
.fops = &rtrack2_fops,
static const struct v4l2_ioctl_ops rtrack2_ioctl_ops = {
.vidioc_querycap = vidioc_querycap,
.vidioc_g_tuner = vidioc_g_tuner,
.vidioc_s_tuner = vidioc_s_tuner,
Expand All @@ -315,6 +310,14 @@ static struct video_device rtrack2_radio=
.vidioc_s_input = vidioc_s_input,
};

static struct video_device rtrack2_radio = {
.owner = THIS_MODULE,
.name = "RadioTrack II radio",
.type = VID_TYPE_TUNER,
.fops = &rtrack2_fops,
.ioctl_ops = &rtrack2_ioctl_ops,
};

static int __init rtrack2_init(void)
{
if(io==-1)
Expand Down
15 changes: 9 additions & 6 deletions drivers/media/radio/radio-sf16fmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,12 +295,7 @@ static const struct file_operations fmi_fops = {
.llseek = no_llseek,
};

static struct video_device fmi_radio=
{
.owner = THIS_MODULE,
.name = "SF16FMx radio",
.type = VID_TYPE_TUNER,
.fops = &fmi_fops,
static const struct v4l2_ioctl_ops fmi_ioctl_ops = {
.vidioc_querycap = vidioc_querycap,
.vidioc_g_tuner = vidioc_g_tuner,
.vidioc_s_tuner = vidioc_s_tuner,
Expand All @@ -315,6 +310,14 @@ static struct video_device fmi_radio=
.vidioc_s_ctrl = vidioc_s_ctrl,
};

static struct video_device fmi_radio = {
.owner = THIS_MODULE,
.name = "SF16FMx radio",
.type = VID_TYPE_TUNER,
.fops = &fmi_fops,
.ioctl_ops = &fmi_ioctl_ops,
};

/* ladis: this is my card. does any other types exist? */
static struct isapnp_device_id id_table[] __devinitdata = {
{ ISAPNP_ANY_ID, ISAPNP_ANY_ID,
Expand Down
15 changes: 9 additions & 6 deletions drivers/media/radio/radio-sf16fmr2.c
Original file line number Diff line number Diff line change
Expand Up @@ -411,12 +411,7 @@ static const struct file_operations fmr2_fops = {
.llseek = no_llseek,
};

static struct video_device fmr2_radio=
{
.owner = THIS_MODULE,
.name = "SF16FMR2 radio",
. type = VID_TYPE_TUNER,
.fops = &fmr2_fops,
static const struct v4l2_ioctl_ops fmr2_ioctl_ops = {
.vidioc_querycap = vidioc_querycap,
.vidioc_g_tuner = vidioc_g_tuner,
.vidioc_s_tuner = vidioc_s_tuner,
Expand All @@ -431,6 +426,14 @@ static struct video_device fmr2_radio=
.vidioc_s_ctrl = vidioc_s_ctrl,
};

static struct video_device fmr2_radio = {
.owner = THIS_MODULE,
.name = "SF16FMR2 radio",
.type = VID_TYPE_TUNER,
.fops = &fmr2_fops,
.ioctl_ops = &fmr2_ioctl_ops,
};

static int __init fmr2_init(void)
{
fmr2_unit.port = io;
Expand Down
21 changes: 12 additions & 9 deletions drivers/media/radio/radio-si470x.c
Original file line number Diff line number Diff line change
Expand Up @@ -1586,15 +1586,7 @@ static int si470x_vidioc_s_hw_freq_seek(struct file *file, void *priv,
return retval;
}


/*
* si470x_viddev_tamples - video device interface
*/
static struct video_device si470x_viddev_template = {
.fops = &si470x_fops,
.name = DRIVER_NAME,
.type = VID_TYPE_TUNER,
.release = video_device_release,
static const struct v4l2_ioctl_ops si470x_ioctl_ops = {
.vidioc_querycap = si470x_vidioc_querycap,
.vidioc_g_input = si470x_vidioc_g_input,
.vidioc_s_input = si470x_vidioc_s_input,
Expand All @@ -1608,6 +1600,17 @@ static struct video_device si470x_viddev_template = {
.vidioc_g_frequency = si470x_vidioc_g_frequency,
.vidioc_s_frequency = si470x_vidioc_s_frequency,
.vidioc_s_hw_freq_seek = si470x_vidioc_s_hw_freq_seek,
};

/*
* si470x_viddev_tamples - video device interface
*/
static struct video_device si470x_viddev_template = {
.fops = &si470x_fops,
.ioctl_ops = &si470x_ioctl_ops,
.name = DRIVER_NAME,
.type = VID_TYPE_TUNER,
.release = video_device_release,
.owner = THIS_MODULE,
};

Expand Down
15 changes: 9 additions & 6 deletions drivers/media/radio/radio-terratec.c
Original file line number Diff line number Diff line change
Expand Up @@ -367,12 +367,7 @@ static const struct file_operations terratec_fops = {
.llseek = no_llseek,
};

static struct video_device terratec_radio=
{
.owner = THIS_MODULE,
.name = "TerraTec ActiveRadio",
.type = VID_TYPE_TUNER,
.fops = &terratec_fops,
static const struct v4l2_ioctl_ops terratec_ioctl_ops = {
.vidioc_querycap = vidioc_querycap,
.vidioc_g_tuner = vidioc_g_tuner,
.vidioc_s_tuner = vidioc_s_tuner,
Expand All @@ -387,6 +382,14 @@ static struct video_device terratec_radio=
.vidioc_s_input = vidioc_s_input,
};

static struct video_device terratec_radio = {
.owner = THIS_MODULE,
.name = "TerraTec ActiveRadio",
.type = VID_TYPE_TUNER,
.fops = &terratec_fops,
.ioctl_ops = &terratec_ioctl_ops,
};

static int __init terratec_init(void)
{
if(io==-1)
Expand Down
Loading

0 comments on commit a399810

Please sign in to comment.