diff options
author | Arnd Bergmann <arnd@arndb.de> | 2010-07-11 06:16:36 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2010-07-12 11:41:05 -0400 |
commit | 90dc763fef4c869e60b2a7ad92e1a7dab68575ea (patch) | |
tree | ab3757f14a6d84e36afa36ac5f325fd316d4e197 /sound/oss/soundcard.c | |
parent | 395c61d19621e80b763810cc988416dc1b6bfd3e (diff) |
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>
Diffstat (limited to 'sound/oss/soundcard.c')
-rw-r--r-- | sound/oss/soundcard.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/sound/oss/soundcard.c b/sound/oss/soundcard.c index 2d9c51312622..92aa762ffb7e 100644 --- a/sound/oss/soundcard.c +++ b/sound/oss/soundcard.c | |||
@@ -210,42 +210,44 @@ static int sound_open(struct inode *inode, struct file *file) | |||
210 | printk(KERN_ERR "Invalid minor device %d\n", dev); | 210 | printk(KERN_ERR "Invalid minor device %d\n", dev); |
211 | return -ENXIO; | 211 | return -ENXIO; |
212 | } | 212 | } |
213 | lock_kernel(); | ||
213 | switch (dev & 0x0f) { | 214 | switch (dev & 0x0f) { |
214 | case SND_DEV_CTL: | 215 | case SND_DEV_CTL: |
215 | dev >>= 4; | 216 | dev >>= 4; |
216 | if (dev >= 0 && dev < MAX_MIXER_DEV && mixer_devs[dev] == NULL) { | 217 | if (dev >= 0 && dev < MAX_MIXER_DEV && mixer_devs[dev] == NULL) { |
217 | request_module("mixer%d", dev); | 218 | request_module("mixer%d", dev); |
218 | } | 219 | } |
220 | retval = -ENXIO; | ||
219 | if (dev && (dev >= num_mixers || mixer_devs[dev] == NULL)) | 221 | if (dev && (dev >= num_mixers || mixer_devs[dev] == NULL)) |
220 | return -ENXIO; | 222 | break; |
221 | 223 | ||
222 | if (!try_module_get(mixer_devs[dev]->owner)) | 224 | if (!try_module_get(mixer_devs[dev]->owner)) |
223 | return -ENXIO; | 225 | break; |
226 | |||
227 | retval = 0; | ||
224 | break; | 228 | break; |
225 | 229 | ||
226 | case SND_DEV_SEQ: | 230 | case SND_DEV_SEQ: |
227 | case SND_DEV_SEQ2: | 231 | case SND_DEV_SEQ2: |
228 | if ((retval = sequencer_open(dev, file)) < 0) | 232 | retval = sequencer_open(dev, file); |
229 | return retval; | ||
230 | break; | 233 | break; |
231 | 234 | ||
232 | case SND_DEV_MIDIN: | 235 | case SND_DEV_MIDIN: |
233 | if ((retval = MIDIbuf_open(dev, file)) < 0) | 236 | retval = MIDIbuf_open(dev, file); |
234 | return retval; | ||
235 | break; | 237 | break; |
236 | 238 | ||
237 | case SND_DEV_DSP: | 239 | case SND_DEV_DSP: |
238 | case SND_DEV_DSP16: | 240 | case SND_DEV_DSP16: |
239 | case SND_DEV_AUDIO: | 241 | case SND_DEV_AUDIO: |
240 | if ((retval = audio_open(dev, file)) < 0) | 242 | retval = audio_open(dev, file); |
241 | return retval; | ||
242 | break; | 243 | break; |
243 | 244 | ||
244 | default: | 245 | default: |
245 | printk(KERN_ERR "Invalid minor device %d\n", dev); | 246 | printk(KERN_ERR "Invalid minor device %d\n", dev); |
246 | return -ENXIO; | 247 | retval = -ENXIO; |
247 | } | 248 | } |
248 | 249 | ||
250 | unlock_kernel(); | ||
249 | return 0; | 251 | return 0; |
250 | } | 252 | } |
251 | 253 | ||