diff options
Diffstat (limited to 'arch/um/drivers/harddog_kern.c')
-rw-r--r-- | arch/um/drivers/harddog_kern.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/arch/um/drivers/harddog_kern.c b/arch/um/drivers/harddog_kern.c index cfcac1ff4cf2..2d0266d0254d 100644 --- a/arch/um/drivers/harddog_kern.c +++ b/arch/um/drivers/harddog_kern.c | |||
@@ -42,7 +42,7 @@ | |||
42 | #include <linux/miscdevice.h> | 42 | #include <linux/miscdevice.h> |
43 | #include <linux/watchdog.h> | 43 | #include <linux/watchdog.h> |
44 | #include <linux/reboot.h> | 44 | #include <linux/reboot.h> |
45 | #include <linux/smp_lock.h> | 45 | #include <linux/mutex.h> |
46 | #include <linux/init.h> | 46 | #include <linux/init.h> |
47 | #include <linux/spinlock.h> | 47 | #include <linux/spinlock.h> |
48 | #include <asm/uaccess.h> | 48 | #include <asm/uaccess.h> |
@@ -50,6 +50,7 @@ | |||
50 | 50 | ||
51 | MODULE_LICENSE("GPL"); | 51 | MODULE_LICENSE("GPL"); |
52 | 52 | ||
53 | static DEFINE_MUTEX(harddog_mutex); | ||
53 | static DEFINE_SPINLOCK(lock); | 54 | static DEFINE_SPINLOCK(lock); |
54 | static int timer_alive; | 55 | static int timer_alive; |
55 | static int harddog_in_fd = -1; | 56 | static int harddog_in_fd = -1; |
@@ -66,7 +67,7 @@ static int harddog_open(struct inode *inode, struct file *file) | |||
66 | int err = -EBUSY; | 67 | int err = -EBUSY; |
67 | char *sock = NULL; | 68 | char *sock = NULL; |
68 | 69 | ||
69 | lock_kernel(); | 70 | mutex_lock(&harddog_mutex); |
70 | spin_lock(&lock); | 71 | spin_lock(&lock); |
71 | if(timer_alive) | 72 | if(timer_alive) |
72 | goto err; | 73 | goto err; |
@@ -83,11 +84,11 @@ static int harddog_open(struct inode *inode, struct file *file) | |||
83 | 84 | ||
84 | timer_alive = 1; | 85 | timer_alive = 1; |
85 | spin_unlock(&lock); | 86 | spin_unlock(&lock); |
86 | unlock_kernel(); | 87 | mutex_unlock(&harddog_mutex); |
87 | return nonseekable_open(inode, file); | 88 | return nonseekable_open(inode, file); |
88 | err: | 89 | err: |
89 | spin_unlock(&lock); | 90 | spin_unlock(&lock); |
90 | unlock_kernel(); | 91 | mutex_unlock(&harddog_mutex); |
91 | return err; | 92 | return err; |
92 | } | 93 | } |
93 | 94 | ||
@@ -153,9 +154,9 @@ static long harddog_ioctl(struct file *file, | |||
153 | { | 154 | { |
154 | long ret; | 155 | long ret; |
155 | 156 | ||
156 | lock_kernel(); | 157 | mutex_lock(&harddog_mutex); |
157 | ret = harddog_ioctl_unlocked(file, cmd, arg); | 158 | ret = harddog_ioctl_unlocked(file, cmd, arg); |
158 | unlock_kernel(); | 159 | mutex_unlock(&harddog_mutex); |
159 | 160 | ||
160 | return ret; | 161 | return ret; |
161 | } | 162 | } |
@@ -166,6 +167,7 @@ static const struct file_operations harddog_fops = { | |||
166 | .unlocked_ioctl = harddog_ioctl, | 167 | .unlocked_ioctl = harddog_ioctl, |
167 | .open = harddog_open, | 168 | .open = harddog_open, |
168 | .release = harddog_release, | 169 | .release = harddog_release, |
170 | .llseek = no_llseek, | ||
169 | }; | 171 | }; |
170 | 172 | ||
171 | static struct miscdevice harddog_miscdev = { | 173 | static struct miscdevice harddog_miscdev = { |