// SPDX-License-Identifier: GPL-2.0 #include #include #include #include #include static acpi_handle test_handle; static int acpi_wait_thread(void *data) { acpi_status st; pr_info("ACPI_CASE5: waiter evaluating MWAI\n"); st = acpi_evaluate_object(test_handle, "MWAI", NULL, NULL); pr_info("ACPI_CASE5: waiter returned st=%d\n", st); return 0; } static int __init acpi_case5_init(void) { struct task_struct *t; acpi_status st; st = acpi_get_handle(NULL, "\\_SB.TST0", &test_handle); pr_info("ACPI_CASE5: get_handle st=%d handle=%px\n", st, test_handle); if (ACPI_FAILURE(st)) return -ENODEV; t = kthread_run(acpi_wait_thread, NULL, "acpi_case5_wait"); if (IS_ERR(t)) return PTR_ERR(t); msleep(1000); pr_info("ACPI_CASE5: evaluating MRST while waiter blocked\n"); st = acpi_evaluate_object(test_handle, "MRST", NULL, NULL); pr_info("ACPI_CASE5: MRST returned st=%d\n", st); msleep(1000); return 0; } static void __exit acpi_case5_exit(void) { pr_info("ACPI_CASE5: unload\n"); } module_init(acpi_case5_init); module_exit(acpi_case5_exit); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("ACPI event Reset-vs-Wait race probe");