[patch 7/7] um: Remove BKL from harddog

From: Thomas Gleixner
Date: Thu Oct 15 2009 - 04:49:14 EST


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@xxxxxxxxxxxxx>
Cc: Jeff Dike <jdike@xxxxxxxxxxx>
---
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,
};


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/