Commit 8348e1b1 authored by Patrick Mochel's avatar Patrick Mochel Committed by Len Brown

ACPI: thermal: add struct acpi_device to struct acpi_thermal.

- Use it instead of acpi_bus_get_device() where we can..
Signed-off-by: default avatarPatrick Mochel <mochel@linux.intel.com>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent 32917e5b
...@@ -163,6 +163,7 @@ struct acpi_thermal_flags { ...@@ -163,6 +163,7 @@ struct acpi_thermal_flags {
struct acpi_thermal { struct acpi_thermal {
acpi_handle handle; acpi_handle handle;
struct acpi_device * device;
acpi_bus_id name; acpi_bus_id name;
unsigned long temperature; unsigned long temperature;
unsigned long last_temperature; unsigned long last_temperature;
...@@ -453,10 +454,6 @@ static int acpi_thermal_call_usermode(char *path) ...@@ -453,10 +454,6 @@ static int acpi_thermal_call_usermode(char *path)
static int acpi_thermal_critical(struct acpi_thermal *tz) static int acpi_thermal_critical(struct acpi_thermal *tz)
{ {
int result = 0;
struct acpi_device *device = NULL;
if (!tz || !tz->trips.critical.flags.valid) if (!tz || !tz->trips.critical.flags.valid)
return -EINVAL; return -EINVAL;
...@@ -466,14 +463,10 @@ static int acpi_thermal_critical(struct acpi_thermal *tz) ...@@ -466,14 +463,10 @@ static int acpi_thermal_critical(struct acpi_thermal *tz)
} else if (tz->trips.critical.flags.enabled) } else if (tz->trips.critical.flags.enabled)
tz->trips.critical.flags.enabled = 0; tz->trips.critical.flags.enabled = 0;
result = acpi_bus_get_device(tz->handle, &device);
if (result)
return result;
printk(KERN_EMERG printk(KERN_EMERG
"Critical temperature reached (%ld C), shutting down.\n", "Critical temperature reached (%ld C), shutting down.\n",
KELVIN_TO_CELSIUS(tz->temperature)); KELVIN_TO_CELSIUS(tz->temperature));
acpi_bus_generate_event(device, ACPI_THERMAL_NOTIFY_CRITICAL, acpi_bus_generate_event(tz->device, ACPI_THERMAL_NOTIFY_CRITICAL,
tz->trips.critical.flags.enabled); tz->trips.critical.flags.enabled);
acpi_thermal_call_usermode(ACPI_THERMAL_PATH_POWEROFF); acpi_thermal_call_usermode(ACPI_THERMAL_PATH_POWEROFF);
...@@ -483,10 +476,6 @@ static int acpi_thermal_critical(struct acpi_thermal *tz) ...@@ -483,10 +476,6 @@ static int acpi_thermal_critical(struct acpi_thermal *tz)
static int acpi_thermal_hot(struct acpi_thermal *tz) static int acpi_thermal_hot(struct acpi_thermal *tz)
{ {
int result = 0;
struct acpi_device *device = NULL;
if (!tz || !tz->trips.hot.flags.valid) if (!tz || !tz->trips.hot.flags.valid)
return -EINVAL; return -EINVAL;
...@@ -496,11 +485,7 @@ static int acpi_thermal_hot(struct acpi_thermal *tz) ...@@ -496,11 +485,7 @@ static int acpi_thermal_hot(struct acpi_thermal *tz)
} else if (tz->trips.hot.flags.enabled) } else if (tz->trips.hot.flags.enabled)
tz->trips.hot.flags.enabled = 0; tz->trips.hot.flags.enabled = 0;
result = acpi_bus_get_device(tz->handle, &device); acpi_bus_generate_event(tz->device, ACPI_THERMAL_NOTIFY_HOT,
if (result)
return result;
acpi_bus_generate_event(device, ACPI_THERMAL_NOTIFY_HOT,
tz->trips.hot.flags.enabled); tz->trips.hot.flags.enabled);
/* TBD: Call user-mode "sleep(S4)" function */ /* TBD: Call user-mode "sleep(S4)" function */
...@@ -1193,8 +1178,7 @@ static void acpi_thermal_notify(acpi_handle handle, u32 event, void *data) ...@@ -1193,8 +1178,7 @@ static void acpi_thermal_notify(acpi_handle handle, u32 event, void *data)
if (!tz) if (!tz)
return; return;
if (acpi_bus_get_device(tz->handle, &device)) device = tz->device;
return;
switch (event) { switch (event) {
case ACPI_THERMAL_NOTIFY_TEMPERATURE: case ACPI_THERMAL_NOTIFY_TEMPERATURE:
...@@ -1294,6 +1278,7 @@ static int acpi_thermal_add(struct acpi_device *device) ...@@ -1294,6 +1278,7 @@ static int acpi_thermal_add(struct acpi_device *device)
memset(tz, 0, sizeof(struct acpi_thermal)); memset(tz, 0, sizeof(struct acpi_thermal));
tz->handle = device->handle; tz->handle = device->handle;
tz->device = device;
strcpy(tz->name, device->pnp.bus_id); strcpy(tz->name, device->pnp.bus_id);
strcpy(acpi_device_name(device), ACPI_THERMAL_DEVICE_NAME); strcpy(acpi_device_name(device), ACPI_THERMAL_DEVICE_NAME);
strcpy(acpi_device_class(device), ACPI_THERMAL_CLASS); strcpy(acpi_device_class(device), ACPI_THERMAL_CLASS);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment