summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2011-07-25 17:13:24 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2011-07-25 20:57:16 -0700
commit39b7e2878e783af027ddd3530f7a0abec330905d (patch)
treef8b5adf97fc9806310c560e12463d1cb56c20b2f /scripts
parent2011247550c1b903a9ecd68f6eb3e9e7b7b07f52 (diff)
downloadlwn-39b7e2878e783af027ddd3530f7a0abec330905d.tar.gz
lwn-39b7e2878e783af027ddd3530f7a0abec330905d.zip
checkpatch: add a "prefer __aligned" check
Prefer the use of __aligned(size) over __attribute__((__aligned___(size))) Link: http://lkml.kernel.org/r/20110609094526.1571774c.akpm@linux-foundation.org Suggested-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/checkpatch.pl5
1 files changed, 5 insertions, 0 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index b14f830cb0fa..8f35f0e03518 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2891,6 +2891,11 @@ sub process {
WARN("__packed is preferred over __attribute__((packed))\n" . $herecurr);
}
+# Check for __attribute__ aligned, prefer __aligned
+ if ($line =~ /\b__attribute__\s*\(\s*\(.*aligned/) {
+ WARN("__aligned(size) is preferred over __attribute__((aligned(size)))\n" . $herecurr);
+ }
+
# check for sizeof(&)
if ($line =~ /\bsizeof\s*\(\s*\&/) {
WARN("sizeof(& should be avoided\n" . $herecurr);