Skip to content

Commit

Permalink
jsflash: BKL pushdown
Browse files Browse the repository at this point in the history
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
  • Loading branch information
Arnd Bergmann authored and Jonathan Corbet committed Jun 20, 2008
1 parent cddf63d commit 28fbbf4
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions drivers/sbus/char/jsflash.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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? */
}

Expand Down

0 comments on commit 28fbbf4

Please sign in to comment.