diff options
author | Paul Mackerras <paulus@samba.org> | 2006-08-08 03:09:11 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2006-08-08 03:09:11 -0400 |
commit | 32bc6e095d75233e7c87cc6fa0e07942b124d194 (patch) | |
tree | 8f83ef9a23d52d1305878b65dd98fc22b09b7f3e /drivers/char | |
parent | 5cf13911b1e72707b6f0eb39b2d819ec6e343d76 (diff) | |
parent | 81b73dd92b97423b8f5324a59044da478c04f4c4 (diff) |
Merge branch 'merge'
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/hvsi.c | 8 | ||||
-rw-r--r-- | drivers/char/hw_random/omap-rng.c | 51 | ||||
-rw-r--r-- | drivers/char/keyboard.c | 139 | ||||
-rw-r--r-- | drivers/char/snsc.c | 7 |
4 files changed, 111 insertions, 94 deletions
diff --git a/drivers/char/hvsi.c b/drivers/char/hvsi.c index 9101784ecf02..a89a95fb5e40 100644 --- a/drivers/char/hvsi.c +++ b/drivers/char/hvsi.c | |||
@@ -311,7 +311,8 @@ static void hvsi_recv_control(struct hvsi_struct *hp, uint8_t *packet, | |||
311 | /* CD went away; no more connection */ | 311 | /* CD went away; no more connection */ |
312 | pr_debug("hvsi%i: CD dropped\n", hp->index); | 312 | pr_debug("hvsi%i: CD dropped\n", hp->index); |
313 | hp->mctrl &= TIOCM_CD; | 313 | hp->mctrl &= TIOCM_CD; |
314 | if (!(hp->tty->flags & CLOCAL)) | 314 | /* If userland hasn't done an open(2) yet, hp->tty is NULL. */ |
315 | if (hp->tty && !(hp->tty->flags & CLOCAL)) | ||
315 | *to_hangup = hp->tty; | 316 | *to_hangup = hp->tty; |
316 | } | 317 | } |
317 | break; | 318 | break; |
@@ -986,10 +987,7 @@ static void hvsi_write_worker(void *arg) | |||
986 | start_j = 0; | 987 | start_j = 0; |
987 | #endif /* DEBUG */ | 988 | #endif /* DEBUG */ |
988 | wake_up_all(&hp->emptyq); | 989 | wake_up_all(&hp->emptyq); |
989 | if (test_bit(TTY_DO_WRITE_WAKEUP, &hp->tty->flags) | 990 | tty_wakeup(hp->tty); |
990 | && hp->tty->ldisc.write_wakeup) | ||
991 | hp->tty->ldisc.write_wakeup(hp->tty); | ||
992 | wake_up_interruptible(&hp->tty->write_wait); | ||
993 | } | 991 | } |
994 | 992 | ||
995 | out: | 993 | out: |
diff --git a/drivers/char/hw_random/omap-rng.c b/drivers/char/hw_random/omap-rng.c index 819516b35a79..a01d796d1eeb 100644 --- a/drivers/char/hw_random/omap-rng.c +++ b/drivers/char/hw_random/omap-rng.c | |||
@@ -25,12 +25,12 @@ | |||
25 | #include <linux/module.h> | 25 | #include <linux/module.h> |
26 | #include <linux/init.h> | 26 | #include <linux/init.h> |
27 | #include <linux/random.h> | 27 | #include <linux/random.h> |
28 | #include <linux/clk.h> | ||
28 | #include <linux/err.h> | 29 | #include <linux/err.h> |
29 | #include <linux/device.h> | 30 | #include <linux/platform_device.h> |
30 | #include <linux/hw_random.h> | 31 | #include <linux/hw_random.h> |
31 | 32 | ||
32 | #include <asm/io.h> | 33 | #include <asm/io.h> |
33 | #include <asm/hardware/clock.h> | ||
34 | 34 | ||
35 | #define RNG_OUT_REG 0x00 /* Output register */ | 35 | #define RNG_OUT_REG 0x00 /* Output register */ |
36 | #define RNG_STAT_REG 0x04 /* Status register | 36 | #define RNG_STAT_REG 0x04 /* Status register |
@@ -52,7 +52,7 @@ | |||
52 | 52 | ||
53 | static void __iomem *rng_base; | 53 | static void __iomem *rng_base; |
54 | static struct clk *rng_ick; | 54 | static struct clk *rng_ick; |
55 | static struct device *rng_dev; | 55 | static struct platform_device *rng_dev; |
56 | 56 | ||
57 | static u32 omap_rng_read_reg(int reg) | 57 | static u32 omap_rng_read_reg(int reg) |
58 | { | 58 | { |
@@ -83,9 +83,8 @@ static struct hwrng omap_rng_ops = { | |||
83 | .data_read = omap_rng_data_read, | 83 | .data_read = omap_rng_data_read, |
84 | }; | 84 | }; |
85 | 85 | ||
86 | static int __init omap_rng_probe(struct device *dev) | 86 | static int __init omap_rng_probe(struct platform_device *pdev) |
87 | { | 87 | { |
88 | struct platform_device *pdev = to_platform_device(dev); | ||
89 | struct resource *res, *mem; | 88 | struct resource *res, *mem; |
90 | int ret; | 89 | int ret; |
91 | 90 | ||
@@ -95,16 +94,14 @@ static int __init omap_rng_probe(struct device *dev) | |||
95 | */ | 94 | */ |
96 | BUG_ON(rng_dev); | 95 | BUG_ON(rng_dev); |
97 | 96 | ||
98 | if (cpu_is_omap24xx()) { | 97 | if (cpu_is_omap24xx()) { |
99 | rng_ick = clk_get(NULL, "rng_ick"); | 98 | rng_ick = clk_get(NULL, "rng_ick"); |
100 | if (IS_ERR(rng_ick)) { | 99 | if (IS_ERR(rng_ick)) { |
101 | dev_err(dev, "Could not get rng_ick\n"); | 100 | dev_err(&pdev->dev, "Could not get rng_ick\n"); |
102 | ret = PTR_ERR(rng_ick); | 101 | ret = PTR_ERR(rng_ick); |
103 | return ret; | 102 | return ret; |
104 | } | 103 | } else |
105 | else { | 104 | clk_enable(rng_ick); |
106 | clk_use(rng_ick); | ||
107 | } | ||
108 | } | 105 | } |
109 | 106 | ||
110 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 107 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
@@ -117,7 +114,7 @@ static int __init omap_rng_probe(struct device *dev) | |||
117 | if (mem == NULL) | 114 | if (mem == NULL) |
118 | return -EBUSY; | 115 | return -EBUSY; |
119 | 116 | ||
120 | dev_set_drvdata(dev, mem); | 117 | dev_set_drvdata(&pdev->dev, mem); |
121 | rng_base = (u32 __iomem *)io_p2v(res->start); | 118 | rng_base = (u32 __iomem *)io_p2v(res->start); |
122 | 119 | ||
123 | ret = hwrng_register(&omap_rng_ops); | 120 | ret = hwrng_register(&omap_rng_ops); |
@@ -127,25 +124,25 @@ static int __init omap_rng_probe(struct device *dev) | |||
127 | return ret; | 124 | return ret; |
128 | } | 125 | } |
129 | 126 | ||
130 | dev_info(dev, "OMAP Random Number Generator ver. %02x\n", | 127 | dev_info(&pdev->dev, "OMAP Random Number Generator ver. %02x\n", |
131 | omap_rng_read_reg(RNG_REV_REG)); | 128 | omap_rng_read_reg(RNG_REV_REG)); |
132 | omap_rng_write_reg(RNG_MASK_REG, 0x1); | 129 | omap_rng_write_reg(RNG_MASK_REG, 0x1); |
133 | 130 | ||
134 | rng_dev = dev; | 131 | rng_dev = pdev; |
135 | 132 | ||
136 | return 0; | 133 | return 0; |
137 | } | 134 | } |
138 | 135 | ||
139 | static int __exit omap_rng_remove(struct device *dev) | 136 | static int __exit omap_rng_remove(struct platform_device *pdev) |
140 | { | 137 | { |
141 | struct resource *mem = dev_get_drvdata(dev); | 138 | struct resource *mem = dev_get_drvdata(&pdev->dev); |
142 | 139 | ||
143 | hwrng_unregister(&omap_rng_ops); | 140 | hwrng_unregister(&omap_rng_ops); |
144 | 141 | ||
145 | omap_rng_write_reg(RNG_MASK_REG, 0x0); | 142 | omap_rng_write_reg(RNG_MASK_REG, 0x0); |
146 | 143 | ||
147 | if (cpu_is_omap24xx()) { | 144 | if (cpu_is_omap24xx()) { |
148 | clk_unuse(rng_ick); | 145 | clk_disable(rng_ick); |
149 | clk_put(rng_ick); | 146 | clk_put(rng_ick); |
150 | } | 147 | } |
151 | 148 | ||
@@ -157,18 +154,16 @@ static int __exit omap_rng_remove(struct device *dev) | |||
157 | 154 | ||
158 | #ifdef CONFIG_PM | 155 | #ifdef CONFIG_PM |
159 | 156 | ||
160 | static int omap_rng_suspend(struct device *dev, pm_message_t message, u32 level) | 157 | static int omap_rng_suspend(struct platform_device *pdev, pm_message_t message) |
161 | { | 158 | { |
162 | omap_rng_write_reg(RNG_MASK_REG, 0x0); | 159 | omap_rng_write_reg(RNG_MASK_REG, 0x0); |
163 | |||
164 | return 0; | 160 | return 0; |
165 | } | 161 | } |
166 | 162 | ||
167 | static int omap_rng_resume(struct device *dev, pm_message_t message, u32 level) | 163 | static int omap_rng_resume(struct platform_device *pdev) |
168 | { | 164 | { |
169 | omap_rng_write_reg(RNG_MASK_REG, 0x1); | 165 | omap_rng_write_reg(RNG_MASK_REG, 0x1); |
170 | 166 | return 0; | |
171 | return 1; | ||
172 | } | 167 | } |
173 | 168 | ||
174 | #else | 169 | #else |
@@ -179,9 +174,11 @@ static int omap_rng_resume(struct device *dev, pm_message_t message, u32 level) | |||
179 | #endif | 174 | #endif |
180 | 175 | ||
181 | 176 | ||
182 | static struct device_driver omap_rng_driver = { | 177 | static struct platform_driver omap_rng_driver = { |
183 | .name = "omap_rng", | 178 | .driver = { |
184 | .bus = &platform_bus_type, | 179 | .name = "omap_rng", |
180 | .owner = THIS_MODULE, | ||
181 | }, | ||
185 | .probe = omap_rng_probe, | 182 | .probe = omap_rng_probe, |
186 | .remove = __exit_p(omap_rng_remove), | 183 | .remove = __exit_p(omap_rng_remove), |
187 | .suspend = omap_rng_suspend, | 184 | .suspend = omap_rng_suspend, |
@@ -193,12 +190,12 @@ static int __init omap_rng_init(void) | |||
193 | if (!cpu_is_omap16xx() && !cpu_is_omap24xx()) | 190 | if (!cpu_is_omap16xx() && !cpu_is_omap24xx()) |
194 | return -ENODEV; | 191 | return -ENODEV; |
195 | 192 | ||
196 | return driver_register(&omap_rng_driver); | 193 | return platform_driver_register(&omap_rng_driver); |
197 | } | 194 | } |
198 | 195 | ||
199 | static void __exit omap_rng_exit(void) | 196 | static void __exit omap_rng_exit(void) |
200 | { | 197 | { |
201 | driver_unregister(&omap_rng_driver); | 198 | platform_driver_unregister(&omap_rng_driver); |
202 | } | 199 | } |
203 | 200 | ||
204 | module_init(omap_rng_init); | 201 | module_init(omap_rng_init); |
diff --git a/drivers/char/keyboard.c b/drivers/char/keyboard.c index 056ebe84b81d..3e90aac37510 100644 --- a/drivers/char/keyboard.c +++ b/drivers/char/keyboard.c | |||
@@ -107,7 +107,6 @@ const int NR_TYPES = ARRAY_SIZE(max_vals); | |||
107 | 107 | ||
108 | struct kbd_struct kbd_table[MAX_NR_CONSOLES]; | 108 | struct kbd_struct kbd_table[MAX_NR_CONSOLES]; |
109 | static struct kbd_struct *kbd = kbd_table; | 109 | static struct kbd_struct *kbd = kbd_table; |
110 | static struct kbd_struct kbd0; | ||
111 | 110 | ||
112 | int spawnpid, spawnsig; | 111 | int spawnpid, spawnsig; |
113 | 112 | ||
@@ -223,13 +222,13 @@ static void kd_nosound(unsigned long ignored) | |||
223 | { | 222 | { |
224 | struct list_head *node; | 223 | struct list_head *node; |
225 | 224 | ||
226 | list_for_each(node,&kbd_handler.h_list) { | 225 | list_for_each(node, &kbd_handler.h_list) { |
227 | struct input_handle *handle = to_handle_h(node); | 226 | struct input_handle *handle = to_handle_h(node); |
228 | if (test_bit(EV_SND, handle->dev->evbit)) { | 227 | if (test_bit(EV_SND, handle->dev->evbit)) { |
229 | if (test_bit(SND_TONE, handle->dev->sndbit)) | 228 | if (test_bit(SND_TONE, handle->dev->sndbit)) |
230 | input_event(handle->dev, EV_SND, SND_TONE, 0); | 229 | input_inject_event(handle, EV_SND, SND_TONE, 0); |
231 | if (test_bit(SND_BELL, handle->dev->sndbit)) | 230 | if (test_bit(SND_BELL, handle->dev->sndbit)) |
232 | input_event(handle->dev, EV_SND, SND_BELL, 0); | 231 | input_inject_event(handle, EV_SND, SND_BELL, 0); |
233 | } | 232 | } |
234 | } | 233 | } |
235 | } | 234 | } |
@@ -247,11 +246,11 @@ void kd_mksound(unsigned int hz, unsigned int ticks) | |||
247 | struct input_handle *handle = to_handle_h(node); | 246 | struct input_handle *handle = to_handle_h(node); |
248 | if (test_bit(EV_SND, handle->dev->evbit)) { | 247 | if (test_bit(EV_SND, handle->dev->evbit)) { |
249 | if (test_bit(SND_TONE, handle->dev->sndbit)) { | 248 | if (test_bit(SND_TONE, handle->dev->sndbit)) { |
250 | input_event(handle->dev, EV_SND, SND_TONE, hz); | 249 | input_inject_event(handle, EV_SND, SND_TONE, hz); |
251 | break; | 250 | break; |
252 | } | 251 | } |
253 | if (test_bit(SND_BELL, handle->dev->sndbit)) { | 252 | if (test_bit(SND_BELL, handle->dev->sndbit)) { |
254 | input_event(handle->dev, EV_SND, SND_BELL, 1); | 253 | input_inject_event(handle, EV_SND, SND_BELL, 1); |
255 | break; | 254 | break; |
256 | } | 255 | } |
257 | } | 256 | } |
@@ -272,15 +271,15 @@ int kbd_rate(struct kbd_repeat *rep) | |||
272 | unsigned int d = 0; | 271 | unsigned int d = 0; |
273 | unsigned int p = 0; | 272 | unsigned int p = 0; |
274 | 273 | ||
275 | list_for_each(node,&kbd_handler.h_list) { | 274 | list_for_each(node, &kbd_handler.h_list) { |
276 | struct input_handle *handle = to_handle_h(node); | 275 | struct input_handle *handle = to_handle_h(node); |
277 | struct input_dev *dev = handle->dev; | 276 | struct input_dev *dev = handle->dev; |
278 | 277 | ||
279 | if (test_bit(EV_REP, dev->evbit)) { | 278 | if (test_bit(EV_REP, dev->evbit)) { |
280 | if (rep->delay > 0) | 279 | if (rep->delay > 0) |
281 | input_event(dev, EV_REP, REP_DELAY, rep->delay); | 280 | input_inject_event(handle, EV_REP, REP_DELAY, rep->delay); |
282 | if (rep->period > 0) | 281 | if (rep->period > 0) |
283 | input_event(dev, EV_REP, REP_PERIOD, rep->period); | 282 | input_inject_event(handle, EV_REP, REP_PERIOD, rep->period); |
284 | d = dev->rep[REP_DELAY]; | 283 | d = dev->rep[REP_DELAY]; |
285 | p = dev->rep[REP_PERIOD]; | 284 | p = dev->rep[REP_PERIOD]; |
286 | } | 285 | } |
@@ -988,7 +987,7 @@ static inline unsigned char getleds(void) | |||
988 | * interrupt routines for this thing allows us to easily mask | 987 | * interrupt routines for this thing allows us to easily mask |
989 | * this when we don't want any of the above to happen. | 988 | * this when we don't want any of the above to happen. |
990 | * This allows for easy and efficient race-condition prevention | 989 | * This allows for easy and efficient race-condition prevention |
991 | * for kbd_refresh_leds => input_event(dev, EV_LED, ...) => ... | 990 | * for kbd_start => input_inject_event(dev, EV_LED, ...) => ... |
992 | */ | 991 | */ |
993 | 992 | ||
994 | static void kbd_bh(unsigned long dummy) | 993 | static void kbd_bh(unsigned long dummy) |
@@ -998,11 +997,11 @@ static void kbd_bh(unsigned long dummy) | |||
998 | 997 | ||
999 | if (leds != ledstate) { | 998 | if (leds != ledstate) { |
1000 | list_for_each(node, &kbd_handler.h_list) { | 999 | list_for_each(node, &kbd_handler.h_list) { |
1001 | struct input_handle * handle = to_handle_h(node); | 1000 | struct input_handle *handle = to_handle_h(node); |
1002 | input_event(handle->dev, EV_LED, LED_SCROLLL, !!(leds & 0x01)); | 1001 | input_inject_event(handle, EV_LED, LED_SCROLLL, !!(leds & 0x01)); |
1003 | input_event(handle->dev, EV_LED, LED_NUML, !!(leds & 0x02)); | 1002 | input_inject_event(handle, EV_LED, LED_NUML, !!(leds & 0x02)); |
1004 | input_event(handle->dev, EV_LED, LED_CAPSL, !!(leds & 0x04)); | 1003 | input_inject_event(handle, EV_LED, LED_CAPSL, !!(leds & 0x04)); |
1005 | input_sync(handle->dev); | 1004 | input_inject_event(handle, EV_SYN, SYN_REPORT, 0); |
1006 | } | 1005 | } |
1007 | } | 1006 | } |
1008 | 1007 | ||
@@ -1011,23 +1010,6 @@ static void kbd_bh(unsigned long dummy) | |||
1011 | 1010 | ||
1012 | DECLARE_TASKLET_DISABLED(keyboard_tasklet, kbd_bh, 0); | 1011 | DECLARE_TASKLET_DISABLED(keyboard_tasklet, kbd_bh, 0); |
1013 | 1012 | ||
1014 | /* | ||
1015 | * This allows a newly plugged keyboard to pick the LED state. | ||
1016 | */ | ||
1017 | static void kbd_refresh_leds(struct input_handle *handle) | ||
1018 | { | ||
1019 | unsigned char leds = ledstate; | ||
1020 | |||
1021 | tasklet_disable(&keyboard_tasklet); | ||
1022 | if (leds != 0xff) { | ||
1023 | input_event(handle->dev, EV_LED, LED_SCROLLL, !!(leds & 0x01)); | ||
1024 | input_event(handle->dev, EV_LED, LED_NUML, !!(leds & 0x02)); | ||
1025 | input_event(handle->dev, EV_LED, LED_CAPSL, !!(leds & 0x04)); | ||
1026 | input_sync(handle->dev); | ||
1027 | } | ||
1028 | tasklet_enable(&keyboard_tasklet); | ||
1029 | } | ||
1030 | |||
1031 | #if defined(CONFIG_X86) || defined(CONFIG_IA64) || defined(CONFIG_ALPHA) ||\ | 1013 | #if defined(CONFIG_X86) || defined(CONFIG_IA64) || defined(CONFIG_ALPHA) ||\ |
1032 | defined(CONFIG_MIPS) || defined(CONFIG_PPC) || defined(CONFIG_SPARC) ||\ | 1014 | defined(CONFIG_MIPS) || defined(CONFIG_PPC) || defined(CONFIG_SPARC) ||\ |
1033 | defined(CONFIG_PARISC) || defined(CONFIG_SUPERH) ||\ | 1015 | defined(CONFIG_PARISC) || defined(CONFIG_SUPERH) ||\ |
@@ -1043,7 +1025,7 @@ static const unsigned short x86_keycodes[256] = | |||
1043 | 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, | 1025 | 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, |
1044 | 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, | 1026 | 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, |
1045 | 80, 81, 82, 83, 84,118, 86, 87, 88,115,120,119,121,112,123, 92, | 1027 | 80, 81, 82, 83, 84,118, 86, 87, 88,115,120,119,121,112,123, 92, |
1046 | 284,285,309,298,312, 91,327,328,329,331,333,335,336,337,338,339, | 1028 | 284,285,309, 0,312, 91,327,328,329,331,333,335,336,337,338,339, |
1047 | 367,288,302,304,350, 89,334,326,267,126,268,269,125,347,348,349, | 1029 | 367,288,302,304,350, 89,334,326,267,126,268,269,125,347,348,349, |
1048 | 360,261,262,263,268,376,100,101,321,316,373,286,289,102,351,355, | 1030 | 360,261,262,263,268,376,100,101,321,316,373,286,289,102,351,355, |
1049 | 103,104,105,275,287,279,306,106,274,107,294,364,358,363,362,361, | 1031 | 103,104,105,275,287,279,306,106,274,107,294,364,358,363,362,361, |
@@ -1065,38 +1047,55 @@ extern void sun_do_break(void); | |||
1065 | static int emulate_raw(struct vc_data *vc, unsigned int keycode, | 1047 | static int emulate_raw(struct vc_data *vc, unsigned int keycode, |
1066 | unsigned char up_flag) | 1048 | unsigned char up_flag) |
1067 | { | 1049 | { |
1068 | if (keycode > 255 || !x86_keycodes[keycode]) | 1050 | int code; |
1069 | return -1; | ||
1070 | 1051 | ||
1071 | switch (keycode) { | 1052 | switch (keycode) { |
1072 | case KEY_PAUSE: | 1053 | case KEY_PAUSE: |
1073 | put_queue(vc, 0xe1); | 1054 | put_queue(vc, 0xe1); |
1074 | put_queue(vc, 0x1d | up_flag); | 1055 | put_queue(vc, 0x1d | up_flag); |
1075 | put_queue(vc, 0x45 | up_flag); | 1056 | put_queue(vc, 0x45 | up_flag); |
1076 | return 0; | 1057 | break; |
1058 | |||
1077 | case KEY_HANGEUL: | 1059 | case KEY_HANGEUL: |
1078 | if (!up_flag) | 1060 | if (!up_flag) |
1079 | put_queue(vc, 0xf2); | 1061 | put_queue(vc, 0xf2); |
1080 | return 0; | 1062 | break; |
1063 | |||
1081 | case KEY_HANJA: | 1064 | case KEY_HANJA: |
1082 | if (!up_flag) | 1065 | if (!up_flag) |
1083 | put_queue(vc, 0xf1); | 1066 | put_queue(vc, 0xf1); |
1084 | return 0; | 1067 | break; |
1085 | } | ||
1086 | 1068 | ||
1087 | if (keycode == KEY_SYSRQ && sysrq_alt) { | 1069 | case KEY_SYSRQ: |
1088 | put_queue(vc, 0x54 | up_flag); | 1070 | /* |
1089 | return 0; | 1071 | * Real AT keyboards (that's what we're trying |
1090 | } | 1072 | * to emulate here emit 0xe0 0x2a 0xe0 0x37 when |
1073 | * pressing PrtSc/SysRq alone, but simply 0x54 | ||
1074 | * when pressing Alt+PrtSc/SysRq. | ||
1075 | */ | ||
1076 | if (sysrq_alt) { | ||
1077 | put_queue(vc, 0x54 | up_flag); | ||
1078 | } else { | ||
1079 | put_queue(vc, 0xe0); | ||
1080 | put_queue(vc, 0x2a | up_flag); | ||
1081 | put_queue(vc, 0xe0); | ||
1082 | put_queue(vc, 0x37 | up_flag); | ||
1083 | } | ||
1084 | break; | ||
1085 | |||
1086 | default: | ||
1087 | if (keycode > 255) | ||
1088 | return -1; | ||
1091 | 1089 | ||
1092 | if (x86_keycodes[keycode] & 0x100) | 1090 | code = x86_keycodes[keycode]; |
1093 | put_queue(vc, 0xe0); | 1091 | if (!code) |
1092 | return -1; | ||
1094 | 1093 | ||
1095 | put_queue(vc, (x86_keycodes[keycode] & 0x7f) | up_flag); | 1094 | if (code & 0x100) |
1095 | put_queue(vc, 0xe0); | ||
1096 | put_queue(vc, (code & 0x7f) | up_flag); | ||
1096 | 1097 | ||
1097 | if (keycode == KEY_SYSRQ) { | 1098 | break; |
1098 | put_queue(vc, 0xe0); | ||
1099 | put_queue(vc, 0x37 | up_flag); | ||
1100 | } | 1099 | } |
1101 | 1100 | ||
1102 | return 0; | 1101 | return 0; |
@@ -1298,16 +1297,15 @@ static struct input_handle *kbd_connect(struct input_handler *handler, | |||
1298 | if (i == BTN_MISC && !test_bit(EV_SND, dev->evbit)) | 1297 | if (i == BTN_MISC && !test_bit(EV_SND, dev->evbit)) |
1299 | return NULL; | 1298 | return NULL; |
1300 | 1299 | ||
1301 | if (!(handle = kmalloc(sizeof(struct input_handle), GFP_KERNEL))) | 1300 | handle = kzalloc(sizeof(struct input_handle), GFP_KERNEL); |
1301 | if (!handle) | ||
1302 | return NULL; | 1302 | return NULL; |
1303 | memset(handle, 0, sizeof(struct input_handle)); | ||
1304 | 1303 | ||
1305 | handle->dev = dev; | 1304 | handle->dev = dev; |
1306 | handle->handler = handler; | 1305 | handle->handler = handler; |
1307 | handle->name = "kbd"; | 1306 | handle->name = "kbd"; |
1308 | 1307 | ||
1309 | input_open_device(handle); | 1308 | input_open_device(handle); |
1310 | kbd_refresh_leds(handle); | ||
1311 | 1309 | ||
1312 | return handle; | 1310 | return handle; |
1313 | } | 1311 | } |
@@ -1318,6 +1316,24 @@ static void kbd_disconnect(struct input_handle *handle) | |||
1318 | kfree(handle); | 1316 | kfree(handle); |
1319 | } | 1317 | } |
1320 | 1318 | ||
1319 | /* | ||
1320 | * Start keyboard handler on the new keyboard by refreshing LED state to | ||
1321 | * match the rest of the system. | ||
1322 | */ | ||
1323 | static void kbd_start(struct input_handle *handle) | ||
1324 | { | ||
1325 | unsigned char leds = ledstate; | ||
1326 | |||
1327 | tasklet_disable(&keyboard_tasklet); | ||
1328 | if (leds != 0xff) { | ||
1329 | input_inject_event(handle, EV_LED, LED_SCROLLL, !!(leds & 0x01)); | ||
1330 | input_inject_event(handle, EV_LED, LED_NUML, !!(leds & 0x02)); | ||
1331 | input_inject_event(handle, EV_LED, LED_CAPSL, !!(leds & 0x04)); | ||
1332 | input_inject_event(handle, EV_SYN, SYN_REPORT, 0); | ||
1333 | } | ||
1334 | tasklet_enable(&keyboard_tasklet); | ||
1335 | } | ||
1336 | |||
1321 | static struct input_device_id kbd_ids[] = { | 1337 | static struct input_device_id kbd_ids[] = { |
1322 | { | 1338 | { |
1323 | .flags = INPUT_DEVICE_ID_MATCH_EVBIT, | 1339 | .flags = INPUT_DEVICE_ID_MATCH_EVBIT, |
@@ -1338,6 +1354,7 @@ static struct input_handler kbd_handler = { | |||
1338 | .event = kbd_event, | 1354 | .event = kbd_event, |
1339 | .connect = kbd_connect, | 1355 | .connect = kbd_connect, |
1340 | .disconnect = kbd_disconnect, | 1356 | .disconnect = kbd_disconnect, |
1357 | .start = kbd_start, | ||
1341 | .name = "kbd", | 1358 | .name = "kbd", |
1342 | .id_table = kbd_ids, | 1359 | .id_table = kbd_ids, |
1343 | }; | 1360 | }; |
@@ -1346,15 +1363,15 @@ int __init kbd_init(void) | |||
1346 | { | 1363 | { |
1347 | int i; | 1364 | int i; |
1348 | 1365 | ||
1349 | kbd0.ledflagstate = kbd0.default_ledflagstate = KBD_DEFLEDS; | 1366 | for (i = 0; i < MAX_NR_CONSOLES; i++) { |
1350 | kbd0.ledmode = LED_SHOW_FLAGS; | 1367 | kbd_table[i].ledflagstate = KBD_DEFLEDS; |
1351 | kbd0.lockstate = KBD_DEFLOCK; | 1368 | kbd_table[i].default_ledflagstate = KBD_DEFLEDS; |
1352 | kbd0.slockstate = 0; | 1369 | kbd_table[i].ledmode = LED_SHOW_FLAGS; |
1353 | kbd0.modeflags = KBD_DEFMODE; | 1370 | kbd_table[i].lockstate = KBD_DEFLOCK; |
1354 | kbd0.kbdmode = VC_XLATE; | 1371 | kbd_table[i].slockstate = 0; |
1355 | 1372 | kbd_table[i].modeflags = KBD_DEFMODE; | |
1356 | for (i = 0 ; i < MAX_NR_CONSOLES ; i++) | 1373 | kbd_table[i].kbdmode = VC_XLATE; |
1357 | kbd_table[i] = kbd0; | 1374 | } |
1358 | 1375 | ||
1359 | input_register_handler(&kbd_handler); | 1376 | input_register_handler(&kbd_handler); |
1360 | 1377 | ||
diff --git a/drivers/char/snsc.c b/drivers/char/snsc.c index afc6eda602f7..07e0b75f2338 100644 --- a/drivers/char/snsc.c +++ b/drivers/char/snsc.c | |||
@@ -374,7 +374,12 @@ scdrv_init(void) | |||
374 | struct sysctl_data_s *scd; | 374 | struct sysctl_data_s *scd; |
375 | void *salbuf; | 375 | void *salbuf; |
376 | dev_t first_dev, dev; | 376 | dev_t first_dev, dev; |
377 | nasid_t event_nasid = ia64_sn_get_console_nasid(); | 377 | nasid_t event_nasid; |
378 | |||
379 | if (!ia64_platform_is("sn2")) | ||
380 | return -ENODEV; | ||
381 | |||
382 | event_nasid = ia64_sn_get_console_nasid(); | ||
378 | 383 | ||
379 | if (alloc_chrdev_region(&first_dev, 0, num_cnodes, | 384 | if (alloc_chrdev_region(&first_dev, 0, num_cnodes, |
380 | SYSCTL_BASENAME) < 0) { | 385 | SYSCTL_BASENAME) < 0) { |