linux-rtc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rtc: pcf85363: fix wrong mask/val parameters in regmap_update_bits call
@ 2023-10-13 14:34 Javier Carrasco
  2023-10-15 21:02 ` Alexandre Belloni
  0 siblings, 1 reply; 2+ messages in thread
From: Javier Carrasco @ 2023-10-13 14:34 UTC (permalink / raw)
  To: Alessandro Zummo, Alexandre Belloni
  Cc: linux-rtc, linux-kernel, Javier Carrasco

The current implementation passes PIN_IO_INTA_OUT (2) as a mask and
PIN_IO_INTAPM (GENMASK(1, 0)) as a value.
Swap the variables to assign mask and value the right way.

This error was first introduced with the alarm support. For better or
worse it worked as expected because 0x02 was applied as a mask to 0x03,
resulting 0x02 anyway. This will of course not work for any other value.

Fixes: e5aac267a10a ("rtc: pcf85363: add alarm support")
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
---
 drivers/rtc/rtc-pcf85363.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-pcf85363.c b/drivers/rtc/rtc-pcf85363.c
index 06194674d71c..540042b9eec8 100644
--- a/drivers/rtc/rtc-pcf85363.c
+++ b/drivers/rtc/rtc-pcf85363.c
@@ -438,7 +438,7 @@ static int pcf85363_probe(struct i2c_client *client)
 	if (client->irq > 0 || wakeup_source) {
 		regmap_write(pcf85363->regmap, CTRL_FLAGS, 0);
 		regmap_update_bits(pcf85363->regmap, CTRL_PIN_IO,
-				   PIN_IO_INTA_OUT, PIN_IO_INTAPM);
+				   PIN_IO_INTAPM, PIN_IO_INTA_OUT);
 	}
 
 	if (client->irq > 0) {

---
base-commit: 10a6e5feccb877c3c75ad11d27942ad52c24815f
change-id: 20231013-topic-pcf85363_regmap_update_bits-77b3877fa1fa

Best regards,
-- 
Javier Carrasco <javier.carrasco.cruz@gmail.com>


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

* Re: [PATCH] rtc: pcf85363: fix wrong mask/val parameters in regmap_update_bits call
  2023-10-13 14:34 [PATCH] rtc: pcf85363: fix wrong mask/val parameters in regmap_update_bits call Javier Carrasco
@ 2023-10-15 21:02 ` Alexandre Belloni
  0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Belloni @ 2023-10-15 21:02 UTC (permalink / raw)
  To: Alessandro Zummo, Javier Carrasco; +Cc: linux-rtc, linux-kernel


On Fri, 13 Oct 2023 16:34:21 +0200, Javier Carrasco wrote:
> The current implementation passes PIN_IO_INTA_OUT (2) as a mask and
> PIN_IO_INTAPM (GENMASK(1, 0)) as a value.
> Swap the variables to assign mask and value the right way.
> 
> This error was first introduced with the alarm support. For better or
> worse it worked as expected because 0x02 was applied as a mask to 0x03,
> resulting 0x02 anyway. This will of course not work for any other value.
> 
> [...]

Applied, thanks!

[1/1] rtc: pcf85363: fix wrong mask/val parameters in regmap_update_bits call
      commit: 2be36c09b6b07306be33519e1aa70d2e2a2161bb

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:[~2023-10-15 21:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-13 14:34 [PATCH] rtc: pcf85363: fix wrong mask/val parameters in regmap_update_bits call Javier Carrasco
2023-10-15 21:02 ` Alexandre Belloni

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 NNTP newsgroup(s).