checkpatch.pl (97eb3f24352ec6632c2127b35d8087d2a809a9b9) checkpatch.pl (33ee3b2e2eb9b4b6c64dcf9ed66e2ac3124e748c)
1#!/usr/bin/perl -w
2# (c) 2001, Dave Jones. (the file handling bit)
3# (c) 2005, Joel Schopp <jschopp@austin.ibm.com> (the ugly bit)
4# (c) 2007,2008, Andy Whitcroft <apw@uk.ibm.com> (new conditions, test suite)
5# (c) 2008-2010 Andy Whitcroft <apw@canonical.com>
6# Licensed under the terms of the GNU GPL License version 2
7
8use strict;

--- 2640 unchanged lines hidden (view full) ---

2649 }
2650
2651# no volatiles please
2652 my $asm_volatile = qr{\b(__asm__|asm)\s+(__volatile__|volatile)\b};
2653 if ($line =~ /\bvolatile\b/ && $line !~ /$asm_volatile/) {
2654 WARN("Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt\n" . $herecurr);
2655 }
2656
1#!/usr/bin/perl -w
2# (c) 2001, Dave Jones. (the file handling bit)
3# (c) 2005, Joel Schopp <jschopp@austin.ibm.com> (the ugly bit)
4# (c) 2007,2008, Andy Whitcroft <apw@uk.ibm.com> (new conditions, test suite)
5# (c) 2008-2010 Andy Whitcroft <apw@canonical.com>
6# Licensed under the terms of the GNU GPL License version 2
7
8use strict;

--- 2640 unchanged lines hidden (view full) ---

2649 }
2650
2651# no volatiles please
2652 my $asm_volatile = qr{\b(__asm__|asm)\s+(__volatile__|volatile)\b};
2653 if ($line =~ /\bvolatile\b/ && $line !~ /$asm_volatile/) {
2654 WARN("Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt\n" . $herecurr);
2655 }
2656
2657# SPIN_LOCK_UNLOCKED & RW_LOCK_UNLOCKED are deprecated
2658 if ($line =~ /\b(SPIN_LOCK_UNLOCKED|RW_LOCK_UNLOCKED)/) {
2659 ERROR("Use of $1 is deprecated: see Documentation/spinlocks.txt\n" . $herecurr);
2660 }
2661
2662# warn about #if 0
2663 if ($line =~ /^.\s*\#\s*if\s+0\b/) {
2664 CHK("if this code is redundant consider removing it\n" .
2665 $herecurr);
2666 }
2667
2668# check for needless kfree() checks
2669 if ($prevline =~ /\bif\s*\(([^\)]*)\)/) {

--- 134 unchanged lines hidden (view full) ---

2804 WARN("__func__ should be used instead of gcc specific __FUNCTION__\n" . $herecurr);
2805 }
2806
2807# check for semaphores initialized locked
2808 if ($line =~ /^.\s*sema_init.+,\W?0\W?\)/) {
2809 WARN("consider using a completion\n" . $herecurr);
2810
2811 }
2657# warn about #if 0
2658 if ($line =~ /^.\s*\#\s*if\s+0\b/) {
2659 CHK("if this code is redundant consider removing it\n" .
2660 $herecurr);
2661 }
2662
2663# check for needless kfree() checks
2664 if ($prevline =~ /\bif\s*\(([^\)]*)\)/) {

--- 134 unchanged lines hidden (view full) ---

2799 WARN("__func__ should be used instead of gcc specific __FUNCTION__\n" . $herecurr);
2800 }
2801
2802# check for semaphores initialized locked
2803 if ($line =~ /^.\s*sema_init.+,\W?0\W?\)/) {
2804 WARN("consider using a completion\n" . $herecurr);
2805
2806 }
2812# recommend strict_strto* over simple_strto*
2807# recommend kstrto* over simple_strto*
2813 if ($line =~ /\bsimple_(strto.*?)\s*\(/) {
2808 if ($line =~ /\bsimple_(strto.*?)\s*\(/) {
2814 WARN("consider using strict_$1 in preference to simple_$1\n" . $herecurr);
2809 WARN("consider using kstrto* in preference to simple_$1\n" . $herecurr);
2815 }
2816# check for __initcall(), use device_initcall() explicitly please
2817 if ($line =~ /^.\s*__initcall\s*\(/) {
2818 WARN("please use device_initcall() instead of __initcall()\n" . $herecurr);
2819 }
2820# check for various ops structs, ensure they are const.
2821 my $struct_ops = qr{acpi_dock_ops|
2822 address_space_operations|

--- 143 unchanged lines hidden ---
2810 }
2811# check for __initcall(), use device_initcall() explicitly please
2812 if ($line =~ /^.\s*__initcall\s*\(/) {
2813 WARN("please use device_initcall() instead of __initcall()\n" . $herecurr);
2814 }
2815# check for various ops structs, ensure they are const.
2816 my $struct_ops = qr{acpi_dock_ops|
2817 address_space_operations|

--- 143 unchanged lines hidden ---