Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp1833722pxt; Sun, 8 Aug 2021 03:08:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJytUlz1RQzXw1/8Tjp5/Uk3ENaUbwAMHjtiC58nFDiZ8KFA20rNTl5Eh8fAaaXTgnBsc3SW X-Received: by 2002:a05:6e02:525:: with SMTP id h5mr304662ils.114.1628417291136; Sun, 08 Aug 2021 03:08:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628417291; cv=none; d=google.com; s=arc-20160816; b=RVrDZCko9yaQbGcRrPIC7Fw17vLvdkjieLJFvx5l4Ctijia7L+WUepPOOcd+jIWhwq vtPWpMy5NnrPEMk3rFi9BvjgT3CUVub5cLjrh89i1eHnHzYXQXs6LKx/24lkM3CPo2hT sDH9vsJhGmYcwPjiLSM5jAVAoflBMEUpRuolJvGBVlBkfbKN92Mj1XE1WpxMaa3llq56 qatoGLWbSaSYLEwDCuwxEPP1+TimQdoeJelNAC0Ko4NPQSMWt22xEeVMe8klW5OuYxEm bPGth4aoShwWR3S0WDwYjlOpbj73PmBe6+uHpgTc5KLEf+YUsg2DXcchQ/PpN6WyI9rb zmjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=SR+7LKXAFIoU6zm4oxnXwsxhnStCIUmlYPMQMtylvjs=; b=n1G89i+qOoGlbHAIgv9NhA2R+lXFcAqXHmDaqHgVX24RVifbXh6L8cMuZf6/D7geOD ohzWCq5cYorUJU8CIhJLG+deqL1bRt/wYIKEN5eM9fIaLypuBD/C/A2n/efGTn6jSUOb jyIp9S5tm00fhKoWZcn2KeKSxp27SXuWsUFla0DyaPzcU8SUcGBewANV5eIxz6C3H9HX qb/O9d1ulYlp4ick6IUEdkjVnwVnVFBWw5vgWTMP8nVbhjzYzKwyA+tZffl2Y9OKtmvS EztM5xjUgYdubQ6+TTkocG7rx6N676Ykbw27V9NeTvJOadpLGg0oymp9Nfu0VrEXSFyO Rb9w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z14si15769470ilu.89.2021.08.08.03.07.30; Sun, 08 Aug 2021 03:08:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230492AbhHHKC7 (ORCPT + 99 others); Sun, 8 Aug 2021 06:02:59 -0400 Received: from smtprelay0193.hostedemail.com ([216.40.44.193]:60260 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230354AbhHHKC6 (ORCPT ); Sun, 8 Aug 2021 06:02:58 -0400 Received: from omf16.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay07.hostedemail.com (Postfix) with ESMTP id C386D181D3025; Sun, 8 Aug 2021 10:02:38 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: joe@perches.com) by omf16.hostedemail.com (Postfix) with ESMTPA id 86E95255108; Sun, 8 Aug 2021 10:02:37 +0000 (UTC) Message-ID: <745ab8a85430ad4268a86b0957aa690c1a7a6d0f.camel@perches.com> Subject: Re: [PATCH net-next 2/2] bonding: combine netlink and console error messages From: Joe Perches To: Jonathan Toppins , netdev@vger.kernel.org Cc: Jay Vosburgh , Veaceslav Falico , Andy Gospodarek , "David S. Miller" , Jakub Kicinski , linux-kernel@vger.kernel.org Date: Sun, 08 Aug 2021 03:02:35 -0700 In-Reply-To: References: <37c7bbbb01ede99974fc9ce3c3f5dad4845df9ee.camel@perches.com> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.40.0-1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.62 X-Rspamd-Server: rspamout04 X-Rspamd-Queue-Id: 86E95255108 X-Stat-Signature: xp76j3p7soenw57a8bias8zr65oqfbqa X-Session-Marker: 6A6F6540706572636865732E636F6D X-Session-ID: U2FsdGVkX18sWdJ0gR/negchCb2xjZXqr9B6PKsIgFM= X-HE-Tag: 1628416957-534976 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 2021-08-07 at 17:54 -0400, Jonathan Toppins wrote: > On 8/6/21 11:52 PM, Joe Perches wrote: > > 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) > > > > > > 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.