Received: by 10.223.185.116 with SMTP id b49csp868699wrg; Tue, 20 Feb 2018 09:08:10 -0800 (PST) X-Google-Smtp-Source: AH8x225DirG73CcLc8pmjXJnS2kxOBaS1gnp6BA0WKcwCoPKSqG7gALuDhe7dkPfqYmLkWTcrvem X-Received: by 10.99.4.131 with SMTP id 125mr210672pge.375.1519146489879; Tue, 20 Feb 2018 09:08:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519146489; cv=none; d=google.com; s=arc-20160816; b=VX3dPtt8PgMMsj2KGSuuN23gm72gyscsVoYy/G2uFHYQS4Anratpflw1QFcel3G36i 6IIQXF+rdt0By6nhfmQNsvc6vvgE9ce3JrlMiG5xzKJTGmj0W0xDB7GnRUDsSKGBQnWD Hv7ud09K35WKGT6tZdb9IKwzhD8aD9Zvy2zDPwYUMdVhZG6K3h0gKjPGGcJz+7nKOWVz B7TU7ZU+j+050vi/V6W+gq2prfgXmmFyqZJfhXiZs58P6FGKvPxw3jw9aWUTvxirXxHk Ovf5qvby0iHOVBC+OVKHw/sBqez1+4eOUDXtWMchYIEiM9b45yOSiAJkOkRZEtrb2O8G DHeQ== 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=W/bzgEnN3D/AkN8lzxeYXCqhvBS3EmIrzdMG0wnyppQ=; b=VEVqazjkRthR6YFnbODWSCKbM+sIxtmOafY5go9TzHF5ENAOHFAFk0sQv9pvi5s/O3 NILbWG7ujZnzZn5ZDhjOtufRWQlwD3vr4H4B3TNLRyRuv34t11Ru25fyjARF0+IbT77g xvnLOdIDulIaTLEe3M+qUiscLM9xBSd6mB2reTOQfAWHftXFj+3FOCXG08lViWTObUmR peWpZJ2RqOoH66QUMJsHK8PYMEJ+3I5FuJH7Rd6kf+BkKWhZG6OtuCoyevFNhRsIT6jh /sMT2VirX96wA9h9+zXQkyX4c89KWLSTg4I8ReITGIr/0D6hCe7zGPriTXJ4Uq0L5n6D my4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=nlyeEs6t; 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 p5si1149536pgn.197.2018.02.20.09.07.55; Tue, 20 Feb 2018 09:08:09 -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=nlyeEs6t; 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 S1753325AbeBTRGu (ORCPT + 99 others); Tue, 20 Feb 2018 12:06:50 -0500 Received: from mail-pl0-f68.google.com ([209.85.160.68]:45695 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752491AbeBTRGs (ORCPT ); Tue, 20 Feb 2018 12:06:48 -0500 Received: by mail-pl0-f68.google.com with SMTP id p5so7738796plo.12 for ; Tue, 20 Feb 2018 09:06:48 -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=W/bzgEnN3D/AkN8lzxeYXCqhvBS3EmIrzdMG0wnyppQ=; b=nlyeEs6t/OktE+/blrJRCaW0GLRcQ84ZBBBR7Ipj6rDbFlMrhaSaeWfSIjS0f8atDD Um8+4C1w2nD132zluzHbRzxku52VFMnN5bKQkOqJx3yZWH+U6TEZgM2/jUNe5QaY/TFO +RjUAdBfqiZ/PNHIkSppGbTGRm5cvxZjfVBaprmTGsyIqQfp5R/ulVcSp5IQc8fTc6ws wW3oG7sFlj7tnesyfDuqeGO2dYG3uQlHCcZoawDtZtDaRrQPiTgMQvqqeeyDr33dyMJ9 jVGayx4DpPlwUnv/lrpBvC2LviZdOUvZpR88da/9PsgHfEgrnOFzxEToXBQsPdMahAeo Nrag== 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=W/bzgEnN3D/AkN8lzxeYXCqhvBS3EmIrzdMG0wnyppQ=; b=LB754UQWJbLgMdFSY8gqPFyakCYiqjjtQjKxyM7fTKbNnlZm0k3CL5WEnY3uBZjKK5 Tob8+/ZelfFMsoF+4E3KXIbf0AvFixZvxncbVsVN2kA7SKGMnL3ArTAz+vQWG5gIQjyh klKp5mPF90SU9DASsc1ZzTCi+xgMF9O5fJOZ72cj1Zq4fOfFwTn7FWbsyYdJijSlzy7a Vtd+7X6qhvneAD5ghqjvKibEWnUkvxe8ga/WkQ4KDHIM2LXOF2roWQPQq7xo7pqRcytb zgCo532tUREITlgZ/P/BHXgCm4C0TWJt7gtL+fwHleDgxF2wFgaV8jRVXqDD/JMkA9BK MzsQ== X-Gm-Message-State: APf1xPAXquCegq8HxF02k7NR/8JD39Nt7JZOWU6fzU2iB70IGxx9SBNh snvNuLnhbKyhORqvQUz9His= X-Received: by 2002:a17:902:bc02:: with SMTP id n2-v6mr292290pls.52.1519146407987; Tue, 20 Feb 2018 09:06:47 -0800 (PST) Received: from [10.0.2.15] ([103.212.140.130]) by smtp.googlemail.com with ESMTPSA id z79sm16883348pfa.139.2018.02.20.09.06.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Feb 2018 09:06:46 -0800 (PST) Message-ID: <1519146401.12276.4.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 22:36:41 +0530 In-Reply-To: <20180219155115.3d9d1bd5@bbrezillon> References: <1519046025-9412-1-git-send-email-shreeya.patel23498@gmail.com> <20180219155115.3d9d1bd5@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 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 I tried doing undef and then define, but it didn't work. > > > > >   return 0; > >   > >  error10: > > diff --git a/drivers/mtd/nand/r852.h b/drivers/mtd/nand/r852.h > > index 8713c57..63de9b6 100644 > > --- a/drivers/mtd/nand/r852.h > > +++ b/drivers/mtd/nand/r852.h > > @@ -149,12 +149,12 @@ struct r852_device { > >   > >  #define dbg(format, ...) \ > >   if (debug) \ > > - printk(KERN_DEBUG DRV_NAME ": " format "\n", ## > > __VA_ARGS__) > > + pr_debug(DRV_NAME ": " format "\n", ## > > __VA_ARGS__) > >   > >  #define dbg_verbose(format, ...) \ > >   if (debug > 1) \ > > - printk(KERN_DEBUG DRV_NAME ": " format "\n", ## > > __VA_ARGS__) > > + pr_debug(DRV_NAME ": " format "\n", ## > > __VA_ARGS__) > >   > And here as well. > > Regards, > > Boris >