aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2009-10-14 02:37:30 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2009-10-14 02:58:27 -0400
commit216023255abc13ca276adfcf4ff2af111aaebc5e (patch)
tree7af4880a2e8ce396047a3bc9cff9f34cc9d9ba33 /drivers
parent7d3fadd148cbba1bc1836dd5a5d2d4b67788ffd5 (diff)
Input: vsxxxaa - change formatting style to match the rest of the kernel
- no spaces between function name and opening parenthesis - switch statements were indented too much This makes checkpatch (and me) happy. Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/input/mouse/vsxxxaa.c374
1 files changed, 175 insertions, 199 deletions
diff --git a/drivers/input/mouse/vsxxxaa.c b/drivers/input/mouse/vsxxxaa.c
index 70111443678e..bf2c0c80d6cc 100644
--- a/drivers/input/mouse/vsxxxaa.c
+++ b/drivers/input/mouse/vsxxxaa.c
@@ -86,27 +86,28 @@
86 86
87#define DRIVER_DESC "Driver for DEC VSXXX-AA and -GA mice and VSXXX-AB tablet" 87#define DRIVER_DESC "Driver for DEC VSXXX-AA and -GA mice and VSXXX-AB tablet"
88 88
89MODULE_AUTHOR ("Jan-Benedict Glaw <jbglaw@lug-owl.de>"); 89MODULE_AUTHOR("Jan-Benedict Glaw <jbglaw@lug-owl.de>");
90MODULE_DESCRIPTION (DRIVER_DESC); 90MODULE_DESCRIPTION(DRIVER_DESC);
91MODULE_LICENSE ("GPL"); 91MODULE_LICENSE("GPL");
92 92
93#undef VSXXXAA_DEBUG 93#undef VSXXXAA_DEBUG
94#ifdef VSXXXAA_DEBUG 94#ifdef VSXXXAA_DEBUG
95#define DBG(x...) printk (x) 95#define DBG(x...) printk(x)
96#else 96#else
97#define DBG(x...) do {} while (0) 97#define DBG(x...) do {} while (0)
98#endif 98#endif
99 99
100#define VSXXXAA_INTRO_MASK 0x80 100#define VSXXXAA_INTRO_MASK 0x80
101#define VSXXXAA_INTRO_HEAD 0x80 101#define VSXXXAA_INTRO_HEAD 0x80
102#define IS_HDR_BYTE(x) (((x) & VSXXXAA_INTRO_MASK) \ 102#define IS_HDR_BYTE(x) \
103 == VSXXXAA_INTRO_HEAD) 103 (((x) & VSXXXAA_INTRO_MASK) == VSXXXAA_INTRO_HEAD)
104 104
105#define VSXXXAA_PACKET_MASK 0xe0 105#define VSXXXAA_PACKET_MASK 0xe0
106#define VSXXXAA_PACKET_REL 0x80 106#define VSXXXAA_PACKET_REL 0x80
107#define VSXXXAA_PACKET_ABS 0xc0 107#define VSXXXAA_PACKET_ABS 0xc0
108#define VSXXXAA_PACKET_POR 0xa0 108#define VSXXXAA_PACKET_POR 0xa0
109#define MATCH_PACKET_TYPE(data, type) (((data) & VSXXXAA_PACKET_MASK) == (type)) 109#define MATCH_PACKET_TYPE(data, type) \
110 (((data) & VSXXXAA_PACKET_MASK) == (type))
110 111
111 112
112 113
@@ -123,52 +124,50 @@ struct vsxxxaa {
123 char phys[32]; 124 char phys[32];
124}; 125};
125 126
126static void 127static void vsxxxaa_drop_bytes(struct vsxxxaa *mouse, int num)
127vsxxxaa_drop_bytes (struct vsxxxaa *mouse, int num)
128{ 128{
129 if (num >= mouse->count) 129 if (num >= mouse->count) {
130 mouse->count = 0; 130 mouse->count = 0;
131 else { 131 } else {
132 memmove (mouse->buf, mouse->buf + num - 1, BUFLEN - num); 132 memmove(mouse->buf, mouse->buf + num - 1, BUFLEN - num);
133 mouse->count -= num; 133 mouse->count -= num;
134 } 134 }
135} 135}
136 136
137static void 137static void vsxxxaa_queue_byte(struct vsxxxaa *mouse, unsigned char byte)
138vsxxxaa_queue_byte (struct vsxxxaa *mouse, unsigned char byte)
139{ 138{
140 if (mouse->count == BUFLEN) { 139 if (mouse->count == BUFLEN) {
141 printk (KERN_ERR "%s on %s: Dropping a byte of full buffer.\n", 140 printk(KERN_ERR "%s on %s: Dropping a byte of full buffer.\n",
142 mouse->name, mouse->phys); 141 mouse->name, mouse->phys);
143 vsxxxaa_drop_bytes (mouse, 1); 142 vsxxxaa_drop_bytes(mouse, 1);
144 } 143 }
145 DBG (KERN_INFO "Queueing byte 0x%02x\n", byte); 144
145 DBG(KERN_INFO "Queueing byte 0x%02x\n", byte);
146 146
147 mouse->buf[mouse->count++] = byte; 147 mouse->buf[mouse->count++] = byte;
148} 148}
149 149
150static void 150static void vsxxxaa_detection_done(struct vsxxxaa *mouse)
151vsxxxaa_detection_done (struct vsxxxaa *mouse)
152{ 151{
153 switch (mouse->type) { 152 switch (mouse->type) {
154 case 0x02: 153 case 0x02:
155 strlcpy (mouse->name, "DEC VSXXX-AA/-GA mouse", 154 strlcpy(mouse->name, "DEC VSXXX-AA/-GA mouse",
156 sizeof (mouse->name)); 155 sizeof(mouse->name));
157 break; 156 break;
158 157
159 case 0x04: 158 case 0x04:
160 strlcpy (mouse->name, "DEC VSXXX-AB digitizer", 159 strlcpy(mouse->name, "DEC VSXXX-AB digitizer",
161 sizeof (mouse->name)); 160 sizeof(mouse->name));
162 break; 161 break;
163 162
164 default: 163 default:
165 snprintf (mouse->name, sizeof (mouse->name), 164 snprintf(mouse->name, sizeof(mouse->name),
166 "unknown DEC pointer device (type = 0x%02x)", 165 "unknown DEC pointer device (type = 0x%02x)",
167 mouse->type); 166 mouse->type);
168 break; 167 break;
169 } 168 }
170 169
171 printk (KERN_INFO 170 printk(KERN_INFO
172 "Found %s version 0x%02x from country 0x%02x on port %s\n", 171 "Found %s version 0x%02x from country 0x%02x on port %s\n",
173 mouse->name, mouse->version, mouse->country, mouse->phys); 172 mouse->name, mouse->version, mouse->country, mouse->phys);
174} 173}
@@ -176,42 +175,38 @@ vsxxxaa_detection_done (struct vsxxxaa *mouse)
176/* 175/*
177 * Returns number of bytes to be dropped, 0 if packet is okay. 176 * Returns number of bytes to be dropped, 0 if packet is okay.
178 */ 177 */
179static int 178static int vsxxxaa_check_packet(struct vsxxxaa *mouse, int packet_len)
180vsxxxaa_check_packet (struct vsxxxaa *mouse, int packet_len)
181{ 179{
182 int i; 180 int i;
183 181
184 /* First byte must be a header byte */ 182 /* First byte must be a header byte */
185 if (!IS_HDR_BYTE (mouse->buf[0])) { 183 if (!IS_HDR_BYTE(mouse->buf[0])) {
186 DBG ("vsck: len=%d, 1st=0x%02x\n", packet_len, mouse->buf[0]); 184 DBG("vsck: len=%d, 1st=0x%02x\n", packet_len, mouse->buf[0]);
187 return 1; 185 return 1;
188 } 186 }
189 187
190 /* Check all following bytes */ 188 /* Check all following bytes */
191 if (packet_len > 1) { 189 for (i = 1; i < packet_len; i++) {
192 for (i = 1; i < packet_len; i++) { 190 if (IS_HDR_BYTE(mouse->buf[i])) {
193 if (IS_HDR_BYTE (mouse->buf[i])) { 191 printk(KERN_ERR
194 printk (KERN_ERR "Need to drop %d bytes " 192 "Need to drop %d bytes of a broken packet.\n",
195 "of a broken packet.\n", 193 i - 1);
196 i - 1); 194 DBG(KERN_INFO "check: len=%d, b[%d]=0x%02x\n",
197 DBG (KERN_INFO "check: len=%d, b[%d]=0x%02x\n", 195 packet_len, i, mouse->buf[i]);
198 packet_len, i, mouse->buf[i]); 196 return i - 1;
199 return i - 1;
200 }
201 } 197 }
202 } 198 }
203 199
204 return 0; 200 return 0;
205} 201}
206 202
207static __inline__ int 203static inline int vsxxxaa_smells_like_packet(struct vsxxxaa *mouse,
208vsxxxaa_smells_like_packet (struct vsxxxaa *mouse, unsigned char type, size_t len) 204 unsigned char type, size_t len)
209{ 205{
210 return (mouse->count >= len) && MATCH_PACKET_TYPE (mouse->buf[0], type); 206 return mouse->count >= len && MATCH_PACKET_TYPE(mouse->buf[0], type);
211} 207}
212 208
213static void 209static void vsxxxaa_handle_REL_packet(struct vsxxxaa *mouse)
214vsxxxaa_handle_REL_packet (struct vsxxxaa *mouse)
215{ 210{
216 struct input_dev *dev = mouse->dev; 211 struct input_dev *dev = mouse->dev;
217 unsigned char *buf = mouse->buf; 212 unsigned char *buf = mouse->buf;
@@ -232,43 +227,42 @@ vsxxxaa_handle_REL_packet (struct vsxxxaa *mouse)
232 * 0, bit 4 of byte 0 is direction. 227 * 0, bit 4 of byte 0 is direction.
233 */ 228 */
234 dx = buf[1] & 0x7f; 229 dx = buf[1] & 0x7f;
235 dx *= ((buf[0] >> 4) & 0x01)? 1: -1; 230 dx *= ((buf[0] >> 4) & 0x01) ? 1 : -1;
236 231
237 /* 232 /*
238 * Low 7 bit of byte 2 are abs(dy), bit 7 is 233 * Low 7 bit of byte 2 are abs(dy), bit 7 is
239 * 0, bit 3 of byte 0 is direction. 234 * 0, bit 3 of byte 0 is direction.
240 */ 235 */
241 dy = buf[2] & 0x7f; 236 dy = buf[2] & 0x7f;
242 dy *= ((buf[0] >> 3) & 0x01)? -1: 1; 237 dy *= ((buf[0] >> 3) & 0x01) ? -1 : 1;
243 238
244 /* 239 /*
245 * Get button state. It's the low three bits 240 * Get button state. It's the low three bits
246 * (for three buttons) of byte 0. 241 * (for three buttons) of byte 0.
247 */ 242 */
248 left = (buf[0] & 0x04)? 1: 0; 243 left = buf[0] & 0x04;
249 middle = (buf[0] & 0x02)? 1: 0; 244 middle = buf[0] & 0x02;
250 right = (buf[0] & 0x01)? 1: 0; 245 right = buf[0] & 0x01;
251 246
252 vsxxxaa_drop_bytes (mouse, 3); 247 vsxxxaa_drop_bytes(mouse, 3);
253 248
254 DBG (KERN_INFO "%s on %s: dx=%d, dy=%d, buttons=%s%s%s\n", 249 DBG(KERN_INFO "%s on %s: dx=%d, dy=%d, buttons=%s%s%s\n",
255 mouse->name, mouse->phys, dx, dy, 250 mouse->name, mouse->phys, dx, dy,
256 left? "L": "l", middle? "M": "m", right? "R": "r"); 251 left ? "L" : "l", middle ? "M" : "m", right ? "R" : "r");
257 252
258 /* 253 /*
259 * Report what we've found so far... 254 * Report what we've found so far...
260 */ 255 */
261 input_report_key (dev, BTN_LEFT, left); 256 input_report_key(dev, BTN_LEFT, left);
262 input_report_key (dev, BTN_MIDDLE, middle); 257 input_report_key(dev, BTN_MIDDLE, middle);
263 input_report_key (dev, BTN_RIGHT, right); 258 input_report_key(dev, BTN_RIGHT, right);
264 input_report_key (dev, BTN_TOUCH, 0); 259 input_report_key(dev, BTN_TOUCH, 0);
265 input_report_rel (dev, REL_X, dx); 260 input_report_rel(dev, REL_X, dx);
266 input_report_rel (dev, REL_Y, dy); 261 input_report_rel(dev, REL_Y, dy);
267 input_sync (dev); 262 input_sync(dev);
268} 263}
269 264
270static void 265static void vsxxxaa_handle_ABS_packet(struct vsxxxaa *mouse)
271vsxxxaa_handle_ABS_packet (struct vsxxxaa *mouse)
272{ 266{
273 struct input_dev *dev = mouse->dev; 267 struct input_dev *dev = mouse->dev;
274 unsigned char *buf = mouse->buf; 268 unsigned char *buf = mouse->buf;
@@ -296,32 +290,31 @@ vsxxxaa_handle_ABS_packet (struct vsxxxaa *mouse)
296 /* 290 /*
297 * Get button state. It's bits <4..1> of byte 0. 291 * Get button state. It's bits <4..1> of byte 0.
298 */ 292 */
299 left = (buf[0] & 0x02)? 1: 0; 293 left = buf[0] & 0x02;
300 middle = (buf[0] & 0x04)? 1: 0; 294 middle = buf[0] & 0x04;
301 right = (buf[0] & 0x08)? 1: 0; 295 right = buf[0] & 0x08;
302 touch = (buf[0] & 0x10)? 1: 0; 296 touch = buf[0] & 0x10;
303 297
304 vsxxxaa_drop_bytes (mouse, 5); 298 vsxxxaa_drop_bytes(mouse, 5);
305 299
306 DBG (KERN_INFO "%s on %s: x=%d, y=%d, buttons=%s%s%s%s\n", 300 DBG(KERN_INFO "%s on %s: x=%d, y=%d, buttons=%s%s%s%s\n",
307 mouse->name, mouse->phys, x, y, 301 mouse->name, mouse->phys, x, y,
308 left? "L": "l", middle? "M": "m", 302 left ? "L" : "l", middle ? "M" : "m",
309 right? "R": "r", touch? "T": "t"); 303 right ? "R" : "r", touch ? "T" : "t");
310 304
311 /* 305 /*
312 * Report what we've found so far... 306 * Report what we've found so far...
313 */ 307 */
314 input_report_key (dev, BTN_LEFT, left); 308 input_report_key(dev, BTN_LEFT, left);
315 input_report_key (dev, BTN_MIDDLE, middle); 309 input_report_key(dev, BTN_MIDDLE, middle);
316 input_report_key (dev, BTN_RIGHT, right); 310 input_report_key(dev, BTN_RIGHT, right);
317 input_report_key (dev, BTN_TOUCH, touch); 311 input_report_key(dev, BTN_TOUCH, touch);
318 input_report_abs (dev, ABS_X, x); 312 input_report_abs(dev, ABS_X, x);
319 input_report_abs (dev, ABS_Y, y); 313 input_report_abs(dev, ABS_Y, y);
320 input_sync (dev); 314 input_sync(dev);
321} 315}
322 316
323static void 317static void vsxxxaa_handle_POR_packet(struct vsxxxaa *mouse)
324vsxxxaa_handle_POR_packet (struct vsxxxaa *mouse)
325{ 318{
326 struct input_dev *dev = mouse->dev; 319 struct input_dev *dev = mouse->dev;
327 unsigned char *buf = mouse->buf; 320 unsigned char *buf = mouse->buf;
@@ -356,24 +349,24 @@ vsxxxaa_handle_POR_packet (struct vsxxxaa *mouse)
356 * (for three buttons) of byte 0. Maybe even the bit <3> 349 * (for three buttons) of byte 0. Maybe even the bit <3>
357 * has some meaning if a tablet is attached. 350 * has some meaning if a tablet is attached.
358 */ 351 */
359 left = (buf[0] & 0x04)? 1: 0; 352 left = buf[0] & 0x04;
360 middle = (buf[0] & 0x02)? 1: 0; 353 middle = buf[0] & 0x02;
361 right = (buf[0] & 0x01)? 1: 0; 354 right = buf[0] & 0x01;
362 355
363 vsxxxaa_drop_bytes (mouse, 4); 356 vsxxxaa_drop_bytes(mouse, 4);
364 vsxxxaa_detection_done (mouse); 357 vsxxxaa_detection_done(mouse);
365 358
366 if (error <= 0x1f) { 359 if (error <= 0x1f) {
367 /* No (serious) error. Report buttons */ 360 /* No (serious) error. Report buttons */
368 input_report_key (dev, BTN_LEFT, left); 361 input_report_key(dev, BTN_LEFT, left);
369 input_report_key (dev, BTN_MIDDLE, middle); 362 input_report_key(dev, BTN_MIDDLE, middle);
370 input_report_key (dev, BTN_RIGHT, right); 363 input_report_key(dev, BTN_RIGHT, right);
371 input_report_key (dev, BTN_TOUCH, 0); 364 input_report_key(dev, BTN_TOUCH, 0);
372 input_sync (dev); 365 input_sync(dev);
373 366
374 if (error != 0) 367 if (error != 0)
375 printk (KERN_INFO "Your %s on %s reports error=0x%02x\n", 368 printk(KERN_INFO "Your %s on %s reports error=0x%02x\n",
376 mouse->name, mouse->phys, error); 369 mouse->name, mouse->phys, error);
377 370
378 } 371 }
379 372
@@ -381,18 +374,18 @@ vsxxxaa_handle_POR_packet (struct vsxxxaa *mouse)
381 * If the mouse was hot-plugged, we need to force differential mode 374 * If the mouse was hot-plugged, we need to force differential mode
382 * now... However, give it a second to recover from it's reset. 375 * now... However, give it a second to recover from it's reset.
383 */ 376 */
384 printk (KERN_NOTICE "%s on %s: Forceing standard packet format, " 377 printk(KERN_NOTICE
385 "incremental streaming mode and 72 samples/sec\n", 378 "%s on %s: Forcing standard packet format, "
386 mouse->name, mouse->phys); 379 "incremental streaming mode and 72 samples/sec\n",
387 serio_write (mouse->serio, 'S'); /* Standard format */ 380 mouse->name, mouse->phys);
388 mdelay (50); 381 serio_write(mouse->serio, 'S'); /* Standard format */
389 serio_write (mouse->serio, 'R'); /* Incremental */ 382 mdelay(50);
390 mdelay (50); 383 serio_write(mouse->serio, 'R'); /* Incremental */
391 serio_write (mouse->serio, 'L'); /* 72 samples/sec */ 384 mdelay(50);
385 serio_write(mouse->serio, 'L'); /* 72 samples/sec */
392} 386}
393 387
394static void 388static void vsxxxaa_parse_buffer(struct vsxxxaa *mouse)
395vsxxxaa_parse_buffer (struct vsxxxaa *mouse)
396{ 389{
397 unsigned char *buf = mouse->buf; 390 unsigned char *buf = mouse->buf;
398 int stray_bytes; 391 int stray_bytes;
@@ -409,122 +402,107 @@ vsxxxaa_parse_buffer (struct vsxxxaa *mouse)
409 * activity on the mouse. 402 * activity on the mouse.
410 */ 403 */
411 while (mouse->count > 0 && !IS_HDR_BYTE(buf[0])) { 404 while (mouse->count > 0 && !IS_HDR_BYTE(buf[0])) {
412 printk (KERN_ERR "%s on %s: Dropping a byte to regain " 405 printk(KERN_ERR "%s on %s: Dropping a byte to regain "
413 "sync with mouse data stream...\n", 406 "sync with mouse data stream...\n",
414 mouse->name, mouse->phys); 407 mouse->name, mouse->phys);
415 vsxxxaa_drop_bytes (mouse, 1); 408 vsxxxaa_drop_bytes(mouse, 1);
416 } 409 }
417 410
418 /* 411 /*
419 * Check for packets we know about. 412 * Check for packets we know about.
420 */ 413 */
421 414
422 if (vsxxxaa_smells_like_packet (mouse, VSXXXAA_PACKET_REL, 3)) { 415 if (vsxxxaa_smells_like_packet(mouse, VSXXXAA_PACKET_REL, 3)) {
423 /* Check for broken packet */ 416 /* Check for broken packet */
424 stray_bytes = vsxxxaa_check_packet (mouse, 3); 417 stray_bytes = vsxxxaa_check_packet(mouse, 3);
425 if (stray_bytes > 0) { 418 if (!stray_bytes)
426 printk (KERN_ERR "Dropping %d bytes now...\n", 419 vsxxxaa_handle_REL_packet(mouse);
427 stray_bytes);
428 vsxxxaa_drop_bytes (mouse, stray_bytes);
429 continue;
430 }
431
432 vsxxxaa_handle_REL_packet (mouse);
433 continue; /* More to parse? */
434 }
435 420
436 if (vsxxxaa_smells_like_packet (mouse, VSXXXAA_PACKET_ABS, 5)) { 421 } else if (vsxxxaa_smells_like_packet(mouse,
422 VSXXXAA_PACKET_ABS, 5)) {
437 /* Check for broken packet */ 423 /* Check for broken packet */
438 stray_bytes = vsxxxaa_check_packet (mouse, 5); 424 stray_bytes = vsxxxaa_check_packet(mouse, 5);
439 if (stray_bytes > 0) { 425 if (!stray_bytes)
440 printk (KERN_ERR "Dropping %d bytes now...\n", 426 vsxxxaa_handle_ABS_packet(mouse);
441 stray_bytes);
442 vsxxxaa_drop_bytes (mouse, stray_bytes);
443 continue;
444 }
445
446 vsxxxaa_handle_ABS_packet (mouse);
447 continue; /* More to parse? */
448 }
449 427
450 if (vsxxxaa_smells_like_packet (mouse, VSXXXAA_PACKET_POR, 4)) { 428 } else if (vsxxxaa_smells_like_packet(mouse,
429 VSXXXAA_PACKET_POR, 4)) {
451 /* Check for broken packet */ 430 /* Check for broken packet */
452 stray_bytes = vsxxxaa_check_packet (mouse, 4); 431 stray_bytes = vsxxxaa_check_packet(mouse, 4);
453 if (stray_bytes > 0) { 432 if (!stray_bytes)
454 printk (KERN_ERR "Dropping %d bytes now...\n", 433 vsxxxaa_handle_POR_packet(mouse);
455 stray_bytes); 434
456 vsxxxaa_drop_bytes (mouse, stray_bytes); 435 } else {
457 continue; 436 break; /* No REL, ABS or POR packet found */
458 } 437 }
459 438
460 vsxxxaa_handle_POR_packet (mouse); 439 if (stray_bytes > 0) {
461 continue; /* More to parse? */ 440 printk(KERN_ERR "Dropping %d bytes now...\n",
441 stray_bytes);
442 vsxxxaa_drop_bytes(mouse, stray_bytes);
462 } 443 }
463 444
464 break; /* No REL, ABS or POR packet found */
465 } while (1); 445 } while (1);
466} 446}
467 447
468static irqreturn_t 448static irqreturn_t vsxxxaa_interrupt(struct serio *serio,
469vsxxxaa_interrupt (struct serio *serio, unsigned char data, unsigned int flags) 449 unsigned char data, unsigned int flags)
470{ 450{
471 struct vsxxxaa *mouse = serio_get_drvdata (serio); 451 struct vsxxxaa *mouse = serio_get_drvdata(serio);
472 452
473 vsxxxaa_queue_byte (mouse, data); 453 vsxxxaa_queue_byte(mouse, data);
474 vsxxxaa_parse_buffer (mouse); 454 vsxxxaa_parse_buffer(mouse);
475 455
476 return IRQ_HANDLED; 456 return IRQ_HANDLED;
477} 457}
478 458
479static void 459static void vsxxxaa_disconnect(struct serio *serio)
480vsxxxaa_disconnect (struct serio *serio)
481{ 460{
482 struct vsxxxaa *mouse = serio_get_drvdata (serio); 461 struct vsxxxaa *mouse = serio_get_drvdata(serio);
483 462
484 serio_close (serio); 463 serio_close(serio);
485 serio_set_drvdata (serio, NULL); 464 serio_set_drvdata(serio, NULL);
486 input_unregister_device (mouse->dev); 465 input_unregister_device(mouse->dev);
487 kfree (mouse); 466 kfree(mouse);
488} 467}
489 468
490static int 469static int vsxxxaa_connect(struct serio *serio, struct serio_driver *drv)
491vsxxxaa_connect (struct serio *serio, struct serio_driver *drv)
492{ 470{
493 struct vsxxxaa *mouse; 471 struct vsxxxaa *mouse;
494 struct input_dev *input_dev; 472 struct input_dev *input_dev;
495 int err = -ENOMEM; 473 int err = -ENOMEM;
496 474
497 mouse = kzalloc (sizeof (struct vsxxxaa), GFP_KERNEL); 475 mouse = kzalloc(sizeof(struct vsxxxaa), GFP_KERNEL);
498 input_dev = input_allocate_device (); 476 input_dev = input_allocate_device();
499 if (!mouse || !input_dev) 477 if (!mouse || !input_dev)
500 goto fail1; 478 goto fail1;
501 479
502 mouse->dev = input_dev; 480 mouse->dev = input_dev;
503 mouse->serio = serio; 481 mouse->serio = serio;
504 strlcat (mouse->name, "DEC VSXXX-AA/-GA mouse or VSXXX-AB digitizer", 482 strlcat(mouse->name, "DEC VSXXX-AA/-GA mouse or VSXXX-AB digitizer",
505 sizeof (mouse->name)); 483 sizeof(mouse->name));
506 snprintf (mouse->phys, sizeof (mouse->phys), "%s/input0", serio->phys); 484 snprintf(mouse->phys, sizeof(mouse->phys), "%s/input0", serio->phys);
507 485
508 input_dev->name = mouse->name; 486 input_dev->name = mouse->name;
509 input_dev->phys = mouse->phys; 487 input_dev->phys = mouse->phys;
510 input_dev->id.bustype = BUS_RS232; 488 input_dev->id.bustype = BUS_RS232;
511 input_dev->dev.parent = &serio->dev; 489 input_dev->dev.parent = &serio->dev;
512 490
513 set_bit (EV_KEY, input_dev->evbit); /* We have buttons */ 491 __set_bit(EV_KEY, input_dev->evbit); /* We have buttons */
514 set_bit (EV_REL, input_dev->evbit); 492 __set_bit(EV_REL, input_dev->evbit);
515 set_bit (EV_ABS, input_dev->evbit); 493 __set_bit(EV_ABS, input_dev->evbit);
516 set_bit (BTN_LEFT, input_dev->keybit); /* We have 3 buttons */ 494 __set_bit(BTN_LEFT, input_dev->keybit); /* We have 3 buttons */
517 set_bit (BTN_MIDDLE, input_dev->keybit); 495 __set_bit(BTN_MIDDLE, input_dev->keybit);
518 set_bit (BTN_RIGHT, input_dev->keybit); 496 __set_bit(BTN_RIGHT, input_dev->keybit);
519 set_bit (BTN_TOUCH, input_dev->keybit); /* ...and Tablet */ 497 __set_bit(BTN_TOUCH, input_dev->keybit); /* ...and Tablet */
520 set_bit (REL_X, input_dev->relbit); 498 __set_bit(REL_X, input_dev->relbit);
521 set_bit (REL_Y, input_dev->relbit); 499 __set_bit(REL_Y, input_dev->relbit);
522 input_set_abs_params (input_dev, ABS_X, 0, 1023, 0, 0); 500 input_set_abs_params(input_dev, ABS_X, 0, 1023, 0, 0);
523 input_set_abs_params (input_dev, ABS_Y, 0, 1023, 0, 0); 501 input_set_abs_params(input_dev, ABS_Y, 0, 1023, 0, 0);
524 502
525 serio_set_drvdata (serio, mouse); 503 serio_set_drvdata(serio, mouse);
526 504
527 err = serio_open (serio, drv); 505 err = serio_open(serio, drv);
528 if (err) 506 if (err)
529 goto fail2; 507 goto fail2;
530 508
@@ -532,18 +510,18 @@ vsxxxaa_connect (struct serio *serio, struct serio_driver *drv)
532 * Request selftest. Standard packet format and differential 510 * Request selftest. Standard packet format and differential
533 * mode will be requested after the device ID'ed successfully. 511 * mode will be requested after the device ID'ed successfully.
534 */ 512 */
535 serio_write (serio, 'T'); /* Test */ 513 serio_write(serio, 'T'); /* Test */
536 514
537 err = input_register_device (input_dev); 515 err = input_register_device(input_dev);
538 if (err) 516 if (err)
539 goto fail3; 517 goto fail3;
540 518
541 return 0; 519 return 0;
542 520
543 fail3: serio_close (serio); 521 fail3: serio_close(serio);
544 fail2: serio_set_drvdata (serio, NULL); 522 fail2: serio_set_drvdata(serio, NULL);
545 fail1: input_free_device (input_dev); 523 fail1: input_free_device(input_dev);
546 kfree (mouse); 524 kfree(mouse);
547 return err; 525 return err;
548} 526}
549 527
@@ -570,18 +548,16 @@ static struct serio_driver vsxxxaa_drv = {
570 .disconnect = vsxxxaa_disconnect, 548 .disconnect = vsxxxaa_disconnect,
571}; 549};
572 550
573static int __init 551static int __init vsxxxaa_init(void)
574vsxxxaa_init (void)
575{ 552{
576 return serio_register_driver(&vsxxxaa_drv); 553 return serio_register_driver(&vsxxxaa_drv);
577} 554}
578 555
579static void __exit 556static void __exit vsxxxaa_exit(void)
580vsxxxaa_exit (void)
581{ 557{
582 serio_unregister_driver(&vsxxxaa_drv); 558 serio_unregister_driver(&vsxxxaa_drv);
583} 559}
584 560
585module_init (vsxxxaa_init); 561module_init(vsxxxaa_init);
586module_exit (vsxxxaa_exit); 562module_exit(vsxxxaa_exit);
587 563