Skip to content

Commit

Permalink
Merge branch 'thermal' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
Len Brown committed Apr 5, 2009
2 parents 2ddb9f1 + 03a971a commit 4f3bff7
Show file tree
Hide file tree
Showing 7 changed files with 525 additions and 509 deletions.
20 changes: 12 additions & 8 deletions drivers/acpi/fan.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,31 +68,35 @@ static struct acpi_driver acpi_fan_driver = {
};

/* thermal cooling device callbacks */
static int fan_get_max_state(struct thermal_cooling_device *cdev, char *buf)
static int fan_get_max_state(struct thermal_cooling_device *cdev, unsigned long
*state)
{
/* ACPI fan device only support two states: ON/OFF */
return sprintf(buf, "1\n");
*state = 1;
return 0;
}

static int fan_get_cur_state(struct thermal_cooling_device *cdev, char *buf)
static int fan_get_cur_state(struct thermal_cooling_device *cdev, unsigned long
*state)
{
struct acpi_device *device = cdev->devdata;
int state;
int result;
int acpi_state;

if (!device)
return -EINVAL;

result = acpi_bus_get_power(device->handle, &state);
result = acpi_bus_get_power(device->handle, &acpi_state);
if (result)
return result;

return sprintf(buf, "%s\n", state == ACPI_STATE_D3 ? "0" :
(state == ACPI_STATE_D0 ? "1" : "unknown"));
*state = (acpi_state == ACPI_STATE_D3 ? 0 :
(acpi_state == ACPI_STATE_D0 ? 1 : -1));
return 0;
}

static int
fan_set_cur_state(struct thermal_cooling_device *cdev, unsigned int state)
fan_set_cur_state(struct thermal_cooling_device *cdev, unsigned long state)
{
struct acpi_device *device = cdev->devdata;
int result;
Expand Down
20 changes: 11 additions & 9 deletions drivers/acpi/processor_thermal.c
Original file line number Diff line number Diff line change
Expand Up @@ -373,36 +373,38 @@ static int acpi_processor_max_state(struct acpi_processor *pr)
return max_state;
}
static int
processor_get_max_state(struct thermal_cooling_device *cdev, char *buf)
processor_get_max_state(struct thermal_cooling_device *cdev,
unsigned long *state)
{
struct acpi_device *device = cdev->devdata;
struct acpi_processor *pr = acpi_driver_data(device);

if (!device || !pr)
return -EINVAL;

return sprintf(buf, "%d\n", acpi_processor_max_state(pr));
*state = acpi_processor_max_state(pr);
return 0;
}

static int
processor_get_cur_state(struct thermal_cooling_device *cdev, char *buf)
processor_get_cur_state(struct thermal_cooling_device *cdev,
unsigned long *cur_state)
{
struct acpi_device *device = cdev->devdata;
struct acpi_processor *pr = acpi_driver_data(device);
int cur_state;

if (!device || !pr)
return -EINVAL;

cur_state = cpufreq_get_cur_state(pr->id);
*cur_state = cpufreq_get_cur_state(pr->id);
if (pr->flags.throttling)
cur_state += pr->throttling.state;

return sprintf(buf, "%d\n", cur_state);
*cur_state += pr->throttling.state;
return 0;
}

static int
processor_set_cur_state(struct thermal_cooling_device *cdev, unsigned int state)
processor_set_cur_state(struct thermal_cooling_device *cdev,
unsigned long state)
{
struct acpi_device *device = cdev->devdata;
struct acpi_processor *pr = acpi_driver_data(device);
Expand Down
Loading

0 comments on commit 4f3bff7

Please sign in to comment.