return 0;
}
-#ifdef CONFIG_PM
-
-static int jmb38x_ms_suspend(struct pci_dev *dev, pm_message_t state)
+static int __maybe_unused jmb38x_ms_suspend(struct device *dev)
{
- struct jmb38x_ms *jm = pci_get_drvdata(dev);
+ struct jmb38x_ms *jm = dev_get_drvdata(dev);
+
int cnt;
for (cnt = 0; cnt < jm->host_cnt; ++cnt) {
memstick_suspend_host(jm->hosts[cnt]);
}
- pci_save_state(dev);
- pci_enable_wake(dev, pci_choose_state(dev, state), 0);
- pci_disable_device(dev);
- pci_set_power_state(dev, pci_choose_state(dev, state));
+ device_wakeup_disable(dev);
+
return 0;
}
-static int jmb38x_ms_resume(struct pci_dev *dev)
+static int __maybe_unused jmb38x_ms_resume(struct device *dev)
{
- struct jmb38x_ms *jm = pci_get_drvdata(dev);
+ struct jmb38x_ms *jm = dev_get_drvdata(dev);
int rc;
- pci_set_power_state(dev, PCI_D0);
- pci_restore_state(dev);
- rc = pci_enable_device(dev);
- if (rc)
- return rc;
- pci_set_master(dev);
-
- jmb38x_ms_pmos(dev, 1);
+ jmb38x_ms_pmos(to_pci_dev(dev), 1);
for (rc = 0; rc < jm->host_cnt; ++rc) {
if (!jm->hosts[rc])
return 0;
}
-#else
-
-#define jmb38x_ms_suspend NULL
-#define jmb38x_ms_resume NULL
-
-#endif /* CONFIG_PM */
-
static int jmb38x_ms_count_slots(struct pci_dev *pdev)
{
int cnt, rc = 0;
{ }
};
+static SIMPLE_DEV_PM_OPS(jmb38x_ms_pm_ops, jmb38x_ms_suspend, jmb38x_ms_resume);
+
static struct pci_driver jmb38x_ms_driver = {
.name = DRIVER_NAME,
.id_table = jmb38x_ms_id_tbl,
.probe = jmb38x_ms_probe,
.remove = jmb38x_ms_remove,
- .suspend = jmb38x_ms_suspend,
- .resume = jmb38x_ms_resume
+ .driver.pm = &jmb38x_ms_pm_ops,
};
module_pci_driver(jmb38x_ms_driver);