Skip to contentSkip to conversation

sony_acpi: fix sony_acpi backlight registration and unregistration

PATCH Applied [email protected] 2 participants 2 messages Feb 6, 2007 – Feb 7, 2007 ACPI

lore
Share & tools
lore
#0 lore raw

PATCH 13/13 sony_acpi: fix sony_acpi backlight registration and unregistration

From: Mattia Dongili <[email protected]>

Initialize the current brightness if the driver registration was successful and unregister the driver in the error exit path.

---

 drivers/acpi/sony_acpi.c |    8 ++++++++
 1 file changed, 8 insertions(+)
drivers/acpi/sony_acpi.c renamed from drivers/acpi/sony_acpi.c~sony_acpi-fix-sony_acpi-backlight-registration-and-unregistration +8 -0
diff -puN drivers/acpi/sony_acpi.c~sony_acpi-fix-sony_acpi-backlight-registration-and-unregistration drivers/acpi/sony_acpi.c
@@ -354,9 +354,14 @@ static int sony_acpi_add(struct acpi_dev
 	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_dev
 	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));

_

reviewer NAK
#1 lore raw

NAK, included in sony-laptop series.

AFAICT, Mattia applied all the various sony fixes floating about to sony_acpi.c before re-naming it to sony-laptop.c, where it lives in the acpi-test tree today.

thanks,
-Len

Quoted 46 lines · On Monday 05 February 2007 19:09, [email protected] wrote:

From: Mattia Dongili <[email protected]>

Initialize the current brightness if the driver registration was successful and unregister the driver in the error exit path.

---

 drivers/acpi/sony_acpi.c |    8 ++++++++
 1 file changed, 8 insertions(+)

diff -puN drivers/acpi/sony_acpi.c~sony_acpi-fix-sony_acpi-backlight-registration-and-unregistration drivers/acpi/sony_acpi.c

drivers/acpi/sony_acpi.c renamed from drivers/acpi/sony_acpi.c~sony_acpi-fix-sony_acpi-backlight-registration-and-unregistration +8 -0
@@ -354,9 +354,14 @@ static int sony_acpi_add(struct acpi_dev
 	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_dev
 	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));

_
-
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html