diff options
author | Patrick Mochel <mochel@linux.intel.com> | 2006-05-19 16:54:40 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2006-06-30 02:32:17 -0400 |
commit | 8348e1b19a06b1932f65e84e1d59be29e1626c2b (patch) | |
tree | b62bb32918767e371e0faf3dc9877f260cb5bcff | |
parent | 32917e5b589d813c9dc0f2d140d8c52898ddb6fb (diff) |
ACPI: thermal: add struct acpi_device to struct acpi_thermal.
- Use it instead of acpi_bus_get_device() where we can..
Signed-off-by: Patrick Mochel <mochel@linux.intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
-rw-r--r-- | drivers/acpi/thermal.c | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index c855f4446b5f..1d8c250c3c73 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c | |||
@@ -163,6 +163,7 @@ struct acpi_thermal_flags { | |||
163 | 163 | ||
164 | struct acpi_thermal { | 164 | struct acpi_thermal { |
165 | acpi_handle handle; | 165 | acpi_handle handle; |
166 | struct acpi_device * device; | ||
166 | acpi_bus_id name; | 167 | acpi_bus_id name; |
167 | unsigned long temperature; | 168 | unsigned long temperature; |
168 | unsigned long last_temperature; | 169 | unsigned long last_temperature; |
@@ -453,10 +454,6 @@ static int acpi_thermal_call_usermode(char *path) | |||
453 | 454 | ||
454 | static int acpi_thermal_critical(struct acpi_thermal *tz) | 455 | static int acpi_thermal_critical(struct acpi_thermal *tz) |
455 | { | 456 | { |
456 | int result = 0; | ||
457 | struct acpi_device *device = NULL; | ||
458 | |||
459 | |||
460 | if (!tz || !tz->trips.critical.flags.valid) | 457 | if (!tz || !tz->trips.critical.flags.valid) |
461 | return -EINVAL; | 458 | return -EINVAL; |
462 | 459 | ||
@@ -466,14 +463,10 @@ static int acpi_thermal_critical(struct acpi_thermal *tz) | |||
466 | } else if (tz->trips.critical.flags.enabled) | 463 | } else if (tz->trips.critical.flags.enabled) |
467 | tz->trips.critical.flags.enabled = 0; | 464 | tz->trips.critical.flags.enabled = 0; |
468 | 465 | ||
469 | result = acpi_bus_get_device(tz->handle, &device); | ||
470 | if (result) | ||
471 | return result; | ||
472 | |||
473 | printk(KERN_EMERG | 466 | printk(KERN_EMERG |
474 | "Critical temperature reached (%ld C), shutting down.\n", | 467 | "Critical temperature reached (%ld C), shutting down.\n", |
475 | KELVIN_TO_CELSIUS(tz->temperature)); | 468 | KELVIN_TO_CELSIUS(tz->temperature)); |
476 | acpi_bus_generate_event(device, ACPI_THERMAL_NOTIFY_CRITICAL, | 469 | acpi_bus_generate_event(tz->device, ACPI_THERMAL_NOTIFY_CRITICAL, |
477 | tz->trips.critical.flags.enabled); | 470 | tz->trips.critical.flags.enabled); |
478 | 471 | ||
479 | acpi_thermal_call_usermode(ACPI_THERMAL_PATH_POWEROFF); | 472 | acpi_thermal_call_usermode(ACPI_THERMAL_PATH_POWEROFF); |
@@ -483,10 +476,6 @@ static int acpi_thermal_critical(struct acpi_thermal *tz) | |||
483 | 476 | ||
484 | static int acpi_thermal_hot(struct acpi_thermal *tz) | 477 | static int acpi_thermal_hot(struct acpi_thermal *tz) |
485 | { | 478 | { |
486 | int result = 0; | ||
487 | struct acpi_device *device = NULL; | ||
488 | |||
489 | |||
490 | if (!tz || !tz->trips.hot.flags.valid) | 479 | if (!tz || !tz->trips.hot.flags.valid) |
491 | return -EINVAL; | 480 | return -EINVAL; |
492 | 481 | ||
@@ -496,11 +485,7 @@ static int acpi_thermal_hot(struct acpi_thermal *tz) | |||
496 | } else if (tz->trips.hot.flags.enabled) | 485 | } else if (tz->trips.hot.flags.enabled) |
497 | tz->trips.hot.flags.enabled = 0; | 486 | tz->trips.hot.flags.enabled = 0; |
498 | 487 | ||
499 | result = acpi_bus_get_device(tz->handle, &device); | 488 | acpi_bus_generate_event(tz->device, ACPI_THERMAL_NOTIFY_HOT, |
500 | if (result) | ||
501 | return result; | ||
502 | |||
503 | acpi_bus_generate_event(device, ACPI_THERMAL_NOTIFY_HOT, | ||
504 | tz->trips.hot.flags.enabled); | 489 | tz->trips.hot.flags.enabled); |
505 | 490 | ||
506 | /* TBD: Call user-mode "sleep(S4)" function */ | 491 | /* TBD: Call user-mode "sleep(S4)" function */ |
@@ -1193,8 +1178,7 @@ static void acpi_thermal_notify(acpi_handle handle, u32 event, void *data) | |||
1193 | if (!tz) | 1178 | if (!tz) |
1194 | return; | 1179 | return; |
1195 | 1180 | ||
1196 | if (acpi_bus_get_device(tz->handle, &device)) | 1181 | device = tz->device; |
1197 | return; | ||
1198 | 1182 | ||
1199 | switch (event) { | 1183 | switch (event) { |
1200 | case ACPI_THERMAL_NOTIFY_TEMPERATURE: | 1184 | case ACPI_THERMAL_NOTIFY_TEMPERATURE: |
@@ -1294,6 +1278,7 @@ static int acpi_thermal_add(struct acpi_device *device) | |||
1294 | memset(tz, 0, sizeof(struct acpi_thermal)); | 1278 | memset(tz, 0, sizeof(struct acpi_thermal)); |
1295 | 1279 | ||
1296 | tz->handle = device->handle; | 1280 | tz->handle = device->handle; |
1281 | tz->device = device; | ||
1297 | strcpy(tz->name, device->pnp.bus_id); | 1282 | strcpy(tz->name, device->pnp.bus_id); |
1298 | strcpy(acpi_device_name(device), ACPI_THERMAL_DEVICE_NAME); | 1283 | strcpy(acpi_device_name(device), ACPI_THERMAL_DEVICE_NAME); |
1299 | strcpy(acpi_device_class(device), ACPI_THERMAL_CLASS); | 1284 | strcpy(acpi_device_class(device), ACPI_THERMAL_CLASS); |