aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform/x86/panasonic-laptop.c
diff options
context:
space:
mode:
authorMatthew Garrett <mjg@redhat.com>2010-02-17 16:39:44 -0500
committerRichard Purdie <rpurdie@linux.intel.com>2010-03-16 15:47:54 -0400
commita19a6ee6cad2b20292a774c2f56ba8039b0fac9c (patch)
tree631916ce6181336c5c28eb0cf5484c40c92986b6 /drivers/platform/x86/panasonic-laptop.c
parent57e148b6a975980944f4466ccb669b1d02dfc6a1 (diff)
backlight: Allow properties to be passed at registration
Values such as max_brightness should be set before backlights are registered, but the current API doesn't allow that. Add a parameter to backlight_device_register and update drivers to ensure that they set this correctly. Signed-off-by: Matthew Garrett <mjg@redhat.com> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'drivers/platform/x86/panasonic-laptop.c')
-rw-r--r--drivers/platform/x86/panasonic-laptop.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/drivers/platform/x86/panasonic-laptop.c b/drivers/platform/x86/panasonic-laptop.c
index c9fc479fc290..ab5c9cea1462 100644
--- a/drivers/platform/x86/panasonic-laptop.c
+++ b/drivers/platform/x86/panasonic-laptop.c
@@ -600,6 +600,7 @@ static int acpi_pcc_hotkey_resume(struct acpi_device *device)
600 600
601static int acpi_pcc_hotkey_add(struct acpi_device *device) 601static 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,23 @@ 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;
653 } 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 goto out_sinf;
654 656
655 /* read the initial brightness setting from the hardware */ 657 /* 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]; 658 pcc->backlight->props.brightness = pcc->sinf[SINF_AC_CUR_BRIGHT];
659 659
660 /* read the initial sticky key mode from the hardware */ 660 /* read the initial sticky key mode from the hardware */
@@ -669,12 +669,12 @@ static int acpi_pcc_hotkey_add(struct acpi_device *device)
669 669
670out_backlight: 670out_backlight:
671 backlight_device_unregister(pcc->backlight); 671 backlight_device_unregister(pcc->backlight);
672out_sinf:
673 kfree(pcc->sinf);
672out_input: 674out_input:
673 input_unregister_device(pcc->input_dev); 675 input_unregister_device(pcc->input_dev);
674 /* no need to input_free_device() since core input API refcount and 676 /* no need to input_free_device() since core input API refcount and
675 * free()s the device */ 677 * free()s the device */
676out_sinf:
677 kfree(pcc->sinf);
678out_hotkey: 678out_hotkey:
679 kfree(pcc); 679 kfree(pcc);
680 680