Linux MM tree latest commits
 help / color / mirror / Atom feed
* + acpi-pm-traverse-video_device_list-for-backlight-restoration.patch added to -mm tree
@ 2010-08-04 19:57 akpm
  0 siblings, 0 replies; only message in thread
From: akpm @ 2010-08-04 19:57 UTC (permalink / raw)
  To: mm-commits; +Cc: mhopf, julia, lenb, mjg, oneukum, rui.zhang


The patch titled
     acpi/pm: traverse video_device_list for backlight restoration
has been added to the -mm tree.  Its filename is
     acpi-pm-traverse-video_device_list-for-backlight-restoration.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find
out what to do about this

The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/

------------------------------------------------------
Subject: acpi/pm: traverse video_device_list for backlight restoration
From: Matthias Hopf <mhopf@suse.de>

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...


.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>
Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Len Brown <lenb@kernel.org>
Cc: Matthew Garrett <mjg@redhat.com>
Cc: Julia Lawall <julia@diku.dk>
Cc: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 drivers/acpi/video.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff -puN drivers/acpi/video.c~acpi-pm-traverse-video_device_list-for-backlight-restoration drivers/acpi/video.c
--- a/drivers/acpi/video.c~acpi-pm-traverse-video_device_list-for-backlight-restoration
+++ a/drivers/acpi/video.c
@@ -2346,7 +2346,6 @@ static int acpi_video_resume(struct noti
 {
 	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 noti
 
 	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;
 }
_

Patches currently in -mm which might be from mhopf@suse.de are

acpi-pm-traverse-video_device_list-for-backlight-restoration.patch


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-08-04 19:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-04 19:57 + acpi-pm-traverse-video_device_list-for-backlight-restoration.patch added to -mm tree akpm

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