Skip to content

Commit

Permalink
bridge: Turn flag change macro into a function.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Vlad Yasevich authored and David S. Miller committed May 16, 2014
1 parent 4c30b52 commit 63c3a62
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions net/bridge/br_sysfs_if.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit 63c3a62

Please sign in to comment.