Commit 8da5db7d authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'platform-drivers-x86-v4.16-5' of git://git.infradead.org/linux-platform-drivers-x86

Pull x86 platform drivers fixes from Andy Shevchenko:

 - fix a regression on laptops like Dell XPS 9360 where keyboard stopped
   working.

 - correct sysfs wakeup attribute after removal of some drivers to
   reflect that they are not able to wake system up anymore.

* tag 'platform-drivers-x86-v4.16-5' of git://git.infradead.org/linux-platform-drivers-x86:
  platform/x86: wmi: Fix misuse of vsprintf extension %pULL
  platform/x86: intel-hid: Reset wakeup capable flag on removal
  platform/x86: intel-vbtn: Reset wakeup capable flag on removal
  platform/x86: intel-vbtn: Only activate tablet mode switch on 2-in-1's
parents 7e303099 1cedc638
...@@ -376,6 +376,7 @@ static int intel_hid_remove(struct platform_device *device) ...@@ -376,6 +376,7 @@ static int intel_hid_remove(struct platform_device *device)
{ {
acpi_handle handle = ACPI_HANDLE(&device->dev); acpi_handle handle = ACPI_HANDLE(&device->dev);
device_init_wakeup(&device->dev, false);
acpi_remove_notify_handler(handle, ACPI_DEVICE_NOTIFY, notify_handler); acpi_remove_notify_handler(handle, ACPI_DEVICE_NOTIFY, notify_handler);
intel_hid_set_enable(&device->dev, false); intel_hid_set_enable(&device->dev, false);
intel_button_array_enable(&device->dev, false); intel_button_array_enable(&device->dev, false);
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
*/ */
#include <linux/acpi.h> #include <linux/acpi.h>
#include <linux/dmi.h>
#include <linux/input.h> #include <linux/input.h>
#include <linux/input/sparse-keymap.h> #include <linux/input/sparse-keymap.h>
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -97,9 +98,35 @@ static void notify_handler(acpi_handle handle, u32 event, void *context) ...@@ -97,9 +98,35 @@ static void notify_handler(acpi_handle handle, u32 event, void *context)
dev_dbg(&device->dev, "unknown event index 0x%x\n", event); dev_dbg(&device->dev, "unknown event index 0x%x\n", event);
} }
static int intel_vbtn_probe(struct platform_device *device) static void detect_tablet_mode(struct platform_device *device)
{ {
const char *chassis_type = dmi_get_system_info(DMI_CHASSIS_TYPE);
struct intel_vbtn_priv *priv = dev_get_drvdata(&device->dev);
acpi_handle handle = ACPI_HANDLE(&device->dev);
struct acpi_buffer vgbs_output = { ACPI_ALLOCATE_BUFFER, NULL }; struct acpi_buffer vgbs_output = { ACPI_ALLOCATE_BUFFER, NULL };
union acpi_object *obj;
acpi_status status;
int m;
if (!(chassis_type && strcmp(chassis_type, "31") == 0))
goto out;
status = acpi_evaluate_object(handle, "VGBS", NULL, &vgbs_output);
if (ACPI_FAILURE(status))
goto out;
obj = vgbs_output.pointer;
if (!(obj && obj->type == ACPI_TYPE_INTEGER))
goto out;
m = !(obj->integer.value & TABLET_MODE_FLAG);
input_report_switch(priv->input_dev, SW_TABLET_MODE, m);
out:
kfree(vgbs_output.pointer);
}
static int intel_vbtn_probe(struct platform_device *device)
{
acpi_handle handle = ACPI_HANDLE(&device->dev); acpi_handle handle = ACPI_HANDLE(&device->dev);
struct intel_vbtn_priv *priv; struct intel_vbtn_priv *priv;
acpi_status status; acpi_status status;
...@@ -122,22 +149,7 @@ static int intel_vbtn_probe(struct platform_device *device) ...@@ -122,22 +149,7 @@ static int intel_vbtn_probe(struct platform_device *device)
return err; return err;
} }
/* detect_tablet_mode(device);
* VGBS being present and returning something means we have
* a tablet mode switch.
*/
status = acpi_evaluate_object(handle, "VGBS", NULL, &vgbs_output);
if (ACPI_SUCCESS(status)) {
union acpi_object *obj = vgbs_output.pointer;
if (obj && obj->type == ACPI_TYPE_INTEGER) {
int m = !(obj->integer.value & TABLET_MODE_FLAG);
input_report_switch(priv->input_dev, SW_TABLET_MODE, m);
}
}
kfree(vgbs_output.pointer);
status = acpi_install_notify_handler(handle, status = acpi_install_notify_handler(handle,
ACPI_DEVICE_NOTIFY, ACPI_DEVICE_NOTIFY,
...@@ -154,6 +166,7 @@ static int intel_vbtn_remove(struct platform_device *device) ...@@ -154,6 +166,7 @@ static int intel_vbtn_remove(struct platform_device *device)
{ {
acpi_handle handle = ACPI_HANDLE(&device->dev); acpi_handle handle = ACPI_HANDLE(&device->dev);
device_init_wakeup(&device->dev, false);
acpi_remove_notify_handler(handle, ACPI_DEVICE_NOTIFY, notify_handler); acpi_remove_notify_handler(handle, ACPI_DEVICE_NOTIFY, notify_handler);
/* /*
......
...@@ -945,7 +945,7 @@ static int wmi_dev_probe(struct device *dev) ...@@ -945,7 +945,7 @@ static int wmi_dev_probe(struct device *dev)
wblock->char_dev.mode = 0444; wblock->char_dev.mode = 0444;
ret = misc_register(&wblock->char_dev); ret = misc_register(&wblock->char_dev);
if (ret) { if (ret) {
dev_warn(dev, "failed to register char dev: %d", ret); dev_warn(dev, "failed to register char dev: %d\n", ret);
ret = -ENOMEM; ret = -ENOMEM;
goto probe_misc_failure; goto probe_misc_failure;
} }
...@@ -1048,7 +1048,7 @@ static int wmi_create_device(struct device *wmi_bus_dev, ...@@ -1048,7 +1048,7 @@ static int wmi_create_device(struct device *wmi_bus_dev,
if (result) { if (result) {
dev_warn(wmi_bus_dev, dev_warn(wmi_bus_dev,
"%s data block query control method not found", "%s data block query control method not found\n",
method); method);
return result; return result;
} }
...@@ -1198,7 +1198,7 @@ static int parse_wdg(struct device *wmi_bus_dev, struct acpi_device *device) ...@@ -1198,7 +1198,7 @@ static int parse_wdg(struct device *wmi_bus_dev, struct acpi_device *device)
retval = device_add(&wblock->dev.dev); retval = device_add(&wblock->dev.dev);
if (retval) { if (retval) {
dev_err(wmi_bus_dev, "failed to register %pULL\n", dev_err(wmi_bus_dev, "failed to register %pUL\n",
wblock->gblock.guid); wblock->gblock.guid);
if (debug_event) if (debug_event)
wmi_method_enable(wblock, 0); wmi_method_enable(wblock, 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