From: Hans de Goede <hdegoede@redhat.com>
To: "Rafael J . Wysocki" <rafael@kernel.org>
Cc: Hans de Goede <hdegoede@redhat.com>,
"Owen T . Heisler" <writer@owenh.net>,
Kai-Heng Feng <kai.heng.feng@canonical.com>,
linux-acpi@vger.kernel.org, regressions@lists.linux.dev,
stable@vger.kernel.org
Subject: [PATCH 1/2] ACPI: PM: Add acpi_device_fix_up_power_children() function
Date: Sun, 12 Nov 2023 21:36:26 +0100 [thread overview]
Message-ID: <20231112203627.34059-2-hdegoede@redhat.com> (raw)
In-Reply-To: <20231112203627.34059-1-hdegoede@redhat.com>
In some cases it is necessary to fix-up the power-state of an ACPI
device's children without touching the ACPI device itself add
a new acpi_device_fix_up_power_children() function for this.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/acpi/device_pm.c | 13 +++++++++++++
include/acpi/acpi_bus.h | 1 +
2 files changed, 14 insertions(+)
diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c
index f007116a8427..3b4d048c4941 100644
--- a/drivers/acpi/device_pm.c
+++ b/drivers/acpi/device_pm.c
@@ -397,6 +397,19 @@ void acpi_device_fix_up_power_extended(struct acpi_device *adev)
}
EXPORT_SYMBOL_GPL(acpi_device_fix_up_power_extended);
+/**
+ * acpi_device_fix_up_power_children - Force a device's children into D0.
+ * @adev: Parent device object whose children's power state is to be fixed up.
+ *
+ * Call acpi_device_fix_up_power() for @adev's children so long as they
+ * are reported as present and enabled.
+ */
+void acpi_device_fix_up_power_children(struct acpi_device *adev)
+{
+ acpi_dev_for_each_child(adev, fix_up_power_if_applicable, NULL);
+}
+EXPORT_SYMBOL_GPL(acpi_device_fix_up_power_children);
+
int acpi_device_update_power(struct acpi_device *device, int *state_p)
{
int state;
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index 254685085c82..0b7eab0ef7d7 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -539,6 +539,7 @@ int acpi_device_set_power(struct acpi_device *device, int state);
int acpi_bus_init_power(struct acpi_device *device);
int acpi_device_fix_up_power(struct acpi_device *device);
void acpi_device_fix_up_power_extended(struct acpi_device *adev);
+void acpi_device_fix_up_power_children(struct acpi_device *adev);
int acpi_bus_update_power(acpi_handle handle, int *state_p);
int acpi_device_update_power(struct acpi_device *device, int *state_p);
bool acpi_bus_power_manageable(acpi_handle handle);
--
2.41.0
next prev parent reply other threads:[~2023-11-12 20:36 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-12 20:36 [PATCH 0/2] ACPI: video: Use acpi_device_fix_up_power_children() Hans de Goede
2023-11-12 20:36 ` Hans de Goede [this message]
2023-11-13 14:32 ` [PATCH 1/2] ACPI: PM: Add acpi_device_fix_up_power_children() function Greg KH
2023-11-12 20:36 ` [PATCH 2/2] ACPI: video: Use acpi_device_fix_up_power_children() Hans de Goede
2023-11-20 16:32 ` [PATCH 0/2] " Rafael J. Wysocki
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=20231112203627.34059-2-hdegoede@redhat.com \
--to=hdegoede@redhat.com \
--cc=kai.heng.feng@canonical.com \
--cc=linux-acpi@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=regressions@lists.linux.dev \
--cc=stable@vger.kernel.org \
--cc=writer@owenh.net \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox