Skip to contentSkip to conversation

Current brightness level got not set correctly in video module, fix it.

PATCH In review Thomas Renninger 2 participants 2 messages Oct 16, 2007 ACPI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Current brightness level got not set correctly in video module, fix it.

Hi,

Len, this should be a rather safe and obvious one. Can you apply it, pls.

Without this one, one should get NULL pointer when cap.BQC is not set as device->brightness should not be allocated then.

Christian: This should fix up the wrong initial 0 entry for the current brightness you saw.

Patch is against Len's git test tree and compile tested only.

Thanks,

Thomas

------------

Current brightness level got not set correctly in video module, fix it.

---
 drivers/acpi/video.c |   14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/acpi/video.c +9 -5
Index: lenb/drivers/acpi/video.c
===================================================================
@@ -428,11 +428,15 @@ static int
 acpi_video_device_lcd_get_level_current(struct acpi_video_device *device,
 					unsigned long *level)
 {
-	if (device->cap._BQC)
-		return acpi_evaluate_integer(device->dev->handle, "_BQC", NULL,
-					     level);
-	*level = device->brightness->curr;
-	return AE_OK;
+	acpi_status status = AE_OK;
+
+	if (device->cap._BQC){
+		status = acpi_evaluate_integer(device->dev->handle, "_BQC",
+					       NULL, level);
+		if (ACPI_SUCCESS(status) && device->brightness)
+			device->brightness->curr = *level;
+	}
+	return status;
 }
 
 static int
#1 lore raw
Quoted 41 lines · Thomas Renninger

Len, this should be a rather safe and obvious one. Can you apply it, pls.

Without this one, one should get NULL pointer when cap.BQC is not set as device->brightness should not be allocated then.

Christian: This should fix up the wrong initial 0 entry for the current brightness you saw.

Patch is against Len's git test tree and compile tested only.

Thanks,

Thomas

------------

Current brightness level got not set correctly in video module, fix it.

---
 drivers/acpi/video.c |   14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

Index: lenb/drivers/acpi/video.c
===================================================================

drivers/acpi/video.c +2 -5
@@ -428,11 +428,15 @@ static int
 acpi_video_device_lcd_get_level_current(struct acpi_video_device *device,
 					unsigned long *level)
 {
-	if (device->cap._BQC)
-		return acpi_evaluate_integer(device->dev->handle, "_BQC", NULL,
-					     level);
-	*level = device->brightness->curr;
-	return AE_OK;
+	acpi_status status = AE_OK;
+

drivers/acpi/video.c static int · line 442

Quoted 10 lines
drivers/acpi/video.c +7 -0
+	if (device->cap._BQC){
+		status = acpi_evaluate_integer(device->dev->handle, "_BQC",
+					       NULL, level);
+		if (ACPI_SUCCESS(status) && device->brightness)
+			device->brightness->curr = *level;
+	}
+	return status;
 }
 
 static int

Looks fine here so far. Status is not 0 anymore on init and gets updated when the brightness level changes.

I've put the function manualy into the 2.6.23.1 video.c because the function was to different compared to the latest git.

Christian