Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

bridge: Turn flag change macro into a function.

Turn the flag change macro into a function to allow
easier updates and to reduce space.

Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Vlad Yasevich <vyasevic@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Vlad Yasevich and committed by
David S. Miller
63c3a622 4c30b525

+17 -10
+17 -10
net/bridge/br_sysfs_if.c
··· 41 41 } \ 42 42 static int store_##_name(struct net_bridge_port *p, unsigned long v) \ 43 43 { \ 44 - unsigned long flags = p->flags; \ 45 - if (v) \ 46 - flags |= _mask; \ 47 - else \ 48 - flags &= ~_mask; \ 49 - if (flags != p->flags) { \ 50 - p->flags = flags; \ 51 - br_ifinfo_notify(RTM_NEWLINK, p); \ 52 - } \ 53 - return 0; \ 44 + return store_flag(p, v, _mask); \ 54 45 } \ 55 46 static BRPORT_ATTR(_name, S_IRUGO | S_IWUSR, \ 56 47 show_##_name, store_##_name) 57 48 49 + static int store_flag(struct net_bridge_port *p, unsigned long v, 50 + unsigned long mask) 51 + { 52 + unsigned long flags = p->flags; 53 + 54 + if (v) 55 + flags |= mask; 56 + else 57 + flags &= ~mask; 58 + 59 + if (flags != p->flags) { 60 + p->flags = flags; 61 + br_ifinfo_notify(RTM_NEWLINK, p); 62 + } 63 + return 0; 64 + } 58 65 59 66 static ssize_t show_path_cost(struct net_bridge_port *p, char *buf) 60 67 {