Skip to content

Commit 79f237b

Browse files
ribaldarafaeljw
authored andcommitted
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>
1 parent 7349678 commit 79f237b

File tree

7 files changed

+10
-17
lines changed

7 files changed

+10
-17
lines changed

drivers/acpi/mipi-disco-img.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -624,8 +624,7 @@ static void init_crs_csi2_swnodes(struct crs_csi2 *csi2)
624624
if (!fwnode_property_present(adev_fwnode, "rotation")) {
625625
struct acpi_pld_info *pld;
626626

627-
status = acpi_get_physical_device_location(handle, &pld);
628-
if (ACPI_SUCCESS(status)) {
627+
if (acpi_get_physical_device_location(handle, &pld)) {
629628
swnodes->dev_props[NEXT_PROPERTY(prop_index, DEV_ROTATION)] =
630629
PROPERTY_ENTRY_U32("rotation",
631630
pld->rotation * 45U);

drivers/acpi/scan.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -723,10 +723,8 @@ int acpi_tie_acpi_dev(struct acpi_device *adev)
723723
static void acpi_store_pld_crc(struct acpi_device *adev)
724724
{
725725
struct acpi_pld_info *pld;
726-
acpi_status status;
727726

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))
730728
return;
731729

732730
adev->pld_crc = crc32(~0, pld, sizeof(*pld));

drivers/acpi/utils.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -494,17 +494,16 @@ bool acpi_device_dep(acpi_handle target, acpi_handle match)
494494
}
495495
EXPORT_SYMBOL_GPL(acpi_device_dep);
496496

497-
acpi_status
497+
bool
498498
acpi_get_physical_device_location(acpi_handle handle, struct acpi_pld_info **pld)
499499
{
500500
acpi_status status;
501501
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
502502
union acpi_object *output;
503503

504504
status = acpi_evaluate_object(handle, "_PLD", NULL, &buffer);
505-
506505
if (ACPI_FAILURE(status))
507-
return status;
506+
return false;
508507

509508
output = buffer.pointer;
510509

@@ -523,7 +522,7 @@ acpi_get_physical_device_location(acpi_handle handle, struct acpi_pld_info **pld
523522

524523
out:
525524
kfree(buffer.pointer);
526-
return status;
525+
return ACPI_SUCCESS(status);
527526
}
528527
EXPORT_SYMBOL(acpi_get_physical_device_location);
529528

drivers/base/physical_location.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,11 @@
1313
bool dev_add_physical_location(struct device *dev)
1414
{
1515
struct acpi_pld_info *pld;
16-
acpi_status status;
1716

1817
if (!has_acpi_companion(dev))
1918
return false;
2019

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))
2321
return false;
2422

2523
dev->physical_location =

drivers/media/pci/intel/ipu-bridge.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,12 +259,12 @@ static enum v4l2_fwnode_orientation ipu_bridge_parse_orientation(struct acpi_dev
259259
{
260260
enum v4l2_fwnode_orientation orientation;
261261
struct acpi_pld_info *pld = NULL;
262-
acpi_status status = AE_ERROR;
262+
bool status = false;
263263

264264
#if IS_ENABLED(CONFIG_ACPI)
265265
status = acpi_get_physical_device_location(adev->handle, &pld);
266266
#endif
267-
if (ACPI_FAILURE(status)) {
267+
if (!status) {
268268
dev_warn(ADEV_DEV(adev), "_PLD call failed, using default orientation\n");
269269
return V4L2_FWNODE_ORIENTATION_EXTERNAL;
270270
}

drivers/usb/core/usb-acpi.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,7 @@ usb_acpi_get_connect_type(struct usb_port *port_dev, acpi_handle *handle)
213213
* no connectable, the port would be not used.
214214
*/
215215

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)
218217
port_dev->location = USB_ACPI_LOCATION_VALID |
219218
pld->group_token << 8 | pld->group_position;
220219

include/acpi/acpi_bus.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ acpi_status
4343
acpi_evaluate_ost(acpi_handle handle, u32 source_event, u32 status_code,
4444
struct acpi_buffer *status_buf);
4545

46-
acpi_status
46+
bool
4747
acpi_get_physical_device_location(acpi_handle handle, struct acpi_pld_info **pld);
4848

4949
bool acpi_has_method(acpi_handle handle, char *name);

0 commit comments

Comments
 (0)