]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
sony_acpi: Fix sony_acpi backlight registration and unregistration
authorMattia Dongili <malattia@linux.it>
Sat, 13 Jan 2007 22:04:41 +0000 (23:04 +0100)
committerLen Brown <len.brown@intel.com>
Tue, 13 Feb 2007 08:06:44 +0000 (03:06 -0500)
Initialize the current brightness if the driver registration
was successful and unregister the driver in the error exit path.

Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Len Brown <len.brown@intel.com>
drivers/acpi/sony_acpi.c

index c65f5893e0e299cbd12a8745abac087c1454919a..c01d98db2fc1513138536c448c20f3ec2f7e6b24 100644 (file)
@@ -354,9 +354,14 @@ static int sony_acpi_add(struct acpi_device *device)
        if (ACPI_SUCCESS(acpi_get_handle(sony_acpi_handle, "GBRT", &handle))) {
                sony_backlight_device = backlight_device_register("sony", NULL,
                                        NULL, &sony_backlight_properties);
+
                if (IS_ERR(sony_backlight_device)) {
                        printk(LOG_PFX "unable to register backlight device\n");
+                       sony_backlight_device = NULL;
                }
+               else
+                       sony_backlight_properties.brightness =
+                               sony_backlight_get_brightness(sony_backlight_device);
        }
 
        for (item = sony_acpi_values; item->name; ++item) {
@@ -400,6 +405,9 @@ static int sony_acpi_add(struct acpi_device *device)
        return 0;
 
 outproc:
+       if (sony_backlight_device)
+               backlight_device_unregister(sony_backlight_device);
+
        for (item = sony_acpi_values; item->name; ++item)
                if (item->proc)
                        remove_proc_entry(item->name, acpi_device_dir(device));