mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: LKML <linux-kernel@vger.kernel.org>
Cc: ALan Cox <alan@lxorguk.ukuu.org.uk>,
	Arnd Bergmann <arnd@arndb.de>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	linuxppc-dev@ozlabs.org
Subject: [patch 2/5] macintosh: Remove BKL from nvram driver
Date: Thu, 15 Oct 2009 20:28:38 -0000	[thread overview]
Message-ID: <20091015202758.441681409@linutronix.de> (raw)
In-Reply-To: <20091015202722.372890083@linutronix.de>

[-- Attachment #1: drivers-mac-nvram-remove-bkl.patch --]
[-- Type: text/plain, Size: 1655 bytes --]

Drop the bkl from nvram_llseek() as it obviously protects nothing. The
file offset is safe in essence.

The ioctl can be converted to unlocked_ioctl because it just calls
pmac_get_partition() which reads a value from an array which was
initialized at early boot time. No need for serialization.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: linuxppc-dev@ozlabs.org
---
 drivers/macintosh/nvram.c |   11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

Index: linux-2.6-tip/drivers/macintosh/nvram.c
===================================================================
--- linux-2.6-tip.orig/drivers/macintosh/nvram.c
+++ linux-2.6-tip/drivers/macintosh/nvram.c
@@ -13,7 +13,6 @@
 #include <linux/fcntl.h>
 #include <linux/nvram.h>
 #include <linux/init.h>
-#include <linux/smp_lock.h>
 #include <asm/uaccess.h>
 #include <asm/nvram.h>
 
@@ -21,7 +20,6 @@
 
 static loff_t nvram_llseek(struct file *file, loff_t offset, int origin)
 {
-	lock_kernel();
 	switch (origin) {
 	case 1:
 		offset += file->f_pos;
@@ -30,12 +28,10 @@ static loff_t nvram_llseek(struct file *
 		offset += NVRAM_SIZE;
 		break;
 	}
-	if (offset < 0) {
-		unlock_kernel();
+	if (offset < 0)
 		return -EINVAL;
-	}
+
 	file->f_pos = offset;
-	unlock_kernel();
 	return file->f_pos;
 }
 
@@ -76,8 +72,7 @@ static ssize_t write_nvram(struct file *
 	return p - buf;
 }
 
-static int nvram_ioctl(struct inode *inode, struct file *file,
-	unsigned int cmd, unsigned long arg)
+static long nvram_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
 	switch(cmd) {
 		case PMAC_NVRAM_GET_OFFSET:



  parent reply	other threads:[~2009-10-15 20:29 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-15 20:28 [patch 0/5] BKL another bunch Thomas Gleixner
2009-10-15 20:28 ` [patch 1/5] hwmon: Convert fschmd to unlocked_ioctl Thomas Gleixner
2009-11-06 13:15   ` [lm-sensors] " Jean Delvare
2009-11-06 13:22     ` Arnd Bergmann
2009-11-06 13:31       ` Jean Delvare
2009-11-06 13:36       ` Hans de Goede
2009-11-06 13:37         ` Arnd Bergmann
2009-11-06 13:35     ` Hans de Goede
2009-11-06 15:56     ` Thomas Gleixner
2009-12-17 13:12       ` Jean Delvare
2009-10-15 20:28 ` Thomas Gleixner [this message]
2009-10-15 20:28 ` [patch 3/5] sunrpc: Convert to unlocked_ioctl and remove stray smp_lock.h Thomas Gleixner
2009-10-15 20:28 ` [patch 4/5] mtd: Remove BKL and convert to unlocked_ioctl Thomas Gleixner
2009-10-16  6:44   ` Artem Bityutskiy
2009-10-20  5:27     ` Thomas Gleixner
2009-10-15 20:28 ` [patch 5/5] bluetooth: Remove stub ioctl in hci_vhci Thomas Gleixner

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=20091015202758.441681409@linutronix.de \
    --to=tglx@linutronix.de \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=arnd@arndb.de \
    --cc=benh@kernel.crashing.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.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

Powered by JetHome