Commit f7f292fe authored by Paul Cercueil's avatar Paul Cercueil Committed by Lee Jones

mfd: stmpe: Remove #ifdef guards for PM related functions

Use the new EXPORT_GPL_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros
to handle the .suspend/.resume callbacks.

These macros allow the suspend and resume functions to be automatically
dropped by the compiler when CONFIG_SUSPEND is disabled, without having
to use #ifdef guards.

This has the advantage of always compiling these functions in,
independently of any Kconfig option. Thanks to that, bugs and other
regressions are subsequently easier to catch.
Signed-off-by: default avatarPaul Cercueil <paul@crapouillou.net>
Signed-off-by: default avatarLee Jones <lee@kernel.org>
parent 4d8a6ae2
...@@ -115,9 +115,7 @@ MODULE_DEVICE_TABLE(i2c, stmpe_i2c_id); ...@@ -115,9 +115,7 @@ MODULE_DEVICE_TABLE(i2c, stmpe_i2c_id);
static struct i2c_driver stmpe_i2c_driver = { static struct i2c_driver stmpe_i2c_driver = {
.driver = { .driver = {
.name = "stmpe-i2c", .name = "stmpe-i2c",
#ifdef CONFIG_PM .pm = pm_sleep_ptr(&stmpe_dev_pm_ops),
.pm = &stmpe_dev_pm_ops,
#endif
.of_match_table = stmpe_of_match, .of_match_table = stmpe_of_match,
}, },
.probe_new = stmpe_i2c_probe, .probe_new = stmpe_i2c_probe,
......
...@@ -135,9 +135,7 @@ static struct spi_driver stmpe_spi_driver = { ...@@ -135,9 +135,7 @@ static struct spi_driver stmpe_spi_driver = {
.driver = { .driver = {
.name = "stmpe-spi", .name = "stmpe-spi",
.of_match_table = of_match_ptr(stmpe_spi_of_match), .of_match_table = of_match_ptr(stmpe_spi_of_match),
#ifdef CONFIG_PM .pm = pm_sleep_ptr(&stmpe_dev_pm_ops),
.pm = &stmpe_dev_pm_ops,
#endif
}, },
.probe = stmpe_spi_probe, .probe = stmpe_spi_probe,
.remove = stmpe_spi_remove, .remove = stmpe_spi_remove,
......
...@@ -1495,7 +1495,6 @@ void stmpe_remove(struct stmpe *stmpe) ...@@ -1495,7 +1495,6 @@ void stmpe_remove(struct stmpe *stmpe)
mfd_remove_devices(stmpe->dev); mfd_remove_devices(stmpe->dev);
} }
#ifdef CONFIG_PM
static int stmpe_suspend(struct device *dev) static int stmpe_suspend(struct device *dev)
{ {
struct stmpe *stmpe = dev_get_drvdata(dev); struct stmpe *stmpe = dev_get_drvdata(dev);
...@@ -1516,8 +1515,5 @@ static int stmpe_resume(struct device *dev) ...@@ -1516,8 +1515,5 @@ static int stmpe_resume(struct device *dev)
return 0; return 0;
} }
const struct dev_pm_ops stmpe_dev_pm_ops = { EXPORT_GPL_SIMPLE_DEV_PM_OPS(stmpe_dev_pm_ops,
.suspend = stmpe_suspend, stmpe_suspend, stmpe_resume);
.resume = stmpe_resume,
};
#endif
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