diff options
author | Nikolay Aleksandrov <nikolay@redhat.com> | 2014-01-22 14:53:27 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-01-22 15:38:42 -0800 |
commit | d3131de76b1b1a4d95f145846bd61f96e72f0411 (patch) | |
tree | e78a441b8ece24edd7fb049d67a70a6836b282ca /drivers/net/bonding/bond_sysfs.c | |
parent | e499461275023e20c4aecb6a546e7e213631b99f (diff) | |
download | op-kernel-dev-d3131de76b1b1a4d95f145846bd61f96e72f0411.zip op-kernel-dev-d3131de76b1b1a4d95f145846bd61f96e72f0411.tar.gz |
bonding: convert lacp_rate to use the new option API
This patch adds the necessary changes so lacp_rate would use
the new bonding option API. Also some trivial/style error fixes.
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 | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index b873a88..a0a54d0 100644 --- a/drivers/net/bonding/bond_sysfs.c +++ b/drivers/net/bonding/bond_sysfs.c @@ -548,10 +548,11 @@ static ssize_t bonding_show_lacp(struct device *d, char *buf) { struct bonding *bond = to_bond(d); + struct bond_opt_value *val; - return sprintf(buf, "%s %d\n", - bond_lacp_tbl[bond->params.lacp_fast].modename, - bond->params.lacp_fast); + val = bond_opt_get_val(BOND_OPT_LACP_RATE, bond->params.lacp_fast); + + return sprintf(buf, "%s %d\n", val->string, bond->params.lacp_fast); } static ssize_t bonding_store_lacp(struct device *d, @@ -559,23 +560,12 @@ static ssize_t bonding_store_lacp(struct device *d, const char *buf, size_t count) { struct bonding *bond = to_bond(d); - int new_value, ret; - - new_value = bond_parse_parm(buf, bond_lacp_tbl); - if (new_value < 0) { - pr_err("%s: Ignoring invalid LACP rate value %.*s.\n", - bond->dev->name, (int)strlen(buf) - 1, buf); - return -EINVAL; - } - - if (!rtnl_trylock()) - return restart_syscall(); + int ret; - ret = bond_option_lacp_rate_set(bond, new_value); + ret = bond_opt_tryset_rtnl(bond, BOND_OPT_LACP_RATE, (char *)buf); if (!ret) ret = count; - rtnl_unlock(); return ret; } static DEVICE_ATTR(lacp_rate, S_IRUGO | S_IWUSR, |