aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/mouse/rpcmouse.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/input/mouse/rpcmouse.c')
-rw-r--r--drivers/input/mouse/rpcmouse.c43
1 files changed, 21 insertions, 22 deletions
diff --git a/drivers/input/mouse/rpcmouse.c b/drivers/input/mouse/rpcmouse.c
index 8fe1212b8fd7..09b6ffdb7582 100644
--- a/drivers/input/mouse/rpcmouse.c
+++ b/drivers/input/mouse/rpcmouse.c
@@ -34,20 +34,7 @@ MODULE_DESCRIPTION("Acorn RiscPC mouse driver");
34MODULE_LICENSE("GPL"); 34MODULE_LICENSE("GPL");
35 35
36static short rpcmouse_lastx, rpcmouse_lasty; 36static short rpcmouse_lastx, rpcmouse_lasty;
37 37static struct input_dev *rpcmouse_dev;
38static struct input_dev rpcmouse_dev = {
39 .evbit = { BIT(EV_KEY) | BIT(EV_REL) },
40 .keybit = { [LONG(BTN_LEFT)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT) },
41 .relbit = { BIT(REL_X) | BIT(REL_Y) },
42 .name = "Acorn RiscPC Mouse",
43 .phys = "rpcmouse/input0",
44 .id = {
45 .bustype = BUS_HOST,
46 .vendor = 0x0005,
47 .product = 0x0001,
48 .version = 0x0100,
49 },
50};
51 38
52static irqreturn_t rpcmouse_irq(int irq, void *dev_id, struct pt_regs *regs) 39static irqreturn_t rpcmouse_irq(int irq, void *dev_id, struct pt_regs *regs)
53{ 40{
@@ -78,29 +65,41 @@ static irqreturn_t rpcmouse_irq(int irq, void *dev_id, struct pt_regs *regs)
78 return IRQ_HANDLED; 65 return IRQ_HANDLED;
79} 66}
80 67
68
81static int __init rpcmouse_init(void) 69static int __init rpcmouse_init(void)
82{ 70{
83 init_input_dev(&rpcmouse_dev); 71 if (!(rpcmouse_dev = input_allocate_device()))
72 return -ENOMEM;
73
74 rpcmouse_dev->name = "Acorn RiscPC Mouse";
75 rpcmouse_dev->phys = "rpcmouse/input0";
76 rpcmouse_dev->id.bustype = BUS_HOST;
77 rpcmouse_dev->id.vendor = 0x0005;
78 rpcmouse_dev->id.product = 0x0001;
79 rpcmouse_dev->id.version = 0x0100;
80
81 rpcmouse_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REL);
82 rpcmouse_dev->keybit[LONG(BTN_LEFT)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT);
83 rpcmouse_dev->relbit[0] = BIT(REL_X) | BIT(REL_Y);
84 84
85 rpcmouse_lastx = (short) iomd_readl(IOMD_MOUSEX); 85 rpcmouse_lastx = (short) iomd_readl(IOMD_MOUSEX);
86 rpcmouse_lasty = (short) iomd_readl(IOMD_MOUSEY); 86 rpcmouse_lasty = (short) iomd_readl(IOMD_MOUSEY);
87 87
88 if (request_irq(IRQ_VSYNCPULSE, rpcmouse_irq, SA_SHIRQ, "rpcmouse", &rpcmouse_dev)) { 88 if (request_irq(IRQ_VSYNCPULSE, rpcmouse_irq, SA_SHIRQ, "rpcmouse", rpcmouse_dev)) {
89 printk(KERN_ERR "rpcmouse: unable to allocate VSYNC interrupt\n"); 89 printk(KERN_ERR "rpcmouse: unable to allocate VSYNC interrupt\n");
90 return -1; 90 input_free_device(rpcmouse_dev);
91 return -EBUSY;
91 } 92 }
92 93
93 input_register_device(&rpcmouse_dev); 94 input_register_device(rpcmouse_dev);
94
95 printk(KERN_INFO "input: Acorn RiscPC mouse\n");
96 95
97 return 0; 96 return 0;
98} 97}
99 98
100static void __exit rpcmouse_exit(void) 99static void __exit rpcmouse_exit(void)
101{ 100{
102 input_unregister_device(&rpcmouse_dev); 101 free_irq(IRQ_VSYNCPULSE, rpcmouse_dev);
103 free_irq(IRQ_VSYNCPULSE, &rpcmouse_dev); 102 input_unregister_device(rpcmouse_dev);
104} 103}
105 104
106module_init(rpcmouse_init); 105module_init(rpcmouse_init);