Lines Matching refs:sysrq

793 	struct sysrq_state *sysrq =  in sysrq_reinject_alt_sysrq()  local
795 struct input_handle *handle = &sysrq->handle; in sysrq_reinject_alt_sysrq()
796 unsigned int alt_code = sysrq->alt_use; in sysrq_reinject_alt_sysrq()
798 if (sysrq->need_reinject) { in sysrq_reinject_alt_sysrq()
800 sysrq->reinjecting = true; in sysrq_reinject_alt_sysrq()
813 sysrq->reinjecting = false; in sysrq_reinject_alt_sysrq()
817 static bool sysrq_handle_keypress(struct sysrq_state *sysrq, in sysrq_handle_keypress() argument
820 bool was_active = sysrq->active; in sysrq_handle_keypress()
829 if (sysrq->active && code == sysrq->alt_use) in sysrq_handle_keypress()
830 sysrq->active = false; in sysrq_handle_keypress()
832 sysrq->alt = KEY_RESERVED; in sysrq_handle_keypress()
835 sysrq->alt = code; in sysrq_handle_keypress()
836 sysrq->need_reinject = false; in sysrq_handle_keypress()
843 sysrq->shift = KEY_RESERVED; in sysrq_handle_keypress()
845 sysrq->shift = code; in sysrq_handle_keypress()
846 if (sysrq->active) in sysrq_handle_keypress()
847 sysrq->shift_use = sysrq->shift; in sysrq_handle_keypress()
851 if (value == 1 && sysrq->alt != KEY_RESERVED) { in sysrq_handle_keypress()
852 sysrq->active = true; in sysrq_handle_keypress()
853 sysrq->alt_use = sysrq->alt; in sysrq_handle_keypress()
855 sysrq->shift_use = sysrq->shift; in sysrq_handle_keypress()
860 sysrq->need_reinject = true; in sysrq_handle_keypress()
871 if (sysrq->active) in sysrq_handle_keypress()
872 clear_bit(KEY_SYSRQ, sysrq->handle.dev->key); in sysrq_handle_keypress()
877 if (sysrq->active && value && value != 2) { in sysrq_handle_keypress()
880 sysrq->need_reinject = false; in sysrq_handle_keypress()
881 if (sysrq->shift_use != KEY_RESERVED) in sysrq_handle_keypress()
888 suppress = sysrq->active; in sysrq_handle_keypress()
890 if (!sysrq->active) { in sysrq_handle_keypress()
895 if (sysrq->reset_seq_version != sysrq_reset_seq_version) in sysrq_handle_keypress()
896 sysrq_parse_reset_sequence(sysrq); in sysrq_handle_keypress()
904 set_bit(code, sysrq->key_down); in sysrq_handle_keypress()
906 clear_bit(code, sysrq->key_down); in sysrq_handle_keypress()
909 schedule_work(&sysrq->reinject_work); in sysrq_handle_keypress()
912 sysrq_detect_reset_sequence(sysrq, code, value); in sysrq_handle_keypress()
914 } else if (value == 0 && test_and_clear_bit(code, sysrq->key_down)) { in sysrq_handle_keypress()
928 struct sysrq_state *sysrq = handle->private; in sysrq_filter() local
935 if (sysrq->reinjecting) in sysrq_filter()
945 suppress = sysrq_handle_keypress(sysrq, code, value); in sysrq_filter()
949 suppress = sysrq->active; in sysrq_filter()
960 struct sysrq_state *sysrq; in sysrq_connect() local
963 sysrq = kzalloc(sizeof(struct sysrq_state), GFP_KERNEL); in sysrq_connect()
964 if (!sysrq) in sysrq_connect()
967 INIT_WORK(&sysrq->reinject_work, sysrq_reinject_alt_sysrq); in sysrq_connect()
969 sysrq->handle.dev = dev; in sysrq_connect()
970 sysrq->handle.handler = handler; in sysrq_connect()
971 sysrq->handle.name = "sysrq"; in sysrq_connect()
972 sysrq->handle.private = sysrq; in sysrq_connect()
973 timer_setup(&sysrq->keyreset_timer, sysrq_do_reset, 0); in sysrq_connect()
975 error = input_register_handle(&sysrq->handle); in sysrq_connect()
982 error = input_open_device(&sysrq->handle); in sysrq_connect()
991 input_unregister_handle(&sysrq->handle); in sysrq_connect()
993 kfree(sysrq); in sysrq_connect()
999 struct sysrq_state *sysrq = handle->private; in sysrq_disconnect() local
1002 cancel_work_sync(&sysrq->reinject_work); in sysrq_disconnect()
1003 del_timer_sync(&sysrq->keyreset_timer); in sysrq_disconnect()
1005 kfree(sysrq); in sysrq_disconnect()