From 162288810c9ebd2efb79ee6dc364e266044cac9e Mon Sep 17 00:00:00 2001 From: Nikolay Aleksandrov Date: Wed, 22 Jan 2014 14:53:20 +0100 Subject: bonding: convert arp_validate to use the new option API This patch adds the necessary changes so arp_validate would use the new bonding option API. Also fix some trivial/style errors. Signed-off-by: Nikolay Aleksandrov Signed-off-by: David S. Miller --- drivers/net/bonding/bond_sysfs.c | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) (limited to 'drivers/net/bonding/bond_sysfs.c') diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index d81638c33fdb..e1a4b633013f 100644 --- a/drivers/net/bonding/bond_sysfs.c +++ b/drivers/net/bonding/bond_sysfs.c @@ -325,10 +325,12 @@ static ssize_t bonding_show_arp_validate(struct device *d, char *buf) { struct bonding *bond = to_bond(d); + struct bond_opt_value *val; - return sprintf(buf, "%s %d\n", - arp_validate_tbl[bond->params.arp_validate].modename, - bond->params.arp_validate); + val = bond_opt_get_val(BOND_OPT_ARP_VALIDATE, + bond->params.arp_validate); + + return sprintf(buf, "%s %d\n", val->string, bond->params.arp_validate); } static ssize_t bonding_store_arp_validate(struct device *d, @@ -336,23 +338,12 @@ static ssize_t bonding_store_arp_validate(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, arp_validate_tbl); - if (new_value < 0) { - pr_err("%s: Ignoring invalid arp_validate value %s\n", - bond->dev->name, buf); - return -EINVAL; - } - if (!rtnl_trylock()) - return restart_syscall(); + int ret; - ret = bond_option_arp_validate_set(bond, new_value); + ret = bond_opt_tryset_rtnl(bond, BOND_OPT_ARP_VALIDATE, (char *)buf); if (!ret) ret = count; - rtnl_unlock(); - return ret; } -- cgit