Skip to content

Commit

Permalink
bonding: don't use bond_next_slave() in bond_info_seq_next()
Browse files Browse the repository at this point in the history
We don't need the circular loop there and it's the only current user of
bond_next_slave() - so just use the standard bond_for_each_slave().

CC: Jay Vosburgh <fubar@us.ibm.com>
CC: Andy Gospodarek <andy@greyhouse.net>
Signed-off-by: Veaceslav Falico <vfalico@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Veaceslav Falico authored and David S. Miller committed Sep 28, 2013
1 parent da8f091 commit f965084
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions drivers/net/bonding/bond_procfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,25 @@ static void *bond_info_seq_start(struct seq_file *seq, loff_t *pos)
static void *bond_info_seq_next(struct seq_file *seq, void *v, loff_t *pos)
{
struct bonding *bond = seq->private;
struct slave *slave = v;
struct list_head *iter;
struct slave *slave;
bool found = false;

++*pos;
if (v == SEQ_START_TOKEN)
return bond_first_slave(bond);

if (bond_is_last_slave(bond, slave))
if (bond_is_last_slave(bond, v))
return NULL;
slave = bond_next_slave(bond, slave);

return slave;
bond_for_each_slave(bond, slave, iter) {
if (found)
return slave;
if (slave == v)
found = true;
}

return NULL;
}

static void bond_info_seq_stop(struct seq_file *seq, void *v)
Expand Down

0 comments on commit f965084

Please sign in to comment.