Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp4104303pxt; Tue, 10 Aug 2021 20:29:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzkbRwfgPGf2BrsXGxMy4xp1bEnpMIxobQSOE9zZodPcDEVBp6V/vA8+P8QFryTEaILjRBO X-Received: by 2002:a5d:8f8b:: with SMTP id l11mr9299iol.38.1628652566945; Tue, 10 Aug 2021 20:29:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628652566; cv=none; d=google.com; s=arc-20160816; b=pOB4lXhVJKoJ//34slrcMtfpZLeGzLJPklYqAHdefWfwF/vvVdQ+y92NMykpt1es6u expEoRNQZtfE5dX5+GgA0Wl8UhLOnlqnH6hp0uALwfqzkkHW5HdKAHpDYbKGPUXD4tsB WnUDcimkpdWGbB4I0f3GGk8TUtV3PPw7jIl7bpZAlRtPmnzT6P+0krUs8OW96idC0XJL m4eClJn+A4plkcOt9NmykbUYV6q63ARNhrSKm+U+BktH0mknWvvJzGb94kmuaa1Z2ukh DfXxcQezfk72gY20AhodQxsB9ZLzoNc1kBhkBSLyYSlyyJI1tRZM/gwYda39oTgbg4Zd YBIw== 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=eny5wQmINBVFzYndq4EHXwzy7IIln/hXZXR83uRZt1I=; b=XeMhWU4VdCeTI7I1/PCdMrIs/uykq1H7nRJ6NleCvx07sci9Eqs9vbr/FTleSzzHOX +cZjqnbCEZGgtzq0AfIASP5o5GhuQWPk0ceAeXlbZnI40oy++dXhnJo7KRLf8WtJ5+cr kb+27oXv7g6fwBDHEmKKCvQPd0rCNHSHx2kcxq3gDdNmv/6qI2OAXW5KMxdgCcrCzCNU TpFcvbQezNXmH0ucZrx3YY49C0qdel3WTDMarXyAXbePW7kpdGJkiCVCvC0LOlM23gw8 BiBQX9q4DcS4xuq0CWoIcskdBsHG8g9x2wAj4xKOLizFTCkNjFZIbAoFAqaksgAfZH73 C97g== 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 u2si25274028jah.8.2021.08.10.20.29.15; Tue, 10 Aug 2021 20:29:26 -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 S233182AbhHKD1b (ORCPT + 99 others); Tue, 10 Aug 2021 23:27:31 -0400 Received: from smtprelay0157.hostedemail.com ([216.40.44.157]:48640 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S232795AbhHKD13 (ORCPT ); Tue, 10 Aug 2021 23:27:29 -0400 Received: from omf16.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay04.hostedemail.com (Postfix) with ESMTP id A12421802B564; Wed, 11 Aug 2021 03:27:03 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: joe@perches.com) by omf16.hostedemail.com (Postfix) with ESMTPA id 3358D2550F6; Wed, 11 Aug 2021 03:27:02 +0000 (UTC) Message-ID: Subject: Re: [PATCH net-next v2 2/2] bonding: combine netlink and console error messages From: Joe Perches To: Jonathan Toppins , netdev@vger.kernel.org, leon@kernel.org Cc: Jay Vosburgh , Veaceslav Falico , Andy Gospodarek , "David S. Miller" , Jakub Kicinski , linux-kernel@vger.kernel.org Date: Tue, 10 Aug 2021 20:27:01 -0700 In-Reply-To: References: Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.40.0-1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=1.21 X-Rspamd-Server: rspamout04 X-Rspamd-Queue-Id: 3358D2550F6 X-Stat-Signature: 75qa5r47bkii4bat47q8hn5j747o34s3 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Session-ID: U2FsdGVkX1/2GfxExur2gZjwWpoFAdVLKZaN4FmBi38= X-HE-Tag: 1628652422-415181 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2021-08-10 at 22:53 -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. > > Signed-off-by: Jonathan Toppins > --- > > 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 [] > @@ -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.