Thread (22 messages) flat view 22 messages, 5 authors, 2021-08-11

Re: [PATCH net-next 2/2] bonding: combine netlink and console error messages

From: Joe Perches <joe@perches.com>
Date: 2021-08-08 10:08:13
Also in: lkml

On Sat, 2021-08-07 at 17:54 -0400, Jonathan Toppins wrote:
On 8/6/21 11:52 PM, Joe Perches wrote:
quoted
On Fri, 2021-08-06 at 23:30 -0400, Jonathan Toppins wrote:
quoted
There seems to be no reason to have different error messages between
netlink and printk. It also cleans up the function slightly.
[]
quoted
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
[]
quoted
+#define BOND_NL_ERR(bond_dev, extack, errmsg) do {		\
+	NL_SET_ERR_MSG(extack, errmsg);				\
+	netdev_err(bond_dev, "Error: " errmsg "\n");		\
+} while (0)
+
+#define SLAVE_NL_ERR(bond_dev, slave_dev, extack, errmsg) do {	\
+	NL_SET_ERR_MSG(extack, errmsg);				\
+	slave_err(bond_dev, slave_dev, "Error: " errmsg "\n");	\
+} while (0)
If you are doing this, it's probably smaller object code to use
	"%s", errmsg
as the errmsg string can be reused

#define BOND_NL_ERR(bond_dev, extack, errmsg)			\
do {								\
	NL_SET_ERR_MSG(extack, errmsg);				\
	netdev_err(bond_dev, "Error: %s\n", errmsg);		\
} while (0)

#define SLAVE_NL_ERR(bond_dev, slave_dev, extack, errmsg)	\
do {								\
	NL_SET_ERR_MSG(extack, errmsg);				\
	slave_err(bond_dev, slave_dev, "Error: %s\n", errmsg);	\
} while (0)
I like the thought and would agree if not for how NL_SET_ERR_MSG is 
coded. Unfortunately it does not appear as though doing the above change 
actually generates smaller object code. Maybe I have incorrectly 
interpreted something?
No, it's because you are compiling allyesconfig or equivalent.
Try defconfig with bonding.

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help