aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/video.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/video.c')
-rw-r--r--drivers/acpi/video.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index bb5ed059114a..5259d502add6 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -358,32 +358,36 @@ static struct output_properties acpi_output_properties = {
358 358
359 359
360/* thermal cooling device callbacks */ 360/* thermal cooling device callbacks */
361static int video_get_max_state(struct thermal_cooling_device *cdev, char *buf) 361static int video_get_max_state(struct thermal_cooling_device *cdev, unsigned
362 long *state)
362{ 363{
363 struct acpi_device *device = cdev->devdata; 364 struct acpi_device *device = cdev->devdata;
364 struct acpi_video_device *video = acpi_driver_data(device); 365 struct acpi_video_device *video = acpi_driver_data(device);
365 366
366 return sprintf(buf, "%d\n", video->brightness->count - 3); 367 *state = video->brightness->count - 3;
368 return 0;
367} 369}
368 370
369static int video_get_cur_state(struct thermal_cooling_device *cdev, char *buf) 371static int video_get_cur_state(struct thermal_cooling_device *cdev, unsigned
372 long *state)
370{ 373{
371 struct acpi_device *device = cdev->devdata; 374 struct acpi_device *device = cdev->devdata;
372 struct acpi_video_device *video = acpi_driver_data(device); 375 struct acpi_video_device *video = acpi_driver_data(device);
373 unsigned long long level; 376 unsigned long long level;
374 int state; 377 int offset;
375 378
376 acpi_video_device_lcd_get_level_current(video, &level); 379 acpi_video_device_lcd_get_level_current(video, &level);
377 for (state = 2; state < video->brightness->count; state++) 380 for (offset = 2; offset < video->brightness->count; offset++)
378 if (level == video->brightness->levels[state]) 381 if (level == video->brightness->levels[offset]) {
379 return sprintf(buf, "%d\n", 382 *state = video->brightness->count - offset - 1;
380 video->brightness->count - state - 1); 383 return 0;
384 }
381 385
382 return -EINVAL; 386 return -EINVAL;
383} 387}
384 388
385static int 389static int
386video_set_cur_state(struct thermal_cooling_device *cdev, unsigned int state) 390video_set_cur_state(struct thermal_cooling_device *cdev, unsigned long state)
387{ 391{
388 struct acpi_device *device = cdev->devdata; 392 struct acpi_device *device = cdev->devdata;
389 struct acpi_video_device *video = acpi_driver_data(device); 393 struct acpi_video_device *video = acpi_driver_data(device);