sound_oss: remove use of old BKL ioctl path
Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
a29fb94ff4
commit
6b98515a62
1 changed files with 22 additions and 13 deletions
|
@ -328,11 +328,11 @@ static int sound_mixer_ioctl(int mixdev, unsigned int cmd, void __user *arg)
|
||||||
return mixer_devs[mixdev]->ioctl(mixdev, cmd, arg);
|
return mixer_devs[mixdev]->ioctl(mixdev, cmd, arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int sound_ioctl(struct inode *inode, struct file *file,
|
static long sound_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
|
||||||
unsigned int cmd, unsigned long arg)
|
|
||||||
{
|
{
|
||||||
int len = 0, dtype;
|
int len = 0, dtype;
|
||||||
int dev = iminor(inode);
|
int dev = iminor(file->f_dentry->d_inode);
|
||||||
|
long ret = -EINVAL;
|
||||||
void __user *p = (void __user *)arg;
|
void __user *p = (void __user *)arg;
|
||||||
|
|
||||||
if (_SIOC_DIR(cmd) != _SIOC_NONE && _SIOC_DIR(cmd) != 0) {
|
if (_SIOC_DIR(cmd) != _SIOC_NONE && _SIOC_DIR(cmd) != 0) {
|
||||||
|
@ -353,6 +353,7 @@ static int sound_ioctl(struct inode *inode, struct file *file,
|
||||||
if (cmd == OSS_GETVERSION)
|
if (cmd == OSS_GETVERSION)
|
||||||
return __put_user(SOUND_VERSION, (int __user *)p);
|
return __put_user(SOUND_VERSION, (int __user *)p);
|
||||||
|
|
||||||
|
lock_kernel();
|
||||||
if (_IOC_TYPE(cmd) == 'M' && num_mixers > 0 && /* Mixer ioctl */
|
if (_IOC_TYPE(cmd) == 'M' && num_mixers > 0 && /* Mixer ioctl */
|
||||||
(dev & 0x0f) != SND_DEV_CTL) {
|
(dev & 0x0f) != SND_DEV_CTL) {
|
||||||
dtype = dev & 0x0f;
|
dtype = dev & 0x0f;
|
||||||
|
@ -360,24 +361,31 @@ static int sound_ioctl(struct inode *inode, struct file *file,
|
||||||
case SND_DEV_DSP:
|
case SND_DEV_DSP:
|
||||||
case SND_DEV_DSP16:
|
case SND_DEV_DSP16:
|
||||||
case SND_DEV_AUDIO:
|
case SND_DEV_AUDIO:
|
||||||
return sound_mixer_ioctl(audio_devs[dev >> 4]->mixer_dev,
|
ret = sound_mixer_ioctl(audio_devs[dev >> 4]->mixer_dev,
|
||||||
cmd, p);
|
cmd, p);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return sound_mixer_ioctl(dev >> 4, cmd, p);
|
ret = sound_mixer_ioctl(dev >> 4, cmd, p);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
unlock_kernel();
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (dev & 0x0f) {
|
switch (dev & 0x0f) {
|
||||||
case SND_DEV_CTL:
|
case SND_DEV_CTL:
|
||||||
if (cmd == SOUND_MIXER_GETLEVELS)
|
if (cmd == SOUND_MIXER_GETLEVELS)
|
||||||
return get_mixer_levels(p);
|
ret = get_mixer_levels(p);
|
||||||
if (cmd == SOUND_MIXER_SETLEVELS)
|
else if (cmd == SOUND_MIXER_SETLEVELS)
|
||||||
return set_mixer_levels(p);
|
ret = set_mixer_levels(p);
|
||||||
return sound_mixer_ioctl(dev >> 4, cmd, p);
|
else
|
||||||
|
ret = sound_mixer_ioctl(dev >> 4, cmd, p);
|
||||||
|
break;
|
||||||
|
|
||||||
case SND_DEV_SEQ:
|
case SND_DEV_SEQ:
|
||||||
case SND_DEV_SEQ2:
|
case SND_DEV_SEQ2:
|
||||||
return sequencer_ioctl(dev, file, cmd, p);
|
ret = sequencer_ioctl(dev, file, cmd, p);
|
||||||
|
break;
|
||||||
|
|
||||||
case SND_DEV_DSP:
|
case SND_DEV_DSP:
|
||||||
case SND_DEV_DSP16:
|
case SND_DEV_DSP16:
|
||||||
|
@ -390,7 +398,8 @@ static int sound_ioctl(struct inode *inode, struct file *file,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
return -EINVAL;
|
unlock_kernel();
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned int sound_poll(struct file *file, poll_table * wait)
|
static unsigned int sound_poll(struct file *file, poll_table * wait)
|
||||||
|
@ -490,7 +499,7 @@ const struct file_operations oss_sound_fops = {
|
||||||
.read = sound_read,
|
.read = sound_read,
|
||||||
.write = sound_write,
|
.write = sound_write,
|
||||||
.poll = sound_poll,
|
.poll = sound_poll,
|
||||||
.ioctl = sound_ioctl,
|
.unlocked_ioctl = sound_ioctl,
|
||||||
.mmap = sound_mmap,
|
.mmap = sound_mmap,
|
||||||
.open = sound_open,
|
.open = sound_open,
|
||||||
.release = sound_release,
|
.release = sound_release,
|
||||||
|
|
Loading…
Add table
Reference in a new issue