[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAH+2xPAVvMpTgT3W=0AsKy=9jkS8qd6eB65Qebw51YKRQshaGQ@mail.gmail.com>
Date: Sun, 27 Sep 2020 10:09:50 +0200
From: Bruno Thomsen <bruno.thomsen@...il.com>
To: Uwe Kleine-König
<u.kleine-koenig@...gutronix.de>
Cc: Alexandre Belloni <alexandre.belloni@...tlin.com>,
Qiang Zhao <qiang.zhao@....com>, linux-rtc@...r.kernel.org,
Alessandro Zummo <a.zummo@...ertech.it>,
linux-watchdog@...r.kernel.org,
"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS"
<devicetree@...r.kernel.org>,
open list <linux-kernel@...r.kernel.org>,
Rob Herring <robh+dt@...nel.org>,
Sascha Hauer <kernel@...gutronix.de>,
Wim Van Sebroeck <wim@...ux-watchdog.org>,
Guenter Roeck <linux@...ck-us.net>
Subject: Re: [PATCH 2/2] [RFC] rtc: pcf2127: only use watchdog when explicitly available
Den tor. 24. sep. 2020 kl. 12.53 skrev Uwe Kleine-König
<u.kleine-koenig@...gutronix.de>:
>
> Most boards using the pcf2127 chip (in my bubble) don't make use of the
> watchdog functionality and the respective output is not connected. The
> effect on such a board is that there is a watchdog device provided that
> doesn't work.
>
> So only register the watchdog if the device tree has a "has-watchdog"
> property.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@...gutronix.de>
> ---
> drivers/rtc/rtc-pcf2127.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/rtc/rtc-pcf2127.c b/drivers/rtc/rtc-pcf2127.c
> index 5b1f1949b5e5..8bd89d641578 100644
> --- a/drivers/rtc/rtc-pcf2127.c
> +++ b/drivers/rtc/rtc-pcf2127.c
> @@ -340,7 +340,8 @@ static int pcf2127_watchdog_init(struct device *dev, struct pcf2127 *pcf2127)
> u32 wdd_timeout;
> int ret;
>
> - if (!IS_ENABLED(CONFIG_WATCHDOG))
> + if (!IS_ENABLED(CONFIG_WATCHDOG) ||
> + !device_property_read_bool(dev, "has-watchdog"))
> return 0;
I don't think the compiler can remove the function if
CONFIG_WATCHDOG is disabled due to the device tree
value check. Maybe it can if split into 2 conditions.
if (!IS_ENABLED(CONFIG_WATCHDOG))
return 0;
if (!device_property_read_bool(dev, "has-watchdog"))
return 0;
/Bruno
>
> pcf2127->wdd.parent = dev;
> --
> 2.28.0
>
Powered by blists - more mailing lists