Commit cc0be1ad authored by Christophe JAILLET's avatar Christophe JAILLET Committed by David S. Miller

net: bridge: Slightly optimize 'find_portno()'

The 'inuse' bitmap is local to this function. So we can use the
non-atomic '__set_bit()' to save a few cycles.

While at it, also remove some useless {}.
Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: default avatarNikolay Aleksandrov <nikolay@nvidia.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent cb3ef7b0
......@@ -397,10 +397,10 @@ static int find_portno(struct net_bridge *br)
if (!inuse)
return -ENOMEM;
set_bit(0, inuse); /* zero is reserved */
list_for_each_entry(p, &br->port_list, list) {
set_bit(p->port_no, inuse);
}
__set_bit(0, inuse); /* zero is reserved */
list_for_each_entry(p, &br->port_list, list)
__set_bit(p->port_no, inuse);
index = find_first_zero_bit(inuse, BR_MAX_PORTS);
bitmap_free(inuse);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment