Skip to content

Commit 7756309

Browse files
jic23groeck
authored andcommitted
hwmon: (max6639) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
These newer PM macros allow the compiler to see what code it can remove if !CONFIG_PM_SLEEP. This allows the removal of #ifdef guards whilst achieving the same result. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Cc: Roland Stigge <stigge@antcom.de> Link: https://lore.kernel.org/r/20220925172759.3573439-12-jic23@kernel.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
1 parent 5ce951a commit 7756309

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

drivers/hwmon/max6639.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,6 @@ static int max6639_probe(struct i2c_client *client)
571571
return PTR_ERR_OR_ZERO(hwmon_dev);
572572
}
573573

574-
#ifdef CONFIG_PM_SLEEP
575574
static int max6639_suspend(struct device *dev)
576575
{
577576
struct i2c_client *client = to_i2c_client(dev);
@@ -609,7 +608,6 @@ static int max6639_resume(struct device *dev)
609608
return i2c_smbus_write_byte_data(client,
610609
MAX6639_REG_GCONFIG, ret & ~MAX6639_GCONFIG_STANDBY);
611610
}
612-
#endif /* CONFIG_PM_SLEEP */
613611

614612
static const struct i2c_device_id max6639_id[] = {
615613
{"max6639", 0},
@@ -618,13 +616,13 @@ static const struct i2c_device_id max6639_id[] = {
618616

619617
MODULE_DEVICE_TABLE(i2c, max6639_id);
620618

621-
static SIMPLE_DEV_PM_OPS(max6639_pm_ops, max6639_suspend, max6639_resume);
619+
static DEFINE_SIMPLE_DEV_PM_OPS(max6639_pm_ops, max6639_suspend, max6639_resume);
622620

623621
static struct i2c_driver max6639_driver = {
624622
.class = I2C_CLASS_HWMON,
625623
.driver = {
626624
.name = "max6639",
627-
.pm = &max6639_pm_ops,
625+
.pm = pm_sleep_ptr(&max6639_pm_ops),
628626
},
629627
.probe_new = max6639_probe,
630628
.id_table = max6639_id,

0 commit comments

Comments
 (0)