bonding: fix const in options processing
[cascardo/linux.git] / drivers / net / bonding / bond_options.c
index c378784..22800bd 100644 (file)
 #include <linux/inet.h>
 #include "bonding.h"
 
-static struct bond_opt_value bond_mode_tbl[] = {
+static int bond_option_active_slave_set(struct bonding *bond,
+                                       const struct bond_opt_value *newval);
+static int bond_option_miimon_set(struct bonding *bond,
+                                 const struct bond_opt_value *newval);
+static int bond_option_updelay_set(struct bonding *bond,
+                                  const struct bond_opt_value *newval);
+static int bond_option_downdelay_set(struct bonding *bond,
+                                    const struct bond_opt_value *newval);
+static int bond_option_use_carrier_set(struct bonding *bond,
+                                      const struct bond_opt_value *newval);
+static int bond_option_arp_interval_set(struct bonding *bond,
+                                       const struct bond_opt_value *newval);
+static int bond_option_arp_ip_target_add(struct bonding *bond, __be32 target);
+static int bond_option_arp_ip_target_rem(struct bonding *bond, __be32 target);
+static int bond_option_arp_ip_targets_set(struct bonding *bond,
+                                         const struct bond_opt_value *newval);
+static int bond_option_arp_validate_set(struct bonding *bond,
+                                       const struct bond_opt_value *newval);
+static int bond_option_arp_all_targets_set(struct bonding *bond,
+                                          const struct bond_opt_value *newval);
+static int bond_option_primary_set(struct bonding *bond,
+                                  const struct bond_opt_value *newval);
+static int bond_option_primary_reselect_set(struct bonding *bond,
+                                           const struct bond_opt_value *newval);
+static int bond_option_fail_over_mac_set(struct bonding *bond,
+                                        const struct bond_opt_value *newval);
+static int bond_option_xmit_hash_policy_set(struct bonding *bond,
+                                           const struct bond_opt_value *newval);
+static int bond_option_resend_igmp_set(struct bonding *bond,
+                                      const struct bond_opt_value *newval);
+static int bond_option_num_peer_notif_set(struct bonding *bond,
+                                         const struct bond_opt_value *newval);
+static int bond_option_all_slaves_active_set(struct bonding *bond,
+                                            const struct bond_opt_value *newval);
+static int bond_option_min_links_set(struct bonding *bond,
+                                    const struct bond_opt_value *newval);
+static int bond_option_lp_interval_set(struct bonding *bond,
+                                      const struct bond_opt_value *newval);
+static int bond_option_pps_set(struct bonding *bond,
+                              const struct bond_opt_value *newval);
+static int bond_option_lacp_rate_set(struct bonding *bond,
+                                    const struct bond_opt_value *newval);
+static int bond_option_ad_select_set(struct bonding *bond,
+                                    const struct bond_opt_value *newval);
+static int bond_option_queue_id_set(struct bonding *bond,
+                                   const struct bond_opt_value *newval);
+static int bond_option_mode_set(struct bonding *bond,
+                               const struct bond_opt_value *newval);
+static int bond_option_slaves_set(struct bonding *bond,
+                                 const struct bond_opt_value *newval);
+
+
+static const struct bond_opt_value bond_mode_tbl[] = {
        { "balance-rr",    BOND_MODE_ROUNDROBIN,   BOND_VALFLAG_DEFAULT},
        { "active-backup", BOND_MODE_ACTIVEBACKUP, 0},
        { "balance-xor",   BOND_MODE_XOR,          0},
@@ -31,13 +83,13 @@ static struct bond_opt_value bond_mode_tbl[] = {
        { NULL,            -1,                     0},
 };
 
-static struct bond_opt_value bond_pps_tbl[] = {
+static const struct bond_opt_value bond_pps_tbl[] = {
        { "default", 1,         BOND_VALFLAG_DEFAULT},
        { "maxval",  USHRT_MAX, BOND_VALFLAG_MAX},
        { NULL,      -1,        0},
 };
 
-static struct bond_opt_value bond_xmit_hashtype_tbl[] = {
+static const struct bond_opt_value bond_xmit_hashtype_tbl[] = {
        { "layer2",   BOND_XMIT_POLICY_LAYER2, BOND_VALFLAG_DEFAULT},
        { "layer3+4", BOND_XMIT_POLICY_LAYER34, 0},
        { "layer2+3", BOND_XMIT_POLICY_LAYER23, 0},
@@ -46,84 +98,87 @@ static struct bond_opt_value bond_xmit_hashtype_tbl[] = {
        { NULL,       -1,                       0},
 };
 
-static struct bond_opt_value bond_arp_validate_tbl[] = {
-       { "none",   BOND_ARP_VALIDATE_NONE,   BOND_VALFLAG_DEFAULT},
-       { "active", BOND_ARP_VALIDATE_ACTIVE, 0},
-       { "backup", BOND_ARP_VALIDATE_BACKUP, 0},
-       { "all",    BOND_ARP_VALIDATE_ALL,    0},
-       { NULL,     -1,                       0},
+static const struct bond_opt_value bond_arp_validate_tbl[] = {
+       { "none",               BOND_ARP_VALIDATE_NONE,         BOND_VALFLAG_DEFAULT},
+       { "active",             BOND_ARP_VALIDATE_ACTIVE,       0},
+       { "backup",             BOND_ARP_VALIDATE_BACKUP,       0},
+       { "all",                BOND_ARP_VALIDATE_ALL,          0},
+       { "filter",             BOND_ARP_FILTER,                0},
+       { "filter_active",      BOND_ARP_FILTER_ACTIVE,         0},
+       { "filter_backup",      BOND_ARP_FILTER_BACKUP,         0},
+       { NULL,                 -1,                             0},
 };
 
-static struct bond_opt_value bond_arp_all_targets_tbl[] = {
+static const struct bond_opt_value bond_arp_all_targets_tbl[] = {
        { "any", BOND_ARP_TARGETS_ANY, BOND_VALFLAG_DEFAULT},
        { "all", BOND_ARP_TARGETS_ALL, 0},
        { NULL,  -1,                   0},
 };
 
-static struct bond_opt_value bond_fail_over_mac_tbl[] = {
+static const struct bond_opt_value bond_fail_over_mac_tbl[] = {
        { "none",   BOND_FOM_NONE,   BOND_VALFLAG_DEFAULT},
        { "active", BOND_FOM_ACTIVE, 0},
        { "follow", BOND_FOM_FOLLOW, 0},
        { NULL,     -1,              0},
 };
 
-static struct bond_opt_value bond_intmax_tbl[] = {
+static const struct bond_opt_value bond_intmax_tbl[] = {
        { "off",     0,       BOND_VALFLAG_DEFAULT},
        { "maxval",  INT_MAX, BOND_VALFLAG_MAX},
 };
 
-static struct bond_opt_value bond_lacp_rate_tbl[] = {
+static const struct bond_opt_value bond_lacp_rate_tbl[] = {
        { "slow", AD_LACP_SLOW, 0},
        { "fast", AD_LACP_FAST, 0},
        { NULL,   -1,           0},
 };
 
-static struct bond_opt_value bond_ad_select_tbl[] = {
+static const struct bond_opt_value bond_ad_select_tbl[] = {
        { "stable",    BOND_AD_STABLE,    BOND_VALFLAG_DEFAULT},
        { "bandwidth", BOND_AD_BANDWIDTH, 0},
        { "count",     BOND_AD_COUNT,     0},
        { NULL,        -1,                0},
 };
 
-static struct bond_opt_value bond_num_peer_notif_tbl[] = {
+static const struct bond_opt_value bond_num_peer_notif_tbl[] = {
        { "off",     0,   0},
        { "maxval",  255, BOND_VALFLAG_MAX},
        { "default", 1,   BOND_VALFLAG_DEFAULT},
        { NULL,      -1,  0}
 };
 
-static struct bond_opt_value bond_primary_reselect_tbl[] = {
+static const struct bond_opt_value bond_primary_reselect_tbl[] = {
        { "always",  BOND_PRI_RESELECT_ALWAYS,  BOND_VALFLAG_DEFAULT},
        { "better",  BOND_PRI_RESELECT_BETTER,  0},
        { "failure", BOND_PRI_RESELECT_FAILURE, 0},
        { NULL,      -1},
 };
 
-static struct bond_opt_value bond_use_carrier_tbl[] = {
+static const struct bond_opt_value bond_use_carrier_tbl[] = {
        { "off", 0,  0},
        { "on",  1,  BOND_VALFLAG_DEFAULT},
        { NULL,  -1, 0}
 };
 
-static struct bond_opt_value bond_all_slaves_active_tbl[] = {
+static const struct bond_opt_value bond_all_slaves_active_tbl[] = {
        { "off", 0,  BOND_VALFLAG_DEFAULT},
        { "on",  1,  0},
        { NULL,  -1, 0}
 };
 
-static struct bond_opt_value bond_resend_igmp_tbl[] = {
+static const struct bond_opt_value bond_resend_igmp_tbl[] = {
        { "off",     0,   0},
        { "maxval",  255, BOND_VALFLAG_MAX},
        { "default", 1,   BOND_VALFLAG_DEFAULT},
        { NULL,      -1,  0}
 };
 
-static struct bond_opt_value bond_lp_interval_tbl[] = {
+static const struct bond_opt_value bond_lp_interval_tbl[] = {
        { "minval",  1,       BOND_VALFLAG_MIN | BOND_VALFLAG_DEFAULT},
        { "maxval",  INT_MAX, BOND_VALFLAG_MAX},
 };
 
-static struct bond_option bond_opts[] = {
+static const struct bond_option bond_opts[] = {
        [BOND_OPT_MODE] = {
                .id = BOND_OPT_MODE,
                .name = "mode",
@@ -151,7 +206,8 @@ static struct bond_option bond_opts[] = {
                .id = BOND_OPT_ARP_VALIDATE,
                .name = "arp_validate",
                .desc = "validate src/dst of ARP probes",
-               .unsuppmodes = BOND_MODE_ALL_EX(BIT(BOND_MODE_ACTIVEBACKUP)),
+               .unsuppmodes = BIT(BOND_MODE_8023AD) | BIT(BOND_MODE_TLB) |
+                              BIT(BOND_MODE_ALB),
                .values = bond_arp_validate_tbl,
                .set = bond_option_arp_validate_set
        },
@@ -311,9 +367,9 @@ static struct bond_option bond_opts[] = {
 };
 
 /* Searches for a value in opt's values[] table */
-struct bond_opt_value *bond_opt_get_val(unsigned int option, u64 val)
+const struct bond_opt_value *bond_opt_get_val(unsigned int option, u64 val)
 {
-       struct bond_option *opt;
+       const struct bond_option *opt;
        int i;
 
        opt = bond_opt_get(option);
@@ -327,7 +383,7 @@ struct bond_opt_value *bond_opt_get_val(unsigned int option, u64 val)
 }
 
 /* Searches for a value in opt's values[] table which matches the flagmask */
-static struct bond_opt_value *bond_opt_get_flags(const struct bond_option *opt,
+static const struct bond_opt_value *bond_opt_get_flags(const struct bond_option *opt,
                                                 u32 flagmask)
 {
        int i;
@@ -344,7 +400,7 @@ static struct bond_opt_value *bond_opt_get_flags(const struct bond_option *opt,
  */
 static bool bond_opt_check_range(const struct bond_option *opt, u64 val)
 {
-       struct bond_opt_value *minval, *maxval;
+       const struct bond_opt_value *minval, *maxval;
 
        minval = bond_opt_get_flags(opt, BOND_VALFLAG_MIN);
        maxval = bond_opt_get_flags(opt, BOND_VALFLAG_MAX);
@@ -364,11 +420,12 @@ static bool bond_opt_check_range(const struct bond_option *opt, u64 val)
  * or the struct_opt_value that matched. It also strips the new line from
  * @val->string if it's present.
  */
-struct bond_opt_value *bond_opt_parse(const struct bond_option *opt,
-                                     struct bond_opt_value *val)
+const struct bond_opt_value *bond_opt_parse(const struct bond_option *opt,
+                                           struct bond_opt_value *val)
 {
        char *p, valstr[BOND_OPT_MAX_NAMELEN + 1] = { 0, };
-       struct bond_opt_value *tbl, *ret = NULL;
+       const struct bond_opt_value *tbl;
+       const struct bond_opt_value *ret = NULL;
        bool checkval;
        int i, rv;
 
@@ -447,7 +504,7 @@ static int bond_opt_check_deps(struct bonding *bond,
 static void bond_opt_dep_print(struct bonding *bond,
                               const struct bond_option *opt)
 {
-       struct bond_opt_value *modeval;
+       const struct bond_opt_value *modeval;
        struct bond_params *params;
 
        params = &bond->params;
@@ -460,9 +517,9 @@ static void bond_opt_dep_print(struct bonding *bond,
 
 static void bond_opt_error_interpret(struct bonding *bond,
                                     const struct bond_option *opt,
-                                    int error, struct bond_opt_value *val)
+                                    int error, const struct bond_opt_value *val)
 {
-       struct bond_opt_value *minval, *maxval;
+       const struct bond_opt_value *minval, *maxval;
        char *p;
 
        switch (error) {
@@ -473,10 +530,10 @@ static void bond_opt_error_interpret(struct bonding *bond,
                                p = strchr(val->string, '\n');
                                if (p)
                                        *p = '\0';
-                               pr_err("%s: option %s: invalid value (%s).\n",
+                               pr_err("%s: option %s: invalid value (%s)\n",
                                       bond->dev->name, opt->name, val->string);
                        } else {
-                               pr_err("%s: option %s: invalid value (%llu).\n",
+                               pr_err("%s: option %s: invalid value (%llu)\n",
                                       bond->dev->name, opt->name, val->value);
                        }
                }
@@ -484,7 +541,7 @@ static void bond_opt_error_interpret(struct bonding *bond,
                maxval = bond_opt_get_flags(opt, BOND_VALFLAG_MAX);
                if (!maxval)
                        break;
-               pr_err("%s: option %s: allowed values %llu - %llu.\n",
+               pr_err("%s: option %s: allowed values %llu - %llu\n",
                       bond->dev->name, opt->name, minval ? minval->value : 0,
                       maxval->value);
                break;
@@ -492,11 +549,11 @@ static void bond_opt_error_interpret(struct bonding *bond,
                bond_opt_dep_print(bond, opt);
                break;
        case -ENOTEMPTY:
-               pr_err("%s: option %s: unable to set because the bond device has slaves.\n",
+               pr_err("%s: option %s: unable to set because the bond device has slaves\n",
                       bond->dev->name, opt->name);
                break;
        case -EBUSY:
-               pr_err("%s: option %s: unable to set because the bond device is up.\n",
+               pr_err("%s: option %s: unable to set because the bond device is up\n",
                       bond->dev->name, opt->name);
                break;
        default:
@@ -517,7 +574,7 @@ static void bond_opt_error_interpret(struct bonding *bond,
 int __bond_opt_set(struct bonding *bond,
                   unsigned int option, struct bond_opt_value *val)
 {
-       struct bond_opt_value *retval = NULL;
+       const struct bond_opt_value *retval = NULL;
        const struct bond_option *opt;
        int ret = -ENOENT;
 
@@ -572,7 +629,7 @@ int bond_opt_tryset_rtnl(struct bonding *bond, unsigned int option, char *buf)
  * This function checks if option is valid and if so returns a pointer
  * to its entry in the bond_opts[] option array.
  */
-struct bond_option *bond_opt_get(unsigned int option)
+const struct bond_option *bond_opt_get(unsigned int option)
 {
        if (!BOND_OPT_VALID(option))
                return NULL;
@@ -580,7 +637,7 @@ struct bond_option *bond_opt_get(unsigned int option)
        return &bond_opts[option];
 }
 
-int bond_option_mode_set(struct bonding *bond, struct bond_opt_value *newval)
+int bond_option_mode_set(struct bonding *bond, const struct bond_opt_value *newval)
 {
        if (BOND_NO_USES_ARP(newval->value) && bond->params.arp_interval) {
                pr_info("%s: %s mode is incompatible with arp monitoring, start mii monitoring\n",
@@ -589,7 +646,7 @@ int bond_option_mode_set(struct bonding *bond, struct bond_opt_value *newval)
                bond->params.arp_interval = 0;
                /* set miimon to default value */
                bond->params.miimon = BOND_DEFAULT_MIIMON;
-               pr_info("%s: Setting MII monitoring interval to %d.\n",
+               pr_info("%s: Setting MII monitoring interval to %d\n",
                        bond->dev->name, bond->params.miimon);
        }
 
@@ -618,8 +675,8 @@ struct net_device *bond_option_active_slave_get(struct bonding *bond)
        return __bond_option_active_slave_get(bond, bond->curr_active_slave);
 }
 
-int bond_option_active_slave_set(struct bonding *bond,
-                                struct bond_opt_value *newval)
+static int bond_option_active_slave_set(struct bonding *bond,
+                                       const struct bond_opt_value *newval)
 {
        char ifname[IFNAMSIZ] = { 0, };
        struct net_device *slave_dev;
@@ -636,13 +693,13 @@ int bond_option_active_slave_set(struct bonding *bond,
 
        if (slave_dev) {
                if (!netif_is_bond_slave(slave_dev)) {
-                       pr_err("Device %s is not bonding slave.\n",
+                       pr_err("Device %s is not bonding slave\n",
                               slave_dev->name);
                        return -EINVAL;
                }
 
                if (bond->dev != netdev_master_upper_dev_get(slave_dev)) {
-                       pr_err("%s: Device %s is not our slave.\n",
+                       pr_err("%s: Device %s is not our slave\n",
                               bond->dev->name, slave_dev->name);
                        return -EINVAL;
                }
@@ -653,8 +710,7 @@ int bond_option_active_slave_set(struct bonding *bond,
 
        /* check to see if we are clearing active */
        if (!slave_dev) {
-               pr_info("%s: Clearing current active slave.\n",
-               bond->dev->name);
+               pr_info("%s: Clearing current active slave\n", bond->dev->name);
                rcu_assign_pointer(bond->curr_active_slave, NULL);
                bond_select_active_slave(bond);
        } else {
@@ -665,16 +721,16 @@ int bond_option_active_slave_set(struct bonding *bond,
 
                if (new_active == old_active) {
                        /* do nothing */
-                       pr_info("%s: %s is already the current active slave.\n",
+                       pr_info("%s: %s is already the current active slave\n",
                                bond->dev->name, new_active->dev->name);
                } else {
                        if (old_active && (new_active->link == BOND_LINK_UP) &&
                            IS_UP(new_active->dev)) {
-                               pr_info("%s: Setting %s as active slave.\n",
+                               pr_info("%s: Setting %s as active slave\n",
                                        bond->dev->name, new_active->dev->name);
                                bond_change_active_slave(bond, new_active);
                        } else {
-                               pr_err("%s: Could not set %s as active slave; either %s is down or the link is down.\n",
+                               pr_err("%s: Could not set %s as active slave; either %s is down or the link is down\n",
                                       bond->dev->name, new_active->dev->name,
                                       new_active->dev->name);
                                ret = -EINVAL;
@@ -688,21 +744,22 @@ int bond_option_active_slave_set(struct bonding *bond,
        return ret;
 }
 
-int bond_option_miimon_set(struct bonding *bond, struct bond_opt_value *newval)
+static int bond_option_miimon_set(struct bonding *bond,
+                                 const struct bond_opt_value *newval)
 {
-       pr_info("%s: Setting MII monitoring interval to %llu.\n",
+       pr_info("%s: Setting MII monitoring interval to %llu\n",
                bond->dev->name, newval->value);
        bond->params.miimon = newval->value;
        if (bond->params.updelay)
-               pr_info("%s: Note: Updating updelay (to %d) since it is a multiple of the miimon value.\n",
+               pr_info("%s: Note: Updating updelay (to %d) since it is a multiple of the miimon value\n",
                        bond->dev->name,
                        bond->params.updelay * bond->params.miimon);
        if (bond->params.downdelay)
-               pr_info("%s: Note: Updating downdelay (to %d) since it is a multiple of the miimon value.\n",
+               pr_info("%s: Note: Updating downdelay (to %d) since it is a multiple of the miimon value\n",
                        bond->dev->name,
                        bond->params.downdelay * bond->params.miimon);
        if (newval->value && bond->params.arp_interval) {
-               pr_info("%s: MII monitoring cannot be used with ARP monitoring. Disabling ARP monitoring...\n",
+               pr_info("%s: MII monitoring cannot be used with ARP monitoring - disabling ARP monitoring...\n",
                        bond->dev->name);
                bond->params.arp_interval = 0;
                if (bond->params.arp_validate)
@@ -725,7 +782,8 @@ int bond_option_miimon_set(struct bonding *bond, struct bond_opt_value *newval)
        return 0;
 }
 
-int bond_option_updelay_set(struct bonding *bond, struct bond_opt_value *newval)
+static int bond_option_updelay_set(struct bonding *bond,
+                                  const struct bond_opt_value *newval)
 {
        int value = newval->value;
 
@@ -742,15 +800,14 @@ int bond_option_updelay_set(struct bonding *bond, struct bond_opt_value *newval)
                        bond->params.miimon);
        }
        bond->params.updelay = value / bond->params.miimon;
-       pr_info("%s: Setting up delay to %d.\n",
-               bond->dev->name,
-               bond->params.updelay * bond->params.miimon);
+       pr_info("%s: Setting up delay to %d\n",
+               bond->dev->name, bond->params.updelay * bond->params.miimon);
 
        return 0;
 }
 
-int bond_option_downdelay_set(struct bonding *bond,
-                             struct bond_opt_value *newval)
+static int bond_option_downdelay_set(struct bonding *bond,
+                                    const struct bond_opt_value *newval)
 {
        int value = newval->value;
 
@@ -767,37 +824,36 @@ int bond_option_downdelay_set(struct bonding *bond,
                        bond->params.miimon);
        }
        bond->params.downdelay = value / bond->params.miimon;
-       pr_info("%s: Setting down delay to %d.\n",
-               bond->dev->name,
-               bond->params.downdelay * bond->params.miimon);
+       pr_info("%s: Setting down delay to %d\n",
+               bond->dev->name, bond->params.downdelay * bond->params.miimon);
 
        return 0;
 }
 
-int bond_option_use_carrier_set(struct bonding *bond,
-                               struct bond_opt_value *newval)
+static int bond_option_use_carrier_set(struct bonding *bond,
+                                      const struct bond_opt_value *newval)
 {
-       pr_info("%s: Setting use_carrier to %llu.\n",
+       pr_info("%s: Setting use_carrier to %llu\n",
                bond->dev->name, newval->value);
        bond->params.use_carrier = newval->value;
 
        return 0;
 }
 
-int bond_option_arp_interval_set(struct bonding *bond,
-                                struct bond_opt_value *newval)
+static int bond_option_arp_interval_set(struct bonding *bond,
+                                       const struct bond_opt_value *newval)
 {
-       pr_info("%s: Setting ARP monitoring interval to %llu.\n",
+       pr_info("%s: Setting ARP monitoring interval to %llu\n",
                bond->dev->name, newval->value);
        bond->params.arp_interval = newval->value;
        if (newval->value) {
                if (bond->params.miimon) {
-                       pr_info("%s: ARP monitoring cannot be used with MII monitoring. %s Disabling MII monitoring.\n",
+                       pr_info("%s: ARP monitoring cannot be used with MII monitoring. %s Disabling MII monitoring\n",
                                bond->dev->name, bond->dev->name);
                        bond->params.miimon = 0;
                }
                if (!bond->params.arp_targets[0])
-                       pr_info("%s: ARP monitoring has been set up, but no ARP targets have been specified.\n",
+                       pr_info("%s: ARP monitoring has been set up, but no ARP targets have been specified\n",
                                bond->dev->name);
        }
        if (bond->dev->flags & IFF_UP) {
@@ -812,8 +868,7 @@ int bond_option_arp_interval_set(struct bonding *bond,
                        cancel_delayed_work_sync(&bond->arp_work);
                } else {
                        /* arp_validate can be set only in active-backup mode */
-                       if (bond->params.arp_validate)
-                               bond->recv_probe = bond_arp_rcv;
+                       bond->recv_probe = bond_arp_rcv;
                        cancel_delayed_work_sync(&bond->mii_work);
                        queue_delayed_work(bond->wq, &bond->arp_work, 0);
                }
@@ -856,19 +911,18 @@ static int _bond_option_arp_ip_target_add(struct bonding *bond, __be32 target)
 
        ind = bond_get_targets_ip(targets, 0); /* first free slot */
        if (ind == -1) {
-               pr_err("%s: ARP target table is full!\n",
-                      bond->dev->name);
+               pr_err("%s: ARP target table is full!\n", bond->dev->name);
                return -EINVAL;
        }
 
-       pr_info("%s: adding ARP target %pI4.\n", bond->dev->name, &target);
+       pr_info("%s: Adding ARP target %pI4\n", bond->dev->name, &target);
 
        _bond_options_arp_ip_target_set(bond, ind, target, jiffies);
 
        return 0;
 }
 
-int bond_option_arp_ip_target_add(struct bonding *bond, __be32 target)
+static int bond_option_arp_ip_target_add(struct bonding *bond, __be32 target)
 {
        int ret;
 
@@ -880,7 +934,7 @@ int bond_option_arp_ip_target_add(struct bonding *bond, __be32 target)
        return ret;
 }
 
-int bond_option_arp_ip_target_rem(struct bonding *bond, __be32 target)
+static int bond_option_arp_ip_target_rem(struct bonding *bond, __be32 target)
 {
        __be32 *targets = bond->params.arp_targets;
        struct list_head *iter;
@@ -896,17 +950,16 @@ int bond_option_arp_ip_target_rem(struct bonding *bond, __be32 target)
 
        ind = bond_get_targets_ip(targets, target);
        if (ind == -1) {
-               pr_err("%s: unable to remove nonexistent ARP target %pI4.\n",
+               pr_err("%s: unable to remove nonexistent ARP target %pI4\n",
                       bond->dev->name, &target);
                return -EINVAL;
        }
 
        if (ind == 0 && !targets[1] && bond->params.arp_interval)
-               pr_warn("%s: removing last arp target with arp_interval on\n",
+               pr_warn("%s: Removing last arp target with arp_interval on\n",
                        bond->dev->name);
 
-       pr_info("%s: removing ARP target %pI4.\n", bond->dev->name,
-               &target);
+       pr_info("%s: Removing ARP target %pI4\n", bond->dev->name, &target);
 
        /* not to race with bond_arp_rcv */
        write_lock_bh(&bond->lock);
@@ -937,8 +990,8 @@ void bond_option_arp_ip_targets_clear(struct bonding *bond)
        write_unlock_bh(&bond->lock);
 }
 
-int bond_option_arp_ip_targets_set(struct bonding *bond,
-                                  struct bond_opt_value *newval)
+static int bond_option_arp_ip_targets_set(struct bonding *bond,
+                                         const struct bond_opt_value *newval)
 {
        int ret = -EPERM;
        __be32 target;
@@ -954,7 +1007,7 @@ int bond_option_arp_ip_targets_set(struct bonding *bond,
                else if (newval->string[0] == '-')
                        ret = bond_option_arp_ip_target_rem(bond, target);
                else
-                       pr_err("no command found in arp_ip_targets file for bond %s. Use +<addr> or -<addr>.\n",
+                       pr_err("no command found in arp_ip_targets file for bond %s - use +<addr> or -<addr>\n",
                               bond->dev->name);
        } else {
                target = newval->value;
@@ -964,10 +1017,10 @@ int bond_option_arp_ip_targets_set(struct bonding *bond,
        return ret;
 }
 
-int bond_option_arp_validate_set(struct bonding *bond,
-                                struct bond_opt_value *newval)
+static int bond_option_arp_validate_set(struct bonding *bond,
+                                       const struct bond_opt_value *newval)
 {
-       pr_info("%s: setting arp_validate to %s (%llu).\n",
+       pr_info("%s: Setting arp_validate to %s (%llu)\n",
                bond->dev->name, newval->string, newval->value);
 
        if (bond->dev->flags & IFF_UP) {
@@ -981,17 +1034,18 @@ int bond_option_arp_validate_set(struct bonding *bond,
        return 0;
 }
 
-int bond_option_arp_all_targets_set(struct bonding *bond,
-                                   struct bond_opt_value *newval)
+static int bond_option_arp_all_targets_set(struct bonding *bond,
+                                          const struct bond_opt_value *newval)
 {
-       pr_info("%s: setting arp_all_targets to %s (%llu).\n",
+       pr_info("%s: Setting arp_all_targets to %s (%llu)\n",
                bond->dev->name, newval->string, newval->value);
        bond->params.arp_all_targets = newval->value;
 
        return 0;
 }
 
-int bond_option_primary_set(struct bonding *bond, struct bond_opt_value *newval)
+static int bond_option_primary_set(struct bonding *bond,
+                                  const struct bond_opt_value *newval)
 {
        char *p, *primary = newval->string;
        struct list_head *iter;
@@ -1006,8 +1060,7 @@ int bond_option_primary_set(struct bonding *bond, struct bond_opt_value *newval)
                *p = '\0';
        /* check to see if we are clearing primary */
        if (!strlen(primary)) {
-               pr_info("%s: Setting primary slave to None.\n",
-                       bond->dev->name);
+               pr_info("%s: Setting primary slave to None\n", bond->dev->name);
                bond->primary_slave = NULL;
                memset(bond->params.primary, 0, sizeof(bond->params.primary));
                bond_select_active_slave(bond);
@@ -1016,7 +1069,7 @@ int bond_option_primary_set(struct bonding *bond, struct bond_opt_value *newval)
 
        bond_for_each_slave(bond, slave, iter) {
                if (strncmp(slave->dev->name, primary, IFNAMSIZ) == 0) {
-                       pr_info("%s: Setting %s as primary slave.\n",
+                       pr_info("%s: Setting %s as primary slave\n",
                                bond->dev->name, slave->dev->name);
                        bond->primary_slave = slave;
                        strcpy(bond->params.primary, slave->dev->name);
@@ -1026,15 +1079,14 @@ int bond_option_primary_set(struct bonding *bond, struct bond_opt_value *newval)
        }
 
        if (bond->primary_slave) {
-               pr_info("%s: Setting primary slave to None.\n",
-                       bond->dev->name);
+               pr_info("%s: Setting primary slave to None\n", bond->dev->name);
                bond->primary_slave = NULL;
                bond_select_active_slave(bond);
        }
        strncpy(bond->params.primary, primary, IFNAMSIZ);
        bond->params.primary[IFNAMSIZ - 1] = 0;
 
-       pr_info("%s: Recording %s as primary, but it has not been enslaved to %s yet.\n",
+       pr_info("%s: Recording %s as primary, but it has not been enslaved to %s yet\n",
                bond->dev->name, primary, bond->dev->name);
 
 out:
@@ -1045,10 +1097,10 @@ out:
        return 0;
 }
 
-int bond_option_primary_reselect_set(struct bonding *bond,
-                                    struct bond_opt_value *newval)
+static int bond_option_primary_reselect_set(struct bonding *bond,
+                                           const struct bond_opt_value *newval)
 {
-       pr_info("%s: setting primary_reselect to %s (%llu).\n",
+       pr_info("%s: Setting primary_reselect to %s (%llu)\n",
                bond->dev->name, newval->string, newval->value);
        bond->params.primary_reselect = newval->value;
 
@@ -1061,46 +1113,46 @@ int bond_option_primary_reselect_set(struct bonding *bond,
        return 0;
 }
 
-int bond_option_fail_over_mac_set(struct bonding *bond,
-                                 struct bond_opt_value *newval)
+static int bond_option_fail_over_mac_set(struct bonding *bond,
+                                        const struct bond_opt_value *newval)
 {
-       pr_info("%s: Setting fail_over_mac to %s (%llu).\n",
+       pr_info("%s: Setting fail_over_mac to %s (%llu)\n",
                bond->dev->name, newval->string, newval->value);
        bond->params.fail_over_mac = newval->value;
 
        return 0;
 }
 
-int bond_option_xmit_hash_policy_set(struct bonding *bond,
-                                    struct bond_opt_value *newval)
+static int bond_option_xmit_hash_policy_set(struct bonding *bond,
+                                           const struct bond_opt_value *newval)
 {
-       pr_info("%s: setting xmit hash policy to %s (%llu).\n",
+       pr_info("%s: Setting xmit hash policy to %s (%llu)\n",
                bond->dev->name, newval->string, newval->value);
        bond->params.xmit_policy = newval->value;
 
        return 0;
 }
 
-int bond_option_resend_igmp_set(struct bonding *bond,
-                               struct bond_opt_value *newval)
+static int bond_option_resend_igmp_set(struct bonding *bond,
+                                      const struct bond_opt_value *newval)
 {
-       pr_info("%s: Setting resend_igmp to %llu.\n",
+       pr_info("%s: Setting resend_igmp to %llu\n",
                bond->dev->name, newval->value);
        bond->params.resend_igmp = newval->value;
 
        return 0;
 }
 
-int bond_option_num_peer_notif_set(struct bonding *bond,
-                                  struct bond_opt_value *newval)
+static int bond_option_num_peer_notif_set(struct bonding *bond,
+                                  const struct bond_opt_value *newval)
 {
        bond->params.num_peer_notif = newval->value;
 
        return 0;
 }
 
-int bond_option_all_slaves_active_set(struct bonding *bond,
-                                     struct bond_opt_value *newval)
+static int bond_option_all_slaves_active_set(struct bonding *bond,
+                                            const struct bond_opt_value *newval)
 {
        struct list_head *iter;
        struct slave *slave;
@@ -1120,8 +1172,8 @@ int bond_option_all_slaves_active_set(struct bonding *bond,
        return 0;
 }
 
-int bond_option_min_links_set(struct bonding *bond,
-                             struct bond_opt_value *newval)
+static int bond_option_min_links_set(struct bonding *bond,
+                                    const struct bond_opt_value *newval)
 {
        pr_info("%s: Setting min links value to %llu\n",
                bond->dev->name, newval->value);
@@ -1130,15 +1182,16 @@ int bond_option_min_links_set(struct bonding *bond,
        return 0;
 }
 
-int bond_option_lp_interval_set(struct bonding *bond,
-                               struct bond_opt_value *newval)
+static int bond_option_lp_interval_set(struct bonding *bond,
+                                      const struct bond_opt_value *newval)
 {
        bond->params.lp_interval = newval->value;
 
        return 0;
 }
 
-int bond_option_pps_set(struct bonding *bond, struct bond_opt_value *newval)
+static int bond_option_pps_set(struct bonding *bond,
+                              const struct bond_opt_value *newval)
 {
        bond->params.packets_per_slave = newval->value;
        if (newval->value > 0) {
@@ -1155,10 +1208,10 @@ int bond_option_pps_set(struct bonding *bond, struct bond_opt_value *newval)
        return 0;
 }
 
-int bond_option_lacp_rate_set(struct bonding *bond,
-                             struct bond_opt_value *newval)
+static int bond_option_lacp_rate_set(struct bonding *bond,
+                                    const struct bond_opt_value *newval)
 {
-       pr_info("%s: Setting LACP rate to %s (%llu).\n",
+       pr_info("%s: Setting LACP rate to %s (%llu)\n",
                bond->dev->name, newval->string, newval->value);
        bond->params.lacp_fast = newval->value;
        bond_3ad_update_lacp_rate(bond);
@@ -1166,18 +1219,18 @@ int bond_option_lacp_rate_set(struct bonding *bond,
        return 0;
 }
 
-int bond_option_ad_select_set(struct bonding *bond,
-                             struct bond_opt_value *newval)
+static int bond_option_ad_select_set(struct bonding *bond,
+                                    const struct bond_opt_value *newval)
 {
-       pr_info("%s: Setting ad_select to %s (%llu).\n",
+       pr_info("%s: Setting ad_select to %s (%llu)\n",
                bond->dev->name, newval->string, newval->value);
        bond->params.ad_select = newval->value;
 
        return 0;
 }
 
-int bond_option_queue_id_set(struct bonding *bond,
-                            struct bond_opt_value *newval)
+static int bond_option_queue_id_set(struct bonding *bond,
+                                   const struct bond_opt_value *newval)
 {
        struct slave *slave, *update_slave;
        struct net_device *sdev;
@@ -1199,8 +1252,7 @@ int bond_option_queue_id_set(struct bonding *bond,
                goto err_no_cmd;
 
        /* Check buffer length, valid ifname and queue id */
-       if (strlen(newval->string) > IFNAMSIZ ||
-           !dev_valid_name(newval->string) ||
+       if (!dev_valid_name(newval->string) ||
            qid > bond->dev->real_num_tx_queues)
                goto err_no_cmd;
 
@@ -1232,14 +1284,14 @@ out:
        return ret;
 
 err_no_cmd:
-       pr_info("invalid input for queue_id set for %s.\n",
-               bond->dev->name);
+       pr_info("invalid input for queue_id set for %s\n", bond->dev->name);
        ret = -EPERM;
        goto out;
 
 }
 
-int bond_option_slaves_set(struct bonding *bond, struct bond_opt_value *newval)
+static int bond_option_slaves_set(struct bonding *bond,
+                                 const struct bond_opt_value *newval)
 {
        char command[IFNAMSIZ + 1] = { 0, };
        struct net_device *dev;
@@ -1254,7 +1306,7 @@ int bond_option_slaves_set(struct bonding *bond, struct bond_opt_value *newval)
 
        dev = __dev_get_by_name(dev_net(bond->dev), ifname);
        if (!dev) {
-               pr_info("%s: Interface %s does not exist!\n",
+               pr_info("%s: interface %s does not exist!\n",
                        bond->dev->name, ifname);
                ret = -ENODEV;
                goto out;
@@ -1262,12 +1314,12 @@ int bond_option_slaves_set(struct bonding *bond, struct bond_opt_value *newval)
 
        switch (command[0]) {
        case '+':
-               pr_info("%s: Adding slave %s.\n", bond->dev->name, dev->name);
+               pr_info("%s: Adding slave %s\n", bond->dev->name, dev->name);
                ret = bond_enslave(bond->dev, dev);
                break;
 
        case '-':
-               pr_info("%s: Removing slave %s.\n", bond->dev->name, dev->name);
+               pr_info("%s: Removing slave %s\n", bond->dev->name, dev->name);
                ret = bond_release(bond->dev, dev);
                break;
 
@@ -1279,7 +1331,7 @@ out:
        return ret;
 
 err_no_cmd:
-       pr_err("no command found in slaves file for bond %s. Use +ifname or -ifname.\n",
+       pr_err("no command found in slaves file for bond %s - use +ifname or -ifname\n",
               bond->dev->name);
        ret = -EPERM;
        goto out;