linux-rtc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rtc: pcf2127: bugfix: watchdog build dependency
@ 2019-08-27 14:36 Bruno Thomsen
  2019-08-27 16:26 ` Alexandre Belloni
  0 siblings, 1 reply; 2+ messages in thread
From: Bruno Thomsen @ 2019-08-27 14:36 UTC (permalink / raw)
  To: alexandre.belloni, linux, yuehaibing
  Cc: a.zummo, bruno.thomsen, linux-rtc, linux-kernel, Hulk Robot

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>
---
 drivers/rtc/Kconfig       | 1 +
 drivers/rtc/rtc-pcf2127.c | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index a3bb58a08879..ab0ccf4a3247 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -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.
diff --git a/drivers/rtc/rtc-pcf2127.c b/drivers/rtc/rtc-pcf2127.c
index 3ec87d320766..02b069caffd5 100644
--- a/drivers/rtc/rtc-pcf2127.c
+++ b/drivers/rtc/rtc-pcf2127.c
@@ -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.
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] rtc: pcf2127: bugfix: watchdog build dependency
  2019-08-27 14:36 [PATCH] rtc: pcf2127: bugfix: watchdog build dependency Bruno Thomsen
@ 2019-08-27 16:26 ` Alexandre Belloni
  0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Belloni @ 2019-08-27 16:26 UTC (permalink / raw)
  To: Bruno Thomsen
  Cc: linux, yuehaibing, a.zummo, linux-rtc, linux-kernel, Hulk Robot

On 27/08/2019 16:36:56+0200, Bruno Thomsen wrote:
> 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>
> ---
>  drivers/rtc/Kconfig       | 1 +
>  drivers/rtc/rtc-pcf2127.c | 2 ++
>  2 files changed, 3 insertions(+)
> 
Applied, thanks.

-- 
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-08-27 16:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-27 14:36 [PATCH] rtc: pcf2127: bugfix: watchdog build dependency Bruno Thomsen
2019-08-27 16:26 ` Alexandre Belloni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).