diff options
author | Jeff Garzik <jeff@garzik.org> | 2006-08-07 06:43:17 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2006-08-07 06:43:17 -0400 |
commit | 38ebb1e0ed214efe124534eba4a34e869a0d8da7 (patch) | |
tree | 3712611527654e81109d194d903401c86763e3f4 /drivers | |
parent | 236a686b56428a8967a057a2396f9be74e2ee652 (diff) | |
parent | 9f737633e6ee54fc174282d49b2559bd2208391d (diff) |
Merge branch 'master' into upstream
Diffstat (limited to 'drivers')
28 files changed, 604 insertions, 390 deletions
diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c index 81e970adeab3..b0d4b147b19e 100644 --- a/drivers/acpi/acpi_memhotplug.c +++ b/drivers/acpi/acpi_memhotplug.c | |||
@@ -129,11 +129,15 @@ acpi_memory_get_device_resources(struct acpi_memory_device *mem_device) | |||
129 | struct acpi_memory_info *info, *n; | 129 | struct acpi_memory_info *info, *n; |
130 | 130 | ||
131 | 131 | ||
132 | if (!list_empty(&mem_device->res_list)) | ||
133 | return 0; | ||
134 | |||
132 | status = acpi_walk_resources(mem_device->device->handle, METHOD_NAME__CRS, | 135 | status = acpi_walk_resources(mem_device->device->handle, METHOD_NAME__CRS, |
133 | acpi_memory_get_resource, mem_device); | 136 | acpi_memory_get_resource, mem_device); |
134 | if (ACPI_FAILURE(status)) { | 137 | if (ACPI_FAILURE(status)) { |
135 | list_for_each_entry_safe(info, n, &mem_device->res_list, list) | 138 | list_for_each_entry_safe(info, n, &mem_device->res_list, list) |
136 | kfree(info); | 139 | kfree(info); |
140 | INIT_LIST_HEAD(&mem_device->res_list); | ||
137 | return -EINVAL; | 141 | return -EINVAL; |
138 | } | 142 | } |
139 | 143 | ||
@@ -230,17 +234,10 @@ static int acpi_memory_enable_device(struct acpi_memory_device *mem_device) | |||
230 | * (i.e. memory-hot-remove function) | 234 | * (i.e. memory-hot-remove function) |
231 | */ | 235 | */ |
232 | list_for_each_entry(info, &mem_device->res_list, list) { | 236 | list_for_each_entry(info, &mem_device->res_list, list) { |
233 | u64 start_pfn, end_pfn; | 237 | if (info->enabled) { /* just sanity check...*/ |
234 | |||
235 | start_pfn = info->start_addr >> PAGE_SHIFT; | ||
236 | end_pfn = (info->start_addr + info->length - 1) >> PAGE_SHIFT; | ||
237 | |||
238 | if (pfn_valid(start_pfn) || pfn_valid(end_pfn)) { | ||
239 | /* already enabled. try next area */ | ||
240 | num_enabled++; | 238 | num_enabled++; |
241 | continue; | 239 | continue; |
242 | } | 240 | } |
243 | |||
244 | result = add_memory(node, info->start_addr, info->length); | 241 | result = add_memory(node, info->start_addr, info->length); |
245 | if (result) | 242 | if (result) |
246 | continue; | 243 | continue; |
diff --git a/drivers/char/hvsi.c b/drivers/char/hvsi.c index 41db8060e8f7..017f755632a3 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/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index bc1088d9b379..b3df613ae4ec 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
@@ -284,39 +284,69 @@ EXPORT_SYMBOL_GPL(cpufreq_notify_transition); | |||
284 | * SYSFS INTERFACE * | 284 | * SYSFS INTERFACE * |
285 | *********************************************************************/ | 285 | *********************************************************************/ |
286 | 286 | ||
287 | static struct cpufreq_governor *__find_governor(const char *str_governor) | ||
288 | { | ||
289 | struct cpufreq_governor *t; | ||
290 | |||
291 | list_for_each_entry(t, &cpufreq_governor_list, governor_list) | ||
292 | if (!strnicmp(str_governor,t->name,CPUFREQ_NAME_LEN)) | ||
293 | return t; | ||
294 | |||
295 | return NULL; | ||
296 | } | ||
297 | |||
287 | /** | 298 | /** |
288 | * cpufreq_parse_governor - parse a governor string | 299 | * cpufreq_parse_governor - parse a governor string |
289 | */ | 300 | */ |
290 | static int cpufreq_parse_governor (char *str_governor, unsigned int *policy, | 301 | static int cpufreq_parse_governor (char *str_governor, unsigned int *policy, |
291 | struct cpufreq_governor **governor) | 302 | struct cpufreq_governor **governor) |
292 | { | 303 | { |
304 | int err = -EINVAL; | ||
305 | |||
293 | if (!cpufreq_driver) | 306 | if (!cpufreq_driver) |
294 | return -EINVAL; | 307 | goto out; |
308 | |||
295 | if (cpufreq_driver->setpolicy) { | 309 | if (cpufreq_driver->setpolicy) { |
296 | if (!strnicmp(str_governor, "performance", CPUFREQ_NAME_LEN)) { | 310 | if (!strnicmp(str_governor, "performance", CPUFREQ_NAME_LEN)) { |
297 | *policy = CPUFREQ_POLICY_PERFORMANCE; | 311 | *policy = CPUFREQ_POLICY_PERFORMANCE; |
298 | return 0; | 312 | err = 0; |
299 | } else if (!strnicmp(str_governor, "powersave", CPUFREQ_NAME_LEN)) { | 313 | } else if (!strnicmp(str_governor, "powersave", CPUFREQ_NAME_LEN)) { |
300 | *policy = CPUFREQ_POLICY_POWERSAVE; | 314 | *policy = CPUFREQ_POLICY_POWERSAVE; |
301 | return 0; | 315 | err = 0; |
302 | } | 316 | } |
303 | return -EINVAL; | 317 | } else if (cpufreq_driver->target) { |
304 | } else { | ||
305 | struct cpufreq_governor *t; | 318 | struct cpufreq_governor *t; |
319 | |||
306 | mutex_lock(&cpufreq_governor_mutex); | 320 | mutex_lock(&cpufreq_governor_mutex); |
307 | if (!cpufreq_driver || !cpufreq_driver->target) | 321 | |
308 | goto out; | 322 | t = __find_governor(str_governor); |
309 | list_for_each_entry(t, &cpufreq_governor_list, governor_list) { | 323 | |
310 | if (!strnicmp(str_governor,t->name,CPUFREQ_NAME_LEN)) { | 324 | if (t == NULL) { |
311 | *governor = t; | 325 | char *name = kasprintf(GFP_KERNEL, "cpufreq_%s", str_governor); |
326 | |||
327 | if (name) { | ||
328 | int ret; | ||
329 | |||
312 | mutex_unlock(&cpufreq_governor_mutex); | 330 | mutex_unlock(&cpufreq_governor_mutex); |
313 | return 0; | 331 | ret = request_module(name); |
332 | mutex_lock(&cpufreq_governor_mutex); | ||
333 | |||
334 | if (ret == 0) | ||
335 | t = __find_governor(str_governor); | ||
314 | } | 336 | } |
337 | |||
338 | kfree(name); | ||
315 | } | 339 | } |
316 | out: | 340 | |
341 | if (t != NULL) { | ||
342 | *governor = t; | ||
343 | err = 0; | ||
344 | } | ||
345 | |||
317 | mutex_unlock(&cpufreq_governor_mutex); | 346 | mutex_unlock(&cpufreq_governor_mutex); |
318 | } | 347 | } |
319 | return -EINVAL; | 348 | out: |
349 | return err; | ||
320 | } | 350 | } |
321 | 351 | ||
322 | 352 | ||
@@ -1265,23 +1295,21 @@ static int __cpufreq_governor(struct cpufreq_policy *policy, unsigned int event) | |||
1265 | 1295 | ||
1266 | int cpufreq_register_governor(struct cpufreq_governor *governor) | 1296 | int cpufreq_register_governor(struct cpufreq_governor *governor) |
1267 | { | 1297 | { |
1268 | struct cpufreq_governor *t; | 1298 | int err; |
1269 | 1299 | ||
1270 | if (!governor) | 1300 | if (!governor) |
1271 | return -EINVAL; | 1301 | return -EINVAL; |
1272 | 1302 | ||
1273 | mutex_lock(&cpufreq_governor_mutex); | 1303 | mutex_lock(&cpufreq_governor_mutex); |
1274 | 1304 | ||
1275 | list_for_each_entry(t, &cpufreq_governor_list, governor_list) { | 1305 | err = -EBUSY; |
1276 | if (!strnicmp(governor->name,t->name,CPUFREQ_NAME_LEN)) { | 1306 | if (__find_governor(governor->name) == NULL) { |
1277 | mutex_unlock(&cpufreq_governor_mutex); | 1307 | err = 0; |
1278 | return -EBUSY; | 1308 | list_add(&governor->governor_list, &cpufreq_governor_list); |
1279 | } | ||
1280 | } | 1309 | } |
1281 | list_add(&governor->governor_list, &cpufreq_governor_list); | ||
1282 | 1310 | ||
1283 | mutex_unlock(&cpufreq_governor_mutex); | 1311 | mutex_unlock(&cpufreq_governor_mutex); |
1284 | return 0; | 1312 | return err; |
1285 | } | 1313 | } |
1286 | EXPORT_SYMBOL_GPL(cpufreq_register_governor); | 1314 | EXPORT_SYMBOL_GPL(cpufreq_register_governor); |
1287 | 1315 | ||
@@ -1343,6 +1371,11 @@ static int __cpufreq_set_policy(struct cpufreq_policy *data, struct cpufreq_poli | |||
1343 | 1371 | ||
1344 | memcpy(&policy->cpuinfo, &data->cpuinfo, sizeof(struct cpufreq_cpuinfo)); | 1372 | memcpy(&policy->cpuinfo, &data->cpuinfo, sizeof(struct cpufreq_cpuinfo)); |
1345 | 1373 | ||
1374 | if (policy->min > data->min && policy->min > policy->max) { | ||
1375 | ret = -EINVAL; | ||
1376 | goto error_out; | ||
1377 | } | ||
1378 | |||
1346 | /* verify the cpu speed can be set within this limit */ | 1379 | /* verify the cpu speed can be set within this limit */ |
1347 | ret = cpufreq_driver->verify(policy); | 1380 | ret = cpufreq_driver->verify(policy); |
1348 | if (ret) | 1381 | if (ret) |
diff --git a/drivers/edac/edac_mc.h b/drivers/edac/edac_mc.h index bf6ab8a8d5ed..a1cfd4e3c97d 100644 --- a/drivers/edac/edac_mc.h +++ b/drivers/edac/edac_mc.h | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/rcupdate.h> | 29 | #include <linux/rcupdate.h> |
30 | #include <linux/completion.h> | 30 | #include <linux/completion.h> |
31 | #include <linux/kobject.h> | 31 | #include <linux/kobject.h> |
32 | #include <linux/platform_device.h> | ||
32 | 33 | ||
33 | #define EDAC_MC_LABEL_LEN 31 | 34 | #define EDAC_MC_LABEL_LEN 31 |
34 | #define MC_PROC_NAME_MAX_LEN 7 | 35 | #define MC_PROC_NAME_MAX_LEN 7 |
diff --git a/drivers/i2c/busses/scx200_acb.c b/drivers/i2c/busses/scx200_acb.c index ced309ff056f..eae9e81be375 100644 --- a/drivers/i2c/busses/scx200_acb.c +++ b/drivers/i2c/busses/scx200_acb.c | |||
@@ -232,7 +232,7 @@ static void scx200_acb_poll(struct scx200_acb_iface *iface) | |||
232 | unsigned long timeout; | 232 | unsigned long timeout; |
233 | 233 | ||
234 | timeout = jiffies + POLL_TIMEOUT; | 234 | timeout = jiffies + POLL_TIMEOUT; |
235 | while (time_before(jiffies, timeout)) { | 235 | while (1) { |
236 | status = inb(ACBST); | 236 | status = inb(ACBST); |
237 | 237 | ||
238 | /* Reset the status register to avoid the hang */ | 238 | /* Reset the status register to avoid the hang */ |
@@ -242,7 +242,10 @@ static void scx200_acb_poll(struct scx200_acb_iface *iface) | |||
242 | scx200_acb_machine(iface, status); | 242 | scx200_acb_machine(iface, status); |
243 | return; | 243 | return; |
244 | } | 244 | } |
245 | yield(); | 245 | if (time_after(jiffies, timeout)) |
246 | break; | ||
247 | cpu_relax(); | ||
248 | cond_resched(); | ||
246 | } | 249 | } |
247 | 250 | ||
248 | dev_err(&iface->adapter.dev, "timeout in state %s\n", | 251 | dev_err(&iface->adapter.dev, "timeout in state %s\n", |
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c index aaa74f293aaf..b08755e2e68f 100644 --- a/drivers/ieee1394/sbp2.c +++ b/drivers/ieee1394/sbp2.c | |||
@@ -2515,6 +2515,9 @@ static int sbp2scsi_slave_configure(struct scsi_device *sdev) | |||
2515 | sdev->skip_ms_page_8 = 1; | 2515 | sdev->skip_ms_page_8 = 1; |
2516 | if (scsi_id->workarounds & SBP2_WORKAROUND_FIX_CAPACITY) | 2516 | if (scsi_id->workarounds & SBP2_WORKAROUND_FIX_CAPACITY) |
2517 | sdev->fix_capacity = 1; | 2517 | sdev->fix_capacity = 1; |
2518 | if (scsi_id->ne->guid_vendor_id == 0x0010b9 && /* Maxtor's OUI */ | ||
2519 | (sdev->type == TYPE_DISK || sdev->type == TYPE_RBC)) | ||
2520 | sdev->allow_restart = 1; | ||
2518 | return 0; | 2521 | return 0; |
2519 | } | 2522 | } |
2520 | 2523 | ||
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c index a29d5ceb00cf..4bf48188cc91 100644 --- a/drivers/input/evdev.c +++ b/drivers/input/evdev.c | |||
@@ -127,14 +127,10 @@ static int evdev_open(struct inode * inode, struct file * file) | |||
127 | { | 127 | { |
128 | struct evdev_list *list; | 128 | struct evdev_list *list; |
129 | int i = iminor(inode) - EVDEV_MINOR_BASE; | 129 | int i = iminor(inode) - EVDEV_MINOR_BASE; |
130 | int accept_err; | ||
131 | 130 | ||
132 | if (i >= EVDEV_MINORS || !evdev_table[i] || !evdev_table[i]->exist) | 131 | if (i >= EVDEV_MINORS || !evdev_table[i] || !evdev_table[i]->exist) |
133 | return -ENODEV; | 132 | return -ENODEV; |
134 | 133 | ||
135 | if ((accept_err = input_accept_process(&(evdev_table[i]->handle), file))) | ||
136 | return accept_err; | ||
137 | |||
138 | if (!(list = kzalloc(sizeof(struct evdev_list), GFP_KERNEL))) | 134 | if (!(list = kzalloc(sizeof(struct evdev_list), GFP_KERNEL))) |
139 | return -ENOMEM; | 135 | return -ENOMEM; |
140 | 136 | ||
@@ -260,7 +256,7 @@ static ssize_t evdev_write(struct file * file, const char __user * buffer, size_ | |||
260 | 256 | ||
261 | if (evdev_event_from_user(buffer + retval, &event)) | 257 | if (evdev_event_from_user(buffer + retval, &event)) |
262 | return -EFAULT; | 258 | return -EFAULT; |
263 | input_event(list->evdev->handle.dev, event.type, event.code, event.value); | 259 | input_inject_event(&list->evdev->handle, event.type, event.code, event.value); |
264 | retval += evdev_event_size(); | 260 | retval += evdev_event_size(); |
265 | } | 261 | } |
266 | 262 | ||
@@ -428,8 +424,8 @@ static long evdev_ioctl_handler(struct file *file, unsigned int cmd, | |||
428 | if (get_user(v, ip + 1)) | 424 | if (get_user(v, ip + 1)) |
429 | return -EFAULT; | 425 | return -EFAULT; |
430 | 426 | ||
431 | input_event(dev, EV_REP, REP_DELAY, u); | 427 | input_inject_event(&evdev->handle, EV_REP, REP_DELAY, u); |
432 | input_event(dev, EV_REP, REP_PERIOD, v); | 428 | input_inject_event(&evdev->handle, EV_REP, REP_PERIOD, v); |
433 | 429 | ||
434 | return 0; | 430 | return 0; |
435 | 431 | ||
diff --git a/drivers/input/gameport/fm801-gp.c b/drivers/input/gameport/fm801-gp.c index 47e93daa0fa7..90de5afe03c2 100644 --- a/drivers/input/gameport/fm801-gp.c +++ b/drivers/input/gameport/fm801-gp.c | |||
@@ -106,10 +106,10 @@ static int __devinit fm801_gp_probe(struct pci_dev *pci, const struct pci_device | |||
106 | gp->gameport = port; | 106 | gp->gameport = port; |
107 | gp->res_port = request_region(port->io, 0x10, "FM801 GP"); | 107 | gp->res_port = request_region(port->io, 0x10, "FM801 GP"); |
108 | if (!gp->res_port) { | 108 | if (!gp->res_port) { |
109 | kfree(gp); | ||
110 | gameport_free_port(port); | ||
111 | printk(KERN_DEBUG "fm801-gp: unable to grab region 0x%x-0x%x\n", | 109 | printk(KERN_DEBUG "fm801-gp: unable to grab region 0x%x-0x%x\n", |
112 | port->io, port->io + 0x0f); | 110 | port->io, port->io + 0x0f); |
111 | gameport_free_port(port); | ||
112 | kfree(gp); | ||
113 | return -EBUSY; | 113 | return -EBUSY; |
114 | } | 114 | } |
115 | 115 | ||
diff --git a/drivers/input/gameport/gameport.c b/drivers/input/gameport/gameport.c index 36644bff379d..3f47ae55c6f3 100644 --- a/drivers/input/gameport/gameport.c +++ b/drivers/input/gameport/gameport.c | |||
@@ -53,6 +53,7 @@ static LIST_HEAD(gameport_list); | |||
53 | 53 | ||
54 | static struct bus_type gameport_bus; | 54 | static struct bus_type gameport_bus; |
55 | 55 | ||
56 | static void gameport_add_driver(struct gameport_driver *drv); | ||
56 | static void gameport_add_port(struct gameport *gameport); | 57 | static void gameport_add_port(struct gameport *gameport); |
57 | static void gameport_destroy_port(struct gameport *gameport); | 58 | static void gameport_destroy_port(struct gameport *gameport); |
58 | static void gameport_reconnect_port(struct gameport *gameport); | 59 | static void gameport_reconnect_port(struct gameport *gameport); |
@@ -211,8 +212,14 @@ static void gameport_release_driver(struct gameport *gameport) | |||
211 | 212 | ||
212 | static void gameport_find_driver(struct gameport *gameport) | 213 | static void gameport_find_driver(struct gameport *gameport) |
213 | { | 214 | { |
215 | int error; | ||
216 | |||
214 | down_write(&gameport_bus.subsys.rwsem); | 217 | down_write(&gameport_bus.subsys.rwsem); |
215 | device_attach(&gameport->dev); | 218 | error = device_attach(&gameport->dev); |
219 | if (error < 0) | ||
220 | printk(KERN_WARNING | ||
221 | "gameport: device_attach() failed for %s (%s), error: %d\n", | ||
222 | gameport->phys, gameport->name, error); | ||
216 | up_write(&gameport_bus.subsys.rwsem); | 223 | up_write(&gameport_bus.subsys.rwsem); |
217 | } | 224 | } |
218 | 225 | ||
@@ -316,7 +323,6 @@ static void gameport_remove_duplicate_events(struct gameport_event *event) | |||
316 | spin_unlock_irqrestore(&gameport_event_lock, flags); | 323 | spin_unlock_irqrestore(&gameport_event_lock, flags); |
317 | } | 324 | } |
318 | 325 | ||
319 | |||
320 | static struct gameport_event *gameport_get_event(void) | 326 | static struct gameport_event *gameport_get_event(void) |
321 | { | 327 | { |
322 | struct gameport_event *event; | 328 | struct gameport_event *event; |
@@ -342,7 +348,6 @@ static struct gameport_event *gameport_get_event(void) | |||
342 | static void gameport_handle_event(void) | 348 | static void gameport_handle_event(void) |
343 | { | 349 | { |
344 | struct gameport_event *event; | 350 | struct gameport_event *event; |
345 | struct gameport_driver *gameport_drv; | ||
346 | 351 | ||
347 | mutex_lock(&gameport_mutex); | 352 | mutex_lock(&gameport_mutex); |
348 | 353 | ||
@@ -369,8 +374,7 @@ static void gameport_handle_event(void) | |||
369 | break; | 374 | break; |
370 | 375 | ||
371 | case GAMEPORT_REGISTER_DRIVER: | 376 | case GAMEPORT_REGISTER_DRIVER: |
372 | gameport_drv = event->object; | 377 | gameport_add_driver(event->object); |
373 | driver_register(&gameport_drv->driver); | ||
374 | break; | 378 | break; |
375 | 379 | ||
376 | default: | 380 | default: |
@@ -532,6 +536,7 @@ static void gameport_init_port(struct gameport *gameport) | |||
532 | if (gameport->parent) | 536 | if (gameport->parent) |
533 | gameport->dev.parent = &gameport->parent->dev; | 537 | gameport->dev.parent = &gameport->parent->dev; |
534 | 538 | ||
539 | INIT_LIST_HEAD(&gameport->node); | ||
535 | spin_lock_init(&gameport->timer_lock); | 540 | spin_lock_init(&gameport->timer_lock); |
536 | init_timer(&gameport->poll_timer); | 541 | init_timer(&gameport->poll_timer); |
537 | gameport->poll_timer.function = gameport_run_poll_handler; | 542 | gameport->poll_timer.function = gameport_run_poll_handler; |
@@ -544,6 +549,8 @@ static void gameport_init_port(struct gameport *gameport) | |||
544 | */ | 549 | */ |
545 | static void gameport_add_port(struct gameport *gameport) | 550 | static void gameport_add_port(struct gameport *gameport) |
546 | { | 551 | { |
552 | int error; | ||
553 | |||
547 | if (gameport->parent) | 554 | if (gameport->parent) |
548 | gameport->parent->child = gameport; | 555 | gameport->parent->child = gameport; |
549 | 556 | ||
@@ -558,8 +565,13 @@ static void gameport_add_port(struct gameport *gameport) | |||
558 | printk(KERN_INFO "gameport: %s is %s, speed %dkHz\n", | 565 | printk(KERN_INFO "gameport: %s is %s, speed %dkHz\n", |
559 | gameport->name, gameport->phys, gameport->speed); | 566 | gameport->name, gameport->phys, gameport->speed); |
560 | 567 | ||
561 | device_add(&gameport->dev); | 568 | error = device_add(&gameport->dev); |
562 | gameport->registered = 1; | 569 | if (error) |
570 | printk(KERN_ERR | ||
571 | "gameport: device_add() failed for %s (%s), error: %d\n", | ||
572 | gameport->phys, gameport->name, error); | ||
573 | else | ||
574 | gameport->registered = 1; | ||
563 | } | 575 | } |
564 | 576 | ||
565 | /* | 577 | /* |
@@ -583,10 +595,11 @@ static void gameport_destroy_port(struct gameport *gameport) | |||
583 | 595 | ||
584 | if (gameport->registered) { | 596 | if (gameport->registered) { |
585 | device_del(&gameport->dev); | 597 | device_del(&gameport->dev); |
586 | list_del_init(&gameport->node); | ||
587 | gameport->registered = 0; | 598 | gameport->registered = 0; |
588 | } | 599 | } |
589 | 600 | ||
601 | list_del_init(&gameport->node); | ||
602 | |||
590 | gameport_remove_pending_events(gameport); | 603 | gameport_remove_pending_events(gameport); |
591 | put_device(&gameport->dev); | 604 | put_device(&gameport->dev); |
592 | } | 605 | } |
@@ -704,11 +717,22 @@ static int gameport_driver_remove(struct device *dev) | |||
704 | } | 717 | } |
705 | 718 | ||
706 | static struct bus_type gameport_bus = { | 719 | static struct bus_type gameport_bus = { |
707 | .name = "gameport", | 720 | .name = "gameport", |
708 | .probe = gameport_driver_probe, | 721 | .probe = gameport_driver_probe, |
709 | .remove = gameport_driver_remove, | 722 | .remove = gameport_driver_remove, |
710 | }; | 723 | }; |
711 | 724 | ||
725 | static void gameport_add_driver(struct gameport_driver *drv) | ||
726 | { | ||
727 | int error; | ||
728 | |||
729 | error = driver_register(&drv->driver); | ||
730 | if (error) | ||
731 | printk(KERN_ERR | ||
732 | "gameport: driver_register() failed for %s, error: %d\n", | ||
733 | drv->driver.name, error); | ||
734 | } | ||
735 | |||
712 | void __gameport_register_driver(struct gameport_driver *drv, struct module *owner) | 736 | void __gameport_register_driver(struct gameport_driver *drv, struct module *owner) |
713 | { | 737 | { |
714 | drv->driver.bus = &gameport_bus; | 738 | drv->driver.bus = &gameport_bus; |
@@ -778,16 +802,24 @@ void gameport_close(struct gameport *gameport) | |||
778 | 802 | ||
779 | static int __init gameport_init(void) | 803 | static int __init gameport_init(void) |
780 | { | 804 | { |
781 | gameport_task = kthread_run(gameport_thread, NULL, "kgameportd"); | 805 | int error; |
782 | if (IS_ERR(gameport_task)) { | ||
783 | printk(KERN_ERR "gameport: Failed to start kgameportd\n"); | ||
784 | return PTR_ERR(gameport_task); | ||
785 | } | ||
786 | 806 | ||
787 | gameport_bus.dev_attrs = gameport_device_attrs; | 807 | gameport_bus.dev_attrs = gameport_device_attrs; |
788 | gameport_bus.drv_attrs = gameport_driver_attrs; | 808 | gameport_bus.drv_attrs = gameport_driver_attrs; |
789 | gameport_bus.match = gameport_bus_match; | 809 | gameport_bus.match = gameport_bus_match; |
790 | bus_register(&gameport_bus); | 810 | error = bus_register(&gameport_bus); |
811 | if (error) { | ||
812 | printk(KERN_ERR "gameport: failed to register gameport bus, error: %d\n", error); | ||
813 | return error; | ||
814 | } | ||
815 | |||
816 | gameport_task = kthread_run(gameport_thread, NULL, "kgameportd"); | ||
817 | if (IS_ERR(gameport_task)) { | ||
818 | bus_unregister(&gameport_bus); | ||
819 | error = PTR_ERR(gameport_task); | ||
820 | printk(KERN_ERR "gameport: Failed to start kgameportd, error: %d\n", error); | ||
821 | return error; | ||
822 | } | ||
791 | 823 | ||
792 | return 0; | 824 | return 0; |
793 | } | 825 | } |
diff --git a/drivers/input/input.c b/drivers/input/input.c index a90486f5e491..9cb4b9a54f01 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c | |||
@@ -35,6 +35,16 @@ static LIST_HEAD(input_handler_list); | |||
35 | 35 | ||
36 | static struct input_handler *input_table[8]; | 36 | static struct input_handler *input_table[8]; |
37 | 37 | ||
38 | /** | ||
39 | * input_event() - report new input event | ||
40 | * @handle: device that generated the event | ||
41 | * @type: type of the event | ||
42 | * @code: event code | ||
43 | * @value: value of the event | ||
44 | * | ||
45 | * This function should be used by drivers implementing various input devices | ||
46 | * See also input_inject_event() | ||
47 | */ | ||
38 | void input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) | 48 | void input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) |
39 | { | 49 | { |
40 | struct input_handle *handle; | 50 | struct input_handle *handle; |
@@ -183,6 +193,23 @@ void input_event(struct input_dev *dev, unsigned int type, unsigned int code, in | |||
183 | } | 193 | } |
184 | EXPORT_SYMBOL(input_event); | 194 | EXPORT_SYMBOL(input_event); |
185 | 195 | ||
196 | /** | ||
197 | * input_inject_event() - send input event from input handler | ||
198 | * @handle: input handle to send event through | ||
199 | * @type: type of the event | ||
200 | * @code: event code | ||
201 | * @value: value of the event | ||
202 | * | ||
203 | * Similar to input_event() but will ignore event if device is "grabbed" and handle | ||
204 | * injecting event is not the one that owns the device. | ||
205 | */ | ||
206 | void input_inject_event(struct input_handle *handle, unsigned int type, unsigned int code, int value) | ||
207 | { | ||
208 | if (!handle->dev->grab || handle->dev->grab == handle) | ||
209 | input_event(handle->dev, type, code, value); | ||
210 | } | ||
211 | EXPORT_SYMBOL(input_inject_event); | ||
212 | |||
186 | static void input_repeat_key(unsigned long data) | 213 | static void input_repeat_key(unsigned long data) |
187 | { | 214 | { |
188 | struct input_dev *dev = (void *) data; | 215 | struct input_dev *dev = (void *) data; |
@@ -197,15 +224,6 @@ static void input_repeat_key(unsigned long data) | |||
197 | mod_timer(&dev->timer, jiffies + msecs_to_jiffies(dev->rep[REP_PERIOD])); | 224 | mod_timer(&dev->timer, jiffies + msecs_to_jiffies(dev->rep[REP_PERIOD])); |
198 | } | 225 | } |
199 | 226 | ||
200 | int input_accept_process(struct input_handle *handle, struct file *file) | ||
201 | { | ||
202 | if (handle->dev->accept) | ||
203 | return handle->dev->accept(handle->dev, file); | ||
204 | |||
205 | return 0; | ||
206 | } | ||
207 | EXPORT_SYMBOL(input_accept_process); | ||
208 | |||
209 | int input_grab_device(struct input_handle *handle) | 227 | int input_grab_device(struct input_handle *handle) |
210 | { | 228 | { |
211 | if (handle->dev->grab) | 229 | if (handle->dev->grab) |
@@ -218,8 +236,15 @@ EXPORT_SYMBOL(input_grab_device); | |||
218 | 236 | ||
219 | void input_release_device(struct input_handle *handle) | 237 | void input_release_device(struct input_handle *handle) |
220 | { | 238 | { |
221 | if (handle->dev->grab == handle) | 239 | struct input_dev *dev = handle->dev; |
222 | handle->dev->grab = NULL; | 240 | |
241 | if (dev->grab == handle) { | ||
242 | dev->grab = NULL; | ||
243 | |||
244 | list_for_each_entry(handle, &dev->h_list, d_node) | ||
245 | if (handle->handler->start) | ||
246 | handle->handler->start(handle); | ||
247 | } | ||
223 | } | 248 | } |
224 | EXPORT_SYMBOL(input_release_device); | 249 | EXPORT_SYMBOL(input_release_device); |
225 | 250 | ||
@@ -963,8 +988,11 @@ int input_register_device(struct input_dev *dev) | |||
963 | list_for_each_entry(handler, &input_handler_list, node) | 988 | list_for_each_entry(handler, &input_handler_list, node) |
964 | if (!handler->blacklist || !input_match_device(handler->blacklist, dev)) | 989 | if (!handler->blacklist || !input_match_device(handler->blacklist, dev)) |
965 | if ((id = input_match_device(handler->id_table, dev))) | 990 | if ((id = input_match_device(handler->id_table, dev))) |
966 | if ((handle = handler->connect(handler, dev, id))) | 991 | if ((handle = handler->connect(handler, dev, id))) { |
967 | input_link_handle(handle); | 992 | input_link_handle(handle); |
993 | if (handler->start) | ||
994 | handler->start(handle); | ||
995 | } | ||
968 | 996 | ||
969 | input_wakeup_procfs_readers(); | 997 | input_wakeup_procfs_readers(); |
970 | 998 | ||
@@ -1028,8 +1056,11 @@ void input_register_handler(struct input_handler *handler) | |||
1028 | list_for_each_entry(dev, &input_dev_list, node) | 1056 | list_for_each_entry(dev, &input_dev_list, node) |
1029 | if (!handler->blacklist || !input_match_device(handler->blacklist, dev)) | 1057 | if (!handler->blacklist || !input_match_device(handler->blacklist, dev)) |
1030 | if ((id = input_match_device(handler->id_table, dev))) | 1058 | if ((id = input_match_device(handler->id_table, dev))) |
1031 | if ((handle = handler->connect(handler, dev, id))) | 1059 | if ((handle = handler->connect(handler, dev, id))) { |
1032 | input_link_handle(handle); | 1060 | input_link_handle(handle); |
1061 | if (handler->start) | ||
1062 | handler->start(handle); | ||
1063 | } | ||
1033 | 1064 | ||
1034 | input_wakeup_procfs_readers(); | 1065 | input_wakeup_procfs_readers(); |
1035 | } | 1066 | } |
diff --git a/drivers/input/joystick/iforce/iforce-main.c b/drivers/input/joystick/iforce/iforce-main.c index 6d99e3c37884..b4914e7231f8 100644 --- a/drivers/input/joystick/iforce/iforce-main.c +++ b/drivers/input/joystick/iforce/iforce-main.c | |||
@@ -79,6 +79,7 @@ static struct iforce_device iforce_device[] = { | |||
79 | { 0x06f8, 0x0001, "Guillemot Race Leader Force Feedback", btn_wheel, abs_wheel, ff_iforce }, //? | 79 | { 0x06f8, 0x0001, "Guillemot Race Leader Force Feedback", btn_wheel, abs_wheel, ff_iforce }, //? |
80 | { 0x06f8, 0x0004, "Guillemot Force Feedback Racing Wheel", btn_wheel, abs_wheel, ff_iforce }, //? | 80 | { 0x06f8, 0x0004, "Guillemot Force Feedback Racing Wheel", btn_wheel, abs_wheel, ff_iforce }, //? |
81 | { 0x06f8, 0x0004, "Gullemot Jet Leader 3D", btn_joystick, abs_joystick, ff_iforce }, //? | 81 | { 0x06f8, 0x0004, "Gullemot Jet Leader 3D", btn_joystick, abs_joystick, ff_iforce }, //? |
82 | { 0x06d6, 0x29bc, "Trust Force Feedback Race Master", btn_wheel, abs_wheel, ff_iforce }, | ||
82 | { 0x0000, 0x0000, "Unknown I-Force Device [%04x:%04x]", btn_joystick, abs_joystick, ff_iforce } | 83 | { 0x0000, 0x0000, "Unknown I-Force Device [%04x:%04x]", btn_joystick, abs_joystick, ff_iforce } |
83 | }; | 84 | }; |
84 | 85 | ||
@@ -222,22 +223,22 @@ static int iforce_erase_effect(struct input_dev *dev, int effect_id) | |||
222 | int err = 0; | 223 | int err = 0; |
223 | struct iforce_core_effect* core_effect; | 224 | struct iforce_core_effect* core_effect; |
224 | 225 | ||
225 | /* Check who is trying to erase this effect */ | ||
226 | if (iforce->core_effects[effect_id].owner != current->pid) { | ||
227 | printk(KERN_WARNING "iforce-main.c: %d tried to erase an effect belonging to %d\n", current->pid, iforce->core_effects[effect_id].owner); | ||
228 | return -EACCES; | ||
229 | } | ||
230 | |||
231 | if (effect_id < 0 || effect_id >= FF_EFFECTS_MAX) | 226 | if (effect_id < 0 || effect_id >= FF_EFFECTS_MAX) |
232 | return -EINVAL; | 227 | return -EINVAL; |
233 | 228 | ||
234 | core_effect = iforce->core_effects + effect_id; | 229 | core_effect = &iforce->core_effects[effect_id]; |
230 | |||
231 | /* Check who is trying to erase this effect */ | ||
232 | if (core_effect->owner != current->pid) { | ||
233 | printk(KERN_WARNING "iforce-main.c: %d tried to erase an effect belonging to %d\n", current->pid, core_effect->owner); | ||
234 | return -EACCES; | ||
235 | } | ||
235 | 236 | ||
236 | if (test_bit(FF_MOD1_IS_USED, core_effect->flags)) | 237 | if (test_bit(FF_MOD1_IS_USED, core_effect->flags)) |
237 | err = release_resource(&(iforce->core_effects[effect_id].mod1_chunk)); | 238 | err = release_resource(&core_effect->mod1_chunk); |
238 | 239 | ||
239 | if (!err && test_bit(FF_MOD2_IS_USED, core_effect->flags)) | 240 | if (!err && test_bit(FF_MOD2_IS_USED, core_effect->flags)) |
240 | err = release_resource(&(iforce->core_effects[effect_id].mod2_chunk)); | 241 | err = release_resource(&core_effect->mod2_chunk); |
241 | 242 | ||
242 | /*TODO: remember to change that if more FF_MOD* bits are added */ | 243 | /*TODO: remember to change that if more FF_MOD* bits are added */ |
243 | core_effect->flags[0] = 0; | 244 | core_effect->flags[0] = 0; |
diff --git a/drivers/input/joystick/spaceball.c b/drivers/input/joystick/spaceball.c index 75eb5ca59992..7a19ee052972 100644 --- a/drivers/input/joystick/spaceball.c +++ b/drivers/input/joystick/spaceball.c | |||
@@ -50,7 +50,7 @@ MODULE_LICENSE("GPL"); | |||
50 | */ | 50 | */ |
51 | 51 | ||
52 | #define SPACEBALL_MAX_LENGTH 128 | 52 | #define SPACEBALL_MAX_LENGTH 128 |
53 | #define SPACEBALL_MAX_ID 8 | 53 | #define SPACEBALL_MAX_ID 9 |
54 | 54 | ||
55 | #define SPACEBALL_1003 1 | 55 | #define SPACEBALL_1003 1 |
56 | #define SPACEBALL_2003B 3 | 56 | #define SPACEBALL_2003B 3 |
diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c index ce1f10e8984b..6bfa0cf4b1d2 100644 --- a/drivers/input/keyboard/atkbd.c +++ b/drivers/input/keyboard/atkbd.c | |||
@@ -482,13 +482,7 @@ out: | |||
482 | return IRQ_HANDLED; | 482 | return IRQ_HANDLED; |
483 | } | 483 | } |
484 | 484 | ||
485 | /* | 485 | static int atkbd_set_repeat_rate(struct atkbd *atkbd) |
486 | * atkbd_event_work() is used to complete processing of events that | ||
487 | * can not be processed by input_event() which is often called from | ||
488 | * interrupt context. | ||
489 | */ | ||
490 | |||
491 | static void atkbd_event_work(void *data) | ||
492 | { | 486 | { |
493 | const short period[32] = | 487 | const short period[32] = |
494 | { 33, 37, 42, 46, 50, 54, 58, 63, 67, 75, 83, 92, 100, 109, 116, 125, | 488 | { 33, 37, 42, 46, 50, 54, 58, 63, 67, 75, 83, 92, 100, 109, 116, 125, |
@@ -496,41 +490,64 @@ static void atkbd_event_work(void *data) | |||
496 | const short delay[4] = | 490 | const short delay[4] = |
497 | { 250, 500, 750, 1000 }; | 491 | { 250, 500, 750, 1000 }; |
498 | 492 | ||
499 | struct atkbd *atkbd = data; | 493 | struct input_dev *dev = atkbd->dev; |
494 | unsigned char param; | ||
495 | int i = 0, j = 0; | ||
496 | |||
497 | while (i < ARRAY_SIZE(period) - 1 && period[i] < dev->rep[REP_PERIOD]) | ||
498 | i++; | ||
499 | dev->rep[REP_PERIOD] = period[i]; | ||
500 | |||
501 | while (j < ARRAY_SIZE(period) - 1 && delay[j] < dev->rep[REP_DELAY]) | ||
502 | j++; | ||
503 | dev->rep[REP_DELAY] = delay[j]; | ||
504 | |||
505 | param = i | (j << 5); | ||
506 | return ps2_command(&atkbd->ps2dev, ¶m, ATKBD_CMD_SETREP); | ||
507 | } | ||
508 | |||
509 | static int atkbd_set_leds(struct atkbd *atkbd) | ||
510 | { | ||
500 | struct input_dev *dev = atkbd->dev; | 511 | struct input_dev *dev = atkbd->dev; |
501 | unsigned char param[2]; | 512 | unsigned char param[2]; |
502 | int i, j; | ||
503 | 513 | ||
504 | mutex_lock(&atkbd->event_mutex); | 514 | param[0] = (test_bit(LED_SCROLLL, dev->led) ? 1 : 0) |
515 | | (test_bit(LED_NUML, dev->led) ? 2 : 0) | ||
516 | | (test_bit(LED_CAPSL, dev->led) ? 4 : 0); | ||
517 | if (ps2_command(&atkbd->ps2dev, param, ATKBD_CMD_SETLEDS)) | ||
518 | return -1; | ||
505 | 519 | ||
506 | if (test_and_clear_bit(ATKBD_LED_EVENT_BIT, &atkbd->event_mask)) { | 520 | if (atkbd->extra) { |
507 | param[0] = (test_bit(LED_SCROLLL, dev->led) ? 1 : 0) | 521 | param[0] = 0; |
508 | | (test_bit(LED_NUML, dev->led) ? 2 : 0) | 522 | param[1] = (test_bit(LED_COMPOSE, dev->led) ? 0x01 : 0) |
509 | | (test_bit(LED_CAPSL, dev->led) ? 4 : 0); | 523 | | (test_bit(LED_SLEEP, dev->led) ? 0x02 : 0) |
510 | ps2_command(&atkbd->ps2dev, param, ATKBD_CMD_SETLEDS); | 524 | | (test_bit(LED_SUSPEND, dev->led) ? 0x04 : 0) |
511 | 525 | | (test_bit(LED_MISC, dev->led) ? 0x10 : 0) | |
512 | if (atkbd->extra) { | 526 | | (test_bit(LED_MUTE, dev->led) ? 0x20 : 0); |
513 | param[0] = 0; | 527 | if (ps2_command(&atkbd->ps2dev, param, ATKBD_CMD_EX_SETLEDS)) |
514 | param[1] = (test_bit(LED_COMPOSE, dev->led) ? 0x01 : 0) | 528 | return -1; |
515 | | (test_bit(LED_SLEEP, dev->led) ? 0x02 : 0) | ||
516 | | (test_bit(LED_SUSPEND, dev->led) ? 0x04 : 0) | ||
517 | | (test_bit(LED_MISC, dev->led) ? 0x10 : 0) | ||
518 | | (test_bit(LED_MUTE, dev->led) ? 0x20 : 0); | ||
519 | ps2_command(&atkbd->ps2dev, param, ATKBD_CMD_EX_SETLEDS); | ||
520 | } | ||
521 | } | 529 | } |
522 | 530 | ||
523 | if (test_and_clear_bit(ATKBD_REP_EVENT_BIT, &atkbd->event_mask)) { | 531 | return 0; |
524 | i = j = 0; | 532 | } |
525 | while (i < 31 && period[i] < dev->rep[REP_PERIOD]) | 533 | |
526 | i++; | 534 | /* |
527 | while (j < 3 && delay[j] < dev->rep[REP_DELAY]) | 535 | * atkbd_event_work() is used to complete processing of events that |
528 | j++; | 536 | * can not be processed by input_event() which is often called from |
529 | dev->rep[REP_PERIOD] = period[i]; | 537 | * interrupt context. |
530 | dev->rep[REP_DELAY] = delay[j]; | 538 | */ |
531 | param[0] = i | (j << 5); | 539 | |
532 | ps2_command(&atkbd->ps2dev, param, ATKBD_CMD_SETREP); | 540 | static void atkbd_event_work(void *data) |
533 | } | 541 | { |
542 | struct atkbd *atkbd = data; | ||
543 | |||
544 | mutex_lock(&atkbd->event_mutex); | ||
545 | |||
546 | if (test_and_clear_bit(ATKBD_LED_EVENT_BIT, &atkbd->event_mask)) | ||
547 | atkbd_set_leds(atkbd); | ||
548 | |||
549 | if (test_and_clear_bit(ATKBD_REP_EVENT_BIT, &atkbd->event_mask)) | ||
550 | atkbd_set_repeat_rate(atkbd); | ||
534 | 551 | ||
535 | mutex_unlock(&atkbd->event_mutex); | 552 | mutex_unlock(&atkbd->event_mutex); |
536 | } | 553 | } |
@@ -975,7 +992,6 @@ static int atkbd_reconnect(struct serio *serio) | |||
975 | { | 992 | { |
976 | struct atkbd *atkbd = serio_get_drvdata(serio); | 993 | struct atkbd *atkbd = serio_get_drvdata(serio); |
977 | struct serio_driver *drv = serio->drv; | 994 | struct serio_driver *drv = serio->drv; |
978 | unsigned char param[1]; | ||
979 | 995 | ||
980 | if (!atkbd || !drv) { | 996 | if (!atkbd || !drv) { |
981 | printk(KERN_DEBUG "atkbd: reconnect request, but serio is disconnected, ignoring...\n"); | 997 | printk(KERN_DEBUG "atkbd: reconnect request, but serio is disconnected, ignoring...\n"); |
@@ -985,10 +1001,6 @@ static int atkbd_reconnect(struct serio *serio) | |||
985 | atkbd_disable(atkbd); | 1001 | atkbd_disable(atkbd); |
986 | 1002 | ||
987 | if (atkbd->write) { | 1003 | if (atkbd->write) { |
988 | param[0] = (test_bit(LED_SCROLLL, atkbd->dev->led) ? 1 : 0) | ||
989 | | (test_bit(LED_NUML, atkbd->dev->led) ? 2 : 0) | ||
990 | | (test_bit(LED_CAPSL, atkbd->dev->led) ? 4 : 0); | ||
991 | |||
992 | if (atkbd_probe(atkbd)) | 1004 | if (atkbd_probe(atkbd)) |
993 | return -1; | 1005 | return -1; |
994 | if (atkbd->set != atkbd_select_set(atkbd, atkbd->set, atkbd->extra)) | 1006 | if (atkbd->set != atkbd_select_set(atkbd, atkbd->set, atkbd->extra)) |
@@ -996,8 +1008,13 @@ static int atkbd_reconnect(struct serio *serio) | |||
996 | 1008 | ||
997 | atkbd_activate(atkbd); | 1009 | atkbd_activate(atkbd); |
998 | 1010 | ||
999 | if (ps2_command(&atkbd->ps2dev, param, ATKBD_CMD_SETLEDS)) | 1011 | /* |
1000 | return -1; | 1012 | * Restore repeat rate and LEDs (that were reset by atkbd_activate) |
1013 | * to pre-resume state | ||
1014 | */ | ||
1015 | if (!atkbd->softrepeat) | ||
1016 | atkbd_set_repeat_rate(atkbd); | ||
1017 | atkbd_set_leds(atkbd); | ||
1001 | } | 1018 | } |
1002 | 1019 | ||
1003 | atkbd_enable(atkbd); | 1020 | atkbd_enable(atkbd); |
diff --git a/drivers/input/misc/wistron_btns.c b/drivers/input/misc/wistron_btns.c index ccf0faeee5c1..a8efc1af36cb 100644 --- a/drivers/input/misc/wistron_btns.c +++ b/drivers/input/misc/wistron_btns.c | |||
@@ -94,7 +94,7 @@ static void call_bios(struct regs *regs) | |||
94 | 94 | ||
95 | static ssize_t __init locate_wistron_bios(void __iomem *base) | 95 | static ssize_t __init locate_wistron_bios(void __iomem *base) |
96 | { | 96 | { |
97 | static const unsigned char __initdata signature[] = | 97 | static unsigned char __initdata signature[] = |
98 | { 0x42, 0x21, 0x55, 0x30 }; | 98 | { 0x42, 0x21, 0x55, 0x30 }; |
99 | ssize_t offset; | 99 | ssize_t offset; |
100 | 100 | ||
@@ -259,11 +259,11 @@ static int __init dmi_matched(struct dmi_system_id *dmi) | |||
259 | return 1; | 259 | return 1; |
260 | } | 260 | } |
261 | 261 | ||
262 | static struct key_entry keymap_empty[] = { | 262 | static struct key_entry keymap_empty[] __initdata = { |
263 | { KE_END, 0 } | 263 | { KE_END, 0 } |
264 | }; | 264 | }; |
265 | 265 | ||
266 | static struct key_entry keymap_fs_amilo_pro_v2000[] = { | 266 | static struct key_entry keymap_fs_amilo_pro_v2000[] __initdata = { |
267 | { KE_KEY, 0x01, KEY_HELP }, | 267 | { KE_KEY, 0x01, KEY_HELP }, |
268 | { KE_KEY, 0x11, KEY_PROG1 }, | 268 | { KE_KEY, 0x11, KEY_PROG1 }, |
269 | { KE_KEY, 0x12, KEY_PROG2 }, | 269 | { KE_KEY, 0x12, KEY_PROG2 }, |
@@ -273,7 +273,7 @@ static struct key_entry keymap_fs_amilo_pro_v2000[] = { | |||
273 | { KE_END, 0 } | 273 | { KE_END, 0 } |
274 | }; | 274 | }; |
275 | 275 | ||
276 | static struct key_entry keymap_fujitsu_n3510[] = { | 276 | static struct key_entry keymap_fujitsu_n3510[] __initdata = { |
277 | { KE_KEY, 0x11, KEY_PROG1 }, | 277 | { KE_KEY, 0x11, KEY_PROG1 }, |
278 | { KE_KEY, 0x12, KEY_PROG2 }, | 278 | { KE_KEY, 0x12, KEY_PROG2 }, |
279 | { KE_KEY, 0x36, KEY_WWW }, | 279 | { KE_KEY, 0x36, KEY_WWW }, |
@@ -285,7 +285,7 @@ static struct key_entry keymap_fujitsu_n3510[] = { | |||
285 | { KE_END, 0 } | 285 | { KE_END, 0 } |
286 | }; | 286 | }; |
287 | 287 | ||
288 | static struct key_entry keymap_wistron_ms2111[] = { | 288 | static struct key_entry keymap_wistron_ms2111[] __initdata = { |
289 | { KE_KEY, 0x11, KEY_PROG1 }, | 289 | { KE_KEY, 0x11, KEY_PROG1 }, |
290 | { KE_KEY, 0x12, KEY_PROG2 }, | 290 | { KE_KEY, 0x12, KEY_PROG2 }, |
291 | { KE_KEY, 0x13, KEY_PROG3 }, | 291 | { KE_KEY, 0x13, KEY_PROG3 }, |
@@ -294,7 +294,7 @@ static struct key_entry keymap_wistron_ms2111[] = { | |||
294 | { KE_END, 0 } | 294 | { KE_END, 0 } |
295 | }; | 295 | }; |
296 | 296 | ||
297 | static struct key_entry keymap_wistron_ms2141[] = { | 297 | static struct key_entry keymap_wistron_ms2141[] __initdata = { |
298 | { KE_KEY, 0x11, KEY_PROG1 }, | 298 | { KE_KEY, 0x11, KEY_PROG1 }, |
299 | { KE_KEY, 0x12, KEY_PROG2 }, | 299 | { KE_KEY, 0x12, KEY_PROG2 }, |
300 | { KE_WIFI, 0x30, 0 }, | 300 | { KE_WIFI, 0x30, 0 }, |
@@ -307,7 +307,7 @@ static struct key_entry keymap_wistron_ms2141[] = { | |||
307 | { KE_END, 0 } | 307 | { KE_END, 0 } |
308 | }; | 308 | }; |
309 | 309 | ||
310 | static struct key_entry keymap_acer_aspire_1500[] = { | 310 | static struct key_entry keymap_acer_aspire_1500[] __initdata = { |
311 | { KE_KEY, 0x11, KEY_PROG1 }, | 311 | { KE_KEY, 0x11, KEY_PROG1 }, |
312 | { KE_KEY, 0x12, KEY_PROG2 }, | 312 | { KE_KEY, 0x12, KEY_PROG2 }, |
313 | { KE_WIFI, 0x30, 0 }, | 313 | { KE_WIFI, 0x30, 0 }, |
@@ -317,7 +317,7 @@ static struct key_entry keymap_acer_aspire_1500[] = { | |||
317 | { KE_END, 0 } | 317 | { KE_END, 0 } |
318 | }; | 318 | }; |
319 | 319 | ||
320 | static struct key_entry keymap_acer_travelmate_240[] = { | 320 | static struct key_entry keymap_acer_travelmate_240[] __initdata = { |
321 | { KE_KEY, 0x31, KEY_MAIL }, | 321 | { KE_KEY, 0x31, KEY_MAIL }, |
322 | { KE_KEY, 0x36, KEY_WWW }, | 322 | { KE_KEY, 0x36, KEY_WWW }, |
323 | { KE_KEY, 0x11, KEY_PROG1 }, | 323 | { KE_KEY, 0x11, KEY_PROG1 }, |
@@ -327,7 +327,7 @@ static struct key_entry keymap_acer_travelmate_240[] = { | |||
327 | { KE_END, 0 } | 327 | { KE_END, 0 } |
328 | }; | 328 | }; |
329 | 329 | ||
330 | static struct key_entry keymap_aopen_1559as[] = { | 330 | static struct key_entry keymap_aopen_1559as[] __initdata = { |
331 | { KE_KEY, 0x01, KEY_HELP }, | 331 | { KE_KEY, 0x01, KEY_HELP }, |
332 | { KE_KEY, 0x06, KEY_PROG3 }, | 332 | { KE_KEY, 0x06, KEY_PROG3 }, |
333 | { KE_KEY, 0x11, KEY_PROG1 }, | 333 | { KE_KEY, 0x11, KEY_PROG1 }, |
@@ -343,7 +343,7 @@ static struct key_entry keymap_aopen_1559as[] = { | |||
343 | * a list of buttons and their key codes (reported when loading this module | 343 | * a list of buttons and their key codes (reported when loading this module |
344 | * with force=1) and the output of dmidecode to $MODULE_AUTHOR. | 344 | * with force=1) and the output of dmidecode to $MODULE_AUTHOR. |
345 | */ | 345 | */ |
346 | static struct dmi_system_id dmi_ids[] = { | 346 | static struct dmi_system_id dmi_ids[] __initdata = { |
347 | { | 347 | { |
348 | .callback = dmi_matched, | 348 | .callback = dmi_matched, |
349 | .ident = "Fujitsu-Siemens Amilo Pro V2000", | 349 | .ident = "Fujitsu-Siemens Amilo Pro V2000", |
diff --git a/drivers/input/mouse/logips2pp.c b/drivers/input/mouse/logips2pp.c index 2f0d28840810..54b696cfe1e3 100644 --- a/drivers/input/mouse/logips2pp.c +++ b/drivers/input/mouse/logips2pp.c | |||
@@ -238,8 +238,7 @@ static struct ps2pp_info *get_model_info(unsigned char model) | |||
238 | { 100, PS2PP_KIND_MX, /* MX510 */ | 238 | { 100, PS2PP_KIND_MX, /* MX510 */ |
239 | PS2PP_WHEEL | PS2PP_SIDE_BTN | PS2PP_TASK_BTN | | 239 | PS2PP_WHEEL | PS2PP_SIDE_BTN | PS2PP_TASK_BTN | |
240 | PS2PP_EXTRA_BTN | PS2PP_NAV_BTN }, | 240 | PS2PP_EXTRA_BTN | PS2PP_NAV_BTN }, |
241 | { 111, PS2PP_KIND_MX, /* MX300 */ | 241 | { 111, PS2PP_KIND_MX, PS2PP_WHEEL | PS2PP_SIDE_BTN }, /* MX300 reports task button as side */ |
242 | PS2PP_WHEEL | PS2PP_EXTRA_BTN | PS2PP_TASK_BTN }, | ||
243 | { 112, PS2PP_KIND_MX, /* MX500 */ | 242 | { 112, PS2PP_KIND_MX, /* MX500 */ |
244 | PS2PP_WHEEL | PS2PP_SIDE_BTN | PS2PP_TASK_BTN | | 243 | PS2PP_WHEEL | PS2PP_SIDE_BTN | PS2PP_TASK_BTN | |
245 | PS2PP_EXTRA_BTN | PS2PP_NAV_BTN }, | 244 | PS2PP_EXTRA_BTN | PS2PP_NAV_BTN }, |
diff --git a/drivers/input/mouse/trackpoint.c b/drivers/input/mouse/trackpoint.c index 6d9ec9ab1b90..ae5871a0e060 100644 --- a/drivers/input/mouse/trackpoint.c +++ b/drivers/input/mouse/trackpoint.c | |||
@@ -183,21 +183,26 @@ static struct attribute_group trackpoint_attr_group = { | |||
183 | .attrs = trackpoint_attrs, | 183 | .attrs = trackpoint_attrs, |
184 | }; | 184 | }; |
185 | 185 | ||
186 | static void trackpoint_disconnect(struct psmouse *psmouse) | 186 | static int trackpoint_start_protocol(struct psmouse *psmouse, unsigned char *firmware_id) |
187 | { | 187 | { |
188 | sysfs_remove_group(&psmouse->ps2dev.serio->dev.kobj, &trackpoint_attr_group); | 188 | unsigned char param[2] = { 0 }; |
189 | 189 | ||
190 | kfree(psmouse->private); | 190 | if (ps2_command(&psmouse->ps2dev, param, MAKE_PS2_CMD(0, 2, TP_READ_ID))) |
191 | psmouse->private = NULL; | 191 | return -1; |
192 | |||
193 | if (param[0] != TP_MAGIC_IDENT) | ||
194 | return -1; | ||
195 | |||
196 | if (firmware_id) | ||
197 | *firmware_id = param[1]; | ||
198 | |||
199 | return 0; | ||
192 | } | 200 | } |
193 | 201 | ||
194 | static int trackpoint_sync(struct psmouse *psmouse) | 202 | static int trackpoint_sync(struct psmouse *psmouse) |
195 | { | 203 | { |
196 | unsigned char toggle; | ||
197 | struct trackpoint_data *tp = psmouse->private; | 204 | struct trackpoint_data *tp = psmouse->private; |
198 | 205 | unsigned char toggle; | |
199 | if (!tp) | ||
200 | return -1; | ||
201 | 206 | ||
202 | /* Disable features that may make device unusable with this driver */ | 207 | /* Disable features that may make device unusable with this driver */ |
203 | trackpoint_read(&psmouse->ps2dev, TP_TOGGLE_TWOHAND, &toggle); | 208 | trackpoint_read(&psmouse->ps2dev, TP_TOGGLE_TWOHAND, &toggle); |
@@ -263,27 +268,38 @@ static void trackpoint_defaults(struct trackpoint_data *tp) | |||
263 | tp->ext_dev = TP_DEF_EXT_DEV; | 268 | tp->ext_dev = TP_DEF_EXT_DEV; |
264 | } | 269 | } |
265 | 270 | ||
271 | static void trackpoint_disconnect(struct psmouse *psmouse) | ||
272 | { | ||
273 | sysfs_remove_group(&psmouse->ps2dev.serio->dev.kobj, &trackpoint_attr_group); | ||
274 | |||
275 | kfree(psmouse->private); | ||
276 | psmouse->private = NULL; | ||
277 | } | ||
278 | |||
279 | static int trackpoint_reconnect(struct psmouse *psmouse) | ||
280 | { | ||
281 | if (trackpoint_start_protocol(psmouse, NULL)) | ||
282 | return -1; | ||
283 | |||
284 | if (trackpoint_sync(psmouse)) | ||
285 | return -1; | ||
286 | |||
287 | return 0; | ||
288 | } | ||
289 | |||
266 | int trackpoint_detect(struct psmouse *psmouse, int set_properties) | 290 | int trackpoint_detect(struct psmouse *psmouse, int set_properties) |
267 | { | 291 | { |
268 | struct trackpoint_data *priv; | 292 | struct trackpoint_data *priv; |
269 | struct ps2dev *ps2dev = &psmouse->ps2dev; | 293 | struct ps2dev *ps2dev = &psmouse->ps2dev; |
270 | unsigned char firmware_id; | 294 | unsigned char firmware_id; |
271 | unsigned char button_info; | 295 | unsigned char button_info; |
272 | unsigned char param[2]; | ||
273 | |||
274 | param[0] = param[1] = 0; | ||
275 | 296 | ||
276 | if (ps2_command(ps2dev, param, MAKE_PS2_CMD(0, 2, TP_READ_ID))) | 297 | if (trackpoint_start_protocol(psmouse, &firmware_id)) |
277 | return -1; | ||
278 | |||
279 | if (param[0] != TP_MAGIC_IDENT) | ||
280 | return -1; | 298 | return -1; |
281 | 299 | ||
282 | if (!set_properties) | 300 | if (!set_properties) |
283 | return 0; | 301 | return 0; |
284 | 302 | ||
285 | firmware_id = param[1]; | ||
286 | |||
287 | if (trackpoint_read(&psmouse->ps2dev, TP_EXT_BTN, &button_info)) { | 303 | if (trackpoint_read(&psmouse->ps2dev, TP_EXT_BTN, &button_info)) { |
288 | printk(KERN_WARNING "trackpoint.c: failed to get extended button data\n"); | 304 | printk(KERN_WARNING "trackpoint.c: failed to get extended button data\n"); |
289 | button_info = 0; | 305 | button_info = 0; |
@@ -296,7 +312,7 @@ int trackpoint_detect(struct psmouse *psmouse, int set_properties) | |||
296 | psmouse->vendor = "IBM"; | 312 | psmouse->vendor = "IBM"; |
297 | psmouse->name = "TrackPoint"; | 313 | psmouse->name = "TrackPoint"; |
298 | 314 | ||
299 | psmouse->reconnect = trackpoint_sync; | 315 | psmouse->reconnect = trackpoint_reconnect; |
300 | psmouse->disconnect = trackpoint_disconnect; | 316 | psmouse->disconnect = trackpoint_disconnect; |
301 | 317 | ||
302 | trackpoint_defaults(priv); | 318 | trackpoint_defaults(priv); |
diff --git a/drivers/input/serio/libps2.c b/drivers/input/serio/libps2.c index 61a6f977846f..ed202f2f251a 100644 --- a/drivers/input/serio/libps2.c +++ b/drivers/input/serio/libps2.c | |||
@@ -177,6 +177,11 @@ int ps2_command(struct ps2dev *ps2dev, unsigned char *param, int command) | |||
177 | return -1; | 177 | return -1; |
178 | } | 178 | } |
179 | 179 | ||
180 | if (send && !param) { | ||
181 | WARN_ON(1); | ||
182 | return -1; | ||
183 | } | ||
184 | |||
180 | mutex_lock_nested(&ps2dev->cmd_mutex, SINGLE_DEPTH_NESTING); | 185 | mutex_lock_nested(&ps2dev->cmd_mutex, SINGLE_DEPTH_NESTING); |
181 | 186 | ||
182 | serio_pause_rx(ps2dev->serio); | 187 | serio_pause_rx(ps2dev->serio); |
diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c index 6521034bc933..3e76ad71c9a0 100644 --- a/drivers/input/serio/serio.c +++ b/drivers/input/serio/serio.c | |||
@@ -62,6 +62,7 @@ static LIST_HEAD(serio_list); | |||
62 | 62 | ||
63 | static struct bus_type serio_bus; | 63 | static struct bus_type serio_bus; |
64 | 64 | ||
65 | static void serio_add_driver(struct serio_driver *drv); | ||
65 | static void serio_add_port(struct serio *serio); | 66 | static void serio_add_port(struct serio *serio); |
66 | static void serio_destroy_port(struct serio *serio); | 67 | static void serio_destroy_port(struct serio *serio); |
67 | static void serio_reconnect_port(struct serio *serio); | 68 | static void serio_reconnect_port(struct serio *serio); |
@@ -140,8 +141,14 @@ static void serio_release_driver(struct serio *serio) | |||
140 | 141 | ||
141 | static void serio_find_driver(struct serio *serio) | 142 | static void serio_find_driver(struct serio *serio) |
142 | { | 143 | { |
144 | int error; | ||
145 | |||
143 | down_write(&serio_bus.subsys.rwsem); | 146 | down_write(&serio_bus.subsys.rwsem); |
144 | device_attach(&serio->dev); | 147 | error = device_attach(&serio->dev); |
148 | if (error < 0) | ||
149 | printk(KERN_WARNING | ||
150 | "serio: device_attach() failed for %s (%s), error: %d\n", | ||
151 | serio->phys, serio->name, error); | ||
145 | up_write(&serio_bus.subsys.rwsem); | 152 | up_write(&serio_bus.subsys.rwsem); |
146 | } | 153 | } |
147 | 154 | ||
@@ -272,7 +279,6 @@ static struct serio_event *serio_get_event(void) | |||
272 | static void serio_handle_event(void) | 279 | static void serio_handle_event(void) |
273 | { | 280 | { |
274 | struct serio_event *event; | 281 | struct serio_event *event; |
275 | struct serio_driver *serio_drv; | ||
276 | 282 | ||
277 | mutex_lock(&serio_mutex); | 283 | mutex_lock(&serio_mutex); |
278 | 284 | ||
@@ -304,8 +310,7 @@ static void serio_handle_event(void) | |||
304 | break; | 310 | break; |
305 | 311 | ||
306 | case SERIO_REGISTER_DRIVER: | 312 | case SERIO_REGISTER_DRIVER: |
307 | serio_drv = event->object; | 313 | serio_add_driver(event->object); |
308 | driver_register(&serio_drv->driver); | ||
309 | break; | 314 | break; |
310 | 315 | ||
311 | default: | 316 | default: |
@@ -525,6 +530,7 @@ static void serio_init_port(struct serio *serio) | |||
525 | 530 | ||
526 | __module_get(THIS_MODULE); | 531 | __module_get(THIS_MODULE); |
527 | 532 | ||
533 | INIT_LIST_HEAD(&serio->node); | ||
528 | spin_lock_init(&serio->lock); | 534 | spin_lock_init(&serio->lock); |
529 | mutex_init(&serio->drv_mutex); | 535 | mutex_init(&serio->drv_mutex); |
530 | device_initialize(&serio->dev); | 536 | device_initialize(&serio->dev); |
@@ -542,6 +548,8 @@ static void serio_init_port(struct serio *serio) | |||
542 | */ | 548 | */ |
543 | static void serio_add_port(struct serio *serio) | 549 | static void serio_add_port(struct serio *serio) |
544 | { | 550 | { |
551 | int error; | ||
552 | |||
545 | if (serio->parent) { | 553 | if (serio->parent) { |
546 | serio_pause_rx(serio->parent); | 554 | serio_pause_rx(serio->parent); |
547 | serio->parent->child = serio; | 555 | serio->parent->child = serio; |
@@ -551,9 +559,19 @@ static void serio_add_port(struct serio *serio) | |||
551 | list_add_tail(&serio->node, &serio_list); | 559 | list_add_tail(&serio->node, &serio_list); |
552 | if (serio->start) | 560 | if (serio->start) |
553 | serio->start(serio); | 561 | serio->start(serio); |
554 | device_add(&serio->dev); | 562 | error = device_add(&serio->dev); |
555 | sysfs_create_group(&serio->dev.kobj, &serio_id_attr_group); | 563 | if (error) |
556 | serio->registered = 1; | 564 | printk(KERN_ERR |
565 | "serio: device_add() failed for %s (%s), error: %d\n", | ||
566 | serio->phys, serio->name, error); | ||
567 | else { | ||
568 | serio->registered = 1; | ||
569 | error = sysfs_create_group(&serio->dev.kobj, &serio_id_attr_group); | ||
570 | if (error) | ||
571 | printk(KERN_ERR | ||
572 | "serio: sysfs_create_group() failed for %s (%s), error: %d\n", | ||
573 | serio->phys, serio->name, error); | ||
574 | } | ||
557 | } | 575 | } |
558 | 576 | ||
559 | /* | 577 | /* |
@@ -583,10 +601,10 @@ static void serio_destroy_port(struct serio *serio) | |||
583 | if (serio->registered) { | 601 | if (serio->registered) { |
584 | sysfs_remove_group(&serio->dev.kobj, &serio_id_attr_group); | 602 | sysfs_remove_group(&serio->dev.kobj, &serio_id_attr_group); |
585 | device_del(&serio->dev); | 603 | device_del(&serio->dev); |
586 | list_del_init(&serio->node); | ||
587 | serio->registered = 0; | 604 | serio->registered = 0; |
588 | } | 605 | } |
589 | 606 | ||
607 | list_del_init(&serio->node); | ||
590 | serio_remove_pending_events(serio); | 608 | serio_remove_pending_events(serio); |
591 | put_device(&serio->dev); | 609 | put_device(&serio->dev); |
592 | } | 610 | } |
@@ -756,6 +774,17 @@ static struct bus_type serio_bus = { | |||
756 | .remove = serio_driver_remove, | 774 | .remove = serio_driver_remove, |
757 | }; | 775 | }; |
758 | 776 | ||
777 | static void serio_add_driver(struct serio_driver *drv) | ||
778 | { | ||
779 | int error; | ||
780 | |||
781 | error = driver_register(&drv->driver); | ||
782 | if (error) | ||
783 | printk(KERN_ERR | ||
784 | "serio: driver_register() failed for %s, error: %d\n", | ||
785 | drv->driver.name, error); | ||
786 | } | ||
787 | |||
759 | void __serio_register_driver(struct serio_driver *drv, struct module *owner) | 788 | void __serio_register_driver(struct serio_driver *drv, struct module *owner) |
760 | { | 789 | { |
761 | drv->driver.bus = &serio_bus; | 790 | drv->driver.bus = &serio_bus; |
@@ -903,18 +932,26 @@ irqreturn_t serio_interrupt(struct serio *serio, | |||
903 | 932 | ||
904 | static int __init serio_init(void) | 933 | static int __init serio_init(void) |
905 | { | 934 | { |
906 | serio_task = kthread_run(serio_thread, NULL, "kseriod"); | 935 | int error; |
907 | if (IS_ERR(serio_task)) { | ||
908 | printk(KERN_ERR "serio: Failed to start kseriod\n"); | ||
909 | return PTR_ERR(serio_task); | ||
910 | } | ||
911 | 936 | ||
912 | serio_bus.dev_attrs = serio_device_attrs; | 937 | serio_bus.dev_attrs = serio_device_attrs; |
913 | serio_bus.drv_attrs = serio_driver_attrs; | 938 | serio_bus.drv_attrs = serio_driver_attrs; |
914 | serio_bus.match = serio_bus_match; | 939 | serio_bus.match = serio_bus_match; |
915 | serio_bus.uevent = serio_uevent; | 940 | serio_bus.uevent = serio_uevent; |
916 | serio_bus.resume = serio_resume; | 941 | serio_bus.resume = serio_resume; |
917 | bus_register(&serio_bus); | 942 | error = bus_register(&serio_bus); |
943 | if (error) { | ||
944 | printk(KERN_ERR "serio: failed to register serio bus, error: %d\n", error); | ||
945 | return error; | ||
946 | } | ||
947 | |||
948 | serio_task = kthread_run(serio_thread, NULL, "kseriod"); | ||
949 | if (IS_ERR(serio_task)) { | ||
950 | bus_unregister(&serio_bus); | ||
951 | error = PTR_ERR(serio_task); | ||
952 | printk(KERN_ERR "serio: Failed to start kseriod, error: %d\n", error); | ||
953 | return error; | ||
954 | } | ||
918 | 955 | ||
919 | return 0; | 956 | return 0; |
920 | } | 957 | } |
diff --git a/drivers/isdn/hardware/eicon/divasync.h b/drivers/isdn/hardware/eicon/divasync.h index 0a5be7f969f2..af3eb9e795b5 100644 --- a/drivers/isdn/hardware/eicon/divasync.h +++ b/drivers/isdn/hardware/eicon/divasync.h | |||
@@ -256,7 +256,6 @@ typedef struct | |||
256 | #define NO_ORDER_CHECK_MASK 0x00000010 | 256 | #define NO_ORDER_CHECK_MASK 0x00000010 |
257 | #define LOW_CHANNEL_MASK 0x00000020 | 257 | #define LOW_CHANNEL_MASK 0x00000020 |
258 | #define NO_HSCX30_MASK 0x00000040 | 258 | #define NO_HSCX30_MASK 0x00000040 |
259 | #define MODE_MASK 0x00000080 | ||
260 | #define SET_BOARD 0x00001000 | 259 | #define SET_BOARD 0x00001000 |
261 | #define SET_CRC4 0x00030000 | 260 | #define SET_CRC4 0x00030000 |
262 | #define SET_L1_TRISTATE 0x00040000 | 261 | #define SET_L1_TRISTATE 0x00040000 |
diff --git a/drivers/md/linear.c b/drivers/md/linear.c index ff83c9b5979e..b99c19c7eb22 100644 --- a/drivers/md/linear.c +++ b/drivers/md/linear.c | |||
@@ -162,7 +162,7 @@ static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks) | |||
162 | goto out; | 162 | goto out; |
163 | } | 163 | } |
164 | 164 | ||
165 | min_spacing = mddev->array_size; | 165 | min_spacing = conf->array_size; |
166 | sector_div(min_spacing, PAGE_SIZE/sizeof(struct dev_info *)); | 166 | sector_div(min_spacing, PAGE_SIZE/sizeof(struct dev_info *)); |
167 | 167 | ||
168 | /* min_spacing is the minimum spacing that will fit the hash | 168 | /* min_spacing is the minimum spacing that will fit the hash |
@@ -171,7 +171,7 @@ static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks) | |||
171 | * that is larger than min_spacing as use the size of that as | 171 | * that is larger than min_spacing as use the size of that as |
172 | * the actual spacing | 172 | * the actual spacing |
173 | */ | 173 | */ |
174 | conf->hash_spacing = mddev->array_size; | 174 | conf->hash_spacing = conf->array_size; |
175 | for (i=0; i < cnt-1 ; i++) { | 175 | for (i=0; i < cnt-1 ; i++) { |
176 | sector_t sz = 0; | 176 | sector_t sz = 0; |
177 | int j; | 177 | int j; |
@@ -228,7 +228,7 @@ static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks) | |||
228 | curr_offset = 0; | 228 | curr_offset = 0; |
229 | i = 0; | 229 | i = 0; |
230 | for (curr_offset = 0; | 230 | for (curr_offset = 0; |
231 | curr_offset < mddev->array_size; | 231 | curr_offset < conf->array_size; |
232 | curr_offset += conf->hash_spacing) { | 232 | curr_offset += conf->hash_spacing) { |
233 | 233 | ||
234 | while (i < mddev->raid_disks-1 && | 234 | while (i < mddev->raid_disks-1 && |
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c index 212268881857..dc79b0a0059f 100644 --- a/drivers/pnp/pnpacpi/rsparser.c +++ b/drivers/pnp/pnpacpi/rsparser.c | |||
@@ -173,6 +173,9 @@ pnpacpi_parse_allocated_address_space(struct pnp_resource_table *res_table, | |||
173 | return; | 173 | return; |
174 | } | 174 | } |
175 | 175 | ||
176 | if (p->producer_consumer == ACPI_PRODUCER) | ||
177 | return; | ||
178 | |||
176 | if (p->resource_type == ACPI_MEMORY_RANGE) | 179 | if (p->resource_type == ACPI_MEMORY_RANGE) |
177 | pnpacpi_parse_allocated_memresource(res_table, | 180 | pnpacpi_parse_allocated_memresource(res_table, |
178 | p->minimum, p->address_length); | 181 | p->minimum, p->address_length); |
@@ -252,9 +255,14 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, | |||
252 | break; | 255 | break; |
253 | 256 | ||
254 | case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64: | 257 | case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64: |
258 | if (res->data.ext_address64.producer_consumer == ACPI_PRODUCER) | ||
259 | return AE_OK; | ||
255 | break; | 260 | break; |
256 | 261 | ||
257 | case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: | 262 | case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: |
263 | if (res->data.extended_irq.producer_consumer == ACPI_PRODUCER) | ||
264 | return AE_OK; | ||
265 | |||
258 | for (i = 0; i < res->data.extended_irq.interrupt_count; i++) { | 266 | for (i = 0; i < res->data.extended_irq.interrupt_count; i++) { |
259 | pnpacpi_parse_allocated_irqresource(res_table, | 267 | pnpacpi_parse_allocated_irqresource(res_table, |
260 | res->data.extended_irq.interrupts[i], | 268 | res->data.extended_irq.interrupts[i], |
diff --git a/drivers/usb/input/ati_remote.c b/drivers/usb/input/ati_remote.c index df198cf76f52..3719fcb04b8f 100644 --- a/drivers/usb/input/ati_remote.c +++ b/drivers/usb/input/ati_remote.c | |||
@@ -111,14 +111,28 @@ | |||
111 | #define NAME_BUFSIZE 80 /* size of product name, path buffers */ | 111 | #define NAME_BUFSIZE 80 /* size of product name, path buffers */ |
112 | #define DATA_BUFSIZE 63 /* size of URB data buffers */ | 112 | #define DATA_BUFSIZE 63 /* size of URB data buffers */ |
113 | 113 | ||
114 | /* | ||
115 | * Duplicate event filtering time. | ||
116 | * Sequential, identical KIND_FILTERED inputs with less than | ||
117 | * FILTER_TIME milliseconds between them are considered as repeat | ||
118 | * events. The hardware generates 5 events for the first keypress | ||
119 | * and we have to take this into account for an accurate repeat | ||
120 | * behaviour. | ||
121 | */ | ||
122 | #define FILTER_TIME 60 /* msec */ | ||
123 | |||
114 | static unsigned long channel_mask; | 124 | static unsigned long channel_mask; |
115 | module_param(channel_mask, ulong, 0444); | 125 | module_param(channel_mask, ulong, 0644); |
116 | MODULE_PARM_DESC(channel_mask, "Bitmask of remote control channels to ignore"); | 126 | MODULE_PARM_DESC(channel_mask, "Bitmask of remote control channels to ignore"); |
117 | 127 | ||
118 | static int debug; | 128 | static int debug; |
119 | module_param(debug, int, 0444); | 129 | module_param(debug, int, 0644); |
120 | MODULE_PARM_DESC(debug, "Enable extra debug messages and information"); | 130 | MODULE_PARM_DESC(debug, "Enable extra debug messages and information"); |
121 | 131 | ||
132 | static int repeat_filter = FILTER_TIME; | ||
133 | module_param(repeat_filter, int, 0644); | ||
134 | MODULE_PARM_DESC(repeat_filter, "Repeat filter time, default = 60 msec"); | ||
135 | |||
122 | #define dbginfo(dev, format, arg...) do { if (debug) dev_info(dev , format , ## arg); } while (0) | 136 | #define dbginfo(dev, format, arg...) do { if (debug) dev_info(dev , format , ## arg); } while (0) |
123 | #undef err | 137 | #undef err |
124 | #define err(format, arg...) printk(KERN_ERR format , ## arg) | 138 | #define err(format, arg...) printk(KERN_ERR format , ## arg) |
@@ -143,18 +157,6 @@ MODULE_DEVICE_TABLE(usb, ati_remote_table); | |||
143 | static char init1[] = { 0x01, 0x00, 0x20, 0x14 }; | 157 | static char init1[] = { 0x01, 0x00, 0x20, 0x14 }; |
144 | static char init2[] = { 0x01, 0x00, 0x20, 0x14, 0x20, 0x20, 0x20 }; | 158 | static char init2[] = { 0x01, 0x00, 0x20, 0x14, 0x20, 0x20, 0x20 }; |
145 | 159 | ||
146 | /* Acceleration curve for directional control pad */ | ||
147 | static const char accel[] = { 1, 2, 4, 6, 9, 13, 20 }; | ||
148 | |||
149 | /* Duplicate event filtering time. | ||
150 | * Sequential, identical KIND_FILTERED inputs with less than | ||
151 | * FILTER_TIME jiffies between them are considered as repeat | ||
152 | * events. The hardware generates 5 events for the first keypress | ||
153 | * and we have to take this into account for an accurate repeat | ||
154 | * behaviour. | ||
155 | */ | ||
156 | #define FILTER_TIME 60 /* msec */ | ||
157 | |||
158 | struct ati_remote { | 160 | struct ati_remote { |
159 | struct input_dev *idev; | 161 | struct input_dev *idev; |
160 | struct usb_device *udev; | 162 | struct usb_device *udev; |
@@ -412,6 +414,43 @@ static int ati_remote_event_lookup(int rem, unsigned char d1, unsigned char d2) | |||
412 | } | 414 | } |
413 | 415 | ||
414 | /* | 416 | /* |
417 | * ati_remote_compute_accel | ||
418 | * | ||
419 | * Implements acceleration curve for directional control pad | ||
420 | * If elapsed time since last event is > 1/4 second, user "stopped", | ||
421 | * so reset acceleration. Otherwise, user is probably holding the control | ||
422 | * pad down, so we increase acceleration, ramping up over two seconds to | ||
423 | * a maximum speed. | ||
424 | */ | ||
425 | static int ati_remote_compute_accel(struct ati_remote *ati_remote) | ||
426 | { | ||
427 | static const char accel[] = { 1, 2, 4, 6, 9, 13, 20 }; | ||
428 | unsigned long now = jiffies; | ||
429 | int acc; | ||
430 | |||
431 | if (time_after(now, ati_remote->old_jiffies + msecs_to_jiffies(250))) { | ||
432 | acc = 1; | ||
433 | ati_remote->acc_jiffies = now; | ||
434 | } | ||
435 | else if (time_before(now, ati_remote->acc_jiffies + msecs_to_jiffies(125))) | ||
436 | acc = accel[0]; | ||
437 | else if (time_before(now, ati_remote->acc_jiffies + msecs_to_jiffies(250))) | ||
438 | acc = accel[1]; | ||
439 | else if (time_before(now, ati_remote->acc_jiffies + msecs_to_jiffies(500))) | ||
440 | acc = accel[2]; | ||
441 | else if (time_before(now, ati_remote->acc_jiffies + msecs_to_jiffies(1000))) | ||
442 | acc = accel[3]; | ||
443 | else if (time_before(now, ati_remote->acc_jiffies + msecs_to_jiffies(1500))) | ||
444 | acc = accel[4]; | ||
445 | else if (time_before(now, ati_remote->acc_jiffies + msecs_to_jiffies(2000))) | ||
446 | acc = accel[5]; | ||
447 | else | ||
448 | acc = accel[6]; | ||
449 | |||
450 | return acc; | ||
451 | } | ||
452 | |||
453 | /* | ||
415 | * ati_remote_report_input | 454 | * ati_remote_report_input |
416 | */ | 455 | */ |
417 | static void ati_remote_input_report(struct urb *urb, struct pt_regs *regs) | 456 | static void ati_remote_input_report(struct urb *urb, struct pt_regs *regs) |
@@ -464,9 +503,9 @@ static void ati_remote_input_report(struct urb *urb, struct pt_regs *regs) | |||
464 | 503 | ||
465 | if (ati_remote_tbl[index].kind == KIND_FILTERED) { | 504 | if (ati_remote_tbl[index].kind == KIND_FILTERED) { |
466 | /* Filter duplicate events which happen "too close" together. */ | 505 | /* Filter duplicate events which happen "too close" together. */ |
467 | if ((ati_remote->old_data[0] == data[1]) && | 506 | if (ati_remote->old_data[0] == data[1] && |
468 | (ati_remote->old_data[1] == data[2]) && | 507 | ati_remote->old_data[1] == data[2] && |
469 | time_before(jiffies, ati_remote->old_jiffies + msecs_to_jiffies(FILTER_TIME))) { | 508 | time_before(jiffies, ati_remote->old_jiffies + msecs_to_jiffies(repeat_filter))) { |
470 | ati_remote->repeat_count++; | 509 | ati_remote->repeat_count++; |
471 | } else { | 510 | } else { |
472 | ati_remote->repeat_count = 0; | 511 | ati_remote->repeat_count = 0; |
@@ -476,75 +515,61 @@ static void ati_remote_input_report(struct urb *urb, struct pt_regs *regs) | |||
476 | ati_remote->old_data[1] = data[2]; | 515 | ati_remote->old_data[1] = data[2]; |
477 | ati_remote->old_jiffies = jiffies; | 516 | ati_remote->old_jiffies = jiffies; |
478 | 517 | ||
479 | if ((ati_remote->repeat_count > 0) | 518 | if (ati_remote->repeat_count > 0 && |
480 | && (ati_remote->repeat_count < 5)) | 519 | ati_remote->repeat_count < 5) |
481 | return; | 520 | return; |
482 | 521 | ||
483 | 522 | ||
484 | input_regs(dev, regs); | 523 | input_regs(dev, regs); |
485 | input_event(dev, ati_remote_tbl[index].type, | 524 | input_event(dev, ati_remote_tbl[index].type, |
486 | ati_remote_tbl[index].code, 1); | 525 | ati_remote_tbl[index].code, 1); |
526 | input_sync(dev); | ||
487 | input_event(dev, ati_remote_tbl[index].type, | 527 | input_event(dev, ati_remote_tbl[index].type, |
488 | ati_remote_tbl[index].code, 0); | 528 | ati_remote_tbl[index].code, 0); |
489 | input_sync(dev); | 529 | input_sync(dev); |
490 | 530 | ||
491 | return; | 531 | } else { |
492 | } | ||
493 | 532 | ||
494 | /* | 533 | /* |
495 | * Other event kinds are from the directional control pad, and have an | 534 | * Other event kinds are from the directional control pad, and have an |
496 | * acceleration factor applied to them. Without this acceleration, the | 535 | * acceleration factor applied to them. Without this acceleration, the |
497 | * control pad is mostly unusable. | 536 | * control pad is mostly unusable. |
498 | * | 537 | */ |
499 | * If elapsed time since last event is > 1/4 second, user "stopped", | 538 | acc = ati_remote_compute_accel(ati_remote); |
500 | * so reset acceleration. Otherwise, user is probably holding the control | 539 | |
501 | * pad down, so we increase acceleration, ramping up over two seconds to | 540 | input_regs(dev, regs); |
502 | * a maximum speed. The acceleration curve is #defined above. | 541 | switch (ati_remote_tbl[index].kind) { |
503 | */ | 542 | case KIND_ACCEL: |
504 | if (time_after(jiffies, ati_remote->old_jiffies + (HZ >> 2))) { | 543 | input_event(dev, ati_remote_tbl[index].type, |
505 | acc = 1; | 544 | ati_remote_tbl[index].code, |
506 | ati_remote->acc_jiffies = jiffies; | 545 | ati_remote_tbl[index].value * acc); |
507 | } | 546 | break; |
508 | else if (time_before(jiffies, ati_remote->acc_jiffies + (HZ >> 3))) acc = accel[0]; | 547 | case KIND_LU: |
509 | else if (time_before(jiffies, ati_remote->acc_jiffies + (HZ >> 2))) acc = accel[1]; | 548 | input_report_rel(dev, REL_X, -acc); |
510 | else if (time_before(jiffies, ati_remote->acc_jiffies + (HZ >> 1))) acc = accel[2]; | 549 | input_report_rel(dev, REL_Y, -acc); |
511 | else if (time_before(jiffies, ati_remote->acc_jiffies + HZ)) acc = accel[3]; | 550 | break; |
512 | else if (time_before(jiffies, ati_remote->acc_jiffies + HZ+(HZ>>1))) acc = accel[4]; | 551 | case KIND_RU: |
513 | else if (time_before(jiffies, ati_remote->acc_jiffies + (HZ << 1))) acc = accel[5]; | 552 | input_report_rel(dev, REL_X, acc); |
514 | else acc = accel[6]; | 553 | input_report_rel(dev, REL_Y, -acc); |
515 | 554 | break; | |
516 | input_regs(dev, regs); | 555 | case KIND_LD: |
517 | switch (ati_remote_tbl[index].kind) { | 556 | input_report_rel(dev, REL_X, -acc); |
518 | case KIND_ACCEL: | 557 | input_report_rel(dev, REL_Y, acc); |
519 | input_event(dev, ati_remote_tbl[index].type, | 558 | break; |
520 | ati_remote_tbl[index].code, | 559 | case KIND_RD: |
521 | ati_remote_tbl[index].value * acc); | 560 | input_report_rel(dev, REL_X, acc); |
522 | break; | 561 | input_report_rel(dev, REL_Y, acc); |
523 | case KIND_LU: | 562 | break; |
524 | input_report_rel(dev, REL_X, -acc); | 563 | default: |
525 | input_report_rel(dev, REL_Y, -acc); | 564 | dev_dbg(&ati_remote->interface->dev, "ati_remote kind=%d\n", |
526 | break; | 565 | ati_remote_tbl[index].kind); |
527 | case KIND_RU: | 566 | } |
528 | input_report_rel(dev, REL_X, acc); | 567 | input_sync(dev); |
529 | input_report_rel(dev, REL_Y, -acc); | ||
530 | break; | ||
531 | case KIND_LD: | ||
532 | input_report_rel(dev, REL_X, -acc); | ||
533 | input_report_rel(dev, REL_Y, acc); | ||
534 | break; | ||
535 | case KIND_RD: | ||
536 | input_report_rel(dev, REL_X, acc); | ||
537 | input_report_rel(dev, REL_Y, acc); | ||
538 | break; | ||
539 | default: | ||
540 | dev_dbg(&ati_remote->interface->dev, "ati_remote kind=%d\n", | ||
541 | ati_remote_tbl[index].kind); | ||
542 | } | ||
543 | input_sync(dev); | ||
544 | 568 | ||
545 | ati_remote->old_jiffies = jiffies; | 569 | ati_remote->old_jiffies = jiffies; |
546 | ati_remote->old_data[0] = data[1]; | 570 | ati_remote->old_data[0] = data[1]; |
547 | ati_remote->old_data[1] = data[2]; | 571 | ati_remote->old_data[1] = data[2]; |
572 | } | ||
548 | } | 573 | } |
549 | 574 | ||
550 | /* | 575 | /* |
diff --git a/drivers/usb/input/hid-input.c b/drivers/usb/input/hid-input.c index 028e1ad89f5d..7208839f2dbf 100644 --- a/drivers/usb/input/hid-input.c +++ b/drivers/usb/input/hid-input.c | |||
@@ -607,7 +607,8 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel | |||
607 | 607 | ||
608 | } | 608 | } |
609 | 609 | ||
610 | if (usage->hat_min < usage->hat_max || usage->hat_dir) { | 610 | if (usage->type == EV_ABS && |
611 | (usage->hat_min < usage->hat_max || usage->hat_dir)) { | ||
611 | int i; | 612 | int i; |
612 | for (i = usage->code; i < usage->code + 2 && i <= max; i++) { | 613 | for (i = usage->code; i < usage->code + 2 && i <= max; i++) { |
613 | input_set_abs_params(input, i, -1, 1, 0, 0); | 614 | input_set_abs_params(input, i, -1, 1, 0, 0); |
diff --git a/drivers/usb/input/hiddev.c b/drivers/usb/input/hiddev.c index 70477f02cc29..f6b839c257a7 100644 --- a/drivers/usb/input/hiddev.c +++ b/drivers/usb/input/hiddev.c | |||
@@ -49,7 +49,7 @@ struct hiddev { | |||
49 | int open; | 49 | int open; |
50 | wait_queue_head_t wait; | 50 | wait_queue_head_t wait; |
51 | struct hid_device *hid; | 51 | struct hid_device *hid; |
52 | struct hiddev_list *list; | 52 | struct list_head list; |
53 | }; | 53 | }; |
54 | 54 | ||
55 | struct hiddev_list { | 55 | struct hiddev_list { |
@@ -59,7 +59,7 @@ struct hiddev_list { | |||
59 | unsigned flags; | 59 | unsigned flags; |
60 | struct fasync_struct *fasync; | 60 | struct fasync_struct *fasync; |
61 | struct hiddev *hiddev; | 61 | struct hiddev *hiddev; |
62 | struct hiddev_list *next; | 62 | struct list_head node; |
63 | }; | 63 | }; |
64 | 64 | ||
65 | static struct hiddev *hiddev_table[HIDDEV_MINORS]; | 65 | static struct hiddev *hiddev_table[HIDDEV_MINORS]; |
@@ -73,12 +73,15 @@ static struct hiddev *hiddev_table[HIDDEV_MINORS]; | |||
73 | static struct hid_report * | 73 | static struct hid_report * |
74 | hiddev_lookup_report(struct hid_device *hid, struct hiddev_report_info *rinfo) | 74 | hiddev_lookup_report(struct hid_device *hid, struct hiddev_report_info *rinfo) |
75 | { | 75 | { |
76 | unsigned flags = rinfo->report_id & ~HID_REPORT_ID_MASK; | 76 | unsigned int flags = rinfo->report_id & ~HID_REPORT_ID_MASK; |
77 | unsigned int rid = rinfo->report_id & HID_REPORT_ID_MASK; | ||
77 | struct hid_report_enum *report_enum; | 78 | struct hid_report_enum *report_enum; |
79 | struct hid_report *report; | ||
78 | struct list_head *list; | 80 | struct list_head *list; |
79 | 81 | ||
80 | if (rinfo->report_type < HID_REPORT_TYPE_MIN || | 82 | if (rinfo->report_type < HID_REPORT_TYPE_MIN || |
81 | rinfo->report_type > HID_REPORT_TYPE_MAX) return NULL; | 83 | rinfo->report_type > HID_REPORT_TYPE_MAX) |
84 | return NULL; | ||
82 | 85 | ||
83 | report_enum = hid->report_enum + | 86 | report_enum = hid->report_enum + |
84 | (rinfo->report_type - HID_REPORT_TYPE_MIN); | 87 | (rinfo->report_type - HID_REPORT_TYPE_MIN); |
@@ -88,21 +91,25 @@ hiddev_lookup_report(struct hid_device *hid, struct hiddev_report_info *rinfo) | |||
88 | break; | 91 | break; |
89 | 92 | ||
90 | case HID_REPORT_ID_FIRST: | 93 | case HID_REPORT_ID_FIRST: |
91 | list = report_enum->report_list.next; | 94 | if (list_empty(&report_enum->report_list)) |
92 | if (list == &report_enum->report_list) | ||
93 | return NULL; | 95 | return NULL; |
94 | rinfo->report_id = ((struct hid_report *) list)->id; | 96 | |
97 | list = report_enum->report_list.next; | ||
98 | report = list_entry(list, struct hid_report, list); | ||
99 | rinfo->report_id = report->id; | ||
95 | break; | 100 | break; |
96 | 101 | ||
97 | case HID_REPORT_ID_NEXT: | 102 | case HID_REPORT_ID_NEXT: |
98 | list = (struct list_head *) | 103 | report = report_enum->report_id_hash[rid]; |
99 | report_enum->report_id_hash[rinfo->report_id & HID_REPORT_ID_MASK]; | 104 | if (!report) |
100 | if (list == NULL) | ||
101 | return NULL; | 105 | return NULL; |
102 | list = list->next; | 106 | |
107 | list = report->list.next; | ||
103 | if (list == &report_enum->report_list) | 108 | if (list == &report_enum->report_list) |
104 | return NULL; | 109 | return NULL; |
105 | rinfo->report_id = ((struct hid_report *) list)->id; | 110 | |
111 | report = list_entry(list, struct hid_report, list); | ||
112 | rinfo->report_id = report->id; | ||
106 | break; | 113 | break; |
107 | 114 | ||
108 | default: | 115 | default: |
@@ -125,12 +132,13 @@ hiddev_lookup_usage(struct hid_device *hid, struct hiddev_usage_ref *uref) | |||
125 | struct hid_field *field; | 132 | struct hid_field *field; |
126 | 133 | ||
127 | if (uref->report_type < HID_REPORT_TYPE_MIN || | 134 | if (uref->report_type < HID_REPORT_TYPE_MIN || |
128 | uref->report_type > HID_REPORT_TYPE_MAX) return NULL; | 135 | uref->report_type > HID_REPORT_TYPE_MAX) |
136 | return NULL; | ||
129 | 137 | ||
130 | report_enum = hid->report_enum + | 138 | report_enum = hid->report_enum + |
131 | (uref->report_type - HID_REPORT_TYPE_MIN); | 139 | (uref->report_type - HID_REPORT_TYPE_MIN); |
132 | 140 | ||
133 | list_for_each_entry(report, &report_enum->report_list, list) | 141 | list_for_each_entry(report, &report_enum->report_list, list) { |
134 | for (i = 0; i < report->maxfield; i++) { | 142 | for (i = 0; i < report->maxfield; i++) { |
135 | field = report->field[i]; | 143 | field = report->field[i]; |
136 | for (j = 0; j < field->maxusage; j++) { | 144 | for (j = 0; j < field->maxusage; j++) { |
@@ -142,6 +150,7 @@ hiddev_lookup_usage(struct hid_device *hid, struct hiddev_usage_ref *uref) | |||
142 | } | 150 | } |
143 | } | 151 | } |
144 | } | 152 | } |
153 | } | ||
145 | 154 | ||
146 | return NULL; | 155 | return NULL; |
147 | } | 156 | } |
@@ -150,9 +159,9 @@ static void hiddev_send_event(struct hid_device *hid, | |||
150 | struct hiddev_usage_ref *uref) | 159 | struct hiddev_usage_ref *uref) |
151 | { | 160 | { |
152 | struct hiddev *hiddev = hid->hiddev; | 161 | struct hiddev *hiddev = hid->hiddev; |
153 | struct hiddev_list *list = hiddev->list; | 162 | struct hiddev_list *list; |
154 | 163 | ||
155 | while (list) { | 164 | list_for_each_entry(list, &hiddev->list, node) { |
156 | if (uref->field_index != HID_FIELD_INDEX_NONE || | 165 | if (uref->field_index != HID_FIELD_INDEX_NONE || |
157 | (list->flags & HIDDEV_FLAG_REPORT) != 0) { | 166 | (list->flags & HIDDEV_FLAG_REPORT) != 0) { |
158 | list->buffer[list->head] = *uref; | 167 | list->buffer[list->head] = *uref; |
@@ -160,8 +169,6 @@ static void hiddev_send_event(struct hid_device *hid, | |||
160 | (HIDDEV_BUFFER_SIZE - 1); | 169 | (HIDDEV_BUFFER_SIZE - 1); |
161 | kill_fasync(&list->fasync, SIGIO, POLL_IN); | 170 | kill_fasync(&list->fasync, SIGIO, POLL_IN); |
162 | } | 171 | } |
163 | |||
164 | list = list->next; | ||
165 | } | 172 | } |
166 | 173 | ||
167 | wake_up_interruptible(&hiddev->wait); | 174 | wake_up_interruptible(&hiddev->wait); |
@@ -180,7 +187,7 @@ void hiddev_hid_event(struct hid_device *hid, struct hid_field *field, | |||
180 | uref.report_type = | 187 | uref.report_type = |
181 | (type == HID_INPUT_REPORT) ? HID_REPORT_TYPE_INPUT : | 188 | (type == HID_INPUT_REPORT) ? HID_REPORT_TYPE_INPUT : |
182 | ((type == HID_OUTPUT_REPORT) ? HID_REPORT_TYPE_OUTPUT : | 189 | ((type == HID_OUTPUT_REPORT) ? HID_REPORT_TYPE_OUTPUT : |
183 | ((type == HID_FEATURE_REPORT) ? HID_REPORT_TYPE_FEATURE:0)); | 190 | ((type == HID_FEATURE_REPORT) ? HID_REPORT_TYPE_FEATURE : 0)); |
184 | uref.report_id = field->report->id; | 191 | uref.report_id = field->report->id; |
185 | uref.field_index = field->index; | 192 | uref.field_index = field->index; |
186 | uref.usage_index = (usage - field->usage); | 193 | uref.usage_index = (usage - field->usage); |
@@ -200,7 +207,7 @@ void hiddev_report_event(struct hid_device *hid, struct hid_report *report) | |||
200 | uref.report_type = | 207 | uref.report_type = |
201 | (type == HID_INPUT_REPORT) ? HID_REPORT_TYPE_INPUT : | 208 | (type == HID_INPUT_REPORT) ? HID_REPORT_TYPE_INPUT : |
202 | ((type == HID_OUTPUT_REPORT) ? HID_REPORT_TYPE_OUTPUT : | 209 | ((type == HID_OUTPUT_REPORT) ? HID_REPORT_TYPE_OUTPUT : |
203 | ((type == HID_FEATURE_REPORT) ? HID_REPORT_TYPE_FEATURE:0)); | 210 | ((type == HID_FEATURE_REPORT) ? HID_REPORT_TYPE_FEATURE : 0)); |
204 | uref.report_id = report->id; | 211 | uref.report_id = report->id; |
205 | uref.field_index = HID_FIELD_INDEX_NONE; | 212 | uref.field_index = HID_FIELD_INDEX_NONE; |
206 | 213 | ||
@@ -213,7 +220,9 @@ static int hiddev_fasync(int fd, struct file *file, int on) | |||
213 | { | 220 | { |
214 | int retval; | 221 | int retval; |
215 | struct hiddev_list *list = file->private_data; | 222 | struct hiddev_list *list = file->private_data; |
223 | |||
216 | retval = fasync_helper(fd, file, on, &list->fasync); | 224 | retval = fasync_helper(fd, file, on, &list->fasync); |
225 | |||
217 | return retval < 0 ? retval : 0; | 226 | return retval < 0 ? retval : 0; |
218 | } | 227 | } |
219 | 228 | ||
@@ -224,14 +233,9 @@ static int hiddev_fasync(int fd, struct file *file, int on) | |||
224 | static int hiddev_release(struct inode * inode, struct file * file) | 233 | static int hiddev_release(struct inode * inode, struct file * file) |
225 | { | 234 | { |
226 | struct hiddev_list *list = file->private_data; | 235 | struct hiddev_list *list = file->private_data; |
227 | struct hiddev_list **listptr; | ||
228 | 236 | ||
229 | listptr = &list->hiddev->list; | ||
230 | hiddev_fasync(-1, file, 0); | 237 | hiddev_fasync(-1, file, 0); |
231 | 238 | list_del(&list->node); | |
232 | while (*listptr && (*listptr != list)) | ||
233 | listptr = &((*listptr)->next); | ||
234 | *listptr = (*listptr)->next; | ||
235 | 239 | ||
236 | if (!--list->hiddev->open) { | 240 | if (!--list->hiddev->open) { |
237 | if (list->hiddev->exist) | 241 | if (list->hiddev->exist) |
@@ -248,7 +252,8 @@ static int hiddev_release(struct inode * inode, struct file * file) | |||
248 | /* | 252 | /* |
249 | * open file op | 253 | * open file op |
250 | */ | 254 | */ |
251 | static int hiddev_open(struct inode * inode, struct file * file) { | 255 | static int hiddev_open(struct inode *inode, struct file *file) |
256 | { | ||
252 | struct hiddev_list *list; | 257 | struct hiddev_list *list; |
253 | 258 | ||
254 | int i = iminor(inode) - HIDDEV_MINOR_BASE; | 259 | int i = iminor(inode) - HIDDEV_MINOR_BASE; |
@@ -260,9 +265,7 @@ static int hiddev_open(struct inode * inode, struct file * file) { | |||
260 | return -ENOMEM; | 265 | return -ENOMEM; |
261 | 266 | ||
262 | list->hiddev = hiddev_table[i]; | 267 | list->hiddev = hiddev_table[i]; |
263 | list->next = hiddev_table[i]->list; | 268 | list_add_tail(&list->node, &hiddev_table[i]->list); |
264 | hiddev_table[i]->list = list; | ||
265 | |||
266 | file->private_data = list; | 269 | file->private_data = list; |
267 | 270 | ||
268 | if (!list->hiddev->open++) | 271 | if (!list->hiddev->open++) |
@@ -362,6 +365,7 @@ static ssize_t hiddev_read(struct file * file, char __user * buffer, size_t coun | |||
362 | static unsigned int hiddev_poll(struct file *file, poll_table *wait) | 365 | static unsigned int hiddev_poll(struct file *file, poll_table *wait) |
363 | { | 366 | { |
364 | struct hiddev_list *list = file->private_data; | 367 | struct hiddev_list *list = file->private_data; |
368 | |||
365 | poll_wait(file, &list->hiddev->wait, wait); | 369 | poll_wait(file, &list->hiddev->wait, wait); |
366 | if (list->head != list->tail) | 370 | if (list->head != list->tail) |
367 | return POLLIN | POLLRDNORM; | 371 | return POLLIN | POLLRDNORM; |
@@ -382,7 +386,7 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, unsigned int cmd | |||
382 | struct hiddev_collection_info cinfo; | 386 | struct hiddev_collection_info cinfo; |
383 | struct hiddev_report_info rinfo; | 387 | struct hiddev_report_info rinfo; |
384 | struct hiddev_field_info finfo; | 388 | struct hiddev_field_info finfo; |
385 | struct hiddev_usage_ref_multi *uref_multi=NULL; | 389 | struct hiddev_usage_ref_multi *uref_multi = NULL; |
386 | struct hiddev_usage_ref *uref; | 390 | struct hiddev_usage_ref *uref; |
387 | struct hiddev_devinfo dinfo; | 391 | struct hiddev_devinfo dinfo; |
388 | struct hid_report *report; | 392 | struct hid_report *report; |
@@ -764,15 +768,15 @@ int hiddev_connect(struct hid_device *hid) | |||
764 | } | 768 | } |
765 | 769 | ||
766 | init_waitqueue_head(&hiddev->wait); | 770 | init_waitqueue_head(&hiddev->wait); |
767 | 771 | INIT_LIST_HEAD(&hiddev->list); | |
768 | hiddev_table[hid->intf->minor - HIDDEV_MINOR_BASE] = hiddev; | ||
769 | |||
770 | hiddev->hid = hid; | 772 | hiddev->hid = hid; |
771 | hiddev->exist = 1; | 773 | hiddev->exist = 1; |
772 | 774 | ||
773 | hid->minor = hid->intf->minor; | 775 | hid->minor = hid->intf->minor; |
774 | hid->hiddev = hiddev; | 776 | hid->hiddev = hiddev; |
775 | 777 | ||
778 | hiddev_table[hid->intf->minor - HIDDEV_MINOR_BASE] = hiddev; | ||
779 | |||
776 | return 0; | 780 | return 0; |
777 | } | 781 | } |
778 | 782 | ||
diff --git a/drivers/video/aty/aty128fb.c b/drivers/video/aty/aty128fb.c index 8b08121b390b..3e827e04a2aa 100644 --- a/drivers/video/aty/aty128fb.c +++ b/drivers/video/aty/aty128fb.c | |||
@@ -1913,9 +1913,6 @@ static int __devinit aty128_init(struct pci_dev *pdev, const struct pci_device_i | |||
1913 | u8 chip_rev; | 1913 | u8 chip_rev; |
1914 | u32 dac; | 1914 | u32 dac; |
1915 | 1915 | ||
1916 | if (!par->vram_size) /* may have already been probed */ | ||
1917 | par->vram_size = aty_ld_le32(CONFIG_MEMSIZE) & 0x03FFFFFF; | ||
1918 | |||
1919 | /* Get the chip revision */ | 1916 | /* Get the chip revision */ |
1920 | chip_rev = (aty_ld_le32(CONFIG_CNTL) >> 16) & 0x1F; | 1917 | chip_rev = (aty_ld_le32(CONFIG_CNTL) >> 16) & 0x1F; |
1921 | 1918 | ||
@@ -2028,9 +2025,6 @@ static int __devinit aty128_init(struct pci_dev *pdev, const struct pci_device_i | |||
2028 | 2025 | ||
2029 | aty128_init_engine(par); | 2026 | aty128_init_engine(par); |
2030 | 2027 | ||
2031 | if (register_framebuffer(info) < 0) | ||
2032 | return 0; | ||
2033 | |||
2034 | par->pm_reg = pci_find_capability(pdev, PCI_CAP_ID_PM); | 2028 | par->pm_reg = pci_find_capability(pdev, PCI_CAP_ID_PM); |
2035 | par->pdev = pdev; | 2029 | par->pdev = pdev; |
2036 | par->asleep = 0; | 2030 | par->asleep = 0; |
@@ -2040,6 +2034,9 @@ static int __devinit aty128_init(struct pci_dev *pdev, const struct pci_device_i | |||
2040 | aty128_bl_init(par); | 2034 | aty128_bl_init(par); |
2041 | #endif | 2035 | #endif |
2042 | 2036 | ||
2037 | if (register_framebuffer(info) < 0) | ||
2038 | return 0; | ||
2039 | |||
2043 | printk(KERN_INFO "fb%d: %s frame buffer device on %s\n", | 2040 | printk(KERN_INFO "fb%d: %s frame buffer device on %s\n", |
2044 | info->node, info->fix.id, video_card); | 2041 | info->node, info->fix.id, video_card); |
2045 | 2042 | ||
@@ -2089,7 +2086,6 @@ static int __devinit aty128_probe(struct pci_dev *pdev, const struct pci_device_ | |||
2089 | par = info->par; | 2086 | par = info->par; |
2090 | 2087 | ||
2091 | info->pseudo_palette = par->pseudo_palette; | 2088 | info->pseudo_palette = par->pseudo_palette; |
2092 | info->fix = aty128fb_fix; | ||
2093 | 2089 | ||
2094 | /* Virtualize mmio region */ | 2090 | /* Virtualize mmio region */ |
2095 | info->fix.mmio_start = reg_addr; | 2091 | info->fix.mmio_start = reg_addr; |
diff --git a/drivers/video/au1100fb.c b/drivers/video/au1100fb.c index a92a91fef16f..f25d5d648333 100644 --- a/drivers/video/au1100fb.c +++ b/drivers/video/au1100fb.c | |||
@@ -156,7 +156,7 @@ int au1100fb_setmode(struct au1100fb_device *fbdev) | |||
156 | 156 | ||
157 | info->fix.visual = FB_VISUAL_TRUECOLOR; | 157 | info->fix.visual = FB_VISUAL_TRUECOLOR; |
158 | info->fix.line_length = info->var.xres_virtual << 1; /* depth=16 */ | 158 | info->fix.line_length = info->var.xres_virtual << 1; /* depth=16 */ |
159 | } | 159 | } |
160 | } else { | 160 | } else { |
161 | /* mono */ | 161 | /* mono */ |
162 | info->fix.visual = FB_VISUAL_MONO10; | 162 | info->fix.visual = FB_VISUAL_MONO10; |
@@ -164,20 +164,16 @@ int au1100fb_setmode(struct au1100fb_device *fbdev) | |||
164 | } | 164 | } |
165 | 165 | ||
166 | info->screen_size = info->fix.line_length * info->var.yres_virtual; | 166 | info->screen_size = info->fix.line_length * info->var.yres_virtual; |
167 | info->var.rotate = ((fbdev->panel->control_base&LCD_CONTROL_SM_MASK) \ | ||
168 | >> LCD_CONTROL_SM_BIT) * 90; | ||
167 | 169 | ||
168 | /* Determine BPP mode and format */ | 170 | /* Determine BPP mode and format */ |
169 | fbdev->regs->lcd_control = fbdev->panel->control_base | | 171 | fbdev->regs->lcd_control = fbdev->panel->control_base; |
170 | ((info->var.rotate/90) << LCD_CONTROL_SM_BIT); | ||
171 | |||
172 | fbdev->regs->lcd_intenable = 0; | ||
173 | fbdev->regs->lcd_intstatus = 0; | ||
174 | |||
175 | fbdev->regs->lcd_horztiming = fbdev->panel->horztiming; | 172 | fbdev->regs->lcd_horztiming = fbdev->panel->horztiming; |
176 | |||
177 | fbdev->regs->lcd_verttiming = fbdev->panel->verttiming; | 173 | fbdev->regs->lcd_verttiming = fbdev->panel->verttiming; |
178 | |||
179 | fbdev->regs->lcd_clkcontrol = fbdev->panel->clkcontrol_base; | 174 | fbdev->regs->lcd_clkcontrol = fbdev->panel->clkcontrol_base; |
180 | 175 | fbdev->regs->lcd_intenable = 0; | |
176 | fbdev->regs->lcd_intstatus = 0; | ||
181 | fbdev->regs->lcd_dmaaddr0 = LCD_DMA_SA_N(fbdev->fb_phys); | 177 | fbdev->regs->lcd_dmaaddr0 = LCD_DMA_SA_N(fbdev->fb_phys); |
182 | 178 | ||
183 | if (panel_is_dual(fbdev->panel)) { | 179 | if (panel_is_dual(fbdev->panel)) { |
@@ -206,6 +202,8 @@ int au1100fb_setmode(struct au1100fb_device *fbdev) | |||
206 | 202 | ||
207 | /* Resume controller */ | 203 | /* Resume controller */ |
208 | fbdev->regs->lcd_control |= LCD_CONTROL_GO; | 204 | fbdev->regs->lcd_control |= LCD_CONTROL_GO; |
205 | mdelay(10); | ||
206 | au1100fb_fb_blank(VESA_NO_BLANKING, info); | ||
209 | 207 | ||
210 | return 0; | 208 | return 0; |
211 | } | 209 | } |