summaryrefslogtreecommitdiffstats
path: root/drivers/input/misc/adxl34x-i2c.c
diff options
context:
space:
mode:
authorJonathan Cameron <Jonathan.Cameron@huawei.com>2023-01-14 17:16:12 +0000
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2023-01-27 14:49:53 -0800
commit40be06463e3d7d26fb520b4b73ae6d86c1776d42 (patch)
tree697f68f212ede105b9c1640d87b936b1e9cfbaa7 /drivers/input/misc/adxl34x-i2c.c
parentc0a150eee35f9a955cd47a737e97271ec262fd30 (diff)
downloadlinux-stable-40be06463e3d7d26fb520b4b73ae6d86c1776d42.tar.gz
linux-stable-40be06463e3d7d26fb520b4b73ae6d86c1776d42.tar.bz2
linux-stable-40be06463e3d7d26fb520b4b73ae6d86c1776d42.zip
Input: adxl34x - unify dev_pm_ops using EXPORT_SIMPLE_DEV_PM_OPS()
The I2C and SPI PM callbacks were identical (though wrapped in some bouncing out to the bus specific container of the struct device and then back again to get the drvdata). As such rather than just moving these to SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() take the opportunity to unify the struct dev_pm_ops and use the new EXPORT_SIMPLE_DEV_PM_OPS() macro so that we can drop the unused suspend and resume callbacks as well as the structure if !CONFIG_PM_SLEEP without needing to mark the callbacks __maybe_unused. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Cc: Michael Hennerich <michael.hennerich@analog.com> Link: https://lore.kernel.org/r/20230114171620.42891-9-jic23@kernel.org Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input/misc/adxl34x-i2c.c')
-rw-r--r--drivers/input/misc/adxl34x-i2c.c25
1 files changed, 1 insertions, 24 deletions
diff --git a/drivers/input/misc/adxl34x-i2c.c b/drivers/input/misc/adxl34x-i2c.c
index a8ceea36d80a..1c75d98c85a7 100644
--- a/drivers/input/misc/adxl34x-i2c.c
+++ b/drivers/input/misc/adxl34x-i2c.c
@@ -105,29 +105,6 @@ static void adxl34x_i2c_remove(struct i2c_client *client)
adxl34x_remove(ac);
}
-static int __maybe_unused adxl34x_i2c_suspend(struct device *dev)
-{
- struct i2c_client *client = to_i2c_client(dev);
- struct adxl34x *ac = i2c_get_clientdata(client);
-
- adxl34x_suspend(ac);
-
- return 0;
-}
-
-static int __maybe_unused adxl34x_i2c_resume(struct device *dev)
-{
- struct i2c_client *client = to_i2c_client(dev);
- struct adxl34x *ac = i2c_get_clientdata(client);
-
- adxl34x_resume(ac);
-
- return 0;
-}
-
-static SIMPLE_DEV_PM_OPS(adxl34x_i2c_pm, adxl34x_i2c_suspend,
- adxl34x_i2c_resume);
-
static const struct i2c_device_id adxl34x_id[] = {
{ "adxl34x", 0 },
{ }
@@ -155,7 +132,7 @@ MODULE_DEVICE_TABLE(of, adxl34x_of_id);
static struct i2c_driver adxl34x_driver = {
.driver = {
.name = "adxl34x",
- .pm = &adxl34x_i2c_pm,
+ .pm = pm_sleep_ptr(&adxl34x_pm),
.of_match_table = adxl34x_of_id,
},
.probe_new = adxl34x_i2c_probe,