[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <37c7bbbb01ede99974fc9ce3c3f5dad4845df9ee.camel@perches.com>
Date:   Fri, 06 Aug 2021 20:52:27 -0700
From:   Joe Perches <joe@...ches.com>
To:     Jonathan Toppins <jtoppins@...hat.com>, netdev@...r.kernel.org
Cc:     Jay Vosburgh <j.vosburgh@...il.com>,
        Veaceslav Falico <vfalico@...il.com>,
        Andy Gospodarek <andy@...yhouse.net>,
        "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next 2/2] bonding: combine netlink and console error
 messages
On Fri, 2021-08-06 at 23:30 -0400, Jonathan Toppins wrote:
> There seems to be no reason to have different error messages between
> netlink and printk. It also cleans up the function slightly.
[]
> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
[]
> +#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)
Powered by blists - more mailing lists