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:
Mitsuru IWASAKI 2002-08-27 07:53:55 +00:00
parent a23f61bc28
commit cfd820d382
2 changed files with 37 additions and 11 deletions

View File

@ -485,12 +485,15 @@ 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) {
ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "don't know how to create a power reference to object type %d\n",
obj->Type));
return_VOID;
}
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));
@ -500,6 +503,13 @@ acpi_pwr_reference_resource(ACPI_OBJECT *obj, void *arg)
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;
}
/* create/look up the resource */
if (ACPI_FAILURE(status = acpi_pwr_register_resource(res))) {

View File

@ -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));