mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alan Cox <alan@lxorguk.ukuu.org.uk>
To: akpm@osdl.org, linux-kernel@vger.kernel.org
Subject: [PATCH] generic_nvram: use inode lock not lock_kernel
Date: Mon, 9 Jul 2007 14:47:45 +0100	[thread overview]
Message-ID: <20070709144745.029094ae@the-village.bc.nu> (raw)

The locking is only done for lseek so this isn't a big change. All the
other operations are thrown at the arch specific lower layers for locking
handling without the file pointer being directly exposed.

Signed-off-by: Alan Cox <alan@redhat.com>

diff -u --new-file --recursive --exclude-from /usr/src/exclude linux.vanilla-2.6.22-rc6-mm1/drivers/char/generic_nvram.c linux-2.6.22-rc6-mm1/drivers/char/generic_nvram.c
--- linux.vanilla-2.6.22-rc6-mm1/drivers/char/generic_nvram.c	2007-07-02 20:47:23.000000000 +0100
+++ linux-2.6.22-rc6-mm1/drivers/char/generic_nvram.c	2007-07-09 12:05:06.786669552 +0100
@@ -30,7 +30,7 @@
 
 static loff_t nvram_llseek(struct file *file, loff_t offset, int origin)
 {
-	lock_kernel();
+	mutex_lock(&file->f_path.dentry->d_inode->i_mutex);
 	switch (origin) {
 	case 1:
 		offset += file->f_pos;
@@ -44,7 +44,7 @@
 		return -EINVAL;
 	}
 	file->f_pos = offset;
-	unlock_kernel();
+	mutex_unlock(&file->f_path.dentry->d_inode->i_mutex);
 	return file->f_pos;
 }
 

             reply	other threads:[~2007-07-09 13:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-09 13:47 Alan Cox [this message]
2007-07-13 23:58 ` Andrew Morton
2007-07-14  8:48   ` Alan Cox

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=20070709144745.029094ae@the-village.bc.nu \
    --to=alan@lxorguk.ukuu.org.uk \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®