bonding/options: convert to using slave printk macros
authorJarod Wilson <jarod@redhat.com>
Fri, 7 Jun 2019 14:59:32 +0000 (10:59 -0400)
committerDavid S. Miller <davem@davemloft.net>
Sun, 9 Jun 2019 20:36:01 +0000 (13:36 -0700)
All of these printk instances benefit from having both master and slave
device information included, so convert to using a standardized macro
format and remove redundant information.

Suggested-by: Joe Perches <joe@perches.com>
CC: Jay Vosburgh <j.vosburgh@gmail.com>
CC: Veaceslav Falico <vfalico@gmail.com>
CC: Andy Gospodarek <andy@greyhouse.net>
CC: netdev@vger.kernel.org
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/bonding/bond_options.c

index 9677418e0362c42a389c7b4f667130277dcb50e1..0d852fe9da7c192161720b26f64060802b7bdd3c 100644 (file)
@@ -783,14 +783,12 @@ static int bond_option_active_slave_set(struct bonding *bond,
 
        if (slave_dev) {
                if (!netif_is_bond_slave(slave_dev)) {
-                       netdev_err(bond->dev, "Device %s is not bonding slave\n",
-                                  slave_dev->name);
+                       slave_err(bond->dev, slave_dev, "Device is not bonding slave\n");
                        return -EINVAL;
                }
 
                if (bond->dev != netdev_master_upper_dev_get(slave_dev)) {
-                       netdev_err(bond->dev, "Device %s is not our slave\n",
-                                  slave_dev->name);
+                       slave_err(bond->dev, slave_dev, "Device is not our slave\n");
                        return -EINVAL;
                }
        }
@@ -809,18 +807,15 @@ static int bond_option_active_slave_set(struct bonding *bond,
 
                if (new_active == old_active) {
                        /* do nothing */
-                       netdev_dbg(bond->dev, "%s is already the current active slave\n",
-                                  new_active->dev->name);
+                       slave_dbg(bond->dev, new_active->dev, "is already the current active slave\n");
                } else {
                        if (old_active && (new_active->link == BOND_LINK_UP) &&
                            bond_slave_is_up(new_active)) {
-                               netdev_dbg(bond->dev, "Setting %s as active slave\n",
-                                          new_active->dev->name);
+                               slave_dbg(bond->dev, new_active->dev, "Setting as active slave\n");
                                bond_change_active_slave(bond, new_active);
                        } else {
-                               netdev_err(bond->dev, "Could not set %s as active slave; either %s is down or the link is down\n",
-                                          new_active->dev->name,
-                                          new_active->dev->name);
+                               slave_err(bond->dev, new_active->dev, "Could not set as active slave; either %s is down or the link is down\n",
+                                         new_active->dev->name);
                                ret = -EINVAL;
                        }
                }
@@ -1132,8 +1127,7 @@ static int bond_option_primary_set(struct bonding *bond,
 
        bond_for_each_slave(bond, slave, iter) {
                if (strncmp(slave->dev->name, primary, IFNAMSIZ) == 0) {
-                       netdev_dbg(bond->dev, "Setting %s as primary slave\n",
-                                  slave->dev->name);
+                       slave_dbg(bond->dev, slave->dev, "Setting as primary slave\n");
                        rcu_assign_pointer(bond->primary_slave, slave);
                        strcpy(bond->params.primary, slave->dev->name);
                        bond->force_primary = true;
@@ -1150,8 +1144,8 @@ static int bond_option_primary_set(struct bonding *bond,
        strncpy(bond->params.primary, primary, IFNAMSIZ);
        bond->params.primary[IFNAMSIZ - 1] = 0;
 
-       netdev_dbg(bond->dev, "Recording %s as primary, but it has not been enslaved to %s yet\n",
-                  primary, bond->dev->name);
+       netdev_dbg(bond->dev, "Recording %s as primary, but it has not been enslaved yet\n",
+                  primary);
 
 out:
        unblock_netpoll_tx();
@@ -1378,12 +1372,12 @@ static int bond_option_slaves_set(struct bonding *bond,
 
        switch (command[0]) {
        case '+':
-               netdev_dbg(bond->dev, "Adding slave %s\n", dev->name);
+               slave_dbg(bond->dev, dev, "Enslaving interface\n");
                ret = bond_enslave(bond->dev, dev, NULL);
                break;
 
        case '-':
-               netdev_dbg(bond->dev, "Removing slave %s\n", dev->name);
+               slave_dbg(bond->dev, dev, "Releasing interface\n");
                ret = bond_release(bond->dev, dev);
                break;
 
@@ -1447,7 +1441,7 @@ static int bond_option_ad_actor_system_set(struct bonding *bond,
        return 0;
 
 err:
-       netdev_err(bond->dev, "Invalid MAC address.\n");
+       netdev_err(bond->dev, "Invalid ad_actor_system MAC address.\n");
        return -EINVAL;
 }