|
@@ -24,6 +24,7 @@
|
|
#include <linux/init.h>
|
|
#include <linux/init.h>
|
|
#include <linux/fs.h>
|
|
#include <linux/fs.h>
|
|
#include <linux/ioctl.h>
|
|
#include <linux/ioctl.h>
|
|
|
|
+#include <linux/smp_lock.h>
|
|
#include <linux/delay.h>
|
|
#include <linux/delay.h>
|
|
#include <linux/bcd.h>
|
|
#include <linux/bcd.h>
|
|
#include <linux/mutex.h>
|
|
#include <linux/mutex.h>
|
|
@@ -49,7 +50,7 @@ static DEFINE_MUTEX(rtc_lock); /* Protect state etc */
|
|
static const unsigned char days_in_month[] =
|
|
static const unsigned char days_in_month[] =
|
|
{ 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
|
|
{ 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
|
|
|
|
|
|
-int pcf8563_ioctl(struct inode *, struct file *, unsigned int, unsigned long);
|
|
|
|
|
|
+static long pcf8563_unlocked_ioctl(struct file *filp, unsigned int cmd, unsigned long arg);
|
|
|
|
|
|
/* Cache VL bit value read at driver init since writing the RTC_SECOND
|
|
/* Cache VL bit value read at driver init since writing the RTC_SECOND
|
|
* register clears the VL status.
|
|
* register clears the VL status.
|
|
@@ -57,8 +58,8 @@ int pcf8563_ioctl(struct inode *, struct file *, unsigned int, unsigned long);
|
|
static int voltage_low;
|
|
static int voltage_low;
|
|
|
|
|
|
static const struct file_operations pcf8563_fops = {
|
|
static const struct file_operations pcf8563_fops = {
|
|
- .owner = THIS_MODULE,
|
|
|
|
- .ioctl = pcf8563_ioctl
|
|
|
|
|
|
+ .owner = THIS_MODULE,
|
|
|
|
+ .unlocked_ioctl = pcf8563_unlocked_ioctl,
|
|
};
|
|
};
|
|
|
|
|
|
unsigned char
|
|
unsigned char
|
|
@@ -208,8 +209,7 @@ pcf8563_exit(void)
|
|
* ioctl calls for this driver. Why return -ENOTTY upon error? Because
|
|
* ioctl calls for this driver. Why return -ENOTTY upon error? Because
|
|
* POSIX says so!
|
|
* POSIX says so!
|
|
*/
|
|
*/
|
|
-int pcf8563_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
|
|
|
|
- unsigned long arg)
|
|
|
|
|
|
+static int pcf8563_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
|
|
{
|
|
{
|
|
/* Some sanity checks. */
|
|
/* Some sanity checks. */
|
|
if (_IOC_TYPE(cmd) != RTC_MAGIC)
|
|
if (_IOC_TYPE(cmd) != RTC_MAGIC)
|
|
@@ -335,6 +335,17 @@ int pcf8563_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+static long pcf8563_unlocked_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
|
|
|
|
+{
|
|
|
|
+ int ret;
|
|
|
|
+
|
|
|
|
+ lock_kernel();
|
|
|
|
+ return pcf8563_ioctl(filp, cmd, arg);
|
|
|
|
+ unlock_kernel();
|
|
|
|
+
|
|
|
|
+ return ret;
|
|
|
|
+}
|
|
|
|
+
|
|
static int __init pcf8563_register(void)
|
|
static int __init pcf8563_register(void)
|
|
{
|
|
{
|
|
if (pcf8563_init() < 0) {
|
|
if (pcf8563_init() < 0) {
|