All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alan Cox <alan@lxorguk.ukuu.org.uk>
To: linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org
Subject: [PATCH] ds1286: push down BKL
Date: Thu, 22 May 2008 21:34:11 +0100	[thread overview]
Message-ID: <20080522213411.698845d5@core> (raw)

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

                 reply	other threads:[~2008-05-22 20:46 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20080522213411.698845d5@core \
    --to=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.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 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.