Commit ed72a2b5 authored by Armin Wolf's avatar Armin Wolf Committed by Hans de Goede

platform/x86: wmi: Remove debug_event module param

Users can already listen to ACPI WMI events through
the ACPI netlink interface. The old wmi_notify_debug()
interface also uses the deprecated GUID-based interface.
Remove it to make the event handling code more readable.
Reviewed-by: default avatarIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: default avatarArmin Wolf <W_Armin@gmx.de>
Link: https://lore.kernel.org/r/20231210202443.646427-3-W_Armin@gmx.deReviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
parent f763fd73
...@@ -85,11 +85,6 @@ struct wmi_block { ...@@ -85,11 +85,6 @@ struct wmi_block {
#define ACPI_WMI_STRING BIT(2) /* GUID takes & returns a string */ #define ACPI_WMI_STRING BIT(2) /* GUID takes & returns a string */
#define ACPI_WMI_EVENT BIT(3) /* GUID is an event */ #define ACPI_WMI_EVENT BIT(3) /* GUID is an event */
static bool debug_event;
module_param(debug_event, bool, 0444);
MODULE_PARM_DESC(debug_event,
"Log WMI Events [0/1]");
static const struct acpi_device_id wmi_device_ids[] = { static const struct acpi_device_id wmi_device_ids[] = {
{"PNP0C14", 0}, {"PNP0C14", 0},
{"pnp0c14", 0}, {"pnp0c14", 0},
...@@ -592,42 +587,6 @@ acpi_status wmidev_block_set(struct wmi_device *wdev, u8 instance, const struct ...@@ -592,42 +587,6 @@ acpi_status wmidev_block_set(struct wmi_device *wdev, u8 instance, const struct
} }
EXPORT_SYMBOL_GPL(wmidev_block_set); EXPORT_SYMBOL_GPL(wmidev_block_set);
static void wmi_notify_debug(u32 value, void *context)
{
struct acpi_buffer response = { ACPI_ALLOCATE_BUFFER, NULL };
union acpi_object *obj;
acpi_status status;
status = wmi_get_event_data(value, &response);
if (status != AE_OK) {
pr_info("bad event status 0x%x\n", status);
return;
}
obj = response.pointer;
if (!obj)
return;
pr_info("DEBUG: event 0x%02X ", value);
switch (obj->type) {
case ACPI_TYPE_BUFFER:
pr_cont("BUFFER_TYPE - length %u\n", obj->buffer.length);
break;
case ACPI_TYPE_STRING:
pr_cont("STRING_TYPE - %s\n", obj->string.pointer);
break;
case ACPI_TYPE_INTEGER:
pr_cont("INTEGER_TYPE - %llu\n", obj->integer.value);
break;
case ACPI_TYPE_PACKAGE:
pr_cont("PACKAGE_TYPE - %u elements\n", obj->package.count);
break;
default:
pr_cont("object type 0x%X\n", obj->type);
}
kfree(obj);
}
/** /**
* wmi_install_notify_handler - Register handler for WMI events (deprecated) * wmi_install_notify_handler - Register handler for WMI events (deprecated)
* @guid: 36 char string of the form fa50ff2b-f2e8-45de-83fa-65417f2f49ba * @guid: 36 char string of the form fa50ff2b-f2e8-45de-83fa-65417f2f49ba
...@@ -656,8 +615,7 @@ acpi_status wmi_install_notify_handler(const char *guid, ...@@ -656,8 +615,7 @@ acpi_status wmi_install_notify_handler(const char *guid,
acpi_status wmi_status; acpi_status wmi_status;
if (guid_equal(&block->gblock.guid, &guid_input)) { if (guid_equal(&block->gblock.guid, &guid_input)) {
if (block->handler && if (block->handler)
block->handler != wmi_notify_debug)
return AE_ALREADY_ACQUIRED; return AE_ALREADY_ACQUIRED;
block->handler = handler; block->handler = handler;
...@@ -698,22 +656,14 @@ acpi_status wmi_remove_notify_handler(const char *guid) ...@@ -698,22 +656,14 @@ acpi_status wmi_remove_notify_handler(const char *guid)
acpi_status wmi_status; acpi_status wmi_status;
if (guid_equal(&block->gblock.guid, &guid_input)) { if (guid_equal(&block->gblock.guid, &guid_input)) {
if (!block->handler || if (!block->handler)
block->handler == wmi_notify_debug)
return AE_NULL_ENTRY; return AE_NULL_ENTRY;
if (debug_event) { wmi_status = wmi_method_enable(block, false);
block->handler = wmi_notify_debug; block->handler = NULL;
status = AE_OK; block->handler_data = NULL;
} else { if (wmi_status != AE_OK || (wmi_status == AE_OK && status == AE_NOT_EXIST))
wmi_status = wmi_method_enable(block, false); status = wmi_status;
block->handler = NULL;
block->handler_data = NULL;
if ((wmi_status != AE_OK) ||
((wmi_status == AE_OK) &&
(status == AE_NOT_EXIST)))
status = wmi_status;
}
} }
} }
...@@ -1340,17 +1290,10 @@ static int parse_wdg(struct device *wmi_bus_dev, struct platform_device *pdev) ...@@ -1340,17 +1290,10 @@ static int parse_wdg(struct device *wmi_bus_dev, struct platform_device *pdev)
list_add_tail(&wblock->list, &wmi_block_list); list_add_tail(&wblock->list, &wmi_block_list);
if (debug_event) {
wblock->handler = wmi_notify_debug;
wmi_method_enable(wblock, true);
}
retval = wmi_add_device(pdev, &wblock->dev); retval = wmi_add_device(pdev, &wblock->dev);
if (retval) { if (retval) {
dev_err(wmi_bus_dev, "failed to register %pUL\n", dev_err(wmi_bus_dev, "failed to register %pUL\n",
&wblock->gblock.guid); &wblock->gblock.guid);
if (debug_event)
wmi_method_enable(wblock, false);
list_del(&wblock->list); list_del(&wblock->list);
put_device(&wblock->dev.dev); put_device(&wblock->dev.dev);
...@@ -1445,9 +1388,6 @@ static void acpi_wmi_notify_handler(acpi_handle handle, u32 event, ...@@ -1445,9 +1388,6 @@ static void acpi_wmi_notify_handler(acpi_handle handle, u32 event,
wblock->handler(event, wblock->handler_data); wblock->handler(event, wblock->handler_data);
} }
if (debug_event)
pr_info("DEBUG: GUID %pUL event 0x%02X\n", &wblock->gblock.guid, event);
acpi_bus_generate_netlink_event( acpi_bus_generate_netlink_event(
wblock->acpi_device->pnp.device_class, wblock->acpi_device->pnp.device_class,
dev_name(&wblock->dev.dev), dev_name(&wblock->dev.dev),
......
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