Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

surface: surface3-wmi: Use ACPI_COMPANION() directly

The ACPI_HANDLE() macro is a wrapper arond the ACPI_COMPANION()
macro and the ACPI handle produced by the former comes from the
ACPI device object produced by the latter, so it is way more
straightforward to evaluate the latter directly instead of passing
the handle produced by the former to acpi_bus_get_device().

Modify s3_wmi_check_platform_device() accordingly (no intentional
functional impact).

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Maximilian Luz <luzmaximilian@gmail.com>
Link: https://lore.kernel.org/r/12896717.uLZWGnKmhe@kreacher
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>

authored by

Rafael J. Wysocki and committed by
Hans de Goede
55588713 603a7dd0

+4 -5
+4 -5
drivers/platform/surface/surface3-wmi.c
··· 139 139 140 140 static int s3_wmi_check_platform_device(struct device *dev, void *data) 141 141 { 142 - struct acpi_device *adev, *ts_adev = NULL; 143 - acpi_handle handle; 142 + struct acpi_device *adev = ACPI_COMPANION(dev); 143 + struct acpi_device *ts_adev = NULL; 144 144 acpi_status status; 145 145 146 146 /* ignore non ACPI devices */ 147 - handle = ACPI_HANDLE(dev); 148 - if (!handle || acpi_bus_get_device(handle, &adev)) 147 + if (!adev) 149 148 return 0; 150 149 151 150 /* check for LID ACPI switch */ ··· 158 159 strlen(SPI_CTL_OBJ_NAME))) 159 160 return 0; 160 161 161 - status = acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, 1, 162 + status = acpi_walk_namespace(ACPI_TYPE_DEVICE, adev->handle, 1, 162 163 s3_wmi_attach_spi_device, NULL, 163 164 &ts_adev, NULL); 164 165 if (ACPI_FAILURE(status))