From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Kars de Jong <jongk@linux-m68k.org>,
Geert Uytterhoeven <geert@linux-m68k.org>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
Sasha Levin <sashal@kernel.org>,
linux-rtc@vger.kernel.org
Subject: [PATCH AUTOSEL 4.19 650/671] rtc: msm6242: Fix reading of 10-hour digit
Date: Thu, 16 Jan 2020 12:04:48 -0500 [thread overview]
Message-ID: <20200116170509.12787-387-sashal@kernel.org> (raw)
In-Reply-To: <20200116170509.12787-1-sashal@kernel.org>
From: Kars de Jong <jongk@linux-m68k.org>
[ Upstream commit e34494c8df0cd96fc432efae121db3212c46ae48 ]
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.
Fixes: 4f9b9bba1dd1 ("rtc: Add an RTC driver for the Oki MSM6242")
Tested-by: Kars de Jong <jongk@linux-m68k.org>
Signed-off-by: Kars de Jong <jongk@linux-m68k.org>
Link: https://lore.kernel.org/r/20191116110548.8562-1-jongk@linux-m68k.org
Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Sasha Levin <sashal@kernel.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 0c72a2e8ec67..6aace9319fe9 100644
--- a/drivers/rtc/rtc-msm6242.c
+++ b/drivers/rtc/rtc-msm6242.c
@@ -132,7 +132,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.20.1
prev parent reply other threads:[~2020-01-16 17:14 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20200116170509.12787-1-sashal@kernel.org>
2020-01-16 16:58 ` [PATCH AUTOSEL 4.19 277/671] rtc: Fix timestamp value for RTC_TIMESTAMP_BEGIN_1900 Sasha Levin
2020-01-16 16:58 ` [PATCH AUTOSEL 4.19 278/671] rtc: mt6397: Don't call irq_dispose_mapping Sasha Levin
2020-01-16 17:01 ` [PATCH AUTOSEL 4.19 425/671] rtc: pcf8563: Fix interrupt trigger method Sasha Levin
2020-01-16 17:01 ` [PATCH AUTOSEL 4.19 426/671] rtc: pcf8563: Clear event flags and disable interrupts before requesting irq Sasha Levin
2020-01-16 17:02 ` [PATCH AUTOSEL 4.19 502/671] rtc: rv3029: revert error handling patch to rv3029_eeprom_write() Sasha Levin
2020-01-16 17:02 ` [PATCH AUTOSEL 4.19 507/671] rtc: pcf2127: bugfix: read rtc disables watchdog Sasha Levin
2020-01-16 17:04 ` [PATCH AUTOSEL 4.19 640/671] rtc: brcmstb-waketimer: add missed clk_disable_unprepare Sasha Levin
2020-01-16 17:04 ` Sasha Levin [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200116170509.12787-387-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=alexandre.belloni@bootlin.com \
--cc=geert@linux-m68k.org \
--cc=jongk@linux-m68k.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rtc@vger.kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).