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>
#include <linux/wait.h>
#include <linux/bcd.h>
#include <linux/delay.h>
#include <linux/wait.h>
#include <linux/bcd.h>
#include <linux/delay.h>
+#include <linux/smp_lock.h>
+#include <linux/uaccess.h>
-#include <asm/uaccess.h>
#include <asm/system.h>
#ifdef CONFIG_X86
#include <asm/system.h>
#ifdef CONFIG_X86
static ssize_t rtc_read(struct file *file, char __user *buf,
size_t count, loff_t *ppos);
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 long 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);
#ifdef RTC_IRQ
static unsigned int rtc_poll(struct file *file, poll_table *wait);
&wtime, sizeof wtime) ? -EFAULT : 0;
}
&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;
#ifdef RTC_IRQ
.poll = rtc_poll,
#endif
#ifdef RTC_IRQ
.poll = rtc_poll,
#endif
+ .unlocked_ioctl = rtc_ioctl,
.open = rtc_open,
.release = rtc_release,
.fasync = rtc_fasync,
.open = rtc_open,
.release = rtc_release,
.fasync = rtc_fasync,