diff options
author | Nikolay Aleksandrov <nikolay@redhat.com> | 2014-01-22 14:53:29 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-01-22 15:38:43 -0800 |
commit | 9e5f5eebe765b340af0318dba261e5de0f2aaf32 (patch) | |
tree | 1a2e1854202ee94bd52f7c83dcdde91f41297e7b /drivers/net/bonding/bond_sysfs.c | |
parent | 633ddc9e9bafd168861dee1000b2c6ff725e85c5 (diff) | |
download | lwn-9e5f5eebe765b340af0318dba261e5de0f2aaf32.tar.gz lwn-9e5f5eebe765b340af0318dba261e5de0f2aaf32.zip |
bonding: convert ad_select to use the new option API
This patch adds the necessary changes so ad_select 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 | 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 3ae9bfd8e65e..02e493ae5173 100644 --- a/drivers/net/bonding/bond_sysfs.c +++ b/drivers/net/bonding/bond_sysfs.c @@ -601,10 +601,11 @@ static ssize_t bonding_show_ad_select(struct device *d, char *buf) { struct bonding *bond = to_bond(d); + struct bond_opt_value *val; - return sprintf(buf, "%s %d\n", - ad_select_tbl[bond->params.ad_select].modename, - bond->params.ad_select); + val = bond_opt_get_val(BOND_OPT_AD_SELECT, bond->params.ad_select); + + return sprintf(buf, "%s %d\n", val->string, bond->params.ad_select); } @@ -612,24 +613,13 @@ static ssize_t bonding_store_ad_select(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, ad_select_tbl); - if (new_value < 0) { - pr_err("%s: Ignoring invalid ad_select value %.*s.\n", - bond->dev->name, (int)strlen(buf) - 1, buf); - return -EINVAL; - } - - if (!rtnl_trylock()) - return restart_syscall(); - - ret = bond_option_ad_select_set(bond, new_value); + ret = bond_opt_tryset_rtnl(bond, BOND_OPT_AD_SELECT, (char *)buf); if (!ret) ret = count; - rtnl_unlock(); return ret; } static DEVICE_ATTR(ad_select, S_IRUGO | S_IWUSR, |