Commit 72d81961 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Greg Kroah-Hartman

serial: 8250_pnp: Move to struct dev_pm_ops

The established way to provide PM callbacks is through struct dev_pm_ops
which is more generic.

Convert driver to use it instead of legacy approach.
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20190726172817.73253-1-andriy.shevchenko@linux.intel.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent fdc2de87
...@@ -498,10 +498,9 @@ static void serial_pnp_remove(struct pnp_dev *dev) ...@@ -498,10 +498,9 @@ static void serial_pnp_remove(struct pnp_dev *dev)
serial8250_unregister_port(line - 1); serial8250_unregister_port(line - 1);
} }
#ifdef CONFIG_PM static int __maybe_unused serial_pnp_suspend(struct device *dev)
static int serial_pnp_suspend(struct pnp_dev *dev, pm_message_t state)
{ {
long line = (long)pnp_get_drvdata(dev); long line = (long)dev_get_drvdata(dev);
if (!line) if (!line)
return -ENODEV; return -ENODEV;
...@@ -509,26 +508,25 @@ static int serial_pnp_suspend(struct pnp_dev *dev, pm_message_t state) ...@@ -509,26 +508,25 @@ static int serial_pnp_suspend(struct pnp_dev *dev, pm_message_t state)
return 0; return 0;
} }
static int serial_pnp_resume(struct pnp_dev *dev) static int __maybe_unused serial_pnp_resume(struct device *dev)
{ {
long line = (long)pnp_get_drvdata(dev); long line = (long)dev_get_drvdata(dev);
if (!line) if (!line)
return -ENODEV; return -ENODEV;
serial8250_resume_port(line - 1); serial8250_resume_port(line - 1);
return 0; return 0;
} }
#else
#define serial_pnp_suspend NULL static SIMPLE_DEV_PM_OPS(serial_pnp_pm_ops, serial_pnp_suspend, serial_pnp_resume);
#define serial_pnp_resume NULL
#endif /* CONFIG_PM */
static struct pnp_driver serial_pnp_driver = { static struct pnp_driver serial_pnp_driver = {
.name = "serial", .name = "serial",
.probe = serial_pnp_probe, .probe = serial_pnp_probe,
.remove = serial_pnp_remove, .remove = serial_pnp_remove,
.suspend = serial_pnp_suspend, .driver = {
.resume = serial_pnp_resume, .pm = &serial_pnp_pm_ops,
},
.id_table = pnp_dev_table, .id_table = pnp_dev_table,
}; };
......
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