public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Ingo Molnar <mingo@elte.hu>, Arnd Bergmann <arnd@arndb.de>,
	ALan Cox <alan@lxorguk.ukuu.org.uk>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Jeff Dike <jdike@addtoit.com>
Subject: [patch 7/7] um: Remove BKL from harddog
Date: Thu, 15 Oct 2009 08:42:49 -0000	[thread overview]
Message-ID: <20091015083934.032160870@linutronix.de> (raw)
In-Reply-To: 20091015083906.716130653@linutronix.de

[-- Attachment #1: um-remove-bkl-from-harddog.patch --]
[-- Type: text/plain, Size: 1996 bytes --]

It's safe to remove the BKL from harddog because:

     - open() needs no serialization versus init
     - open() is already serialized with a local lock

     - ioctl() does not need BKL for put/copy_user
     - ioctl() does not need BKL for pin_watchdog as it
       simply writes to the fd which was created in open()

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Jeff Dike <jdike@addtoit.com>
---
 arch/um/drivers/harddog_kern.c |   10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

Index: linux-2.6-tip/arch/um/drivers/harddog_kern.c
===================================================================
--- linux-2.6-tip.orig/arch/um/drivers/harddog_kern.c
+++ linux-2.6-tip/arch/um/drivers/harddog_kern.c
@@ -42,7 +42,6 @@
 #include <linux/miscdevice.h>
 #include <linux/watchdog.h>
 #include <linux/reboot.h>
-#include <linux/smp_lock.h>
 #include <linux/init.h>
 #include <linux/spinlock.h>
 #include <asm/uaccess.h>
@@ -66,7 +65,6 @@ static int harddog_open(struct inode *in
 	int err = -EBUSY;
 	char *sock = NULL;
 
-	lock_kernel();
 	spin_lock(&lock);
 	if(timer_alive)
 		goto err;
@@ -83,11 +81,9 @@ static int harddog_open(struct inode *in
 
 	timer_alive = 1;
 	spin_unlock(&lock);
-	unlock_kernel();
 	return nonseekable_open(inode, file);
 err:
 	spin_unlock(&lock);
-	unlock_kernel();
 	return err;
 }
 
@@ -124,8 +120,8 @@ static ssize_t harddog_write(struct file
 	return 0;
 }
 
-static int harddog_ioctl(struct inode *inode, struct file *file,
-			 unsigned int cmd, unsigned long arg)
+static long harddog_ioctl(struct file *file, unsigned int cmd,
+			  unsigned long arg)
 {
 	void __user *argp= (void __user *)arg;
 	static struct watchdog_info ident = {
@@ -151,7 +147,7 @@ static int harddog_ioctl(struct inode *i
 static const struct file_operations harddog_fops = {
 	.owner		= THIS_MODULE,
 	.write		= harddog_write,
-	.ioctl		= harddog_ioctl,
+	.unlocked_ioctl	= harddog_ioctl,
 	.open		= harddog_open,
 	.release	= harddog_release,
 };



      parent reply	other threads:[~2009-10-15  8:48 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-15  8:42 [patch 0/7] BKL the next lot Thomas Gleixner
2009-10-15  8:42 ` [patch 1/7] ia64: Remove the BKL from perfmon Thomas Gleixner
2009-10-15  8:42 ` [patch 2/7] m68k: Remove BKL from rtc implementations Thomas Gleixner
2010-03-07 12:40   ` Geert Uytterhoeven
2009-10-15  8:42 ` [patch 3/7] powerpc: Use unlocked ioctl in nvram_64 Thomas Gleixner
2009-10-15  8:42 ` [patch 4/7] sh: Remove BKL from landisk gio Thomas Gleixner
2009-10-16  6:18   ` Paul Mundt
2009-10-15  8:42 ` [patch 5/7] um: Convert hostaudio to unlocked ioctl Thomas Gleixner
2009-10-15  8:42 ` [patch 6/7] um: Convert mmapper to unlocked_ioctl Thomas Gleixner
2009-10-15 13:00   ` Arnd Bergmann
2009-10-15 14:50     ` Thomas Gleixner
2009-10-15 15:29     ` Alan Cox
2009-10-16 19:42       ` Arnd Bergmann
2009-10-17  2:58         ` Thomas Gleixner
2009-10-15  8:42 ` Thomas Gleixner [this message]

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=20091015083934.032160870@linutronix.de \
    --to=tglx@linutronix.de \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=arnd@arndb.de \
    --cc=fweisbec@gmail.com \
    --cc=jdike@addtoit.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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