aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bonding/bond_sysfs.c
diff options
context:
space:
mode:
authorVeaceslav Falico <vfalico@redhat.com>2013-09-25 03:20:21 -0400
committerDavid S. Miller <davem@davemloft.net>2013-09-26 16:02:06 -0400
commit0965a1f3f8757a2c20a16a83bc18279009d79a26 (patch)
treedd7b1c154e8b5e01f31422ebdf3c27df8b583780 /drivers/net/bonding/bond_sysfs.c
parentb386c58b85b23c3a73baa014d01d2943ca8260cd (diff)
bonding: add bond_has_slaves() and use it
Currently we verify if we have slaves by checking if bond->slave_list is empty. Create a define bond_has_slaves() and use it, a bit more readable and easier to change in the future. 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>
Diffstat (limited to 'drivers/net/bonding/bond_sysfs.c')
-rw-r--r--drivers/net/bonding/bond_sysfs.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
index e747415b5cb0..04d95d6f6c63 100644
--- a/drivers/net/bonding/bond_sysfs.c
+++ b/drivers/net/bonding/bond_sysfs.c
@@ -327,7 +327,7 @@ static ssize_t bonding_store_mode(struct device *d,
327 goto out; 327 goto out;
328 } 328 }
329 329
330 if (!list_empty(&bond->slave_list)) { 330 if (bond_has_slaves(bond)) {
331 pr_err("unable to update mode of %s because it has slaves.\n", 331 pr_err("unable to update mode of %s because it has slaves.\n",
332 bond->dev->name); 332 bond->dev->name);
333 ret = -EPERM; 333 ret = -EPERM;
@@ -523,7 +523,7 @@ static ssize_t bonding_store_fail_over_mac(struct device *d,
523 if (!rtnl_trylock()) 523 if (!rtnl_trylock())
524 return restart_syscall(); 524 return restart_syscall();
525 525
526 if (!list_empty(&bond->slave_list)) { 526 if (bond_has_slaves(bond)) {
527 pr_err("%s: Can't alter fail_over_mac with slaves in bond.\n", 527 pr_err("%s: Can't alter fail_over_mac with slaves in bond.\n",
528 bond->dev->name); 528 bond->dev->name);
529 ret = -EPERM; 529 ret = -EPERM;