From: sashiko-bot@kernel.org
To: "Antoni Pokusinski" <apokusinski01@gmail.com>
Cc: robh@kernel.org, linux-rtc@vger.kernel.org,
devicetree@vger.kernel.org,
"Alexandre Belloni" <alexandre.belloni@bootlin.com>,
conor+dt@kernel.org
Subject: Re: [PATCH v7 4/9] rtc: abx80x: properly handle shared IRQs
Date: Wed, 16 Sep 2026 21:05:27 +0000 [thread overview]
Message-ID: <20260916210527.CF14B1F0089A@smtp.kernel.org> (raw)
In-Reply-To: <20260916205138.16771-5-apokusinski01@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] rtc: abx80x: race condition loses interrupts due to flawed W0C status register clearing
--
commit 27cfcb7135851594344aa538f01f8ef1328d2392
Author: Antoni Pokusinski <apokusinski01@gmail.com>
rtc: abx80x: properly handle shared IRQs
This commit updates the abx80x RTC interrupt handler to only return
IRQ_HANDLED and clear the status register when the alarm or watchdog flags
are set. It aims to properly support IRQF_SHARED by returning IRQ_NONE
for unrelated interrupts.
> diff --git a/drivers/rtc/rtc-abx80x.c b/drivers/rtc/rtc-abx80x.c
> --- a/drivers/rtc/rtc-abx80x.c
> +++ b/drivers/rtc/rtc-abx80x.c
[ ... ]
> @@ -284,9 +291,15 @@ static irqreturn_t abx80x_handle_irq(int irq, void *dev_id)
> if (status & ABX8XX_STATUS_WDT)
> dev_alert(&client->dev, "watchdog timeout interrupt.\n");
>
> - i2c_smbus_write_byte_data(client, ABX8XX_REG_STATUS, 0);
> + status_flags_clear = status & (ABX8XX_STATUS_AF | ABX8XX_STATUS_WDT);
>
> - return IRQ_HANDLED;
> + if (status_flags_clear) {
> + i2c_smbus_write_byte_data(client, ABX8XX_REG_STATUS,
> + status & ~status_flags_clear);
[Severity: High]
Does this logic introduce a race condition that loses late-arriving interrupts
in abx80x_handle_irq()?
Because the ABX8XX_REG_STATUS register is W0C (write-0-to-clear), any bit
written as 0 will be cleared in hardware.
The expression status & ~status_flags_clear forces a 0 for all bits that
were 0 during the initial read. If a new hardware interrupt asserts between
the read and this write, its status bit will be newly set to 1 in hardware.
However, writing back the old status value forces a 0 for that new bit,
silently clearing it and losing the event.
To preserve unhandled or newly asserted bits, the correct write value for a
W0C register is ~status_flags_clear instead.
> + return IRQ_HANDLED;
> + }
> +
> + return IRQ_NONE;
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260916205138.16771-1-apokusinski01@gmail.com?part=4
next prev parent reply other threads:[~2026-09-16 21:05 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-16 20:51 [PATCH v7 0/9] rtc: abx80x: add support for abx81x Antoni Pokusinski
2026-09-16 20:51 ` [PATCH v7 1/9] dt-bindings: rtc: abx80x: document ABX81X RTCs Antoni Pokusinski
2026-09-16 20:59 ` sashiko-bot
2026-09-16 20:51 ` [PATCH v7 2/9] rtc: abx80x: fix error check after i2c_smbus_read in read_alarm() Antoni Pokusinski
2026-09-16 21:01 ` sashiko-bot
2026-09-16 20:51 ` [PATCH v7 3/9] rtc: abx80x: add mutex protection for register writes Antoni Pokusinski
2026-09-16 21:02 ` sashiko-bot
2026-09-16 20:51 ` [PATCH v7 4/9] rtc: abx80x: properly handle shared IRQs Antoni Pokusinski
2026-09-16 21:05 ` sashiko-bot [this message]
2026-09-17 18:00 ` Antoni Pokusinski
2026-09-16 20:51 ` [PATCH v7 5/9] rtc: abx80x: add irq to struct abx80x_priv Antoni Pokusinski
2026-09-16 20:59 ` sashiko-bot
2026-09-16 20:51 ` [PATCH v7 6/9] rtc: abx80x: use regmap instead of I2C specific API Antoni Pokusinski
2026-09-16 21:05 ` sashiko-bot
2026-09-16 20:51 ` [PATCH v7 7/9] rtc: abx80x: replace read-modify-write pattern with regmap helpers Antoni Pokusinski
2026-09-16 21:05 ` sashiko-bot
2026-09-17 18:03 ` Antoni Pokusinski
2026-09-16 20:51 ` [PATCH v7 8/9] rtc: abx80x: create abx80x_i2c_probe() Antoni Pokusinski
2026-09-16 21:07 ` sashiko-bot
2026-09-16 20:51 ` [PATCH v7 9/9] rtc: abx80x: add support for ABX81X Antoni Pokusinski
2026-09-16 21:06 ` sashiko-bot
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=20260916210527.CF14B1F0089A@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox