Commit 61702c3e authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Greg Kroah-Hartman

serial: 8250_pci: convert to dev_pm_ops

Convert the legacy system PM callbacks to new ones. Meanwhile, remove the
redudant calls to the PCI for changing a power state since it's done by bus
code.
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 213dce3c
...@@ -4020,41 +4020,41 @@ static void pciserial_remove_one(struct pci_dev *dev) ...@@ -4020,41 +4020,41 @@ static void pciserial_remove_one(struct pci_dev *dev)
pci_disable_device(dev); pci_disable_device(dev);
} }
#ifdef CONFIG_PM #ifdef CONFIG_PM_SLEEP
static int pciserial_suspend_one(struct pci_dev *dev, pm_message_t state) static int pciserial_suspend_one(struct device *dev)
{ {
struct serial_private *priv = pci_get_drvdata(dev); struct pci_dev *pdev = to_pci_dev(dev);
struct serial_private *priv = pci_get_drvdata(pdev);
if (priv) if (priv)
pciserial_suspend_ports(priv); pciserial_suspend_ports(priv);
pci_save_state(dev);
pci_set_power_state(dev, pci_choose_state(dev, state));
return 0; return 0;
} }
static int pciserial_resume_one(struct pci_dev *dev) static int pciserial_resume_one(struct device *dev)
{ {
struct pci_dev *pdev = to_pci_dev(dev);
struct serial_private *priv = pci_get_drvdata(pdev);
int err; int err;
struct serial_private *priv = pci_get_drvdata(dev);
pci_set_power_state(dev, PCI_D0);
pci_restore_state(dev);
if (priv) { if (priv) {
/* /*
* The device may have been disabled. Re-enable it. * The device may have been disabled. Re-enable it.
*/ */
err = pci_enable_device(dev); err = pci_enable_device(pdev);
/* FIXME: We cannot simply error out here */ /* FIXME: We cannot simply error out here */
if (err) if (err)
dev_err(&dev->dev, "Unable to re-enable ports, trying to continue.\n"); dev_err(dev, "Unable to re-enable ports, trying to continue.\n");
pciserial_resume_ports(priv); pciserial_resume_ports(priv);
} }
return 0; return 0;
} }
#endif #endif
static SIMPLE_DEV_PM_OPS(pciserial_pm_ops, pciserial_suspend_one,
pciserial_resume_one);
static struct pci_device_id serial_pci_tbl[] = { static struct pci_device_id serial_pci_tbl[] = {
/* Advantech use PCI_DEVICE_ID_ADVANTECH_PCI3620 (0x3620) as 'PCI_SUBVENDOR_ID' */ /* Advantech use PCI_DEVICE_ID_ADVANTECH_PCI3620 (0x3620) as 'PCI_SUBVENDOR_ID' */
{ PCI_VENDOR_ID_ADVANTECH, PCI_DEVICE_ID_ADVANTECH_PCI3620, { PCI_VENDOR_ID_ADVANTECH, PCI_DEVICE_ID_ADVANTECH_PCI3620,
...@@ -5528,10 +5528,9 @@ static struct pci_driver serial_pci_driver = { ...@@ -5528,10 +5528,9 @@ static struct pci_driver serial_pci_driver = {
.name = "serial", .name = "serial",
.probe = pciserial_init_one, .probe = pciserial_init_one,
.remove = pciserial_remove_one, .remove = pciserial_remove_one,
#ifdef CONFIG_PM .driver = {
.suspend = pciserial_suspend_one, .pm = &pciserial_pm_ops,
.resume = pciserial_resume_one, },
#endif
.id_table = serial_pci_tbl, .id_table = serial_pci_tbl,
.err_handler = &serial8250_err_handler, .err_handler = &serial8250_err_handler,
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment