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

ACPI: bus: change the prototype for acpi_get_physical_device_location

It generally is not OK to use acpi_status and/or AE_ error codes
without CONFIG_ACPI and they really only should be used in
drivers/acpi/ (and not everywhere in there for that matter).

So acpi_get_physical_device_location() needs to be redefined to return
something different from acpi_status (preferably bool) in order to be
used in !CONFIG_ACPI code.

Suggested-by: Rafael J. Wysocki <rafael@kernel.org>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Link: https://patch.msgid.link/20241216-fix-ipu-v5-1-3d6b35ddce7b@chromium.org
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

authored by

Ricardo Ribalda and committed by
Rafael J. Wysocki
79f237ba 7349678b

+10 -17
+1 -2
drivers/acpi/mipi-disco-img.c
··· 624 624 if (!fwnode_property_present(adev_fwnode, "rotation")) { 625 625 struct acpi_pld_info *pld; 626 626 627 - status = acpi_get_physical_device_location(handle, &pld); 628 - if (ACPI_SUCCESS(status)) { 627 + if (acpi_get_physical_device_location(handle, &pld)) { 629 628 swnodes->dev_props[NEXT_PROPERTY(prop_index, DEV_ROTATION)] = 630 629 PROPERTY_ENTRY_U32("rotation", 631 630 pld->rotation * 45U);
+1 -3
drivers/acpi/scan.c
··· 723 723 static void acpi_store_pld_crc(struct acpi_device *adev) 724 724 { 725 725 struct acpi_pld_info *pld; 726 - acpi_status status; 727 726 728 - status = acpi_get_physical_device_location(adev->handle, &pld); 729 - if (ACPI_FAILURE(status)) 727 + if (!acpi_get_physical_device_location(adev->handle, &pld)) 730 728 return; 731 729 732 730 adev->pld_crc = crc32(~0, pld, sizeof(*pld));
+3 -4
drivers/acpi/utils.c
··· 494 494 } 495 495 EXPORT_SYMBOL_GPL(acpi_device_dep); 496 496 497 - acpi_status 497 + bool 498 498 acpi_get_physical_device_location(acpi_handle handle, struct acpi_pld_info **pld) 499 499 { 500 500 acpi_status status; ··· 502 502 union acpi_object *output; 503 503 504 504 status = acpi_evaluate_object(handle, "_PLD", NULL, &buffer); 505 - 506 505 if (ACPI_FAILURE(status)) 507 - return status; 506 + return false; 508 507 509 508 output = buffer.pointer; 510 509 ··· 522 523 523 524 out: 524 525 kfree(buffer.pointer); 525 - return status; 526 + return ACPI_SUCCESS(status); 526 527 } 527 528 EXPORT_SYMBOL(acpi_get_physical_device_location); 528 529
+1 -3
drivers/base/physical_location.c
··· 13 13 bool dev_add_physical_location(struct device *dev) 14 14 { 15 15 struct acpi_pld_info *pld; 16 - acpi_status status; 17 16 18 17 if (!has_acpi_companion(dev)) 19 18 return false; 20 19 21 - status = acpi_get_physical_device_location(ACPI_HANDLE(dev), &pld); 22 - if (ACPI_FAILURE(status)) 20 + if (!acpi_get_physical_device_location(ACPI_HANDLE(dev), &pld)) 23 21 return false; 24 22 25 23 dev->physical_location =
+2 -2
drivers/media/pci/intel/ipu-bridge.c
··· 259 259 { 260 260 enum v4l2_fwnode_orientation orientation; 261 261 struct acpi_pld_info *pld = NULL; 262 - acpi_status status = AE_ERROR; 262 + bool status = false; 263 263 264 264 #if IS_ENABLED(CONFIG_ACPI) 265 265 status = acpi_get_physical_device_location(adev->handle, &pld); 266 266 #endif 267 - if (ACPI_FAILURE(status)) { 267 + if (!status) { 268 268 dev_warn(ADEV_DEV(adev), "_PLD call failed, using default orientation\n"); 269 269 return V4L2_FWNODE_ORIENTATION_EXTERNAL; 270 270 }
+1 -2
drivers/usb/core/usb-acpi.c
··· 213 213 * no connectable, the port would be not used. 214 214 */ 215 215 216 - status = acpi_get_physical_device_location(handle, &pld); 217 - if (ACPI_SUCCESS(status) && pld) 216 + if (acpi_get_physical_device_location(handle, &pld) && pld) 218 217 port_dev->location = USB_ACPI_LOCATION_VALID | 219 218 pld->group_token << 8 | pld->group_position; 220 219
+1 -1
include/acpi/acpi_bus.h
··· 43 43 acpi_evaluate_ost(acpi_handle handle, u32 source_event, u32 status_code, 44 44 struct acpi_buffer *status_buf); 45 45 46 - acpi_status 46 + bool 47 47 acpi_get_physical_device_location(acpi_handle handle, struct acpi_pld_info **pld); 48 48 49 49 bool acpi_has_method(acpi_handle handle, char *name);