batadv_gw_election() only needs to test whether gw.reselect was set and
clear it afterwards. Replace the batadv_atomic_dec_not_zero()
[atomic_add_unless(..., -1, 0)] call with atomic_xchg(..., 0) to simplify
the logic and make the intent more explicit.

Signed-off-by: Sven Eckelmann <[email protected]>
---
 net/batman-adv/gateway_client.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/batman-adv/gateway_client.c b/net/batman-adv/gateway_client.c
index a4ab3d44..0fb05469 100644
--- a/net/batman-adv/gateway_client.c
+++ b/net/batman-adv/gateway_client.c
@@ -211,7 +211,7 @@ void batadv_gw_election(struct batadv_priv *bat_priv)
 
        curr_gw = batadv_gw_get_selected_gw_node(bat_priv);
 
-       if (!batadv_atomic_dec_not_zero(&bat_priv->gw.reselect) && curr_gw)
+       if (atomic_xchg(&bat_priv->gw.reselect, 0) == 0 && curr_gw)
                goto out;
 
        /* if gw.reselect is set to 1 it means that a previous call to

---
base-commit: f3fe50814354e157a6740c818c9ba293ff7c2214
change-id: 20260512-gw-reselect-xchg-a0726590e230

Best regards,
--  
Sven Eckelmann <[email protected]>

Reply via email to