Skip to content

Commit 2d5604c

Browse files
jic23groeck
authored andcommitted
hwmon: (ina3221) Use DEFINE_RUNTIME_DEV_PM_OPS() and pm_ptr()
These new macros allow the compiler to see all the functions even if !CONFIG_PM* and remove the structures and functions if unused. This removes the need for __maybe_unused markings. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Cc: Ninad Malwade <nmalwade@nvidia.com> Link: https://lore.kernel.org/r/20220925172759.3573439-19-jic23@kernel.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
1 parent 655231d commit 2d5604c

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

drivers/hwmon/ina3221.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -930,7 +930,7 @@ static int ina3221_remove(struct i2c_client *client)
930930
return 0;
931931
}
932932

933-
static int __maybe_unused ina3221_suspend(struct device *dev)
933+
static int ina3221_suspend(struct device *dev)
934934
{
935935
struct ina3221_data *ina = dev_get_drvdata(dev);
936936
int ret;
@@ -953,7 +953,7 @@ static int __maybe_unused ina3221_suspend(struct device *dev)
953953
return 0;
954954
}
955955

956-
static int __maybe_unused ina3221_resume(struct device *dev)
956+
static int ina3221_resume(struct device *dev)
957957
{
958958
struct ina3221_data *ina = dev_get_drvdata(dev);
959959
int ret;
@@ -996,11 +996,8 @@ static int __maybe_unused ina3221_resume(struct device *dev)
996996
return 0;
997997
}
998998

999-
static const struct dev_pm_ops ina3221_pm = {
1000-
SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
1001-
pm_runtime_force_resume)
1002-
SET_RUNTIME_PM_OPS(ina3221_suspend, ina3221_resume, NULL)
1003-
};
999+
static DEFINE_RUNTIME_DEV_PM_OPS(ina3221_pm, ina3221_suspend, ina3221_resume,
1000+
NULL);
10041001

10051002
static const struct of_device_id ina3221_of_match_table[] = {
10061003
{ .compatible = "ti,ina3221", },
@@ -1020,7 +1017,7 @@ static struct i2c_driver ina3221_i2c_driver = {
10201017
.driver = {
10211018
.name = INA3221_DRIVER_NAME,
10221019
.of_match_table = ina3221_of_match_table,
1023-
.pm = &ina3221_pm,
1020+
.pm = pm_ptr(&ina3221_pm),
10241021
},
10251022
.id_table = ina3221_ids,
10261023
};

0 commit comments

Comments
 (0)