Received: by 10.223.185.116 with SMTP id b49csp901313wrg; Tue, 20 Feb 2018 09:38:23 -0800 (PST) X-Google-Smtp-Source: AH8x224xg8cq0LrkB6Ku+vB2Si37ZDcY662JvrRRnK1wXgEc6KTl+/T8//aBdRDvS1I81kGPDsM7 X-Received: by 10.98.137.147 with SMTP id n19mr367762pfk.193.1519148303848; Tue, 20 Feb 2018 09:38:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519148303; cv=none; d=google.com; s=arc-20160816; b=t1jVt5QJTLR2cywiLF4OPNHUhwcPta2LoRlABq5MI5mjUL4zSvXSRBlOCpShywJUsO Wj51jfSbmn8i4YaBn446jn/p9c++qw+/2HBcgONF4WUja47FXE2ohs+7qYmNxSU7n/Ty KX/iq5h9IRTdToQHIpleihAVWgtfXUJ9XIcXUXI/ZaJswP3IYwJKPJyrASHYMIKpVf3D 7jvWbCrvcY+6YerBwU/nG2BO4BFeebpJchKAKNAouX6TY9pZn8suSUu2hqEUZSQKTvjc sfZ6Y6Z5gbKu3oM1tq0EKM1X74FOVhikyPn8uIPEsp8vpFSwFNChdPG69Lwycp9Gdtfa Kqdg== 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:date:cc:to:from:subject:message-id :dkim-signature:arc-authentication-results; bh=FMUWuQD9csgV7Orm8TT9VSY74QSo3DuvYN28HbWPuhw=; b=fiwghacN96xU2GSxdzlI2s37K9C5SbzK3h7gHHV0dnhZYlMulbJm5pi8s4YZJCtW1c MJ1ljPpdDVURD8fqFYa2r3X4t64NZKhm/+SC85BtntmcDLRpy2N+ElgFbpGS32jsYjIO 7P/f2k7c74jtBQZs+HAQ8rb4duLB/2uGxjP0h+q/7GQb41miP9xuaLDXFVnJH6MkMuQj 1xkRDP0orbtpIjF6Vq+yU66Lo/P6pghNNhOmfCNOHAWvH0Gdp5NOFWLmIFkpYCWCcdIq ZOAOWEOitLzbykdbLdYKfSQyAK+QXa/oKWG8f+zSD1o65HItEYLBnAWPXgu/MkiXlabJ R1dA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Dp/VB9d8; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p15si9544505pgs.328.2018.02.20.09.38.09; Tue, 20 Feb 2018 09:38:23 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Dp/VB9d8; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753341AbeBTRh2 (ORCPT + 99 others); Tue, 20 Feb 2018 12:37:28 -0500 Received: from mail-pf0-f196.google.com ([209.85.192.196]:33486 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753129AbeBTRh0 (ORCPT ); Tue, 20 Feb 2018 12:37:26 -0500 Received: by mail-pf0-f196.google.com with SMTP id q13so793615pff.0 for ; Tue, 20 Feb 2018 09:37:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:subject:from:to:cc:date:in-reply-to:references :mime-version:content-transfer-encoding; bh=FMUWuQD9csgV7Orm8TT9VSY74QSo3DuvYN28HbWPuhw=; b=Dp/VB9d88gNl7HjT9FZVbdny4rcJ53YjWMCGW01riI+TV6D1sAb3/aF9cMXaCUd3Cc +FjbY6gluXgqlfU5oV6sLBeDbidBPqYL8BZk0UYBYXVzQUGh08BK9OnfPFkxRe1KOrcN 2N89TxIvyD7WGrSsmq+EhQjzJMcTj6Ja9ADlUPPZ3nESS0unyfyrY0MiKMUZ17JxhR+u wanwFF6W5w8Ps3wWp12nRQ7EL6z3N+DrQ+10REMIxiRkwQn0JsDljLNOwje0QM+MSekf zzeClGgLYFcx29Inhz0aaTniprKAqPdFFESGGhwvlX494nF/ZHG081GoISS+U6cD+Dgj Svow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:mime-version:content-transfer-encoding; bh=FMUWuQD9csgV7Orm8TT9VSY74QSo3DuvYN28HbWPuhw=; b=XEncQlK4zSUIT6RhaEuO+pyUX3x563K0+g66JEm4i+Dvm8YWMARcQDHUgrnnQyNZKA /kXMQ1ax4GDiKQsC7fKlXdjlhSP+/Flu9FxlQFPYC5c2hoj/uqIW1n8QTIYgBLcqBrUx /5fNCEbi1a8pe8fGOjgam5kg5M+Gud9pnbxyNPR9GGgEMUsiX4VOZHqW7qO7OClY1Ss4 oWTgNjJEL1mUAeUyGk0441b5sjiov0gpSG8zy6WiGcWcvVci9rDGRbTVxtw8xEPeJJ7E Szn8tS9Cazgv9yyNXl03W6JvxYAIE61xKaqpNOrfKCUyTcOxAVx0V3Tydq6Xc2eRTg4V nWyQ== X-Gm-Message-State: APf1xPArdQYyWs4qzGJQqTxc40TjLSZdN9DTeT25Of6KKoZFImpf33Zl he50ZvuXN5FNZvSJs8EM6Vw= X-Received: by 10.98.150.82 with SMTP id c79mr399123pfe.88.1519148246029; Tue, 20 Feb 2018 09:37:26 -0800 (PST) Received: from [10.0.2.15] ([103.212.140.130]) by smtp.googlemail.com with ESMTPSA id f3sm57416704pgn.9.2018.02.20.09.37.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Feb 2018 09:37:25 -0800 (PST) Message-ID: <1519148238.14621.3.camel@gmail.com> Subject: Re: [PATCH NAND v2] mtd: nand: Replace printk() with appropriate pr_*macro() From: Shreeya Patel To: Boris Brezillon 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 Date: Tue, 20 Feb 2018 23:07:18 +0530 In-Reply-To: <20180220181647.6f2367b6@bbrezillon> References: <1519046025-9412-1-git-send-email-shreeya.patel23498@gmail.com> <20180219155115.3d9d1bd5@bbrezillon> <1519146401.12276.4.camel@gmail.com> <20180220181647.6f2367b6@bbrezillon> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.18.5.2-0ubuntu3.2 Mime-Version: 1.0 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, 2018-02-20 at 18:16 +0100, Boris Brezillon wrote: > 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,  "En > > > > able > > > > 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. Yes, and that is why I did undef before defining it again in the r852.c file. Shouldn't it work in this manner? >