* [PATCH] ACPI / PM: Traverse video_device_list for backlight restoration
@ 2010-08-03 10:05 Matthias Hopf
2010-08-03 10:11 ` Matthias Hopf
0 siblings, 1 reply; 4+ messages in thread
From: Matthias Hopf @ 2010-08-03 10:05 UTC (permalink / raw)
To: Zhang Rui, Len Brown, Matthew Garrett, Andrew Morton,
Julia Lawall, oneukum
Cc: linux-acpi, linux-pm, linux-kernel
[-- Attachment #1: 0001-ACPI-PM-Traverse-video_device_list-for-backlight.patch --]
[-- Type: text/x-patch, Size: 1306 bytes --]
.bind_info in active_list[] is NULL by construction - and used to determine
the acpi_video_device pointer during backlight restoration during resume.
Using the list instead fixes backlight restoration for systems where the BIOS
doesn't do this by itself already.
Signed-off-by: Matthias Hopf <mhopf@suse.de>
---
drivers/acpi/video.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index 9865d46..887ac2b 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -2346,7 +2346,6 @@ static int acpi_video_resume(struct notifier_block *nb,
{
struct acpi_video_bus *video;
struct acpi_video_device *video_device;
- int i;
switch (val) {
case PM_HIBERNATION_PREPARE:
@@ -2359,11 +2358,12 @@ static int acpi_video_resume(struct notifier_block *nb,
dev_info(&video->device->dev, "Restoring backlight state\n");
- for (i = 0; i < video->attached_count; i++) {
- video_device = video->attached_array[i].bind_info;
+ mutex_lock(&video->device_list_lock);
+ list_for_each_entry(video_device, &video->video_device_list, entry) {
if (video_device && video_device->backlight)
acpi_video_set_brightness(video_device->backlight);
}
+ mutex_unlock(&video->device_list_lock);
return NOTIFY_OK;
}
--
1.6.0.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] ACPI / PM: Traverse video_device_list for backlight restoration
2010-08-03 10:05 [PATCH] ACPI / PM: Traverse video_device_list for backlight restoration Matthias Hopf
@ 2010-08-03 10:11 ` Matthias Hopf
2010-08-04 1:27 ` Zhang Rui
0 siblings, 1 reply; 4+ messages in thread
From: Matthias Hopf @ 2010-08-03 10:11 UTC (permalink / raw)
To: Zhang Rui, Len Brown, Matthew Garrett, Andrew Morton,
Julia Lawall, Oliver
Cc: linux-acpi, linux-pm, linux-kernel
A bit of background about this patch:
acpi_video_bus_get_devices() explicitly calls acpi_video_device_enumerate()
before acpi_video_bus_get_one_device(), which does acpi_video_device_bind().
In _enumerate(), active_list[] is created, with .bind_info explicitly set to
NULL, while the related .bind_info entry in video_device_list is set to the
acpi_video_device ptr in _bind().
The .bind_info is later used in acpi_video_resume() to re-set the backlight
- but it's only evaluated on the active_list[], on which all .bind_info are
NULL by construction. This results in backlight not being restored, if the
BIOS doesn't do this by itself already.
The patch resolves this by replacing the active_list[] traversal by a
video_device_list traversal, but due to the nature of the issue I'm unsure
whether the original issue isn't of more principal quality. I don't understand
why the list is (partially) transformed into an array in the first place,
especially as both the array *and* the list are used in the code...
Thanks
Matthias
--
Matthias Hopf <mhopf@suse.de> __ __ __
Maxfeldstr. 5 / 90409 Nuernberg (_ | | (_ |__ mat@mshopf.de
Phone +49-911-74053-715 __) |_| __) |__ R & D www.mshopf.de
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ACPI / PM: Traverse video_device_list for backlight restoration
2010-08-03 10:11 ` Matthias Hopf
@ 2010-08-04 1:27 ` Zhang Rui
2010-08-04 11:00 ` Matthias Hopf
0 siblings, 1 reply; 4+ messages in thread
From: Zhang Rui @ 2010-08-04 1:27 UTC (permalink / raw)
To: Matthias Hopf
Cc: Len Brown, Matthew Garrett, Andrew Morton, Julia Lawall,
Oliver Neukum, linux-acpi@vger.kernel.org,
linux-pm@lists.linux-foundation.org, linux-kernel@vger.kernel.org
On Tue, 2010-08-03 at 18:11 +0800, Matthias Hopf wrote:
> A bit of background about this patch:
>
>
> acpi_video_bus_get_devices() explicitly calls acpi_video_device_enumerate()
> before acpi_video_bus_get_one_device(), which does acpi_video_device_bind().
>
> In _enumerate(), active_list[] is created, with .bind_info explicitly set to
> NULL, while the related .bind_info entry in video_device_list is set to the
> acpi_video_device ptr in _bind().
>
> The .bind_info is later used in acpi_video_resume() to re-set the backlight
> - but it's only evaluated on the active_list[], on which all .bind_info are
> NULL by construction.
why? .bind_info in active_list is initialized in acpi_video_device_bind.
> This results in backlight not being restored, if the
> BIOS doesn't do this by itself already.
>
>
> The patch resolves this by replacing the active_list[] traversal by a
> video_device_list traversal,
> but due to the nature of the issue I'm unsure
> whether the original issue isn't of more principal quality.
> I don't understand
> why the list is (partially) transformed into an array in the first place,
> especially as both the array *and* the list are used in the code...
>
no, the active_list is an array in fact, which equals
acpi_video_bus->attached_array. Maybe we need to change it to a more
proper name.
I'm still wondering why the patch works for you.
could you please attach the acpidump output of this laptop?
please rebuild your kernel with CONFIG_ACPI_DEBUG=y, and reboot with
kernel parameter "acpi.debug_layer=0x10 acpi.debug_level=0x400".
and attach the dmesg output after resume, both w/ and w/o the patch you
attached.
thanks,
rui
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ACPI / PM: Traverse video_device_list for backlight restoration
2010-08-04 1:27 ` Zhang Rui
@ 2010-08-04 11:00 ` Matthias Hopf
0 siblings, 0 replies; 4+ messages in thread
From: Matthias Hopf @ 2010-08-04 11:00 UTC (permalink / raw)
To: Zhang Rui
Cc: Len Brown, Matthew Garrett, Andrew Morton, Julia Lawall,
Oliver Neukum, linux-acpi@vger.kernel.org,
linux-pm@lists.linux-foundation.org, linux-kernel@vger.kernel.org
On Aug 04, 10 09:27:29 +0800, Zhang Rui wrote:
> On Tue, 2010-08-03 at 18:11 +0800, Matthias Hopf wrote:
> > The .bind_info is later used in acpi_video_resume() to re-set the backlight
> > - but it's only evaluated on the active_list[], on which all .bind_info are
> > NULL by construction.
> why? .bind_info in active_list is initialized in acpi_video_device_bind.
Hm. Right. acpi_video_bus_get_one_device() is called after _enumerate().
Dunno why I didn't read this correctly.
> > I don't understand
> > why the list is (partially) transformed into an array in the first place,
> > especially as both the array *and* the list are used in the code...
> >
> no, the active_list is an array in fact, which equals
> acpi_video_bus->attached_array. Maybe we need to change it to a more
> proper name.
:-)
> I'm still wondering why the patch works for you.
Same to me.
> could you please attach the acpidump output of this laptop?
Will do.
> please rebuild your kernel with CONFIG_ACPI_DEBUG=y, and reboot with
> kernel parameter "acpi.debug_layer=0x10 acpi.debug_level=0x400".
> and attach the dmesg output after resume, both w/ and w/o the patch you
> attached.
The most intriguing thing here is that the system starts writing to
/var/log/messages continuously, thus dmesg output is sort-of worthless.
This might be a reasonable side effect, it might be an indication of the
original issue.
I'll try to compile something for you.
Thanks
Matthias
--
Matthias Hopf <mhopf@suse.de> __ __ __
Maxfeldstr. 5 / 90409 Nuernberg (_ | | (_ |__ mat@mshopf.de
Phone +49-911-74053-715 __) |_| __) |__ R & D www.mshopf.de
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-08-04 11:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-03 10:05 [PATCH] ACPI / PM: Traverse video_device_list for backlight restoration Matthias Hopf
2010-08-03 10:11 ` Matthias Hopf
2010-08-04 1:27 ` Zhang Rui
2010-08-04 11:00 ` Matthias Hopf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).