aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/video.c
diff options
context:
space:
mode:
authorMatthew Garrett <mjg59@srcf.ucam.org>2008-11-27 12:48:13 -0500
committerLen Brown <len.brown@intel.com>2009-02-20 10:52:37 -0500
commit6503e5df08008b9a47022b5e9ebba658c8fa69af (patch)
tree8ef36d1b85d2a03ac9e61f5074d717b67f9259ba /drivers/acpi/video.c
parentd2f8d7ee1a9b4650b4e43325b321801264f7c37a (diff)
thermal: use integers rather than strings for thermal values
The thermal API currently uses strings to pass values to userspace. This makes it difficult to use from within the kernel. Change the interface to use integers and fix up the consumers. Signed-off-by: Matthew Garrett <mjg@redhat.com> Acked-by: Zhang Rui <rui.zhang@intel.com> Acked-by: Thomas Renninger <trenn@suse.de> Signed-off-by: Len Brown <len.brown@intel.com>
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);