aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-18 17:39:44 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-18 17:39:44 -0400
commit9cf52b2921fbe62566b6b2ee79f71203749c9e5e (patch)
tree5705ab0af0adfb7043407b5a4ffbf43fcbff42bd
parent952184304fbf030f0133d8b66a91b2847dce729e (diff)
parent5c45708352a040f19caceb683c78bc86aad466f6 (diff)
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6
* 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6: [SPARC/64]: Consolidate of_register_driver [SPARC] Videopix Frame Grabber: Convert device_lock_sem to mutex [SPARC]: Support for new termios. [SPARC64]: Check of_get_property() return in pci_determine_mem_io_space(). [SPARC64]: Fix boot failures due to bootmem. [SPARC64]: Implement atomic backoff.
-rw-r--r--arch/sparc/kernel/of_device.c20
-rw-r--r--arch/sparc64/kernel/irq.c8
-rw-r--r--arch/sparc64/kernel/of_device.c20
-rw-r--r--arch/sparc64/kernel/pci_common.c7
-rw-r--r--arch/sparc64/lib/atomic.S38
-rw-r--r--arch/sparc64/lib/bitops.S30
-rw-r--r--drivers/of/platform.c21
-rw-r--r--drivers/sbus/char/vfc.h2
-rw-r--r--drivers/sbus/char/vfc_dev.c5
-rw-r--r--include/asm-sparc/ioctls.h4
-rw-r--r--include/asm-sparc/of_platform.h5
-rw-r--r--include/asm-sparc/termbits.h15
-rw-r--r--include/asm-sparc/termios.h48
-rw-r--r--include/asm-sparc64/backoff.h28
-rw-r--r--include/asm-sparc64/ioctls.h4
-rw-r--r--include/asm-sparc64/of_platform.h5
-rw-r--r--include/asm-sparc64/termbits.h17
-rw-r--r--include/asm-sparc64/termios.h42
-rw-r--r--include/linux/of_platform.h4
19 files changed, 243 insertions, 80 deletions
diff --git a/arch/sparc/kernel/of_device.c b/arch/sparc/kernel/of_device.c
index fb2caef79cec..3ea000d15e3a 100644
--- a/arch/sparc/kernel/of_device.c
+++ b/arch/sparc/kernel/of_device.c
@@ -585,24 +585,6 @@ static int __init of_debug(char *str)
585 585
586__setup("of_debug=", of_debug); 586__setup("of_debug=", of_debug);
587 587
588int of_register_driver(struct of_platform_driver *drv, struct bus_type *bus)
589{
590 /* initialize common driver fields */
591 if (!drv->driver.name)
592 drv->driver.name = drv->name;
593 if (!drv->driver.owner)
594 drv->driver.owner = drv->owner;
595 drv->driver.bus = bus;
596
597 /* register with core */
598 return driver_register(&drv->driver);
599}
600
601void of_unregister_driver(struct of_platform_driver *drv)
602{
603 driver_unregister(&drv->driver);
604}
605
606struct of_device* of_platform_device_create(struct device_node *np, 588struct of_device* of_platform_device_create(struct device_node *np,
607 const char *bus_id, 589 const char *bus_id,
608 struct device *parent, 590 struct device *parent,
@@ -628,6 +610,4 @@ struct of_device* of_platform_device_create(struct device_node *np,
628 return dev; 610 return dev;
629} 611}
630 612
631EXPORT_SYMBOL(of_register_driver);
632EXPORT_SYMBOL(of_unregister_driver);
633EXPORT_SYMBOL(of_platform_device_create); 613EXPORT_SYMBOL(of_platform_device_create);
diff --git a/arch/sparc64/kernel/irq.c b/arch/sparc64/kernel/irq.c
index f3922e5a89f6..2c3bea228159 100644
--- a/arch/sparc64/kernel/irq.c
+++ b/arch/sparc64/kernel/irq.c
@@ -877,7 +877,7 @@ void __cpuinit sun4v_register_mondo_queues(int this_cpu)
877static void __init alloc_one_mondo(unsigned long *pa_ptr, unsigned long qmask) 877static void __init alloc_one_mondo(unsigned long *pa_ptr, unsigned long qmask)
878{ 878{
879 unsigned long size = PAGE_ALIGN(qmask + 1); 879 unsigned long size = PAGE_ALIGN(qmask + 1);
880 void *p = __alloc_bootmem_low(size, size, 0); 880 void *p = __alloc_bootmem(size, size, 0);
881 if (!p) { 881 if (!p) {
882 prom_printf("SUN4V: Error, cannot allocate mondo queue.\n"); 882 prom_printf("SUN4V: Error, cannot allocate mondo queue.\n");
883 prom_halt(); 883 prom_halt();
@@ -889,7 +889,7 @@ static void __init alloc_one_mondo(unsigned long *pa_ptr, unsigned long qmask)
889static void __init alloc_one_kbuf(unsigned long *pa_ptr, unsigned long qmask) 889static void __init alloc_one_kbuf(unsigned long *pa_ptr, unsigned long qmask)
890{ 890{
891 unsigned long size = PAGE_ALIGN(qmask + 1); 891 unsigned long size = PAGE_ALIGN(qmask + 1);
892 void *p = __alloc_bootmem_low(size, size, 0); 892 void *p = __alloc_bootmem(size, size, 0);
893 893
894 if (!p) { 894 if (!p) {
895 prom_printf("SUN4V: Error, cannot allocate kbuf page.\n"); 895 prom_printf("SUN4V: Error, cannot allocate kbuf page.\n");
@@ -906,7 +906,7 @@ static void __init init_cpu_send_mondo_info(struct trap_per_cpu *tb)
906 906
907 BUILD_BUG_ON((NR_CPUS * sizeof(u16)) > (PAGE_SIZE - 64)); 907 BUILD_BUG_ON((NR_CPUS * sizeof(u16)) > (PAGE_SIZE - 64));
908 908
909 page = alloc_bootmem_low_pages(PAGE_SIZE); 909 page = alloc_bootmem_pages(PAGE_SIZE);
910 if (!page) { 910 if (!page) {
911 prom_printf("SUN4V: Error, cannot allocate cpu mondo page.\n"); 911 prom_printf("SUN4V: Error, cannot allocate cpu mondo page.\n");
912 prom_halt(); 912 prom_halt();
@@ -953,7 +953,7 @@ void __init init_IRQ(void)
953 kill_prom_timer(); 953 kill_prom_timer();
954 954
955 size = sizeof(struct ino_bucket) * NUM_IVECS; 955 size = sizeof(struct ino_bucket) * NUM_IVECS;
956 ivector_table = alloc_bootmem_low(size); 956 ivector_table = alloc_bootmem(size);
957 if (!ivector_table) { 957 if (!ivector_table) {
958 prom_printf("Fatal error, cannot allocate ivector_table\n"); 958 prom_printf("Fatal error, cannot allocate ivector_table\n");
959 prom_halt(); 959 prom_halt();
diff --git a/arch/sparc64/kernel/of_device.c b/arch/sparc64/kernel/of_device.c
index 42d779866fba..fc5c0cc793b8 100644
--- a/arch/sparc64/kernel/of_device.c
+++ b/arch/sparc64/kernel/of_device.c
@@ -869,26 +869,6 @@ static int __init of_debug(char *str)
869 869
870__setup("of_debug=", of_debug); 870__setup("of_debug=", of_debug);
871 871
872int of_register_driver(struct of_platform_driver *drv, struct bus_type *bus)
873{
874 /* initialize common driver fields */
875 if (!drv->driver.name)
876 drv->driver.name = drv->name;
877 if (!drv->driver.owner)
878 drv->driver.owner = drv->owner;
879 drv->driver.bus = bus;
880
881 /* register with core */
882 return driver_register(&drv->driver);
883}
884EXPORT_SYMBOL(of_register_driver);
885
886void of_unregister_driver(struct of_platform_driver *drv)
887{
888 driver_unregister(&drv->driver);
889}
890EXPORT_SYMBOL(of_unregister_driver);
891
892struct of_device* of_platform_device_create(struct device_node *np, 872struct of_device* of_platform_device_create(struct device_node *np,
893 const char *bus_id, 873 const char *bus_id,
894 struct device *parent, 874 struct device *parent,
diff --git a/arch/sparc64/kernel/pci_common.c b/arch/sparc64/kernel/pci_common.c
index c76bfbb7da08..923e0bcc3bfd 100644
--- a/arch/sparc64/kernel/pci_common.c
+++ b/arch/sparc64/kernel/pci_common.c
@@ -396,6 +396,13 @@ void pci_determine_mem_io_space(struct pci_pbm_info *pbm)
396 396
397 saw_mem = saw_io = 0; 397 saw_mem = saw_io = 0;
398 pbm_ranges = of_get_property(pbm->prom_node, "ranges", &i); 398 pbm_ranges = of_get_property(pbm->prom_node, "ranges", &i);
399 if (!pbm_ranges) {
400 prom_printf("PCI: Fatal error, missing PBM ranges property "
401 " for %s\n",
402 pbm->name);
403 prom_halt();
404 }
405
399 num_pbm_ranges = i / sizeof(*pbm_ranges); 406 num_pbm_ranges = i / sizeof(*pbm_ranges);
400 407
401 for (i = 0; i < num_pbm_ranges; i++) { 408 for (i = 0; i < num_pbm_ranges; i++) {
diff --git a/arch/sparc64/lib/atomic.S b/arch/sparc64/lib/atomic.S
index 9633750167d0..70ac4186f62b 100644
--- a/arch/sparc64/lib/atomic.S
+++ b/arch/sparc64/lib/atomic.S
@@ -1,10 +1,10 @@
1/* $Id: atomic.S,v 1.4 2001/11/18 00:12:56 davem Exp $ 1/* atomic.S: These things are too big to do inline.
2 * atomic.S: These things are too big to do inline.
3 * 2 *
4 * Copyright (C) 1999 David S. Miller (davem@redhat.com) 3 * Copyright (C) 1999, 2007 David S. Miller (davem@davemloft.net)
5 */ 4 */
6 5
7#include <asm/asi.h> 6#include <asm/asi.h>
7#include <asm/backoff.h>
8 8
9 .text 9 .text
10 10
@@ -16,27 +16,31 @@
16 .globl atomic_add 16 .globl atomic_add
17 .type atomic_add,#function 17 .type atomic_add,#function
18atomic_add: /* %o0 = increment, %o1 = atomic_ptr */ 18atomic_add: /* %o0 = increment, %o1 = atomic_ptr */
19 BACKOFF_SETUP(%o2)
191: lduw [%o1], %g1 201: lduw [%o1], %g1
20 add %g1, %o0, %g7 21 add %g1, %o0, %g7
21 cas [%o1], %g1, %g7 22 cas [%o1], %g1, %g7
22 cmp %g1, %g7 23 cmp %g1, %g7
23 bne,pn %icc, 1b 24 bne,pn %icc, 2f
24 nop 25 nop
25 retl 26 retl
26 nop 27 nop
282: BACKOFF_SPIN(%o2, %o3, 1b)
27 .size atomic_add, .-atomic_add 29 .size atomic_add, .-atomic_add
28 30
29 .globl atomic_sub 31 .globl atomic_sub
30 .type atomic_sub,#function 32 .type atomic_sub,#function
31atomic_sub: /* %o0 = decrement, %o1 = atomic_ptr */ 33atomic_sub: /* %o0 = decrement, %o1 = atomic_ptr */
34 BACKOFF_SETUP(%o2)
321: lduw [%o1], %g1 351: lduw [%o1], %g1
33 sub %g1, %o0, %g7 36 sub %g1, %o0, %g7
34 cas [%o1], %g1, %g7 37 cas [%o1], %g1, %g7
35 cmp %g1, %g7 38 cmp %g1, %g7
36 bne,pn %icc, 1b 39 bne,pn %icc, 2f
37 nop 40 nop
38 retl 41 retl
39 nop 42 nop
432: BACKOFF_SPIN(%o2, %o3, 1b)
40 .size atomic_sub, .-atomic_sub 44 .size atomic_sub, .-atomic_sub
41 45
42 /* On SMP we need to use memory barriers to ensure 46 /* On SMP we need to use memory barriers to ensure
@@ -60,89 +64,101 @@ atomic_sub: /* %o0 = decrement, %o1 = atomic_ptr */
60 .globl atomic_add_ret 64 .globl atomic_add_ret
61 .type atomic_add_ret,#function 65 .type atomic_add_ret,#function
62atomic_add_ret: /* %o0 = increment, %o1 = atomic_ptr */ 66atomic_add_ret: /* %o0 = increment, %o1 = atomic_ptr */
67 BACKOFF_SETUP(%o2)
63 ATOMIC_PRE_BARRIER 68 ATOMIC_PRE_BARRIER
641: lduw [%o1], %g1 691: lduw [%o1], %g1
65 add %g1, %o0, %g7 70 add %g1, %o0, %g7
66 cas [%o1], %g1, %g7 71 cas [%o1], %g1, %g7
67 cmp %g1, %g7 72 cmp %g1, %g7
68 bne,pn %icc, 1b 73 bne,pn %icc, 2f
69 add %g7, %o0, %g7 74 add %g7, %o0, %g7
70 sra %g7, 0, %o0 75 sra %g7, 0, %o0
71 ATOMIC_POST_BARRIER 76 ATOMIC_POST_BARRIER
72 retl 77 retl
73 nop 78 nop
792: BACKOFF_SPIN(%o2, %o3, 1b)
74 .size atomic_add_ret, .-atomic_add_ret 80 .size atomic_add_ret, .-atomic_add_ret
75 81
76 .globl atomic_sub_ret 82 .globl atomic_sub_ret
77 .type atomic_sub_ret,#function 83 .type atomic_sub_ret,#function
78atomic_sub_ret: /* %o0 = decrement, %o1 = atomic_ptr */ 84atomic_sub_ret: /* %o0 = decrement, %o1 = atomic_ptr */
85 BACKOFF_SETUP(%o2)
79 ATOMIC_PRE_BARRIER 86 ATOMIC_PRE_BARRIER
801: lduw [%o1], %g1 871: lduw [%o1], %g1
81 sub %g1, %o0, %g7 88 sub %g1, %o0, %g7
82 cas [%o1], %g1, %g7 89 cas [%o1], %g1, %g7
83 cmp %g1, %g7 90 cmp %g1, %g7
84 bne,pn %icc, 1b 91 bne,pn %icc, 2f
85 sub %g7, %o0, %g7 92 sub %g7, %o0, %g7
86 sra %g7, 0, %o0 93 sra %g7, 0, %o0
87 ATOMIC_POST_BARRIER 94 ATOMIC_POST_BARRIER
88 retl 95 retl
89 nop 96 nop
972: BACKOFF_SPIN(%o2, %o3, 1b)
90 .size atomic_sub_ret, .-atomic_sub_ret 98 .size atomic_sub_ret, .-atomic_sub_ret
91 99
92 .globl atomic64_add 100 .globl atomic64_add
93 .type atomic64_add,#function 101 .type atomic64_add,#function
94atomic64_add: /* %o0 = increment, %o1 = atomic_ptr */ 102atomic64_add: /* %o0 = increment, %o1 = atomic_ptr */
103 BACKOFF_SETUP(%o2)
951: ldx [%o1], %g1 1041: ldx [%o1], %g1
96 add %g1, %o0, %g7 105 add %g1, %o0, %g7
97 casx [%o1], %g1, %g7 106 casx [%o1], %g1, %g7
98 cmp %g1, %g7 107 cmp %g1, %g7
99 bne,pn %xcc, 1b 108 bne,pn %xcc, 2f
100 nop 109 nop
101 retl 110 retl
102 nop 111 nop
1122: BACKOFF_SPIN(%o2, %o3, 1b)
103 .size atomic64_add, .-atomic64_add 113 .size atomic64_add, .-atomic64_add
104 114
105 .globl atomic64_sub 115 .globl atomic64_sub
106 .type atomic64_sub,#function 116 .type atomic64_sub,#function
107atomic64_sub: /* %o0 = decrement, %o1 = atomic_ptr */ 117atomic64_sub: /* %o0 = decrement, %o1 = atomic_ptr */
118 BACKOFF_SETUP(%o2)
1081: ldx [%o1], %g1 1191: ldx [%o1], %g1
109 sub %g1, %o0, %g7 120 sub %g1, %o0, %g7
110 casx [%o1], %g1, %g7 121 casx [%o1], %g1, %g7
111 cmp %g1, %g7 122 cmp %g1, %g7
112 bne,pn %xcc, 1b 123 bne,pn %xcc, 2f
113 nop 124 nop
114 retl 125 retl
115 nop 126 nop
1272: BACKOFF_SPIN(%o2, %o3, 1b)
116 .size atomic64_sub, .-atomic64_sub 128 .size atomic64_sub, .-atomic64_sub
117 129
118 .globl atomic64_add_ret 130 .globl atomic64_add_ret
119 .type atomic64_add_ret,#function 131 .type atomic64_add_ret,#function
120atomic64_add_ret: /* %o0 = increment, %o1 = atomic_ptr */ 132atomic64_add_ret: /* %o0 = increment, %o1 = atomic_ptr */
133 BACKOFF_SETUP(%o2)
121 ATOMIC_PRE_BARRIER 134 ATOMIC_PRE_BARRIER
1221: ldx [%o1], %g1 1351: ldx [%o1], %g1
123 add %g1, %o0, %g7 136 add %g1, %o0, %g7
124 casx [%o1], %g1, %g7 137 casx [%o1], %g1, %g7
125 cmp %g1, %g7 138 cmp %g1, %g7
126 bne,pn %xcc, 1b 139 bne,pn %xcc, 2f
127 add %g7, %o0, %g7 140 add %g7, %o0, %g7
128 mov %g7, %o0 141 mov %g7, %o0
129 ATOMIC_POST_BARRIER 142 ATOMIC_POST_BARRIER
130 retl 143 retl
131 nop 144 nop
1452: BACKOFF_SPIN(%o2, %o3, 1b)
132 .size atomic64_add_ret, .-atomic64_add_ret 146 .size atomic64_add_ret, .-atomic64_add_ret
133 147
134 .globl atomic64_sub_ret 148 .globl atomic64_sub_ret
135 .type atomic64_sub_ret,#function 149 .type atomic64_sub_ret,#function
136atomic64_sub_ret: /* %o0 = decrement, %o1 = atomic_ptr */ 150atomic64_sub_ret: /* %o0 = decrement, %o1 = atomic_ptr */
151 BACKOFF_SETUP(%o2)
137 ATOMIC_PRE_BARRIER 152 ATOMIC_PRE_BARRIER
1381: ldx [%o1], %g1 1531: ldx [%o1], %g1
139 sub %g1, %o0, %g7 154 sub %g1, %o0, %g7
140 casx [%o1], %g1, %g7 155 casx [%o1], %g1, %g7
141 cmp %g1, %g7 156 cmp %g1, %g7
142 bne,pn %xcc, 1b 157 bne,pn %xcc, 2f
143 sub %g7, %o0, %g7 158 sub %g7, %o0, %g7
144 mov %g7, %o0 159 mov %g7, %o0
145 ATOMIC_POST_BARRIER 160 ATOMIC_POST_BARRIER
146 retl 161 retl
147 nop 162 nop
1632: BACKOFF_SPIN(%o2, %o3, 1b)
148 .size atomic64_sub_ret, .-atomic64_sub_ret 164 .size atomic64_sub_ret, .-atomic64_sub_ret
diff --git a/arch/sparc64/lib/bitops.S b/arch/sparc64/lib/bitops.S
index 892431a82131..6b015a6eefb5 100644
--- a/arch/sparc64/lib/bitops.S
+++ b/arch/sparc64/lib/bitops.S
@@ -1,10 +1,10 @@
1/* $Id: bitops.S,v 1.3 2001/11/18 00:12:56 davem Exp $ 1/* bitops.S: Sparc64 atomic bit operations.
2 * bitops.S: Sparc64 atomic bit operations.
3 * 2 *
4 * Copyright (C) 2000 David S. Miller (davem@redhat.com) 3 * Copyright (C) 2000, 2007 David S. Miller (davem@davemloft.net)
5 */ 4 */
6 5
7#include <asm/asi.h> 6#include <asm/asi.h>
7#include <asm/backoff.h>
8 8
9 .text 9 .text
10 10
@@ -29,6 +29,7 @@
29 .globl test_and_set_bit 29 .globl test_and_set_bit
30 .type test_and_set_bit,#function 30 .type test_and_set_bit,#function
31test_and_set_bit: /* %o0=nr, %o1=addr */ 31test_and_set_bit: /* %o0=nr, %o1=addr */
32 BACKOFF_SETUP(%o3)
32 BITOP_PRE_BARRIER 33 BITOP_PRE_BARRIER
33 srlx %o0, 6, %g1 34 srlx %o0, 6, %g1
34 mov 1, %o2 35 mov 1, %o2
@@ -40,18 +41,20 @@ test_and_set_bit: /* %o0=nr, %o1=addr */
40 or %g7, %o2, %g1 41 or %g7, %o2, %g1
41 casx [%o1], %g7, %g1 42 casx [%o1], %g7, %g1
42 cmp %g7, %g1 43 cmp %g7, %g1
43 bne,pn %xcc, 1b 44 bne,pn %xcc, 2f
44 and %g7, %o2, %g2 45 and %g7, %o2, %g2
45 clr %o0 46 clr %o0
46 movrne %g2, 1, %o0 47 movrne %g2, 1, %o0
47 BITOP_POST_BARRIER 48 BITOP_POST_BARRIER
48 retl 49 retl
49 nop 50 nop
512: BACKOFF_SPIN(%o3, %o4, 1b)
50 .size test_and_set_bit, .-test_and_set_bit 52 .size test_and_set_bit, .-test_and_set_bit
51 53
52 .globl test_and_clear_bit 54 .globl test_and_clear_bit
53 .type test_and_clear_bit,#function 55 .type test_and_clear_bit,#function
54test_and_clear_bit: /* %o0=nr, %o1=addr */ 56test_and_clear_bit: /* %o0=nr, %o1=addr */
57 BACKOFF_SETUP(%o3)
55 BITOP_PRE_BARRIER 58 BITOP_PRE_BARRIER
56 srlx %o0, 6, %g1 59 srlx %o0, 6, %g1
57 mov 1, %o2 60 mov 1, %o2
@@ -63,18 +66,20 @@ test_and_clear_bit: /* %o0=nr, %o1=addr */
63 andn %g7, %o2, %g1 66 andn %g7, %o2, %g1
64 casx [%o1], %g7, %g1 67 casx [%o1], %g7, %g1
65 cmp %g7, %g1 68 cmp %g7, %g1
66 bne,pn %xcc, 1b 69 bne,pn %xcc, 2f
67 and %g7, %o2, %g2 70 and %g7, %o2, %g2
68 clr %o0 71 clr %o0
69 movrne %g2, 1, %o0 72 movrne %g2, 1, %o0
70 BITOP_POST_BARRIER 73 BITOP_POST_BARRIER
71 retl 74 retl
72 nop 75 nop
762: BACKOFF_SPIN(%o3, %o4, 1b)
73 .size test_and_clear_bit, .-test_and_clear_bit 77 .size test_and_clear_bit, .-test_and_clear_bit
74 78
75 .globl test_and_change_bit 79 .globl test_and_change_bit
76 .type test_and_change_bit,#function 80 .type test_and_change_bit,#function
77test_and_change_bit: /* %o0=nr, %o1=addr */ 81test_and_change_bit: /* %o0=nr, %o1=addr */
82 BACKOFF_SETUP(%o3)
78 BITOP_PRE_BARRIER 83 BITOP_PRE_BARRIER
79 srlx %o0, 6, %g1 84 srlx %o0, 6, %g1
80 mov 1, %o2 85 mov 1, %o2
@@ -86,18 +91,20 @@ test_and_change_bit: /* %o0=nr, %o1=addr */
86 xor %g7, %o2, %g1 91 xor %g7, %o2, %g1
87 casx [%o1], %g7, %g1 92 casx [%o1], %g7, %g1
88 cmp %g7, %g1 93 cmp %g7, %g1
89 bne,pn %xcc, 1b 94 bne,pn %xcc, 2f
90 and %g7, %o2, %g2 95 and %g7, %o2, %g2
91 clr %o0 96 clr %o0
92 movrne %g2, 1, %o0 97 movrne %g2, 1, %o0
93 BITOP_POST_BARRIER 98 BITOP_POST_BARRIER
94 retl 99 retl
95 nop 100 nop
1012: BACKOFF_SPIN(%o3, %o4, 1b)
96 .size test_and_change_bit, .-test_and_change_bit 102 .size test_and_change_bit, .-test_and_change_bit
97 103
98 .globl set_bit 104 .globl set_bit
99 .type set_bit,#function 105 .type set_bit,#function
100set_bit: /* %o0=nr, %o1=addr */ 106set_bit: /* %o0=nr, %o1=addr */
107 BACKOFF_SETUP(%o3)
101 srlx %o0, 6, %g1 108 srlx %o0, 6, %g1
102 mov 1, %o2 109 mov 1, %o2
103 sllx %g1, 3, %g3 110 sllx %g1, 3, %g3
@@ -108,15 +115,17 @@ set_bit: /* %o0=nr, %o1=addr */
108 or %g7, %o2, %g1 115 or %g7, %o2, %g1
109 casx [%o1], %g7, %g1 116 casx [%o1], %g7, %g1
110 cmp %g7, %g1 117 cmp %g7, %g1
111 bne,pn %xcc, 1b 118 bne,pn %xcc, 2f
112 nop 119 nop
113 retl 120 retl
114 nop 121 nop
1222: BACKOFF_SPIN(%o3, %o4, 1b)
115 .size set_bit, .-set_bit 123 .size set_bit, .-set_bit
116 124
117 .globl clear_bit 125 .globl clear_bit
118 .type clear_bit,#function 126 .type clear_bit,#function
119clear_bit: /* %o0=nr, %o1=addr */ 127clear_bit: /* %o0=nr, %o1=addr */
128 BACKOFF_SETUP(%o3)
120 srlx %o0, 6, %g1 129 srlx %o0, 6, %g1
121 mov 1, %o2 130 mov 1, %o2
122 sllx %g1, 3, %g3 131 sllx %g1, 3, %g3
@@ -127,15 +136,17 @@ clear_bit: /* %o0=nr, %o1=addr */
127 andn %g7, %o2, %g1 136 andn %g7, %o2, %g1
128 casx [%o1], %g7, %g1 137 casx [%o1], %g7, %g1
129 cmp %g7, %g1 138 cmp %g7, %g1
130 bne,pn %xcc, 1b 139 bne,pn %xcc, 2f
131 nop 140 nop
132 retl 141 retl
133 nop 142 nop
1432: BACKOFF_SPIN(%o3, %o4, 1b)
134 .size clear_bit, .-clear_bit 144 .size clear_bit, .-clear_bit
135 145
136 .globl change_bit 146 .globl change_bit
137 .type change_bit,#function 147 .type change_bit,#function
138change_bit: /* %o0=nr, %o1=addr */ 148change_bit: /* %o0=nr, %o1=addr */
149 BACKOFF_SETUP(%o3)
139 srlx %o0, 6, %g1 150 srlx %o0, 6, %g1
140 mov 1, %o2 151 mov 1, %o2
141 sllx %g1, 3, %g3 152 sllx %g1, 3, %g3
@@ -146,8 +157,9 @@ change_bit: /* %o0=nr, %o1=addr */
146 xor %g7, %o2, %g1 157 xor %g7, %o2, %g1
147 casx [%o1], %g7, %g1 158 casx [%o1], %g7, %g1
148 cmp %g7, %g1 159 cmp %g7, %g1
149 bne,pn %xcc, 1b 160 bne,pn %xcc, 2f
150 nop 161 nop
151 retl 162 retl
152 nop 163 nop
1642: BACKOFF_SPIN(%o3, %o4, 1b)
153 .size change_bit, .-change_bit 165 .size change_bit, .-change_bit
diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index 864f09fd9f86..b47bb2d7476a 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -12,6 +12,7 @@
12 * 12 *
13 */ 13 */
14#include <linux/errno.h> 14#include <linux/errno.h>
15#include <linux/module.h>
15#include <linux/device.h> 16#include <linux/device.h>
16#include <linux/of_device.h> 17#include <linux/of_device.h>
17#include <linux/of_platform.h> 18#include <linux/of_platform.h>
@@ -94,3 +95,23 @@ int of_bus_type_init(struct bus_type *bus, const char *name)
94 bus->resume = of_platform_device_resume; 95 bus->resume = of_platform_device_resume;
95 return bus_register(bus); 96 return bus_register(bus);
96} 97}
98
99int of_register_driver(struct of_platform_driver *drv, struct bus_type *bus)
100{
101 /* initialize common driver fields */
102 if (!drv->driver.name)
103 drv->driver.name = drv->name;
104 if (!drv->driver.owner)
105 drv->driver.owner = drv->owner;
106 drv->driver.bus = bus;
107
108 /* register with core */
109 return driver_register(&drv->driver);
110}
111EXPORT_SYMBOL(of_register_driver);
112
113void of_unregister_driver(struct of_platform_driver *drv)
114{
115 driver_unregister(&drv->driver);
116}
117EXPORT_SYMBOL(of_unregister_driver);
diff --git a/drivers/sbus/char/vfc.h b/drivers/sbus/char/vfc.h
index 63941a259b92..f1aa1389ea4a 100644
--- a/drivers/sbus/char/vfc.h
+++ b/drivers/sbus/char/vfc.h
@@ -126,7 +126,7 @@ struct vfc_dev {
126 volatile struct vfc_regs __iomem *regs; 126 volatile struct vfc_regs __iomem *regs;
127 struct vfc_regs *phys_regs; 127 struct vfc_regs *phys_regs;
128 unsigned int control_reg; 128 unsigned int control_reg;
129 struct semaphore device_lock_sem; 129 struct mutex device_lock_mtx;
130 int instance; 130 int instance;
131 int busy; 131 int busy;
132 unsigned long which_io; 132 unsigned long which_io;
diff --git a/drivers/sbus/char/vfc_dev.c b/drivers/sbus/char/vfc_dev.c
index 9269f7fbd363..e7a1642b2aa4 100644
--- a/drivers/sbus/char/vfc_dev.c
+++ b/drivers/sbus/char/vfc_dev.c
@@ -22,6 +22,7 @@
22#include <linux/fs.h> 22#include <linux/fs.h>
23#include <linux/delay.h> 23#include <linux/delay.h>
24#include <linux/spinlock.h> 24#include <linux/spinlock.h>
25#include <linux/mutex.h>
25#include <linux/mm.h> 26#include <linux/mm.h>
26 27
27#include <asm/openprom.h> 28#include <asm/openprom.h>
@@ -54,12 +55,12 @@ static unsigned char saa9051_init_array[VFC_SAA9051_NR] = {
54 55
55void vfc_lock_device(struct vfc_dev *dev) 56void vfc_lock_device(struct vfc_dev *dev)
56{ 57{
57 down(&dev->device_lock_sem); 58 mutex_lock(&dev->device_lock_mtx);
58} 59}
59 60
60void vfc_unlock_device(struct vfc_dev *dev) 61void vfc_unlock_device(struct vfc_dev *dev)
61{ 62{
62 up(&dev->device_lock_sem); 63 mutex_unlock(&dev->device_lock_mtx);
63} 64}
64 65
65 66
diff --git a/include/asm-sparc/ioctls.h b/include/asm-sparc/ioctls.h
index bdf77b0dfd8e..058c2064f706 100644
--- a/include/asm-sparc/ioctls.h
+++ b/include/asm-sparc/ioctls.h
@@ -15,6 +15,10 @@
15#define TCSETS _IOW('T', 9, struct termios) 15#define TCSETS _IOW('T', 9, struct termios)
16#define TCSETSW _IOW('T', 10, struct termios) 16#define TCSETSW _IOW('T', 10, struct termios)
17#define TCSETSF _IOW('T', 11, struct termios) 17#define TCSETSF _IOW('T', 11, struct termios)
18#define TCGETS2 _IOR('T', 12, struct termios2)
19#define TCSETS2 _IOW('T', 13, struct termios2)
20#define TCSETSW2 _IOW('T', 14, struct termios2)
21#define TCSETSF2 _IOW('T', 15, struct termios2)
18 22
19/* Note that all the ioctls that are not available in Linux have a 23/* Note that all the ioctls that are not available in Linux have a
20 * double underscore on the front to: a) avoid some programs to 24 * double underscore on the front to: a) avoid some programs to
diff --git a/include/asm-sparc/of_platform.h b/include/asm-sparc/of_platform.h
index 64a230064ef2..d638737ff13c 100644
--- a/include/asm-sparc/of_platform.h
+++ b/include/asm-sparc/of_platform.h
@@ -18,12 +18,9 @@
18 18
19extern struct bus_type ebus_bus_type; 19extern struct bus_type ebus_bus_type;
20extern struct bus_type sbus_bus_type; 20extern struct bus_type sbus_bus_type;
21extern struct bus_type of_platform_bus_type; 21
22#define of_bus_type of_platform_bus_type /* for compatibility */ 22#define of_bus_type of_platform_bus_type /* for compatibility */
23 23
24extern int of_register_driver(struct of_platform_driver *drv,
25 struct bus_type *bus);
26extern void of_unregister_driver(struct of_platform_driver *drv);
27extern struct of_device *of_platform_device_create(struct device_node *np, 24extern struct of_device *of_platform_device_create(struct device_node *np,
28 const char *bus_id, 25 const char *bus_id,
29 struct device *parent, 26 struct device *parent,
diff --git a/include/asm-sparc/termbits.h b/include/asm-sparc/termbits.h
index 5eb00a105d7c..90cf2210118b 100644
--- a/include/asm-sparc/termbits.h
+++ b/include/asm-sparc/termbits.h
@@ -31,6 +31,18 @@ struct termios {
31#endif 31#endif
32}; 32};
33 33
34struct termios2 {
35 tcflag_t c_iflag; /* input mode flags */
36 tcflag_t c_oflag; /* output mode flags */
37 tcflag_t c_cflag; /* control mode flags */
38 tcflag_t c_lflag; /* local mode flags */
39 cc_t c_line; /* line discipline */
40 cc_t c_cc[NCCS]; /* control characters */
41 cc_t _x_cc[2]; /* padding to match ktermios */
42 speed_t c_ispeed; /* input speed */
43 speed_t c_ospeed; /* output speed */
44};
45
34struct ktermios { 46struct ktermios {
35 tcflag_t c_iflag; /* input mode flags */ 47 tcflag_t c_iflag; /* input mode flags */
36 tcflag_t c_oflag; /* output mode flags */ 48 tcflag_t c_oflag; /* output mode flags */
@@ -160,6 +172,7 @@ struct ktermios {
160#define CLOCAL 0x00000800 172#define CLOCAL 0x00000800
161#define CBAUDEX 0x00001000 173#define CBAUDEX 0x00001000
162/* We'll never see these speeds with the Zilogs, but for completeness... */ 174/* We'll never see these speeds with the Zilogs, but for completeness... */
175#define BOTHER 0x00001000
163#define B57600 0x00001001 176#define B57600 0x00001001
164#define B115200 0x00001002 177#define B115200 0x00001002
165#define B230400 0x00001003 178#define B230400 0x00001003
@@ -189,6 +202,8 @@ struct ktermios {
189#define CMSPAR 0x40000000 /* mark or space (stick) parity */ 202#define CMSPAR 0x40000000 /* mark or space (stick) parity */
190#define CRTSCTS 0x80000000 /* flow control */ 203#define CRTSCTS 0x80000000 /* flow control */
191 204
205#define IBSHIFT 16 /* Shift from CBAUD to CIBAUD */
206
192/* c_lflag bits */ 207/* c_lflag bits */
193#define ISIG 0x00000001 208#define ISIG 0x00000001
194#define ICANON 0x00000002 209#define ICANON 0x00000002
diff --git a/include/asm-sparc/termios.h b/include/asm-sparc/termios.h
index d767f206ab33..4333232abb9f 100644
--- a/include/asm-sparc/termios.h
+++ b/include/asm-sparc/termios.h
@@ -108,13 +108,55 @@ struct winsize {
108 108
109#define user_termios_to_kernel_termios(k, u) \ 109#define user_termios_to_kernel_termios(k, u) \
110({ \ 110({ \
111 int err; \
112 err = get_user((k)->c_iflag, &(u)->c_iflag); \
113 err |= get_user((k)->c_oflag, &(u)->c_oflag); \
114 err |= get_user((k)->c_cflag, &(u)->c_cflag); \
115 err |= get_user((k)->c_lflag, &(u)->c_lflag); \
116 err |= get_user((k)->c_line, &(u)->c_line); \
117 err |= copy_from_user((k)->c_cc, (u)->c_cc, NCCS); \
118 if ((k)->c_lflag & ICANON) { \
119 err |= get_user((k)->c_cc[VEOF], &(u)->c_cc[VEOF]); \
120 err |= get_user((k)->c_cc[VEOL], &(u)->c_cc[VEOL]); \
121 } else { \
122 err |= get_user((k)->c_cc[VMIN], &(u)->c_cc[_VMIN]); \
123 err |= get_user((k)->c_cc[VTIME], &(u)->c_cc[_VTIME]); \
124 } \
125 err |= get_user((k)->c_ispeed, &(u)->c_ispeed); \
126 err |= get_user((k)->c_ospeed, &(u)->c_ospeed); \
127 err; \
128})
129
130#define kernel_termios_to_user_termios(u, k) \
131({ \
132 int err; \
133 err = put_user((k)->c_iflag, &(u)->c_iflag); \
134 err |= put_user((k)->c_oflag, &(u)->c_oflag); \
135 err |= put_user((k)->c_cflag, &(u)->c_cflag); \
136 err |= put_user((k)->c_lflag, &(u)->c_lflag); \
137 err |= put_user((k)->c_line, &(u)->c_line); \
138 err |= copy_to_user((u)->c_cc, (k)->c_cc, NCCS); \
139 if (!((k)->c_lflag & ICANON)) { \
140 err |= put_user((k)->c_cc[VMIN], &(u)->c_cc[_VMIN]); \
141 err |= put_user((k)->c_cc[VTIME], &(u)->c_cc[_VTIME]); \
142 } else { \
143 err |= put_user((k)->c_cc[VEOF], &(u)->c_cc[VEOF]); \
144 err |= put_user((k)->c_cc[VEOL], &(u)->c_cc[VEOL]); \
145 } \
146 err |= put_user((k)->c_ispeed, &(u)->c_ispeed); \
147 err |= put_user((k)->c_ospeed, &(u)->c_ospeed); \
148 err; \
149})
150
151#define user_termios_to_kernel_termios_1(k, u) \
152({ \
111 get_user((k)->c_iflag, &(u)->c_iflag); \ 153 get_user((k)->c_iflag, &(u)->c_iflag); \
112 get_user((k)->c_oflag, &(u)->c_oflag); \ 154 get_user((k)->c_oflag, &(u)->c_oflag); \
113 get_user((k)->c_cflag, &(u)->c_cflag); \ 155 get_user((k)->c_cflag, &(u)->c_cflag); \
114 get_user((k)->c_lflag, &(u)->c_lflag); \ 156 get_user((k)->c_lflag, &(u)->c_lflag); \
115 get_user((k)->c_line, &(u)->c_line); \ 157 get_user((k)->c_line, &(u)->c_line); \
116 copy_from_user((k)->c_cc, (u)->c_cc, NCCS); \ 158 copy_from_user((k)->c_cc, (u)->c_cc, NCCS); \
117 if((k)->c_lflag & ICANON) { \ 159 if ((k)->c_lflag & ICANON) { \
118 get_user((k)->c_cc[VEOF], &(u)->c_cc[VEOF]); \ 160 get_user((k)->c_cc[VEOF], &(u)->c_cc[VEOF]); \
119 get_user((k)->c_cc[VEOL], &(u)->c_cc[VEOL]); \ 161 get_user((k)->c_cc[VEOL], &(u)->c_cc[VEOL]); \
120 } else { \ 162 } else { \
@@ -124,7 +166,7 @@ struct winsize {
124 0; \ 166 0; \
125}) 167})
126 168
127#define kernel_termios_to_user_termios(u, k) \ 169#define kernel_termios_to_user_termios_1(u, k) \
128({ \ 170({ \
129 put_user((k)->c_iflag, &(u)->c_iflag); \ 171 put_user((k)->c_iflag, &(u)->c_iflag); \
130 put_user((k)->c_oflag, &(u)->c_oflag); \ 172 put_user((k)->c_oflag, &(u)->c_oflag); \
@@ -132,7 +174,7 @@ struct winsize {
132 put_user((k)->c_lflag, &(u)->c_lflag); \ 174 put_user((k)->c_lflag, &(u)->c_lflag); \
133 put_user((k)->c_line, &(u)->c_line); \ 175 put_user((k)->c_line, &(u)->c_line); \
134 copy_to_user((u)->c_cc, (k)->c_cc, NCCS); \ 176 copy_to_user((u)->c_cc, (k)->c_cc, NCCS); \
135 if(!((k)->c_lflag & ICANON)) { \ 177 if (!((k)->c_lflag & ICANON)) { \
136 put_user((k)->c_cc[VMIN], &(u)->c_cc[_VMIN]); \ 178 put_user((k)->c_cc[VMIN], &(u)->c_cc[_VMIN]); \
137 put_user((k)->c_cc[VTIME], &(u)->c_cc[_VTIME]); \ 179 put_user((k)->c_cc[VTIME], &(u)->c_cc[_VTIME]); \
138 } else { \ 180 } else { \
diff --git a/include/asm-sparc64/backoff.h b/include/asm-sparc64/backoff.h
new file mode 100644
index 000000000000..0e32f8b62fd2
--- /dev/null
+++ b/include/asm-sparc64/backoff.h
@@ -0,0 +1,28 @@
1#ifndef _SPARC64_BACKOFF_H
2#define _SPARC64_BACKOFF_H
3
4#define BACKOFF_LIMIT (4 * 1024)
5
6#ifdef CONFIG_SMP
7
8#define BACKOFF_SETUP(reg) \
9 mov 1, reg
10
11#define BACKOFF_SPIN(reg, tmp, label) \
12 mov reg, tmp; \
1388: brnz,pt tmp, 88b; \
14 sub tmp, 1, tmp; \
15 cmp reg, BACKOFF_LIMIT; \
16 bg,pn %xcc, label; \
17 nop; \
18 ba,pt %xcc, label; \
19 sllx reg, 1, reg;
20
21#else
22
23#define BACKOFF_SETUP(reg)
24#define BACKOFF_SPIN(reg, tmp, label)
25
26#endif
27
28#endif /* _SPARC64_BACKOFF_H */
diff --git a/include/asm-sparc64/ioctls.h b/include/asm-sparc64/ioctls.h
index 2223b6d0e5ed..083c9a0f37de 100644
--- a/include/asm-sparc64/ioctls.h
+++ b/include/asm-sparc64/ioctls.h
@@ -16,6 +16,10 @@
16#define TCSETS _IOW('T', 9, struct termios) 16#define TCSETS _IOW('T', 9, struct termios)
17#define TCSETSW _IOW('T', 10, struct termios) 17#define TCSETSW _IOW('T', 10, struct termios)
18#define TCSETSF _IOW('T', 11, struct termios) 18#define TCSETSF _IOW('T', 11, struct termios)
19#define TCGETS2 _IOR('T', 12, struct termios2)
20#define TCSETS2 _IOW('T', 13, struct termios2)
21#define TCSETSW2 _IOW('T', 14, struct termios2)
22#define TCSETSF2 _IOW('T', 15, struct termios2)
19 23
20/* Note that all the ioctls that are not available in Linux have a 24/* Note that all the ioctls that are not available in Linux have a
21 * double underscore on the front to: a) avoid some programs to 25 * double underscore on the front to: a) avoid some programs to
diff --git a/include/asm-sparc64/of_platform.h b/include/asm-sparc64/of_platform.h
index f7c1f17c7d52..f15cfa723916 100644
--- a/include/asm-sparc64/of_platform.h
+++ b/include/asm-sparc64/of_platform.h
@@ -19,12 +19,9 @@
19extern struct bus_type isa_bus_type; 19extern struct bus_type isa_bus_type;
20extern struct bus_type ebus_bus_type; 20extern struct bus_type ebus_bus_type;
21extern struct bus_type sbus_bus_type; 21extern struct bus_type sbus_bus_type;
22extern struct bus_type of_platform_bus_type; 22
23#define of_bus_type of_platform_bus_type /* for compatibility */ 23#define of_bus_type of_platform_bus_type /* for compatibility */
24 24
25extern int of_register_driver(struct of_platform_driver *drv,
26 struct bus_type *bus);
27extern void of_unregister_driver(struct of_platform_driver *drv);
28extern struct of_device *of_platform_device_create(struct device_node *np, 25extern struct of_device *of_platform_device_create(struct device_node *np,
29 const char *bus_id, 26 const char *bus_id,
30 struct device *parent, 27 struct device *parent,
diff --git a/include/asm-sparc64/termbits.h b/include/asm-sparc64/termbits.h
index 705cd44b4173..ebe31c152f16 100644
--- a/include/asm-sparc64/termbits.h
+++ b/include/asm-sparc64/termbits.h
@@ -5,8 +5,6 @@
5 5
6typedef unsigned char cc_t; 6typedef unsigned char cc_t;
7typedef unsigned int speed_t; 7typedef unsigned int speed_t;
8
9/* XXX is this right for sparc64? it was an unsigned long... XXX */
10typedef unsigned int tcflag_t; 8typedef unsigned int tcflag_t;
11 9
12#define NCC 8 10#define NCC 8
@@ -33,6 +31,18 @@ struct termios {
33#endif 31#endif
34}; 32};
35 33
34struct termios2 {
35 tcflag_t c_iflag; /* input mode flags */
36 tcflag_t c_oflag; /* output mode flags */
37 tcflag_t c_cflag; /* control mode flags */
38 tcflag_t c_lflag; /* local mode flags */
39 cc_t c_line; /* line discipline */
40 cc_t c_cc[NCCS]; /* control characters */
41 cc_t _x_cc[2]; /* padding to match ktermios */
42 speed_t c_ispeed; /* input speed */
43 speed_t c_ospeed; /* output speed */
44};
45
36struct ktermios { 46struct ktermios {
37 tcflag_t c_iflag; /* input mode flags */ 47 tcflag_t c_iflag; /* input mode flags */
38 tcflag_t c_oflag; /* output mode flags */ 48 tcflag_t c_oflag; /* output mode flags */
@@ -161,6 +171,7 @@ struct ktermios {
161#define HUPCL 0x00000400 171#define HUPCL 0x00000400
162#define CLOCAL 0x00000800 172#define CLOCAL 0x00000800
163#define CBAUDEX 0x00001000 173#define CBAUDEX 0x00001000
174#define BOTHER 0x00001000
164#define B57600 0x00001001 175#define B57600 0x00001001
165#define B115200 0x00001002 176#define B115200 0x00001002
166#define B230400 0x00001003 177#define B230400 0x00001003
@@ -190,6 +201,8 @@ struct ktermios {
190#define CMSPAR 0x40000000 /* mark or space (stick) parity */ 201#define CMSPAR 0x40000000 /* mark or space (stick) parity */
191#define CRTSCTS 0x80000000 /* flow control */ 202#define CRTSCTS 0x80000000 /* flow control */
192 203
204#define IBSHIFT 16 /* Shift from CBAUD to CIBAUD */
205
193/* c_lflag bits */ 206/* c_lflag bits */
194#define ISIG 0x00000001 207#define ISIG 0x00000001
195#define ICANON 0x00000002 208#define ICANON 0x00000002
diff --git a/include/asm-sparc64/termios.h b/include/asm-sparc64/termios.h
index f05d390993d5..ef527211f8a8 100644
--- a/include/asm-sparc64/termios.h
+++ b/include/asm-sparc64/termios.h
@@ -123,6 +123,8 @@ struct winsize {
123 err |= get_user((k)->c_cc[VMIN], &(u)->c_cc[_VMIN]); \ 123 err |= get_user((k)->c_cc[VMIN], &(u)->c_cc[_VMIN]); \
124 err |= get_user((k)->c_cc[VTIME], &(u)->c_cc[_VTIME]); \ 124 err |= get_user((k)->c_cc[VTIME], &(u)->c_cc[_VTIME]); \
125 } \ 125 } \
126 err |= get_user((k)->c_ispeed, &(u)->c_ispeed); \
127 err |= get_user((k)->c_ospeed, &(u)->c_ospeed); \
126 err; \ 128 err; \
127}) 129})
128 130
@@ -142,6 +144,46 @@ struct winsize {
142 err |= put_user((k)->c_cc[VEOF], &(u)->c_cc[VEOF]); \ 144 err |= put_user((k)->c_cc[VEOF], &(u)->c_cc[VEOF]); \
143 err |= put_user((k)->c_cc[VEOL], &(u)->c_cc[VEOL]); \ 145 err |= put_user((k)->c_cc[VEOL], &(u)->c_cc[VEOL]); \
144 } \ 146 } \
147 err |= put_user((k)->c_ispeed, &(u)->c_ispeed); \
148 err |= put_user((k)->c_ospeed, &(u)->c_ospeed); \
149 err; \
150})
151
152#define user_termios_to_kernel_termios_1(k, u) \
153({ \
154 int err; \
155 err = get_user((k)->c_iflag, &(u)->c_iflag); \
156 err |= get_user((k)->c_oflag, &(u)->c_oflag); \
157 err |= get_user((k)->c_cflag, &(u)->c_cflag); \
158 err |= get_user((k)->c_lflag, &(u)->c_lflag); \
159 err |= get_user((k)->c_line, &(u)->c_line); \
160 err |= copy_from_user((k)->c_cc, (u)->c_cc, NCCS); \
161 if((k)->c_lflag & ICANON) { \
162 err |= get_user((k)->c_cc[VEOF], &(u)->c_cc[VEOF]); \
163 err |= get_user((k)->c_cc[VEOL], &(u)->c_cc[VEOL]); \
164 } else { \
165 err |= get_user((k)->c_cc[VMIN], &(u)->c_cc[_VMIN]); \
166 err |= get_user((k)->c_cc[VTIME], &(u)->c_cc[_VTIME]); \
167 } \
168 err; \
169})
170
171#define kernel_termios_to_user_termios_1(u, k) \
172({ \
173 int err; \
174 err = put_user((k)->c_iflag, &(u)->c_iflag); \
175 err |= put_user((k)->c_oflag, &(u)->c_oflag); \
176 err |= put_user((k)->c_cflag, &(u)->c_cflag); \
177 err |= put_user((k)->c_lflag, &(u)->c_lflag); \
178 err |= put_user((k)->c_line, &(u)->c_line); \
179 err |= copy_to_user((u)->c_cc, (k)->c_cc, NCCS); \
180 if(!((k)->c_lflag & ICANON)) { \
181 err |= put_user((k)->c_cc[VMIN], &(u)->c_cc[_VMIN]); \
182 err |= put_user((k)->c_cc[VTIME], &(u)->c_cc[_VTIME]); \
183 } else { \
184 err |= put_user((k)->c_cc[VEOF], &(u)->c_cc[VEOF]); \
185 err |= put_user((k)->c_cc[VEOL], &(u)->c_cc[VEOL]); \
186 } \
145 err; \ 187 err; \
146}) 188})
147 189
diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h
index 448f70b30a0c..a8efcfeea732 100644
--- a/include/linux/of_platform.h
+++ b/include/linux/of_platform.h
@@ -48,6 +48,10 @@ struct of_platform_driver
48#define to_of_platform_driver(drv) \ 48#define to_of_platform_driver(drv) \
49 container_of(drv,struct of_platform_driver, driver) 49 container_of(drv,struct of_platform_driver, driver)
50 50
51extern int of_register_driver(struct of_platform_driver *drv,
52 struct bus_type *bus);
53extern void of_unregister_driver(struct of_platform_driver *drv);
54
51#include <asm/of_platform.h> 55#include <asm/of_platform.h>
52 56
53extern struct of_device *of_find_device_by_node(struct device_node *np); 57extern struct of_device *of_find_device_by_node(struct device_node *np);