summaryrefslogtreecommitdiffstats
path: root/drivers/net/bonding/bond_procfs.c
diff options
context:
space:
mode:
authornikolay@redhat.com <nikolay@redhat.com>2013-08-01 16:54:47 +0200
committerDavid S. Miller <davem@davemloft.net>2013-08-01 16:42:01 -0700
commitdec1e90e8c7157a527faad95023d96dbc114fbac (patch)
treee25bbe042e4f2e525c08bac512e22bb43c619b0b /drivers/net/bonding/bond_procfs.c
parent439677d766ba9095e5afc4a30147f65bc363b6e7 (diff)
downloadlinux-dec1e90e8c7157a527faad95023d96dbc114fbac.tar.gz
linux-dec1e90e8c7157a527faad95023d96dbc114fbac.tar.bz2
linux-dec1e90e8c7157a527faad95023d96dbc114fbac.zip
bonding: convert to list API and replace bond's custom list
This patch aims to remove struct bonding's first_slave and struct slave's next and prev pointers, and replace them with the standard Linux list API. The old macros are converted to list API as well and some new primitives are available now. The checks if there're slaves that used slave_cnt have been replaced by the list_empty macro. Also a few small style fixes, changing longest -> shortest line in local variable declarations, leaving an empty line before return and removing unnecessary brackets. This is the first step to gradual RCU conversion. Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bonding/bond_procfs.c')
-rw-r--r--drivers/net/bonding/bond_procfs.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/net/bonding/bond_procfs.c b/drivers/net/bonding/bond_procfs.c
index 4060d41f0ee7..20a6ee25bb63 100644
--- a/drivers/net/bonding/bond_procfs.c
+++ b/drivers/net/bonding/bond_procfs.c
@@ -12,7 +12,6 @@ static void *bond_info_seq_start(struct seq_file *seq, loff_t *pos)
struct bonding *bond = seq->private;
loff_t off = 0;
struct slave *slave;
- int i;
/* make sure the bond won't be taken away */
rcu_read_lock();
@@ -21,10 +20,9 @@ static void *bond_info_seq_start(struct seq_file *seq, loff_t *pos)
if (*pos == 0)
return SEQ_START_TOKEN;
- bond_for_each_slave(bond, slave, i) {
+ bond_for_each_slave(bond, slave)
if (++off == *pos)
return slave;
- }
return NULL;
}
@@ -36,11 +34,13 @@ static void *bond_info_seq_next(struct seq_file *seq, void *v, loff_t *pos)
++*pos;
if (v == SEQ_START_TOKEN)
- return bond->first_slave;
+ return bond_first_slave(bond);
- slave = slave->next;
+ if (bond_is_last_slave(bond, slave))
+ return NULL;
+ slave = bond_next_slave(bond, slave);
- return (slave == bond->first_slave) ? NULL : slave;
+ return slave;
}
static void bond_info_seq_stop(struct seq_file *seq, void *v)