[PATCH] Remove the bkl in soundcore_open

From: John Kacur
Date: Sat Oct 10 2009 - 20:14:44 EST


Remove the bkl in soundcore_open since it is mostly covered by the sound_loader_lock spin_lock

Protect the underlying driver open method with a mutex.

Signed-off-by: John Kacur <jkacur@xxxxxxxxxx>
---
sound/sound_core.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/sound/sound_core.c b/sound/sound_core.c
index 49c9981..6afb6f1 100644
--- a/sound/sound_core.c
+++ b/sound/sound_core.c
@@ -14,6 +14,8 @@
#include <linux/major.h>
#include <sound/core.h>

+static DEFINE_MUTEX(osc_mutex);
+
#ifdef CONFIG_SOUND_OSS_CORE
static int __init init_oss_soundcore(void);
static void cleanup_oss_soundcore(void);
@@ -576,8 +578,6 @@ static int soundcore_open(struct inode *inode, struct file *file)
struct sound_unit *s;
const struct file_operations *new_fops = NULL;

- lock_kernel ();
-
chain=unit&0x0F;
if(chain==4 || chain==5) /* dsp/audio/dsp16 */
{
@@ -631,17 +631,17 @@ static int soundcore_open(struct inode *inode, struct file *file)
file->f_op = new_fops;
spin_unlock(&sound_loader_lock);
if(file->f_op->open)
+ mutex_lock(&osc_mutex);
err = file->f_op->open(inode,file);
+ mutex_unlock(&osc_mutex);
if (err) {
fops_put(file->f_op);
file->f_op = fops_get(old_fops);
}
fops_put(old_fops);
- unlock_kernel();
return err;
}
spin_unlock(&sound_loader_lock);
- unlock_kernel();
return -ENODEV;
}

--
1.6.0.6

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/