diff options
Diffstat (limited to 'drivers/input/mouse')
-rw-r--r-- | drivers/input/mouse/amimouse.c | 11 | ||||
-rw-r--r-- | drivers/input/mouse/hil_ptr.c | 3 | ||||
-rw-r--r-- | drivers/input/mouse/inport.c | 23 | ||||
-rw-r--r-- | drivers/input/mouse/lifebook.c | 82 | ||||
-rw-r--r-- | drivers/input/mouse/logibm.c | 24 | ||||
-rw-r--r-- | drivers/input/mouse/logips2pp.c | 11 | ||||
-rw-r--r-- | drivers/input/mouse/pc110pad.c | 26 | ||||
-rw-r--r-- | drivers/input/mouse/psmouse-base.c | 101 | ||||
-rw-r--r-- | drivers/input/mouse/rpcmouse.c | 20 | ||||
-rw-r--r-- | drivers/input/mouse/sermouse.c | 16 | ||||
-rw-r--r-- | drivers/input/mouse/trackpoint.c | 12 | ||||
-rw-r--r-- | drivers/input/mouse/vsxxxaa.c | 16 |
12 files changed, 231 insertions, 114 deletions
diff --git a/drivers/input/mouse/amimouse.c b/drivers/input/mouse/amimouse.c index 599a7b2dc519..239a0e16d91a 100644 --- a/drivers/input/mouse/amimouse.c +++ b/drivers/input/mouse/amimouse.c | |||
@@ -95,10 +95,13 @@ static void amimouse_close(struct input_dev *dev) | |||
95 | 95 | ||
96 | static int __init amimouse_init(void) | 96 | static int __init amimouse_init(void) |
97 | { | 97 | { |
98 | int err; | ||
99 | |||
98 | if (!MACH_IS_AMIGA || !AMIGAHW_PRESENT(AMI_MOUSE)) | 100 | if (!MACH_IS_AMIGA || !AMIGAHW_PRESENT(AMI_MOUSE)) |
99 | return -ENODEV; | 101 | return -ENODEV; |
100 | 102 | ||
101 | if (!(amimouse_dev = input_allocate_device())) | 103 | amimouse_dev = input_allocate_device(); |
104 | if (!amimouse_dev) | ||
102 | return -ENOMEM; | 105 | return -ENOMEM; |
103 | 106 | ||
104 | amimouse_dev->name = "Amiga mouse"; | 107 | amimouse_dev->name = "Amiga mouse"; |
@@ -114,7 +117,11 @@ static int __init amimouse_init(void) | |||
114 | amimouse_dev->open = amimouse_open; | 117 | amimouse_dev->open = amimouse_open; |
115 | amimouse_dev->close = amimouse_close; | 118 | amimouse_dev->close = amimouse_close; |
116 | 119 | ||
117 | input_register_device(amimouse_dev); | 120 | err = input_register_device(amimouse_dev); |
121 | if (err) { | ||
122 | input_free_device(amimouse_dev); | ||
123 | return err; | ||
124 | } | ||
118 | 125 | ||
119 | return 0; | 126 | return 0; |
120 | } | 127 | } |
diff --git a/drivers/input/mouse/hil_ptr.c b/drivers/input/mouse/hil_ptr.c index 4f2b503c1ac7..bfb174fe3230 100644 --- a/drivers/input/mouse/hil_ptr.c +++ b/drivers/input/mouse/hil_ptr.c | |||
@@ -417,8 +417,7 @@ static struct serio_driver hil_ptr_serio_driver = { | |||
417 | 417 | ||
418 | static int __init hil_ptr_init(void) | 418 | static int __init hil_ptr_init(void) |
419 | { | 419 | { |
420 | serio_register_driver(&hil_ptr_serio_driver); | 420 | return serio_register_driver(&hil_ptr_serio_driver); |
421 | return 0; | ||
422 | } | 421 | } |
423 | 422 | ||
424 | static void __exit hil_ptr_exit(void) | 423 | static void __exit hil_ptr_exit(void) |
diff --git a/drivers/input/mouse/inport.c b/drivers/input/mouse/inport.c index e1252fa9a107..13dd96785e39 100644 --- a/drivers/input/mouse/inport.c +++ b/drivers/input/mouse/inport.c | |||
@@ -135,6 +135,7 @@ static void inport_close(struct input_dev *dev) | |||
135 | static int __init inport_init(void) | 135 | static int __init inport_init(void) |
136 | { | 136 | { |
137 | unsigned char a, b, c; | 137 | unsigned char a, b, c; |
138 | int err; | ||
138 | 139 | ||
139 | if (!request_region(INPORT_BASE, INPORT_EXTENT, "inport")) { | 140 | if (!request_region(INPORT_BASE, INPORT_EXTENT, "inport")) { |
140 | printk(KERN_ERR "inport.c: Can't allocate ports at %#x\n", INPORT_BASE); | 141 | printk(KERN_ERR "inport.c: Can't allocate ports at %#x\n", INPORT_BASE); |
@@ -145,15 +146,16 @@ static int __init inport_init(void) | |||
145 | b = inb(INPORT_SIGNATURE_PORT); | 146 | b = inb(INPORT_SIGNATURE_PORT); |
146 | c = inb(INPORT_SIGNATURE_PORT); | 147 | c = inb(INPORT_SIGNATURE_PORT); |
147 | if (a == b || a != c) { | 148 | if (a == b || a != c) { |
148 | release_region(INPORT_BASE, INPORT_EXTENT); | ||
149 | printk(KERN_ERR "inport.c: Didn't find InPort mouse at %#x\n", INPORT_BASE); | 149 | printk(KERN_ERR "inport.c: Didn't find InPort mouse at %#x\n", INPORT_BASE); |
150 | return -ENODEV; | 150 | err = -ENODEV; |
151 | goto err_release_region; | ||
151 | } | 152 | } |
152 | 153 | ||
153 | if (!(inport_dev = input_allocate_device())) { | 154 | inport_dev = input_allocate_device(); |
155 | if (!inport_dev) { | ||
154 | printk(KERN_ERR "inport.c: Not enough memory for input device\n"); | 156 | printk(KERN_ERR "inport.c: Not enough memory for input device\n"); |
155 | release_region(INPORT_BASE, INPORT_EXTENT); | 157 | err = -ENOMEM; |
156 | return -ENOMEM; | 158 | goto err_release_region; |
157 | } | 159 | } |
158 | 160 | ||
159 | inport_dev->name = INPORT_NAME; | 161 | inport_dev->name = INPORT_NAME; |
@@ -174,9 +176,18 @@ static int __init inport_init(void) | |||
174 | outb(INPORT_REG_MODE, INPORT_CONTROL_PORT); | 176 | outb(INPORT_REG_MODE, INPORT_CONTROL_PORT); |
175 | outb(INPORT_MODE_BASE, INPORT_DATA_PORT); | 177 | outb(INPORT_MODE_BASE, INPORT_DATA_PORT); |
176 | 178 | ||
177 | input_register_device(inport_dev); | 179 | err = input_register_device(inport_dev); |
180 | if (err) | ||
181 | goto err_free_dev; | ||
178 | 182 | ||
179 | return 0; | 183 | return 0; |
184 | |||
185 | err_free_dev: | ||
186 | input_free_device(inport_dev); | ||
187 | err_release_region: | ||
188 | release_region(INPORT_BASE, INPORT_EXTENT); | ||
189 | |||
190 | return err; | ||
180 | } | 191 | } |
181 | 192 | ||
182 | static void __exit inport_exit(void) | 193 | static void __exit inport_exit(void) |
diff --git a/drivers/input/mouse/lifebook.c b/drivers/input/mouse/lifebook.c index c57e8853b949..29542f0631cb 100644 --- a/drivers/input/mouse/lifebook.c +++ b/drivers/input/mouse/lifebook.c | |||
@@ -21,47 +21,51 @@ | |||
21 | #include "lifebook.h" | 21 | #include "lifebook.h" |
22 | 22 | ||
23 | static struct dmi_system_id lifebook_dmi_table[] = { | 23 | static struct dmi_system_id lifebook_dmi_table[] = { |
24 | { | 24 | { |
25 | .ident = "LifeBook B", | 25 | .ident = "FLORA-ie 55mi", |
26 | .matches = { | 26 | .matches = { |
27 | DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook B Series"), | 27 | DMI_MATCH(DMI_PRODUCT_NAME, "FLORA-ie 55mi"), |
28 | }, | 28 | }, |
29 | }, | 29 | }, |
30 | { | 30 | { |
31 | .ident = "Lifebook B", | 31 | .ident = "LifeBook B", |
32 | .matches = { | 32 | .matches = { |
33 | DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK B Series"), | 33 | DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook B Series"), |
34 | }, | 34 | }, |
35 | }, | 35 | }, |
36 | { | 36 | { |
37 | .ident = "Lifebook B213x/B2150", | 37 | .ident = "Lifebook B", |
38 | .matches = { | 38 | .matches = { |
39 | DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook B2131/B2133/B2150"), | 39 | DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK B Series"), |
40 | }, | 40 | }, |
41 | }, | 41 | }, |
42 | { | 42 | { |
43 | .ident = "Zephyr", | 43 | .ident = "Lifebook B213x/B2150", |
44 | .matches = { | 44 | .matches = { |
45 | DMI_MATCH(DMI_PRODUCT_NAME, "ZEPHYR"), | 45 | DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook B2131/B2133/B2150"), |
46 | }, | 46 | }, |
47 | }, | 47 | }, |
48 | { | 48 | { |
49 | .ident = "CF-18", | 49 | .ident = "Zephyr", |
50 | .matches = { | 50 | .matches = { |
51 | DMI_MATCH(DMI_PRODUCT_NAME, "CF-18"), | 51 | DMI_MATCH(DMI_PRODUCT_NAME, "ZEPHYR"), |
52 | }, | 52 | }, |
53 | }, | 53 | }, |
54 | { | 54 | { |
55 | .ident = "Lifebook B142", | 55 | .ident = "CF-18", |
56 | .matches = { | 56 | .matches = { |
57 | DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook B142"), | 57 | DMI_MATCH(DMI_PRODUCT_NAME, "CF-18"), |
58 | }, | 58 | }, |
59 | 59 | }, | |
60 | }, | 60 | { |
61 | { } | 61 | .ident = "Lifebook B142", |
62 | .matches = { | ||
63 | DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook B142"), | ||
64 | }, | ||
65 | }, | ||
66 | { } | ||
62 | }; | 67 | }; |
63 | 68 | ||
64 | |||
65 | static psmouse_ret_t lifebook_process_byte(struct psmouse *psmouse) | 69 | static psmouse_ret_t lifebook_process_byte(struct psmouse *psmouse) |
66 | { | 70 | { |
67 | unsigned char *packet = psmouse->packet; | 71 | unsigned char *packet = psmouse->packet; |
diff --git a/drivers/input/mouse/logibm.c b/drivers/input/mouse/logibm.c index 8e9c2f3d69a8..db205995bffd 100644 --- a/drivers/input/mouse/logibm.c +++ b/drivers/input/mouse/logibm.c | |||
@@ -124,6 +124,8 @@ static void logibm_close(struct input_dev *dev) | |||
124 | 124 | ||
125 | static int __init logibm_init(void) | 125 | static int __init logibm_init(void) |
126 | { | 126 | { |
127 | int err; | ||
128 | |||
127 | if (!request_region(LOGIBM_BASE, LOGIBM_EXTENT, "logibm")) { | 129 | if (!request_region(LOGIBM_BASE, LOGIBM_EXTENT, "logibm")) { |
128 | printk(KERN_ERR "logibm.c: Can't allocate ports at %#x\n", LOGIBM_BASE); | 130 | printk(KERN_ERR "logibm.c: Can't allocate ports at %#x\n", LOGIBM_BASE); |
129 | return -EBUSY; | 131 | return -EBUSY; |
@@ -134,18 +136,19 @@ static int __init logibm_init(void) | |||
134 | udelay(100); | 136 | udelay(100); |
135 | 137 | ||
136 | if (inb(LOGIBM_SIGNATURE_PORT) != LOGIBM_SIGNATURE_BYTE) { | 138 | if (inb(LOGIBM_SIGNATURE_PORT) != LOGIBM_SIGNATURE_BYTE) { |
137 | release_region(LOGIBM_BASE, LOGIBM_EXTENT); | ||
138 | printk(KERN_ERR "logibm.c: Didn't find Logitech busmouse at %#x\n", LOGIBM_BASE); | 139 | printk(KERN_ERR "logibm.c: Didn't find Logitech busmouse at %#x\n", LOGIBM_BASE); |
139 | return -ENODEV; | 140 | err = -ENODEV; |
141 | goto err_release_region; | ||
140 | } | 142 | } |
141 | 143 | ||
142 | outb(LOGIBM_DEFAULT_MODE, LOGIBM_CONFIG_PORT); | 144 | outb(LOGIBM_DEFAULT_MODE, LOGIBM_CONFIG_PORT); |
143 | outb(LOGIBM_DISABLE_IRQ, LOGIBM_CONTROL_PORT); | 145 | outb(LOGIBM_DISABLE_IRQ, LOGIBM_CONTROL_PORT); |
144 | 146 | ||
145 | if (!(logibm_dev = input_allocate_device())) { | 147 | logibm_dev = input_allocate_device(); |
148 | if (!logibm_dev) { | ||
146 | printk(KERN_ERR "logibm.c: Not enough memory for input device\n"); | 149 | printk(KERN_ERR "logibm.c: Not enough memory for input device\n"); |
147 | release_region(LOGIBM_BASE, LOGIBM_EXTENT); | 150 | err = -ENOMEM; |
148 | return -ENOMEM; | 151 | goto err_release_region; |
149 | } | 152 | } |
150 | 153 | ||
151 | logibm_dev->name = "Logitech bus mouse"; | 154 | logibm_dev->name = "Logitech bus mouse"; |
@@ -162,9 +165,18 @@ static int __init logibm_init(void) | |||
162 | logibm_dev->open = logibm_open; | 165 | logibm_dev->open = logibm_open; |
163 | logibm_dev->close = logibm_close; | 166 | logibm_dev->close = logibm_close; |
164 | 167 | ||
165 | input_register_device(logibm_dev); | 168 | err = input_register_device(logibm_dev); |
169 | if (err) | ||
170 | goto err_free_dev; | ||
166 | 171 | ||
167 | return 0; | 172 | return 0; |
173 | |||
174 | err_free_dev: | ||
175 | input_free_device(logibm_dev); | ||
176 | err_release_region: | ||
177 | release_region(LOGIBM_BASE, LOGIBM_EXTENT); | ||
178 | |||
179 | return err; | ||
168 | } | 180 | } |
169 | 181 | ||
170 | static void __exit logibm_exit(void) | 182 | static void __exit logibm_exit(void) |
diff --git a/drivers/input/mouse/logips2pp.c b/drivers/input/mouse/logips2pp.c index 8a4f862709e7..d3ddea26b8ca 100644 --- a/drivers/input/mouse/logips2pp.c +++ b/drivers/input/mouse/logips2pp.c | |||
@@ -328,6 +328,7 @@ int ps2pp_init(struct psmouse *psmouse, int set_properties) | |||
328 | unsigned char model, buttons; | 328 | unsigned char model, buttons; |
329 | const struct ps2pp_info *model_info; | 329 | const struct ps2pp_info *model_info; |
330 | int use_ps2pp = 0; | 330 | int use_ps2pp = 0; |
331 | int error; | ||
331 | 332 | ||
332 | param[0] = 0; | 333 | param[0] = 0; |
333 | ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES); | 334 | ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES); |
@@ -393,8 +394,14 @@ int ps2pp_init(struct psmouse *psmouse, int set_properties) | |||
393 | psmouse->set_resolution = ps2pp_set_resolution; | 394 | psmouse->set_resolution = ps2pp_set_resolution; |
394 | psmouse->disconnect = ps2pp_disconnect; | 395 | psmouse->disconnect = ps2pp_disconnect; |
395 | 396 | ||
396 | device_create_file(&psmouse->ps2dev.serio->dev, | 397 | error = device_create_file(&psmouse->ps2dev.serio->dev, |
397 | &psmouse_attr_smartscroll.dattr); | 398 | &psmouse_attr_smartscroll.dattr); |
399 | if (error) { | ||
400 | printk(KERN_ERR | ||
401 | "logips2pp.c: failed to create smartscroll " | ||
402 | "sysfs attribute, error: %d\n", error); | ||
403 | return -1; | ||
404 | } | ||
398 | } | 405 | } |
399 | } | 406 | } |
400 | 407 | ||
diff --git a/drivers/input/mouse/pc110pad.c b/drivers/input/mouse/pc110pad.c index 8c075aa7223b..f155c1fea04e 100644 --- a/drivers/input/mouse/pc110pad.c +++ b/drivers/input/mouse/pc110pad.c | |||
@@ -108,6 +108,7 @@ static int pc110pad_open(struct input_dev *dev) | |||
108 | static int __init pc110pad_init(void) | 108 | static int __init pc110pad_init(void) |
109 | { | 109 | { |
110 | struct pci_dev *dev; | 110 | struct pci_dev *dev; |
111 | int err; | ||
111 | 112 | ||
112 | dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, NULL); | 113 | dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, NULL); |
113 | if (dev) { | 114 | if (dev) { |
@@ -124,16 +125,16 @@ static int __init pc110pad_init(void) | |||
124 | outb(PC110PAD_OFF, pc110pad_io + 2); | 125 | outb(PC110PAD_OFF, pc110pad_io + 2); |
125 | 126 | ||
126 | if (request_irq(pc110pad_irq, pc110pad_interrupt, 0, "pc110pad", NULL)) { | 127 | if (request_irq(pc110pad_irq, pc110pad_interrupt, 0, "pc110pad", NULL)) { |
127 | release_region(pc110pad_io, 4); | ||
128 | printk(KERN_ERR "pc110pad: Unable to get irq %d.\n", pc110pad_irq); | 128 | printk(KERN_ERR "pc110pad: Unable to get irq %d.\n", pc110pad_irq); |
129 | return -EBUSY; | 129 | err = -EBUSY; |
130 | goto err_release_region; | ||
130 | } | 131 | } |
131 | 132 | ||
132 | if (!(pc110pad_dev = input_allocate_device())) { | 133 | pc110pad_dev = input_allocate_device(); |
133 | free_irq(pc110pad_irq, NULL); | 134 | if (!pc110pad_dev) { |
134 | release_region(pc110pad_io, 4); | ||
135 | printk(KERN_ERR "pc110pad: Not enough memory.\n"); | 135 | printk(KERN_ERR "pc110pad: Not enough memory.\n"); |
136 | return -ENOMEM; | 136 | err = -ENOMEM; |
137 | goto err_free_irq; | ||
137 | } | 138 | } |
138 | 139 | ||
139 | pc110pad_dev->name = "IBM PC110 TouchPad"; | 140 | pc110pad_dev->name = "IBM PC110 TouchPad"; |
@@ -153,9 +154,20 @@ static int __init pc110pad_init(void) | |||
153 | pc110pad_dev->open = pc110pad_open; | 154 | pc110pad_dev->open = pc110pad_open; |
154 | pc110pad_dev->close = pc110pad_close; | 155 | pc110pad_dev->close = pc110pad_close; |
155 | 156 | ||
156 | input_register_device(pc110pad_dev); | 157 | err = input_register_device(pc110pad_dev); |
158 | if (err) | ||
159 | goto err_free_dev; | ||
157 | 160 | ||
158 | return 0; | 161 | return 0; |
162 | |||
163 | err_free_dev: | ||
164 | input_free_device(pc110pad_dev); | ||
165 | err_free_irq: | ||
166 | free_irq(pc110pad_irq, NULL); | ||
167 | err_release_region: | ||
168 | release_region(pc110pad_io, 4); | ||
169 | |||
170 | return err; | ||
159 | } | 171 | } |
160 | 172 | ||
161 | static void __exit pc110pad_exit(void) | 173 | static void __exit pc110pad_exit(void) |
diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c index 52bb2226ce2f..a0e4a033e2db 100644 --- a/drivers/input/mouse/psmouse-base.c +++ b/drivers/input/mouse/psmouse-base.c | |||
@@ -1103,7 +1103,7 @@ static int psmouse_connect(struct serio *serio, struct serio_driver *drv) | |||
1103 | { | 1103 | { |
1104 | struct psmouse *psmouse, *parent = NULL; | 1104 | struct psmouse *psmouse, *parent = NULL; |
1105 | struct input_dev *input_dev; | 1105 | struct input_dev *input_dev; |
1106 | int retval = -ENOMEM; | 1106 | int retval = 0, error = -ENOMEM; |
1107 | 1107 | ||
1108 | mutex_lock(&psmouse_mutex); | 1108 | mutex_lock(&psmouse_mutex); |
1109 | 1109 | ||
@@ -1119,7 +1119,7 @@ static int psmouse_connect(struct serio *serio, struct serio_driver *drv) | |||
1119 | psmouse = kzalloc(sizeof(struct psmouse), GFP_KERNEL); | 1119 | psmouse = kzalloc(sizeof(struct psmouse), GFP_KERNEL); |
1120 | input_dev = input_allocate_device(); | 1120 | input_dev = input_allocate_device(); |
1121 | if (!psmouse || !input_dev) | 1121 | if (!psmouse || !input_dev) |
1122 | goto out; | 1122 | goto err_free; |
1123 | 1123 | ||
1124 | ps2_init(&psmouse->ps2dev, serio); | 1124 | ps2_init(&psmouse->ps2dev, serio); |
1125 | INIT_WORK(&psmouse->resync_work, psmouse_resync); | 1125 | INIT_WORK(&psmouse->resync_work, psmouse_resync); |
@@ -1130,14 +1130,13 @@ static int psmouse_connect(struct serio *serio, struct serio_driver *drv) | |||
1130 | 1130 | ||
1131 | serio_set_drvdata(serio, psmouse); | 1131 | serio_set_drvdata(serio, psmouse); |
1132 | 1132 | ||
1133 | retval = serio_open(serio, drv); | 1133 | error = serio_open(serio, drv); |
1134 | if (retval) | 1134 | if (error) |
1135 | goto out; | 1135 | goto err_clear_drvdata; |
1136 | 1136 | ||
1137 | if (psmouse_probe(psmouse) < 0) { | 1137 | if (psmouse_probe(psmouse) < 0) { |
1138 | serio_close(serio); | 1138 | error = -ENODEV; |
1139 | retval = -ENODEV; | 1139 | goto err_close_serio; |
1140 | goto out; | ||
1141 | } | 1140 | } |
1142 | 1141 | ||
1143 | psmouse->rate = psmouse_rate; | 1142 | psmouse->rate = psmouse_rate; |
@@ -1151,30 +1150,44 @@ static int psmouse_connect(struct serio *serio, struct serio_driver *drv) | |||
1151 | psmouse_set_state(psmouse, PSMOUSE_CMD_MODE); | 1150 | psmouse_set_state(psmouse, PSMOUSE_CMD_MODE); |
1152 | psmouse_initialize(psmouse); | 1151 | psmouse_initialize(psmouse); |
1153 | 1152 | ||
1154 | input_register_device(psmouse->dev); | 1153 | error = input_register_device(psmouse->dev); |
1154 | if (error) | ||
1155 | goto err_protocol_disconnect; | ||
1155 | 1156 | ||
1156 | if (parent && parent->pt_activate) | 1157 | if (parent && parent->pt_activate) |
1157 | parent->pt_activate(parent); | 1158 | parent->pt_activate(parent); |
1158 | 1159 | ||
1159 | sysfs_create_group(&serio->dev.kobj, &psmouse_attribute_group); | 1160 | error = sysfs_create_group(&serio->dev.kobj, &psmouse_attribute_group); |
1161 | if (error) | ||
1162 | goto err_pt_deactivate; | ||
1160 | 1163 | ||
1161 | psmouse_activate(psmouse); | 1164 | psmouse_activate(psmouse); |
1162 | 1165 | ||
1163 | retval = 0; | 1166 | out: |
1164 | |||
1165 | out: | ||
1166 | if (retval) { | ||
1167 | serio_set_drvdata(serio, NULL); | ||
1168 | input_free_device(input_dev); | ||
1169 | kfree(psmouse); | ||
1170 | } | ||
1171 | |||
1172 | /* If this is a pass-through port the parent needs to be re-activated */ | 1167 | /* If this is a pass-through port the parent needs to be re-activated */ |
1173 | if (parent) | 1168 | if (parent) |
1174 | psmouse_activate(parent); | 1169 | psmouse_activate(parent); |
1175 | 1170 | ||
1176 | mutex_unlock(&psmouse_mutex); | 1171 | mutex_unlock(&psmouse_mutex); |
1177 | return retval; | 1172 | return retval; |
1173 | |||
1174 | err_pt_deactivate: | ||
1175 | if (parent && parent->pt_deactivate) | ||
1176 | parent->pt_deactivate(parent); | ||
1177 | err_protocol_disconnect: | ||
1178 | if (psmouse->disconnect) | ||
1179 | psmouse->disconnect(psmouse); | ||
1180 | psmouse_set_state(psmouse, PSMOUSE_IGNORE); | ||
1181 | err_close_serio: | ||
1182 | serio_close(serio); | ||
1183 | err_clear_drvdata: | ||
1184 | serio_set_drvdata(serio, NULL); | ||
1185 | err_free: | ||
1186 | input_free_device(input_dev); | ||
1187 | kfree(psmouse); | ||
1188 | |||
1189 | retval = error; | ||
1190 | goto out; | ||
1178 | } | 1191 | } |
1179 | 1192 | ||
1180 | 1193 | ||
@@ -1337,14 +1350,14 @@ ssize_t psmouse_attr_set_helper(struct device *dev, struct device_attribute *dev | |||
1337 | 1350 | ||
1338 | static ssize_t psmouse_show_int_attr(struct psmouse *psmouse, void *offset, char *buf) | 1351 | static ssize_t psmouse_show_int_attr(struct psmouse *psmouse, void *offset, char *buf) |
1339 | { | 1352 | { |
1340 | unsigned long *field = (unsigned long *)((char *)psmouse + (size_t)offset); | 1353 | unsigned int *field = (unsigned int *)((char *)psmouse + (size_t)offset); |
1341 | 1354 | ||
1342 | return sprintf(buf, "%lu\n", *field); | 1355 | return sprintf(buf, "%u\n", *field); |
1343 | } | 1356 | } |
1344 | 1357 | ||
1345 | static ssize_t psmouse_set_int_attr(struct psmouse *psmouse, void *offset, const char *buf, size_t count) | 1358 | static ssize_t psmouse_set_int_attr(struct psmouse *psmouse, void *offset, const char *buf, size_t count) |
1346 | { | 1359 | { |
1347 | unsigned long *field = (unsigned long *)((char *)psmouse + (size_t)offset); | 1360 | unsigned int *field = (unsigned int *)((char *)psmouse + (size_t)offset); |
1348 | unsigned long value; | 1361 | unsigned long value; |
1349 | char *rest; | 1362 | char *rest; |
1350 | 1363 | ||
@@ -1352,6 +1365,9 @@ static ssize_t psmouse_set_int_attr(struct psmouse *psmouse, void *offset, const | |||
1352 | if (*rest) | 1365 | if (*rest) |
1353 | return -EINVAL; | 1366 | return -EINVAL; |
1354 | 1367 | ||
1368 | if ((unsigned int)value != value) | ||
1369 | return -EINVAL; | ||
1370 | |||
1355 | *field = value; | 1371 | *field = value; |
1356 | 1372 | ||
1357 | return count; | 1373 | return count; |
@@ -1366,17 +1382,20 @@ static ssize_t psmouse_attr_set_protocol(struct psmouse *psmouse, void *data, co | |||
1366 | { | 1382 | { |
1367 | struct serio *serio = psmouse->ps2dev.serio; | 1383 | struct serio *serio = psmouse->ps2dev.serio; |
1368 | struct psmouse *parent = NULL; | 1384 | struct psmouse *parent = NULL; |
1369 | struct input_dev *new_dev; | 1385 | struct input_dev *old_dev, *new_dev; |
1370 | const struct psmouse_protocol *proto; | 1386 | const struct psmouse_protocol *proto, *old_proto; |
1387 | int error; | ||
1371 | int retry = 0; | 1388 | int retry = 0; |
1372 | 1389 | ||
1373 | if (!(proto = psmouse_protocol_by_name(buf, count))) | 1390 | proto = psmouse_protocol_by_name(buf, count); |
1391 | if (!proto) | ||
1374 | return -EINVAL; | 1392 | return -EINVAL; |
1375 | 1393 | ||
1376 | if (psmouse->type == proto->type) | 1394 | if (psmouse->type == proto->type) |
1377 | return count; | 1395 | return count; |
1378 | 1396 | ||
1379 | if (!(new_dev = input_allocate_device())) | 1397 | new_dev = input_allocate_device(); |
1398 | if (!new_dev) | ||
1380 | return -ENOMEM; | 1399 | return -ENOMEM; |
1381 | 1400 | ||
1382 | while (serio->child) { | 1401 | while (serio->child) { |
@@ -1409,11 +1428,13 @@ static ssize_t psmouse_attr_set_protocol(struct psmouse *psmouse, void *data, co | |||
1409 | parent->pt_deactivate(parent); | 1428 | parent->pt_deactivate(parent); |
1410 | } | 1429 | } |
1411 | 1430 | ||
1431 | old_dev = psmouse->dev; | ||
1432 | old_proto = psmouse_protocol_by_type(psmouse->type); | ||
1433 | |||
1412 | if (psmouse->disconnect) | 1434 | if (psmouse->disconnect) |
1413 | psmouse->disconnect(psmouse); | 1435 | psmouse->disconnect(psmouse); |
1414 | 1436 | ||
1415 | psmouse_set_state(psmouse, PSMOUSE_IGNORE); | 1437 | psmouse_set_state(psmouse, PSMOUSE_IGNORE); |
1416 | input_unregister_device(psmouse->dev); | ||
1417 | 1438 | ||
1418 | psmouse->dev = new_dev; | 1439 | psmouse->dev = new_dev; |
1419 | psmouse_set_state(psmouse, PSMOUSE_INITIALIZING); | 1440 | psmouse_set_state(psmouse, PSMOUSE_INITIALIZING); |
@@ -1427,7 +1448,23 @@ static ssize_t psmouse_attr_set_protocol(struct psmouse *psmouse, void *data, co | |||
1427 | psmouse_initialize(psmouse); | 1448 | psmouse_initialize(psmouse); |
1428 | psmouse_set_state(psmouse, PSMOUSE_CMD_MODE); | 1449 | psmouse_set_state(psmouse, PSMOUSE_CMD_MODE); |
1429 | 1450 | ||
1430 | input_register_device(psmouse->dev); | 1451 | error = input_register_device(psmouse->dev); |
1452 | if (error) { | ||
1453 | if (psmouse->disconnect) | ||
1454 | psmouse->disconnect(psmouse); | ||
1455 | |||
1456 | psmouse_set_state(psmouse, PSMOUSE_IGNORE); | ||
1457 | input_free_device(new_dev); | ||
1458 | psmouse->dev = old_dev; | ||
1459 | psmouse_set_state(psmouse, PSMOUSE_INITIALIZING); | ||
1460 | psmouse_switch_protocol(psmouse, old_proto); | ||
1461 | psmouse_initialize(psmouse); | ||
1462 | psmouse_set_state(psmouse, PSMOUSE_CMD_MODE); | ||
1463 | |||
1464 | return error; | ||
1465 | } | ||
1466 | |||
1467 | input_unregister_device(old_dev); | ||
1431 | 1468 | ||
1432 | if (parent && parent->pt_activate) | 1469 | if (parent && parent->pt_activate) |
1433 | parent->pt_activate(parent); | 1470 | parent->pt_activate(parent); |
@@ -1488,15 +1525,19 @@ static int psmouse_get_maxproto(char *buffer, struct kernel_param *kp) | |||
1488 | 1525 | ||
1489 | static int __init psmouse_init(void) | 1526 | static int __init psmouse_init(void) |
1490 | { | 1527 | { |
1528 | int err; | ||
1529 | |||
1491 | kpsmoused_wq = create_singlethread_workqueue("kpsmoused"); | 1530 | kpsmoused_wq = create_singlethread_workqueue("kpsmoused"); |
1492 | if (!kpsmoused_wq) { | 1531 | if (!kpsmoused_wq) { |
1493 | printk(KERN_ERR "psmouse: failed to create kpsmoused workqueue\n"); | 1532 | printk(KERN_ERR "psmouse: failed to create kpsmoused workqueue\n"); |
1494 | return -ENOMEM; | 1533 | return -ENOMEM; |
1495 | } | 1534 | } |
1496 | 1535 | ||
1497 | serio_register_driver(&psmouse_drv); | 1536 | err = serio_register_driver(&psmouse_drv); |
1537 | if (err) | ||
1538 | destroy_workqueue(kpsmoused_wq); | ||
1498 | 1539 | ||
1499 | return 0; | 1540 | return err; |
1500 | } | 1541 | } |
1501 | 1542 | ||
1502 | static void __exit psmouse_exit(void) | 1543 | static void __exit psmouse_exit(void) |
diff --git a/drivers/input/mouse/rpcmouse.c b/drivers/input/mouse/rpcmouse.c index ea0468569610..fbdcfd8eb4e9 100644 --- a/drivers/input/mouse/rpcmouse.c +++ b/drivers/input/mouse/rpcmouse.c | |||
@@ -66,7 +66,10 @@ static irqreturn_t rpcmouse_irq(int irq, void *dev_id) | |||
66 | 66 | ||
67 | static int __init rpcmouse_init(void) | 67 | static int __init rpcmouse_init(void) |
68 | { | 68 | { |
69 | if (!(rpcmouse_dev = input_allocate_device())) | 69 | int err; |
70 | |||
71 | rpcmouse_dev = input_allocate_device(); | ||
72 | if (!rpcmouse_dev) | ||
70 | return -ENOMEM; | 73 | return -ENOMEM; |
71 | 74 | ||
72 | rpcmouse_dev->name = "Acorn RiscPC Mouse"; | 75 | rpcmouse_dev->name = "Acorn RiscPC Mouse"; |
@@ -85,13 +88,22 @@ static int __init rpcmouse_init(void) | |||
85 | 88 | ||
86 | if (request_irq(IRQ_VSYNCPULSE, rpcmouse_irq, IRQF_SHARED, "rpcmouse", rpcmouse_dev)) { | 89 | if (request_irq(IRQ_VSYNCPULSE, rpcmouse_irq, IRQF_SHARED, "rpcmouse", rpcmouse_dev)) { |
87 | printk(KERN_ERR "rpcmouse: unable to allocate VSYNC interrupt\n"); | 90 | printk(KERN_ERR "rpcmouse: unable to allocate VSYNC interrupt\n"); |
88 | input_free_device(rpcmouse_dev); | 91 | err = -EBUSY; |
89 | return -EBUSY; | 92 | goto err_free_dev; |
90 | } | 93 | } |
91 | 94 | ||
92 | input_register_device(rpcmouse_dev); | 95 | err = input_register_device(rpcmouse_dev); |
96 | if (err) | ||
97 | goto err_free_irq; | ||
93 | 98 | ||
94 | return 0; | 99 | return 0; |
100 | |||
101 | err_free_irq: | ||
102 | free_irq(IRQ_VSYNCPULSE, rpcmouse_dev); | ||
103 | err_free_dev: | ||
104 | input_free_device(rpcmouse_dev); | ||
105 | |||
106 | return err; | ||
95 | } | 107 | } |
96 | 108 | ||
97 | static void __exit rpcmouse_exit(void) | 109 | static void __exit rpcmouse_exit(void) |
diff --git a/drivers/input/mouse/sermouse.c b/drivers/input/mouse/sermouse.c index 2a272c5daf08..a85d74710b44 100644 --- a/drivers/input/mouse/sermouse.c +++ b/drivers/input/mouse/sermouse.c | |||
@@ -246,7 +246,7 @@ static int sermouse_connect(struct serio *serio, struct serio_driver *drv) | |||
246 | sermouse = kzalloc(sizeof(struct sermouse), GFP_KERNEL); | 246 | sermouse = kzalloc(sizeof(struct sermouse), GFP_KERNEL); |
247 | input_dev = input_allocate_device(); | 247 | input_dev = input_allocate_device(); |
248 | if (!sermouse || !input_dev) | 248 | if (!sermouse || !input_dev) |
249 | goto fail; | 249 | goto fail1; |
250 | 250 | ||
251 | sermouse->dev = input_dev; | 251 | sermouse->dev = input_dev; |
252 | snprintf(sermouse->phys, sizeof(sermouse->phys), "%s/input0", serio->phys); | 252 | snprintf(sermouse->phys, sizeof(sermouse->phys), "%s/input0", serio->phys); |
@@ -275,14 +275,17 @@ static int sermouse_connect(struct serio *serio, struct serio_driver *drv) | |||
275 | 275 | ||
276 | err = serio_open(serio, drv); | 276 | err = serio_open(serio, drv); |
277 | if (err) | 277 | if (err) |
278 | goto fail; | 278 | goto fail2; |
279 | 279 | ||
280 | input_register_device(sermouse->dev); | 280 | err = input_register_device(sermouse->dev); |
281 | if (err) | ||
282 | goto fail3; | ||
281 | 283 | ||
282 | return 0; | 284 | return 0; |
283 | 285 | ||
284 | fail: serio_set_drvdata(serio, NULL); | 286 | fail3: serio_close(serio); |
285 | input_free_device(input_dev); | 287 | fail2: serio_set_drvdata(serio, NULL); |
288 | fail1: input_free_device(input_dev); | ||
286 | kfree(sermouse); | 289 | kfree(sermouse); |
287 | return err; | 290 | return err; |
288 | } | 291 | } |
@@ -348,8 +351,7 @@ static struct serio_driver sermouse_drv = { | |||
348 | 351 | ||
349 | static int __init sermouse_init(void) | 352 | static int __init sermouse_init(void) |
350 | { | 353 | { |
351 | serio_register_driver(&sermouse_drv); | 354 | return serio_register_driver(&sermouse_drv); |
352 | return 0; | ||
353 | } | 355 | } |
354 | 356 | ||
355 | static void __exit sermouse_exit(void) | 357 | static void __exit sermouse_exit(void) |
diff --git a/drivers/input/mouse/trackpoint.c b/drivers/input/mouse/trackpoint.c index ae5871a0e060..9ab5b5ea809d 100644 --- a/drivers/input/mouse/trackpoint.c +++ b/drivers/input/mouse/trackpoint.c | |||
@@ -293,6 +293,7 @@ int trackpoint_detect(struct psmouse *psmouse, int set_properties) | |||
293 | struct ps2dev *ps2dev = &psmouse->ps2dev; | 293 | struct ps2dev *ps2dev = &psmouse->ps2dev; |
294 | unsigned char firmware_id; | 294 | unsigned char firmware_id; |
295 | unsigned char button_info; | 295 | unsigned char button_info; |
296 | int error; | ||
296 | 297 | ||
297 | if (trackpoint_start_protocol(psmouse, &firmware_id)) | 298 | if (trackpoint_start_protocol(psmouse, &firmware_id)) |
298 | return -1; | 299 | return -1; |
@@ -305,7 +306,7 @@ int trackpoint_detect(struct psmouse *psmouse, int set_properties) | |||
305 | button_info = 0; | 306 | button_info = 0; |
306 | } | 307 | } |
307 | 308 | ||
308 | psmouse->private = priv = kcalloc(1, sizeof(struct trackpoint_data), GFP_KERNEL); | 309 | psmouse->private = priv = kzalloc(sizeof(struct trackpoint_data), GFP_KERNEL); |
309 | if (!priv) | 310 | if (!priv) |
310 | return -1; | 311 | return -1; |
311 | 312 | ||
@@ -318,7 +319,14 @@ int trackpoint_detect(struct psmouse *psmouse, int set_properties) | |||
318 | trackpoint_defaults(priv); | 319 | trackpoint_defaults(priv); |
319 | trackpoint_sync(psmouse); | 320 | trackpoint_sync(psmouse); |
320 | 321 | ||
321 | sysfs_create_group(&ps2dev->serio->dev.kobj, &trackpoint_attr_group); | 322 | error = sysfs_create_group(&ps2dev->serio->dev.kobj, &trackpoint_attr_group); |
323 | if (error) { | ||
324 | printk(KERN_ERR | ||
325 | "trackpoint.c: failed to create sysfs attributes, error: %d\n", | ||
326 | error); | ||
327 | kfree(priv); | ||
328 | return -1; | ||
329 | } | ||
322 | 330 | ||
323 | printk(KERN_INFO "IBM TrackPoint firmware: 0x%02x, buttons: %d/%d\n", | 331 | printk(KERN_INFO "IBM TrackPoint firmware: 0x%02x, buttons: %d/%d\n", |
324 | firmware_id, (button_info & 0xf0) >> 4, button_info & 0x0f); | 332 | firmware_id, (button_info & 0xf0) >> 4, button_info & 0x0f); |
diff --git a/drivers/input/mouse/vsxxxaa.c b/drivers/input/mouse/vsxxxaa.c index ffdb50eee93d..c3d64fcc858d 100644 --- a/drivers/input/mouse/vsxxxaa.c +++ b/drivers/input/mouse/vsxxxaa.c | |||
@@ -497,7 +497,7 @@ vsxxxaa_connect (struct serio *serio, struct serio_driver *drv) | |||
497 | mouse = kzalloc (sizeof (struct vsxxxaa), GFP_KERNEL); | 497 | mouse = kzalloc (sizeof (struct vsxxxaa), GFP_KERNEL); |
498 | input_dev = input_allocate_device (); | 498 | input_dev = input_allocate_device (); |
499 | if (!mouse || !input_dev) | 499 | if (!mouse || !input_dev) |
500 | goto fail; | 500 | goto fail1; |
501 | 501 | ||
502 | mouse->dev = input_dev; | 502 | mouse->dev = input_dev; |
503 | mouse->serio = serio; | 503 | mouse->serio = serio; |
@@ -527,7 +527,7 @@ vsxxxaa_connect (struct serio *serio, struct serio_driver *drv) | |||
527 | 527 | ||
528 | err = serio_open (serio, drv); | 528 | err = serio_open (serio, drv); |
529 | if (err) | 529 | if (err) |
530 | goto fail; | 530 | goto fail2; |
531 | 531 | ||
532 | /* | 532 | /* |
533 | * Request selftest. Standard packet format and differential | 533 | * Request selftest. Standard packet format and differential |
@@ -535,12 +535,15 @@ vsxxxaa_connect (struct serio *serio, struct serio_driver *drv) | |||
535 | */ | 535 | */ |
536 | serio->write (serio, 'T'); /* Test */ | 536 | serio->write (serio, 'T'); /* Test */ |
537 | 537 | ||
538 | input_register_device (input_dev); | 538 | err = input_register_device (input_dev); |
539 | if (err) | ||
540 | goto fail3; | ||
539 | 541 | ||
540 | return 0; | 542 | return 0; |
541 | 543 | ||
542 | fail: serio_set_drvdata (serio, NULL); | 544 | fail3: serio_close (serio); |
543 | input_free_device (input_dev); | 545 | fail2: serio_set_drvdata (serio, NULL); |
546 | fail1: input_free_device (input_dev); | ||
544 | kfree (mouse); | 547 | kfree (mouse); |
545 | return err; | 548 | return err; |
546 | } | 549 | } |
@@ -571,8 +574,7 @@ static struct serio_driver vsxxxaa_drv = { | |||
571 | static int __init | 574 | static int __init |
572 | vsxxxaa_init (void) | 575 | vsxxxaa_init (void) |
573 | { | 576 | { |
574 | serio_register_driver(&vsxxxaa_drv); | 577 | return serio_register_driver(&vsxxxaa_drv); |
575 | return 0; | ||
576 | } | 578 | } |
577 | 579 | ||
578 | static void __exit | 580 | static void __exit |