From: Vaibhav Gupta <vaibhavgupta40@gmail.com>
To: Huang Rui <ray.huang@amd.com>, Guenter Roeck <linux@roeck-us.net>,
Bjorn Helgaas <bhelgaas@google.com>
Cc: Vaibhav Gupta <vaibhavgupta40@gmail.com>,
linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v1] hwmon: (fam15h_power) Use generic power management
Date: Tue, 16 Dec 2025 18:13:59 +0000 [thread overview]
Message-ID: <20251216181401.598273-1-vaibhavgupta40@gmail.com> (raw)
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
next reply other threads:[~2025-12-16 18:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-16 18:13 Vaibhav Gupta [this message]
2025-12-18 18:59 ` Guenter Roeck
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=20251216181401.598273-1-vaibhavgupta40@gmail.com \
--to=vaibhavgupta40@gmail.com \
--cc=bhelgaas@google.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=ray.huang@amd.com \
/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
all inboxes | Powered by JetHome®