Re: ACPI: ibm-acpi: fix initial status of backlight device

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Henrique de Moraes Holschuh
Date: Thursday, February 22, 2007 - 11:19 am

Here's the final version.  I will request a pull from Len Brown to get it
into acpi-test, from where it will eventually reach mainline at Len's
discretion.

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh

From: Henrique de Moraes Holschuh <hmh@hmh.eng.br>

ACPI: ibm-acpi: fix initial status of backlight device

The brightness class core does not update the initial status of the
device's brightness at register time.  Do it by ourselves.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Acked-by: Richard Purdie <rpurdie@rpsys.net>
---
 drivers/acpi/ibm_acpi.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/drivers/acpi/ibm_acpi.c b/drivers/acpi/ibm_acpi.c
index 4cc534e..7c1b418 100644
--- a/drivers/acpi/ibm_acpi.c
+++ b/drivers/acpi/ibm_acpi.c
@@ -1711,6 +1711,12 @@ static struct backlight_ops ibm_backlight_data = {
 
 static int brightness_init(void)
 {
+	int b;
+
+	b = brightness_get(NULL);
+	if (b < 0)
+		return b;
+
 	ibm_backlight_device = backlight_device_register("ibm", NULL, NULL,
 							 &ibm_backlight_data);
 	if (IS_ERR(ibm_backlight_device)) {
@@ -1718,7 +1724,9 @@ static int brightness_init(void)
 		return PTR_ERR(ibm_backlight_device);
 	}
 
-        ibm_backlight_device->props.max_brightness = 7;
+	ibm_backlight_device->props.max_brightness = 7;
+	ibm_backlight_device->props.brightness = b;
+	backlight_update_status(ibm_backlight_device);
 
 	return 0;
 }
-- 
1.4.4.4

-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
no backlight on radeon after recent kernel &quot;upgrade&quot;s, Yaroslav Halchenko, (Sun Feb 18, 9:46 pm)
Re: no backlight on radeon after recent kernel &quot;upgrade&quot;s, Henrique de Moraes H ..., (Wed Feb 21, 4:17 pm)
Re: no backlight on radeon after recent kernel &quot;upgrade&quot;s, Henrique de Moraes H ..., (Wed Feb 21, 5:51 pm)
Re: no backlight on radeon after recent kernel &quot;upgrade&quot;s, Henrique de Moraes H ..., (Wed Feb 21, 6:10 pm)
ACPI: ibm-acpi: fix initial status of backlight device, Henrique de Moraes H ..., (Wed Feb 21, 6:16 pm)
Re: no backlight on radeon after recent kernel &quot;upgrade&quot;s, Henrique de Moraes H ..., (Wed Feb 21, 7:13 pm)
Re: ACPI: ibm-acpi: fix initial status of backlight device, Richard Purdie, (Thu Feb 22, 3:03 am)
Re: no backlight on radeon after recent kernel &quot;upgrade&quot;s, Henrique de Moraes H ..., (Thu Feb 22, 7:38 am)
ACPI: ibm-acpi: fix initial status of backlight device, Henrique de Moraes H ..., (Thu Feb 22, 7:45 am)
Re: no backlight on radeon after recent kernel &quot;upgrade&quot;s, Henrique de Moraes H ..., (Thu Feb 22, 7:56 am)
Re: no backlight on radeon after recent kernel &quot;upgrade&quot;s, Henrique de Moraes H ..., (Thu Feb 22, 9:34 am)
Re: ACPI: ibm-acpi: fix initial status of backlight device, Henrique de Moraes H ..., (Thu Feb 22, 11:19 am)