Lines Matching refs:sysrq
796 struct sysrq_state *sysrq = in sysrq_reinject_alt_sysrq() local
798 struct input_handle *handle = &sysrq->handle; in sysrq_reinject_alt_sysrq()
799 unsigned int alt_code = sysrq->alt_use; in sysrq_reinject_alt_sysrq()
801 if (sysrq->need_reinject) { in sysrq_reinject_alt_sysrq()
803 sysrq->reinjecting = true; in sysrq_reinject_alt_sysrq()
816 sysrq->reinjecting = false; in sysrq_reinject_alt_sysrq()
820 static bool sysrq_handle_keypress(struct sysrq_state *sysrq, in sysrq_handle_keypress() argument
823 bool was_active = sysrq->active; in sysrq_handle_keypress()
832 if (sysrq->active && code == sysrq->alt_use) in sysrq_handle_keypress()
833 sysrq->active = false; in sysrq_handle_keypress()
835 sysrq->alt = KEY_RESERVED; in sysrq_handle_keypress()
838 sysrq->alt = code; in sysrq_handle_keypress()
839 sysrq->need_reinject = false; in sysrq_handle_keypress()
846 sysrq->shift = KEY_RESERVED; in sysrq_handle_keypress()
848 sysrq->shift = code; in sysrq_handle_keypress()
849 if (sysrq->active) in sysrq_handle_keypress()
850 sysrq->shift_use = sysrq->shift; in sysrq_handle_keypress()
854 if (value == 1 && sysrq->alt != KEY_RESERVED) { in sysrq_handle_keypress()
855 sysrq->active = true; in sysrq_handle_keypress()
856 sysrq->alt_use = sysrq->alt; in sysrq_handle_keypress()
858 sysrq->shift_use = sysrq->shift; in sysrq_handle_keypress()
863 sysrq->need_reinject = true; in sysrq_handle_keypress()
874 if (sysrq->active) in sysrq_handle_keypress()
875 clear_bit(KEY_SYSRQ, sysrq->handle.dev->key); in sysrq_handle_keypress()
880 if (sysrq->active && value && value != 2) { in sysrq_handle_keypress()
883 sysrq->need_reinject = false; in sysrq_handle_keypress()
884 if (sysrq->shift_use != KEY_RESERVED) in sysrq_handle_keypress()
891 suppress = sysrq->active; in sysrq_handle_keypress()
893 if (!sysrq->active) { in sysrq_handle_keypress()
898 if (sysrq->reset_seq_version != sysrq_reset_seq_version) in sysrq_handle_keypress()
899 sysrq_parse_reset_sequence(sysrq); in sysrq_handle_keypress()
907 set_bit(code, sysrq->key_down); in sysrq_handle_keypress()
909 clear_bit(code, sysrq->key_down); in sysrq_handle_keypress()
912 schedule_work(&sysrq->reinject_work); in sysrq_handle_keypress()
915 sysrq_detect_reset_sequence(sysrq, code, value); in sysrq_handle_keypress()
917 } else if (value == 0 && test_and_clear_bit(code, sysrq->key_down)) { in sysrq_handle_keypress()
931 struct sysrq_state *sysrq = handle->private; in sysrq_filter() local
938 if (sysrq->reinjecting) in sysrq_filter()
948 suppress = sysrq_handle_keypress(sysrq, code, value); in sysrq_filter()
952 suppress = sysrq->active; in sysrq_filter()
963 struct sysrq_state *sysrq; in sysrq_connect() local
966 sysrq = kzalloc(sizeof(struct sysrq_state), GFP_KERNEL); in sysrq_connect()
967 if (!sysrq) in sysrq_connect()
970 INIT_WORK(&sysrq->reinject_work, sysrq_reinject_alt_sysrq); in sysrq_connect()
972 sysrq->handle.dev = dev; in sysrq_connect()
973 sysrq->handle.handler = handler; in sysrq_connect()
974 sysrq->handle.name = "sysrq"; in sysrq_connect()
975 sysrq->handle.private = sysrq; in sysrq_connect()
976 timer_setup(&sysrq->keyreset_timer, sysrq_do_reset, 0); in sysrq_connect()
978 error = input_register_handle(&sysrq->handle); in sysrq_connect()
985 error = input_open_device(&sysrq->handle); in sysrq_connect()
994 input_unregister_handle(&sysrq->handle); in sysrq_connect()
996 kfree(sysrq); in sysrq_connect()
1002 struct sysrq_state *sysrq = handle->private; in sysrq_disconnect() local
1005 cancel_work_sync(&sysrq->reinject_work); in sysrq_disconnect()
1006 del_timer_sync(&sysrq->keyreset_timer); in sysrq_disconnect()
1008 kfree(sysrq); in sysrq_disconnect()