aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/mouse
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2008-06-02 01:03:24 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2008-06-30 09:36:46 -0400
commit82547e9074a23d9d722a5f6053f4734566127da6 (patch)
tree1570f0ca3ada832e8b8417545afedc008ec570a8 /drivers/input/mouse
parent819561286b8eca845ce741141a016de2b51e90c7 (diff)
Input: atamouse - various cleanups
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/mouse')
-rw-r--r--drivers/input/mouse/atarimouse.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/drivers/input/mouse/atarimouse.c b/drivers/input/mouse/atarimouse.c
index 98a3561d4b05..adf45b3040e9 100644
--- a/drivers/input/mouse/atarimouse.c
+++ b/drivers/input/mouse/atarimouse.c
@@ -57,15 +57,12 @@ MODULE_AUTHOR("Michael Schmitz <schmitz@biophys.uni-duesseldorf.de>");
57MODULE_DESCRIPTION("Atari mouse driver"); 57MODULE_DESCRIPTION("Atari mouse driver");
58MODULE_LICENSE("GPL"); 58MODULE_LICENSE("GPL");
59 59
60static int mouse_threshold[2] = {2,2}; 60static int mouse_threshold[2] = {2, 2};
61module_param_array(mouse_threshold, int, NULL, 0);
61 62
62#ifdef __MODULE__
63MODULE_PARM(mouse_threshold, "2i");
64#endif
65#ifdef FIXED_ATARI_JOYSTICK 63#ifdef FIXED_ATARI_JOYSTICK
66extern int atari_mouse_buttons; 64extern int atari_mouse_buttons;
67#endif 65#endif
68static int atamouse_used = 0;
69 66
70static struct input_dev *atamouse_dev; 67static struct input_dev *atamouse_dev;
71 68
@@ -97,9 +94,6 @@ static void atamouse_interrupt(char *buf)
97 94
98static int atamouse_open(struct input_dev *dev) 95static int atamouse_open(struct input_dev *dev)
99{ 96{
100 if (atamouse_used++)
101 return 0;
102
103#ifdef FIXED_ATARI_JOYSTICK 97#ifdef FIXED_ATARI_JOYSTICK
104 atari_mouse_buttons = 0; 98 atari_mouse_buttons = 0;
105#endif 99#endif
@@ -107,23 +101,24 @@ static int atamouse_open(struct input_dev *dev)
107 ikbd_mouse_thresh(mouse_threshold[0], mouse_threshold[1]); 101 ikbd_mouse_thresh(mouse_threshold[0], mouse_threshold[1]);
108 ikbd_mouse_rel_pos(); 102 ikbd_mouse_rel_pos();
109 atari_input_mouse_interrupt_hook = atamouse_interrupt; 103 atari_input_mouse_interrupt_hook = atamouse_interrupt;
104
110 return 0; 105 return 0;
111} 106}
112 107
113static void atamouse_close(struct input_dev *dev) 108static void atamouse_close(struct input_dev *dev)
114{ 109{
115 if (!--atamouse_used) { 110 ikbd_mouse_disable();
116 ikbd_mouse_disable(); 111 atari_mouse_interrupt_hook = NULL;
117 atari_mouse_interrupt_hook = NULL;
118 }
119} 112}
120 113
121static int __init atamouse_init(void) 114static int __init atamouse_init(void)
122{ 115{
116 int error;
117
123 if (!MACH_IS_ATARI || !ATARIHW_PRESENT(ST_MFP)) 118 if (!MACH_IS_ATARI || !ATARIHW_PRESENT(ST_MFP))
124 return -ENODEV; 119 return -ENODEV;
125 120
126 if (!(atari_keyb_init())) 121 if (!atari_keyb_init())
127 return -ENODEV; 122 return -ENODEV;
128 123
129 atamouse_dev = input_allocate_device(); 124 atamouse_dev = input_allocate_device();
@@ -141,12 +136,14 @@ static int __init atamouse_init(void)
141 atamouse_dev->relbit[0] = BIT_MASK(REL_X) | BIT_MASK(REL_Y); 136 atamouse_dev->relbit[0] = BIT_MASK(REL_X) | BIT_MASK(REL_Y);
142 atamouse_dev->keybit[BIT_WORD(BTN_LEFT)] = BIT_MASK(BTN_LEFT) | 137 atamouse_dev->keybit[BIT_WORD(BTN_LEFT)] = BIT_MASK(BTN_LEFT) |
143 BIT_MASK(BTN_MIDDLE) | BIT_MASK(BTN_RIGHT); 138 BIT_MASK(BTN_MIDDLE) | BIT_MASK(BTN_RIGHT);
139
144 atamouse_dev->open = atamouse_open; 140 atamouse_dev->open = atamouse_open;
145 atamouse_dev->close = atamouse_close; 141 atamouse_dev->close = atamouse_close;
146 142
147 if (input_register_device(atamouse_dev)) { 143 error = input_register_device(atamouse_dev);
144 if (error) {
148 input_free_device(atamouse_dev); 145 input_free_device(atamouse_dev);
149 return -ENOMEM; 146 return error;
150 } 147 }
151 148
152 return 0; 149 return 0;