Fix a bug about the cooling system controlling in acpi_thermal driver.
Recent version of ACPI CA returns the package object which contains object reference elements if the elements are named objects. We need to be careful when you use acpi_ForeachPackageObject() in new code...
This commit is contained in:
parent
5df6e11624
commit
aeee03503f
@ -485,22 +485,32 @@ acpi_pwr_reference_resource(ACPI_OBJECT *obj, void *arg)
|
||||
ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
|
||||
|
||||
/* check the object type */
|
||||
if (obj->Type != ACPI_TYPE_STRING) {
|
||||
switch (obj->Type) {
|
||||
case ACPI_TYPE_ANY:
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "building reference from %s to %s\n",
|
||||
acpi_name(pc->ac_consumer), acpi_name(obj->Reference.Handle)));
|
||||
|
||||
res = obj->Reference.Handle;
|
||||
break;
|
||||
|
||||
case ACPI_TYPE_STRING:
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "building reference from %s to %s\n",
|
||||
acpi_name(pc->ac_consumer), obj->String.Pointer));
|
||||
|
||||
/* get the handle of the resource */
|
||||
if (ACPI_FAILURE(status = AcpiGetHandle(NULL, obj->String.Pointer, &res))) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "couldn't find power resource %s\n",
|
||||
obj->String.Pointer));
|
||||
return_VOID;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "don't know how to create a power reference to object type %d\n",
|
||||
obj->Type));
|
||||
return_VOID;
|
||||
}
|
||||
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "building reference from %s to %s\n",
|
||||
acpi_name(pc->ac_consumer), obj->String.Pointer));
|
||||
|
||||
/* get the handle of the resource */
|
||||
if (ACPI_FAILURE(status = AcpiGetHandle(NULL, obj->String.Pointer, &res))) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "couldn't find power resource %s\n",
|
||||
obj->String.Pointer));
|
||||
return_VOID;
|
||||
}
|
||||
|
||||
/* create/look up the resource */
|
||||
if (ACPI_FAILURE(status = acpi_pwr_register_resource(res))) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "couldn't register power resource %s - %s\n",
|
||||
|
@ -536,6 +536,12 @@ acpi_tz_switch_cooler_off(ACPI_OBJECT *obj, void *arg)
|
||||
ACPI_ASSERTLOCK;
|
||||
|
||||
switch(obj->Type) {
|
||||
case ACPI_TYPE_ANY:
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "called to turn %s off\n", acpi_name(obj->Reference.Handle)));
|
||||
|
||||
acpi_pwr_switch_consumer(obj->Reference.Handle, ACPI_STATE_D3);
|
||||
break;
|
||||
|
||||
case ACPI_TYPE_STRING:
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "called to turn %s off\n", obj->String.Pointer));
|
||||
|
||||
@ -576,6 +582,16 @@ acpi_tz_switch_cooler_on(ACPI_OBJECT *obj, void *arg)
|
||||
ACPI_ASSERTLOCK;
|
||||
|
||||
switch(obj->Type) {
|
||||
case ACPI_TYPE_ANY:
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "called to turn %s on\n", acpi_name(obj->Reference.Handle)));
|
||||
|
||||
if (ACPI_FAILURE(status = acpi_pwr_switch_consumer(obj->Reference.Handle, ACPI_STATE_D0))) {
|
||||
ACPI_VPRINT(sc->tz_dev, acpi_device_get_parent_softc(sc->tz_dev),
|
||||
"failed to activate %s - %s\n", acpi_name(obj->Reference.Handle),
|
||||
AcpiFormatException(status));
|
||||
}
|
||||
break;
|
||||
|
||||
case ACPI_TYPE_STRING:
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "called to turn %s on\n", obj->String.Pointer));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user