Commit 5c682eee authored by Jonathan Cameron's avatar Jonathan Cameron

iio: proximity: sx9360: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()

These new macros avoid the need for marking the callbacks __maybe_unused
whilst ensuring both callbacks and structure may be dropped by the compiler
if CONFIG_PM_SLEEP is not enabled.
Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
Cc: Gwendal Grignou <gwendal@chromium.org>
Link: https://lore.kernel.org/r/20220807185618.1038812-4-jic23@kernel.orgSigned-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent d53f6cdc
...@@ -819,7 +819,7 @@ static int sx9360_probe(struct i2c_client *client) ...@@ -819,7 +819,7 @@ static int sx9360_probe(struct i2c_client *client)
return sx_common_probe(client, &sx9360_chip_info, &sx9360_regmap_config); return sx_common_probe(client, &sx9360_chip_info, &sx9360_regmap_config);
} }
static int __maybe_unused sx9360_suspend(struct device *dev) static int sx9360_suspend(struct device *dev)
{ {
struct sx_common_data *data = iio_priv(dev_get_drvdata(dev)); struct sx_common_data *data = iio_priv(dev_get_drvdata(dev));
unsigned int regval; unsigned int regval;
...@@ -844,7 +844,7 @@ static int __maybe_unused sx9360_suspend(struct device *dev) ...@@ -844,7 +844,7 @@ static int __maybe_unused sx9360_suspend(struct device *dev)
return ret; return ret;
} }
static int __maybe_unused sx9360_resume(struct device *dev) static int sx9360_resume(struct device *dev)
{ {
struct sx_common_data *data = iio_priv(dev_get_drvdata(dev)); struct sx_common_data *data = iio_priv(dev_get_drvdata(dev));
int ret; int ret;
...@@ -861,7 +861,7 @@ static int __maybe_unused sx9360_resume(struct device *dev) ...@@ -861,7 +861,7 @@ static int __maybe_unused sx9360_resume(struct device *dev)
return 0; return 0;
} }
static SIMPLE_DEV_PM_OPS(sx9360_pm_ops, sx9360_suspend, sx9360_resume); static DEFINE_SIMPLE_DEV_PM_OPS(sx9360_pm_ops, sx9360_suspend, sx9360_resume);
static const struct acpi_device_id sx9360_acpi_match[] = { static const struct acpi_device_id sx9360_acpi_match[] = {
{ "STH9360", SX9360_WHOAMI_VALUE }, { "STH9360", SX9360_WHOAMI_VALUE },
...@@ -886,7 +886,7 @@ static struct i2c_driver sx9360_driver = { ...@@ -886,7 +886,7 @@ static struct i2c_driver sx9360_driver = {
.name = "sx9360", .name = "sx9360",
.acpi_match_table = sx9360_acpi_match, .acpi_match_table = sx9360_acpi_match,
.of_match_table = sx9360_of_match, .of_match_table = sx9360_of_match,
.pm = &sx9360_pm_ops, .pm = pm_sleep_ptr(&sx9360_pm_ops),
/* /*
* Lots of i2c transfers in probe + over 200 ms waiting in * Lots of i2c transfers in probe + over 200 ms waiting in
......
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