Skip to content

Commit ed72a2b

Browse files
Wer-Wolfjwrdegoede
authored andcommitted
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: Ilpo Järvinen <[email protected]> Signed-off-by: Armin Wolf <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Hans de Goede <[email protected]> Signed-off-by: Hans de Goede <[email protected]>
1 parent f763fd7 commit ed72a2b

File tree

1 file changed

+7
-67
lines changed
  • drivers/platform/x86

1 file changed

+7
-67
lines changed

drivers/platform/x86/wmi.c

Lines changed: 7 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,6 @@ struct wmi_block {
8585
#define ACPI_WMI_STRING BIT(2) /* GUID takes & returns a string */
8686
#define ACPI_WMI_EVENT BIT(3) /* GUID is an event */
8787

88-
static bool debug_event;
89-
module_param(debug_event, bool, 0444);
90-
MODULE_PARM_DESC(debug_event,
91-
"Log WMI Events [0/1]");
92-
9388
static const struct acpi_device_id wmi_device_ids[] = {
9489
{"PNP0C14", 0},
9590
{"pnp0c14", 0},
@@ -592,42 +587,6 @@ acpi_status wmidev_block_set(struct wmi_device *wdev, u8 instance, const struct
592587
}
593588
EXPORT_SYMBOL_GPL(wmidev_block_set);
594589

595-
static void wmi_notify_debug(u32 value, void *context)
596-
{
597-
struct acpi_buffer response = { ACPI_ALLOCATE_BUFFER, NULL };
598-
union acpi_object *obj;
599-
acpi_status status;
600-
601-
status = wmi_get_event_data(value, &response);
602-
if (status != AE_OK) {
603-
pr_info("bad event status 0x%x\n", status);
604-
return;
605-
}
606-
607-
obj = response.pointer;
608-
if (!obj)
609-
return;
610-
611-
pr_info("DEBUG: event 0x%02X ", value);
612-
switch (obj->type) {
613-
case ACPI_TYPE_BUFFER:
614-
pr_cont("BUFFER_TYPE - length %u\n", obj->buffer.length);
615-
break;
616-
case ACPI_TYPE_STRING:
617-
pr_cont("STRING_TYPE - %s\n", obj->string.pointer);
618-
break;
619-
case ACPI_TYPE_INTEGER:
620-
pr_cont("INTEGER_TYPE - %llu\n", obj->integer.value);
621-
break;
622-
case ACPI_TYPE_PACKAGE:
623-
pr_cont("PACKAGE_TYPE - %u elements\n", obj->package.count);
624-
break;
625-
default:
626-
pr_cont("object type 0x%X\n", obj->type);
627-
}
628-
kfree(obj);
629-
}
630-
631590
/**
632591
* wmi_install_notify_handler - Register handler for WMI events (deprecated)
633592
* @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,
656615
acpi_status wmi_status;
657616

658617
if (guid_equal(&block->gblock.guid, &guid_input)) {
659-
if (block->handler &&
660-
block->handler != wmi_notify_debug)
618+
if (block->handler)
661619
return AE_ALREADY_ACQUIRED;
662620

663621
block->handler = handler;
@@ -698,22 +656,14 @@ acpi_status wmi_remove_notify_handler(const char *guid)
698656
acpi_status wmi_status;
699657

700658
if (guid_equal(&block->gblock.guid, &guid_input)) {
701-
if (!block->handler ||
702-
block->handler == wmi_notify_debug)
659+
if (!block->handler)
703660
return AE_NULL_ENTRY;
704661

705-
if (debug_event) {
706-
block->handler = wmi_notify_debug;
707-
status = AE_OK;
708-
} else {
709-
wmi_status = wmi_method_enable(block, false);
710-
block->handler = NULL;
711-
block->handler_data = NULL;
712-
if ((wmi_status != AE_OK) ||
713-
((wmi_status == AE_OK) &&
714-
(status == AE_NOT_EXIST)))
715-
status = wmi_status;
716-
}
662+
wmi_status = wmi_method_enable(block, false);
663+
block->handler = NULL;
664+
block->handler_data = NULL;
665+
if (wmi_status != AE_OK || (wmi_status == AE_OK && status == AE_NOT_EXIST))
666+
status = wmi_status;
717667
}
718668
}
719669

@@ -1340,17 +1290,10 @@ static int parse_wdg(struct device *wmi_bus_dev, struct platform_device *pdev)
13401290

13411291
list_add_tail(&wblock->list, &wmi_block_list);
13421292

1343-
if (debug_event) {
1344-
wblock->handler = wmi_notify_debug;
1345-
wmi_method_enable(wblock, true);
1346-
}
1347-
13481293
retval = wmi_add_device(pdev, &wblock->dev);
13491294
if (retval) {
13501295
dev_err(wmi_bus_dev, "failed to register %pUL\n",
13511296
&wblock->gblock.guid);
1352-
if (debug_event)
1353-
wmi_method_enable(wblock, false);
13541297

13551298
list_del(&wblock->list);
13561299
put_device(&wblock->dev.dev);
@@ -1445,9 +1388,6 @@ static void acpi_wmi_notify_handler(acpi_handle handle, u32 event,
14451388
wblock->handler(event, wblock->handler_data);
14461389
}
14471390

1448-
if (debug_event)
1449-
pr_info("DEBUG: GUID %pUL event 0x%02X\n", &wblock->gblock.guid, event);
1450-
14511391
acpi_bus_generate_netlink_event(
14521392
wblock->acpi_device->pnp.device_class,
14531393
dev_name(&wblock->dev.dev),

0 commit comments

Comments
 (0)