Skip to content

Commit e3f0d76

Browse files
committed
net/core: Replace rcu_swap_protected() with rcu_replace_pointer()
This commit replaces the use of rcu_swap_protected() with the more intuitively appealing rcu_replace_pointer() as a step towards removing rcu_swap_protected(). Link: https://lore.kernel.org/lkml/CAHk-=wiAsJLw1egFEE=Z7-GGtM6wcvtyytXZA1+BHqta4gg6Hw@mail.gmail.com/ Reported-by: Linus Torvalds <[email protected]> [ paulmck: From rcu_replace() to rcu_replace_pointer() per Ingo Molnar. ] Signed-off-by: Paul E. McKenney <[email protected]> Cc: "David S. Miller" <[email protected]> Cc: Jiri Pirko <[email protected]> Cc: Eric Dumazet <[email protected]> Cc: Ido Schimmel <[email protected]> Cc: Petr Machata <[email protected]> Cc: Paolo Abeni <[email protected]> Cc: <[email protected]>
1 parent 6092f72 commit e3f0d76

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

net/core/dev.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1288,8 +1288,8 @@ int dev_set_alias(struct net_device *dev, const char *alias, size_t len)
12881288
}
12891289

12901290
mutex_lock(&ifalias_mutex);
1291-
rcu_swap_protected(dev->ifalias, new_alias,
1292-
mutex_is_locked(&ifalias_mutex));
1291+
new_alias = rcu_replace_pointer(dev->ifalias, new_alias,
1292+
mutex_is_locked(&ifalias_mutex));
12931293
mutex_unlock(&ifalias_mutex);
12941294

12951295
if (new_alias)

net/core/sock_reuseport.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,8 +356,8 @@ int reuseport_detach_prog(struct sock *sk)
356356
spin_lock_bh(&reuseport_lock);
357357
reuse = rcu_dereference_protected(sk->sk_reuseport_cb,
358358
lockdep_is_held(&reuseport_lock));
359-
rcu_swap_protected(reuse->prog, old_prog,
360-
lockdep_is_held(&reuseport_lock));
359+
old_prog = rcu_replace_pointer(reuse->prog, old_prog,
360+
lockdep_is_held(&reuseport_lock));
361361
spin_unlock_bh(&reuseport_lock);
362362

363363
if (!old_prog)

0 commit comments

Comments
 (0)