From: Josh Triplett <josh@joshtriplett.org>
To: linux-kernel@vger.kernel.org
Cc: Nandini Hanumanthagowda <nandu.hgowda@gmail.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Andy Whitcroft <apw@canonical.com>, Joe Perches <joe@perches.com>
Subject: [PATCH] checkpatch: Allow spaces before the ':' of a bitfield
Date: Mon, 14 Oct 2013 10:32:08 -0700 [thread overview]
Message-ID: <20131014173207.GE16517@jtriplet-mobl1> (raw)
In-Reply-To: <687af3bd-edc6-40cf-b994-0d0fdb7cd30d@googlegroups.com>
checkpatch warns about spaces both before and after the ':' separating a
bitfield name from its width. However, many drivers do put space before
the : to line up the widths, which makes the definition significantly
more readable; checkpatch should not warn about that. Remove the
warning for space before the ':' of a bitfield.
Reported-by: Nandini Hanumanthagowda <nandu.hgowda@gmail.com>
Reported-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Josh Triplett <josh@joshtriplett.org>
---
Nandini and Greg observed this issue as part of checkpatch warnings on a
staging driver (octeon-usb), and both agreed that checkpatch should not
issue this warning; patching accordingly.
scripts/checkpatch.pl | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index ed16a68..9e36345 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2934,8 +2934,7 @@ sub process {
# No spaces for:
# ->
- # : when part of a bitfield
- } elsif ($op eq '->' || $opv eq ':B') {
+ } elsif ($op eq '->') {
if ($ctx =~ /Wx.|.xW/) {
if (ERROR("SPACING",
"spaces prohibited around that '$op' $at\n" . $hereptr)) {
@@ -2947,6 +2946,19 @@ sub process {
}
}
+ # : when part of a bitfield
+ } elsif ($opv eq ':B') {
+ if ($ctx =~ /.xW/) {
+ if (ERROR("SPACING",
+ "spaces prohibited after that '$op' $at\n" . $hereptr)) {
+ $good = $fix_elements[$n] . rtrim($fix_elements[$n + 1]);
+ if (defined $fix_elements[$n + 2]) {
+ $fix_elements[$n + 2] =~ s/^\s+//;
+ }
+ $line_fixed = 1;
+ }
+ }
+
# , must have a space on the right.
} elsif ($op eq ',') {
if ($ctx !~ /.x[WEC]/ && $cc !~ /^}/) {
--
1.8.4.rc3
next parent reply other threads:[~2013-10-14 17:32 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20131013121635.GA29395@nandinih-Inspiron-5521>
[not found] ` <20131013153943.GA27861@kroah.com>
[not found] ` <687af3bd-edc6-40cf-b994-0d0fdb7cd30d@googlegroups.com>
2013-10-14 17:32 ` Josh Triplett [this message]
2013-10-14 17:51 ` Joe Perches
2013-10-14 18:00 ` Josh Triplett
2013-10-14 18:04 ` Joe Perches
2013-10-14 20:20 ` Josh Triplett
2013-10-14 20:23 ` Joe Perches
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=20131014173207.GE16517@jtriplet-mobl1 \
--to=josh@joshtriplett.org \
--cc=apw@canonical.com \
--cc=gregkh@linuxfoundation.org \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nandu.hgowda@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®