bridge: Turn flag change macro into a function.
authorVlad Yasevich <vyasevic@redhat.com>
Fri, 16 May 2014 13:59:15 +0000 (09:59 -0400)
committerDavid S. Miller <davem@davemloft.net>
Fri, 16 May 2014 21:06:32 +0000 (17:06 -0400)
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>
net/bridge/br_sysfs_if.c

index dd595bd7fa820444f6e8c424eb7dd4f307998af2..351af6b36ee1f1219aecb1e5d72552d4b29a4efc 100644 (file)
@@ -41,20 +41,27 @@ static ssize_t show_##_name(struct net_bridge_port *p, char *buf) \
 }                                                              \
 static int store_##_name(struct net_bridge_port *p, unsigned long v) \
 {                                                              \
-       unsigned long flags = p->flags;                         \
-       if (v)                                                  \
-               flags |= _mask;                                 \
-       else                                                    \
-               flags &= ~_mask;                                \
-       if (flags != p->flags) {                                \
-               p->flags = flags;                               \
-               br_ifinfo_notify(RTM_NEWLINK, p);               \
-       }                                                       \
-       return 0;                                               \
+       return store_flag(p, v, _mask);                         \
 }                                                              \
 static BRPORT_ATTR(_name, S_IRUGO | S_IWUSR,                   \
                   show_##_name, store_##_name)
 
+static int store_flag(struct net_bridge_port *p, unsigned long v,
+                     unsigned long mask)
+{
+       unsigned long flags = p->flags;
+
+       if (v)
+               flags |= mask;
+       else
+               flags &= ~mask;
+
+       if (flags != p->flags) {
+               p->flags = flags;
+               br_ifinfo_notify(RTM_NEWLINK, p);
+       }
+       return 0;
+}
 
 static ssize_t show_path_cost(struct net_bridge_port *p, char *buf)
 {