* [PATCH] nvram: Drop the bkl from nvram_llseek()
@ 2009-10-09 19:20 Frederic Weisbecker
2009-10-09 19:27 ` Thomas Gleixner
2009-10-14 15:48 ` [tip:bkl/drivers] " tip-bot for Frederic Weisbecker
0 siblings, 2 replies; 4+ messages in thread
From: Frederic Weisbecker @ 2009-10-09 19:20 UTC (permalink / raw)
To: Thomas Gleixner
Cc: LKML, Frederic Weisbecker, Thomas Gleixner, Ingo Molnar,
John Kacur, Sven-Thorsten Dietrich, Jonathan Corbet,
Alessio Igor Bogani, Benjamin Herrenschmidt, Greg KH
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.
(Is this file still used? I can't even build it,
looks like it is built under CONFIG_GENERIC_NVRAM but this
option is referenced nowhere except in powerpc defconfigs)
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: John Kacur <jkacur@redhat.com>
Cc: Sven-Thorsten Dietrich <sven@thebigcorporation.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Alessio Igor Bogani <abogani@texware.it>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Greg KH <gregkh@suse.de>
---
drivers/char/generic_nvram.c | 8 +++-----
1 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/char/generic_nvram.c b/drivers/char/generic_nvram.c
index ef31738..c49200e 100644
--- a/drivers/char/generic_nvram.c
+++ b/drivers/char/generic_nvram.c
@@ -32,7 +32,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;
@@ -41,12 +40,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;
}
--
1.6.2.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] nvram: Drop the bkl from nvram_llseek()
2009-10-09 19:20 [PATCH] nvram: Drop the bkl from nvram_llseek() Frederic Weisbecker
@ 2009-10-09 19:27 ` Thomas Gleixner
2009-10-09 19:29 ` Frederic Weisbecker
2009-10-14 15:48 ` [tip:bkl/drivers] " tip-bot for Frederic Weisbecker
1 sibling, 1 reply; 4+ messages in thread
From: Thomas Gleixner @ 2009-10-09 19:27 UTC (permalink / raw)
To: Frederic Weisbecker
Cc: LKML, Ingo Molnar, John Kacur, Sven-Thorsten Dietrich,
Jonathan Corbet, Alessio Igor Bogani, Benjamin Herrenschmidt,
Greg KH
B1;2005;0cOn Fri, 9 Oct 2009, Frederic Weisbecker wrote:
> 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.
>
> (Is this file still used? I can't even build it,
> looks like it is built under CONFIG_GENERIC_NVRAM but this
> option is referenced nowhere except in powerpc defconfigs)
Yes it is used. Look at arch/powerpc/Kconfig
config GENERIC_NVRAM
bool
default y if PPC32
But I have to admit that the GENERIC part is confusing :)
> Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Ingo Molnar <mingo@elte.hu>
> Cc: John Kacur <jkacur@redhat.com>
> Cc: Sven-Thorsten Dietrich <sven@thebigcorporation.com>
> Cc: Jonathan Corbet <corbet@lwn.net>
> Cc: Alessio Igor Bogani <abogani@texware.it>
> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Cc: Greg KH <gregkh@suse.de>
Added to the pile of pending BKL bashing. Thanks,
tglx
> ---
> drivers/char/generic_nvram.c | 8 +++-----
> 1 files changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/char/generic_nvram.c b/drivers/char/generic_nvram.c
> index ef31738..c49200e 100644
> --- a/drivers/char/generic_nvram.c
> +++ b/drivers/char/generic_nvram.c
> @@ -32,7 +32,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;
> @@ -41,12 +40,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;
> }
>
> --
> 1.6.2.3
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] nvram: Drop the bkl from nvram_llseek()
2009-10-09 19:27 ` Thomas Gleixner
@ 2009-10-09 19:29 ` Frederic Weisbecker
0 siblings, 0 replies; 4+ messages in thread
From: Frederic Weisbecker @ 2009-10-09 19:29 UTC (permalink / raw)
To: Thomas Gleixner
Cc: LKML, Ingo Molnar, John Kacur, Sven-Thorsten Dietrich,
Jonathan Corbet, Alessio Igor Bogani, Benjamin Herrenschmidt,
Greg KH
On Fri, Oct 09, 2009 at 09:27:17PM +0200, Thomas Gleixner wrote:
> B1;2005;0cOn Fri, 9 Oct 2009, Frederic Weisbecker wrote:
>
> > 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.
> >
> > (Is this file still used? I can't even build it,
> > looks like it is built under CONFIG_GENERIC_NVRAM but this
> > option is referenced nowhere except in powerpc defconfigs)
>
> Yes it is used. Look at arch/powerpc/Kconfig
>
> config GENERIC_NVRAM
> bool
> default y if PPC32
Oh right, I missed it.
> But I have to admit that the GENERIC part is confusing :)
Yep :)
> > Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
> > Cc: Thomas Gleixner <tglx@linutronix.de>
> > Cc: Ingo Molnar <mingo@elte.hu>
> > Cc: John Kacur <jkacur@redhat.com>
> > Cc: Sven-Thorsten Dietrich <sven@thebigcorporation.com>
> > Cc: Jonathan Corbet <corbet@lwn.net>
> > Cc: Alessio Igor Bogani <abogani@texware.it>
> > Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> > Cc: Greg KH <gregkh@suse.de>
>
> Added to the pile of pending BKL bashing. Thanks,
>
> tglx
Ok. Be care I couldn't even build test this one.
Thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [tip:bkl/drivers] nvram: Drop the bkl from nvram_llseek()
2009-10-09 19:20 [PATCH] nvram: Drop the bkl from nvram_llseek() Frederic Weisbecker
2009-10-09 19:27 ` Thomas Gleixner
@ 2009-10-14 15:48 ` tip-bot for Frederic Weisbecker
1 sibling, 0 replies; 4+ messages in thread
From: tip-bot for Frederic Weisbecker @ 2009-10-14 15:48 UTC (permalink / raw)
To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, fweisbec, gregkh, tglx
Commit-ID: 6783b9cd7104470a3afab51c205c5aea53a2858f
Gitweb: http://git.kernel.org/tip/6783b9cd7104470a3afab51c205c5aea53a2858f
Author: Frederic Weisbecker <fweisbec@gmail.com>
AuthorDate: Fri, 9 Oct 2009 21:20:30 +0200
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Wed, 14 Oct 2009 17:36:49 +0200
nvram: Drop the bkl from nvram_llseek()
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>
---
drivers/char/generic_nvram.c | 9 +++------
1 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/char/generic_nvram.c b/drivers/char/generic_nvram.c
index ef31738..fda4181 100644
--- a/drivers/char/generic_nvram.c
+++ b/drivers/char/generic_nvram.c
@@ -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
@@ -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;
@@ -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;
}
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-10-14 15:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-09 19:20 [PATCH] nvram: Drop the bkl from nvram_llseek() Frederic Weisbecker
2009-10-09 19:27 ` Thomas Gleixner
2009-10-09 19:29 ` Frederic Weisbecker
2009-10-14 15:48 ` [tip:bkl/drivers] " tip-bot for Frederic Weisbecker
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox