Commit da123e29 authored by Jonathan Cameron's avatar Jonathan Cameron

iio:imu:kmx61: Switch from CONFIG_PM* guards to pm_ptr() etc

Letting the compiler remove these functions when the kernel is built
without one or  more of CONFIG_PM/CONFIG_PM_SLEEP support is simpler and
less error prone than the use of #ifdef based config guards.

Removing instances of this approach from IIO also stops them being
copied into new drivers.
Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: default avatarPaul Cercueil <paul@crapouillou.net>
Link: https://lore.kernel.org/r/20220130193147.279148-42-jic23@kernel.org
parent 671d2c60
...@@ -1440,7 +1440,6 @@ static int kmx61_remove(struct i2c_client *client) ...@@ -1440,7 +1440,6 @@ static int kmx61_remove(struct i2c_client *client)
return 0; return 0;
} }
#ifdef CONFIG_PM_SLEEP
static int kmx61_suspend(struct device *dev) static int kmx61_suspend(struct device *dev)
{ {
int ret; int ret;
...@@ -1466,9 +1465,7 @@ static int kmx61_resume(struct device *dev) ...@@ -1466,9 +1465,7 @@ static int kmx61_resume(struct device *dev)
return kmx61_set_mode(data, stby, KMX61_ACC | KMX61_MAG, true); return kmx61_set_mode(data, stby, KMX61_ACC | KMX61_MAG, true);
} }
#endif
#ifdef CONFIG_PM
static int kmx61_runtime_suspend(struct device *dev) static int kmx61_runtime_suspend(struct device *dev)
{ {
struct kmx61_data *data = i2c_get_clientdata(to_i2c_client(dev)); struct kmx61_data *data = i2c_get_clientdata(to_i2c_client(dev));
...@@ -1493,11 +1490,10 @@ static int kmx61_runtime_resume(struct device *dev) ...@@ -1493,11 +1490,10 @@ static int kmx61_runtime_resume(struct device *dev)
return kmx61_set_mode(data, stby, KMX61_ACC | KMX61_MAG, true); return kmx61_set_mode(data, stby, KMX61_ACC | KMX61_MAG, true);
} }
#endif
static const struct dev_pm_ops kmx61_pm_ops = { static const struct dev_pm_ops kmx61_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(kmx61_suspend, kmx61_resume) SYSTEM_SLEEP_PM_OPS(kmx61_suspend, kmx61_resume)
SET_RUNTIME_PM_OPS(kmx61_runtime_suspend, kmx61_runtime_resume, NULL) RUNTIME_PM_OPS(kmx61_runtime_suspend, kmx61_runtime_resume, NULL)
}; };
static const struct acpi_device_id kmx61_acpi_match[] = { static const struct acpi_device_id kmx61_acpi_match[] = {
...@@ -1518,7 +1514,7 @@ static struct i2c_driver kmx61_driver = { ...@@ -1518,7 +1514,7 @@ static struct i2c_driver kmx61_driver = {
.driver = { .driver = {
.name = KMX61_DRV_NAME, .name = KMX61_DRV_NAME,
.acpi_match_table = ACPI_PTR(kmx61_acpi_match), .acpi_match_table = ACPI_PTR(kmx61_acpi_match),
.pm = &kmx61_pm_ops, .pm = pm_ptr(&kmx61_pm_ops),
}, },
.probe = kmx61_probe, .probe = kmx61_probe,
.remove = kmx61_remove, .remove = kmx61_remove,
......
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