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/dmasound | |
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/dmasound')
-rw-r--r-- | sound/oss/dmasound/dmasound_core.c | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/sound/oss/dmasound/dmasound_core.c b/sound/oss/dmasound/dmasound_core.c index 3f3c3f71db4b..5a4f38c0f480 100644 --- a/sound/oss/dmasound/dmasound_core.c +++ b/sound/oss/dmasound/dmasound_core.c | |||
@@ -323,9 +323,13 @@ static struct { | |||
323 | 323 | ||
324 | static int mixer_open(struct inode *inode, struct file *file) | 324 | static int mixer_open(struct inode *inode, struct file *file) |
325 | { | 325 | { |
326 | if (!try_module_get(dmasound.mach.owner)) | 326 | lock_kernel(); |
327 | if (!try_module_get(dmasound.mach.owner)) { | ||
328 | unlock_kernel(); | ||
327 | return -ENODEV; | 329 | return -ENODEV; |
330 | } | ||
328 | mixer.busy = 1; | 331 | mixer.busy = 1; |
332 | unlock_kernel(); | ||
329 | return 0; | 333 | return 0; |
330 | } | 334 | } |
331 | 335 | ||
@@ -737,8 +741,11 @@ static int sq_open(struct inode *inode, struct file *file) | |||
737 | { | 741 | { |
738 | int rc; | 742 | int rc; |
739 | 743 | ||
740 | if (!try_module_get(dmasound.mach.owner)) | 744 | lock_kernel(); |
745 | if (!try_module_get(dmasound.mach.owner)) { | ||
746 | unlock_kernel(); | ||
741 | return -ENODEV; | 747 | return -ENODEV; |
748 | } | ||
742 | 749 | ||
743 | rc = write_sq_open(file); /* checks the f_mode */ | 750 | rc = write_sq_open(file); /* checks the f_mode */ |
744 | if (rc) | 751 | if (rc) |
@@ -781,10 +788,11 @@ static int sq_open(struct inode *inode, struct file *file) | |||
781 | sound_set_format(AFMT_MU_LAW); | 788 | sound_set_format(AFMT_MU_LAW); |
782 | } | 789 | } |
783 | #endif | 790 | #endif |
784 | 791 | unlock_kernel(); | |
785 | return 0; | 792 | return 0; |
786 | out: | 793 | out: |
787 | module_put(dmasound.mach.owner); | 794 | module_put(dmasound.mach.owner); |
795 | unlock_kernel(); | ||
788 | return rc; | 796 | return rc; |
789 | } | 797 | } |
790 | 798 | ||
@@ -1226,12 +1234,17 @@ static int state_open(struct inode *inode, struct file *file) | |||
1226 | { | 1234 | { |
1227 | char *buffer = state.buf; | 1235 | char *buffer = state.buf; |
1228 | int len = 0; | 1236 | int len = 0; |
1237 | int ret; | ||
1229 | 1238 | ||
1239 | lock_kernel(); | ||
1240 | ret = -EBUSY; | ||
1230 | if (state.busy) | 1241 | if (state.busy) |
1231 | return -EBUSY; | 1242 | goto out; |
1232 | 1243 | ||
1244 | ret = -ENODEV; | ||
1233 | if (!try_module_get(dmasound.mach.owner)) | 1245 | if (!try_module_get(dmasound.mach.owner)) |
1234 | return -ENODEV; | 1246 | goto out; |
1247 | |||
1235 | state.ptr = 0; | 1248 | state.ptr = 0; |
1236 | state.busy = 1; | 1249 | state.busy = 1; |
1237 | 1250 | ||
@@ -1293,7 +1306,10 @@ printk("dmasound: stat buffer used %d bytes\n", len) ; | |||
1293 | printk(KERN_ERR "dmasound_core: stat buffer overflowed!\n"); | 1306 | printk(KERN_ERR "dmasound_core: stat buffer overflowed!\n"); |
1294 | 1307 | ||
1295 | state.len = len; | 1308 | state.len = len; |
1296 | return 0; | 1309 | ret = 0; |
1310 | out: | ||
1311 | unlock_kernel(); | ||
1312 | return ret; | ||
1297 | } | 1313 | } |
1298 | 1314 | ||
1299 | static int state_release(struct inode *inode, struct file *file) | 1315 | static int state_release(struct inode *inode, struct file *file) |