All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@suse.cz>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: eric.piel@tremplin-utc.net, trenn@suse.de, linux-kernel@vger.kernel.org
Subject: checkpatch fun (was Re: hp accelerometer: add freefall detection)
Date: Tue, 20 Jan 2009 11:32:19 +0100	[thread overview]
Message-ID: <20090120103219.GK2576@elf.ucw.cz> (raw)
In-Reply-To: <20090116143404.ccf2d9ee.akpm@linux-foundation.org>

On Fri 2009-01-16 14:34:04, Andrew Morton wrote:
> On Fri, 16 Jan 2009 13:19:40 +0100
> Pavel Machek <pavel@suse.cz> wrote:
> 
> > new file mode 100755
> > index 0000000..7d17764
> > --- /dev/null
> > +++ b/Documentation/hwmon/hpfall.c
> 
> checkpatch has fun with this file.

Well, I have fun with checkpatch :-(.

pavel@amd:/data/l/linux/Documentation$ ../scripts/checkpatch.pl
hwmon/hpfall.c
ERROR: Does not appear to be a unified-diff format patch

total: 1 errors, 0 warnings, 0 lines checked

hwmon/hpfall.c has style problems, please review.  If any of these
errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
pavel@amd:/data/l/linux/Documentation$ ../scripts/checkpatch.pl -f
hwmon/hpfall.c
Unknown option: f
pavel@amd:/data/l/linux/Documentation$ ../scripts/checkpatch.pl -h
Unknown option: h
pavel@amd:/data/l/linux/Documentation$ ../scripts/checkpatch.pl --help
Unknown option: help
pavel@amd:/data/l/linux/Documentation$ 

Ok, will fix.

> > -struct acpi_lis3lv02d adev;
> > +struct acpi_lis3lv02d adev = {
> > +	.misc_wait   = __WAIT_QUEUE_HEAD_INITIALIZER(adev.misc_wait),
> > +};
> > +
> >  EXPORT_SYMBOL_GPL(adev);
> 
> This seems a rather poor name for a globally-visible identifier.

Hmm, right. lis_acpi_dev should be better. Will fix.

---

I tried checkpatch-ing a file, and not only my attempts to use it
failed, my attempts to get help failed too.

pavel@amd:/data/l/linux/Documentation$ ../scripts/checkpatch.pl hwmon/hpfall.c
ERROR: Does not appear to be a unified-diff format patch
....
pavel@amd:/data/l/linux/Documentation$ ../scripts/checkpatch.pl -f hwmon/hpfall.c
Unknown option: f
pavel@amd:/data/l/linux/Documentation$ ../scripts/checkpatch.pl -h
Unknown option: h
pavel@amd:/data/l/linux/Documentation$ ../scripts/checkpatch.pl --help
Unknown option: help

Make -f alias of --file, and print help if user passes unknown option.

Signed-off-by: Pavel Machek <pavel@suse.cz>

---
commit 4ef496ab198210648c310b8ae25872b9f99bee27
tree 1155a0dad369dc33362994bb6ff74868c7408f4c
parent f155017822e2fea0bc7434545cc63c2c8d363e59
author Pavel <pavel@suse.cz> Tue, 20 Jan 2009 11:31:52 +0100
committer Pavel <pavel@suse.cz> Tue, 20 Jan 2009 11:31:52 +0100

 scripts/checkpatch.pl |   34 ++++++++++++++++++++--------------
 1 files changed, 20 insertions(+), 14 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 45eb0ae..c9eeda9 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -28,6 +28,22 @@ my $mailback = 0;
 my $summary_file = 0;
 my $root;
 my %debug;
+
+sub help {
+	print "usage: $P [options] patchfile\n";
+	print "version: $V\n";
+	print "options: -q               => quiet\n";
+	print "         --no-tree        => run without a kernel tree\n";
+	print "         --terse          => one line per report\n";
+	print "         --emacs          => emacs compile window format\n";
+	print "         --file           => check a source file\n";
+	print "         --strict         => enable more subjective tests\n";
+	print "         --root           => path to the kernel tree root\n";
+	print "         --no-summary     => suppress the per-file summary\n";
+	print "         --summary-file   => include the filename in summary\n";
+	exit(1);
+}
+
 GetOptions(
 	'q|quiet+'	=> \$quiet,
 	'tree!'		=> \$tree,
@@ -35,7 +51,7 @@ GetOptions(
 	'patch!'	=> \$chk_patch,
 	'emacs!'	=> \$emacs,
 	'terse!'	=> \$terse,
-	'file!'		=> \$file,
+	'f|file!'	=> \$file,
 	'subjective!'	=> \$check,
 	'strict!'	=> \$check,
 	'root=s'	=> \$root,
@@ -45,23 +61,13 @@ GetOptions(
 
 	'debug=s'	=> \%debug,
 	'test-only=s'	=> \$tst_only,
-) or exit;
+) or help;
 
 my $exit = 0;
 
+
 if ($#ARGV < 0) {
-	print "usage: $P [options] patchfile\n";
-	print "version: $V\n";
-	print "options: -q               => quiet\n";
-	print "         --no-tree        => run without a kernel tree\n";
-	print "         --terse          => one line per report\n";
-	print "         --emacs          => emacs compile window format\n";
-	print "         --file           => check a source file\n";
-	print "         --strict         => enable more subjective tests\n";
-	print "         --root           => path to the kernel tree root\n";
-	print "         --no-summary     => suppress the per-file summary\n";
-	print "         --summary-file   => include the filename in summary\n";
-	exit(1);
+    	help;
 }
 
 my $dbg_values = 0;



-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

  reply	other threads:[~2009-01-20 10:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-12  9:29 hp accelerometer: fix LED handling and add freefall detection Pavel Machek
2009-01-12  9:33 ` Éric Piel
     [not found]   ` <fd6b62c10901120150q6b00640dm72c0ec5d0bd7a9e2@mail.gmail.com>
2009-01-12 10:02     ` Pavel Machek
2009-01-16 12:19   ` hp accelerometer: " Pavel Machek
2009-01-16 22:34     ` Andrew Morton
2009-01-20 10:32       ` Pavel Machek [this message]
2009-03-10 17:21         ` [PATCH] checkpatch: make -f alias --file, add --help, more verbose help message Hannes Eder
2009-03-10 18:10           ` Andy Whitcroft
2009-03-10 18:52             ` Andy Whitcroft
2009-03-11  8:18           ` Pavel Machek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090120103219.GK2576@elf.ucw.cz \
    --to=pavel@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=eric.piel@tremplin-utc.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=trenn@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.