summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSven Eckelmann <sven@narfation.org>2026-05-12 23:03:53 +0300
committerSven Eckelmann <sven@narfation.org>2026-05-29 22:19:21 +0300
commit9550dd11e360ec0c460b13096ceda283601fa5cb (patch)
tree4b75e07d1898c65e683359498c5545397e260850
parentb8fbbfe81d3e9678290923f374d700aa03fa8d4e (diff)
downloadlinux-9550dd11e360ec0c460b13096ceda283601fa5cb.tar.xz
batman-adv: use atomic_xchg() for gw.reselect check
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 <sven@narfation.org>
-rw-r--r--net/batman-adv/gateway_client.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/batman-adv/gateway_client.c b/net/batman-adv/gateway_client.c
index ec743ce39be4..026627c8ba45 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