diff options
author | Nikolay Aleksandrov <nikolay@redhat.com> | 2014-01-22 14:53:33 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-01-23 00:38:43 +0100 |
commit | 388d3a6d4aa356b885bcd023c185060df9ea2484 (patch) | |
tree | 4d48b059fc62aac5d47907eca55cc1f10379636c /drivers/net/bonding/bond_sysfs.c | |
parent | bonding: convert primary to use the new option API (diff) | |
download | linux-388d3a6d4aa356b885bcd023c185060df9ea2484.tar.xz linux-388d3a6d4aa356b885bcd023c185060df9ea2484.zip |
bonding: convert primary_reselect to use the new option API
This patch adds the necessary changes so primary_reselect would use
the new bonding option API.
Signed-off-by: Nikolay Aleksandrov <nikolay@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.c | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index 10c58ef4876d..7f307bf096d1 100644 --- a/drivers/net/bonding/bond_sysfs.c +++ b/drivers/net/bonding/bond_sysfs.c @@ -729,35 +729,27 @@ static ssize_t bonding_show_primary_reselect(struct device *d, char *buf) { struct bonding *bond = to_bond(d); + struct bond_opt_value *val; + + val = bond_opt_get_val(BOND_OPT_PRIMARY_RESELECT, + bond->params.primary_reselect); return sprintf(buf, "%s %d\n", - pri_reselect_tbl[bond->params.primary_reselect].modename, - bond->params.primary_reselect); + val->string, bond->params.primary_reselect); } static ssize_t bonding_store_primary_reselect(struct device *d, struct device_attribute *attr, const char *buf, size_t count) { - int new_value, ret; struct bonding *bond = to_bond(d); + int ret; - new_value = bond_parse_parm(buf, pri_reselect_tbl); - if (new_value < 0) { - pr_err("%s: Ignoring invalid primary_reselect value %.*s.\n", - bond->dev->name, - (int) strlen(buf) - 1, buf); - return -EINVAL; - } - - if (!rtnl_trylock()) - return restart_syscall(); - - ret = bond_option_primary_reselect_set(bond, new_value); + ret = bond_opt_tryset_rtnl(bond, BOND_OPT_PRIMARY_RESELECT, + (char *)buf); if (!ret) ret = count; - rtnl_unlock(); return ret; } static DEVICE_ATTR(primary_reselect, S_IRUGO | S_IWUSR, |