]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ACPI: bus: change the prototype for acpi_get_physical_device_location
authorRicardo Ribalda <ribalda@chromium.org>
Mon, 16 Dec 2024 21:17:15 +0000 (21:17 +0000)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 19 Dec 2024 19:59:35 +0000 (20:59 +0100)
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>
drivers/acpi/mipi-disco-img.c
drivers/acpi/scan.c
drivers/acpi/utils.c
drivers/base/physical_location.c
drivers/media/pci/intel/ipu-bridge.c
drivers/usb/core/usb-acpi.c
include/acpi/acpi_bus.h

index 92b658f92dc0f1d9123cdcb1d49a130a41f600be..5b85989f96beeb726f59ac9e12e965a215fb38f6 100644 (file)
@@ -624,8 +624,7 @@ static void init_crs_csi2_swnodes(struct crs_csi2 *csi2)
        if (!fwnode_property_present(adev_fwnode, "rotation")) {
                struct acpi_pld_info *pld;
 
-               status = acpi_get_physical_device_location(handle, &pld);
-               if (ACPI_SUCCESS(status)) {
+               if (acpi_get_physical_device_location(handle, &pld)) {
                        swnodes->dev_props[NEXT_PROPERTY(prop_index, DEV_ROTATION)] =
                                        PROPERTY_ENTRY_U32("rotation",
                                                           pld->rotation * 45U);
index 74dcccdc6482b88bcfd0b8f98d6ff0162f756847..93d340027b7f92dad7bfbe226229340c05a50485 100644 (file)
@@ -723,10 +723,8 @@ int acpi_tie_acpi_dev(struct acpi_device *adev)
 static void acpi_store_pld_crc(struct acpi_device *adev)
 {
        struct acpi_pld_info *pld;
-       acpi_status status;
 
-       status = acpi_get_physical_device_location(adev->handle, &pld);
-       if (ACPI_FAILURE(status))
+       if (!acpi_get_physical_device_location(adev->handle, &pld))
                return;
 
        adev->pld_crc = crc32(~0, pld, sizeof(*pld));
index 6de542d995189a16ca88bb935f53a7584573195b..526563a0d1886be835a096cdcb4371c9ec48a63a 100644 (file)
@@ -494,7 +494,7 @@ bool acpi_device_dep(acpi_handle target, acpi_handle match)
 }
 EXPORT_SYMBOL_GPL(acpi_device_dep);
 
-acpi_status
+bool
 acpi_get_physical_device_location(acpi_handle handle, struct acpi_pld_info **pld)
 {
        acpi_status status;
@@ -502,9 +502,8 @@ acpi_get_physical_device_location(acpi_handle handle, struct acpi_pld_info **pld
        union acpi_object *output;
 
        status = acpi_evaluate_object(handle, "_PLD", NULL, &buffer);
-
        if (ACPI_FAILURE(status))
-               return status;
+               return false;
 
        output = buffer.pointer;
 
@@ -523,7 +522,7 @@ acpi_get_physical_device_location(acpi_handle handle, struct acpi_pld_info **pld
 
 out:
        kfree(buffer.pointer);
-       return status;
+       return ACPI_SUCCESS(status);
 }
 EXPORT_SYMBOL(acpi_get_physical_device_location);
 
index 951819e71b4ad43cffd24fb48caeb4d066d651aa..5db06e825c94f2449664aba800e77317689a9d29 100644 (file)
 bool dev_add_physical_location(struct device *dev)
 {
        struct acpi_pld_info *pld;
-       acpi_status status;
 
        if (!has_acpi_companion(dev))
                return false;
 
-       status = acpi_get_physical_device_location(ACPI_HANDLE(dev), &pld);
-       if (ACPI_FAILURE(status))
+       if (!acpi_get_physical_device_location(ACPI_HANDLE(dev), &pld))
                return false;
 
        dev->physical_location =
index 1bf249f446a988769e7976ccdb0e179beadac30a..49aa7c51791e5152d065fd7445a683aa0d9d4733 100644 (file)
@@ -259,12 +259,12 @@ static enum v4l2_fwnode_orientation ipu_bridge_parse_orientation(struct acpi_dev
 {
        enum v4l2_fwnode_orientation orientation;
        struct acpi_pld_info *pld = NULL;
-       acpi_status status = AE_ERROR;
+       bool status = false;
 
 #if IS_ENABLED(CONFIG_ACPI)
        status = acpi_get_physical_device_location(adev->handle, &pld);
 #endif
-       if (ACPI_FAILURE(status)) {
+       if (!status) {
                dev_warn(ADEV_DEV(adev), "_PLD call failed, using default orientation\n");
                return V4L2_FWNODE_ORIENTATION_EXTERNAL;
        }
index 03c22114214b5ac0aa70df83f350238c6dc6e0a5..935c0efea0b640b448a5161b3d0555cf38530eed 100644 (file)
@@ -213,8 +213,7 @@ usb_acpi_get_connect_type(struct usb_port *port_dev, acpi_handle *handle)
         * no connectable, the port would be not used.
         */
 
-       status = acpi_get_physical_device_location(handle, &pld);
-       if (ACPI_SUCCESS(status) && pld)
+       if (acpi_get_physical_device_location(handle, &pld) && pld)
                port_dev->location = USB_ACPI_LOCATION_VALID |
                        pld->group_token << 8 | pld->group_position;
 
index b2e377b7f3373d09071e83262d634d5ee28c3b0c..19f92852e1273bf738d507492663a018d5c7844a 100644 (file)
@@ -43,7 +43,7 @@ acpi_status
 acpi_evaluate_ost(acpi_handle handle, u32 source_event, u32 status_code,
                  struct acpi_buffer *status_buf);
 
-acpi_status
+bool
 acpi_get_physical_device_location(acpi_handle handle, struct acpi_pld_info **pld);
 
 bool acpi_has_method(acpi_handle handle, char *name);