From: sashiko-bot@kernel.org
To: "Antoni Pokusinski" <apokusinski01@gmail.com>
Cc: linux-rtc@vger.kernel.org, robh@kernel.org,
devicetree@vger.kernel.org, conor+dt@kernel.org,
"Alexandre Belloni" <alexandre.belloni@bootlin.com>
Subject: Re: [PATCH v5 9/9] rtc: abx80x: add support for ABX81X
Date: Tue, 11 Aug 2026 20:03:54 +0000 [thread overview]
Message-ID: <20260811200355.40B981F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260811194034.28937-10-apokusinski01@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Read-modify-write (RMW) operations on the W0C (write-zero-to-clear) status register cause lost interrupts.
--
--- Patch [9]: [PATCH v5 9/9] rtc: abx80x: add support for ABX81X ---
commit de21e840f75a86e42ad746c99077b6acf5f3e1fb
Author: Antoni Pokusinski <apokusinski01@gmail.com>
rtc: abx80x: add support for ABX81X
Abracon ABX81X is a family of RTCs with SPI interface featuring
the same functionalities as the ABX80X I2C clocks.
> diff --git a/drivers/rtc/rtc-abx80x.c b/drivers/rtc/rtc-abx80x.c
> index 08b22c0676995..7145de876b50b 100644
> --- a/drivers/rtc/rtc-abx80x.c
> +++ b/drivers/rtc/rtc-abx80x.c
> @@ -1,7 +1,7 @@
> // SPDX-License-Identifier: GPL-2.0
> /*
> - * A driver for the I2C members of the Abracon AB x8xx RTC family,
> - * and compatible: AB 1805 and AB 0805
> + * A driver for the I2C and SPI members of the Abracon AB x8xx RTC family,
> + * and compatible: AB 1805, AB 0805, AB 1815 and AB 0815
[ ... ]
While reviewing this patch, I noticed a pre-existing issue in the driver
that might cause lost interrupts.
drivers/rtc/rtc-abx80x.c:abx80x_handle_irq() {
[ ... ]
if (handled == IRQ_HANDLED)
regmap_write(priv->regmap, ABX8XX_REG_STATUS,
status & ~(ABX8XX_STATUS_AF | ABX8XX_STATUS_WDT));
[ ... ]
}
[Severity: High]
This isn't a bug introduced by this patch, but does this write inadvertently
clear newly-asserted interrupts?
The ABX8XX_REG_STATUS register uses a 'Write 0 to Clear' (W0C) mechanism,
where writing 0 clears a bit and writing 1 preserves it. Because the code
bitwise-ANDs the previously read status, it writes 0 to any bit that was
0 during the read.
If a hardware event asserts a flag between the read and this write, the
write of 0 will clear the new event before it is handled.
[ ... ]
drivers/rtc/rtc-abx80x.c:abx80x_ioctl() {
[ ... ]
case RTC_VL_CLR:
scoped_guard(mutex, &priv->lock) {
err = regmap_update_bits(priv->regmap, ABX8XX_REG_STATUS,
ABX8XX_STATUS_BLF, 0);
}
[ ... ]
}
[Severity: High]
This is also a pre-existing issue, but does this read-modify-write operation
expose all other W0C flags to the exact same race condition?
Using regmap_update_bits to clear the BLF bit performs a read-modify-write
and writes 0 to all other unasserted bits, which could cause them to be lost
if they were asserted right after the read phase.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260811194034.28937-1-apokusinski01@gmail.com?part=9
prev parent reply other threads:[~2026-08-11 20:03 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-11 19:40 [PATCH v5 0/9] rtc: abx80x: add support for abx81x Antoni Pokusinski
2026-08-11 19:40 ` [PATCH v5 1/9] dt-bindings: rtc: abx80x: document ABX81X RTCs Antoni Pokusinski
2026-08-11 19:48 ` sashiko-bot
2026-08-11 19:40 ` [PATCH v5 2/9] rtc: abx80x: fix error check after i2c_smbus_read in read_alarm() Antoni Pokusinski
2026-08-11 19:55 ` sashiko-bot
2026-08-11 19:40 ` [PATCH v5 3/9] rtc: abx80x: add mutex protection for register writes Antoni Pokusinski
2026-08-11 19:56 ` sashiko-bot
2026-08-11 19:40 ` [PATCH v5 4/9] rtc: abx80x: properly handle shared IRQs Antoni Pokusinski
2026-08-11 19:53 ` sashiko-bot
2026-08-11 19:40 ` [PATCH v5 5/9] rtc: abx80x: add irq to struct abx80x_priv Antoni Pokusinski
2026-08-11 19:51 ` sashiko-bot
2026-08-11 19:40 ` [PATCH v5 6/9] rtc: abx80x: use regmap instead of I2C specific API Antoni Pokusinski
2026-08-11 19:55 ` sashiko-bot
2026-08-11 19:40 ` [PATCH v5 7/9] rtc: abx80x: replace read-modify-write pattern with regmap helpers Antoni Pokusinski
2026-08-11 19:56 ` sashiko-bot
2026-08-11 19:40 ` [PATCH v5 8/9] rtc: abx80x: create abx80x_i2c_probe() Antoni Pokusinski
2026-08-11 19:54 ` sashiko-bot
2026-08-11 19:40 ` [PATCH v5 9/9] rtc: abx80x: add support for ABX81X Antoni Pokusinski
2026-08-11 20:03 ` sashiko-bot [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=20260811200355.40B981F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=alexandre.belloni@bootlin.com \
--cc=apokusinski01@gmail.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=linux-rtc@vger.kernel.org \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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.