aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/sbus
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2010-08-09 09:09:29 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2010-08-09 09:09:29 -0400
commit054d5c9238f3c577ad51195c3ee7803613f322cc (patch)
treeff7d9f5c0e0ddf14230ba28f28ef69a2c0a0debf /drivers/sbus
parent11e4afb49b7fa1fc8e1ffd850c1806dd86a08204 (diff)
parent2192482ee5ce5d5d4a6cec0c351b2d3a744606eb (diff)
Merge branch 'devel-stable' into devel
Diffstat (limited to 'drivers/sbus')
-rw-r--r--drivers/sbus/char/bbc_i2c.c10
-rw-r--r--drivers/sbus/char/display7seg.c12
-rw-r--r--drivers/sbus/char/envctrl.c6
-rw-r--r--drivers/sbus/char/flash.c19
-rw-r--r--drivers/sbus/char/openprom.c15
-rw-r--r--drivers/sbus/char/uctrl.c13
6 files changed, 38 insertions, 37 deletions
diff --git a/drivers/sbus/char/bbc_i2c.c b/drivers/sbus/char/bbc_i2c.c
index 8bfdd63a1fcb..3e89c313e98d 100644
--- a/drivers/sbus/char/bbc_i2c.c
+++ b/drivers/sbus/char/bbc_i2c.c
@@ -317,7 +317,7 @@ static struct bbc_i2c_bus * __init attach_one_i2c(struct of_device *op, int inde
317 317
318 bp->waiting = 0; 318 bp->waiting = 0;
319 init_waitqueue_head(&bp->wq); 319 init_waitqueue_head(&bp->wq);
320 if (request_irq(op->irqs[0], bbc_i2c_interrupt, 320 if (request_irq(op->archdata.irqs[0], bbc_i2c_interrupt,
321 IRQF_SHARED, "bbc_i2c", bp)) 321 IRQF_SHARED, "bbc_i2c", bp))
322 goto fail; 322 goto fail;
323 323
@@ -373,7 +373,7 @@ static int __devinit bbc_i2c_probe(struct of_device *op,
373 373
374 err = bbc_envctrl_init(bp); 374 err = bbc_envctrl_init(bp);
375 if (err) { 375 if (err) {
376 free_irq(op->irqs[0], bp); 376 free_irq(op->archdata.irqs[0], bp);
377 if (bp->i2c_bussel_reg) 377 if (bp->i2c_bussel_reg)
378 of_iounmap(&op->resource[0], bp->i2c_bussel_reg, 1); 378 of_iounmap(&op->resource[0], bp->i2c_bussel_reg, 1);
379 if (bp->i2c_control_regs) 379 if (bp->i2c_control_regs)
@@ -392,7 +392,7 @@ static int __devexit bbc_i2c_remove(struct of_device *op)
392 392
393 bbc_envctrl_cleanup(bp); 393 bbc_envctrl_cleanup(bp);
394 394
395 free_irq(op->irqs[0], bp); 395 free_irq(op->archdata.irqs[0], bp);
396 396
397 if (bp->i2c_bussel_reg) 397 if (bp->i2c_bussel_reg)
398 of_iounmap(&op->resource[0], bp->i2c_bussel_reg, 1); 398 of_iounmap(&op->resource[0], bp->i2c_bussel_reg, 1);
@@ -425,12 +425,12 @@ static struct of_platform_driver bbc_i2c_driver = {
425 425
426static int __init bbc_i2c_init(void) 426static int __init bbc_i2c_init(void)
427{ 427{
428 return of_register_driver(&bbc_i2c_driver, &of_bus_type); 428 return of_register_platform_driver(&bbc_i2c_driver);
429} 429}
430 430
431static void __exit bbc_i2c_exit(void) 431static void __exit bbc_i2c_exit(void)
432{ 432{
433 of_unregister_driver(&bbc_i2c_driver); 433 of_unregister_platform_driver(&bbc_i2c_driver);
434} 434}
435 435
436module_init(bbc_i2c_init); 436module_init(bbc_i2c_init);
diff --git a/drivers/sbus/char/display7seg.c b/drivers/sbus/char/display7seg.c
index 7baf1b644039..47db97583ea7 100644
--- a/drivers/sbus/char/display7seg.c
+++ b/drivers/sbus/char/display7seg.c
@@ -13,7 +13,7 @@
13#include <linux/miscdevice.h> 13#include <linux/miscdevice.h>
14#include <linux/ioport.h> /* request_region */ 14#include <linux/ioport.h> /* request_region */
15#include <linux/slab.h> 15#include <linux/slab.h>
16#include <linux/smp_lock.h> 16#include <linux/mutex.h>
17#include <linux/of.h> 17#include <linux/of.h>
18#include <linux/of_device.h> 18#include <linux/of_device.h>
19#include <asm/atomic.h> 19#include <asm/atomic.h>
@@ -26,6 +26,7 @@
26#define DRIVER_NAME "d7s" 26#define DRIVER_NAME "d7s"
27#define PFX DRIVER_NAME ": " 27#define PFX DRIVER_NAME ": "
28 28
29static DEFINE_MUTEX(d7s_mutex);
29static int sol_compat = 0; /* Solaris compatibility mode */ 30static int sol_compat = 0; /* Solaris compatibility mode */
30 31
31/* Solaris compatibility flag - 32/* Solaris compatibility flag -
@@ -74,7 +75,6 @@ static int d7s_open(struct inode *inode, struct file *f)
74{ 75{
75 if (D7S_MINOR != iminor(inode)) 76 if (D7S_MINOR != iminor(inode))
76 return -ENODEV; 77 return -ENODEV;
77 cycle_kernel_lock();
78 atomic_inc(&d7s_users); 78 atomic_inc(&d7s_users);
79 return 0; 79 return 0;
80} 80}
@@ -110,7 +110,7 @@ static long d7s_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
110 if (D7S_MINOR != iminor(file->f_path.dentry->d_inode)) 110 if (D7S_MINOR != iminor(file->f_path.dentry->d_inode))
111 return -ENODEV; 111 return -ENODEV;
112 112
113 lock_kernel(); 113 mutex_lock(&d7s_mutex);
114 switch (cmd) { 114 switch (cmd) {
115 case D7SIOCWR: 115 case D7SIOCWR:
116 /* assign device register values we mask-out D7S_FLIP 116 /* assign device register values we mask-out D7S_FLIP
@@ -151,7 +151,7 @@ static long d7s_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
151 writeb(regs, p->regs); 151 writeb(regs, p->regs);
152 break; 152 break;
153 }; 153 };
154 unlock_kernel(); 154 mutex_unlock(&d7s_mutex);
155 155
156 return error; 156 return error;
157} 157}
@@ -277,12 +277,12 @@ static struct of_platform_driver d7s_driver = {
277 277
278static int __init d7s_init(void) 278static int __init d7s_init(void)
279{ 279{
280 return of_register_driver(&d7s_driver, &of_bus_type); 280 return of_register_platform_driver(&d7s_driver);
281} 281}
282 282
283static void __exit d7s_exit(void) 283static void __exit d7s_exit(void)
284{ 284{
285 of_unregister_driver(&d7s_driver); 285 of_unregister_platform_driver(&d7s_driver);
286} 286}
287 287
288module_init(d7s_init); 288module_init(d7s_init);
diff --git a/drivers/sbus/char/envctrl.c b/drivers/sbus/char/envctrl.c
index c8166ecf5276..3c27f45e2b6d 100644
--- a/drivers/sbus/char/envctrl.c
+++ b/drivers/sbus/char/envctrl.c
@@ -27,7 +27,6 @@
27#include <linux/kmod.h> 27#include <linux/kmod.h>
28#include <linux/reboot.h> 28#include <linux/reboot.h>
29#include <linux/slab.h> 29#include <linux/slab.h>
30#include <linux/smp_lock.h>
31#include <linux/of.h> 30#include <linux/of.h>
32#include <linux/of_device.h> 31#include <linux/of_device.h>
33 32
@@ -699,7 +698,6 @@ envctrl_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
699static int 698static int
700envctrl_open(struct inode *inode, struct file *file) 699envctrl_open(struct inode *inode, struct file *file)
701{ 700{
702 cycle_kernel_lock();
703 file->private_data = NULL; 701 file->private_data = NULL;
704 return 0; 702 return 0;
705} 703}
@@ -1142,12 +1140,12 @@ static struct of_platform_driver envctrl_driver = {
1142 1140
1143static int __init envctrl_init(void) 1141static int __init envctrl_init(void)
1144{ 1142{
1145 return of_register_driver(&envctrl_driver, &of_bus_type); 1143 return of_register_platform_driver(&envctrl_driver);
1146} 1144}
1147 1145
1148static void __exit envctrl_exit(void) 1146static void __exit envctrl_exit(void)
1149{ 1147{
1150 of_unregister_driver(&envctrl_driver); 1148 of_unregister_platform_driver(&envctrl_driver);
1151} 1149}
1152 1150
1153module_init(envctrl_init); 1151module_init(envctrl_init);
diff --git a/drivers/sbus/char/flash.c b/drivers/sbus/char/flash.c
index 368d66294d83..8bb31c584b64 100644
--- a/drivers/sbus/char/flash.c
+++ b/drivers/sbus/char/flash.c
@@ -10,7 +10,7 @@
10#include <linux/fcntl.h> 10#include <linux/fcntl.h>
11#include <linux/poll.h> 11#include <linux/poll.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/smp_lock.h> 13#include <linux/mutex.h>
14#include <linux/spinlock.h> 14#include <linux/spinlock.h>
15#include <linux/mm.h> 15#include <linux/mm.h>
16#include <linux/of.h> 16#include <linux/of.h>
@@ -22,6 +22,7 @@
22#include <asm/io.h> 22#include <asm/io.h>
23#include <asm/upa.h> 23#include <asm/upa.h>
24 24
25static DEFINE_MUTEX(flash_mutex);
25static DEFINE_SPINLOCK(flash_lock); 26static DEFINE_SPINLOCK(flash_lock);
26static struct { 27static struct {
27 unsigned long read_base; /* Physical read address */ 28 unsigned long read_base; /* Physical read address */
@@ -80,7 +81,7 @@ flash_mmap(struct file *file, struct vm_area_struct *vma)
80static long long 81static long long
81flash_llseek(struct file *file, long long offset, int origin) 82flash_llseek(struct file *file, long long offset, int origin)
82{ 83{
83 lock_kernel(); 84 mutex_lock(&flash_mutex);
84 switch (origin) { 85 switch (origin) {
85 case 0: 86 case 0:
86 file->f_pos = offset; 87 file->f_pos = offset;
@@ -94,10 +95,10 @@ flash_llseek(struct file *file, long long offset, int origin)
94 file->f_pos = flash.read_size; 95 file->f_pos = flash.read_size;
95 break; 96 break;
96 default: 97 default:
97 unlock_kernel(); 98 mutex_unlock(&flash_mutex);
98 return -EINVAL; 99 return -EINVAL;
99 } 100 }
100 unlock_kernel(); 101 mutex_unlock(&flash_mutex);
101 return file->f_pos; 102 return file->f_pos;
102} 103}
103 104
@@ -125,13 +126,13 @@ flash_read(struct file * file, char __user * buf,
125static int 126static int
126flash_open(struct inode *inode, struct file *file) 127flash_open(struct inode *inode, struct file *file)
127{ 128{
128 lock_kernel(); 129 mutex_lock(&flash_mutex);
129 if (test_and_set_bit(0, (void *)&flash.busy) != 0) { 130 if (test_and_set_bit(0, (void *)&flash.busy) != 0) {
130 unlock_kernel(); 131 mutex_unlock(&flash_mutex);
131 return -EBUSY; 132 return -EBUSY;
132 } 133 }
133 134
134 unlock_kernel(); 135 mutex_unlock(&flash_mutex);
135 return 0; 136 return 0;
136} 137}
137 138
@@ -218,12 +219,12 @@ static struct of_platform_driver flash_driver = {
218 219
219static int __init flash_init(void) 220static int __init flash_init(void)
220{ 221{
221 return of_register_driver(&flash_driver, &of_bus_type); 222 return of_register_platform_driver(&flash_driver);
222} 223}
223 224
224static void __exit flash_cleanup(void) 225static void __exit flash_cleanup(void)
225{ 226{
226 of_unregister_driver(&flash_driver); 227 of_unregister_platform_driver(&flash_driver);
227} 228}
228 229
229module_init(flash_init); 230module_init(flash_init);
diff --git a/drivers/sbus/char/openprom.c b/drivers/sbus/char/openprom.c
index aacbe14e2e7a..8d6e508222b8 100644
--- a/drivers/sbus/char/openprom.c
+++ b/drivers/sbus/char/openprom.c
@@ -33,7 +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/mutex.h>
37#include <linux/string.h> 37#include <linux/string.h>
38#include <linux/miscdevice.h> 38#include <linux/miscdevice.h>
39#include <linux/init.h> 39#include <linux/init.h>
@@ -61,6 +61,7 @@ typedef struct openprom_private_data
61} DATA; 61} DATA;
62 62
63/* ID of the PROM node containing all of the EEPROM options. */ 63/* ID of the PROM node containing all of the EEPROM options. */
64static DEFINE_MUTEX(openprom_mutex);
64static struct device_node *options_node; 65static struct device_node *options_node;
65 66
66/* 67/*
@@ -316,7 +317,7 @@ static long openprom_sunos_ioctl(struct file * file,
316 if (bufsize < 0) 317 if (bufsize < 0)
317 return bufsize; 318 return bufsize;
318 319
319 lock_kernel(); 320 mutex_lock(&openprom_mutex);
320 321
321 switch (cmd) { 322 switch (cmd) {
322 case OPROMGETOPT: 323 case OPROMGETOPT:
@@ -367,7 +368,7 @@ static long openprom_sunos_ioctl(struct file * file,
367 } 368 }
368 369
369 kfree(opp); 370 kfree(opp);
370 unlock_kernel(); 371 mutex_unlock(&openprom_mutex);
371 372
372 return error; 373 return error;
373} 374}
@@ -558,7 +559,7 @@ static int openprom_bsd_ioctl(struct file * file,
558 void __user *argp = (void __user *)arg; 559 void __user *argp = (void __user *)arg;
559 int err; 560 int err;
560 561
561 lock_kernel(); 562 mutex_lock(&openprom_mutex);
562 switch (cmd) { 563 switch (cmd) {
563 case OPIOCGET: 564 case OPIOCGET:
564 err = opiocget(argp, data); 565 err = opiocget(argp, data);
@@ -589,7 +590,7 @@ static int openprom_bsd_ioctl(struct file * file,
589 err = -EINVAL; 590 err = -EINVAL;
590 break; 591 break;
591 }; 592 };
592 unlock_kernel(); 593 mutex_unlock(&openprom_mutex);
593 594
594 return err; 595 return err;
595} 596}
@@ -697,11 +698,11 @@ static int openprom_open(struct inode * inode, struct file * file)
697 if (!data) 698 if (!data)
698 return -ENOMEM; 699 return -ENOMEM;
699 700
700 lock_kernel(); 701 mutex_lock(&openprom_mutex);
701 data->current_node = of_find_node_by_path("/"); 702 data->current_node = of_find_node_by_path("/");
702 data->lastnode = data->current_node; 703 data->lastnode = data->current_node;
703 file->private_data = (void *) data; 704 file->private_data = (void *) data;
704 unlock_kernel(); 705 mutex_unlock(&openprom_mutex);
705 706
706 return 0; 707 return 0;
707} 708}
diff --git a/drivers/sbus/char/uctrl.c b/drivers/sbus/char/uctrl.c
index 5f253665a1da..41eb6725ff5f 100644
--- a/drivers/sbus/char/uctrl.c
+++ b/drivers/sbus/char/uctrl.c
@@ -9,7 +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/mutex.h>
13#include <linux/ioport.h> 13#include <linux/ioport.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/miscdevice.h> 15#include <linux/miscdevice.h>
@@ -72,6 +72,7 @@ struct ts102_regs {
72#define UCTRL_STAT_RXNE_STA 0x04 /* receive FIFO not empty status */ 72#define UCTRL_STAT_RXNE_STA 0x04 /* receive FIFO not empty status */
73#define UCTRL_STAT_RXO_STA 0x08 /* receive FIFO overflow status */ 73#define UCTRL_STAT_RXO_STA 0x08 /* receive FIFO overflow status */
74 74
75static DEFINE_MUTEX(uctrl_mutex);
75static const char *uctrl_extstatus[16] = { 76static const char *uctrl_extstatus[16] = {
76 "main power available", 77 "main power available",
77 "internal battery attached", 78 "internal battery attached",
@@ -210,10 +211,10 @@ uctrl_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
210static int 211static int
211uctrl_open(struct inode *inode, struct file *file) 212uctrl_open(struct inode *inode, struct file *file)
212{ 213{
213 lock_kernel(); 214 mutex_lock(&uctrl_mutex);
214 uctrl_get_event_status(global_driver); 215 uctrl_get_event_status(global_driver);
215 uctrl_get_external_status(global_driver); 216 uctrl_get_external_status(global_driver);
216 unlock_kernel(); 217 mutex_unlock(&uctrl_mutex);
217 return 0; 218 return 0;
218} 219}
219 220
@@ -367,7 +368,7 @@ static int __devinit uctrl_probe(struct of_device *op,
367 goto out_free; 368 goto out_free;
368 } 369 }
369 370
370 p->irq = op->irqs[0]; 371 p->irq = op->archdata.irqs[0];
371 err = request_irq(p->irq, uctrl_interrupt, 0, "uctrl", p); 372 err = request_irq(p->irq, uctrl_interrupt, 0, "uctrl", p);
372 if (err) { 373 if (err) {
373 printk(KERN_ERR "uctrl: Unable to register irq.\n"); 374 printk(KERN_ERR "uctrl: Unable to register irq.\n");
@@ -437,12 +438,12 @@ static struct of_platform_driver uctrl_driver = {
437 438
438static int __init uctrl_init(void) 439static int __init uctrl_init(void)
439{ 440{
440 return of_register_driver(&uctrl_driver, &of_bus_type); 441 return of_register_platform_driver(&uctrl_driver);
441} 442}
442 443
443static void __exit uctrl_exit(void) 444static void __exit uctrl_exit(void)
444{ 445{
445 of_unregister_driver(&uctrl_driver); 446 of_unregister_platform_driver(&uctrl_driver);
446} 447}
447 448
448module_init(uctrl_init); 449module_init(uctrl_init);