lkml.org 
[lkml]   [2008]   [May]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] ds1286: push down BKL
Not one I can test but hopefully someone can check this on the mips side
and better still eliminate the BKL in the ioctl handler entirely

Signed-off-by: Alan Cox <alan@redhat.com>

diff --git a/drivers/char/ds1286.c b/drivers/char/ds1286.c
index ea35ab2..775b3f6 100644
--- a/drivers/char/ds1286.c
+++ b/drivers/char/ds1286.c
@@ -40,8 +40,8 @@
#include <linux/bcd.h>
#include <linux/proc_fs.h>
#include <linux/jiffies.h>
-
-#include <asm/uaccess.h>
+#include <linux/smp_lock.h>
+#include <linux/uaccess.h>
#include <asm/system.h>

#define DS1286_VERSION "1.0"
@@ -58,8 +58,8 @@ static DECLARE_WAIT_QUEUE_HEAD(ds1286_wait);
static ssize_t ds1286_read(struct file *file, char *buf,
size_t count, loff_t *ppos);

-static int ds1286_ioctl(struct inode *inode, struct file *file,
- unsigned int cmd, unsigned long arg);
+static long ds1286_ioctl(struct file *file, unsigned int cmd,
+ unsigned long arg);

static unsigned int ds1286_poll(struct file *file, poll_table *wait);

@@ -97,8 +97,8 @@ static ssize_t ds1286_read(struct file *file, char *buf,
return -EIO;
}

-static int ds1286_ioctl(struct inode *inode, struct file *file,
- unsigned int cmd, unsigned long arg)
+static long do_ds1286_ioctl(struct file *file, unsigned int cmd,
+ unsigned long arg)
{
struct rtc_time wtime;

@@ -244,6 +244,16 @@ static int ds1286_ioctl(struct inode *inode, struct file *file,
return copy_to_user((void *)arg, &wtime, sizeof wtime) ? -EFAULT : 0;
}

+static long ds1286_ioctl(struct file *file, unsigned int cmd,
+ unsigned long arg)
+{
+ long ret;
+ lock_kernel();
+ ret = ds1286_do_ioctl(file, cmd, arg);
+ unlock_kernel();
+ return ret;
+}
+
/*
* We enforce only one user at a time here with the open/close.
* Also clear the previous interrupt data on an open, and clean
@@ -289,7 +299,7 @@ static const struct file_operations ds1286_fops = {
.llseek = no_llseek,
.read = ds1286_read,
.poll = ds1286_poll,
- .ioctl = ds1286_ioctl,
+ .unlocked_ioctl = ds1286_ioctl,
.open = ds1286_open,
.release = ds1286_release,
};

\
 
 \ /
  Last update: 2008-05-22 22:49    [W:0.179 / U:0.288 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site