From: Hugh Dickins <hu...@chromium.org> Subject: drm: avoid switching to text console if there is no panic timeout
Add a check for panic_timeout in the drm_fb_helper_panic() notifier: if we're going to reboot immediately, the user will not be able to see the messages anyway, and messing with the video mode may display artifacts, and certainly get into several layers of complexity (including mutexes and memory allocations) which we shall be much safer to avoid. [msb at chromium.org: edited commit message and modified to short-circuit panic_timeout < 0 instead of testing panic_timeout >= 0] Signed-off-by: Hugh Dickins <hughd at google.com> Signed-off-by: Mandeep Singh Baines <msb at chromium.org> Cc: Dave Airlie <airlied at redhat.com> Acked-by: David Rientjes <rientjes at google.com> Acked-by: St?phane Marchesin <marcheu at chromium.org> Cc: Dave Young <hidave.darkstar at gmail.com> Signed-off-by: Andrew Morton <akpm at linux-foundation.org> --- drivers/gpu/drm/drm_fb_helper.c | 7 +++++++ 1 file changed, 7 insertions(+) diff -puN drivers/gpu/drm/drm_fb_helper.c~drm-avoid-switching-to-text-console-if-there-is-no-panic-timeout drivers/gpu/drm/drm_fb_helper.c --- a/drivers/gpu/drm/drm_fb_helper.c~drm-avoid-switching-to-text-console-if-there-is-no-panic-timeout +++ a/drivers/gpu/drm/drm_fb_helper.c @@ -255,6 +255,13 @@ bool drm_fb_helper_force_kernel_mode(voi int drm_fb_helper_panic(struct notifier_block *n, unsigned long ununsed, void *panic_str) { + /* + * It's a waste of time and effort to switch back to text console + * if the kernel should reboot before panic messages can be seen. + */ + if (panic_timeout < 0) + return 0; + printk(KERN_ERR "panic occurred, switching back to text console\n"); return drm_fb_helper_force_kernel_mode(); } _