public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Current brightness level got not set correctly in video module, fix it.
@ 2007-10-16 15:41 Thomas Renninger
  2007-10-16 17:48 ` Christian Birchinger
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Renninger @ 2007-10-16 15:41 UTC (permalink / raw)
  To: linux-acpi; +Cc: Christian Birchinger, Len Brown

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.


Signed-off-by: Thomas Renninger <trenn@suse.de>
---
 drivers/acpi/video.c |   14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

Index: lenb/drivers/acpi/video.c
===================================================================
--- lenb.orig/drivers/acpi/video.c
+++ 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



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-10-16 18:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-16 15:41 [PATCH] Current brightness level got not set correctly in video module, fix it Thomas Renninger
2007-10-16 17:48 ` Christian Birchinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox