Commit 1364262c authored by Jonathan Cameron's avatar Jonathan Cameron

iio: proximity: srf04: Use pm_ptr() to remove unused struct dev_pm_ops

If CONFIG_PM is not set, the pm_ptr() will ensure that the struct
dev_pm_ops and callbacks are removed without the need for __maybe_unused
markings.

In this case we can't simply use DEFINE_RUNTIME_DEV_PM_OPS() because
that would provide suspend and resume functions without the
checks the driver is doing before calling runtime_pm functions
(whether the necessary GPIO is provided).  It may be possible to
clean that up in future by moving the checks into the callbacks.
Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Andreas Klinger <ak@it-klinger.de>
Link: https://lore.kernel.org/r/20220807185618.1038812-5-jic23@kernel.orgSigned-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent 5c682eee
......@@ -359,7 +359,7 @@ static int srf04_remove(struct platform_device *pdev)
return 0;
}
static int __maybe_unused srf04_pm_runtime_suspend(struct device *dev)
static int srf04_pm_runtime_suspend(struct device *dev)
{
struct platform_device *pdev = container_of(dev,
struct platform_device, dev);
......@@ -371,7 +371,7 @@ static int __maybe_unused srf04_pm_runtime_suspend(struct device *dev)
return 0;
}
static int __maybe_unused srf04_pm_runtime_resume(struct device *dev)
static int srf04_pm_runtime_resume(struct device *dev)
{
struct platform_device *pdev = container_of(dev,
struct platform_device, dev);
......@@ -385,7 +385,7 @@ static int __maybe_unused srf04_pm_runtime_resume(struct device *dev)
}
static const struct dev_pm_ops srf04_pm_ops = {
SET_RUNTIME_PM_OPS(srf04_pm_runtime_suspend,
RUNTIME_PM_OPS(srf04_pm_runtime_suspend,
srf04_pm_runtime_resume, NULL)
};
......@@ -395,7 +395,7 @@ static struct platform_driver srf04_driver = {
.driver = {
.name = "srf04-gpio",
.of_match_table = of_srf04_match,
.pm = &srf04_pm_ops,
.pm = pm_ptr(&srf04_pm_ops),
},
};
......
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