mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] rtc: abx80x: fix the RTC_VL_CLR clearing all status flags
@ 2026-04-15 16:06 Antoni Pokusinski
  2026-06-24 21:15 ` Alexandre Belloni
  0 siblings, 1 reply; 2+ messages in thread
From: Antoni Pokusinski @ 2026-04-15 16:06 UTC (permalink / raw)
  To: alexandre.belloni; +Cc: marex, linux-rtc, linux-kernel, Antoni Pokusinski

The RTC_VL_CLR ioctl intends to clear only the battery low flag (BLF),
however the current implementation writes 0 to the status register,
clearing all status bits.

Fix this by writing back the masked status value so that only BLF is
cleared, preserving other status flags.

Fixes: ffe1c5a2d427 ("rtc: abx80x: Implement RTC_VL_READ,CLR ioctls")
Signed-off-by: Antoni Pokusinski <apokusinski01@gmail.com>
---
 drivers/rtc/rtc-abx80x.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-abx80x.c b/drivers/rtc/rtc-abx80x.c
index 3fee27914ba8..5c2424a00b7e 100644
--- a/drivers/rtc/rtc-abx80x.c
+++ b/drivers/rtc/rtc-abx80x.c
@@ -545,7 +545,8 @@ static int abx80x_ioctl(struct device *dev, unsigned int cmd, unsigned long arg)
 
 		status &= ~ABX8XX_STATUS_BLF;
 
-		tmp = i2c_smbus_write_byte_data(client, ABX8XX_REG_STATUS, 0);
+		tmp = i2c_smbus_write_byte_data(client, ABX8XX_REG_STATUS,
+						status);
 		if (tmp < 0)
 			return tmp;
 
-- 
2.53.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] rtc: abx80x: fix the RTC_VL_CLR clearing all status flags
  2026-04-15 16:06 [PATCH] rtc: abx80x: fix the RTC_VL_CLR clearing all status flags Antoni Pokusinski
@ 2026-06-24 21:15 ` Alexandre Belloni
  0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Belloni @ 2026-06-24 21:15 UTC (permalink / raw)
  To: Antoni Pokusinski; +Cc: marex, linux-rtc, linux-kernel

On Wed, 15 Apr 2026 18:06:11 +0200, Antoni Pokusinski wrote:
> The RTC_VL_CLR ioctl intends to clear only the battery low flag (BLF),
> however the current implementation writes 0 to the status register,
> clearing all status bits.
> 
> Fix this by writing back the masked status value so that only BLF is
> cleared, preserving other status flags.
> 
> [...]

Applied, thanks!

[1/1] rtc: abx80x: fix the RTC_VL_CLR clearing all status flags
      https://git.kernel.org/abelloni/c/419719c51425

Best regards,

-- 
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-06-24 21:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-04-15 16:06 [PATCH] rtc: abx80x: fix the RTC_VL_CLR clearing all status flags Antoni Pokusinski
2026-06-24 21:15 ` Alexandre Belloni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®