diff options
Diffstat (limited to 'drivers/input/keyboard/atkbd.c')
-rw-r--r-- | drivers/input/keyboard/atkbd.c | 309 |
1 files changed, 161 insertions, 148 deletions
diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c index 7b4056292eaf..d358ef8623f4 100644 --- a/drivers/input/keyboard/atkbd.c +++ b/drivers/input/keyboard/atkbd.c | |||
@@ -40,26 +40,26 @@ module_param_named(set, atkbd_set, int, 0); | |||
40 | MODULE_PARM_DESC(set, "Select keyboard code set (2 = default, 3 = PS/2 native)"); | 40 | MODULE_PARM_DESC(set, "Select keyboard code set (2 = default, 3 = PS/2 native)"); |
41 | 41 | ||
42 | #if defined(__i386__) || defined(__x86_64__) || defined(__hppa__) | 42 | #if defined(__i386__) || defined(__x86_64__) || defined(__hppa__) |
43 | static int atkbd_reset; | 43 | static bool atkbd_reset; |
44 | #else | 44 | #else |
45 | static int atkbd_reset = 1; | 45 | static bool atkbd_reset = true; |
46 | #endif | 46 | #endif |
47 | module_param_named(reset, atkbd_reset, bool, 0); | 47 | module_param_named(reset, atkbd_reset, bool, 0); |
48 | MODULE_PARM_DESC(reset, "Reset keyboard during initialization"); | 48 | MODULE_PARM_DESC(reset, "Reset keyboard during initialization"); |
49 | 49 | ||
50 | static int atkbd_softrepeat; | 50 | static bool atkbd_softrepeat; |
51 | module_param_named(softrepeat, atkbd_softrepeat, bool, 0); | 51 | module_param_named(softrepeat, atkbd_softrepeat, bool, 0); |
52 | MODULE_PARM_DESC(softrepeat, "Use software keyboard repeat"); | 52 | MODULE_PARM_DESC(softrepeat, "Use software keyboard repeat"); |
53 | 53 | ||
54 | static int atkbd_softraw = 1; | 54 | static bool atkbd_softraw = true; |
55 | module_param_named(softraw, atkbd_softraw, bool, 0); | 55 | module_param_named(softraw, atkbd_softraw, bool, 0); |
56 | MODULE_PARM_DESC(softraw, "Use software generated rawmode"); | 56 | MODULE_PARM_DESC(softraw, "Use software generated rawmode"); |
57 | 57 | ||
58 | static int atkbd_scroll; | 58 | static bool atkbd_scroll; |
59 | module_param_named(scroll, atkbd_scroll, bool, 0); | 59 | module_param_named(scroll, atkbd_scroll, bool, 0); |
60 | MODULE_PARM_DESC(scroll, "Enable scroll-wheel on MS Office and similar keyboards"); | 60 | MODULE_PARM_DESC(scroll, "Enable scroll-wheel on MS Office and similar keyboards"); |
61 | 61 | ||
62 | static int atkbd_extra; | 62 | static bool atkbd_extra; |
63 | module_param_named(extra, atkbd_extra, bool, 0); | 63 | module_param_named(extra, atkbd_extra, bool, 0); |
64 | MODULE_PARM_DESC(extra, "Enable extra LEDs and keys on IBM RapidAcces, EzKey and similar keyboards"); | 64 | MODULE_PARM_DESC(extra, "Enable extra LEDs and keys on IBM RapidAcces, EzKey and similar keyboards"); |
65 | 65 | ||
@@ -153,16 +153,16 @@ static const unsigned short atkbd_unxlate_table[128] = { | |||
153 | #define ATKBD_RET_HANGEUL 0xf2 | 153 | #define ATKBD_RET_HANGEUL 0xf2 |
154 | #define ATKBD_RET_ERR 0xff | 154 | #define ATKBD_RET_ERR 0xff |
155 | 155 | ||
156 | #define ATKBD_KEY_UNKNOWN 0 | 156 | #define ATKBD_KEY_UNKNOWN 0 |
157 | #define ATKBD_KEY_NULL 255 | 157 | #define ATKBD_KEY_NULL 255 |
158 | 158 | ||
159 | #define ATKBD_SCR_1 254 | 159 | #define ATKBD_SCR_1 0xfffe |
160 | #define ATKBD_SCR_2 253 | 160 | #define ATKBD_SCR_2 0xfffd |
161 | #define ATKBD_SCR_4 252 | 161 | #define ATKBD_SCR_4 0xfffc |
162 | #define ATKBD_SCR_8 251 | 162 | #define ATKBD_SCR_8 0xfffb |
163 | #define ATKBD_SCR_CLICK 250 | 163 | #define ATKBD_SCR_CLICK 0xfffa |
164 | #define ATKBD_SCR_LEFT 249 | 164 | #define ATKBD_SCR_LEFT 0xfff9 |
165 | #define ATKBD_SCR_RIGHT 248 | 165 | #define ATKBD_SCR_RIGHT 0xfff8 |
166 | 166 | ||
167 | #define ATKBD_SPECIAL ATKBD_SCR_RIGHT | 167 | #define ATKBD_SPECIAL ATKBD_SCR_RIGHT |
168 | 168 | ||
@@ -177,7 +177,7 @@ static const unsigned short atkbd_unxlate_table[128] = { | |||
177 | #define ATKBD_XL_HANJA 0x20 | 177 | #define ATKBD_XL_HANJA 0x20 |
178 | 178 | ||
179 | static const struct { | 179 | static const struct { |
180 | unsigned char keycode; | 180 | unsigned short keycode; |
181 | unsigned char set2; | 181 | unsigned char set2; |
182 | } atkbd_scroll_keys[] = { | 182 | } atkbd_scroll_keys[] = { |
183 | { ATKBD_SCR_1, 0xc5 }, | 183 | { ATKBD_SCR_1, 0xc5 }, |
@@ -206,18 +206,18 @@ struct atkbd { | |||
206 | unsigned short keycode[ATKBD_KEYMAP_SIZE]; | 206 | unsigned short keycode[ATKBD_KEYMAP_SIZE]; |
207 | DECLARE_BITMAP(force_release_mask, ATKBD_KEYMAP_SIZE); | 207 | DECLARE_BITMAP(force_release_mask, ATKBD_KEYMAP_SIZE); |
208 | unsigned char set; | 208 | unsigned char set; |
209 | unsigned char translated; | 209 | bool translated; |
210 | unsigned char extra; | 210 | bool extra; |
211 | unsigned char write; | 211 | bool write; |
212 | unsigned char softrepeat; | 212 | bool softrepeat; |
213 | unsigned char softraw; | 213 | bool softraw; |
214 | unsigned char scroll; | 214 | bool scroll; |
215 | unsigned char enabled; | 215 | bool enabled; |
216 | 216 | ||
217 | /* Accessed only from interrupt */ | 217 | /* Accessed only from interrupt */ |
218 | unsigned char emul; | 218 | unsigned char emul; |
219 | unsigned char resend; | 219 | bool resend; |
220 | unsigned char release; | 220 | bool release; |
221 | unsigned long xl_bit; | 221 | unsigned long xl_bit; |
222 | unsigned int last; | 222 | unsigned int last; |
223 | unsigned long time; | 223 | unsigned long time; |
@@ -301,18 +301,18 @@ static const unsigned int xl_table[] = { | |||
301 | * Checks if we should mangle the scancode to extract 'release' bit | 301 | * Checks if we should mangle the scancode to extract 'release' bit |
302 | * in translated mode. | 302 | * in translated mode. |
303 | */ | 303 | */ |
304 | static int atkbd_need_xlate(unsigned long xl_bit, unsigned char code) | 304 | static bool atkbd_need_xlate(unsigned long xl_bit, unsigned char code) |
305 | { | 305 | { |
306 | int i; | 306 | int i; |
307 | 307 | ||
308 | if (code == ATKBD_RET_EMUL0 || code == ATKBD_RET_EMUL1) | 308 | if (code == ATKBD_RET_EMUL0 || code == ATKBD_RET_EMUL1) |
309 | return 0; | 309 | return false; |
310 | 310 | ||
311 | for (i = 0; i < ARRAY_SIZE(xl_table); i++) | 311 | for (i = 0; i < ARRAY_SIZE(xl_table); i++) |
312 | if (code == xl_table[i]) | 312 | if (code == xl_table[i]) |
313 | return test_bit(i, &xl_bit); | 313 | return test_bit(i, &xl_bit); |
314 | 314 | ||
315 | return 1; | 315 | return true; |
316 | } | 316 | } |
317 | 317 | ||
318 | /* | 318 | /* |
@@ -359,7 +359,7 @@ static unsigned int atkbd_compat_scancode(struct atkbd *atkbd, unsigned int code | |||
359 | */ | 359 | */ |
360 | 360 | ||
361 | static irqreturn_t atkbd_interrupt(struct serio *serio, unsigned char data, | 361 | static irqreturn_t atkbd_interrupt(struct serio *serio, unsigned char data, |
362 | unsigned int flags) | 362 | unsigned int flags) |
363 | { | 363 | { |
364 | struct atkbd *atkbd = serio_get_drvdata(serio); | 364 | struct atkbd *atkbd = serio_get_drvdata(serio); |
365 | struct input_dev *dev = atkbd->dev; | 365 | struct input_dev *dev = atkbd->dev; |
@@ -368,20 +368,18 @@ static irqreturn_t atkbd_interrupt(struct serio *serio, unsigned char data, | |||
368 | int value; | 368 | int value; |
369 | unsigned short keycode; | 369 | unsigned short keycode; |
370 | 370 | ||
371 | #ifdef ATKBD_DEBUG | 371 | dev_dbg(&serio->dev, "Received %02x flags %02x\n", data, flags); |
372 | printk(KERN_DEBUG "atkbd.c: Received %02x flags %02x\n", data, flags); | ||
373 | #endif | ||
374 | 372 | ||
375 | #if !defined(__i386__) && !defined (__x86_64__) | 373 | #if !defined(__i386__) && !defined (__x86_64__) |
376 | if ((flags & (SERIO_FRAME | SERIO_PARITY)) && (~flags & SERIO_TIMEOUT) && !atkbd->resend && atkbd->write) { | 374 | if ((flags & (SERIO_FRAME | SERIO_PARITY)) && (~flags & SERIO_TIMEOUT) && !atkbd->resend && atkbd->write) { |
377 | printk(KERN_WARNING "atkbd.c: frame/parity error: %02x\n", flags); | 375 | dev_warn(&serio->dev, "Frame/parity error: %02x\n", flags); |
378 | serio_write(serio, ATKBD_CMD_RESEND); | 376 | serio_write(serio, ATKBD_CMD_RESEND); |
379 | atkbd->resend = 1; | 377 | atkbd->resend = true; |
380 | goto out; | 378 | goto out; |
381 | } | 379 | } |
382 | 380 | ||
383 | if (!flags && data == ATKBD_RET_ACK) | 381 | if (!flags && data == ATKBD_RET_ACK) |
384 | atkbd->resend = 0; | 382 | atkbd->resend = false; |
385 | #endif | 383 | #endif |
386 | 384 | ||
387 | if (unlikely(atkbd->ps2dev.flags & PS2_FLAG_ACK)) | 385 | if (unlikely(atkbd->ps2dev.flags & PS2_FLAG_ACK)) |
@@ -412,32 +410,32 @@ static irqreturn_t atkbd_interrupt(struct serio *serio, unsigned char data, | |||
412 | } | 410 | } |
413 | 411 | ||
414 | switch (code) { | 412 | switch (code) { |
415 | case ATKBD_RET_BAT: | 413 | case ATKBD_RET_BAT: |
416 | atkbd->enabled = 0; | 414 | atkbd->enabled = false; |
417 | serio_reconnect(atkbd->ps2dev.serio); | 415 | serio_reconnect(atkbd->ps2dev.serio); |
418 | goto out; | 416 | goto out; |
419 | case ATKBD_RET_EMUL0: | 417 | case ATKBD_RET_EMUL0: |
420 | atkbd->emul = 1; | 418 | atkbd->emul = 1; |
421 | goto out; | 419 | goto out; |
422 | case ATKBD_RET_EMUL1: | 420 | case ATKBD_RET_EMUL1: |
423 | atkbd->emul = 2; | 421 | atkbd->emul = 2; |
424 | goto out; | 422 | goto out; |
425 | case ATKBD_RET_RELEASE: | 423 | case ATKBD_RET_RELEASE: |
426 | atkbd->release = 1; | 424 | atkbd->release = true; |
427 | goto out; | 425 | goto out; |
428 | case ATKBD_RET_ACK: | 426 | case ATKBD_RET_ACK: |
429 | case ATKBD_RET_NAK: | 427 | case ATKBD_RET_NAK: |
430 | if (printk_ratelimit()) | 428 | if (printk_ratelimit()) |
431 | printk(KERN_WARNING "atkbd.c: Spurious %s on %s. " | 429 | dev_warn(&serio->dev, |
432 | "Some program might be trying access hardware directly.\n", | 430 | "Spurious %s on %s. " |
433 | data == ATKBD_RET_ACK ? "ACK" : "NAK", serio->phys); | 431 | "Some program might be trying access hardware directly.\n", |
434 | goto out; | 432 | data == ATKBD_RET_ACK ? "ACK" : "NAK", serio->phys); |
435 | case ATKBD_RET_ERR: | 433 | goto out; |
436 | atkbd->err_count++; | 434 | case ATKBD_RET_ERR: |
437 | #ifdef ATKBD_DEBUG | 435 | atkbd->err_count++; |
438 | printk(KERN_DEBUG "atkbd.c: Keyboard on %s reports too many keys pressed.\n", serio->phys); | 436 | dev_dbg(&serio->dev, "Keyboard on %s reports too many keys pressed.\n", |
439 | #endif | 437 | serio->phys); |
440 | goto out; | 438 | goto out; |
441 | } | 439 | } |
442 | 440 | ||
443 | code = atkbd_compat_scancode(atkbd, code); | 441 | code = atkbd_compat_scancode(atkbd, code); |
@@ -451,71 +449,72 @@ static irqreturn_t atkbd_interrupt(struct serio *serio, unsigned char data, | |||
451 | input_event(dev, EV_MSC, MSC_SCAN, code); | 449 | input_event(dev, EV_MSC, MSC_SCAN, code); |
452 | 450 | ||
453 | switch (keycode) { | 451 | switch (keycode) { |
454 | case ATKBD_KEY_NULL: | 452 | case ATKBD_KEY_NULL: |
455 | break; | 453 | break; |
456 | case ATKBD_KEY_UNKNOWN: | 454 | case ATKBD_KEY_UNKNOWN: |
457 | printk(KERN_WARNING | 455 | dev_warn(&serio->dev, |
458 | "atkbd.c: Unknown key %s (%s set %d, code %#x on %s).\n", | 456 | "Unknown key %s (%s set %d, code %#x on %s).\n", |
459 | atkbd->release ? "released" : "pressed", | 457 | atkbd->release ? "released" : "pressed", |
460 | atkbd->translated ? "translated" : "raw", | 458 | atkbd->translated ? "translated" : "raw", |
461 | atkbd->set, code, serio->phys); | 459 | atkbd->set, code, serio->phys); |
462 | printk(KERN_WARNING | 460 | dev_warn(&serio->dev, |
463 | "atkbd.c: Use 'setkeycodes %s%02x <keycode>' to make it known.\n", | 461 | "Use 'setkeycodes %s%02x <keycode>' to make it known.\n", |
464 | code & 0x80 ? "e0" : "", code & 0x7f); | 462 | code & 0x80 ? "e0" : "", code & 0x7f); |
465 | input_sync(dev); | 463 | input_sync(dev); |
466 | break; | 464 | break; |
467 | case ATKBD_SCR_1: | 465 | case ATKBD_SCR_1: |
468 | scroll = 1 - atkbd->release * 2; | 466 | scroll = 1; |
469 | break; | 467 | break; |
470 | case ATKBD_SCR_2: | 468 | case ATKBD_SCR_2: |
471 | scroll = 2 - atkbd->release * 4; | 469 | scroll = 2; |
472 | break; | 470 | break; |
473 | case ATKBD_SCR_4: | 471 | case ATKBD_SCR_4: |
474 | scroll = 4 - atkbd->release * 8; | 472 | scroll = 4; |
475 | break; | 473 | break; |
476 | case ATKBD_SCR_8: | 474 | case ATKBD_SCR_8: |
477 | scroll = 8 - atkbd->release * 16; | 475 | scroll = 8; |
478 | break; | 476 | break; |
479 | case ATKBD_SCR_CLICK: | 477 | case ATKBD_SCR_CLICK: |
480 | click = !atkbd->release; | 478 | click = !atkbd->release; |
481 | break; | 479 | break; |
482 | case ATKBD_SCR_LEFT: | 480 | case ATKBD_SCR_LEFT: |
483 | hscroll = -1; | 481 | hscroll = -1; |
484 | break; | 482 | break; |
485 | case ATKBD_SCR_RIGHT: | 483 | case ATKBD_SCR_RIGHT: |
486 | hscroll = 1; | 484 | hscroll = 1; |
487 | break; | 485 | break; |
488 | default: | 486 | default: |
489 | if (atkbd->release) { | 487 | if (atkbd->release) { |
490 | value = 0; | 488 | value = 0; |
491 | atkbd->last = 0; | 489 | atkbd->last = 0; |
492 | } else if (!atkbd->softrepeat && test_bit(keycode, dev->key)) { | 490 | } else if (!atkbd->softrepeat && test_bit(keycode, dev->key)) { |
493 | /* Workaround Toshiba laptop multiple keypress */ | 491 | /* Workaround Toshiba laptop multiple keypress */ |
494 | value = time_before(jiffies, atkbd->time) && atkbd->last == code ? 1 : 2; | 492 | value = time_before(jiffies, atkbd->time) && atkbd->last == code ? 1 : 2; |
495 | } else { | 493 | } else { |
496 | value = 1; | 494 | value = 1; |
497 | atkbd->last = code; | 495 | atkbd->last = code; |
498 | atkbd->time = jiffies + msecs_to_jiffies(dev->rep[REP_DELAY]) / 2; | 496 | atkbd->time = jiffies + msecs_to_jiffies(dev->rep[REP_DELAY]) / 2; |
499 | } | 497 | } |
500 | 498 | ||
501 | input_event(dev, EV_KEY, keycode, value); | 499 | input_event(dev, EV_KEY, keycode, value); |
502 | input_sync(dev); | 500 | input_sync(dev); |
503 | 501 | ||
504 | if (value && test_bit(code, atkbd->force_release_mask)) { | 502 | if (value && test_bit(code, atkbd->force_release_mask)) { |
505 | input_report_key(dev, keycode, 0); | 503 | input_report_key(dev, keycode, 0); |
506 | input_sync(dev); | 504 | input_sync(dev); |
507 | } | 505 | } |
508 | } | 506 | } |
509 | 507 | ||
510 | if (atkbd->scroll) { | 508 | if (atkbd->scroll) { |
511 | if (click != -1) | 509 | if (click != -1) |
512 | input_report_key(dev, BTN_MIDDLE, click); | 510 | input_report_key(dev, BTN_MIDDLE, click); |
513 | input_report_rel(dev, REL_WHEEL, scroll); | 511 | input_report_rel(dev, REL_WHEEL, |
512 | atkbd->release ? -scroll : scroll); | ||
514 | input_report_rel(dev, REL_HWHEEL, hscroll); | 513 | input_report_rel(dev, REL_HWHEEL, hscroll); |
515 | input_sync(dev); | 514 | input_sync(dev); |
516 | } | 515 | } |
517 | 516 | ||
518 | atkbd->release = 0; | 517 | atkbd->release = false; |
519 | out: | 518 | out: |
520 | return IRQ_HANDLED; | 519 | return IRQ_HANDLED; |
521 | } | 520 | } |
@@ -634,17 +633,18 @@ static int atkbd_event(struct input_dev *dev, | |||
634 | 633 | ||
635 | switch (type) { | 634 | switch (type) { |
636 | 635 | ||
637 | case EV_LED: | 636 | case EV_LED: |
638 | atkbd_schedule_event_work(atkbd, ATKBD_LED_EVENT_BIT); | 637 | atkbd_schedule_event_work(atkbd, ATKBD_LED_EVENT_BIT); |
639 | return 0; | 638 | return 0; |
640 | 639 | ||
641 | case EV_REP: | 640 | case EV_REP: |
642 | if (!atkbd->softrepeat) | 641 | if (!atkbd->softrepeat) |
643 | atkbd_schedule_event_work(atkbd, ATKBD_REP_EVENT_BIT); | 642 | atkbd_schedule_event_work(atkbd, ATKBD_REP_EVENT_BIT); |
644 | return 0; | 643 | return 0; |
645 | } | ||
646 | 644 | ||
647 | return -1; | 645 | default: |
646 | return -1; | ||
647 | } | ||
648 | } | 648 | } |
649 | 649 | ||
650 | /* | 650 | /* |
@@ -655,7 +655,7 @@ static int atkbd_event(struct input_dev *dev, | |||
655 | static inline void atkbd_enable(struct atkbd *atkbd) | 655 | static inline void atkbd_enable(struct atkbd *atkbd) |
656 | { | 656 | { |
657 | serio_pause_rx(atkbd->ps2dev.serio); | 657 | serio_pause_rx(atkbd->ps2dev.serio); |
658 | atkbd->enabled = 1; | 658 | atkbd->enabled = true; |
659 | serio_continue_rx(atkbd->ps2dev.serio); | 659 | serio_continue_rx(atkbd->ps2dev.serio); |
660 | } | 660 | } |
661 | 661 | ||
@@ -667,7 +667,7 @@ static inline void atkbd_enable(struct atkbd *atkbd) | |||
667 | static inline void atkbd_disable(struct atkbd *atkbd) | 667 | static inline void atkbd_disable(struct atkbd *atkbd) |
668 | { | 668 | { |
669 | serio_pause_rx(atkbd->ps2dev.serio); | 669 | serio_pause_rx(atkbd->ps2dev.serio); |
670 | atkbd->enabled = 0; | 670 | atkbd->enabled = false; |
671 | serio_continue_rx(atkbd->ps2dev.serio); | 671 | serio_continue_rx(atkbd->ps2dev.serio); |
672 | } | 672 | } |
673 | 673 | ||
@@ -688,7 +688,9 @@ static int atkbd_probe(struct atkbd *atkbd) | |||
688 | 688 | ||
689 | if (atkbd_reset) | 689 | if (atkbd_reset) |
690 | if (ps2_command(ps2dev, NULL, ATKBD_CMD_RESET_BAT)) | 690 | if (ps2_command(ps2dev, NULL, ATKBD_CMD_RESET_BAT)) |
691 | printk(KERN_WARNING "atkbd.c: keyboard reset failed on %s\n", ps2dev->serio->phys); | 691 | dev_warn(&ps2dev->serio->dev, |
692 | "keyboard reset failed on %s\n", | ||
693 | ps2dev->serio->phys); | ||
692 | 694 | ||
693 | /* | 695 | /* |
694 | * Then we check the keyboard ID. We should get 0xab83 under normal conditions. | 696 | * Then we check the keyboard ID. We should get 0xab83 under normal conditions. |
@@ -718,8 +720,9 @@ static int atkbd_probe(struct atkbd *atkbd) | |||
718 | atkbd->id = (param[0] << 8) | param[1]; | 720 | atkbd->id = (param[0] << 8) | param[1]; |
719 | 721 | ||
720 | if (atkbd->id == 0xaca1 && atkbd->translated) { | 722 | if (atkbd->id == 0xaca1 && atkbd->translated) { |
721 | printk(KERN_ERR "atkbd.c: NCD terminal keyboards are only supported on non-translating\n"); | 723 | dev_err(&ps2dev->serio->dev, |
722 | printk(KERN_ERR "atkbd.c: controllers. Use i8042.direct=1 to disable translation.\n"); | 724 | "NCD terminal keyboards are only supported on non-translating controlelrs. " |
725 | "Use i8042.direct=1 to disable translation.\n"); | ||
723 | return -1; | 726 | return -1; |
724 | } | 727 | } |
725 | 728 | ||
@@ -737,7 +740,7 @@ static int atkbd_select_set(struct atkbd *atkbd, int target_set, int allow_extra | |||
737 | struct ps2dev *ps2dev = &atkbd->ps2dev; | 740 | struct ps2dev *ps2dev = &atkbd->ps2dev; |
738 | unsigned char param[2]; | 741 | unsigned char param[2]; |
739 | 742 | ||
740 | atkbd->extra = 0; | 743 | atkbd->extra = false; |
741 | /* | 744 | /* |
742 | * For known special keyboards we can go ahead and set the correct set. | 745 | * For known special keyboards we can go ahead and set the correct set. |
743 | * We check for NCD PS/2 Sun, NorthGate OmniKey 101 and | 746 | * We check for NCD PS/2 Sun, NorthGate OmniKey 101 and |
@@ -756,7 +759,7 @@ static int atkbd_select_set(struct atkbd *atkbd, int target_set, int allow_extra | |||
756 | if (allow_extra) { | 759 | if (allow_extra) { |
757 | param[0] = 0x71; | 760 | param[0] = 0x71; |
758 | if (!ps2_command(ps2dev, param, ATKBD_CMD_EX_ENABLE)) { | 761 | if (!ps2_command(ps2dev, param, ATKBD_CMD_EX_ENABLE)) { |
759 | atkbd->extra = 1; | 762 | atkbd->extra = true; |
760 | return 2; | 763 | return 2; |
761 | } | 764 | } |
762 | } | 765 | } |
@@ -821,7 +824,8 @@ static int atkbd_activate(struct atkbd *atkbd) | |||
821 | */ | 824 | */ |
822 | 825 | ||
823 | if (ps2_command(ps2dev, NULL, ATKBD_CMD_ENABLE)) { | 826 | if (ps2_command(ps2dev, NULL, ATKBD_CMD_ENABLE)) { |
824 | printk(KERN_ERR "atkbd.c: Failed to enable keyboard on %s\n", | 827 | dev_err(&ps2dev->serio->dev, |
828 | "Failed to enable keyboard on %s\n", | ||
825 | ps2dev->serio->phys); | 829 | ps2dev->serio->phys); |
826 | return -1; | 830 | return -1; |
827 | } | 831 | } |
@@ -1070,9 +1074,13 @@ static void atkbd_set_device_attrs(struct atkbd *atkbd) | |||
1070 | input_dev->keycodesize = sizeof(unsigned short); | 1074 | input_dev->keycodesize = sizeof(unsigned short); |
1071 | input_dev->keycodemax = ARRAY_SIZE(atkbd_set2_keycode); | 1075 | input_dev->keycodemax = ARRAY_SIZE(atkbd_set2_keycode); |
1072 | 1076 | ||
1073 | for (i = 0; i < ATKBD_KEYMAP_SIZE; i++) | 1077 | for (i = 0; i < ATKBD_KEYMAP_SIZE; i++) { |
1074 | if (atkbd->keycode[i] && atkbd->keycode[i] < ATKBD_SPECIAL) | 1078 | if (atkbd->keycode[i] != KEY_RESERVED && |
1079 | atkbd->keycode[i] != ATKBD_KEY_NULL && | ||
1080 | atkbd->keycode[i] < ATKBD_SPECIAL) { | ||
1075 | __set_bit(atkbd->keycode[i], input_dev->keybit); | 1081 | __set_bit(atkbd->keycode[i], input_dev->keybit); |
1082 | } | ||
1083 | } | ||
1076 | } | 1084 | } |
1077 | 1085 | ||
1078 | /* | 1086 | /* |
@@ -1100,12 +1108,14 @@ static int atkbd_connect(struct serio *serio, struct serio_driver *drv) | |||
1100 | 1108 | ||
1101 | switch (serio->id.type) { | 1109 | switch (serio->id.type) { |
1102 | 1110 | ||
1103 | case SERIO_8042_XL: | 1111 | case SERIO_8042_XL: |
1104 | atkbd->translated = 1; | 1112 | atkbd->translated = true; |
1105 | case SERIO_8042: | 1113 | /* Fall through */ |
1106 | if (serio->write) | 1114 | |
1107 | atkbd->write = 1; | 1115 | case SERIO_8042: |
1108 | break; | 1116 | if (serio->write) |
1117 | atkbd->write = true; | ||
1118 | break; | ||
1109 | } | 1119 | } |
1110 | 1120 | ||
1111 | atkbd->softraw = atkbd_softraw; | 1121 | atkbd->softraw = atkbd_softraw; |
@@ -1113,7 +1123,7 @@ static int atkbd_connect(struct serio *serio, struct serio_driver *drv) | |||
1113 | atkbd->scroll = atkbd_scroll; | 1123 | atkbd->scroll = atkbd_scroll; |
1114 | 1124 | ||
1115 | if (atkbd->softrepeat) | 1125 | if (atkbd->softrepeat) |
1116 | atkbd->softraw = 1; | 1126 | atkbd->softraw = true; |
1117 | 1127 | ||
1118 | serio_set_drvdata(serio, atkbd); | 1128 | serio_set_drvdata(serio, atkbd); |
1119 | 1129 | ||
@@ -1172,7 +1182,8 @@ static int atkbd_reconnect(struct serio *serio) | |||
1172 | int retval = -1; | 1182 | int retval = -1; |
1173 | 1183 | ||
1174 | if (!atkbd || !drv) { | 1184 | if (!atkbd || !drv) { |
1175 | printk(KERN_DEBUG "atkbd: reconnect request, but serio is disconnected, ignoring...\n"); | 1185 | dev_dbg(&serio->dev, |
1186 | "reconnect request, but serio is disconnected, ignoring...\n"); | ||
1176 | return -1; | 1187 | return -1; |
1177 | } | 1188 | } |
1178 | 1189 | ||
@@ -1286,7 +1297,8 @@ static ssize_t atkbd_set_extra(struct atkbd *atkbd, const char *buf, size_t coun | |||
1286 | struct input_dev *old_dev, *new_dev; | 1297 | struct input_dev *old_dev, *new_dev; |
1287 | unsigned long value; | 1298 | unsigned long value; |
1288 | int err; | 1299 | int err; |
1289 | unsigned char old_extra, old_set; | 1300 | bool old_extra; |
1301 | unsigned char old_set; | ||
1290 | 1302 | ||
1291 | if (!atkbd->write) | 1303 | if (!atkbd->write) |
1292 | return -EIO; | 1304 | return -EIO; |
@@ -1369,7 +1381,7 @@ static ssize_t atkbd_set_scroll(struct atkbd *atkbd, const char *buf, size_t cou | |||
1369 | struct input_dev *old_dev, *new_dev; | 1381 | struct input_dev *old_dev, *new_dev; |
1370 | unsigned long value; | 1382 | unsigned long value; |
1371 | int err; | 1383 | int err; |
1372 | unsigned char old_scroll; | 1384 | bool old_scroll; |
1373 | 1385 | ||
1374 | if (strict_strtoul(buf, 10, &value) || value > 1) | 1386 | if (strict_strtoul(buf, 10, &value) || value > 1) |
1375 | return -EINVAL; | 1387 | return -EINVAL; |
@@ -1413,7 +1425,8 @@ static ssize_t atkbd_set_set(struct atkbd *atkbd, const char *buf, size_t count) | |||
1413 | struct input_dev *old_dev, *new_dev; | 1425 | struct input_dev *old_dev, *new_dev; |
1414 | unsigned long value; | 1426 | unsigned long value; |
1415 | int err; | 1427 | int err; |
1416 | unsigned char old_set, old_extra; | 1428 | unsigned char old_set; |
1429 | bool old_extra; | ||
1417 | 1430 | ||
1418 | if (!atkbd->write) | 1431 | if (!atkbd->write) |
1419 | return -EIO; | 1432 | return -EIO; |
@@ -1463,7 +1476,7 @@ static ssize_t atkbd_set_softrepeat(struct atkbd *atkbd, const char *buf, size_t | |||
1463 | struct input_dev *old_dev, *new_dev; | 1476 | struct input_dev *old_dev, *new_dev; |
1464 | unsigned long value; | 1477 | unsigned long value; |
1465 | int err; | 1478 | int err; |
1466 | unsigned char old_softrepeat, old_softraw; | 1479 | bool old_softrepeat, old_softraw; |
1467 | 1480 | ||
1468 | if (!atkbd->write) | 1481 | if (!atkbd->write) |
1469 | return -EIO; | 1482 | return -EIO; |
@@ -1483,7 +1496,7 @@ static ssize_t atkbd_set_softrepeat(struct atkbd *atkbd, const char *buf, size_t | |||
1483 | atkbd->dev = new_dev; | 1496 | atkbd->dev = new_dev; |
1484 | atkbd->softrepeat = value; | 1497 | atkbd->softrepeat = value; |
1485 | if (atkbd->softrepeat) | 1498 | if (atkbd->softrepeat) |
1486 | atkbd->softraw = 1; | 1499 | atkbd->softraw = true; |
1487 | atkbd_set_device_attrs(atkbd); | 1500 | atkbd_set_device_attrs(atkbd); |
1488 | 1501 | ||
1489 | err = input_register_device(atkbd->dev); | 1502 | err = input_register_device(atkbd->dev); |
@@ -1513,7 +1526,7 @@ static ssize_t atkbd_set_softraw(struct atkbd *atkbd, const char *buf, size_t co | |||
1513 | struct input_dev *old_dev, *new_dev; | 1526 | struct input_dev *old_dev, *new_dev; |
1514 | unsigned long value; | 1527 | unsigned long value; |
1515 | int err; | 1528 | int err; |
1516 | unsigned char old_softraw; | 1529 | bool old_softraw; |
1517 | 1530 | ||
1518 | if (strict_strtoul(buf, 10, &value) || value > 1) | 1531 | if (strict_strtoul(buf, 10, &value) || value > 1) |
1519 | return -EINVAL; | 1532 | return -EINVAL; |