From: Mario Limonciello <mario.limonciello@amd.com>
To: "Mateusz Jończyk" <mat.jonczyk@o2.pl>,
"Alessandro Zummo" <a.zummo@towertech.it>,
"Alexandre Belloni" <alexandre.belloni@bootlin.com>
Cc: "open list:REAL TIME CLOCK (RTC) SUBSYSTEM"
<linux-rtc@vger.kernel.org>,
open list <linux-kernel@vger.kernel.org>,
<linux-pm@vger.kernel.org>, <tobrohl@gmail.com>,
<aalsing@gmail.com>, <Dhaval.Giani@amd.com>, <xmb8dsv4@gmail.com>,
<x86@kernel.org>, <dhaval.giani@gmail.com>,
"Mario Limonciello" <mario.limonciello@amd.com>
Subject: [PATCH v2 1/4] rtc: mc146818-lib: Adjust failure return code for mc146818_get_time()
Date: Mon, 20 Nov 2023 08:15:52 -0600 [thread overview]
Message-ID: <20231120141555.458-2-mario.limonciello@amd.com> (raw)
In-Reply-To: <20231120141555.458-1-mario.limonciello@amd.com>
mc146818_get_time() calls mc146818_avoid_UIP() to avoid fetching the
time while RTC update is in progress (UIP). When this fails, the return
code is -EIO, but actually there was no IO failure.
The reason for the return from mc146818_avoid_UIP() is that the UIP
wasn't cleared in the time period. Adjust the return code to -ETIMEDOUT
to match the behavior.
Cc: stable@vger.kernel.org
Fixes: 2a61b0ac5493 ("rtc: mc146818-lib: refactor mc146818_get_time")
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
v1->v2:
* Add stable and fixes tag
---
drivers/rtc/rtc-mc146818-lib.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/rtc/rtc-mc146818-lib.c b/drivers/rtc/rtc-mc146818-lib.c
index f1c09f1db044..43a28e82674e 100644
--- a/drivers/rtc/rtc-mc146818-lib.c
+++ b/drivers/rtc/rtc-mc146818-lib.c
@@ -138,7 +138,7 @@ int mc146818_get_time(struct rtc_time *time)
if (!mc146818_avoid_UIP(mc146818_get_time_callback, &p)) {
memset(time, 0, sizeof(*time));
- return -EIO;
+ return -ETIMEDOUT;
}
if (!(p.ctrl & RTC_DM_BINARY) || RTC_ALWAYS_BCD)
--
2.34.1
next prev parent reply other threads:[~2023-11-20 14:16 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-20 14:15 [PATCH v2 0/4] Extend time to wait for UIP for some callers Mario Limonciello
2023-11-20 14:15 ` Mario Limonciello [this message]
2023-11-20 14:15 ` [PATCH v2 2/4] rtc: Adjust failure return code for cmos_set_alarm() Mario Limonciello
2023-11-20 14:15 ` [PATCH v2 3/4] rtc: Add support for configuring the UIP timeout for RTC reads Mario Limonciello
2023-11-22 17:06 ` Mateusz Jończyk
2023-11-20 14:15 ` [PATCH v2 4/4] rtc: Extend timeout for waiting for UIP to clear to 1s Mario Limonciello
2023-11-22 17:16 ` Mateusz Jończyk
2023-11-22 16:58 ` [PATCH v2 0/4] Extend time to wait for UIP for some callers Mateusz Jończyk
2023-11-23 8:31 ` Alexandre Belloni
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=20231120141555.458-2-mario.limonciello@amd.com \
--to=mario.limonciello@amd.com \
--cc=Dhaval.Giani@amd.com \
--cc=a.zummo@towertech.it \
--cc=aalsing@gmail.com \
--cc=alexandre.belloni@bootlin.com \
--cc=dhaval.giani@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-rtc@vger.kernel.org \
--cc=mat.jonczyk@o2.pl \
--cc=tobrohl@gmail.com \
--cc=x86@kernel.org \
--cc=xmb8dsv4@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 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 read-only IMAP folder(s) and NNTP newsgroup(s).