Received: by 10.223.185.116 with SMTP id b49csp880449wrg; Tue, 20 Feb 2018 09:18:31 -0800 (PST) X-Google-Smtp-Source: AH8x226YWE631AbkZQlOmkXM1WSt423/dZMFpsl6qarqfN4V4/dHtMgqJxfHpSlAIcG8rZw1PLpA X-Received: by 10.99.182.76 with SMTP id v12mr273948pgt.158.1519147111588; Tue, 20 Feb 2018 09:18:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519147111; cv=none; d=google.com; s=arc-20160816; b=UKEHFd4WZZWemCloxa5jafayR9SfYlVZywk2W1X1uUEoeb7Qjx1dPGpbg6Uyxqsm/q 1tIo08S3TE3mrFKfLFBzIhEsSTho2CdND4YUqZAErNZpsdjMI5MNV8u2v7f48o1zb/fm bCgI1GRKUKTudBsdp1jjWgHJJF+IuoFEartmC5bHDQZMSCReKyDKip3iAOuaVLeLOMvJ 18hGGZETmmWcmKwmUVVHnNqx3LT+723gZSvPPoGLef5YzgI8n1Vnxxq3HbJWE9Zf+Fzt NGmKJGHLY3pn67XnizxrIb1XAgwW1vrQOUfLHboxCrJgR76wtbTr17cGGtBWhEqQRXdb hdlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :arc-authentication-results; bh=kzQZDFcBlsu5VU32k2VvhXYD92wUvEOmIDPiiKckjI4=; b=pxiFbVltFYu0dQR8wHJxQDijZpClj/XBHvh6qle5o85z0ZIM0z6FpxCYpDJtsxqbc7 R7ff6Uh2cLnHBqDXExxl8njpeTxNF1BcqubiNvCWaOaABwYxfKnGP4pML6H5O5rIC58c 3VV3FL5iLppuauxMWrk1afyzVvNv4PisLgSo6WHk/3zWpzNa8RVyKphTCVrC8Urzf9zl 7CuWmi35ZccnepTct1xXiWrmSdBibvraIiw+oA80mFaouqm9L69jbWbYyoBqwbjfItcu ddcFnmO/npYOt+zWBU5b1Q2GBs0eexJLRueJ3uovMYOBHJX67gfxFu5ybRtr+kcslg/H 5gWg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e13-v6si9350369pln.750.2018.02.20.09.18.11; Tue, 20 Feb 2018 09:18:31 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753303AbeBTRRB convert rfc822-to-8bit (ORCPT + 99 others); Tue, 20 Feb 2018 12:17:01 -0500 Received: from mail.free-electrons.com ([62.4.15.54]:41372 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752823AbeBTRQ7 (ORCPT ); Tue, 20 Feb 2018 12:16:59 -0500 Received: by mail.free-electrons.com (Postfix, from userid 110) id 01E462071C; Tue, 20 Feb 2018 18:16:57 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.free-electrons.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT shortcircuit=ham autolearn=disabled version=3.4.0 Received: from bbrezillon (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.free-electrons.com (Postfix) with ESMTPSA id 8CB662046F; Tue, 20 Feb 2018 18:16:47 +0100 (CET) Date: Tue, 20 Feb 2018 18:16:47 +0100 From: Boris Brezillon To: Shreeya Patel Cc: boris.brezillon@free-electrons.com, richard@nod.at, dwmw2@infradead.org, computersforpeace@gmail.com, marek.vasut@gmail.com, cyrille.pitchen@wedev4u.fr, maximlevitsky@gmail.com, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, ezequiel@vanguardiasur.com.ar, outreachy-kernel@googlegroups.com Subject: Re: [PATCH NAND v2] mtd: nand: Replace printk() with appropriate pr_*macro() Message-ID: <20180220181647.6f2367b6@bbrezillon> In-Reply-To: <1519146401.12276.4.camel@gmail.com> References: <1519046025-9412-1-git-send-email-shreeya.patel23498@gmail.com> <20180219155115.3d9d1bd5@bbrezillon> <1519146401.12276.4.camel@gmail.com> X-Mailer: Claws Mail 3.15.0-dirty (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 20 Feb 2018 22:36:41 +0530 Shreeya Patel wrote: > On Mon, 2018-02-19 at 15:51 +0100, Boris Brezillon wrote: > > Hi Shreeya, > > > > On Mon, 19 Feb 2018 18:43:45 +0530 > > Shreeya Patel wrote: > > > > > > > > The log levels embedded with the name are more concise than > > > printk. > > > Replace printks having a log level with the appropriate > > > pr_*macro. > > > > > > Signed-off-by: Shreeya Patel > > > --- > > > > > > Changes in v2: > > >   -Merge previous patches of the patchset regarding replacement > > > of printk with pr_*macro, into single patch. > > > > > > > > >  drivers/mtd/nand/cs553x_nand.c   |  9 ++--- > > >  drivers/mtd/nand/diskonchip.c    | 76 +++++++++++++++++++++------- > > > ------------ > > >  drivers/mtd/nand/fsl_elbc_nand.c |  2 +- > > >  drivers/mtd/nand/fsl_ifc_nand.c  |  2 +- > > >  drivers/mtd/nand/mxc_nand.c      |  2 +- > > >  drivers/mtd/nand/nand_bch.c      | 12 +++---- > > >  drivers/mtd/nand/nandsim.c       | 10 +++--- > > >  drivers/mtd/nand/r852.c          |  2 +- > > >  drivers/mtd/nand/r852.h          |  6 ++-- > > >  drivers/mtd/nand/sm_common.c     |  5 ++- > > >  10 files changed, 65 insertions(+), 61 deletions(-) > > > > > [...] > > > > > > > >   > > > diff --git a/drivers/mtd/nand/diskonchip.c > > > b/drivers/mtd/nand/diskonchip.c > > > index c3aa53c..b97d88c 100644 > > > --- a/drivers/mtd/nand/diskonchip.c > > > +++ b/drivers/mtd/nand/diskonchip.c > > [...] > > > > > > > > @@ -438,7 +438,7 @@ static void __init doc2000_count_chips(struct > > > mtd_info *mtd) > > >   break; > > >   } > > >   doc->chips_per_floor = i; > > > - printk(KERN_DEBUG "Detected %d chips per floor.\n", i); > > > + pr_info("Detected %d chips per floor.\n", i); > > Should be pr_debug() here. > > > > > > > >  } > > >   > > [...] > > > > > > > > diff --git a/drivers/mtd/nand/nandsim.c > > > b/drivers/mtd/nand/nandsim.c > > > index 246b439..4e5f817 100644 > > > --- a/drivers/mtd/nand/nandsim.c > > > +++ b/drivers/mtd/nand/nandsim.c > > > @@ -184,15 +184,15 @@ MODULE_PARM_DESC(bch,  "Enable > > > BCH ecc and set how many bits should " > > >   > > >  /* Simulator's output macros (logging, debugging, warning, error) > > > */ > > >  #define NS_LOG(args...) \ > > > - do { if (log) printk(KERN_DEBUG NS_OUTPUT_PREFIX " log: " > > > args); } while(0) > > > + do { if (log) pr_debug(NS_OUTPUT_PREFIX " log: " args); } > > > while(0) > > You could define pr_fmt() to avoid passing NS_OUTPUT_PREFIX. > > Something > > like: > > > > #define pr_fmt(fmt) "[nandsim]" fmt > > > > (remember to put this definition before include directives). > > > > Then, all you have to do is > > > > do { if (log) pr_debug(" log: " args); } while(0) > > > > > > > >  #define NS_DBG(args...) \ > > > - do { if (dbg) printk(KERN_DEBUG NS_OUTPUT_PREFIX " debug: > > > " args); } while(0) > > > + do { if (dbg) pr_debug(NS_OUTPUT_PREFIX " debug: " args); > > > } while(0) > > >  #define NS_WARN(args...) \ > > > - do { printk(KERN_WARNING NS_OUTPUT_PREFIX " warning: " > > > args); } while(0) > > > + do { pr_warn(NS_OUTPUT_PREFIX " warning: " args); } > > > while(0) > > >  #define NS_ERR(args...) \ > > > - do { printk(KERN_ERR NS_OUTPUT_PREFIX " error: " args); } > > > while(0) > > > + do { pr_err(NS_OUTPUT_PREFIX " error: " args); } while(0) > > >  #define NS_INFO(args...) \ > > > - do { printk(KERN_INFO NS_OUTPUT_PREFIX " " args); } > > > while(0) > > > + do { pr_info(NS_OUTPUT_PREFIX " " args); } while(0) > > >   > > >  /* Busy-wait delay macros (microseconds, milliseconds) */ > > >  #define NS_UDELAY(us) \ > > > diff --git a/drivers/mtd/nand/r852.c b/drivers/mtd/nand/r852.c > > > index fc9287a..3d54c6a 100644 > > > --- a/drivers/mtd/nand/r852.c > > > +++ b/drivers/mtd/nand/r852.c > > > @@ -935,7 +935,7 @@ static int  r852_probe(struct pci_dev *pci_dev, > > > const struct pci_device_id *id) > > >   &dev->card_detect_work, 0); > > >   > > >   > > > - printk(KERN_NOTICE DRV_NAME ": driver loaded > > > successfully\n"); > > > + pr_notice(DRV_NAME ": driver loaded successfully\n"); > > Same here: > > > > #define pr_fmt(fmt) DRV_NAME fmt > > I am facing the following errors here. > > > > In file included from drivers/mtd/nand/r852.c:22:0: > drivers/mtd/nand/r852.h:148:0: warning: "pr_fmt" redefined >  #define pr_fmt(fmt)  (DRV_NAME fmt) >  ^ > In file included from ./include/linux/kernel.h:14:0, >                  from drivers/mtd/nand/r852.c:10: > ./include/linux/printk.h:287:0: note: this is the location of the > previous definition >  #define pr_fmt(fmt) fmt That's because you didn't define pr_fmt() before all the #include directives in this driver. See the '#indef pr_fmt' statement in printk.h which is preventing redefinition of this symbol if the file including printk.h (either directly or indirectly) already defines it. -- Boris Brezillon, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering http://bootlin.com