aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/device.c
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2016-12-08 12:09:54 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2016-12-09 21:31:11 +0100
commit28a406b1853b2a3a03acccea7c0d8fd362f41443 (patch)
tree6b5b800a6e4d42ad8a6249b10893138c5f71ec83 /src/device.c
parentdevice: make suspend code conditional on CONFIG_PM_SLEEP (diff)
downloadwireguard-monolithic-historical-28a406b1853b2a3a03acccea7c0d8fd362f41443.tar.xz
wireguard-monolithic-historical-28a406b1853b2a3a03acccea7c0d8fd362f41443.zip
device: traditional if is cleaner than switch for this small
This also generates identical assembly.
Diffstat (limited to 'src/device.c')
-rw-r--r--src/device.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/device.c b/src/device.c
index efa2ee8..1504169 100644
--- a/src/device.c
+++ b/src/device.c
@@ -68,9 +68,7 @@ static int clear_noise_peer(struct wireguard_peer *peer, void *data)
static int suspending_clear_noise_peers(struct notifier_block *nb, unsigned long action, void *data)
{
struct wireguard_device *wg = container_of(nb, struct wireguard_device, clear_peers_on_suspend);
- switch (action) {
- case PM_HIBERNATION_PREPARE:
- case PM_SUSPEND_PREPARE:
+ if (action == PM_HIBERNATION_PREPARE || action == PM_SUSPEND_PREPARE) {
peer_for_each(wg, clear_noise_peer, NULL);
rcu_barrier();
}