diff options
author | Dmitry Torokhov <dtor_core@ameritech.net> | 2005-09-15 03:01:44 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2005-10-28 12:52:52 -0400 |
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"); | |||
34 | MODULE_LICENSE("GPL"); | 34 | MODULE_LICENSE("GPL"); |
35 | 35 | ||
36 | static int amimouse_lastx, amimouse_lasty; | 36 | static int amimouse_lastx, amimouse_lasty; |
37 | static struct input_dev amimouse_dev; | 37 | static struct input_dev *amimouse_dev; |
38 | |||
39 | static char *amimouse_name = "Amiga mouse"; | ||
40 | static char *amimouse_phys = "amimouse/input0"; | ||
41 | 38 | ||
42 | static irqreturn_t amimouse_interrupt(int irq, void *dummy, struct pt_regs *fp) | 39 | static irqreturn_t amimouse_interrupt(int irq, void *dummy, struct pt_regs *fp) |
43 | { | 40 | { |
@@ -62,16 +59,16 @@ static irqreturn_t amimouse_interrupt(int irq, void *dummy, struct pt_regs *fp) | |||
62 | 59 | ||
63 | potgor = custom.potgor; | 60 | potgor = custom.potgor; |
64 | 61 | ||
65 | input_regs(&amimouse_dev, fp); | 62 | input_regs(amimouse_dev, fp); |
66 | 63 | ||
67 | input_report_rel(&amimouse_dev, REL_X, dx); | 64 | input_report_rel(amimouse_dev, REL_X, dx); |
68 | input_report_rel(&amimouse_dev, REL_Y, dy); | 65 | input_report_rel(amimouse_dev, REL_Y, dy); |
69 | 66 | ||
70 | input_report_key(&amimouse_dev, BTN_LEFT, ciaa.pra & 0x40); | 67 | input_report_key(amimouse_dev, BTN_LEFT, ciaa.pra & 0x40); |
71 | input_report_key(&amimouse_dev, BTN_MIDDLE, potgor & 0x0100); | 68 | input_report_key(amimouse_dev, BTN_MIDDLE, potgor & 0x0100); |
72 | input_report_key(&amimouse_dev, BTN_RIGHT, potgor & 0x0400); | 69 | input_report_key(amimouse_dev, BTN_RIGHT, potgor & 0x0400); |
73 | 70 | ||
74 | input_sync(&amimouse_dev); | 71 | input_sync(amimouse_dev); |
75 | 72 | ||
76 | return IRQ_HANDLED; | 73 | return IRQ_HANDLED; |
77 | } | 74 | } |
@@ -103,28 +100,30 @@ static int __init amimouse_init(void) | |||
103 | if (!MACH_IS_AMIGA || !AMIGAHW_PRESENT(AMI_MOUSE)) | 100 | if (!MACH_IS_AMIGA || !AMIGAHW_PRESENT(AMI_MOUSE)) |
104 | return -ENODEV; | 101 | return -ENODEV; |
105 | 102 | ||
106 | amimouse_dev.evbit[0] = BIT(EV_KEY) | BIT(EV_REL); | 103 | if (!(amimouse_dev = input_allocate_device())) |
107 | amimouse_dev.relbit[0] = BIT(REL_X) | BIT(REL_Y); | 104 | return -ENOMEM; |
108 | amimouse_dev.keybit[LONG(BTN_LEFT)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT); | 105 | |
109 | amimouse_dev.open = amimouse_open; | 106 | amimouse_dev->name = "Amiga mouse"; |
110 | amimouse_dev.close = amimouse_close; | 107 | amimouse_dev->phys = "amimouse/input0"; |
108 | amimouse_dev->id.bustype = BUS_AMIGA; | ||
109 | amimouse_dev->id.vendor = 0x0001; | ||
110 | amimouse_dev->id.product = 0x0002; | ||
111 | amimouse_dev->id.version = 0x0100; | ||
111 | 112 | ||
112 | amimouse_dev.name = amimouse_name; | 113 | amimouse_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REL); |
113 | amimouse_dev.phys = amimouse_phys; | 114 | amimouse_dev->relbit[0] = BIT(REL_X) | BIT(REL_Y); |
114 | amimouse_dev.id.bustype = BUS_AMIGA; | 115 | amimouse_dev->keybit[LONG(BTN_LEFT)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT); |
115 | amimouse_dev.id.vendor = 0x0001; | 116 | amimouse_dev->open = amimouse_open; |
116 | amimouse_dev.id.product = 0x0002; | 117 | amimouse_dev->close = amimouse_close; |
117 | amimouse_dev.id.version = 0x0100; | ||
118 | 118 | ||
119 | input_register_device(&amimouse_dev); | 119 | input_register_device(amimouse_dev); |
120 | 120 | ||
121 | printk(KERN_INFO "input: %s at joy0dat\n", amimouse_name); | ||
122 | return 0; | 121 | return 0; |
123 | } | 122 | } |
124 | 123 | ||
125 | static void __exit amimouse_exit(void) | 124 | static void __exit amimouse_exit(void) |
126 | { | 125 | { |
127 | input_unregister_device(&amimouse_dev); | 126 | input_unregister_device(amimouse_dev); |
128 | } | 127 | } |
129 | 128 | ||
130 | module_init(amimouse_init); | 129 | module_init(amimouse_init); |