diff options
author | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-05-30 19:16:45 -0400 |
---|---|---|
committer | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-05-30 19:16:45 -0400 |
commit | ada47b5fe13d89735805b566185f4885f5a3f750 (patch) | |
tree | 644b88f8a71896307d71438e9b3af49126ffb22b /drivers/platform/x86/fujitsu-laptop.c | |
parent | 43e98717ad40a4ae64545b5ba047c7b86aa44f4f (diff) | |
parent | 3280f21d43ee541f97f8cda5792150d2dbec20d5 (diff) |
Merge branch 'wip-2.6.34' into old-private-masterarchived-private-master
Diffstat (limited to 'drivers/platform/x86/fujitsu-laptop.c')
-rw-r--r-- | drivers/platform/x86/fujitsu-laptop.c | 53 |
1 files changed, 29 insertions, 24 deletions
diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/fujitsu-laptop.c index bcd4ba8be7db..47b4fd75aa34 100644 --- a/drivers/platform/x86/fujitsu-laptop.c +++ b/drivers/platform/x86/fujitsu-laptop.c | |||
@@ -66,6 +66,7 @@ | |||
66 | #include <linux/kfifo.h> | 66 | #include <linux/kfifo.h> |
67 | #include <linux/video_output.h> | 67 | #include <linux/video_output.h> |
68 | #include <linux/platform_device.h> | 68 | #include <linux/platform_device.h> |
69 | #include <linux/slab.h> | ||
69 | #if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE) | 70 | #if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE) |
70 | #include <linux/leds.h> | 71 | #include <linux/leds.h> |
71 | #endif | 72 | #endif |
@@ -164,7 +165,7 @@ struct fujitsu_hotkey_t { | |||
164 | struct input_dev *input; | 165 | struct input_dev *input; |
165 | char phys[32]; | 166 | char phys[32]; |
166 | struct platform_device *pf_device; | 167 | struct platform_device *pf_device; |
167 | struct kfifo *fifo; | 168 | struct kfifo fifo; |
168 | spinlock_t fifo_lock; | 169 | spinlock_t fifo_lock; |
169 | int rfkill_supported; | 170 | int rfkill_supported; |
170 | int rfkill_state; | 171 | int rfkill_state; |
@@ -376,8 +377,8 @@ static int get_lcd_level(void) | |||
376 | 377 | ||
377 | status = | 378 | status = |
378 | acpi_evaluate_integer(fujitsu->acpi_handle, "GBLL", NULL, &state); | 379 | acpi_evaluate_integer(fujitsu->acpi_handle, "GBLL", NULL, &state); |
379 | if (status < 0) | 380 | if (ACPI_FAILURE(status)) |
380 | return status; | 381 | return 0; |
381 | 382 | ||
382 | fujitsu->brightness_level = state & 0x0fffffff; | 383 | fujitsu->brightness_level = state & 0x0fffffff; |
383 | 384 | ||
@@ -398,8 +399,8 @@ static int get_max_brightness(void) | |||
398 | 399 | ||
399 | status = | 400 | status = |
400 | acpi_evaluate_integer(fujitsu->acpi_handle, "RBLL", NULL, &state); | 401 | acpi_evaluate_integer(fujitsu->acpi_handle, "RBLL", NULL, &state); |
401 | if (status < 0) | 402 | if (ACPI_FAILURE(status)) |
402 | return status; | 403 | return -1; |
403 | 404 | ||
404 | fujitsu->max_brightness = state; | 405 | fujitsu->max_brightness = state; |
405 | 406 | ||
@@ -824,12 +825,10 @@ static int acpi_fujitsu_hotkey_add(struct acpi_device *device) | |||
824 | 825 | ||
825 | /* kfifo */ | 826 | /* kfifo */ |
826 | spin_lock_init(&fujitsu_hotkey->fifo_lock); | 827 | spin_lock_init(&fujitsu_hotkey->fifo_lock); |
827 | fujitsu_hotkey->fifo = | 828 | error = kfifo_alloc(&fujitsu_hotkey->fifo, RINGBUFFERSIZE * sizeof(int), |
828 | kfifo_alloc(RINGBUFFERSIZE * sizeof(int), GFP_KERNEL, | 829 | GFP_KERNEL); |
829 | &fujitsu_hotkey->fifo_lock); | 830 | if (error) { |
830 | if (IS_ERR(fujitsu_hotkey->fifo)) { | ||
831 | printk(KERN_ERR "kfifo_alloc failed\n"); | 831 | printk(KERN_ERR "kfifo_alloc failed\n"); |
832 | error = PTR_ERR(fujitsu_hotkey->fifo); | ||
833 | goto err_stop; | 832 | goto err_stop; |
834 | } | 833 | } |
835 | 834 | ||
@@ -934,7 +933,7 @@ err_unregister_input_dev: | |||
934 | err_free_input_dev: | 933 | err_free_input_dev: |
935 | input_free_device(input); | 934 | input_free_device(input); |
936 | err_free_fifo: | 935 | err_free_fifo: |
937 | kfifo_free(fujitsu_hotkey->fifo); | 936 | kfifo_free(&fujitsu_hotkey->fifo); |
938 | err_stop: | 937 | err_stop: |
939 | return result; | 938 | return result; |
940 | } | 939 | } |
@@ -956,7 +955,7 @@ static int acpi_fujitsu_hotkey_remove(struct acpi_device *device, int type) | |||
956 | 955 | ||
957 | input_free_device(input); | 956 | input_free_device(input); |
958 | 957 | ||
959 | kfifo_free(fujitsu_hotkey->fifo); | 958 | kfifo_free(&fujitsu_hotkey->fifo); |
960 | 959 | ||
961 | fujitsu_hotkey->acpi_handle = NULL; | 960 | fujitsu_hotkey->acpi_handle = NULL; |
962 | 961 | ||
@@ -1008,9 +1007,10 @@ static void acpi_fujitsu_hotkey_notify(struct acpi_device *device, u32 event) | |||
1008 | vdbg_printk(FUJLAPTOP_DBG_TRACE, | 1007 | vdbg_printk(FUJLAPTOP_DBG_TRACE, |
1009 | "Push keycode into ringbuffer [%d]\n", | 1008 | "Push keycode into ringbuffer [%d]\n", |
1010 | keycode); | 1009 | keycode); |
1011 | status = kfifo_put(fujitsu_hotkey->fifo, | 1010 | status = kfifo_in_locked(&fujitsu_hotkey->fifo, |
1012 | (unsigned char *)&keycode, | 1011 | (unsigned char *)&keycode, |
1013 | sizeof(keycode)); | 1012 | sizeof(keycode), |
1013 | &fujitsu_hotkey->fifo_lock); | ||
1014 | if (status != sizeof(keycode)) { | 1014 | if (status != sizeof(keycode)) { |
1015 | vdbg_printk(FUJLAPTOP_DBG_WARN, | 1015 | vdbg_printk(FUJLAPTOP_DBG_WARN, |
1016 | "Could not push keycode [0x%x]\n", | 1016 | "Could not push keycode [0x%x]\n", |
@@ -1021,11 +1021,12 @@ static void acpi_fujitsu_hotkey_notify(struct acpi_device *device, u32 event) | |||
1021 | } | 1021 | } |
1022 | } else if (keycode == 0) { | 1022 | } else if (keycode == 0) { |
1023 | while ((status = | 1023 | while ((status = |
1024 | kfifo_get | 1024 | kfifo_out_locked( |
1025 | (fujitsu_hotkey->fifo, (unsigned char *) | 1025 | &fujitsu_hotkey->fifo, |
1026 | &keycode_r, | 1026 | (unsigned char *) &keycode_r, |
1027 | sizeof | 1027 | sizeof(keycode_r), |
1028 | (keycode_r))) == sizeof(keycode_r)) { | 1028 | &fujitsu_hotkey->fifo_lock)) |
1029 | == sizeof(keycode_r)) { | ||
1029 | input_report_key(input, keycode_r, 0); | 1030 | input_report_key(input, keycode_r, 0); |
1030 | input_sync(input); | 1031 | input_sync(input); |
1031 | vdbg_printk(FUJLAPTOP_DBG_TRACE, | 1032 | vdbg_printk(FUJLAPTOP_DBG_TRACE, |
@@ -1126,16 +1127,20 @@ static int __init fujitsu_init(void) | |||
1126 | /* Register backlight stuff */ | 1127 | /* Register backlight stuff */ |
1127 | 1128 | ||
1128 | if (!acpi_video_backlight_support()) { | 1129 | if (!acpi_video_backlight_support()) { |
1129 | fujitsu->bl_device = | 1130 | struct backlight_properties props; |
1130 | backlight_device_register("fujitsu-laptop", NULL, NULL, | 1131 | |
1131 | &fujitsubl_ops); | 1132 | memset(&props, 0, sizeof(struct backlight_properties)); |
1133 | max_brightness = fujitsu->max_brightness; | ||
1134 | props.max_brightness = max_brightness - 1; | ||
1135 | fujitsu->bl_device = backlight_device_register("fujitsu-laptop", | ||
1136 | NULL, NULL, | ||
1137 | &fujitsubl_ops, | ||
1138 | &props); | ||
1132 | if (IS_ERR(fujitsu->bl_device)) { | 1139 | if (IS_ERR(fujitsu->bl_device)) { |
1133 | ret = PTR_ERR(fujitsu->bl_device); | 1140 | ret = PTR_ERR(fujitsu->bl_device); |
1134 | fujitsu->bl_device = NULL; | 1141 | fujitsu->bl_device = NULL; |
1135 | goto fail_sysfs_group; | 1142 | goto fail_sysfs_group; |
1136 | } | 1143 | } |
1137 | max_brightness = fujitsu->max_brightness; | ||
1138 | fujitsu->bl_device->props.max_brightness = max_brightness - 1; | ||
1139 | fujitsu->bl_device->props.brightness = fujitsu->brightness_level; | 1144 | fujitsu->bl_device->props.brightness = fujitsu->brightness_level; |
1140 | } | 1145 | } |
1141 | 1146 | ||