summaryrefslogtreecommitdiffstats
path: root/drivers/sbus
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2008-05-20 19:16:08 +0200
committerJonathan Corbet <corbet@lwn.net>2008-06-20 14:05:58 -0600
commit28fbbf491368c9491461ca492e13862da1b49180 (patch)
treee0c64fab37a1374785ce1a7764e8f5836ca4fe3d /drivers/sbus
parentcddf63d99d0d145f18b293c3d0de4af7dab2a922 (diff)
downloadlinux-28fbbf491368c9491461ca492e13862da1b49180.tar.gz
linux-28fbbf491368c9491461ca492e13862da1b49180.tar.bz2
linux-28fbbf491368c9491461ca492e13862da1b49180.zip
jsflash: BKL pushdown
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'drivers/sbus')
-rw-r--r--drivers/sbus/char/jsflash.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/sbus/char/jsflash.c b/drivers/sbus/char/jsflash.c
index 4b7079fdc10c..2bec9ccc0293 100644
--- a/drivers/sbus/char/jsflash.c
+++ b/drivers/sbus/char/jsflash.c
@@ -27,6 +27,7 @@
*/
#include <linux/module.h>
+#include <linux/smp_lock.h>
#include <linux/types.h>
#include <linux/errno.h>
#include <linux/miscdevice.h>
@@ -417,11 +418,17 @@ static int jsf_mmap(struct file * file, struct vm_area_struct * vma)
static int jsf_open(struct inode * inode, struct file * filp)
{
-
- if (jsf0.base == 0) return -ENXIO;
- if (test_and_set_bit(0, (void *)&jsf0.busy) != 0)
+ lock_kernel();
+ if (jsf0.base == 0) {
+ unlock_kernel();
+ return -ENXIO;
+ }
+ if (test_and_set_bit(0, (void *)&jsf0.busy) != 0) {
+ unlock_kernel();
return -EBUSY;
+ }
+ unlock_kernel();
return 0; /* XXX What security? */
}