From patchwork Thu Jan 3 16:49:52 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joe Perches X-Patchwork-Id: 1928331 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id AEF66DF25A for ; Thu, 3 Jan 2013 16:50:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753709Ab3ACQtx (ORCPT ); Thu, 3 Jan 2013 11:49:53 -0500 Received: from perches-mx.perches.com ([206.117.179.246]:59071 "EHLO labridge.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753605Ab3ACQtw (ORCPT ); Thu, 3 Jan 2013 11:49:52 -0500 Received: from [173.51.221.202] (account joe@perches.com HELO [192.168.1.167]) by labridge.com (CommuniGate Pro SMTP 5.0.14) with ESMTPA id 20461943; Thu, 03 Jan 2013 08:49:51 -0800 Message-ID: <1357231792.25181.62.camel@joe-AO722> Subject: [PATCH V2] checkpatch: prefer dev_( to dev_printk(KERN_ From: Joe Perches To: Andy Whitcroft Cc: Andrew Morton , Lance Ortiz , bhelgaas@google.com, lance_ortiz@hotmail.com, jiang.liu@huawei.com, tony.luck@intel.com, bp@alien8.de, rostedt@goodmis.org, mchehab@redhat.com, linux-acpi@vger.kernel.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Date: Thu, 03 Jan 2013 08:49:52 -0800 In-Reply-To: <1357230494.25181.55.camel@joe-AO722> References: <20130102232730.5706.82243.stgit@grignak.americas.hpqcorp.net> <20130102232743.5706.63153.stgit@grignak.americas.hpqcorp.net> <1357171594.25181.19.camel@joe-AO722> <20130103100808.GG2649@dm> <1357230494.25181.55.camel@joe-AO722> X-Mailer: Evolution 3.6.0-0ubuntu3 Mime-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Add YA check to printk style. dev_ uses are functions and generate smaller object code than dev_printk(KERN_. Signed-off-by: Joe Perches --- V2: Remove unnecessary copy/paste logic from pr_ conversion above it. scripts/checkpatch.pl | 9 +++++++++ 1 file changed, 9 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 9de3a69..9a1ae72 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2425,6 +2425,15 @@ sub process { "Prefer pr_warn(... to pr_warning(...\n" . $herecurr); } + if ($line =~ /\bdev_printk\s*\(\s*KERN_([A-Z]+)/) { + my $orig = $1; + my $level = lc($orig); + $level = "warn" if ($level eq "warning"); + $level = "dbg" if ($level eq "debug"); + WARN("PREFER_DEV_LEVEL", + "Prefer dev_$level(... to dev_printk(KERN_$orig, ...\n" . $herecurr); + } + # function brace can't be on same line, except for #defines of do while, # or if closed on same line if (($line=~/$Type\s*$Ident\(.*\).*\s{/) and