aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-01-08 19:04:50 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-01-08 19:04:50 -0500
commit97d61b8e3aef163a75f80f4762794c154572293d (patch)
treea3def27ce963fa0137ae51096879f1f99b33daa3 /drivers
parent1df2d017fe9d22a49bad157b4f5aa19212f29557 (diff)
parent048cd5888f81713af4597bde5815f32d58fdf5b0 (diff)
Merge branch 'bkl-removal' of git://git.lwn.net/linux-2.6
* 'bkl-removal' of git://git.lwn.net/linux-2.6: RTC: Remove the BKL.
Diffstat (limited to 'drivers')
-rw-r--r--drivers/char/rtc.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c
index 20d6efb6324e..e0d0f8b2696b 100644
--- a/drivers/char/rtc.c
+++ b/drivers/char/rtc.c
@@ -48,9 +48,10 @@
48 * CONFIG_HPET_EMULATE_RTC 48 * CONFIG_HPET_EMULATE_RTC
49 * 1.12a Maciej W. Rozycki: Handle memory-mapped chips properly. 49 * 1.12a Maciej W. Rozycki: Handle memory-mapped chips properly.
50 * 1.12ac Alan Cox: Allow read access to the day of week register 50 * 1.12ac Alan Cox: Allow read access to the day of week register
51 * 1.12b David John: Remove calls to the BKL.
51 */ 52 */
52 53
53#define RTC_VERSION "1.12ac" 54#define RTC_VERSION "1.12b"
54 55
55/* 56/*
56 * Note that *all* calls to CMOS_READ and CMOS_WRITE are done with 57 * Note that *all* calls to CMOS_READ and CMOS_WRITE are done with
@@ -73,7 +74,6 @@
73#include <linux/proc_fs.h> 74#include <linux/proc_fs.h>
74#include <linux/seq_file.h> 75#include <linux/seq_file.h>
75#include <linux/spinlock.h> 76#include <linux/spinlock.h>
76#include <linux/smp_lock.h>
77#include <linux/sysctl.h> 77#include <linux/sysctl.h>
78#include <linux/wait.h> 78#include <linux/wait.h>
79#include <linux/bcd.h> 79#include <linux/bcd.h>
@@ -182,8 +182,8 @@ static int rtc_proc_open(struct inode *inode, struct file *file);
182 182
183/* 183/*
184 * rtc_status is never changed by rtc_interrupt, and ioctl/open/close is 184 * rtc_status is never changed by rtc_interrupt, and ioctl/open/close is
185 * protected by the big kernel lock. However, ioctl can still disable the timer 185 * protected by the spin lock rtc_lock. However, ioctl can still disable the
186 * in rtc_status and then with del_timer after the interrupt has read 186 * timer in rtc_status and then with del_timer after the interrupt has read
187 * rtc_status but before mod_timer is called, which would then reenable the 187 * rtc_status but before mod_timer is called, which would then reenable the
188 * timer (but you would need to have an awful timing before you'd trip on it) 188 * timer (but you would need to have an awful timing before you'd trip on it)
189 */ 189 */
@@ -720,9 +720,7 @@ static int rtc_do_ioctl(unsigned int cmd, unsigned long arg, int kernel)
720static long rtc_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 720static long rtc_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
721{ 721{
722 long ret; 722 long ret;
723 lock_kernel();
724 ret = rtc_do_ioctl(cmd, arg, 0); 723 ret = rtc_do_ioctl(cmd, arg, 0);
725 unlock_kernel();
726 return ret; 724 return ret;
727} 725}
728 726
@@ -731,12 +729,8 @@ static long rtc_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
731 * Also clear the previous interrupt data on an open, and clean 729 * Also clear the previous interrupt data on an open, and clean
732 * up things on a close. 730 * up things on a close.
733 */ 731 */
734
735/* We use rtc_lock to protect against concurrent opens. So the BKL is not
736 * needed here. Or anywhere else in this driver. */
737static int rtc_open(struct inode *inode, struct file *file) 732static int rtc_open(struct inode *inode, struct file *file)
738{ 733{
739 lock_kernel();
740 spin_lock_irq(&rtc_lock); 734 spin_lock_irq(&rtc_lock);
741 735
742 if (rtc_status & RTC_IS_OPEN) 736 if (rtc_status & RTC_IS_OPEN)
@@ -746,12 +740,10 @@ static int rtc_open(struct inode *inode, struct file *file)
746 740
747 rtc_irq_data = 0; 741 rtc_irq_data = 0;
748 spin_unlock_irq(&rtc_lock); 742 spin_unlock_irq(&rtc_lock);
749 unlock_kernel();
750 return 0; 743 return 0;
751 744
752out_busy: 745out_busy:
753 spin_unlock_irq(&rtc_lock); 746 spin_unlock_irq(&rtc_lock);
754 unlock_kernel();
755 return -EBUSY; 747 return -EBUSY;
756} 748}
757 749
@@ -800,7 +792,6 @@ no_irq:
800} 792}
801 793
802#ifdef RTC_IRQ 794#ifdef RTC_IRQ
803/* Called without the kernel lock - fine */
804static unsigned int rtc_poll(struct file *file, poll_table *wait) 795static unsigned int rtc_poll(struct file *file, poll_table *wait)
805{ 796{
806 unsigned long l; 797 unsigned long l;