From: Andi Kleen <andi@firstfloor.org>
To: apw@canonical.com
Cc: joe@perches.com, linux-kernel@vger.kernel.org,
Andi Kleen <ak@linux.intel.com>
Subject: [PATCH] checkpatch: add a rule to check devinitconst mistakes
Date: Mon, 5 Aug 2013 15:10:51 -0700 [thread overview]
Message-ID: <1375740651-7716-1-git-send-email-andi@firstfloor.org> (raw)
From: Andi Kleen <ak@linux.intel.com>
Check for const __devinitdata and non const __devinitconst
People get this regularly wrong and it breaks the LTO builds,
as it causes a section attribute conflict.
This doesn't catch all mistakes -- spreading over multiple lines,
getting const pointers wrong, but hopefully the common ones.
Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
scripts/checkpatch.pl | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 2ee9eb7..5d68d9c 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2676,6 +2676,15 @@ sub process {
}
}
+# check for __devinitdata with const or const without __devintconst
+# XXX should scan multiple lines and handle misplaced consts for pointers
+ if ($line =~ /const/ && $line =~ /__(dev)?initdata/) {
+ ERROR("DEVINITCONST", "const init definition must use __devinitconst");
+ }
+ if ($line =~ /__(dev)?initconst/ && $line !~ /\Wconst\W/) {
+ ERROR("DEVINITCONST", "__devinitconst must have have const definition");
+ }
+
# check for spacing round square brackets; allowed:
# 1. with a type on the left -- int [] a;
# 2. at the beginning of a line for slice initialisers -- [0...10] = 5,
--
1.8.3.1
next reply other threads:[~2013-08-05 22:10 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-05 22:10 Andi Kleen [this message]
2013-08-05 23:30 ` Joe Perches
2013-09-15 20:26 ` [PATCH] checkpatch: add rules to check init attribute and const defects Joe Perches
2013-09-15 21:04 ` Andi Kleen
2013-09-16 2:34 ` [PATCH v2] " Joe Perches
2013-09-16 2:41 ` [untested checkpatch patch] treewide: Convert __initdata and __initconst misuses Joe Perches
-- strict thread matches above, loose matches on Subject: below --
2013-04-21 3:33 [PATCH] checkpatch: add a rule to check devinitconst mistakes Andi Kleen
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=1375740651-7716-1-git-send-email-andi@firstfloor.org \
--to=andi@firstfloor.org \
--cc=ak@linux.intel.com \
--cc=apw@canonical.com \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
/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
Powered by JetHome