linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rtc: msm6242: Fix reading of 10-hour digit
@ 2019-11-16 11:05 Kars de Jong
  2019-11-16 11:17 ` Kars de Jong
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Kars de Jong @ 2019-11-16 11:05 UTC (permalink / raw)
  To: Alessandro Zummo, Alexandre Belloni
  Cc: linux-rtc, linux-kernel, Kars de Jong, Geert Uytterhoeven

The driver was reading the wrong register as the 10-hour digit due to
a misplaced ')'. It was in fact reading the 1-second digit register due
to this bug.

Also remove the use of a magic number for the hour mask and use the define
for it which was already present.

Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Tested-by: Kars de Jong <jongk@linux-m68k.org>
Signed-off-by: Kars de Jong <jongk@linux-m68k.org>
---
 drivers/rtc/rtc-msm6242.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-msm6242.c b/drivers/rtc/rtc-msm6242.c
index 1c2d3c4a4963..b1f2bedee77e 100644
--- a/drivers/rtc/rtc-msm6242.c
+++ b/drivers/rtc/rtc-msm6242.c
@@ -133,7 +133,8 @@ static int msm6242_read_time(struct device *dev, struct rtc_time *tm)
 		      msm6242_read(priv, MSM6242_SECOND1);
 	tm->tm_min  = msm6242_read(priv, MSM6242_MINUTE10) * 10 +
 		      msm6242_read(priv, MSM6242_MINUTE1);
-	tm->tm_hour = (msm6242_read(priv, MSM6242_HOUR10 & 3)) * 10 +
+	tm->tm_hour = (msm6242_read(priv, MSM6242_HOUR10) &
+		       MSM6242_HOUR10_HR_MASK) * 10 +
 		      msm6242_read(priv, MSM6242_HOUR1);
 	tm->tm_mday = msm6242_read(priv, MSM6242_DAY10) * 10 +
 		      msm6242_read(priv, MSM6242_DAY1);
-- 
2.17.1


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

* Re: [PATCH] rtc: msm6242: Fix reading of 10-hour digit
  2019-11-16 11:05 [PATCH] rtc: msm6242: Fix reading of 10-hour digit Kars de Jong
@ 2019-11-16 11:17 ` Kars de Jong
  2019-11-18 14:14 ` Geert Uytterhoeven
  2019-11-18 14:18 ` Alexandre Belloni
  2 siblings, 0 replies; 4+ messages in thread
From: Kars de Jong @ 2019-11-16 11:17 UTC (permalink / raw)
  To: Alessandro Zummo, Alexandre Belloni
  Cc: linux-rtc, linux-kernel, Geert Uytterhoeven

Forgot to add:

Fixes: 4f9b9bba1dd1 ("rtc: Add an RTC driver for the Oki MSM6242")

Op za 16 nov. 2019 om 12:06 schreef Kars de Jong <jongk@linux-m68k.org>:
>
> The driver was reading the wrong register as the 10-hour digit due to
> a misplaced ')'. It was in fact reading the 1-second digit register due
> to this bug.
>
> Also remove the use of a magic number for the hour mask and use the define
> for it which was already present.
>
> Cc: Geert Uytterhoeven <geert@linux-m68k.org>
> Tested-by: Kars de Jong <jongk@linux-m68k.org>
> Signed-off-by: Kars de Jong <jongk@linux-m68k.org>

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

* Re: [PATCH] rtc: msm6242: Fix reading of 10-hour digit
  2019-11-16 11:05 [PATCH] rtc: msm6242: Fix reading of 10-hour digit Kars de Jong
  2019-11-16 11:17 ` Kars de Jong
@ 2019-11-18 14:14 ` Geert Uytterhoeven
  2019-11-18 14:18 ` Alexandre Belloni
  2 siblings, 0 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2019-11-18 14:14 UTC (permalink / raw)
  To: Kars de Jong
  Cc: Alessandro Zummo, Alexandre Belloni, linux-rtc,
	Linux Kernel Mailing List

On Sat, Nov 16, 2019 at 12:06 PM Kars de Jong <jongk@linux-m68k.org> wrote:
> The driver was reading the wrong register as the 10-hour digit due to
> a misplaced ')'. It was in fact reading the 1-second digit register due
> to this bug.
>
> Also remove the use of a magic number for the hour mask and use the define
> for it which was already present.
>
> Cc: Geert Uytterhoeven <geert@linux-m68k.org>
> Tested-by: Kars de Jong <jongk@linux-m68k.org>
> Signed-off-by: Kars de Jong <jongk@linux-m68k.org>

Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH] rtc: msm6242: Fix reading of 10-hour digit
  2019-11-16 11:05 [PATCH] rtc: msm6242: Fix reading of 10-hour digit Kars de Jong
  2019-11-16 11:17 ` Kars de Jong
  2019-11-18 14:14 ` Geert Uytterhoeven
@ 2019-11-18 14:18 ` Alexandre Belloni
  2 siblings, 0 replies; 4+ messages in thread
From: Alexandre Belloni @ 2019-11-18 14:18 UTC (permalink / raw)
  To: Kars de Jong
  Cc: Alessandro Zummo, linux-rtc, linux-kernel, Geert Uytterhoeven

On 16/11/2019 12:05:48+0100, Kars de Jong wrote:
> The driver was reading the wrong register as the 10-hour digit due to
> a misplaced ')'. It was in fact reading the 1-second digit register due
> to this bug.
> 
> Also remove the use of a magic number for the hour mask and use the define
> for it which was already present.
> 
> Cc: Geert Uytterhoeven <geert@linux-m68k.org>
> Tested-by: Kars de Jong <jongk@linux-m68k.org>
> Signed-off-by: Kars de Jong <jongk@linux-m68k.org>
> ---
>  drivers/rtc/rtc-msm6242.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
Applied, thanks.

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

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

end of thread, other threads:[~2019-11-18 14:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-16 11:05 [PATCH] rtc: msm6242: Fix reading of 10-hour digit Kars de Jong
2019-11-16 11:17 ` Kars de Jong
2019-11-18 14:14 ` Geert Uytterhoeven
2019-11-18 14:18 ` 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).