tea575x: Switch to unlocked_ioctl
PATCH 1/1 tea575x: Switch to unlocked_ioctl
Not sure why this is hiding in the sound directory or why it has an ancient and buggy V4L1 interface on it but it is and it needs to use unlocked_ioctl.
Signed-off-by Alan Cox <[email protected]>
sound/i2c/other/tea575x-tuner.c +14 -4
@@ -25,6 +25,7 @@#include <linux/interrupt.h> #include <linux/init.h> #include <sound/core.h> +#include <linux/smp_lock.h> #include <sound/tea575x-tuner.h> MODULE_AUTHOR ("Jaroslav Kysela <[email protected]>" );
@@ -84,12 +85,14 @@ static void snd_tea575x_set_freq(struct snd_tea575x *tea)* Linux Video interface */ -static int snd_tea575x_ioctl (struct inode *inode,struct file *file, -unsigned int cmd,unsigned long data) +static long snd_tea575x_ioctl (struct file *file,unsigned int cmd, +unsigned long data) {struct video_device *dev =video_devdata (file);struct snd_tea575x *tea =video_get_drvdata (dev);void __user *arg = (void __user *)data; + +#warning "Video4Linux 1 is obsolete. Please update this driver"switch (cmd) {case VIDIOCGCAP :
@@ -103,7 +106,9 @@ static int snd_tea575x_ioctl(struct inode *inode, struct file *file, v.maxheight =0 ; v.minwidth =0 ; v.minheight =0 ; +lock_kernel ();strcpy (v.name, tea->tea5759 ?"TEA5759" :"TEA5757" ); +unlock_kernel ();if (copy_to_user (arg,&v,sizeof (v)))return -EFAULT ;return 0 ;
@@ -136,13 +141,16 @@ static int snd_tea575x_ioctl(struct inode *inode, struct file *file,return 0 ; }case VIDIOCGFREQ : +/* FIXME: freq locking is needed ?? */ if (copy_to_user (arg, &tea->freq,sizeof (tea->freq)))return -EFAULT ;return 0 ;case VIDIOCSFREQ :if (copy_from_user (&tea->freq, arg,sizeof (tea->freq)))return -EFAULT ; +lock_kernel ();snd_tea575x_set_freq (tea); +unlock_kernel ();return 0 ;case VIDIOCGAUDIO : {
@@ -158,16 +166,18 @@ static int snd_tea575x_ioctl(struct inode *inode, struct file *file,struct video_audio v;if (copy_from_user (&v, arg,sizeof (v)))return -EFAULT ; +lock_kernel ();if (tea->ops->mute) tea->ops->mute (tea, (v.flags &VIDEO_AUDIO_MUTE ) ?1 :0 ); +unlock_kernel ();if (v.audio)return -EINVAL ;return 0 ; }default : -return -ENOIOCTLCMD ; +return -ENOTTY ; } }
@@ -198,7 +208,7 @@ void snd_tea575x_init(struct snd_tea575x *tea) tea->fops.owner = tea->card->module; tea->fops.open = video_exclusive_open; tea->fops.release = video_exclusive_release; - tea->fops.ioctl = snd_tea575x_ioctl; + tea->fops.unlocked_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 ;