Skip to content

Commit

Permalink
soundcore_open: Reduce the area BKL coverage
Browse files Browse the repository at this point in the history
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: John Kacur <[email protected]>
Signed-off-by: Arnd Bergmann <[email protected]>
Acked-by: Alan Cox <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
  • Loading branch information
John Kacur authored and tiwai committed Jul 5, 2010
1 parent 65ee2ba commit 171d9f7
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions sound/sound_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
{
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 171d9f7

Please sign in to comment.