Re: [PATCH net-next v2 2/2] bonding: combine netlink and console error messages
From: Joe Perches <joe@perches.com>
Date: 2021-08-11 03:27:13
Also in:
lkml
On Tue, 2021-08-10 at 22:53 -0400, Jonathan Toppins wrote:
quoted hunk ↗ jump to hunk
There seems to be no reason to have different error messages between netlink and printk. It also cleans up the function slightly. Signed-off-by: Jonathan Toppins <redacted> --- Notes: v2: - changed the printks to reduce object code slightly - emit a single error message based on if netlink or sysfs is attempting to enslave - rebase on top of net-next/master and convert additional instances added by XDP additions drivers/net/bonding/bond_main.c | 69 ++++++++++++++++++--------------- 1 file changed, 37 insertions(+), 32 deletions(-)diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
[]
quoted hunk ↗ jump to hunk
@@ -1725,6 +1725,20 @@ void bond_lower_state_changed(struct slave *slave)netdev_lower_state_changed(slave->dev, &info); } +#define BOND_NL_ERR(bond_dev, extack, errmsg) do { \ + if (extack) \ + NL_SET_ERR_MSG(extack, errmsg); \ + else \ + netdev_err(bond_dev, "Error: %s\n", errmsg); \ +} while (0) + +#define SLAVE_NL_ERR(bond_dev, slave_dev, extack, errmsg) do { \ + if (extack) \ + NL_SET_ERR_MSG(extack, errmsg); \ + else \ + slave_err(bond_dev, slave_dev, "Error: %s\n", errmsg); \ +} while (0)
Ideally both of these would be static functions and not macros.