[PATCH] soundcore_open: Reduce the area BKL coverage in this function.

From: John Kacur
Date: Sun Oct 11 2009 - 08:25:46 EST


Most of this function is protected by the sound_loader_lock.
We can push down the BKL to this call out err = file->f_op->open(inode,file);

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

diff --git a/sound/sound_core.c b/sound/sound_core.c
index 49c9981..a7d6956 100644
--- a/sound/sound_core.c
+++ b/sound/sound_core.c
@@ -576,8 +576,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 +629,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)
+ lock_kernel();
err = file->f_op->open(inode,file);
+ unlock_kernel();
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/