Skip to content

Commit

Permalink
nvram: Drop the bkl from nvram_llseek()
Browse files Browse the repository at this point in the history
There is nothing to protect inside nvram_llseek(), the file
offset doesn't need to be protected and nvram_len is only
initialized from an __init path.

It's safe to remove the big kernel lock there.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <1255116030-6929-1-git-send-email-fweisbec@gmail.com>
Cc: Greg KH <gregkh@suse.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
  • Loading branch information
Frederic Weisbecker authored and Thomas Gleixner committed Oct 14, 2009
1 parent 205153a commit 6783b9c
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions drivers/char/generic_nvram.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include <linux/miscdevice.h>
#include <linux/fcntl.h>
#include <linux/init.h>
#include <linux/smp_lock.h>
#include <asm/uaccess.h>
#include <asm/nvram.h>
#ifdef CONFIG_PPC_PMAC
Expand All @@ -32,7 +31,6 @@ static ssize_t nvram_len;

static loff_t nvram_llseek(struct file *file, loff_t offset, int origin)
{
lock_kernel();
switch (origin) {
case 1:
offset += file->f_pos;
Expand All @@ -41,12 +39,11 @@ static loff_t nvram_llseek(struct file *file, loff_t offset, int origin)
offset += nvram_len;
break;
}
if (offset < 0) {
unlock_kernel();
if (offset < 0)
return -EINVAL;
}

file->f_pos = offset;
unlock_kernel();

return file->f_pos;
}

Expand Down

0 comments on commit 6783b9c

Please sign in to comment.