Skip to contentSkip to conversation

rtc: ds3232: avoid unused-const-variable warning

PATCH Applied Akinobu Mita 2 participants 2 messages Nov 18, 2023 – Jan 8, 2024 Real time clock (RTC)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rtc: ds3232: avoid unused-const-variable warning

Fix the following warning when CONFIG_I2C is not set but CONFIG_SPI_MASTER is set.

warning: 'ds3232_pm_ops' defined but not used [-Wunused-const-variable=]

'ds3232_pm_ops' is only used by rtc-ds3232 i2c driver, so move the device PM callbacks inside #if IS_ENABLED(CONFIG_I2C).

---
 drivers/rtc/rtc-ds3232.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/rtc/rtc-ds3232.c +2 -2
index 89d7b085f721..1485a6ae51e6 100644
@@ -536,6 +536,8 @@ static int ds3232_probe(struct device *dev, struct regmap *regmap, int irq,
 	return 0;
 }
 
+#if IS_ENABLED(CONFIG_I2C)
+
 #ifdef CONFIG_PM_SLEEP
 static int ds3232_suspend(struct device *dev)
 {
@@ -564,8 +566,6 @@ static const struct dev_pm_ops ds3232_pm_ops = {
 	SET_SYSTEM_SLEEP_PM_OPS(ds3232_suspend, ds3232_resume)
 };
 
-#if IS_ENABLED(CONFIG_I2C)
-
 static int ds3232_i2c_probe(struct i2c_client *client)
 {
 	struct regmap *regmap;
Signature · 1 line
2.34.1
maintainer Applied
#1 lore raw
Quoted 9 lines · Akinobu Mita

Fix the following warning when CONFIG_I2C is not set but CONFIG_SPI_MASTER is set.

warning: 'ds3232_pm_ops' defined but not used [-Wunused-const-variable=]

'ds3232_pm_ops' is only used by rtc-ds3232 i2c driver, so move the device PM callbacks inside #if IS_ENABLED(CONFIG_I2C).

[...]

Applied, thanks!

[1/1] rtc: ds3232: avoid unused-const-variable warning

      commit: 3628d999e31e2e31b51f78b0f68e91275854c179

Best regards,

Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com