mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-25 01:33:26 -04:00
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>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user