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: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20190726172817.73253-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Andy Shevchenko 2019-07-26 20:28:17 +03:00 committed by Greg Kroah-Hartman
parent fdc2de8712
commit 72d819612a
1 changed files with 9 additions and 11 deletions

View File

@ -498,10 +498,9 @@ static void serial_pnp_remove(struct pnp_dev *dev)
serial8250_unregister_port(line - 1);
}
#ifdef CONFIG_PM
static int serial_pnp_suspend(struct pnp_dev *dev, pm_message_t state)
static int __maybe_unused serial_pnp_suspend(struct device *dev)
{
long line = (long)pnp_get_drvdata(dev);
long line = (long)dev_get_drvdata(dev);
if (!line)
return -ENODEV;
@ -509,26 +508,25 @@ static int serial_pnp_suspend(struct pnp_dev *dev, pm_message_t state)
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)
return -ENODEV;
serial8250_resume_port(line - 1);
return 0;
}
#else
#define serial_pnp_suspend NULL
#define serial_pnp_resume NULL
#endif /* CONFIG_PM */
static SIMPLE_DEV_PM_OPS(serial_pnp_pm_ops, serial_pnp_suspend, serial_pnp_resume);
static struct pnp_driver serial_pnp_driver = {
.name = "serial",
.probe = serial_pnp_probe,
.remove = serial_pnp_remove,
.suspend = serial_pnp_suspend,
.resume = serial_pnp_resume,
.driver = {
.pm = &serial_pnp_pm_ops,
},
.id_table = pnp_dev_table,
};