rtc: pcf2127: bugfix: watchdog build dependency
authorBruno Thomsen <bruno.thomsen@gmail.com>
Tue, 27 Aug 2019 14:36:56 +0000 (16:36 +0200)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Tue, 27 Aug 2019 16:24:15 +0000 (18:24 +0200)
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.

Reported-by: Hulk Robot <hulkci@huawei.com>
Reported-by: YueHaibing <yuehaibing@huawei.com>
Fixes: bbc597561ce1 ("rtc: pcf2127: add watchdog feature support")
Signed-off-by: Bruno Thomsen <bruno.thomsen@gmail.com>
Link: https://lore.kernel.org/r/20190827143656.4734-1-bruno.thomsen@gmail.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
drivers/rtc/Kconfig
drivers/rtc/rtc-pcf2127.c

index 758f7a4174700072420e522961097b6af5c5518e..da0aceb45095af170ac983dfe3c22250700d247b 100644 (file)
@@ -886,6 +886,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.
index 3ec87d3207666924f0775ae83afa51c5c9052a66..02b069caffd57c88ab0b022481d0b8c1704de19c 100644 (file)
@@ -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.