Skip to contentSkip to conversation

hwmon: max6639: Fix CONFIG_PM compile option

PATCH In review Roland Stigge 3 participants 5 messages Mar 24, 2012 – Mar 26, 2012 Hardware monitoring

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hwmon: max6639: Fix CONFIG_PM compile option

This patch fixes a compiler warning in case CONFIG_PM is not defined

---

This solves the issue recently encountered by Kurt Roeck in the nightly build.

The solution with #ifdef's is done as in all the other drivers.

 drivers/hwmon/max6639.c |    5 +++++
 1 file changed, 5 insertions(+)
drivers/hwmon/max6639.c +5 -0
@@ -596,6 +596,7 @@ static int max6639_remove(struct i2c_cli
 	return 0;
 }
 
+#ifdef CONFIG_PM
 static int max6639_suspend(struct device *dev)
 {
 	struct i2c_client *client = to_i2c_client(dev);
@@ -617,6 +618,10 @@ static int max6639_resume(struct device
 	return i2c_smbus_write_byte_data(client,
 			MAX6639_REG_GCONFIG, data & ~MAX6639_GCONFIG_STANDBY);
 }
+#else
+#define max6639_suspend NULL
+#define max6639_resume NULL
+#endif
 
 static const struct i2c_device_id max6639_id[] = {
 	{"max6639", 0},

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#1 lore raw
Quoted 16 lines · Roland Stigge

This patch fixes a compiler warning in case CONFIG_PM is not defined

---

This solves the issue recently encountered by Kurt Roeck in the nightly build.

The solution with #ifdef's is done as in all the other drivers.

 drivers/hwmon/max6639.c |    5 +++++
 1 file changed, 5 insertions(+)

drivers/hwmon/max6639.c static int max6639_remove(struct i2c_cli · line 599

Quoted 4 lines
drivers/hwmon/max6639.c +1 -0
@@ -596,6 +596,7 @@ static int max6639_remove(struct i2c_cli
 	return 0;
 }
 
+#ifdef CONFIG_PM

Looking into other drivers, I think that should be CONFIG_PM_SLEEP

drivers/hwmon/max6639.c static int max6639_resume(struct device · line 625

Quoted 12 lines
drivers/hwmon/max6639.c +4 -0
 static int max6639_suspend(struct device *dev)
 {
 	struct i2c_client *client = to_i2c_client(dev);
@@ -617,6 +618,10 @@ static int max6639_resume(struct device
 	return i2c_smbus_write_byte_data(client,
 			MAX6639_REG_GCONFIG, data & ~MAX6639_GCONFIG_STANDBY);
 }
+#else
+#define max6639_suspend NULL
+#define max6639_resume NULL
+#endif
 

... and that else case should not be necessary.

Oh well, now I ended up looking into it anyway ... so I just added the missing #ifdef to Mark's patch.

Thanks,
Guenter

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#2 lore raw
In reply to Roland Stigge

Hi,

Quoted 9 lines · Guenter Roeck

drivers/hwmon/max6639.c static int max6639_remove(struct i2c_cli · line 599

Quoted 7 lines
drivers/hwmon/max6639.c +1 -0
@@ -596,6 +596,7 @@ static int max6639_remove(struct i2c_cli
 	return 0;
 }
 
+#ifdef CONFIG_PM

Looking into other drivers, I think that should be CONFIG_PM_SLEEP

Which other drivers did you mean?

What about those drivers that all handle it via CONFIG_PM:

abituguru.c
abituguru3.c
exynos4_tmu.c
gpio-fan.c
jc42.c
lm75.c
tmp102.c

?

Quoted 6 lines

drivers/hwmon/max6639.c static int max6639_resume(struct device · line 624

Quoted 5 lines
drivers/hwmon/max6639.c +4 -0
+#else
+#define max6639_suspend NULL
+#define max6639_resume NULL
+#endif

... and that else case should not be necessary.

According to the compiler warning, right. :-)

Thanks,

Roland

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#3 lore raw
In reply to Roland Stigge
Quoted 25 lines · Roland Stigge

Hi,

Quoted 9 lines · Guenter Roeck

drivers/hwmon/max6639.c static int max6639_remove(struct i2c_cli · line 599

Quoted 7 lines
drivers/hwmon/max6639.c +1 -0
@@ -596,6 +596,7 @@ static int max6639_remove(struct i2c_cli
 	return 0;
 }
 
+#ifdef CONFIG_PM

Looking into other drivers, I think that should be CONFIG_PM_SLEEP

Which other drivers did you mean?

What about those drivers that all handle it via CONFIG_PM:

abituguru.c
abituguru3.c
exynos4_tmu.c
gpio-fan.c
jc42.c
lm75.c
tmp102.c

Quoted 1 line

?

Those drivers don't use SET_SYSTEM_SLEEP_PM_OPS. I checked several drivers which do use SET_SYSTEM_SLEEP_PM_OPS, and they all use CONFIG_PM_SLEEP.

Quoted 8 lines
Quoted 7 lines

drivers/hwmon/max6639.c static int max6639_resume(struct device · line 624

Quoted 6 lines
drivers/hwmon/max6639.c +4 -0
+#else
+#define max6639_suspend NULL
+#define max6639_resume NULL
+#endif

... and that else case should not be necessary.

The drivers using SET_SYSTEM_SLEEP_PM_OPS don't define the else case.

Thanks,
Guenter

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#4 lore raw
In reply to Roland Stigge
Quoted 18 lines · Guenter Roeck
Quoted 8 lines · Roland Stigge
Quoted 3 lines
Quoted 1 line

+#ifdef CONFIG_PM

Looking into other drivers, I think that should be CONFIG_PM_SLEEP

Which other drivers did you mean?

What about those drivers that all handle it via CONFIG_PM:

Quoted 7 lines

abituguru.c
abituguru3.c
exynos4_tmu.c
gpio-fan.c
jc42.c
lm75.c
tmp102.c

Quoted 2 lines

Those drivers don't use SET_SYSTEM_SLEEP_PM_OPS. I checked several drivers which do use SET_SYSTEM_SLEEP_PM_OPS, and they all use CONFIG_PM_SLEEP.

It's nothing to do with SET_SYSTEM_SLEEP_PM_OPS - it's more about drivers that are following current best practice (which includes using the SET_ macros). A modern driver should be using CONFIG_PM_SLEEP for system sleep operations and CONFIG_PM_RUNTIME for runtime PM operations since they can be enabled independently. CONFIG_PM should only control having dev_pm_ops at all (if you want to bother with the ifdefery).

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors