public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Frederic Weisbecker <fweisbec@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>, Ingo Molnar <mingo@elte.hu>,
	John Kacur <jkacur@redhat.com>,
	Sven-Thorsten Dietrich <sven@thebigcorporation.com>,
	Jonathan Corbet <corbet@lwn.net>,
	Alessio Igor Bogani <abogani@texware.it>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Greg KH <gregkh@suse.de>
Subject: Re: [PATCH] nvram: Drop the bkl from nvram_llseek()
Date: Fri, 9 Oct 2009 21:27:17 +0200 (CEST)	[thread overview]
Message-ID: <alpine.LFD.2.00.0910092124260.9428@localhost.localdomain> (raw)
In-Reply-To: <1255116030-6929-1-git-send-email-fweisbec@gmail.com>

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
> 

  reply	other threads:[~2009-10-09 19:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-09 19:20 [PATCH] nvram: Drop the bkl from nvram_llseek() Frederic Weisbecker
2009-10-09 19:27 ` Thomas Gleixner [this message]
2009-10-09 19:29   ` Frederic Weisbecker
2009-10-14 15:48 ` [tip:bkl/drivers] " tip-bot for Frederic Weisbecker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LFD.2.00.0910092124260.9428@localhost.localdomain \
    --to=tglx@linutronix.de \
    --cc=abogani@texware.it \
    --cc=benh@kernel.crashing.org \
    --cc=corbet@lwn.net \
    --cc=fweisbec@gmail.com \
    --cc=gregkh@suse.de \
    --cc=jkacur@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=sven@thebigcorporation.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox