Skip to contentSkip to conversation

rtc: pcf2127: bugfix: watchdog build dependency

PATCH Applied Bruno Thomsen 2 participants 2 messages Aug 27, 2019 Real time clock (RTC)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rtc: pcf2127: bugfix: watchdog build dependency

Disable watchdog registation when kernel is build without watchdog functionality, and enable watchdog core otherwise. This removes compile errors like the one below:

drivers/rtc/rtc-pcf2127.o: in function `pcf2127_probe.constprop.3':
rtc-pcf2127.c:(.text.unlikely+0x2c8): undefined reference to `devm_watchdog_register_device'

Watchdog feature in chip will always be configured as this is safe to do in both cases and minimize code churn.

Fixes bbc597561ce1 ("rtc: pcf2127: add watchdog feature support")
---
 drivers/rtc/Kconfig       | 1 +
 drivers/rtc/rtc-pcf2127.c | 2 ++
 2 files changed, 3 insertions(+)
drivers/rtc/Kconfig +1 -0
index a3bb58a08879..ab0ccf4a3247 100644
@@ -874,6 +874,7 @@ config RTC_DRV_DS3232_HWMON
 config RTC_DRV_PCF2127
 	tristate "NXP PCF2127"
 	depends on RTC_I2C_AND_SPI
+	select WATCHDOG_CORE if WATCHDOG
 	help
 	  If you say yes here you get support for the NXP PCF2127/29 RTC
 	  chips with integrated quartz crystal for industrial applications.
drivers/rtc/rtc-pcf2127.c +2 -0
index 3ec87d320766..02b069caffd5 100644
@@ -475,9 +475,11 @@ static int pcf2127_probe(struct device *dev, struct regmap *regmap,
 		return ret;
 	}
 
+#ifdef CONFIG_WATCHDOG
 	ret = devm_watchdog_register_device(dev, &pcf2127->wdd);
 	if (ret)
 		return ret;
+#endif /* CONFIG_WATCHDOG */
 
 	/*
 	 * Disable battery low/switch-over timestamp and interrupts.
Signature · 1 line
2.21.0
maintainer Applied
#1 lore raw
Quoted 11 lines · Bruno Thomsen

Disable watchdog registation when kernel is build without watchdog functionality, and enable watchdog core otherwise. This removes compile errors like the one below:

drivers/rtc/rtc-pcf2127.o: in function `pcf2127_probe.constprop.3':
rtc-pcf2127.c:(.text.unlikely+0x2c8): undefined reference to `devm_watchdog_register_device'

Watchdog feature in chip will always be configured as this is safe to do in both cases and minimize code churn.

Quoted 9 lines
Fixes bbc597561ce1 ("rtc: pcf2127: add watchdog feature support")
---
 drivers/rtc/Kconfig       | 1 +
 drivers/rtc/rtc-pcf2127.c | 2 ++
 2 files changed, 3 insertions(+)

Applied, thanks.

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