[PATCH] ds1286: push down BKL
From: Alan Cox
Date: Thu May 22 2008 - 16:46:49 EST
Not one I can test but hopefully someone can check this on the mips side
and better still eliminate the BKL in the ioctl handler entirely
Signed-off-by: Alan Cox <alan@xxxxxxxxxx>
diff --git a/drivers/char/ds1286.c b/drivers/char/ds1286.c
index ea35ab2..775b3f6 100644
--- a/drivers/char/ds1286.c
+++ b/drivers/char/ds1286.c
@@ -40,8 +40,8 @@
#include <linux/bcd.h>
#include <linux/proc_fs.h>
#include <linux/jiffies.h>
-
-#include <asm/uaccess.h>
+#include <linux/smp_lock.h>
+#include <linux/uaccess.h>
#include <asm/system.h>
#define DS1286_VERSION "1.0"
@@ -58,8 +58,8 @@ static DECLARE_WAIT_QUEUE_HEAD(ds1286_wait);
static ssize_t ds1286_read(struct file *file, char *buf,
size_t count, loff_t *ppos);
-static int ds1286_ioctl(struct inode *inode, struct file *file,
- unsigned int cmd, unsigned long arg);
+static long ds1286_ioctl(struct file *file, unsigned int cmd,
+ unsigned long arg);
static unsigned int ds1286_poll(struct file *file, poll_table *wait);
@@ -97,8 +97,8 @@ static ssize_t ds1286_read(struct file *file, char *buf,
return -EIO;
}
-static int ds1286_ioctl(struct inode *inode, struct file *file,
- unsigned int cmd, unsigned long arg)
+static long do_ds1286_ioctl(struct file *file, unsigned int cmd,
+ unsigned long arg)
{
struct rtc_time wtime;
@@ -244,6 +244,16 @@ static int ds1286_ioctl(struct inode *inode, struct file *file,
return copy_to_user((void *)arg, &wtime, sizeof wtime) ? -EFAULT : 0;
}
+static long ds1286_ioctl(struct file *file, unsigned int cmd,
+ unsigned long arg)
+{
+ long ret;
+ lock_kernel();
+ ret = ds1286_do_ioctl(file, cmd, arg);
+ unlock_kernel();
+ return ret;
+}
+
/*
* We enforce only one user at a time here with the open/close.
* Also clear the previous interrupt data on an open, and clean
@@ -289,7 +299,7 @@ static const struct file_operations ds1286_fops = {
.llseek = no_llseek,
.read = ds1286_read,
.poll = ds1286_poll,
- .ioctl = ds1286_ioctl,
+ .unlocked_ioctl = ds1286_ioctl,
.open = ds1286_open,
.release = ds1286_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/