sound: push BKL into open functions
This moves the lock_kernel() call from soundcore_open to the individual OSS device drivers, where we can deal with it one driver at a time if needed, or just kill off the drivers. All core components in ALSA already provide adequate locking in their open()-functions and do not require the big kernel lock, so there is no need to add the BKL there. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
此提交包含在:
@@ -210,42 +210,44 @@ static int sound_open(struct inode *inode, struct file *file)
|
||||
printk(KERN_ERR "Invalid minor device %d\n", dev);
|
||||
return -ENXIO;
|
||||
}
|
||||
lock_kernel();
|
||||
switch (dev & 0x0f) {
|
||||
case SND_DEV_CTL:
|
||||
dev >>= 4;
|
||||
if (dev >= 0 && dev < MAX_MIXER_DEV && mixer_devs[dev] == NULL) {
|
||||
request_module("mixer%d", dev);
|
||||
}
|
||||
retval = -ENXIO;
|
||||
if (dev && (dev >= num_mixers || mixer_devs[dev] == NULL))
|
||||
return -ENXIO;
|
||||
break;
|
||||
|
||||
if (!try_module_get(mixer_devs[dev]->owner))
|
||||
return -ENXIO;
|
||||
break;
|
||||
|
||||
retval = 0;
|
||||
break;
|
||||
|
||||
case SND_DEV_SEQ:
|
||||
case SND_DEV_SEQ2:
|
||||
if ((retval = sequencer_open(dev, file)) < 0)
|
||||
return retval;
|
||||
retval = sequencer_open(dev, file);
|
||||
break;
|
||||
|
||||
case SND_DEV_MIDIN:
|
||||
if ((retval = MIDIbuf_open(dev, file)) < 0)
|
||||
return retval;
|
||||
retval = MIDIbuf_open(dev, file);
|
||||
break;
|
||||
|
||||
case SND_DEV_DSP:
|
||||
case SND_DEV_DSP16:
|
||||
case SND_DEV_AUDIO:
|
||||
if ((retval = audio_open(dev, file)) < 0)
|
||||
return retval;
|
||||
retval = audio_open(dev, file);
|
||||
break;
|
||||
|
||||
default:
|
||||
printk(KERN_ERR "Invalid minor device %d\n", dev);
|
||||
return -ENXIO;
|
||||
retval = -ENXIO;
|
||||
}
|
||||
|
||||
unlock_kernel();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
新增問題並參考
封鎖使用者