Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp1947323ybh; Sun, 8 Mar 2020 17:45:53 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtiKbkpNM/DfxZ4uvfwuCXVa5XMjVqXHJWCZVjM2gspn4KdAUYKoTYRDe2qiS/c+qP9BzgB X-Received: by 2002:a9d:5d09:: with SMTP id b9mr11143052oti.207.1583714753608; Sun, 08 Mar 2020 17:45:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583714753; cv=none; d=google.com; s=arc-20160816; b=ded6jddYpaRMjQRi+EMDK61wmW35WLH5oWydCXD0IWNJvAO5bQHJiNjy6vsK9LB+10 NdYPbNlghFuXuapIpjgE1wjDlxPcwGKuqYYUfQHGSFCkKvapSfBP3upF6XS3RTvxWjpj Hg1i1AKkQ7dY9DA90EEjCEZFabebdIukllXhTTn9M1T+dUD4gYgkTsGxA0G3aMcBO+3f FZkjEP/nl0BbaKV1K7QlyNmwGh0RzmOfkJLTE9TdOhxfLmRQXaoPysAcEMzDtk5M7tSr 0vfMM/BsAlWUu7pIu1eXs79MyqrGmVC3614KGcsPCIjeK0X3SU1BEGyE6ZAS7xpWuJOn AK/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature:dkim-filter; bh=Zp+vgNpNVW0FeI5TnKPcJs7XrT2/R3BYpxjqyKXAZhE=; b=JeOktzXAQoBNdhnmnBbxEpepbQXvsSStiNQMsydn8nZAKIRdiHyI7Uv/EiUaKnlY4r qDriJcFen03/62s2Sp66JXiUuu9NXhUl/Nt+ajB80JoJJvQ78uOd62Q2t5jfyvAlccY7 fX8t9mSuX+9tTFaoXUiB/vj+rWdPN4/3i7Nyy1PV410Orz3vqHUlsBoiCTKRrJTyeODe ukrIKHIpqH8bCVzmHCBJ4C7TGB5XkvccQgAMROmMXSkHztpPX/AtdmfC65Qb0QGlmNYC RMLzTsTjsfvDDioXO8n0In2nYT7Yyp5ACVrOyOpC9VJocaRPS2mPQaHbw7cyZ59n/plI x5vA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=dUOyaAMC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b2si1377451otl.18.2020.03.08.17.45.42; Sun, 08 Mar 2020 17:45:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=dUOyaAMC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726702AbgCIAlV (ORCPT + 99 others); Sun, 8 Mar 2020 20:41:21 -0400 Received: from conssluserg-02.nifty.com ([210.131.2.81]:48723 "EHLO conssluserg-02.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726621AbgCIAlV (ORCPT ); Sun, 8 Mar 2020 20:41:21 -0400 Received: from mail-ua1-f53.google.com (mail-ua1-f53.google.com [209.85.222.53]) (authenticated) by conssluserg-02.nifty.com with ESMTP id 0290eso0024295 for ; Mon, 9 Mar 2020 09:40:54 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-02.nifty.com 0290eso0024295 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1583714455; bh=Zp+vgNpNVW0FeI5TnKPcJs7XrT2/R3BYpxjqyKXAZhE=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=dUOyaAMC3hAoJM4oTt3lDkKSQ9JhqOLYbs1LwUl5Mvlt51B9rg4UT1fZlnvANKmUS L4oOX7sbHQ3ruD44JXNNc1e+aq4lM4aPGWsPQ6aeJMRmVLddYunh+lD6YXLRWZWq18 TvL75pYcsEVH2Ip+qyc4YxphFhdFDVD9B8XI3FSpWLe/2cTmdoXoD52Ezlgc18mzDa uYcHF5XYIi2MDTjWHfPyO8VLNvy7D3DWuVqfXLNib28UsPsvZOvsJMBLMMTGrAUdWy sm2cLvYtMbakdJaoGhlPrIJS1722s5Yo1TCSU2dVpGGanUOICxXtmIpzvPplwpvNgJ 8FqHLNimi1DwQ== X-Nifty-SrcIP: [209.85.222.53] Received: by mail-ua1-f53.google.com with SMTP id b2so249194uas.13 for ; Sun, 08 Mar 2020 17:40:54 -0700 (PDT) X-Gm-Message-State: ANhLgQ2kJb7EKexvMzjQznnpDvXdSm3vC+TYkyaMPLe/e1BvNaxElBI2 5voAtCHcug6hiWSnoZ1UEvjQ/gQoWgYl6zz+jtM= X-Received: by 2002:ab0:3485:: with SMTP id c5mr7077286uar.109.1583714453622; Sun, 08 Mar 2020 17:40:53 -0700 (PDT) MIME-Version: 1.0 References: <20200306160206.5609-1-jeyu@kernel.org> In-Reply-To: <20200306160206.5609-1-jeyu@kernel.org> From: Masahiro Yamada Date: Mon, 9 Mar 2020 09:40:17 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3 1/2] modpost: rework and consolidate logging interface To: Jessica Yu Cc: Matthias Maennich , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jessica, On Sat, Mar 7, 2020 at 1:02 AM Jessica Yu wrote: > > Rework modpost's logging interface by consolidating merror(), warn(), and > fatal() to use a single function, modpost_log(). Introduce different > logging levels (WARN, ERROR, FATAL) as well. The purpose of this cleanup is > to reduce code duplication when deciding whether or not to warn or error > out based on a condition. > > Signed-off-by: Jessica Yu > --- > v3: > - remove level variable from modpost_log and just call fprintf in each > case > - remove warn_unless and just call modpost_log() directly > - fix checkpatch error: > ERROR: space required before the open parenthesis '(' > #102: FILE: scripts/mod/modpost.c:61: > + switch(loglevel) { > > scripts/mod/modpost.c | 68 ++++++++++++++++++++++----------------------------- > scripts/mod/modpost.h | 14 ++++++++--- > 2 files changed, 40 insertions(+), 42 deletions(-) > > diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c > index 7edfdb2f4497..a2329235a6db 100644 > --- a/scripts/mod/modpost.c > +++ b/scripts/mod/modpost.c > @@ -51,41 +51,34 @@ enum export { > > #define MODULE_NAME_LEN (64 - sizeof(Elf_Addr)) > > -#define PRINTF __attribute__ ((format (printf, 1, 2))) > +#define PRINTF __attribute__ ((format (printf, 2, 3))) > > -PRINTF void fatal(const char *fmt, ...) > +PRINTF void modpost_log(enum loglevel loglevel, const char *fmt, ...) > { This series looks good to me. I can queue it up to kbuild tree if there is no objection. I just noticed one nit. Now that modpost_log() is the only user of PRINTF, we can delete PRITNF, and directly add the attribute to modpost_log(), like this: void __attribute__((format(printf, 2, 3))) modpost_log(enum loglevel loglevel, const char *fmt, ...) { ... } If you agree, I can modify it when I apply it. Thank you. -- Best Regards Masahiro Yamada