aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/rtc.c
diff options
context:
space:
mode:
authorAlan Cox <alan@lxorguk.ukuu.org.uk>2008-07-24 00:30:32 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-24 13:47:33 -0400
commit53f1b1433da7eac2607a4a0898a221a4485fd732 (patch)
treeb6c663482bc7e94cead5d8e9135993a0af149b18 /drivers/char/rtc.c
parent4c228db0b30fa12d65ae7461ce29ed1f4da12c5b (diff)
rtc: push the BKL down into the driver ioctl method
For now just wrap the main logic, but this driver is a prime candidate for someone wanting to eliminate the lock entirely [lizf@cn.fujitsu.com: fix build failure] Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Li Zefan <lizf@cn.fujitsu.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char/rtc.c')
-rw-r--r--drivers/char/rtc.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c
index fa92a8af5a5a..d1569a0d0506 100644
--- a/drivers/char/rtc.c
+++ b/drivers/char/rtc.c
@@ -78,9 +78,10 @@
78#include <linux/wait.h> 78#include <linux/wait.h>
79#include <linux/bcd.h> 79#include <linux/bcd.h>
80#include <linux/delay.h> 80#include <linux/delay.h>
81#include <linux/smp_lock.h>
82#include <linux/uaccess.h>
81 83
82#include <asm/current.h> 84#include <asm/current.h>
83#include <asm/uaccess.h>
84#include <asm/system.h> 85#include <asm/system.h>
85 86
86#ifdef CONFIG_X86 87#ifdef CONFIG_X86
@@ -144,8 +145,7 @@ static DEFINE_TIMER(rtc_irq_timer, rtc_dropped_irq, 0, 0);
144static ssize_t rtc_read(struct file *file, char __user *buf, 145static ssize_t rtc_read(struct file *file, char __user *buf,
145 size_t count, loff_t *ppos); 146 size_t count, loff_t *ppos);
146 147
147static int rtc_ioctl(struct inode *inode, struct file *file, 148static long rtc_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
148 unsigned int cmd, unsigned long arg);
149 149
150#ifdef RTC_IRQ 150#ifdef RTC_IRQ
151static unsigned int rtc_poll(struct file *file, poll_table *wait); 151static unsigned int rtc_poll(struct file *file, poll_table *wait);
@@ -719,10 +719,13 @@ static int rtc_do_ioctl(unsigned int cmd, unsigned long arg, int kernel)
719 &wtime, sizeof wtime) ? -EFAULT : 0; 719 &wtime, sizeof wtime) ? -EFAULT : 0;
720} 720}
721 721
722static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd, 722static long rtc_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
723 unsigned long arg)
724{ 723{
725 return rtc_do_ioctl(cmd, arg, 0); 724 long ret;
725 lock_kernel();
726 ret = rtc_do_ioctl(cmd, arg, 0);
727 unlock_kernel();
728 return ret;
726} 729}
727 730
728/* 731/*
@@ -915,7 +918,7 @@ static const struct file_operations rtc_fops = {
915#ifdef RTC_IRQ 918#ifdef RTC_IRQ
916 .poll = rtc_poll, 919 .poll = rtc_poll,
917#endif 920#endif
918 .ioctl = rtc_ioctl, 921 .unlocked_ioctl = rtc_ioctl,
919 .open = rtc_open, 922 .open = rtc_open,
920 .release = rtc_release, 923 .release = rtc_release,
921 .fasync = rtc_fasync, 924 .fasync = rtc_fasync,