diff options
Diffstat (limited to 'drivers/char/keyboard.c')
-rw-r--r-- | drivers/char/keyboard.c | 162 |
1 files changed, 87 insertions, 75 deletions
diff --git a/drivers/char/keyboard.c b/drivers/char/keyboard.c index 3e90aac37510..7a6c1c0b7a95 100644 --- a/drivers/char/keyboard.c +++ b/drivers/char/keyboard.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/string.h> | 32 | #include <linux/string.h> |
33 | #include <linux/init.h> | 33 | #include <linux/init.h> |
34 | #include <linux/slab.h> | 34 | #include <linux/slab.h> |
35 | #include <linux/irq.h> | ||
35 | 36 | ||
36 | #include <linux/kbd_kern.h> | 37 | #include <linux/kbd_kern.h> |
37 | #include <linux/kbd_diacr.h> | 38 | #include <linux/kbd_diacr.h> |
@@ -77,7 +78,7 @@ void compute_shiftstate(void); | |||
77 | k_slock, k_dead2, k_brl, k_ignore | 78 | k_slock, k_dead2, k_brl, k_ignore |
78 | 79 | ||
79 | typedef void (k_handler_fn)(struct vc_data *vc, unsigned char value, | 80 | typedef void (k_handler_fn)(struct vc_data *vc, unsigned char value, |
80 | char up_flag, struct pt_regs *regs); | 81 | char up_flag); |
81 | static k_handler_fn K_HANDLERS; | 82 | static k_handler_fn K_HANDLERS; |
82 | static k_handler_fn *k_handler[16] = { K_HANDLERS }; | 83 | static k_handler_fn *k_handler[16] = { K_HANDLERS }; |
83 | 84 | ||
@@ -88,7 +89,7 @@ static k_handler_fn *k_handler[16] = { K_HANDLERS }; | |||
88 | fn_boot_it, fn_caps_on, fn_compose, fn_SAK,\ | 89 | fn_boot_it, fn_caps_on, fn_compose, fn_SAK,\ |
89 | fn_dec_console, fn_inc_console, fn_spawn_con, fn_bare_num | 90 | fn_dec_console, fn_inc_console, fn_spawn_con, fn_bare_num |
90 | 91 | ||
91 | typedef void (fn_handler_fn)(struct vc_data *vc, struct pt_regs *regs); | 92 | typedef void (fn_handler_fn)(struct vc_data *vc); |
92 | static fn_handler_fn FN_HANDLERS; | 93 | static fn_handler_fn FN_HANDLERS; |
93 | static fn_handler_fn *fn_handler[] = { FN_HANDLERS }; | 94 | static fn_handler_fn *fn_handler[] = { FN_HANDLERS }; |
94 | 95 | ||
@@ -108,7 +109,11 @@ const int NR_TYPES = ARRAY_SIZE(max_vals); | |||
108 | struct kbd_struct kbd_table[MAX_NR_CONSOLES]; | 109 | struct kbd_struct kbd_table[MAX_NR_CONSOLES]; |
109 | static struct kbd_struct *kbd = kbd_table; | 110 | static struct kbd_struct *kbd = kbd_table; |
110 | 111 | ||
111 | int spawnpid, spawnsig; | 112 | struct vt_spawn_console vt_spawn_con = { |
113 | .lock = SPIN_LOCK_UNLOCKED, | ||
114 | .pid = NULL, | ||
115 | .sig = 0, | ||
116 | }; | ||
112 | 117 | ||
113 | /* | 118 | /* |
114 | * Variables exported for vt.c | 119 | * Variables exported for vt.c |
@@ -424,7 +429,7 @@ static unsigned int handle_diacr(struct vc_data *vc, unsigned int ch) | |||
424 | /* | 429 | /* |
425 | * Special function handlers | 430 | * Special function handlers |
426 | */ | 431 | */ |
427 | static void fn_enter(struct vc_data *vc, struct pt_regs *regs) | 432 | static void fn_enter(struct vc_data *vc) |
428 | { | 433 | { |
429 | if (diacr) { | 434 | if (diacr) { |
430 | if (kbd->kbdmode == VC_UNICODE) | 435 | if (kbd->kbdmode == VC_UNICODE) |
@@ -438,27 +443,28 @@ static void fn_enter(struct vc_data *vc, struct pt_regs *regs) | |||
438 | put_queue(vc, 10); | 443 | put_queue(vc, 10); |
439 | } | 444 | } |
440 | 445 | ||
441 | static void fn_caps_toggle(struct vc_data *vc, struct pt_regs *regs) | 446 | static void fn_caps_toggle(struct vc_data *vc) |
442 | { | 447 | { |
443 | if (rep) | 448 | if (rep) |
444 | return; | 449 | return; |
445 | chg_vc_kbd_led(kbd, VC_CAPSLOCK); | 450 | chg_vc_kbd_led(kbd, VC_CAPSLOCK); |
446 | } | 451 | } |
447 | 452 | ||
448 | static void fn_caps_on(struct vc_data *vc, struct pt_regs *regs) | 453 | static void fn_caps_on(struct vc_data *vc) |
449 | { | 454 | { |
450 | if (rep) | 455 | if (rep) |
451 | return; | 456 | return; |
452 | set_vc_kbd_led(kbd, VC_CAPSLOCK); | 457 | set_vc_kbd_led(kbd, VC_CAPSLOCK); |
453 | } | 458 | } |
454 | 459 | ||
455 | static void fn_show_ptregs(struct vc_data *vc, struct pt_regs *regs) | 460 | static void fn_show_ptregs(struct vc_data *vc) |
456 | { | 461 | { |
462 | struct pt_regs *regs = get_irq_regs(); | ||
457 | if (regs) | 463 | if (regs) |
458 | show_regs(regs); | 464 | show_regs(regs); |
459 | } | 465 | } |
460 | 466 | ||
461 | static void fn_hold(struct vc_data *vc, struct pt_regs *regs) | 467 | static void fn_hold(struct vc_data *vc) |
462 | { | 468 | { |
463 | struct tty_struct *tty = vc->vc_tty; | 469 | struct tty_struct *tty = vc->vc_tty; |
464 | 470 | ||
@@ -476,12 +482,12 @@ static void fn_hold(struct vc_data *vc, struct pt_regs *regs) | |||
476 | stop_tty(tty); | 482 | stop_tty(tty); |
477 | } | 483 | } |
478 | 484 | ||
479 | static void fn_num(struct vc_data *vc, struct pt_regs *regs) | 485 | static void fn_num(struct vc_data *vc) |
480 | { | 486 | { |
481 | if (vc_kbd_mode(kbd,VC_APPLIC)) | 487 | if (vc_kbd_mode(kbd,VC_APPLIC)) |
482 | applkey(vc, 'P', 1); | 488 | applkey(vc, 'P', 1); |
483 | else | 489 | else |
484 | fn_bare_num(vc, regs); | 490 | fn_bare_num(vc); |
485 | } | 491 | } |
486 | 492 | ||
487 | /* | 493 | /* |
@@ -490,19 +496,19 @@ static void fn_num(struct vc_data *vc, struct pt_regs *regs) | |||
490 | * Bind this to NumLock if you prefer that the NumLock key always | 496 | * Bind this to NumLock if you prefer that the NumLock key always |
491 | * changes the NumLock flag. | 497 | * changes the NumLock flag. |
492 | */ | 498 | */ |
493 | static void fn_bare_num(struct vc_data *vc, struct pt_regs *regs) | 499 | static void fn_bare_num(struct vc_data *vc) |
494 | { | 500 | { |
495 | if (!rep) | 501 | if (!rep) |
496 | chg_vc_kbd_led(kbd, VC_NUMLOCK); | 502 | chg_vc_kbd_led(kbd, VC_NUMLOCK); |
497 | } | 503 | } |
498 | 504 | ||
499 | static void fn_lastcons(struct vc_data *vc, struct pt_regs *regs) | 505 | static void fn_lastcons(struct vc_data *vc) |
500 | { | 506 | { |
501 | /* switch to the last used console, ChN */ | 507 | /* switch to the last used console, ChN */ |
502 | set_console(last_console); | 508 | set_console(last_console); |
503 | } | 509 | } |
504 | 510 | ||
505 | static void fn_dec_console(struct vc_data *vc, struct pt_regs *regs) | 511 | static void fn_dec_console(struct vc_data *vc) |
506 | { | 512 | { |
507 | int i, cur = fg_console; | 513 | int i, cur = fg_console; |
508 | 514 | ||
@@ -519,7 +525,7 @@ static void fn_dec_console(struct vc_data *vc, struct pt_regs *regs) | |||
519 | set_console(i); | 525 | set_console(i); |
520 | } | 526 | } |
521 | 527 | ||
522 | static void fn_inc_console(struct vc_data *vc, struct pt_regs *regs) | 528 | static void fn_inc_console(struct vc_data *vc) |
523 | { | 529 | { |
524 | int i, cur = fg_console; | 530 | int i, cur = fg_console; |
525 | 531 | ||
@@ -536,7 +542,7 @@ static void fn_inc_console(struct vc_data *vc, struct pt_regs *regs) | |||
536 | set_console(i); | 542 | set_console(i); |
537 | } | 543 | } |
538 | 544 | ||
539 | static void fn_send_intr(struct vc_data *vc, struct pt_regs *regs) | 545 | static void fn_send_intr(struct vc_data *vc) |
540 | { | 546 | { |
541 | struct tty_struct *tty = vc->vc_tty; | 547 | struct tty_struct *tty = vc->vc_tty; |
542 | 548 | ||
@@ -546,44 +552,48 @@ static void fn_send_intr(struct vc_data *vc, struct pt_regs *regs) | |||
546 | con_schedule_flip(tty); | 552 | con_schedule_flip(tty); |
547 | } | 553 | } |
548 | 554 | ||
549 | static void fn_scroll_forw(struct vc_data *vc, struct pt_regs *regs) | 555 | static void fn_scroll_forw(struct vc_data *vc) |
550 | { | 556 | { |
551 | scrollfront(vc, 0); | 557 | scrollfront(vc, 0); |
552 | } | 558 | } |
553 | 559 | ||
554 | static void fn_scroll_back(struct vc_data *vc, struct pt_regs *regs) | 560 | static void fn_scroll_back(struct vc_data *vc) |
555 | { | 561 | { |
556 | scrollback(vc, 0); | 562 | scrollback(vc, 0); |
557 | } | 563 | } |
558 | 564 | ||
559 | static void fn_show_mem(struct vc_data *vc, struct pt_regs *regs) | 565 | static void fn_show_mem(struct vc_data *vc) |
560 | { | 566 | { |
561 | show_mem(); | 567 | show_mem(); |
562 | } | 568 | } |
563 | 569 | ||
564 | static void fn_show_state(struct vc_data *vc, struct pt_regs *regs) | 570 | static void fn_show_state(struct vc_data *vc) |
565 | { | 571 | { |
566 | show_state(); | 572 | show_state(); |
567 | } | 573 | } |
568 | 574 | ||
569 | static void fn_boot_it(struct vc_data *vc, struct pt_regs *regs) | 575 | static void fn_boot_it(struct vc_data *vc) |
570 | { | 576 | { |
571 | ctrl_alt_del(); | 577 | ctrl_alt_del(); |
572 | } | 578 | } |
573 | 579 | ||
574 | static void fn_compose(struct vc_data *vc, struct pt_regs *regs) | 580 | static void fn_compose(struct vc_data *vc) |
575 | { | 581 | { |
576 | dead_key_next = 1; | 582 | dead_key_next = 1; |
577 | } | 583 | } |
578 | 584 | ||
579 | static void fn_spawn_con(struct vc_data *vc, struct pt_regs *regs) | 585 | static void fn_spawn_con(struct vc_data *vc) |
580 | { | 586 | { |
581 | if (spawnpid) | 587 | spin_lock(&vt_spawn_con.lock); |
582 | if (kill_proc(spawnpid, spawnsig, 1)) | 588 | if (vt_spawn_con.pid) |
583 | spawnpid = 0; | 589 | if (kill_pid(vt_spawn_con.pid, vt_spawn_con.sig, 1)) { |
590 | put_pid(vt_spawn_con.pid); | ||
591 | vt_spawn_con.pid = NULL; | ||
592 | } | ||
593 | spin_unlock(&vt_spawn_con.lock); | ||
584 | } | 594 | } |
585 | 595 | ||
586 | static void fn_SAK(struct vc_data *vc, struct pt_regs *regs) | 596 | static void fn_SAK(struct vc_data *vc) |
587 | { | 597 | { |
588 | struct tty_struct *tty = vc->vc_tty; | 598 | struct tty_struct *tty = vc->vc_tty; |
589 | 599 | ||
@@ -596,7 +606,7 @@ static void fn_SAK(struct vc_data *vc, struct pt_regs *regs) | |||
596 | reset_vc(vc); | 606 | reset_vc(vc); |
597 | } | 607 | } |
598 | 608 | ||
599 | static void fn_null(struct vc_data *vc, struct pt_regs *regs) | 609 | static void fn_null(struct vc_data *vc) |
600 | { | 610 | { |
601 | compute_shiftstate(); | 611 | compute_shiftstate(); |
602 | } | 612 | } |
@@ -604,11 +614,11 @@ static void fn_null(struct vc_data *vc, struct pt_regs *regs) | |||
604 | /* | 614 | /* |
605 | * Special key handlers | 615 | * Special key handlers |
606 | */ | 616 | */ |
607 | static void k_ignore(struct vc_data *vc, unsigned char value, char up_flag, struct pt_regs *regs) | 617 | static void k_ignore(struct vc_data *vc, unsigned char value, char up_flag) |
608 | { | 618 | { |
609 | } | 619 | } |
610 | 620 | ||
611 | static void k_spec(struct vc_data *vc, unsigned char value, char up_flag, struct pt_regs *regs) | 621 | static void k_spec(struct vc_data *vc, unsigned char value, char up_flag) |
612 | { | 622 | { |
613 | if (up_flag) | 623 | if (up_flag) |
614 | return; | 624 | return; |
@@ -618,15 +628,15 @@ static void k_spec(struct vc_data *vc, unsigned char value, char up_flag, struct | |||
618 | kbd->kbdmode == VC_MEDIUMRAW) && | 628 | kbd->kbdmode == VC_MEDIUMRAW) && |
619 | value != KVAL(K_SAK)) | 629 | value != KVAL(K_SAK)) |
620 | return; /* SAK is allowed even in raw mode */ | 630 | return; /* SAK is allowed even in raw mode */ |
621 | fn_handler[value](vc, regs); | 631 | fn_handler[value](vc); |
622 | } | 632 | } |
623 | 633 | ||
624 | static void k_lowercase(struct vc_data *vc, unsigned char value, char up_flag, struct pt_regs *regs) | 634 | static void k_lowercase(struct vc_data *vc, unsigned char value, char up_flag) |
625 | { | 635 | { |
626 | printk(KERN_ERR "keyboard.c: k_lowercase was called - impossible\n"); | 636 | printk(KERN_ERR "keyboard.c: k_lowercase was called - impossible\n"); |
627 | } | 637 | } |
628 | 638 | ||
629 | static void k_unicode(struct vc_data *vc, unsigned int value, char up_flag, struct pt_regs *regs) | 639 | static void k_unicode(struct vc_data *vc, unsigned int value, char up_flag) |
630 | { | 640 | { |
631 | if (up_flag) | 641 | if (up_flag) |
632 | return; /* no action, if this is a key release */ | 642 | return; /* no action, if this is a key release */ |
@@ -650,41 +660,41 @@ static void k_unicode(struct vc_data *vc, unsigned int value, char up_flag, stru | |||
650 | * dead keys modifying the same character. Very useful | 660 | * dead keys modifying the same character. Very useful |
651 | * for Vietnamese. | 661 | * for Vietnamese. |
652 | */ | 662 | */ |
653 | static void k_deadunicode(struct vc_data *vc, unsigned int value, char up_flag, struct pt_regs *regs) | 663 | static void k_deadunicode(struct vc_data *vc, unsigned int value, char up_flag) |
654 | { | 664 | { |
655 | if (up_flag) | 665 | if (up_flag) |
656 | return; | 666 | return; |
657 | diacr = (diacr ? handle_diacr(vc, value) : value); | 667 | diacr = (diacr ? handle_diacr(vc, value) : value); |
658 | } | 668 | } |
659 | 669 | ||
660 | static void k_self(struct vc_data *vc, unsigned char value, char up_flag, struct pt_regs *regs) | 670 | static void k_self(struct vc_data *vc, unsigned char value, char up_flag) |
661 | { | 671 | { |
662 | k_unicode(vc, value, up_flag, regs); | 672 | k_unicode(vc, value, up_flag); |
663 | } | 673 | } |
664 | 674 | ||
665 | static void k_dead2(struct vc_data *vc, unsigned char value, char up_flag, struct pt_regs *regs) | 675 | static void k_dead2(struct vc_data *vc, unsigned char value, char up_flag) |
666 | { | 676 | { |
667 | k_deadunicode(vc, value, up_flag, regs); | 677 | k_deadunicode(vc, value, up_flag); |
668 | } | 678 | } |
669 | 679 | ||
670 | /* | 680 | /* |
671 | * Obsolete - for backwards compatibility only | 681 | * Obsolete - for backwards compatibility only |
672 | */ | 682 | */ |
673 | static void k_dead(struct vc_data *vc, unsigned char value, char up_flag, struct pt_regs *regs) | 683 | static void k_dead(struct vc_data *vc, unsigned char value, char up_flag) |
674 | { | 684 | { |
675 | static const unsigned char ret_diacr[NR_DEAD] = {'`', '\'', '^', '~', '"', ',' }; | 685 | static const unsigned char ret_diacr[NR_DEAD] = {'`', '\'', '^', '~', '"', ',' }; |
676 | value = ret_diacr[value]; | 686 | value = ret_diacr[value]; |
677 | k_deadunicode(vc, value, up_flag, regs); | 687 | k_deadunicode(vc, value, up_flag); |
678 | } | 688 | } |
679 | 689 | ||
680 | static void k_cons(struct vc_data *vc, unsigned char value, char up_flag, struct pt_regs *regs) | 690 | static void k_cons(struct vc_data *vc, unsigned char value, char up_flag) |
681 | { | 691 | { |
682 | if (up_flag) | 692 | if (up_flag) |
683 | return; | 693 | return; |
684 | set_console(value); | 694 | set_console(value); |
685 | } | 695 | } |
686 | 696 | ||
687 | static void k_fn(struct vc_data *vc, unsigned char value, char up_flag, struct pt_regs *regs) | 697 | static void k_fn(struct vc_data *vc, unsigned char value, char up_flag) |
688 | { | 698 | { |
689 | unsigned v; | 699 | unsigned v; |
690 | 700 | ||
@@ -698,16 +708,16 @@ static void k_fn(struct vc_data *vc, unsigned char value, char up_flag, struct p | |||
698 | printk(KERN_ERR "k_fn called with value=%d\n", value); | 708 | printk(KERN_ERR "k_fn called with value=%d\n", value); |
699 | } | 709 | } |
700 | 710 | ||
701 | static void k_cur(struct vc_data *vc, unsigned char value, char up_flag, struct pt_regs *regs) | 711 | static void k_cur(struct vc_data *vc, unsigned char value, char up_flag) |
702 | { | 712 | { |
703 | static const char *cur_chars = "BDCA"; | 713 | static const char cur_chars[] = "BDCA"; |
704 | 714 | ||
705 | if (up_flag) | 715 | if (up_flag) |
706 | return; | 716 | return; |
707 | applkey(vc, cur_chars[value], vc_kbd_mode(kbd, VC_CKMODE)); | 717 | applkey(vc, cur_chars[value], vc_kbd_mode(kbd, VC_CKMODE)); |
708 | } | 718 | } |
709 | 719 | ||
710 | static void k_pad(struct vc_data *vc, unsigned char value, char up_flag, struct pt_regs *regs) | 720 | static void k_pad(struct vc_data *vc, unsigned char value, char up_flag) |
711 | { | 721 | { |
712 | static const char pad_chars[] = "0123456789+-*/\015,.?()#"; | 722 | static const char pad_chars[] = "0123456789+-*/\015,.?()#"; |
713 | static const char app_map[] = "pqrstuvwxylSRQMnnmPQS"; | 723 | static const char app_map[] = "pqrstuvwxylSRQMnnmPQS"; |
@@ -725,34 +735,34 @@ static void k_pad(struct vc_data *vc, unsigned char value, char up_flag, struct | |||
725 | switch (value) { | 735 | switch (value) { |
726 | case KVAL(K_PCOMMA): | 736 | case KVAL(K_PCOMMA): |
727 | case KVAL(K_PDOT): | 737 | case KVAL(K_PDOT): |
728 | k_fn(vc, KVAL(K_REMOVE), 0, regs); | 738 | k_fn(vc, KVAL(K_REMOVE), 0); |
729 | return; | 739 | return; |
730 | case KVAL(K_P0): | 740 | case KVAL(K_P0): |
731 | k_fn(vc, KVAL(K_INSERT), 0, regs); | 741 | k_fn(vc, KVAL(K_INSERT), 0); |
732 | return; | 742 | return; |
733 | case KVAL(K_P1): | 743 | case KVAL(K_P1): |
734 | k_fn(vc, KVAL(K_SELECT), 0, regs); | 744 | k_fn(vc, KVAL(K_SELECT), 0); |
735 | return; | 745 | return; |
736 | case KVAL(K_P2): | 746 | case KVAL(K_P2): |
737 | k_cur(vc, KVAL(K_DOWN), 0, regs); | 747 | k_cur(vc, KVAL(K_DOWN), 0); |
738 | return; | 748 | return; |
739 | case KVAL(K_P3): | 749 | case KVAL(K_P3): |
740 | k_fn(vc, KVAL(K_PGDN), 0, regs); | 750 | k_fn(vc, KVAL(K_PGDN), 0); |
741 | return; | 751 | return; |
742 | case KVAL(K_P4): | 752 | case KVAL(K_P4): |
743 | k_cur(vc, KVAL(K_LEFT), 0, regs); | 753 | k_cur(vc, KVAL(K_LEFT), 0); |
744 | return; | 754 | return; |
745 | case KVAL(K_P6): | 755 | case KVAL(K_P6): |
746 | k_cur(vc, KVAL(K_RIGHT), 0, regs); | 756 | k_cur(vc, KVAL(K_RIGHT), 0); |
747 | return; | 757 | return; |
748 | case KVAL(K_P7): | 758 | case KVAL(K_P7): |
749 | k_fn(vc, KVAL(K_FIND), 0, regs); | 759 | k_fn(vc, KVAL(K_FIND), 0); |
750 | return; | 760 | return; |
751 | case KVAL(K_P8): | 761 | case KVAL(K_P8): |
752 | k_cur(vc, KVAL(K_UP), 0, regs); | 762 | k_cur(vc, KVAL(K_UP), 0); |
753 | return; | 763 | return; |
754 | case KVAL(K_P9): | 764 | case KVAL(K_P9): |
755 | k_fn(vc, KVAL(K_PGUP), 0, regs); | 765 | k_fn(vc, KVAL(K_PGUP), 0); |
756 | return; | 766 | return; |
757 | case KVAL(K_P5): | 767 | case KVAL(K_P5): |
758 | applkey(vc, 'G', vc_kbd_mode(kbd, VC_APPLIC)); | 768 | applkey(vc, 'G', vc_kbd_mode(kbd, VC_APPLIC)); |
@@ -764,7 +774,7 @@ static void k_pad(struct vc_data *vc, unsigned char value, char up_flag, struct | |||
764 | put_queue(vc, 10); | 774 | put_queue(vc, 10); |
765 | } | 775 | } |
766 | 776 | ||
767 | static void k_shift(struct vc_data *vc, unsigned char value, char up_flag, struct pt_regs *regs) | 777 | static void k_shift(struct vc_data *vc, unsigned char value, char up_flag) |
768 | { | 778 | { |
769 | int old_state = shift_state; | 779 | int old_state = shift_state; |
770 | 780 | ||
@@ -805,7 +815,7 @@ static void k_shift(struct vc_data *vc, unsigned char value, char up_flag, struc | |||
805 | } | 815 | } |
806 | } | 816 | } |
807 | 817 | ||
808 | static void k_meta(struct vc_data *vc, unsigned char value, char up_flag, struct pt_regs *regs) | 818 | static void k_meta(struct vc_data *vc, unsigned char value, char up_flag) |
809 | { | 819 | { |
810 | if (up_flag) | 820 | if (up_flag) |
811 | return; | 821 | return; |
@@ -817,7 +827,7 @@ static void k_meta(struct vc_data *vc, unsigned char value, char up_flag, struct | |||
817 | put_queue(vc, value | 0x80); | 827 | put_queue(vc, value | 0x80); |
818 | } | 828 | } |
819 | 829 | ||
820 | static void k_ascii(struct vc_data *vc, unsigned char value, char up_flag, struct pt_regs *regs) | 830 | static void k_ascii(struct vc_data *vc, unsigned char value, char up_flag) |
821 | { | 831 | { |
822 | int base; | 832 | int base; |
823 | 833 | ||
@@ -839,16 +849,16 @@ static void k_ascii(struct vc_data *vc, unsigned char value, char up_flag, struc | |||
839 | npadch = npadch * base + value; | 849 | npadch = npadch * base + value; |
840 | } | 850 | } |
841 | 851 | ||
842 | static void k_lock(struct vc_data *vc, unsigned char value, char up_flag, struct pt_regs *regs) | 852 | static void k_lock(struct vc_data *vc, unsigned char value, char up_flag) |
843 | { | 853 | { |
844 | if (up_flag || rep) | 854 | if (up_flag || rep) |
845 | return; | 855 | return; |
846 | chg_vc_kbd_lock(kbd, value); | 856 | chg_vc_kbd_lock(kbd, value); |
847 | } | 857 | } |
848 | 858 | ||
849 | static void k_slock(struct vc_data *vc, unsigned char value, char up_flag, struct pt_regs *regs) | 859 | static void k_slock(struct vc_data *vc, unsigned char value, char up_flag) |
850 | { | 860 | { |
851 | k_shift(vc, value, up_flag, regs); | 861 | k_shift(vc, value, up_flag); |
852 | if (up_flag || rep) | 862 | if (up_flag || rep) |
853 | return; | 863 | return; |
854 | chg_vc_kbd_slock(kbd, value); | 864 | chg_vc_kbd_slock(kbd, value); |
@@ -868,25 +878,25 @@ static unsigned brl_nbchords = 1; | |||
868 | MODULE_PARM_DESC(brl_nbchords, "Number of chords that produce a braille pattern (0 for dead chords)"); | 878 | MODULE_PARM_DESC(brl_nbchords, "Number of chords that produce a braille pattern (0 for dead chords)"); |
869 | module_param(brl_nbchords, uint, 0644); | 879 | module_param(brl_nbchords, uint, 0644); |
870 | 880 | ||
871 | static void k_brlcommit(struct vc_data *vc, unsigned int pattern, char up_flag, struct pt_regs *regs) | 881 | static void k_brlcommit(struct vc_data *vc, unsigned int pattern, char up_flag) |
872 | { | 882 | { |
873 | static unsigned long chords; | 883 | static unsigned long chords; |
874 | static unsigned committed; | 884 | static unsigned committed; |
875 | 885 | ||
876 | if (!brl_nbchords) | 886 | if (!brl_nbchords) |
877 | k_deadunicode(vc, BRL_UC_ROW | pattern, up_flag, regs); | 887 | k_deadunicode(vc, BRL_UC_ROW | pattern, up_flag); |
878 | else { | 888 | else { |
879 | committed |= pattern; | 889 | committed |= pattern; |
880 | chords++; | 890 | chords++; |
881 | if (chords == brl_nbchords) { | 891 | if (chords == brl_nbchords) { |
882 | k_unicode(vc, BRL_UC_ROW | committed, up_flag, regs); | 892 | k_unicode(vc, BRL_UC_ROW | committed, up_flag); |
883 | chords = 0; | 893 | chords = 0; |
884 | committed = 0; | 894 | committed = 0; |
885 | } | 895 | } |
886 | } | 896 | } |
887 | } | 897 | } |
888 | 898 | ||
889 | static void k_brl(struct vc_data *vc, unsigned char value, char up_flag, struct pt_regs *regs) | 899 | static void k_brl(struct vc_data *vc, unsigned char value, char up_flag) |
890 | { | 900 | { |
891 | static unsigned pressed,committing; | 901 | static unsigned pressed,committing; |
892 | static unsigned long releasestart; | 902 | static unsigned long releasestart; |
@@ -898,7 +908,7 @@ static void k_brl(struct vc_data *vc, unsigned char value, char up_flag, struct | |||
898 | } | 908 | } |
899 | 909 | ||
900 | if (!value) { | 910 | if (!value) { |
901 | k_unicode(vc, BRL_UC_ROW, up_flag, regs); | 911 | k_unicode(vc, BRL_UC_ROW, up_flag); |
902 | return; | 912 | return; |
903 | } | 913 | } |
904 | 914 | ||
@@ -915,13 +925,13 @@ static void k_brl(struct vc_data *vc, unsigned char value, char up_flag, struct | |||
915 | pressed &= ~(1 << (value - 1)); | 925 | pressed &= ~(1 << (value - 1)); |
916 | if (!pressed) { | 926 | if (!pressed) { |
917 | if (committing) { | 927 | if (committing) { |
918 | k_brlcommit(vc, committing, 0, regs); | 928 | k_brlcommit(vc, committing, 0); |
919 | committing = 0; | 929 | committing = 0; |
920 | } | 930 | } |
921 | } | 931 | } |
922 | } else { | 932 | } else { |
923 | if (committing) { | 933 | if (committing) { |
924 | k_brlcommit(vc, committing, 0, regs); | 934 | k_brlcommit(vc, committing, 0); |
925 | committing = 0; | 935 | committing = 0; |
926 | } | 936 | } |
927 | pressed &= ~(1 << (value - 1)); | 937 | pressed &= ~(1 << (value - 1)); |
@@ -1125,8 +1135,7 @@ static void kbd_rawcode(unsigned char data) | |||
1125 | put_queue(vc, data); | 1135 | put_queue(vc, data); |
1126 | } | 1136 | } |
1127 | 1137 | ||
1128 | static void kbd_keycode(unsigned int keycode, int down, | 1138 | static void kbd_keycode(unsigned int keycode, int down, int hw_raw) |
1129 | int hw_raw, struct pt_regs *regs) | ||
1130 | { | 1139 | { |
1131 | struct vc_data *vc = vc_cons[fg_console].d; | 1140 | struct vc_data *vc = vc_cons[fg_console].d; |
1132 | unsigned short keysym, *key_map; | 1141 | unsigned short keysym, *key_map; |
@@ -1173,7 +1182,7 @@ static void kbd_keycode(unsigned int keycode, int down, | |||
1173 | if (sysrq_down && !down && keycode == sysrq_alt_use) | 1182 | if (sysrq_down && !down && keycode == sysrq_alt_use) |
1174 | sysrq_down = 0; | 1183 | sysrq_down = 0; |
1175 | if (sysrq_down && down && !rep) { | 1184 | if (sysrq_down && down && !rep) { |
1176 | handle_sysrq(kbd_sysrq_xlate[keycode], regs, tty); | 1185 | handle_sysrq(kbd_sysrq_xlate[keycode], tty); |
1177 | return; | 1186 | return; |
1178 | } | 1187 | } |
1179 | #endif | 1188 | #endif |
@@ -1259,7 +1268,7 @@ static void kbd_keycode(unsigned int keycode, int down, | |||
1259 | } | 1268 | } |
1260 | } | 1269 | } |
1261 | 1270 | ||
1262 | (*k_handler[type])(vc, keysym & 0xff, !down, regs); | 1271 | (*k_handler[type])(vc, keysym & 0xff, !down); |
1263 | 1272 | ||
1264 | if (type != KT_SLOCK) | 1273 | if (type != KT_SLOCK) |
1265 | kbd->slockstate = 0; | 1274 | kbd->slockstate = 0; |
@@ -1271,7 +1280,7 @@ static void kbd_event(struct input_handle *handle, unsigned int event_type, | |||
1271 | if (event_type == EV_MSC && event_code == MSC_RAW && HW_RAW(handle->dev)) | 1280 | if (event_type == EV_MSC && event_code == MSC_RAW && HW_RAW(handle->dev)) |
1272 | kbd_rawcode(value); | 1281 | kbd_rawcode(value); |
1273 | if (event_type == EV_KEY) | 1282 | if (event_type == EV_KEY) |
1274 | kbd_keycode(event_code, value, HW_RAW(handle->dev), handle->dev->regs); | 1283 | kbd_keycode(event_code, value, HW_RAW(handle->dev)); |
1275 | tasklet_schedule(&keyboard_tasklet); | 1284 | tasklet_schedule(&keyboard_tasklet); |
1276 | do_poke_blanked_console = 1; | 1285 | do_poke_blanked_console = 1; |
1277 | schedule_console_callback(); | 1286 | schedule_console_callback(); |
@@ -1285,7 +1294,7 @@ static void kbd_event(struct input_handle *handle, unsigned int event_type, | |||
1285 | */ | 1294 | */ |
1286 | static struct input_handle *kbd_connect(struct input_handler *handler, | 1295 | static struct input_handle *kbd_connect(struct input_handler *handler, |
1287 | struct input_dev *dev, | 1296 | struct input_dev *dev, |
1288 | struct input_device_id *id) | 1297 | const struct input_device_id *id) |
1289 | { | 1298 | { |
1290 | struct input_handle *handle; | 1299 | struct input_handle *handle; |
1291 | int i; | 1300 | int i; |
@@ -1334,7 +1343,7 @@ static void kbd_start(struct input_handle *handle) | |||
1334 | tasklet_enable(&keyboard_tasklet); | 1343 | tasklet_enable(&keyboard_tasklet); |
1335 | } | 1344 | } |
1336 | 1345 | ||
1337 | static struct input_device_id kbd_ids[] = { | 1346 | static const struct input_device_id kbd_ids[] = { |
1338 | { | 1347 | { |
1339 | .flags = INPUT_DEVICE_ID_MATCH_EVBIT, | 1348 | .flags = INPUT_DEVICE_ID_MATCH_EVBIT, |
1340 | .evbit = { BIT(EV_KEY) }, | 1349 | .evbit = { BIT(EV_KEY) }, |
@@ -1362,6 +1371,7 @@ static struct input_handler kbd_handler = { | |||
1362 | int __init kbd_init(void) | 1371 | int __init kbd_init(void) |
1363 | { | 1372 | { |
1364 | int i; | 1373 | int i; |
1374 | int error; | ||
1365 | 1375 | ||
1366 | for (i = 0; i < MAX_NR_CONSOLES; i++) { | 1376 | for (i = 0; i < MAX_NR_CONSOLES; i++) { |
1367 | kbd_table[i].ledflagstate = KBD_DEFLEDS; | 1377 | kbd_table[i].ledflagstate = KBD_DEFLEDS; |
@@ -1373,7 +1383,9 @@ int __init kbd_init(void) | |||
1373 | kbd_table[i].kbdmode = VC_XLATE; | 1383 | kbd_table[i].kbdmode = VC_XLATE; |
1374 | } | 1384 | } |
1375 | 1385 | ||
1376 | input_register_handler(&kbd_handler); | 1386 | error = input_register_handler(&kbd_handler); |
1387 | if (error) | ||
1388 | return error; | ||
1377 | 1389 | ||
1378 | tasklet_enable(&keyboard_tasklet); | 1390 | tasklet_enable(&keyboard_tasklet); |
1379 | tasklet_schedule(&keyboard_tasklet); | 1391 | tasklet_schedule(&keyboard_tasklet); |