- 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>
struct acpi_thermal {
acpi_handle handle;
struct acpi_thermal {
acpi_handle handle;
+ struct acpi_device * device;
acpi_bus_id name;
unsigned long temperature;
unsigned long last_temperature;
acpi_bus_id name;
unsigned long temperature;
unsigned long last_temperature;
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)
return -EINVAL;
if (!tz || !tz->trips.critical.flags.valid)
return -EINVAL;
} else if (tz->trips.critical.flags.enabled)
tz->trips.critical.flags.enabled = 0;
} else if (tz->trips.critical.flags.enabled)
tz->trips.critical.flags.enabled = 0;
- result = acpi_bus_get_device(tz->handle, &device);
- if (result)
- return result;
-
printk(KERN_EMERG
"Critical temperature reached (%ld C), shutting down.\n",
KELVIN_TO_CELSIUS(tz->temperature));
printk(KERN_EMERG
"Critical temperature reached (%ld C), shutting down.\n",
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);
acpi_thermal_call_usermode(ACPI_THERMAL_PATH_POWEROFF);
tz->trips.critical.flags.enabled);
acpi_thermal_call_usermode(ACPI_THERMAL_PATH_POWEROFF);
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)
return -EINVAL;
if (!tz || !tz->trips.hot.flags.valid)
return -EINVAL;
} else if (tz->trips.hot.flags.enabled)
tz->trips.hot.flags.enabled = 0;
} else if (tz->trips.hot.flags.enabled)
tz->trips.hot.flags.enabled = 0;
- result = acpi_bus_get_device(tz->handle, &device);
- if (result)
- return result;
-
- acpi_bus_generate_event(device, ACPI_THERMAL_NOTIFY_HOT,
+ acpi_bus_generate_event(tz->device, ACPI_THERMAL_NOTIFY_HOT,
tz->trips.hot.flags.enabled);
/* TBD: Call user-mode "sleep(S4)" function */
tz->trips.hot.flags.enabled);
/* TBD: Call user-mode "sleep(S4)" function */
- if (acpi_bus_get_device(tz->handle, &device))
- return;
switch (event) {
case ACPI_THERMAL_NOTIFY_TEMPERATURE:
switch (event) {
case ACPI_THERMAL_NOTIFY_TEMPERATURE:
memset(tz, 0, sizeof(struct acpi_thermal));
tz->handle = device->handle;
memset(tz, 0, sizeof(struct acpi_thermal));
tz->handle = device->handle;
strcpy(tz->name, device->pnp.bus_id);
strcpy(acpi_device_name(device), ACPI_THERMAL_DEVICE_NAME);
strcpy(acpi_device_class(device), ACPI_THERMAL_CLASS);
strcpy(tz->name, device->pnp.bus_id);
strcpy(acpi_device_name(device), ACPI_THERMAL_DEVICE_NAME);
strcpy(acpi_device_class(device), ACPI_THERMAL_CLASS);