diff options
Diffstat (limited to 'drivers/input/keyboard/hilkbd.c')
-rw-r--r-- | drivers/input/keyboard/hilkbd.c | 53 |
1 files changed, 29 insertions, 24 deletions
diff --git a/drivers/input/keyboard/hilkbd.c b/drivers/input/keyboard/hilkbd.c index e95bc052e32a..33edd030aa75 100644 --- a/drivers/input/keyboard/hilkbd.c +++ b/drivers/input/keyboard/hilkbd.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * Copyright (C) 1998 Philip Blundell <philb@gnu.org> | 4 | * Copyright (C) 1998 Philip Blundell <philb@gnu.org> |
5 | * Copyright (C) 1999 Matthew Wilcox <willy@bofh.ai> | 5 | * Copyright (C) 1999 Matthew Wilcox <willy@bofh.ai> |
6 | * Copyright (C) 1999-2003 Helge Deller <deller@gmx.de> | 6 | * Copyright (C) 1999-2006 Helge Deller <deller@gmx.de> |
7 | * | 7 | * |
8 | * Very basic HP Human Interface Loop (HIL) driver. | 8 | * Very basic HP Human Interface Loop (HIL) driver. |
9 | * This driver handles the keyboard on HP300 (m68k) and on some | 9 | * This driver handles the keyboard on HP300 (m68k) and on some |
@@ -90,7 +90,7 @@ static unsigned int hphilkeyb_keycode[HIL_KEYCODES_SET1_TBLSIZE] = | |||
90 | 90 | ||
91 | /* HIL structure */ | 91 | /* HIL structure */ |
92 | static struct { | 92 | static struct { |
93 | struct input_dev dev; | 93 | struct input_dev *dev; |
94 | 94 | ||
95 | unsigned int curdev; | 95 | unsigned int curdev; |
96 | 96 | ||
@@ -117,7 +117,7 @@ static void poll_finished(void) | |||
117 | down = (hil_dev.data[1] & 1) == 0; | 117 | down = (hil_dev.data[1] & 1) == 0; |
118 | scode = hil_dev.data[1] >> 1; | 118 | scode = hil_dev.data[1] >> 1; |
119 | key = hphilkeyb_keycode[scode]; | 119 | key = hphilkeyb_keycode[scode]; |
120 | input_report_key(&hil_dev.dev, key, down); | 120 | input_report_key(hil_dev.dev, key, down); |
121 | break; | 121 | break; |
122 | } | 122 | } |
123 | hil_dev.curdev = 0; | 123 | hil_dev.curdev = 0; |
@@ -207,9 +207,14 @@ hil_keyb_init(void) | |||
207 | unsigned int i, kbid; | 207 | unsigned int i, kbid; |
208 | wait_queue_head_t hil_wait; | 208 | wait_queue_head_t hil_wait; |
209 | 209 | ||
210 | if (hil_dev.dev.id.bustype) { | 210 | if (hil_dev.dev) { |
211 | return -ENODEV; /* already initialized */ | 211 | return -ENODEV; /* already initialized */ |
212 | } | 212 | } |
213 | |||
214 | hil_dev.dev = input_allocate_device(); | ||
215 | if (!hil_dev.dev) | ||
216 | return -ENOMEM; | ||
217 | hil_dev.dev->private = &hil_dev; | ||
213 | 218 | ||
214 | #if defined(CONFIG_HP300) | 219 | #if defined(CONFIG_HP300) |
215 | if (!hwreg_present((void *)(HILBASE + HIL_DATA))) | 220 | if (!hwreg_present((void *)(HILBASE + HIL_DATA))) |
@@ -247,28 +252,26 @@ hil_keyb_init(void) | |||
247 | c = 0; | 252 | c = 0; |
248 | hil_do(HIL_WRITEKBDSADR, &c, 1); | 253 | hil_do(HIL_WRITEKBDSADR, &c, 1); |
249 | 254 | ||
250 | init_input_dev(&hil_dev.dev); | ||
251 | |||
252 | for (i = 0; i < HIL_KEYCODES_SET1_TBLSIZE; i++) | 255 | for (i = 0; i < HIL_KEYCODES_SET1_TBLSIZE; i++) |
253 | if (hphilkeyb_keycode[i] != KEY_RESERVED) | 256 | if (hphilkeyb_keycode[i] != KEY_RESERVED) |
254 | set_bit(hphilkeyb_keycode[i], hil_dev.dev.keybit); | 257 | set_bit(hphilkeyb_keycode[i], hil_dev.dev->keybit); |
255 | 258 | ||
256 | hil_dev.dev.evbit[0] = BIT(EV_KEY) | BIT(EV_REP); | 259 | hil_dev.dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP); |
257 | hil_dev.dev.ledbit[0] = BIT(LED_NUML) | BIT(LED_CAPSL) | BIT(LED_SCROLLL); | 260 | hil_dev.dev->ledbit[0] = BIT(LED_NUML) | BIT(LED_CAPSL) | BIT(LED_SCROLLL); |
258 | hil_dev.dev.keycodemax = HIL_KEYCODES_SET1_TBLSIZE; | 261 | hil_dev.dev->keycodemax = HIL_KEYCODES_SET1_TBLSIZE; |
259 | hil_dev.dev.keycodesize = sizeof(hphilkeyb_keycode[0]); | 262 | hil_dev.dev->keycodesize = sizeof(hphilkeyb_keycode[0]); |
260 | hil_dev.dev.keycode = hphilkeyb_keycode; | 263 | hil_dev.dev->keycode = hphilkeyb_keycode; |
261 | hil_dev.dev.name = "HIL keyboard"; | 264 | hil_dev.dev->name = "HIL keyboard"; |
262 | hil_dev.dev.phys = "hpkbd/input0"; | 265 | hil_dev.dev->phys = "hpkbd/input0"; |
263 | 266 | ||
264 | hil_dev.dev.id.bustype = BUS_HIL; | 267 | hil_dev.dev->id.bustype = BUS_HIL; |
265 | hil_dev.dev.id.vendor = PCI_VENDOR_ID_HP; | 268 | hil_dev.dev->id.vendor = PCI_VENDOR_ID_HP; |
266 | hil_dev.dev.id.product = 0x0001; | 269 | hil_dev.dev->id.product = 0x0001; |
267 | hil_dev.dev.id.version = 0x0010; | 270 | hil_dev.dev->id.version = 0x0010; |
268 | 271 | ||
269 | input_register_device(&hil_dev.dev); | 272 | input_register_device(hil_dev.dev); |
270 | printk(KERN_INFO "input: %s, ID %d at 0x%08lx (irq %d) found and attached\n", | 273 | printk(KERN_INFO "input: %s, ID %d at 0x%08lx (irq %d) found and attached\n", |
271 | hil_dev.dev.name, kbid, HILBASE, HIL_IRQ); | 274 | hil_dev.dev->name, kbid, HILBASE, HIL_IRQ); |
272 | 275 | ||
273 | return 0; | 276 | return 0; |
274 | } | 277 | } |
@@ -329,7 +332,9 @@ static void __exit hil_exit(void) | |||
329 | /* Turn off interrupts */ | 332 | /* Turn off interrupts */ |
330 | hil_do(HIL_INTOFF, NULL, 0); | 333 | hil_do(HIL_INTOFF, NULL, 0); |
331 | 334 | ||
332 | input_unregister_device(&hil_dev.dev); | 335 | input_unregister_device(hil_dev.dev); |
336 | |||
337 | hil_dev.dev = NULL; | ||
333 | 338 | ||
334 | #if defined(CONFIG_PARISC) | 339 | #if defined(CONFIG_PARISC) |
335 | unregister_parisc_driver(&hil_driver); | 340 | unregister_parisc_driver(&hil_driver); |