diff --git a/patches/4.18/acpi.patch b/patches/4.18/acpi.patch index 7248fa03e..8930d1489 100644 --- a/patches/4.18/acpi.patch +++ b/patches/4.18/acpi.patch @@ -1322,3 +1322,53 @@ index 000000000000..7a84340b04bb +MODULE_AUTHOR("Jake Day"); +MODULE_DESCRIPTION("Microsoft Surface Platform Driver"); +MODULE_LICENSE("GPL"); +diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c +index 87331565e505..d55f949ee25a 100644 +--- a/kernel/power/suspend.c ++++ b/kernel/power/suspend.c +@@ -520,6 +520,8 @@ int suspend_devices_and_enter(suspend_state_t state) + goto Resume_devices; + } + ++unsigned int resume_delay = 3000; ++ + /** + * suspend_finish - Clean up before finishing the suspend sequence. + * +@@ -528,6 +530,15 @@ int suspend_devices_and_enter(suspend_state_t state) + */ + static void suspend_finish(void) + { ++ if (resume_delay) { ++ /* Give kernel threads a head start, such that usb-storage ++ * can detect devices before syslog attempts to write log ++ * messages from the suspend code. ++ */ ++ thaw_kernel_threads(); ++ pr_debug("PM: Sleeping for %d milliseconds.\n", resume_delay); ++ msleep(resume_delay); ++ } + suspend_thaw_processes(); + pm_notifier_call_chain(PM_POST_SUSPEND); + pm_restore_console(); +diff --git a/kernel/sysctl.c b/kernel/sysctl.c +index 2d9837c0aff4..ac704bf71f45 100644 +--- a/kernel/sysctl.c ++++ b/kernel/sysctl.c +@@ -308,7 +308,16 @@ static int min_extfrag_threshold; + static int max_extfrag_threshold = 1000; + #endif + ++extern unsigned int resume_delay; ++ + static struct ctl_table kern_table[] = { ++ { ++ .procname = "resume_delay", ++ .data = &resume_delay, ++ .maxlen = sizeof(unsigned int), ++ .mode = 0644, ++ .proc_handler = proc_dointvec, ++ }, + { + .procname = "sched_child_runs_first", + .data = &sysctl_sched_child_runs_first,