X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Finput%2Fkeyboard%2Fhilkbd.c;h=e95bc052e32a3ec6ab406ed74c90be0cfc811606;hb=987b0145d94eecf292d8b301228356f44611ab7c;hp=33edd030aa758048f6b9ab11bd0463609da4c6ab;hpb=f7ed79d23a47594e7834d66a8f14449796d4f3e6;p=linux-2.6.git diff --git a/drivers/input/keyboard/hilkbd.c b/drivers/input/keyboard/hilkbd.c index 33edd030a..e95bc052e 100644 --- a/drivers/input/keyboard/hilkbd.c +++ b/drivers/input/keyboard/hilkbd.c @@ -3,7 +3,7 @@ * * Copyright (C) 1998 Philip Blundell * Copyright (C) 1999 Matthew Wilcox - * Copyright (C) 1999-2006 Helge Deller + * Copyright (C) 1999-2003 Helge Deller * * Very basic HP Human Interface Loop (HIL) driver. * This driver handles the keyboard on HP300 (m68k) and on some @@ -90,7 +90,7 @@ static unsigned int hphilkeyb_keycode[HIL_KEYCODES_SET1_TBLSIZE] = /* HIL structure */ static struct { - struct input_dev *dev; + struct input_dev dev; unsigned int curdev; @@ -117,7 +117,7 @@ static void poll_finished(void) down = (hil_dev.data[1] & 1) == 0; scode = hil_dev.data[1] >> 1; key = hphilkeyb_keycode[scode]; - input_report_key(hil_dev.dev, key, down); + input_report_key(&hil_dev.dev, key, down); break; } hil_dev.curdev = 0; @@ -207,14 +207,9 @@ hil_keyb_init(void) unsigned int i, kbid; wait_queue_head_t hil_wait; - if (hil_dev.dev) { + if (hil_dev.dev.id.bustype) { return -ENODEV; /* already initialized */ } - - hil_dev.dev = input_allocate_device(); - if (!hil_dev.dev) - return -ENOMEM; - hil_dev.dev->private = &hil_dev; #if defined(CONFIG_HP300) if (!hwreg_present((void *)(HILBASE + HIL_DATA))) @@ -252,26 +247,28 @@ hil_keyb_init(void) c = 0; hil_do(HIL_WRITEKBDSADR, &c, 1); + init_input_dev(&hil_dev.dev); + for (i = 0; i < HIL_KEYCODES_SET1_TBLSIZE; i++) if (hphilkeyb_keycode[i] != KEY_RESERVED) - set_bit(hphilkeyb_keycode[i], hil_dev.dev->keybit); - - hil_dev.dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP); - hil_dev.dev->ledbit[0] = BIT(LED_NUML) | BIT(LED_CAPSL) | BIT(LED_SCROLLL); - hil_dev.dev->keycodemax = HIL_KEYCODES_SET1_TBLSIZE; - hil_dev.dev->keycodesize = sizeof(hphilkeyb_keycode[0]); - hil_dev.dev->keycode = hphilkeyb_keycode; - hil_dev.dev->name = "HIL keyboard"; - hil_dev.dev->phys = "hpkbd/input0"; - - hil_dev.dev->id.bustype = BUS_HIL; - hil_dev.dev->id.vendor = PCI_VENDOR_ID_HP; - hil_dev.dev->id.product = 0x0001; - hil_dev.dev->id.version = 0x0010; - - input_register_device(hil_dev.dev); + set_bit(hphilkeyb_keycode[i], hil_dev.dev.keybit); + + hil_dev.dev.evbit[0] = BIT(EV_KEY) | BIT(EV_REP); + hil_dev.dev.ledbit[0] = BIT(LED_NUML) | BIT(LED_CAPSL) | BIT(LED_SCROLLL); + hil_dev.dev.keycodemax = HIL_KEYCODES_SET1_TBLSIZE; + hil_dev.dev.keycodesize = sizeof(hphilkeyb_keycode[0]); + hil_dev.dev.keycode = hphilkeyb_keycode; + hil_dev.dev.name = "HIL keyboard"; + hil_dev.dev.phys = "hpkbd/input0"; + + hil_dev.dev.id.bustype = BUS_HIL; + hil_dev.dev.id.vendor = PCI_VENDOR_ID_HP; + hil_dev.dev.id.product = 0x0001; + hil_dev.dev.id.version = 0x0010; + + input_register_device(&hil_dev.dev); printk(KERN_INFO "input: %s, ID %d at 0x%08lx (irq %d) found and attached\n", - hil_dev.dev->name, kbid, HILBASE, HIL_IRQ); + hil_dev.dev.name, kbid, HILBASE, HIL_IRQ); return 0; } @@ -332,9 +329,7 @@ static void __exit hil_exit(void) /* Turn off interrupts */ hil_do(HIL_INTOFF, NULL, 0); - input_unregister_device(hil_dev.dev); - - hil_dev.dev = NULL; + input_unregister_device(&hil_dev.dev); #if defined(CONFIG_PARISC) unregister_parisc_driver(&hil_driver);