iio: pressure: icp10100: Switch from UNIVERSAL to DEFINE_RUNTIME_DEV_PM_OPS().
The suspend and resume callbacks in this driver appear to be safe to call repeatedly, but why do so when we can use the DEFINE_RUNTIME_DEV_PM_OPS() macro to supply callbacks that check if we are already runtime suspended before doing unnecessary work. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Cc: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com> Acked-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com> Link: https://lore.kernel.org/r/20220807190414.1039028-2-jic23@kernel.org
This commit is contained in:
@@ -595,7 +595,7 @@ static int icp10100_probe(struct i2c_client *client,
|
|||||||
return devm_iio_device_register(&client->dev, indio_dev);
|
return devm_iio_device_register(&client->dev, indio_dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __maybe_unused icp10100_suspend(struct device *dev)
|
static int icp10100_suspend(struct device *dev)
|
||||||
{
|
{
|
||||||
struct icp10100_state *st = iio_priv(dev_get_drvdata(dev));
|
struct icp10100_state *st = iio_priv(dev_get_drvdata(dev));
|
||||||
int ret;
|
int ret;
|
||||||
@@ -607,7 +607,7 @@ static int __maybe_unused icp10100_suspend(struct device *dev)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __maybe_unused icp10100_resume(struct device *dev)
|
static int icp10100_resume(struct device *dev)
|
||||||
{
|
{
|
||||||
struct icp10100_state *st = iio_priv(dev_get_drvdata(dev));
|
struct icp10100_state *st = iio_priv(dev_get_drvdata(dev));
|
||||||
int ret;
|
int ret;
|
||||||
@@ -626,8 +626,8 @@ out_unlock:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static UNIVERSAL_DEV_PM_OPS(icp10100_pm, icp10100_suspend, icp10100_resume,
|
static DEFINE_RUNTIME_DEV_PM_OPS(icp10100_pm, icp10100_suspend, icp10100_resume,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
static const struct of_device_id icp10100_of_match[] = {
|
static const struct of_device_id icp10100_of_match[] = {
|
||||||
{
|
{
|
||||||
@@ -646,7 +646,7 @@ MODULE_DEVICE_TABLE(i2c, icp10100_id);
|
|||||||
static struct i2c_driver icp10100_driver = {
|
static struct i2c_driver icp10100_driver = {
|
||||||
.driver = {
|
.driver = {
|
||||||
.name = "icp10100",
|
.name = "icp10100",
|
||||||
.pm = &icp10100_pm,
|
.pm = pm_ptr(&icp10100_pm),
|
||||||
.of_match_table = icp10100_of_match,
|
.of_match_table = icp10100_of_match,
|
||||||
},
|
},
|
||||||
.probe = icp10100_probe,
|
.probe = icp10100_probe,
|
||||||
|
|||||||
Reference in New Issue
Block a user