diff options
author | Dmitry Torokhov <dtor_core@ameritech.net> | 2005-09-15 02:01:44 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2005-10-28 09:52:52 -0700 |
commit | 2e5b636bb5f8dacbb91d08544e2c41ebcad5dace (patch) | |
tree | 059a2078d7b11713cad4675a9d8a062337957102 /drivers/input/mouse/amimouse.c | |
parent | d19fbe8a763634395d4bef40fc88cdb61c4a6274 (diff) |
[PATCH] drivers/input/mouse: convert to dynamic input_dev allocation
Input: convert drivers/input/mouse to dynamic input_dev allocation
This is required for input_dev sysfs integration
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/input/mouse/amimouse.c')
-rw-r--r-- | drivers/input/mouse/amimouse.c | 49 |
1 files changed, 24 insertions, 25 deletions
diff --git a/drivers/input/mouse/amimouse.c b/drivers/input/mouse/amimouse.c index e994849efb8f..d13d4c8fe3c5 100644 --- a/drivers/input/mouse/amimouse.c +++ b/drivers/input/mouse/amimouse.c @@ -34,10 +34,7 @@ MODULE_DESCRIPTION("Amiga mouse driver"); MODULE_LICENSE("GPL"); static int amimouse_lastx, amimouse_lasty; -static struct input_dev amimouse_dev; - -static char *amimouse_name = "Amiga mouse"; -static char *amimouse_phys = "amimouse/input0"; +static struct input_dev *amimouse_dev; static irqreturn_t amimouse_interrupt(int irq, void *dummy, struct pt_regs *fp) { @@ -62,16 +59,16 @@ static irqreturn_t amimouse_interrupt(int irq, void *dummy, struct pt_regs *fp) potgor = custom.potgor; - input_regs(&amimouse_dev, fp); + input_regs(amimouse_dev, fp); - input_report_rel(&amimouse_dev, REL_X, dx); - input_report_rel(&amimouse_dev, REL_Y, dy); + input_report_rel(amimouse_dev, REL_X, dx); + input_report_rel(amimouse_dev, REL_Y, dy); - input_report_key(&amimouse_dev, BTN_LEFT, ciaa.pra & 0x40); - input_report_key(&amimouse_dev, BTN_MIDDLE, potgor & 0x0100); - input_report_key(&amimouse_dev, BTN_RIGHT, potgor & 0x0400); + input_report_key(amimouse_dev, BTN_LEFT, ciaa.pra & 0x40); + input_report_key(amimouse_dev, BTN_MIDDLE, potgor & 0x0100); + input_report_key(amimouse_dev, BTN_RIGHT, potgor & 0x0400); - input_sync(&amimouse_dev); + input_sync(amimouse_dev); return IRQ_HANDLED; } @@ -103,28 +100,30 @@ static int __init amimouse_init(void) if (!MACH_IS_AMIGA || !AMIGAHW_PRESENT(AMI_MOUSE)) return -ENODEV; - amimouse_dev.evbit[0] = BIT(EV_KEY) | BIT(EV_REL); - amimouse_dev.relbit[0] = BIT(REL_X) | BIT(REL_Y); - amimouse_dev.keybit[LONG(BTN_LEFT)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT); - amimouse_dev.open = amimouse_open; - amimouse_dev.close = amimouse_close; + if (!(amimouse_dev = input_allocate_device())) + return -ENOMEM; + + amimouse_dev->name = "Amiga mouse"; + amimouse_dev->phys = "amimouse/input0"; + amimouse_dev->id.bustype = BUS_AMIGA; + amimouse_dev->id.vendor = 0x0001; + amimouse_dev->id.product = 0x0002; + amimouse_dev->id.version = 0x0100; - amimouse_dev.name = amimouse_name; - amimouse_dev.phys = amimouse_phys; - amimouse_dev.id.bustype = BUS_AMIGA; - amimouse_dev.id.vendor = 0x0001; - amimouse_dev.id.product = 0x0002; - amimouse_dev.id.version = 0x0100; + amimouse_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REL); + amimouse_dev->relbit[0] = BIT(REL_X) | BIT(REL_Y); + amimouse_dev->keybit[LONG(BTN_LEFT)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT); + amimouse_dev->open = amimouse_open; + amimouse_dev->close = amimouse_close; - input_register_device(&amimouse_dev); + input_register_device(amimouse_dev); - printk(KERN_INFO "input: %s at joy0dat\n", amimouse_name); return 0; } static void __exit amimouse_exit(void) { - input_unregister_device(&amimouse_dev); + input_unregister_device(amimouse_dev); } module_init(amimouse_init); |