All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Matthew Garrett <mjg59@srcf.ucam.org>
Cc: ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
	Linux-pm mailing list <linux-pm@lists.linux-foundation.org>
Subject: [RFC/RFT][PATCH 3/3] ACPI / PM: Fix initial reference counting of power resources
Date: Thu, 28 Oct 2010 15:11:07 +0200	[thread overview]
Message-ID: <201010281511.07358.rjw__90.7355723485992$1288271738$gmane$org@sisk.pl> (raw)
In-Reply-To: <201010281507.34994.rjw@sisk.pl>

From: Rafael J. Wysocki <rjw@sisk.pl>

ACPI power resources are only reference counted during device power
state changes.  The initial device power states have no effect on
the reference counting of power resources.  This leads to the problem
that some power resources may be turned off too early when devices
are powered off during system suspend or via runtime PM.  Moreover,
the state of power resource reference counters after powering a
device on may be different than it had been before the device was
powered off.

To fix this issue, update power resource reference counting directly
during initialization by calling acpi_power_transition() for every
device using power resources.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
 drivers/acpi/scan.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Index: linux-2.6/drivers/acpi/scan.c
===================================================================
--- linux-2.6.orig/drivers/acpi/scan.c
+++ linux-2.6/drivers/acpi/scan.c
@@ -880,8 +880,10 @@ static int acpi_bus_get_power_flags(stru
 
 	/* TBD: System wake support and resource requirements. */
 
-	device->power.state = ACPI_STATE_UNKNOWN;
-	acpi_bus_get_power(device->handle, &(device->power.state));
+	acpi_bus_get_power(device->handle, &device->power.state);
+	/* Update power resources reference counting. */
+	if (device->power.flags.power_resources)
+		acpi_power_transition(device, device->power.state);
 
 	return 0;
 }

      parent reply	other threads:[~2010-10-28 13:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-28 13:07 [RFC/RFT][PATCH 0/3] ACPI: Fix handling of power resources during initialization Rafael J. Wysocki
2010-10-28 13:09 ` [RFC/RFT][PATCH 1/3] ACPI / PM: Register acpi_power_driver early Rafael J. Wysocki
2010-10-28 13:09 ` Rafael J. Wysocki
2010-10-28 13:10 ` [RFC/RFT][PATCH 2/3] ACPI / PM: Register power resource devices as soon as they are needed Rafael J. Wysocki
2010-10-28 13:10 ` Rafael J. Wysocki
2010-10-28 13:11 ` [RFC/RFT][PATCH 3/3] ACPI / PM: Fix initial reference counting of power resources Rafael J. Wysocki
2010-10-28 13:11 ` Rafael J. Wysocki [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='201010281511.07358.rjw__90.7355723485992$1288271738$gmane$org@sisk.pl' \
    --to=rjw@sisk.pl \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=mjg59@srcf.ucam.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.