diff options
Diffstat (limited to 'arch/sh')
-rw-r--r-- | arch/sh/boards/landisk/gio.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/arch/sh/boards/landisk/gio.c b/arch/sh/boards/landisk/gio.c index 17025080db35..0c15b0a50b99 100644 --- a/arch/sh/boards/landisk/gio.c +++ b/arch/sh/boards/landisk/gio.c | |||
@@ -14,6 +14,7 @@ | |||
14 | */ | 14 | */ |
15 | #include <linux/module.h> | 15 | #include <linux/module.h> |
16 | #include <linux/init.h> | 16 | #include <linux/init.h> |
17 | #include <linux/smp_lock.h> | ||
17 | #include <linux/kdev_t.h> | 18 | #include <linux/kdev_t.h> |
18 | #include <linux/cdev.h> | 19 | #include <linux/cdev.h> |
19 | #include <linux/fs.h> | 20 | #include <linux/fs.h> |
@@ -32,17 +33,20 @@ static int openCnt; | |||
32 | static int gio_open(struct inode *inode, struct file *filp) | 33 | static int gio_open(struct inode *inode, struct file *filp) |
33 | { | 34 | { |
34 | int minor; | 35 | int minor; |
36 | int ret = -ENOENT; | ||
35 | 37 | ||
38 | lock_kernel(); | ||
36 | minor = MINOR(inode->i_rdev); | 39 | minor = MINOR(inode->i_rdev); |
37 | if (minor < DEVCOUNT) { | 40 | if (minor < DEVCOUNT) { |
38 | if (openCnt > 0) { | 41 | if (openCnt > 0) { |
39 | return -EALREADY; | 42 | ret = -EALREADY; |
40 | } else { | 43 | } else { |
41 | openCnt++; | 44 | openCnt++; |
42 | return 0; | 45 | ret = 0; |
43 | } | 46 | } |
44 | } | 47 | } |
45 | return -ENOENT; | 48 | unlock_kernel(); |
49 | return ret; | ||
46 | } | 50 | } |
47 | 51 | ||
48 | static int gio_close(struct inode *inode, struct file *filp) | 52 | static int gio_close(struct inode *inode, struct file *filp) |