* [PATCH] rtc: isl1208: Fix incorrect logic in isl1208_set_xtoscb()
@ 2023-08-17 16:10 Biju Das
2023-08-18 7:02 ` Pavel Machek
2023-08-27 21:49 ` Alexandre Belloni
0 siblings, 2 replies; 3+ messages in thread
From: Biju Das @ 2023-08-17 16:10 UTC (permalink / raw)
To: Alessandro Zummo, Alexandre Belloni
Cc: Biju Das, linux-rtc, Geert Uytterhoeven, Pavel Machek,
Prabhakar Mahadev Lad, linux-renesas-soc
The XTOSCB bit is not bit 0, but xtosb_val is either 0 or 1. If it is 1,
test will never succeed. Fix this issue by using double negation.
While at it, remove unnecessary blank line from probe().
Reported-by: Pavel Machek <pavel@denx.de>
Closes: https://lore.kernel.org/all/ZN4BgzG2xmzOzdFZ@duo.ucw.cz/
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
drivers/rtc/rtc-isl1208.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/rtc/rtc-isl1208.c b/drivers/rtc/rtc-isl1208.c
index 712ca652d6d3..e50c23ee1646 100644
--- a/drivers/rtc/rtc-isl1208.c
+++ b/drivers/rtc/rtc-isl1208.c
@@ -188,7 +188,7 @@ isl1208_i2c_validate_client(struct i2c_client *client)
static int isl1208_set_xtoscb(struct i2c_client *client, int sr, int xtosb_val)
{
/* Do nothing if bit is already set to desired value */
- if ((sr & ISL1208_REG_SR_XTOSCB) == xtosb_val)
+ if (!!(sr & ISL1208_REG_SR_XTOSCB) == xtosb_val)
return 0;
if (xtosb_val)
@@ -944,7 +944,6 @@ isl1208_probe(struct i2c_client *client)
rc = isl1208_setup_irq(client, client->irq);
if (rc)
return rc;
-
} else {
clear_bit(RTC_FEATURE_UPDATE_INTERRUPT, isl1208->rtc->features);
}
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] rtc: isl1208: Fix incorrect logic in isl1208_set_xtoscb()
2023-08-17 16:10 [PATCH] rtc: isl1208: Fix incorrect logic in isl1208_set_xtoscb() Biju Das
@ 2023-08-18 7:02 ` Pavel Machek
2023-08-27 21:49 ` Alexandre Belloni
1 sibling, 0 replies; 3+ messages in thread
From: Pavel Machek @ 2023-08-18 7:02 UTC (permalink / raw)
To: Biju Das
Cc: Alessandro Zummo, Alexandre Belloni, linux-rtc,
Geert Uytterhoeven, Pavel Machek, Prabhakar Mahadev Lad,
linux-renesas-soc
[-- Attachment #1: Type: text/plain, Size: 1151 bytes --]
On Thu 2023-08-17 17:10:38, Biju Das wrote:
> The XTOSCB bit is not bit 0, but xtosb_val is either 0 or 1. If it is 1,
> test will never succeed. Fix this issue by using double negation.
>
> While at it, remove unnecessary blank line from probe().
Reviewed-by: Pavel Machek <pavel@denx.de>
Thank you!
Best regards,
Pavel
> +++ b/drivers/rtc/rtc-isl1208.c
> @@ -188,7 +188,7 @@ isl1208_i2c_validate_client(struct i2c_client *client)
> static int isl1208_set_xtoscb(struct i2c_client *client, int sr, int xtosb_val)
> {
> /* Do nothing if bit is already set to desired value */
> - if ((sr & ISL1208_REG_SR_XTOSCB) == xtosb_val)
> + if (!!(sr & ISL1208_REG_SR_XTOSCB) == xtosb_val)
> return 0;
>
> if (xtosb_val)
> @@ -944,7 +944,6 @@ isl1208_probe(struct i2c_client *client)
> rc = isl1208_setup_irq(client, client->irq);
> if (rc)
> return rc;
> -
> } else {
> clear_bit(RTC_FEATURE_UPDATE_INTERRUPT, isl1208->rtc->features);
> }
--
DENX Software Engineering GmbH, Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] rtc: isl1208: Fix incorrect logic in isl1208_set_xtoscb()
2023-08-17 16:10 [PATCH] rtc: isl1208: Fix incorrect logic in isl1208_set_xtoscb() Biju Das
2023-08-18 7:02 ` Pavel Machek
@ 2023-08-27 21:49 ` Alexandre Belloni
1 sibling, 0 replies; 3+ messages in thread
From: Alexandre Belloni @ 2023-08-27 21:49 UTC (permalink / raw)
To: Alessandro Zummo, Biju Das
Cc: linux-rtc, Geert Uytterhoeven, Pavel Machek,
Prabhakar Mahadev Lad, linux-renesas-soc
On Thu, 17 Aug 2023 17:10:38 +0100, Biju Das wrote:
> The XTOSCB bit is not bit 0, but xtosb_val is either 0 or 1. If it is 1,
> test will never succeed. Fix this issue by using double negation.
>
> While at it, remove unnecessary blank line from probe().
>
>
Applied, thanks!
[1/1] rtc: isl1208: Fix incorrect logic in isl1208_set_xtoscb()
commit: f45d32d2cd183c09b6c9aa8689a91d6f2760b557
Best regards,
--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-08-27 21:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-17 16:10 [PATCH] rtc: isl1208: Fix incorrect logic in isl1208_set_xtoscb() Biju Das
2023-08-18 7:02 ` Pavel Machek
2023-08-27 21:49 ` 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).