[PATCH] acpi: device: Fix check for sequence number

Wolfgang Wallner wolfgang.wallner at br-automation.com
Thu Jul 30 14:47:10 CEST 2020


Currently the function acpi_check_seq() checks whether dev->req_seq is
unequal to "-1", but it should actually check dev->seq. Change it to
check dev->seq.

For req_seq the value "-1" would be a valid (meaning 'any'), while for
seq the value "-1" means 'none' and is not valid.

Quoting the description of udevice in device.h:
 * @req_seq: Requested sequence number for this device (-1 = any)
 * @seq: Allocated sequence number for this device (-1 = none).
 *       This is set up when the device is probed and will be unique
 *       within the device's uclass.

Signed-off-by: Wolfgang Wallner <wolfgang.wallner at br-automation.com>

Fixes: commit fefac0b0643b ("dm: acpi: Enhance acpi_get_name()")

---

 lib/acpi/acpi_device.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/acpi/acpi_device.c b/lib/acpi/acpi_device.c
index 3c75b6d962..76194ea1b4 100644
--- a/lib/acpi/acpi_device.c
+++ b/lib/acpi/acpi_device.c
@@ -743,12 +743,12 @@ static const char *acpi_name_from_id(enum uclass_id id)
 
 static int acpi_check_seq(const struct udevice *dev)
 {
-	if (dev->req_seq == -1) {
+	if (dev->seq == -1) {
 		log_warning("Device '%s' has no seq\n", dev->name);
 		return log_msg_ret("no seq", -ENXIO);
 	}
 
-	return dev->req_seq;
+	return dev->seq;
 }
 
 /* If you change this function, add test cases to dm_test_acpi_get_name() */
-- 
2.27.0




More information about the U-Boot mailing list