linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rtc: sh: Fix invalid alarm warning for non-enabled alarm
@ 2019-03-20 10:32 Geert Uytterhoeven
  2019-03-20 10:38 ` Alexandre Belloni
  0 siblings, 1 reply; 2+ messages in thread
From: Geert Uytterhoeven @ 2019-03-20 10:32 UTC (permalink / raw)
  To: Alessandro Zummo, Alexandre Belloni, Chris Brandt
  Cc: linux-rtc, linux-renesas-soc, Geert Uytterhoeven

When no alarm has been programmed on RSK-RZA1, an error message is
printed during boot:

    rtc rtc0: invalid alarm value: 2019-03-14T255:255:255

sh_rtc_read_alarm_value() returns 0xff when querying a hardware alarm
field that is not enabled.  __rtc_read_alarm() validates the received
alarm values, and fills in missing fields when needed.
While 0xff is handled fine for the year, month, and day fields, and
corrected as considered being out-of-range, this is not the case for the
hour, minute, and second fields, where -1 is expected for missing
fields.

Fix this by returning -1 instead, as this value is handled fine for all
fields.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/rtc/rtc-sh.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-sh.c b/drivers/rtc/rtc-sh.c
index d417b203cbc553eb..1d3de2a3d1a4d7a0 100644
--- a/drivers/rtc/rtc-sh.c
+++ b/drivers/rtc/rtc-sh.c
@@ -374,7 +374,7 @@ static int sh_rtc_set_time(struct device *dev, struct rtc_time *tm)
 static inline int sh_rtc_read_alarm_value(struct sh_rtc *rtc, int reg_off)
 {
 	unsigned int byte;
-	int value = 0xff;	/* return 0xff for ignored values */
+	int value = -1;			/* return -1 for ignored values */
 
 	byte = readb(rtc->regbase + reg_off);
 	if (byte & AR_ENB) {
-- 
2.17.1


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

* Re: [PATCH] rtc: sh: Fix invalid alarm warning for non-enabled alarm
  2019-03-20 10:32 [PATCH] rtc: sh: Fix invalid alarm warning for non-enabled alarm Geert Uytterhoeven
@ 2019-03-20 10:38 ` Alexandre Belloni
  0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Belloni @ 2019-03-20 10:38 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Alessandro Zummo, Chris Brandt, linux-rtc, linux-renesas-soc

On 20/03/2019 11:32:14+0100, Geert Uytterhoeven wrote:
> When no alarm has been programmed on RSK-RZA1, an error message is
> printed during boot:
> 
>     rtc rtc0: invalid alarm value: 2019-03-14T255:255:255
> 
> sh_rtc_read_alarm_value() returns 0xff when querying a hardware alarm
> field that is not enabled.  __rtc_read_alarm() validates the received
> alarm values, and fills in missing fields when needed.
> While 0xff is handled fine for the year, month, and day fields, and
> corrected as considered being out-of-range, this is not the case for the
> hour, minute, and second fields, where -1 is expected for missing
> fields.
> 
> Fix this by returning -1 instead, as this value is handled fine for all
> fields.
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
>  drivers/rtc/rtc-sh.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
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-03-20 10:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-20 10:32 [PATCH] rtc: sh: Fix invalid alarm warning for non-enabled alarm Geert Uytterhoeven
2019-03-20 10:38 ` 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).