Received: by 10.223.185.116 with SMTP id b49csp2005073wrg; Thu, 22 Feb 2018 06:46:34 -0800 (PST) X-Google-Smtp-Source: AH8x226TGZzxlXym7Vho17BlEagGcuzqr2RD6MWfl/XlcZWNPI4wUZpaQXOqVUUAA4IFJmpykGbp X-Received: by 10.101.83.76 with SMTP id w12mr5627551pgr.95.1519310794169; Thu, 22 Feb 2018 06:46:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519310794; cv=none; d=google.com; s=arc-20160816; b=zfOAYSfjg2h4I6iI9TRc0sZjidji52xMcOrAmUX3UzHTmrIdkuFe39BwH2WAGXSj1i /FL6+GyD0OhqxqvskR75VIyxCn2S6OhWDjuwYmYE9ZuDTYd5fbI6jPEqj7EJs5qDAH9Y tNawCYdmstcV0Q0lfy9qC6dm2fXhqKpz72x+zqBeZaIvjGKczlFZu47SW3jhrS/+ukoX WVHOt6Nk6F3wo8brgBmTblQHkOkFSl4CzXxxMFqAi4PrtrLdGN1M6SwNThslK/5KJ6HU UxGC+swRLFJ6FsDmbqj3wUwAH1uFFWRKVanIqiw/c6whNeyj3zWd0hn1Yva2fwgKWqX1 LArw== 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=shK39Y+F9I0j67zUagZ839PlkE6NbHRKOBX8h1B4ZCw=; b=Xb/U9Rj82sCb+6LKl9ynhHk6pnV4MV53THDTARsIF2hYWPmBjKyebFGzHMdrUrXSRU bBB+WG+wIJCe94n8bcJ6cHYyyWEVvyCfnBlgW8o8Ab4lLBnUwAZLd9ZPjIxRnrgMFf8G 3cUWV1yqMlnuU2kFwpGyEKiJlVk6ahEKxje3pB5wH5XpJueOby9m4A6teXB7NXuG27vb qPN0/f1euocTqs3yNdJkZsIHNFLv0LRxVDRqKwL5t4O91ULRy0oZDUOa1ld3TPrVwD4n xa8rO9tBZhsk467XN5606MWuaXIizTRnmec3GxR+cYndxj5ngfxEv8k6X5coXlvana04 cK6Q== 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 e22si149445pfj.33.2018.02.22.06.46.18; Thu, 22 Feb 2018 06:46:34 -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 S1753863AbeBVOpf (ORCPT + 99 others); Thu, 22 Feb 2018 09:45:35 -0500 Received: from mail.free-electrons.com ([62.4.15.54]:43387 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753651AbeBVOpe (ORCPT ); Thu, 22 Feb 2018 09:45:34 -0500 Received: by mail.free-electrons.com (Postfix, from userid 110) id EFECF207F1; Thu, 22 Feb 2018 15:45:31 +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, URIBL_BLOCKED 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 59114207BB; Thu, 22 Feb 2018 15:45:09 +0100 (CET) Date: Thu, 22 Feb 2018 15:45:09 +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 v3] mtd: nand: Replace printk() with appropriate pr_*() macro Message-ID: <20180222154509.4837eb38@bbrezillon> In-Reply-To: <1519305014-2547-1-git-send-email-shreeya.patel23498@gmail.com> References: <1519305014-2547-1-git-send-email-shreeya.patel23498@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=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Shreeya, On Thu, 22 Feb 2018 18:40:14 +0530 Shreeya Patel wrote: > diff --git a/drivers/mtd/nand/diskonchip.c b/drivers/mtd/nand/diskonchip.c > index c3aa53c..8643512 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_debug("Detected %d chips per floor.\n", i); Just want to add some more context on pr_debug(), nothing that requires changes on your side, but as Richard said, it's important to explain it. pr_debug() and printk(KERN_DEBUG) are not exactly the same. pr_debug() calls are NOPs by default unless you have enabled the CONFIG_DYNAMIC_DEBUG option or defined DEBUG (either directly in the sources or by passing -DDEBUG to gcc). This is not the case with printk(KERN_DEBUG). If you want to know more about dynamic debug, you can read [1]. > diff --git a/drivers/mtd/nand/r852.c b/drivers/mtd/nand/r852.c > index fc9287a..cd3cd1c 100644 > --- a/drivers/mtd/nand/r852.c > +++ b/drivers/mtd/nand/r852.c > @@ -7,6 +7,9 @@ > * published by the Free Software Foundation. > */ > > +#define DRV_NAME "r852" > +#define pr_fmt(fmt) DRV_NAME fmt It would be nicer with: #define pr_fmt(fmt) DRV_NAME ": " fmt ... > + > #include > #include > #include > @@ -935,7 +938,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(": driver loaded successfully\n"); and then pr_notice("driver loaded successfully\n"); > return 0; > > error10: > diff --git a/drivers/mtd/nand/r852.h b/drivers/mtd/nand/r852.h > index 8713c57..709eced 100644 > --- a/drivers/mtd/nand/r852.h > +++ b/drivers/mtd/nand/r852.h > @@ -145,16 +145,16 @@ struct r852_device { > }; > > #define DRV_NAME "r852" You don't need this definition anymore, it's been moved to the .c file. Actually, if you keep it you'll hit a 'redefine' error. > - > +#define pr_fmt(fmt) DRV_NAME fmt Why do you redefine it here? The only file including r852.h is r852.c, and pr_fmt() has been defined before all include directives, so when the preprocessor reaches this point pr_fmt() already has a valid definition. > > #define dbg(format, ...) \ > if (debug) \ > - printk(KERN_DEBUG DRV_NAME ": " format "\n", ## __VA_ARGS__) > + pr_debug(": " format "\n", ## __VA_ARGS__) > > #define dbg_verbose(format, ...) \ > if (debug > 1) \ > - printk(KERN_DEBUG DRV_NAME ": " format "\n", ## __VA_ARGS__) > + pr_debug(": " format "\n", ## __VA_ARGS__) With the pr_fmt() definition modified as suggested it should be: pr_debug(format "\n", ## __VA_ARGS__) Regards, Boris [1]https://01.org/linuxgraphics/gfx-docs/drm/admin-guide/dynamic-debug-howto.html -- Boris Brezillon, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com