提交 171d9f7d 编写于 作者: J John Kacur 提交者: Takashi Iwai

soundcore_open: Reduce the area BKL coverage

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);

In order to build the sound core without the BKL, we
will need to push the lock_kernel() call into the ~20
device drivers that register their file operations.
Signed-off-by: NJohn Kacur <jkacur@redhat.com>
Signed-off-by: NArnd Bergmann <arnd@arndb.de>
Acked-by: NAlan Cox <alan@linux.intel.com>
Signed-off-by: NTakashi Iwai <tiwai@suse.de>
上级 65ee2ba3
......@@ -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 */
{
......@@ -630,18 +628,23 @@ static int soundcore_open(struct inode *inode, struct file *file)
const struct file_operations *old_fops = file->f_op;
file->f_op = new_fops;
spin_unlock(&sound_loader_lock);
if(file->f_op->open)
if (file->f_op->open) {
/* TODO: push down BKL into indivial open functions */
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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册