public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rtc: Push the BKL down into the driver ioctl method
@ 2008-05-22 22:12 Alan Cox
  0 siblings, 0 replies; only message in thread
From: Alan Cox @ 2008-05-22 22:12 UTC (permalink / raw)
  To: linux-kernel, akpm

For now just wrap the main logic, but this driver is a prime candidate
for someone wanting to eliminate the lock entirely

Signed-off-by: Alan Cox <alan@redhat.com>

diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c
index 5f80a9d..3ea201a 100644
--- a/drivers/char/rtc.c
+++ b/drivers/char/rtc.c
@@ -77,9 +77,10 @@
 #include <linux/wait.h>
 #include <linux/bcd.h>
 #include <linux/delay.h>
+#include <linux/smp_lock.h>
+#include <linux/uaccess.h>
 
 #include <asm/current.h>
-#include <asm/uaccess.h>
 #include <asm/system.h>
 
 #ifdef CONFIG_X86
@@ -143,8 +144,7 @@ static DEFINE_TIMER(rtc_irq_timer, rtc_dropped_irq, 0, 0);
 static ssize_t rtc_read(struct file *file, char __user *buf,
 			size_t count, loff_t *ppos);
 
-static int rtc_ioctl(struct inode *inode, struct file *file,
-		     unsigned int cmd, unsigned long arg);
+static int rtc_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
 
 #ifdef RTC_IRQ
 static unsigned int rtc_poll(struct file *file, poll_table *wait);
@@ -717,10 +717,13 @@ static int rtc_do_ioctl(unsigned int cmd, unsigned long arg, int kernel)
 			    &wtime, sizeof wtime) ? -EFAULT : 0;
 }
 
-static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
-		     unsigned long arg)
+static long rtc_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
-	return rtc_do_ioctl(cmd, arg, 0);
+	long ret;
+	lock_kernel();
+	ret = rtc_do_ioctl(cmd, arg, 0);
+	unlock_kernel();
+	return ret;
 }
 
 /*
@@ -910,7 +913,7 @@ static const struct file_operations rtc_fops = {
 #ifdef RTC_IRQ
 	.poll		= rtc_poll,
 #endif
-	.ioctl		= rtc_ioctl,
+	.unlocked_ioctl	= rtc_ioctl,
 	.open		= rtc_open,
 	.release	= rtc_release,
 	.fasync		= rtc_fasync,

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

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

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-22 22:12 [PATCH] rtc: Push the BKL down into the driver ioctl method Alan Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox