Skip to contentSkip to conversation

ACPI: Do not pass NULL to acpi_get_handle() when looking for _EJD

PATCH In review Holger Macht 2 participants 3 messages Feb 14, 2008 ACPI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ACPI: Do not pass NULL to acpi_get_handle() when looking for _EJD

When trying to get the acpi_handle from an acpi_buffer, pass ACPI_ROOT_OBJECT instead of NULL to acpi_get_handle(). This fixes the detection of dock dependent bays.

---

drivers/acpi/scan.c +2 -1
index 3fac011..d9b9143 100644
@@ -609,7 +609,8 @@ acpi_bus_get_ejd(acpi_handle handle, acpi_handle *ejd)
 	status = acpi_evaluate_object(handle, "_EJD", NULL, &buffer);
 	if (ACPI_SUCCESS(status)) {
 		obj = buffer.pointer;
-		status = acpi_get_handle(NULL, obj->string.pointer, ejd);
+		status = acpi_get_handle(ACPI_ROOT_OBJECT, obj->string.pointer,
+					 ejd);
 		kfree(buffer.pointer);
 	}
 	return status;
#1 lore raw
Quoted 14 lines · Holger Macht

When trying to get the acpi_handle from an acpi_buffer, pass ACPI_ROOT_OBJECT instead of NULL to acpi_get_handle(). This fixes the detection of dock dependent bays.

---

drivers/acpi/scan.c +0 -0
index 3fac011..d9b9143 100644

drivers/acpi/scan.c acpi_bus_get_ejd(acpi_handle handle, acpi_handle *ejd) · line 616

Quoted 9 lines
drivers/acpi/scan.c +2 -1
@@ -609,7 +609,8 @@ acpi_bus_get_ejd(acpi_handle handle, acpi_handle *ejd)
 	status = acpi_evaluate_object(handle, "_EJD", NULL, &buffer);
 	if (ACPI_SUCCESS(status)) {
 		obj = buffer.pointer;
-		status = acpi_get_handle(NULL, obj->string.pointer, ejd);
+		status = acpi_get_handle(ACPI_ROOT_OBJECT, obj->string.pointer,
+					 ejd);
 		kfree(buffer.pointer);
 	}
 	return status;

I can verify that acpi_bus_get_ejd is totally useless without that patch.
If "status = acpi_evaluate_object(handle, "_EJD", NULL, &buffer);" succeeds (and AE_NOT_FOUND is not returned), the function will return AE_BAD_PARAMETER, because NULL never makes sense as first argument of acpi_get_handle:
status = acpi_get_handle(NULL, obj->string.pointer, ejd);

I can also verify that the correct handle is evaluated with this patch on a recent ThinkPad, otherwise not.

Please add it, looks like a typo.

Thomas

#2 lore raw
Quoted 19 lines · Thomas Renninger
Quoted 18 lines · Holger Macht

When trying to get the acpi_handle from an acpi_buffer, pass ACPI_ROOT_OBJECT instead of NULL to acpi_get_handle(). This fixes the detection of dock dependent bays.

---

drivers/acpi/scan.c +1 -1
index 3fac011..d9b9143 100644
@@ -609,7 +609,8 @@ acpi_bus_get_ejd(acpi_handle handle, acpi_handle *ejd)
 	status = acpi_evaluate_object(handle, "_EJD", NULL, &buffer);
 	if (ACPI_SUCCESS(status)) {
 		obj = buffer.pointer;
-		status = acpi_get_handle(NULL, obj->string.pointer, ejd);
+		status = acpi_get_handle(ACPI_ROOT_OBJECT, obj->string.pointer,
Quoted 8 lines

drivers/acpi/scan.c acpi_bus_get_ejd(acpi_handle handle, acpi_handle *ejd) · line 616

Quoted 5 lines
drivers/acpi/scan.c +1 -0
+					 ejd);
 		kfree(buffer.pointer);
 	}
 	return status;

I can verify that acpi_bus_get_ejd is totally useless without that patch.

I mean I have verified and can confirm that..

Quoted 8 lines

If "status = acpi_evaluate_object(handle, "_EJD", NULL, &buffer);" succeeds (and AE_NOT_FOUND is not returned), the function will return AE_BAD_PARAMETER, because NULL never makes sense as first argument of acpi_get_handle:
status = acpi_get_handle(NULL, obj->string.pointer, ejd);

I can also verify that the correct handle is evaluated with this patch on a recent ThinkPad, otherwise not.

Same here.

Quoted 1 line

Please add it, looks like a typo.

Thomas