Re: [PATCH 2/8] ACPI: PM: Use the new device_to_pm() helper to access struct dev_pm_ops

From
Rafael J. Wysocki <rafael@kernel.org>
Date
2020-05-26 10:36:11
Also in
linux-acpi, linux-pci, linux-pm, linux-s390, linux-scsi, linux-usb
Reply to
Pavel Machek, 2020-05-26
On Tue, May 26, 2020 at 11:45 AM Pavel Machek [off-list ref] wrote:
On Tue 2020-05-26 10:37:36, Rafael J. Wysocki wrote:
quoted
On Mon, May 25, 2020 at 8:26 PM Krzysztof Wilczyński [off-list ref] wrote:
quoted
Use the new device_to_pm() helper to access Power Management callbacs
(struct dev_pm_ops) for a particular device (struct device_driver).

No functional change intended.

Signed-off-by: Krzysztof Wilczyński <redacted>
---
 drivers/acpi/device_pm.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c
index 5832bc10aca8..b98a32c48fbe 100644
--- a/drivers/acpi/device_pm.c
+++ b/drivers/acpi/device_pm.c
@@ -1022,9 +1022,10 @@ static bool acpi_dev_needs_resume(struct device *dev, struct acpi_device *adev)
 int acpi_subsys_prepare(struct device *dev)
 {
        struct acpi_device *adev = ACPI_COMPANION(dev);
+       const struct dev_pm_ops *pm = driver_to_pm(dev->driver);
I don't really see a reason for this change.

What's wrong with the check below?
Duplicated code. Yes, compiler can sort it out, but... new version
looks better to me.
So the new code would not be duplicated?

Look at the other patches in the series then. :-)
Thread (26 messages) 26 messages, 7 authors, last reply 2020-05-26
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help