Commit daed9537 authored by Frans Pop's avatar Frans Pop Committed by Len Brown

hp-wmi: check that an input device exists in resume handler

Some systems may not support input events, or registering the input
handler may have failed. So check that an input device exists before
trying to set the docking and tablet mode state during resume.

Fixes: http://bugzilla.kernel.org/show_bug.cgi?id=13865Reported-and-tested-by: default avatarCédric Godin <cedric@belbone.be>
Signed-off-by: default avatarFrans Pop <elendil@planet.nl>
Acked-by: default avatarMatthew Garrett <mjg59@srcf.ucam.org>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent 4be3bd78
...@@ -520,11 +520,13 @@ static int hp_wmi_resume_handler(struct platform_device *device) ...@@ -520,11 +520,13 @@ static int hp_wmi_resume_handler(struct platform_device *device)
* the input layer will only actually pass it on if the state * the input layer will only actually pass it on if the state
* changed. * changed.
*/ */
if (hp_wmi_input_dev) {
input_report_switch(hp_wmi_input_dev, SW_DOCK, hp_wmi_dock_state()); input_report_switch(hp_wmi_input_dev, SW_DOCK,
hp_wmi_dock_state());
input_report_switch(hp_wmi_input_dev, SW_TABLET_MODE, input_report_switch(hp_wmi_input_dev, SW_TABLET_MODE,
hp_wmi_tablet_state()); hp_wmi_tablet_state());
input_sync(hp_wmi_input_dev); input_sync(hp_wmi_input_dev);
}
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment