Skip to content

Commit 1a64e35

Browse files
authored
Enable checkpatch with make lint target (#11)
* Add support for running checkpatch * Add xclbin.h as UAPI
1 parent 079f0b3 commit 1a64e35

File tree

8 files changed

+459
-3
lines changed

8 files changed

+459
-3
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ tags
1010
*.mod.c
1111
modules.order
1212
Module.symvers
13+
TAGS

scripts/lint.sh

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/bin/bash
2+
3+
# SPDX-License-Identifier: GPL-2.0
4+
#
5+
# Copyright (C) 2019 Xilinx, Inc. All rights reserved.
6+
#
7+
8+
9+
set -e
10+
11+
ROOT=`git rev-parse --show-toplevel`
12+
ROOTSRC="$ROOT/src"
13+
out=TAGS
14+
15+
echo "Running checkpatch on source files in $ROOTSRC ..."
16+
ALL_FILES=$(git ls-files --exclude-standard --full-name $ROOTSRC)
17+
for item in $ALL_FILES;
18+
do
19+
# Skip all the libfdt files which are part of Linux kernel
20+
regex="^.+libfdt.*$"
21+
if [[ $item =~ $regex ]]; then
22+
continue
23+
fi
24+
# Skip all the "ref" files which are for reference only
25+
regex="^src\/ref\/.*$"
26+
if [[ $item =~ $regex ]]; then
27+
continue
28+
fi
29+
regex="^.+xclbin\.h$"
30+
if [[ $item =~ $regex ]]; then
31+
continue
32+
fi
33+
regex="^.+[c|h]$"
34+
if [[ $item =~ $regex ]]; then
35+
$ROOT/scripts/checkpatch.pl --no-tree --emacs --color=never -f $ROOT/$item || true
36+
fi
37+
done

src/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,6 @@ tags:
1515
clean:
1616
$(MAKE) -C lib clean
1717
$(MAKE) -C mgmt clean
18+
19+
lint:
20+
../scripts/lint.sh

0 commit comments

Comments
 (0)