All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ds1286: push down BKL
@ 2008-05-22 20:34 Alan Cox
  0 siblings, 0 replies; only message in thread
From: Alan Cox @ 2008-05-22 20:34 UTC (permalink / raw)
  To: linux-kernel, linux-mips

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@redhat.com>

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,
 };

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2008-05-22 20:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-22 20:34 [PATCH] ds1286: push down BKL Alan Cox

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.