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

platform/x86: wmi: Simplify get_subobj_info()

All callers who call get_subobj_info() with **info being NULL
should better use acpi_has_method() instead.
Convert the only caller who does this to acpi_has_method()
to drop the dummy info handling.
Reviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarArmin Wolf <W_Armin@gmx.de>
Link: https://lore.kernel.org/r/20231218192420.305411-7-W_Armin@gmx.deSigned-off-by: default avatarHans de Goede <hdegoede@redhat.com>
parent 2c933755
...@@ -132,23 +132,19 @@ static const void *find_guid_context(struct wmi_block *wblock, ...@@ -132,23 +132,19 @@ static const void *find_guid_context(struct wmi_block *wblock,
static int get_subobj_info(acpi_handle handle, const char *pathname, static int get_subobj_info(acpi_handle handle, const char *pathname,
struct acpi_device_info **info) struct acpi_device_info **info)
{ {
struct acpi_device_info *dummy_info, **info_ptr;
acpi_handle subobj_handle; acpi_handle subobj_handle;
acpi_status status; acpi_status status;
status = acpi_get_handle(handle, (char *)pathname, &subobj_handle); status = acpi_get_handle(handle, pathname, &subobj_handle);
if (status == AE_NOT_FOUND) if (status == AE_NOT_FOUND)
return -ENOENT; return -ENOENT;
else if (ACPI_FAILURE(status))
return -EIO;
info_ptr = info ? info : &dummy_info;
status = acpi_get_object_info(subobj_handle, info_ptr);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
return -EIO; return -EIO;
if (!info) status = acpi_get_object_info(subobj_handle, info);
kfree(dummy_info); if (ACPI_FAILURE(status))
return -EIO;
return 0; return 0;
} }
...@@ -998,9 +994,7 @@ static int wmi_create_device(struct device *wmi_bus_dev, ...@@ -998,9 +994,7 @@ static int wmi_create_device(struct device *wmi_bus_dev,
kfree(info); kfree(info);
get_acpi_method_name(wblock, 'S', method); get_acpi_method_name(wblock, 'S', method);
result = get_subobj_info(device->handle, method, NULL); if (acpi_has_method(device->handle, method))
if (result == 0)
wblock->dev.setable = true; wblock->dev.setable = true;
out_init: out_init:
......
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