提交 74f4595a 编写于 作者: J Jonathan Cameron

iio: magnetometer: ak8974: Use DEFINE_RUNTIME_DEV_PM_OPS() and pm_ptr() macros

Using these new macros allows the compiler to remove the unused dev_pm_ops
structure and related functions if !CONFIG_PM without the need to mark
the functions __maybe_unused.
Signed-off-by: NJonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: NPaul Cercueil <paul@crapouillou.net>
Link: https://lore.kernel.org/r/20220621202719.13644-36-jic23@kernel.org
上级 1539e05b
...@@ -985,7 +985,7 @@ static int ak8974_remove(struct i2c_client *i2c) ...@@ -985,7 +985,7 @@ static int ak8974_remove(struct i2c_client *i2c)
return 0; return 0;
} }
static int __maybe_unused ak8974_runtime_suspend(struct device *dev) static int ak8974_runtime_suspend(struct device *dev)
{ {
struct ak8974 *ak8974 = struct ak8974 *ak8974 =
iio_priv(i2c_get_clientdata(to_i2c_client(dev))); iio_priv(i2c_get_clientdata(to_i2c_client(dev)));
...@@ -996,7 +996,7 @@ static int __maybe_unused ak8974_runtime_suspend(struct device *dev) ...@@ -996,7 +996,7 @@ static int __maybe_unused ak8974_runtime_suspend(struct device *dev)
return 0; return 0;
} }
static int __maybe_unused ak8974_runtime_resume(struct device *dev) static int ak8974_runtime_resume(struct device *dev)
{ {
struct ak8974 *ak8974 = struct ak8974 *ak8974 =
iio_priv(i2c_get_clientdata(to_i2c_client(dev))); iio_priv(i2c_get_clientdata(to_i2c_client(dev)));
...@@ -1024,12 +1024,8 @@ static int __maybe_unused ak8974_runtime_resume(struct device *dev) ...@@ -1024,12 +1024,8 @@ static int __maybe_unused ak8974_runtime_resume(struct device *dev)
return ret; return ret;
} }
static const struct dev_pm_ops ak8974_dev_pm_ops = { static DEFINE_RUNTIME_DEV_PM_OPS(ak8974_dev_pm_ops, ak8974_runtime_suspend,
SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, ak8974_runtime_resume, NULL);
pm_runtime_force_resume)
SET_RUNTIME_PM_OPS(ak8974_runtime_suspend,
ak8974_runtime_resume, NULL)
};
static const struct i2c_device_id ak8974_id[] = { static const struct i2c_device_id ak8974_id[] = {
{"ami305", 0 }, {"ami305", 0 },
...@@ -1050,7 +1046,7 @@ MODULE_DEVICE_TABLE(of, ak8974_of_match); ...@@ -1050,7 +1046,7 @@ MODULE_DEVICE_TABLE(of, ak8974_of_match);
static struct i2c_driver ak8974_driver = { static struct i2c_driver ak8974_driver = {
.driver = { .driver = {
.name = "ak8974", .name = "ak8974",
.pm = &ak8974_dev_pm_ops, .pm = pm_ptr(&ak8974_dev_pm_ops),
.of_match_table = ak8974_of_match, .of_match_table = ak8974_of_match,
}, },
.probe = ak8974_probe, .probe = ak8974_probe,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册