mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v1] hwmon: (fam15h_power) Use generic power management
@ 2025-12-16 18:13 Vaibhav Gupta
  2025-12-18 18:59 ` Guenter Roeck
  0 siblings, 1 reply; 2+ messages in thread
From: Vaibhav Gupta @ 2025-12-16 18:13 UTC (permalink / raw)
  To: Huang Rui, Guenter Roeck, Bjorn Helgaas
  Cc: Vaibhav Gupta, linux-hwmon, linux-kernel

Switch to the generic PCI power management framework and remove legacy
.resume() callback. With the generic framework, the
standard PCI related work like:
        - pci_save/restore_state()
        - pci_enable/disable_device()
        - pci_set_power_state()
is handled by the PCI core and this driver should implement only
device specific operations in its respective callback function.

Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com>
---
 drivers/hwmon/fam15h_power.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/hwmon/fam15h_power.c b/drivers/hwmon/fam15h_power.c
index 8ecebea53651..efcbea2d070e 100644
--- a/drivers/hwmon/fam15h_power.c
+++ b/drivers/hwmon/fam15h_power.c
@@ -372,15 +372,14 @@ static void tweak_runavg_range(struct pci_dev *pdev)
 		REG_TDP_RUNNING_AVERAGE, val);
 }
 
-#ifdef CONFIG_PM
-static int fam15h_power_resume(struct pci_dev *pdev)
+static int fam15h_power_resume(struct device *dev)
 {
+	struct pci_dev *pdev = to_pci_dev(dev);
 	tweak_runavg_range(pdev);
 	return 0;
 }
-#else
-#define fam15h_power_resume NULL
-#endif
+
+static DEFINE_SIMPLE_DEV_PM_OPS(fam15h_power_ops, NULL, fam15h_power_resume);
 
 static int fam15h_power_init_data(struct pci_dev *f4,
 				  struct fam15h_power_data *data)
@@ -493,7 +492,7 @@ static struct pci_driver fam15h_power_driver = {
 	.name = "fam15h_power",
 	.id_table = fam15h_power_id_table,
 	.probe = fam15h_power_probe,
-	.resume = fam15h_power_resume,
+	.driver.pm = &fam15h_power_ops,
 };
 
 module_pci_driver(fam15h_power_driver);
-- 
2.51.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v1] hwmon: (fam15h_power) Use generic power management
  2025-12-16 18:13 [PATCH v1] hwmon: (fam15h_power) Use generic power management Vaibhav Gupta
@ 2025-12-18 18:59 ` Guenter Roeck
  0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2025-12-18 18:59 UTC (permalink / raw)
  To: Vaibhav Gupta; +Cc: Huang Rui, Bjorn Helgaas, linux-hwmon, linux-kernel

On Tue, Dec 16, 2025 at 06:13:59PM +0000, Vaibhav Gupta wrote:
> Switch to the generic PCI power management framework and remove legacy
> .resume() callback. With the generic framework, the
> standard PCI related work like:
>         - pci_save/restore_state()
>         - pci_enable/disable_device()
>         - pci_set_power_state()
> is handled by the PCI core and this driver should implement only
> device specific operations in its respective callback function.
> 
> Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com>

Applied.

Thanks,
Guenter

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-12-18 18:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-16 18:13 [PATCH v1] hwmon: (fam15h_power) Use generic power management Vaibhav Gupta
2025-12-18 18:59 ` Guenter Roeck

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

all inboxes | Powered by JetHome®