aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/rtc.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/rtc.c')
-rw-r--r--drivers/char/rtc.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c
index 5f80a9dff57..fa92a8af5a5 100644
--- a/drivers/char/rtc.c
+++ b/drivers/char/rtc.c
@@ -73,6 +73,7 @@
73#include <linux/proc_fs.h> 73#include <linux/proc_fs.h>
74#include <linux/seq_file.h> 74#include <linux/seq_file.h>
75#include <linux/spinlock.h> 75#include <linux/spinlock.h>
76#include <linux/smp_lock.h>
76#include <linux/sysctl.h> 77#include <linux/sysctl.h>
77#include <linux/wait.h> 78#include <linux/wait.h>
78#include <linux/bcd.h> 79#include <linux/bcd.h>
@@ -678,12 +679,13 @@ static int rtc_do_ioctl(unsigned int cmd, unsigned long arg, int kernel)
678 if (arg != (1<<tmp)) 679 if (arg != (1<<tmp))
679 return -EINVAL; 680 return -EINVAL;
680 681
682 rtc_freq = arg;
683
681 spin_lock_irqsave(&rtc_lock, flags); 684 spin_lock_irqsave(&rtc_lock, flags);
682 if (hpet_set_periodic_freq(arg)) { 685 if (hpet_set_periodic_freq(arg)) {
683 spin_unlock_irqrestore(&rtc_lock, flags); 686 spin_unlock_irqrestore(&rtc_lock, flags);
684 return 0; 687 return 0;
685 } 688 }
686 rtc_freq = arg;
687 689
688 val = CMOS_READ(RTC_FREQ_SELECT) & 0xf0; 690 val = CMOS_READ(RTC_FREQ_SELECT) & 0xf0;
689 val |= (16 - tmp); 691 val |= (16 - tmp);
@@ -733,6 +735,7 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
733 * needed here. Or anywhere else in this driver. */ 735 * needed here. Or anywhere else in this driver. */
734static int rtc_open(struct inode *inode, struct file *file) 736static int rtc_open(struct inode *inode, struct file *file)
735{ 737{
738 lock_kernel();
736 spin_lock_irq(&rtc_lock); 739 spin_lock_irq(&rtc_lock);
737 740
738 if (rtc_status & RTC_IS_OPEN) 741 if (rtc_status & RTC_IS_OPEN)
@@ -742,10 +745,12 @@ static int rtc_open(struct inode *inode, struct file *file)
742 745
743 rtc_irq_data = 0; 746 rtc_irq_data = 0;
744 spin_unlock_irq(&rtc_lock); 747 spin_unlock_irq(&rtc_lock);
748 unlock_kernel();
745 return 0; 749 return 0;
746 750
747out_busy: 751out_busy:
748 spin_unlock_irq(&rtc_lock); 752 spin_unlock_irq(&rtc_lock);
753 unlock_kernel();
749 return -EBUSY; 754 return -EBUSY;
750} 755}
751 756