diff --git a/include/sound/tea575x-tuner.h b/include/sound/tea575x-tuner.h index 1c6ea034de11f9882b5bf37b217455472e86802e..ad3c3be33c0391ddb3a0b613c8e8f0dab6cd4b0c 100644 --- a/include/sound/tea575x-tuner.h +++ b/include/sound/tea575x-tuner.h @@ -34,6 +34,9 @@ struct snd_tea575x_ops { struct snd_tea575x { snd_card_t *card; struct video_device vd; /* video device */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 0) + struct file_operations fops; +#endif int dev_nr; /* requested device number + 1 */ int vd_registered; /* video device is registered */ int tea5759; /* 5759 chip is present */ diff --git a/sound/i2c/other/tea575x-tuner.c b/sound/i2c/other/tea575x-tuner.c index b1ab62fed2074ca44d3d1388f1c87194d6f934d5..7b9f3ea7653faf0d4e0c24a175c9851c519707a8 100644 --- a/sound/i2c/other/tea575x-tuner.c +++ b/sound/i2c/other/tea575x-tuner.c @@ -85,18 +85,11 @@ static void snd_tea575x_set_freq(tea575x_t *tea) * Linux Video interface */ -static int snd_tea575x_open(struct video_device *dev, int flags) +static int snd_tea575x_do_ioctl(struct inode *inode, struct file *file, + unsigned int cmd, void *arg) { - return 0; -} - -static void snd_tea575x_close(struct video_device *dev) -{ -} - -static int snd_tea575x_ioctl(struct video_device *dev, unsigned int cmd, void *arg) -{ - tea575x_t *tea = dev->priv; + struct video_device *dev = video_devdata(file); + tea575x_t *tea = video_get_drvdata(dev); switch(cmd) { case VIDIOCGCAP: @@ -174,6 +167,12 @@ static int snd_tea575x_ioctl(struct video_device *dev, unsigned int cmd, void *a } } +static int snd_tea575x_ioctl(struct inode *inode, struct file *file, + unsigned int cmd, unsigned long arg) +{ + return video_usercopy(inode, file, cmd, arg, snd_tea575x_do_ioctl); +} + /* * initialize all the tea575x chips */ @@ -192,10 +191,12 @@ void snd_tea575x_init(tea575x_t *tea) strcpy(tea->vd.name, tea->tea5759 ? "TEA5759 radio" : "TEA5757 radio"); tea->vd.type = VID_TYPE_TUNER; tea->vd.hardware = VID_HARDWARE_RTRACK; /* FIXME: assign new number */ - tea->vd.open = snd_tea575x_open; - tea->vd.close = snd_tea575x_close; - tea->vd.ioctl = snd_tea575x_ioctl; - tea->vd.priv = tea; + video_set_drvdata(&tea->vd, tea); + tea->vd.fops = &tea->fops; + tea->fops.owner = tea->card->module; + tea->fops.open = video_exclusive_open; + tea->fops.release = video_exclusive_release; + tea->fops.ioctl = snd_tea575x_ioctl; if (video_register_device(&tea->vd, VFL_TYPE_RADIO, tea->dev_nr - 1) < 0) { snd_printk(KERN_ERR "unable to register tea575x tuner\n"); return;