[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200722083335.50068-3-vaibhavgupta40@gmail.com>
Date: Wed, 22 Jul 2020 14:03:34 +0530
From: Vaibhav Gupta <vaibhavgupta40@...il.com>
To: Bjorn Helgaas <helgaas@...nel.org>,
Bjorn Helgaas <bhelgaas@...gle.com>,
Bjorn Helgaas <bjorn@...gaas.com>,
Vaibhav Gupta <vaibhav.varodek@...il.com>,
Jens Axboe <axboe@...nel.dk>,
Joshua Morris <josh.h.morris@...ibm.com>,
Philip Kelleher <pjk1939@...ux.ibm.com>,
Damien Le Moal <Damien.LeMoal@....com>
Cc: Vaibhav Gupta <vaibhavgupta40@...il.com>,
linux-block@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-kernel-mentees@...ts.linuxfoundation.org,
Shuah Khan <skhan@...uxfoundation.org>
Subject: [PATCH v3 2/3] rsxx: use generic power management
Drivers using legacy power management .suspen()/.resume() callbacks
have to manage PCI states and device's PM states themselves. They also
need to take care of standard configuration registers.
Switch to generic power management framework using a single
"struct dev_pm_ops" variable to take the unnecessary load from the driver.
This also avoids the need for the driver to directly call most of the PCI
helper functions and device power state control functions, as through
the generic framework PCI Core takes care of the necessary operations,
and drivers are required to do only device-specific jobs.
Signed-off-by: Vaibhav Gupta <vaibhavgupta40@...il.com>
---
drivers/block/rsxx/core.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/block/rsxx/core.c b/drivers/block/rsxx/core.c
index 10f6368117d8..866153fd380a 100644
--- a/drivers/block/rsxx/core.c
+++ b/drivers/block/rsxx/core.c
@@ -1030,12 +1030,15 @@ static void rsxx_pci_remove(struct pci_dev *dev)
kfree(card);
}
-static int rsxx_pci_suspend(struct pci_dev *dev, pm_message_t state)
+static int __maybe_unused rsxx_pci_suspend(
+ __attribute__((unused)) struct device *dev)
{
/* We don't support suspend at this time. */
return -ENOSYS;
}
+#define rsxx_pci_resume NULL
+
static void rsxx_pci_shutdown(struct pci_dev *dev)
{
struct rsxx_cardinfo *card = pci_get_drvdata(dev);
@@ -1071,12 +1074,14 @@ static const struct pci_device_id rsxx_pci_ids[] = {
MODULE_DEVICE_TABLE(pci, rsxx_pci_ids);
+static SIMPLE_DEV_PM_OPS(rsxx_pci_pm_ops, rsxx_pci_suspend, rsxx_pci_resume);
+
static struct pci_driver rsxx_pci_driver = {
.name = DRIVER_NAME,
.id_table = rsxx_pci_ids,
.probe = rsxx_pci_probe,
.remove = rsxx_pci_remove,
- .suspend = rsxx_pci_suspend,
+ .driver.pm = &rsxx_pci_pm_ops,
.shutdown = rsxx_pci_shutdown,
.err_handler = &rsxx_err_handler,
};
--
2.27.0
Powered by blists - more mailing lists