aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/sbus
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/sbus')
-rw-r--r--drivers/sbus/char/bpp.c3
-rw-r--r--drivers/sbus/char/cpwatchdog.c4
-rw-r--r--drivers/sbus/char/display7seg.c1
-rw-r--r--drivers/sbus/char/envctrl.c2
-rw-r--r--drivers/sbus/char/flash.c6
-rw-r--r--drivers/sbus/char/jsflash.c13
-rw-r--r--drivers/sbus/char/openprom.c3
-rw-r--r--drivers/sbus/char/riowatchdog.c2
-rw-r--r--drivers/sbus/char/rtc.c3
-rw-r--r--drivers/sbus/char/uctrl.c3
-rw-r--r--drivers/sbus/char/vfc_dev.c5
11 files changed, 41 insertions, 4 deletions
diff --git a/drivers/sbus/char/bpp.c b/drivers/sbus/char/bpp.c
index 03c966059471..bba21e053a1b 100644
--- a/drivers/sbus/char/bpp.c
+++ b/drivers/sbus/char/bpp.c
@@ -19,6 +19,7 @@
19#include <linux/timer.h> 19#include <linux/timer.h>
20#include <linux/ioport.h> 20#include <linux/ioport.h>
21#include <linux/major.h> 21#include <linux/major.h>
22#include <linux/smp_lock.h>
22 23
23#include <asm/uaccess.h> 24#include <asm/uaccess.h>
24#include <asm/io.h> 25#include <asm/io.h>
@@ -429,6 +430,7 @@ static int bpp_open(struct inode *inode, struct file *f)
429 unsigned minor = iminor(inode); 430 unsigned minor = iminor(inode);
430 int ret; 431 int ret;
431 432
433 lock_kernel();
432 spin_lock(&bpp_open_lock); 434 spin_lock(&bpp_open_lock);
433 ret = 0; 435 ret = 0;
434 if (minor >= BPP_NO) { 436 if (minor >= BPP_NO) {
@@ -444,6 +446,7 @@ static int bpp_open(struct inode *inode, struct file *f)
444 } 446 }
445 } 447 }
446 spin_unlock(&bpp_open_lock); 448 spin_unlock(&bpp_open_lock);
449 unlock_kernel();
447 450
448 return ret; 451 return ret;
449} 452}
diff --git a/drivers/sbus/char/cpwatchdog.c b/drivers/sbus/char/cpwatchdog.c
index 235703414370..23abfdfb44f1 100644
--- a/drivers/sbus/char/cpwatchdog.c
+++ b/drivers/sbus/char/cpwatchdog.c
@@ -279,6 +279,7 @@ static inline int wd_opt_timeout(void)
279 279
280static int wd_open(struct inode *inode, struct file *f) 280static int wd_open(struct inode *inode, struct file *f)
281{ 281{
282 lock_kernel();
282 switch(iminor(inode)) 283 switch(iminor(inode))
283 { 284 {
284 case WD0_MINOR: 285 case WD0_MINOR:
@@ -291,6 +292,7 @@ static int wd_open(struct inode *inode, struct file *f)
291 f->private_data = &wd_dev.watchdog[WD2_ID]; 292 f->private_data = &wd_dev.watchdog[WD2_ID];
292 break; 293 break;
293 default: 294 default:
295 unlock_kernel();
294 return(-ENODEV); 296 return(-ENODEV);
295 } 297 }
296 298
@@ -304,11 +306,13 @@ static int wd_open(struct inode *inode, struct file *f)
304 (void *)wd_dev.regs)) { 306 (void *)wd_dev.regs)) {
305 printk("%s: Cannot register IRQ %d\n", 307 printk("%s: Cannot register IRQ %d\n",
306 WD_OBPNAME, wd_dev.irq); 308 WD_OBPNAME, wd_dev.irq);
309 unlock_kernel();
307 return(-EBUSY); 310 return(-EBUSY);
308 } 311 }
309 wd_dev.initialized = 1; 312 wd_dev.initialized = 1;
310 } 313 }
311 314
315 unlock_kernel();
312 return(nonseekable_open(inode, f)); 316 return(nonseekable_open(inode, f));
313} 317}
314 318
diff --git a/drivers/sbus/char/display7seg.c b/drivers/sbus/char/display7seg.c
index 3279a1b6501d..d8f5c0ca236d 100644
--- a/drivers/sbus/char/display7seg.c
+++ b/drivers/sbus/char/display7seg.c
@@ -94,6 +94,7 @@ static int d7s_open(struct inode *inode, struct file *f)
94{ 94{
95 if (D7S_MINOR != iminor(inode)) 95 if (D7S_MINOR != iminor(inode))
96 return -ENODEV; 96 return -ENODEV;
97 cycle_kernel_lock();
97 atomic_inc(&d7s_users); 98 atomic_inc(&d7s_users);
98 return 0; 99 return 0;
99} 100}
diff --git a/drivers/sbus/char/envctrl.c b/drivers/sbus/char/envctrl.c
index dadabef116b6..a408402426f8 100644
--- a/drivers/sbus/char/envctrl.c
+++ b/drivers/sbus/char/envctrl.c
@@ -27,6 +27,7 @@
27#include <linux/miscdevice.h> 27#include <linux/miscdevice.h>
28#include <linux/kmod.h> 28#include <linux/kmod.h>
29#include <linux/reboot.h> 29#include <linux/reboot.h>
30#include <linux/smp_lock.h>
30 31
31#include <asm/ebus.h> 32#include <asm/ebus.h>
32#include <asm/uaccess.h> 33#include <asm/uaccess.h>
@@ -694,6 +695,7 @@ envctrl_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
694static int 695static int
695envctrl_open(struct inode *inode, struct file *file) 696envctrl_open(struct inode *inode, struct file *file)
696{ 697{
698 cycle_kernel_lock();
697 file->private_data = NULL; 699 file->private_data = NULL;
698 return 0; 700 return 0;
699} 701}
diff --git a/drivers/sbus/char/flash.c b/drivers/sbus/char/flash.c
index 44e039865aa9..7d95e151513a 100644
--- a/drivers/sbus/char/flash.c
+++ b/drivers/sbus/char/flash.c
@@ -127,9 +127,13 @@ flash_read(struct file * file, char __user * buf,
127static int 127static int
128flash_open(struct inode *inode, struct file *file) 128flash_open(struct inode *inode, struct file *file)
129{ 129{
130 if (test_and_set_bit(0, (void *)&flash.busy) != 0) 130 lock_kernel();
131 if (test_and_set_bit(0, (void *)&flash.busy) != 0) {
132 unlock_kernel();
131 return -EBUSY; 133 return -EBUSY;
134 }
132 135
136 unlock_kernel();
133 return 0; 137 return 0;
134} 138}
135 139
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 @@
27 */ 27 */
28 28
29#include <linux/module.h> 29#include <linux/module.h>
30#include <linux/smp_lock.h>
30#include <linux/types.h> 31#include <linux/types.h>
31#include <linux/errno.h> 32#include <linux/errno.h>
32#include <linux/miscdevice.h> 33#include <linux/miscdevice.h>
@@ -417,11 +418,17 @@ static int jsf_mmap(struct file * file, struct vm_area_struct * vma)
417 418
418static int jsf_open(struct inode * inode, struct file * filp) 419static int jsf_open(struct inode * inode, struct file * filp)
419{ 420{
420 421 lock_kernel();
421 if (jsf0.base == 0) return -ENXIO; 422 if (jsf0.base == 0) {
422 if (test_and_set_bit(0, (void *)&jsf0.busy) != 0) 423 unlock_kernel();
424 return -ENXIO;
425 }
426 if (test_and_set_bit(0, (void *)&jsf0.busy) != 0) {
427 unlock_kernel();
423 return -EBUSY; 428 return -EBUSY;
429 }
424 430
431 unlock_kernel();
425 return 0; /* XXX What security? */ 432 return 0; /* XXX What security? */
426} 433}
427 434
diff --git a/drivers/sbus/char/openprom.c b/drivers/sbus/char/openprom.c
index fbfeb89a6f32..29dc735e1a20 100644
--- a/drivers/sbus/char/openprom.c
+++ b/drivers/sbus/char/openprom.c
@@ -33,6 +33,7 @@
33#include <linux/kernel.h> 33#include <linux/kernel.h>
34#include <linux/errno.h> 34#include <linux/errno.h>
35#include <linux/slab.h> 35#include <linux/slab.h>
36#include <linux/smp_lock.h>
36#include <linux/string.h> 37#include <linux/string.h>
37#include <linux/miscdevice.h> 38#include <linux/miscdevice.h>
38#include <linux/init.h> 39#include <linux/init.h>
@@ -689,9 +690,11 @@ static int openprom_open(struct inode * inode, struct file * file)
689 if (!data) 690 if (!data)
690 return -ENOMEM; 691 return -ENOMEM;
691 692
693 lock_kernel();
692 data->current_node = of_find_node_by_path("/"); 694 data->current_node = of_find_node_by_path("/");
693 data->lastnode = data->current_node; 695 data->lastnode = data->current_node;
694 file->private_data = (void *) data; 696 file->private_data = (void *) data;
697 unlock_kernel();
695 698
696 return 0; 699 return 0;
697} 700}
diff --git a/drivers/sbus/char/riowatchdog.c b/drivers/sbus/char/riowatchdog.c
index a2fc6b8c1334..88c0fc6395e1 100644
--- a/drivers/sbus/char/riowatchdog.c
+++ b/drivers/sbus/char/riowatchdog.c
@@ -11,6 +11,7 @@
11#include <linux/errno.h> 11#include <linux/errno.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/miscdevice.h> 13#include <linux/miscdevice.h>
14#include <linux/smp_lock.h>
14 15
15#include <asm/io.h> 16#include <asm/io.h>
16#include <asm/ebus.h> 17#include <asm/ebus.h>
@@ -116,6 +117,7 @@ static void riowd_starttimer(void)
116 117
117static int riowd_open(struct inode *inode, struct file *filp) 118static int riowd_open(struct inode *inode, struct file *filp)
118{ 119{
120 cycle_kernel_lock();
119 nonseekable_open(inode, filp); 121 nonseekable_open(inode, filp);
120 return 0; 122 return 0;
121} 123}
diff --git a/drivers/sbus/char/rtc.c b/drivers/sbus/char/rtc.c
index 18d18f1a114e..b0429917154d 100644
--- a/drivers/sbus/char/rtc.c
+++ b/drivers/sbus/char/rtc.c
@@ -12,6 +12,7 @@
12 */ 12 */
13 13
14#include <linux/module.h> 14#include <linux/module.h>
15#include <linux/smp_lock.h>
15#include <linux/types.h> 16#include <linux/types.h>
16#include <linux/errno.h> 17#include <linux/errno.h>
17#include <linux/miscdevice.h> 18#include <linux/miscdevice.h>
@@ -213,6 +214,7 @@ static int rtc_open(struct inode *inode, struct file *file)
213{ 214{
214 int ret; 215 int ret;
215 216
217 lock_kernel();
216 spin_lock_irq(&mostek_lock); 218 spin_lock_irq(&mostek_lock);
217 if (rtc_busy) { 219 if (rtc_busy) {
218 ret = -EBUSY; 220 ret = -EBUSY;
@@ -221,6 +223,7 @@ static int rtc_open(struct inode *inode, struct file *file)
221 ret = 0; 223 ret = 0;
222 } 224 }
223 spin_unlock_irq(&mostek_lock); 225 spin_unlock_irq(&mostek_lock);
226 unlock_kernel();
224 227
225 return ret; 228 return ret;
226} 229}
diff --git a/drivers/sbus/char/uctrl.c b/drivers/sbus/char/uctrl.c
index 383f32c1d347..513ba61ae966 100644
--- a/drivers/sbus/char/uctrl.c
+++ b/drivers/sbus/char/uctrl.c
@@ -9,6 +9,7 @@
9#include <linux/delay.h> 9#include <linux/delay.h>
10#include <linux/interrupt.h> 10#include <linux/interrupt.h>
11#include <linux/slab.h> 11#include <linux/slab.h>
12#include <linux/smp_lock.h>
12#include <linux/ioport.h> 13#include <linux/ioport.h>
13#include <linux/init.h> 14#include <linux/init.h>
14#include <linux/miscdevice.h> 15#include <linux/miscdevice.h>
@@ -211,8 +212,10 @@ uctrl_ioctl(struct inode *inode, struct file *file,
211static int 212static int
212uctrl_open(struct inode *inode, struct file *file) 213uctrl_open(struct inode *inode, struct file *file)
213{ 214{
215 lock_kernel();
214 uctrl_get_event_status(); 216 uctrl_get_event_status();
215 uctrl_get_external_status(); 217 uctrl_get_external_status();
218 unlock_kernel();
216 return 0; 219 return 0;
217} 220}
218 221
diff --git a/drivers/sbus/char/vfc_dev.c b/drivers/sbus/char/vfc_dev.c
index d4f8fcded51d..1f6cb8ae2784 100644
--- a/drivers/sbus/char/vfc_dev.c
+++ b/drivers/sbus/char/vfc_dev.c
@@ -24,6 +24,7 @@
24#include <linux/spinlock.h> 24#include <linux/spinlock.h>
25#include <linux/mutex.h> 25#include <linux/mutex.h>
26#include <linux/mm.h> 26#include <linux/mm.h>
27#include <linux/smp_lock.h>
27 28
28#include <asm/openprom.h> 29#include <asm/openprom.h>
29#include <asm/oplib.h> 30#include <asm/oplib.h>
@@ -178,14 +179,17 @@ static int vfc_open(struct inode *inode, struct file *file)
178{ 179{
179 struct vfc_dev *dev; 180 struct vfc_dev *dev;
180 181
182 lock_kernel();
181 spin_lock(&vfc_dev_lock); 183 spin_lock(&vfc_dev_lock);
182 dev = vfc_get_dev_ptr(iminor(inode)); 184 dev = vfc_get_dev_ptr(iminor(inode));
183 if (dev == NULL) { 185 if (dev == NULL) {
184 spin_unlock(&vfc_dev_lock); 186 spin_unlock(&vfc_dev_lock);
187 unlock_kernel();
185 return -ENODEV; 188 return -ENODEV;
186 } 189 }
187 if (dev->busy) { 190 if (dev->busy) {
188 spin_unlock(&vfc_dev_lock); 191 spin_unlock(&vfc_dev_lock);
192 unlock_kernel();
189 return -EBUSY; 193 return -EBUSY;
190 } 194 }
191 195
@@ -202,6 +206,7 @@ static int vfc_open(struct inode *inode, struct file *file)
202 vfc_captstat_reset(dev); 206 vfc_captstat_reset(dev);
203 207
204 vfc_unlock_device(dev); 208 vfc_unlock_device(dev);
209 unlock_kernel();
205 return 0; 210 return 0;
206} 211}
207 212