Re: [PATCH 2/2] staging: slicoss: fix missing blank line (fwd)
From: Joe Perches
Date: Wed Apr 06 2016 - 02:29:49 EST
On Wed, 2016-04-06 at 07:17 +0200, Julia Lawall wrote:
> I have the impression that __iomem is in the wrong place in the following
> code. Perhaps checkpatch could do something about that? Coccinelle,
> unfortunately, skips over such annotations, to simplify parsing...
[]
> __iomem struct slic_regs *slic_regs = adapter->slic_regs;
Maybe so.
There aren't many of these in the kernel tree.
$ git grep -E "^\s+__iomem" | wc -l
46
And there are a whole lot more after the type,
so maybe this is appropriate.
---
scripts/checkpatch.pl | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index e3d9c34..1b23495 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3400,6 +3400,14 @@ sub process {
}
}
+# check for attributions like __iomem before the type
+ while ($sline =~ m{(\b$Type\s*$Ident)}g) {
+ my $tmp = trim($1);
+ next if ($tmp !~ /^($Sparse)\b/);
+ WARN("ATTRIBUTE_LOCATION",
+ "attribute '$1' should be positioned after the type\n" . $herecurr);
+ }
+
# check for misordered declarations of char/short/int/long with signed/unsigned
while ($sline =~ m{(\b$TypeMisordered\b)}g) {
my $tmp = trim($1);