summaryrefslogtreecommitdiff
path: root/drivers/mfd/tc3589x.c
diff options
context:
space:
mode:
authorPaul Cercueil <paul@crapouillou.net>2022-10-23 10:48:50 +0100
committerLee Jones <lee@kernel.org>2022-12-07 13:28:13 +0000
commit02313a90095fb919d9e5e166458f73a5f7bf915c (patch)
treeb2f20a2e062828a1dd5ceac5343e8a78a29240ac /drivers/mfd/tc3589x.c
parentf7f292fe819b6c754836923e126ec27c29be2d07 (diff)
downloadlwn-02313a90095fb919d9e5e166458f73a5f7bf915c.tar.gz
lwn-02313a90095fb919d9e5e166458f73a5f7bf915c.zip
mfd: tc3589x: Remove #ifdef guards for PM related functions
Use the new DEFINE_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: Paul Cercueil <paul@crapouillou.net> Signed-off-by: Lee Jones <lee@kernel.org>
Diffstat (limited to 'drivers/mfd/tc3589x.c')
-rw-r--r--drivers/mfd/tc3589x.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/mfd/tc3589x.c b/drivers/mfd/tc3589x.c
index b0f4fff5872d..1f6e0d682cd9 100644
--- a/drivers/mfd/tc3589x.c
+++ b/drivers/mfd/tc3589x.c
@@ -436,7 +436,6 @@ static void tc3589x_remove(struct i2c_client *client)
mfd_remove_devices(tc3589x->dev);
}
-#ifdef CONFIG_PM_SLEEP
static int tc3589x_suspend(struct device *dev)
{
struct tc3589x *tc3589x = dev_get_drvdata(dev);
@@ -464,9 +463,9 @@ static int tc3589x_resume(struct device *dev)
return ret;
}
-#endif
-static SIMPLE_DEV_PM_OPS(tc3589x_dev_pm_ops, tc3589x_suspend, tc3589x_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(tc3589x_dev_pm_ops,
+ tc3589x_suspend, tc3589x_resume);
static const struct i2c_device_id tc3589x_id[] = {
{ "tc35890", TC3589X_TC35890 },
@@ -483,7 +482,7 @@ MODULE_DEVICE_TABLE(i2c, tc3589x_id);
static struct i2c_driver tc3589x_driver = {
.driver = {
.name = "tc3589x",
- .pm = &tc3589x_dev_pm_ops,
+ .pm = pm_sleep_ptr(&tc3589x_dev_pm_ops),
.of_match_table = of_match_ptr(tc3589x_match),
},
.probe_new = tc3589x_probe,