Skip to content

Commit

Permalink
nvram: BKL pushdown
Browse files Browse the repository at this point in the history
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
  • Loading branch information
Arnd Bergmann authored and Jonathan Corbet committed Jul 2, 2008
1 parent fd3e05b commit 930ab4e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/char/nvram.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
#include <linux/init.h>
#include <linux/proc_fs.h>
#include <linux/spinlock.h>
#include <linux/smp_lock.h>

#include <asm/io.h>
#include <asm/uaccess.h>
Expand Down Expand Up @@ -333,12 +334,14 @@ nvram_ioctl(struct inode *inode, struct file *file,
static int
nvram_open(struct inode *inode, struct file *file)
{
lock_kernel();
spin_lock(&nvram_state_lock);

if ((nvram_open_cnt && (file->f_flags & O_EXCL)) ||
(nvram_open_mode & NVRAM_EXCL) ||
((file->f_mode & 2) && (nvram_open_mode & NVRAM_WRITE))) {
spin_unlock(&nvram_state_lock);
unlock_kernel();
return -EBUSY;
}

Expand All @@ -349,6 +352,7 @@ nvram_open(struct inode *inode, struct file *file)
nvram_open_cnt++;

spin_unlock(&nvram_state_lock);
unlock_kernel();

return 0;
}
Expand Down

0 comments on commit 930ab4e

Please sign in to comment.