diff options
Diffstat (limited to 'drivers/platform/x86/panasonic-laptop.c')
-rw-r--r-- | drivers/platform/x86/panasonic-laptop.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/drivers/platform/x86/panasonic-laptop.c b/drivers/platform/x86/panasonic-laptop.c index c9fc479fc290..726f02affcb6 100644 --- a/drivers/platform/x86/panasonic-laptop.c +++ b/drivers/platform/x86/panasonic-laptop.c | |||
@@ -352,7 +352,7 @@ static int bl_set_status(struct backlight_device *bd) | |||
352 | return acpi_pcc_write_sset(pcc, SINF_DC_CUR_BRIGHT, bright); | 352 | return acpi_pcc_write_sset(pcc, SINF_DC_CUR_BRIGHT, bright); |
353 | } | 353 | } |
354 | 354 | ||
355 | static struct backlight_ops pcc_backlight_ops = { | 355 | static const struct backlight_ops pcc_backlight_ops = { |
356 | .get_brightness = bl_get, | 356 | .get_brightness = bl_get, |
357 | .update_status = bl_set_status, | 357 | .update_status = bl_set_status, |
358 | }; | 358 | }; |
@@ -600,6 +600,7 @@ static int acpi_pcc_hotkey_resume(struct acpi_device *device) | |||
600 | 600 | ||
601 | static int acpi_pcc_hotkey_add(struct acpi_device *device) | 601 | static int acpi_pcc_hotkey_add(struct acpi_device *device) |
602 | { | 602 | { |
603 | struct backlight_properties props; | ||
603 | struct pcc_acpi *pcc; | 604 | struct pcc_acpi *pcc; |
604 | int num_sifr, result; | 605 | int num_sifr, result; |
605 | 606 | ||
@@ -637,24 +638,25 @@ static int acpi_pcc_hotkey_add(struct acpi_device *device) | |||
637 | if (result) { | 638 | if (result) { |
638 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 639 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
639 | "Error installing keyinput handler\n")); | 640 | "Error installing keyinput handler\n")); |
640 | goto out_sinf; | 641 | goto out_hotkey; |
641 | } | 642 | } |
642 | 643 | ||
643 | /* initialize backlight */ | ||
644 | pcc->backlight = backlight_device_register("panasonic", NULL, pcc, | ||
645 | &pcc_backlight_ops); | ||
646 | if (IS_ERR(pcc->backlight)) | ||
647 | goto out_input; | ||
648 | |||
649 | if (!acpi_pcc_retrieve_biosdata(pcc, pcc->sinf)) { | 644 | if (!acpi_pcc_retrieve_biosdata(pcc, pcc->sinf)) { |
650 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 645 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
651 | "Couldn't retrieve BIOS data\n")); | 646 | "Couldn't retrieve BIOS data\n")); |
652 | goto out_backlight; | 647 | goto out_input; |
648 | } | ||
649 | /* initialize backlight */ | ||
650 | memset(&props, 0, sizeof(struct backlight_properties)); | ||
651 | props.max_brightness = pcc->sinf[SINF_AC_MAX_BRIGHT]; | ||
652 | pcc->backlight = backlight_device_register("panasonic", NULL, pcc, | ||
653 | &pcc_backlight_ops, &props); | ||
654 | if (IS_ERR(pcc->backlight)) { | ||
655 | result = PTR_ERR(pcc->backlight); | ||
656 | goto out_sinf; | ||
653 | } | 657 | } |
654 | 658 | ||
655 | /* read the initial brightness setting from the hardware */ | 659 | /* read the initial brightness setting from the hardware */ |
656 | pcc->backlight->props.max_brightness = | ||
657 | pcc->sinf[SINF_AC_MAX_BRIGHT]; | ||
658 | pcc->backlight->props.brightness = pcc->sinf[SINF_AC_CUR_BRIGHT]; | 660 | pcc->backlight->props.brightness = pcc->sinf[SINF_AC_CUR_BRIGHT]; |
659 | 661 | ||
660 | /* read the initial sticky key mode from the hardware */ | 662 | /* read the initial sticky key mode from the hardware */ |
@@ -669,12 +671,12 @@ static int acpi_pcc_hotkey_add(struct acpi_device *device) | |||
669 | 671 | ||
670 | out_backlight: | 672 | out_backlight: |
671 | backlight_device_unregister(pcc->backlight); | 673 | backlight_device_unregister(pcc->backlight); |
674 | out_sinf: | ||
675 | kfree(pcc->sinf); | ||
672 | out_input: | 676 | out_input: |
673 | input_unregister_device(pcc->input_dev); | 677 | input_unregister_device(pcc->input_dev); |
674 | /* no need to input_free_device() since core input API refcount and | 678 | /* no need to input_free_device() since core input API refcount and |
675 | * free()s the device */ | 679 | * free()s the device */ |
676 | out_sinf: | ||
677 | kfree(pcc->sinf); | ||
678 | out_hotkey: | 680 | out_hotkey: |
679 | kfree(pcc); | 681 | kfree(pcc); |
680 | 682 | ||