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/panasonic-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/panasonic-laptop.c')
-rw-r--r-- | drivers/platform/x86/panasonic-laptop.c | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/drivers/platform/x86/panasonic-laptop.c b/drivers/platform/x86/panasonic-laptop.c index fe7cf0188acc..2fb9a32926f8 100644 --- a/drivers/platform/x86/panasonic-laptop.c +++ b/drivers/platform/x86/panasonic-laptop.c | |||
@@ -124,6 +124,7 @@ | |||
124 | #include <linux/ctype.h> | 124 | #include <linux/ctype.h> |
125 | #include <linux/seq_file.h> | 125 | #include <linux/seq_file.h> |
126 | #include <linux/uaccess.h> | 126 | #include <linux/uaccess.h> |
127 | #include <linux/slab.h> | ||
127 | #include <acpi/acpi_bus.h> | 128 | #include <acpi/acpi_bus.h> |
128 | #include <acpi/acpi_drivers.h> | 129 | #include <acpi/acpi_drivers.h> |
129 | #include <linux/input.h> | 130 | #include <linux/input.h> |
@@ -200,7 +201,7 @@ static struct acpi_driver acpi_pcc_driver = { | |||
200 | }; | 201 | }; |
201 | 202 | ||
202 | #define KEYMAP_SIZE 11 | 203 | #define KEYMAP_SIZE 11 |
203 | static const int initial_keymap[KEYMAP_SIZE] = { | 204 | static const unsigned int initial_keymap[KEYMAP_SIZE] = { |
204 | /* 0 */ KEY_RESERVED, | 205 | /* 0 */ KEY_RESERVED, |
205 | /* 1 */ KEY_BRIGHTNESSDOWN, | 206 | /* 1 */ KEY_BRIGHTNESSDOWN, |
206 | /* 2 */ KEY_BRIGHTNESSUP, | 207 | /* 2 */ KEY_BRIGHTNESSUP, |
@@ -222,7 +223,7 @@ struct pcc_acpi { | |||
222 | struct acpi_device *device; | 223 | struct acpi_device *device; |
223 | struct input_dev *input_dev; | 224 | struct input_dev *input_dev; |
224 | struct backlight_device *backlight; | 225 | struct backlight_device *backlight; |
225 | int keymap[KEYMAP_SIZE]; | 226 | unsigned int keymap[KEYMAP_SIZE]; |
226 | }; | 227 | }; |
227 | 228 | ||
228 | struct pcc_keyinput { | 229 | struct pcc_keyinput { |
@@ -352,7 +353,7 @@ static int bl_set_status(struct backlight_device *bd) | |||
352 | return acpi_pcc_write_sset(pcc, SINF_DC_CUR_BRIGHT, bright); | 353 | return acpi_pcc_write_sset(pcc, SINF_DC_CUR_BRIGHT, bright); |
353 | } | 354 | } |
354 | 355 | ||
355 | static struct backlight_ops pcc_backlight_ops = { | 356 | static const struct backlight_ops pcc_backlight_ops = { |
356 | .get_brightness = bl_get, | 357 | .get_brightness = bl_get, |
357 | .update_status = bl_set_status, | 358 | .update_status = bl_set_status, |
358 | }; | 359 | }; |
@@ -445,7 +446,8 @@ static struct attribute_group pcc_attr_group = { | |||
445 | 446 | ||
446 | /* hotkey input device driver */ | 447 | /* hotkey input device driver */ |
447 | 448 | ||
448 | static int pcc_getkeycode(struct input_dev *dev, int scancode, int *keycode) | 449 | static int pcc_getkeycode(struct input_dev *dev, |
450 | unsigned int scancode, unsigned int *keycode) | ||
449 | { | 451 | { |
450 | struct pcc_acpi *pcc = input_get_drvdata(dev); | 452 | struct pcc_acpi *pcc = input_get_drvdata(dev); |
451 | 453 | ||
@@ -457,7 +459,7 @@ static int pcc_getkeycode(struct input_dev *dev, int scancode, int *keycode) | |||
457 | return 0; | 459 | return 0; |
458 | } | 460 | } |
459 | 461 | ||
460 | static int keymap_get_by_keycode(struct pcc_acpi *pcc, int keycode) | 462 | static int keymap_get_by_keycode(struct pcc_acpi *pcc, unsigned int keycode) |
461 | { | 463 | { |
462 | int i; | 464 | int i; |
463 | 465 | ||
@@ -469,7 +471,8 @@ static int keymap_get_by_keycode(struct pcc_acpi *pcc, int keycode) | |||
469 | return 0; | 471 | return 0; |
470 | } | 472 | } |
471 | 473 | ||
472 | static int pcc_setkeycode(struct input_dev *dev, int scancode, int keycode) | 474 | static int pcc_setkeycode(struct input_dev *dev, |
475 | unsigned int scancode, unsigned int keycode) | ||
473 | { | 476 | { |
474 | struct pcc_acpi *pcc = input_get_drvdata(dev); | 477 | struct pcc_acpi *pcc = input_get_drvdata(dev); |
475 | int oldkeycode; | 478 | int oldkeycode; |
@@ -477,9 +480,6 @@ static int pcc_setkeycode(struct input_dev *dev, int scancode, int keycode) | |||
477 | if (scancode >= ARRAY_SIZE(pcc->keymap)) | 480 | if (scancode >= ARRAY_SIZE(pcc->keymap)) |
478 | return -EINVAL; | 481 | return -EINVAL; |
479 | 482 | ||
480 | if (keycode < 0 || keycode > KEY_MAX) | ||
481 | return -EINVAL; | ||
482 | |||
483 | oldkeycode = pcc->keymap[scancode]; | 483 | oldkeycode = pcc->keymap[scancode]; |
484 | pcc->keymap[scancode] = keycode; | 484 | pcc->keymap[scancode] = keycode; |
485 | 485 | ||
@@ -601,6 +601,7 @@ static int acpi_pcc_hotkey_resume(struct acpi_device *device) | |||
601 | 601 | ||
602 | static int acpi_pcc_hotkey_add(struct acpi_device *device) | 602 | static int acpi_pcc_hotkey_add(struct acpi_device *device) |
603 | { | 603 | { |
604 | struct backlight_properties props; | ||
604 | struct pcc_acpi *pcc; | 605 | struct pcc_acpi *pcc; |
605 | int num_sifr, result; | 606 | int num_sifr, result; |
606 | 607 | ||
@@ -638,24 +639,25 @@ static int acpi_pcc_hotkey_add(struct acpi_device *device) | |||
638 | if (result) { | 639 | if (result) { |
639 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 640 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
640 | "Error installing keyinput handler\n")); | 641 | "Error installing keyinput handler\n")); |
641 | goto out_sinf; | 642 | goto out_hotkey; |
642 | } | 643 | } |
643 | 644 | ||
644 | /* initialize backlight */ | ||
645 | pcc->backlight = backlight_device_register("panasonic", NULL, pcc, | ||
646 | &pcc_backlight_ops); | ||
647 | if (IS_ERR(pcc->backlight)) | ||
648 | goto out_input; | ||
649 | |||
650 | if (!acpi_pcc_retrieve_biosdata(pcc, pcc->sinf)) { | 645 | if (!acpi_pcc_retrieve_biosdata(pcc, pcc->sinf)) { |
651 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 646 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
652 | "Couldn't retrieve BIOS data\n")); | 647 | "Couldn't retrieve BIOS data\n")); |
653 | goto out_backlight; | 648 | goto out_input; |
649 | } | ||
650 | /* initialize backlight */ | ||
651 | memset(&props, 0, sizeof(struct backlight_properties)); | ||
652 | props.max_brightness = pcc->sinf[SINF_AC_MAX_BRIGHT]; | ||
653 | pcc->backlight = backlight_device_register("panasonic", NULL, pcc, | ||
654 | &pcc_backlight_ops, &props); | ||
655 | if (IS_ERR(pcc->backlight)) { | ||
656 | result = PTR_ERR(pcc->backlight); | ||
657 | goto out_sinf; | ||
654 | } | 658 | } |
655 | 659 | ||
656 | /* read the initial brightness setting from the hardware */ | 660 | /* read the initial brightness setting from the hardware */ |
657 | pcc->backlight->props.max_brightness = | ||
658 | pcc->sinf[SINF_AC_MAX_BRIGHT]; | ||
659 | pcc->backlight->props.brightness = pcc->sinf[SINF_AC_CUR_BRIGHT]; | 661 | pcc->backlight->props.brightness = pcc->sinf[SINF_AC_CUR_BRIGHT]; |
660 | 662 | ||
661 | /* read the initial sticky key mode from the hardware */ | 663 | /* read the initial sticky key mode from the hardware */ |
@@ -670,12 +672,12 @@ static int acpi_pcc_hotkey_add(struct acpi_device *device) | |||
670 | 672 | ||
671 | out_backlight: | 673 | out_backlight: |
672 | backlight_device_unregister(pcc->backlight); | 674 | backlight_device_unregister(pcc->backlight); |
675 | out_sinf: | ||
676 | kfree(pcc->sinf); | ||
673 | out_input: | 677 | out_input: |
674 | input_unregister_device(pcc->input_dev); | 678 | input_unregister_device(pcc->input_dev); |
675 | /* no need to input_free_device() since core input API refcount and | 679 | /* no need to input_free_device() since core input API refcount and |
676 | * free()s the device */ | 680 | * free()s the device */ |
677 | out_sinf: | ||
678 | kfree(pcc->sinf); | ||
679 | out_hotkey: | 681 | out_hotkey: |
680 | kfree(pcc); | 682 | kfree(pcc); |
681 | 683 | ||