From: Thorsten Blum <blum@kernel.org>
To: Madhavan Srinivasan <maddy@linux.ibm.com>,
Michael Ellerman <mpe@ellerman.id.au>,
Nicholas Piggin <npiggin@gmail.com>,
"Christophe Leroy (CS GROUP)" <chleroy@kernel.org>
Cc: Thorsten Blum <blum@kernel.org>, linuxppc-dev@lists.ozlabs.org
Subject: [PATCH] macintosh/smu: Fix BCD encoding of the RTC month
Date: Tue, 24 Nov 2026 14:23:38 +0100 [thread overview]
Message-ID: <20261124132342.235824-2-blum@kernel.org> (raw)
The SMU expects a one-based month encoded as BCD, while tm_mon is
zero-based. Adding 1 after converting tm_mon to BCD incorrectly encodes
October as 0x0a instead of 0x10.
Add 1 to tm_mon before converting it to BCD.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Thorsten Blum <blum@kernel.org>
---
drivers/macintosh/smu.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/macintosh/smu.c b/drivers/macintosh/smu.c
index c463760710b6..fb93094ff608 100644
--- a/drivers/macintosh/smu.c
+++ b/drivers/macintosh/smu.c
@@ -374,7 +374,7 @@ static inline void smu_fill_set_rtc_cmd(struct smu_cmd_buf *cmd_buf,
cmd_buf->data[3] = hex2bcd(time->tm_hour);
cmd_buf->data[4] = time->tm_wday;
cmd_buf->data[5] = hex2bcd(time->tm_mday);
- cmd_buf->data[6] = hex2bcd(time->tm_mon) + 1;
+ cmd_buf->data[6] = hex2bcd(time->tm_mon + 1);
cmd_buf->data[7] = hex2bcd(time->tm_year - 100);
}
@@ -421,7 +421,7 @@ int smu_set_rtc_time(struct rtc_time *time, int spinwait)
hex2bcd(time->tm_hour),
time->tm_wday,
hex2bcd(time->tm_mday),
- hex2bcd(time->tm_mon) + 1,
+ hex2bcd(time->tm_mon + 1),
hex2bcd(time->tm_year - 100));
if (rc)
return rc;
next reply other threads:[~2026-11-24 13:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 13:23 Thorsten Blum [this message]
2026-11-24 15:46 ` [PATCH] macintosh/smu: Fix BCD encoding of the RTC month Christophe Leroy (CS GROUP)
2026-11-24 18:06 ` Christophe Leroy (CS GROUP)
2026-11-24 22:32 ` Thorsten Blum
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=20261124132342.235824-2-blum@kernel.org \
--to=blum@kernel.org \
--cc=chleroy@kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
--cc=mpe@ellerman.id.au \
--cc=npiggin@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.