With the support of generic PM callbacks, drivers no longer need to use legacy .suspend() and .resume() in which they had to maintain PCI states changes and device's power state themselves. All required operations are done by PCI core. After converting it into generic model, suspend() became an empty function. Hence, it is defined as NULL. Compile-tested only. Signed-off-by: Vaibhav Gupta <vaibhavgupta40@xxxxxxxxx> --- drivers/ide/delkin_cb.c | 30 ++++++------------------------ 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/drivers/ide/delkin_cb.c b/drivers/ide/delkin_cb.c index 300daabaa575..a8a1af6aa1c1 100644 --- a/drivers/ide/delkin_cb.c +++ b/drivers/ide/delkin_cb.c @@ -123,28 +123,13 @@ delkin_cb_remove (struct pci_dev *dev) pci_disable_device(dev); } -#ifdef CONFIG_PM -static int delkin_cb_suspend(struct pci_dev *dev, pm_message_t state) -{ - pci_save_state(dev); - pci_disable_device(dev); - pci_set_power_state(dev, pci_choose_state(dev, state)); - - return 0; -} +#define delkin_cb_suspend NULL -static int delkin_cb_resume(struct pci_dev *dev) +static int __maybe_unused delkin_cb_resume(struct device *dev_d) { + struct pci_dev *dev = to_pci_dev(dev_d); struct ide_host *host = pci_get_drvdata(dev); - int rc; - pci_set_power_state(dev, PCI_D0); - - rc = pci_enable_device(dev); - if (rc) - return rc; - - pci_restore_state(dev); pci_set_master(dev); if (host->init_chipset) @@ -152,10 +137,6 @@ static int delkin_cb_resume(struct pci_dev *dev) return 0; } -#else -#define delkin_cb_suspend NULL -#define delkin_cb_resume NULL -#endif static struct pci_device_id delkin_cb_pci_tbl[] = { { 0x1145, 0xf021, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, @@ -164,13 +145,14 @@ static struct pci_device_id delkin_cb_pci_tbl[] = { }; MODULE_DEVICE_TABLE(pci, delkin_cb_pci_tbl); +static SIMPLE_DEV_PM_OPS(delkin_cb_pm_ops, delkin_cb_suspend, delkin_cb_resume); + static struct pci_driver delkin_cb_pci_driver = { .name = "Delkin-ASKA-Workbit Cardbus IDE", .id_table = delkin_cb_pci_tbl, .probe = delkin_cb_probe, .remove = delkin_cb_remove, - .suspend = delkin_cb_suspend, - .resume = delkin_cb_resume, + .driver.pm = &delkin_cb_pm_ops, }; module_pci_driver(delkin_cb_pci_driver); -- 2.27.0