From patchwork Thu Jan 3 00:06:34 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joe Perches X-Patchwork-Id: 1925861 Return-Path: X-Original-To: patchwork-linux-acpi@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 B0182DF230 for ; Thu, 3 Jan 2013 00:06:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752882Ab3ACAGf (ORCPT ); Wed, 2 Jan 2013 19:06:35 -0500 Received: from perches-mx.perches.com ([206.117.179.246]:39474 "EHLO labridge.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752785Ab3ACAGf (ORCPT ); Wed, 2 Jan 2013 19:06:35 -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 20459950; Wed, 02 Jan 2013 16:06:34 -0800 Message-ID: <1357171594.25181.19.camel@joe-AO722> Subject: [PATCH] checkpatch: prefer dev_( to dev_printk(KERN_ From: Joe Perches To: Andrew Morton , Andy Whitcroft Cc: 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: Wed, 02 Jan 2013 16:06:34 -0800 In-Reply-To: <20130102232743.5706.63153.stgit@grignak.americas.hpqcorp.net> References: <20130102232730.5706.82243.stgit@grignak.americas.hpqcorp.net> <20130102232743.5706.63153.stgit@grignak.americas.hpqcorp.net> X-Mailer: Evolution 3.6.0-0ubuntu3 Mime-Version: 1.0 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@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 --- scripts/checkpatch.pl | 10 ++++++++++ 1 file changed, 10 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" 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 4d2c7df..f50b32d 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2430,6 +2430,16 @@ 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"); + my $level2 = $level; + $level2 = "dbg" if ($level eq "debug"); + WARN("PREFER_DEV_LEVEL", + "Prefer dev_$level2(... 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