iio: proximity: sx9310: 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: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Gwendal Grignou <gwendal@chromium.org>
Link: https://lore.kernel.org/r/20220807185618.1038812-2-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
Jonathan Cameron 2022-08-07 19:56:13 +01:00
parent 130476acfd
commit 93176acee9

View File

@ -965,7 +965,7 @@ static int sx9310_probe(struct i2c_client *client)
return sx_common_probe(client, &sx9310_chip_info, &sx9310_regmap_config); return sx_common_probe(client, &sx9310_chip_info, &sx9310_regmap_config);
} }
static int __maybe_unused sx9310_suspend(struct device *dev) static int sx9310_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));
u8 ctrl0; u8 ctrl0;
@ -991,7 +991,7 @@ out:
return ret; return ret;
} }
static int __maybe_unused sx9310_resume(struct device *dev) static int sx9310_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;
@ -1013,7 +1013,7 @@ out:
return 0; return 0;
} }
static SIMPLE_DEV_PM_OPS(sx9310_pm_ops, sx9310_suspend, sx9310_resume); static DEFINE_SIMPLE_DEV_PM_OPS(sx9310_pm_ops, sx9310_suspend, sx9310_resume);
static const struct acpi_device_id sx9310_acpi_match[] = { static const struct acpi_device_id sx9310_acpi_match[] = {
{ "STH9310", SX9310_WHOAMI_VALUE }, { "STH9310", SX9310_WHOAMI_VALUE },
@ -1041,7 +1041,7 @@ static struct i2c_driver sx9310_driver = {
.name = "sx9310", .name = "sx9310",
.acpi_match_table = sx9310_acpi_match, .acpi_match_table = sx9310_acpi_match,
.of_match_table = sx9310_of_match, .of_match_table = sx9310_of_match,
.pm = &sx9310_pm_ops, .pm = pm_sleep_ptr(&sx9310_pm_ops),
/* /*
* Lots of i2c transfers in probe + over 200 ms waiting in * Lots of i2c transfers in probe + over 200 ms waiting in