blob: 5a6c1c2f6e490023d035d2f9ada338f07d4215fe [file] [log] [blame]
Jimmy Brisson0862f012020-04-02 15:19:12 -05001Checking source code style
2--------------------------
3
4When making changes to the source for submission to the project, the source must
5be in compliance with the Linux style guide. To assist with this, the project
6Makefile provides two targets, which both utilise the ``checkpatch.pl`` script
7that ships with the Linux source tree.
8
9To check the entire source tree, you must first download copies of
10``checkpatch.pl``, ``spelling.txt`` and ``const_structs.checkpatch`` available
11in the `Linux master tree`_ scripts directory, then set the ``CHECKPATCH``
12environment variable to point to ``checkpatch.pl`` (with the other 2 files in
13the same directory).
14
15Then use the following command:
16
17::
18
19 make CHECKPATCH=<path-to-linux>/linux/scripts/checkpatch.pl checkcodebase
20
21To limit the coding style checks to your local changes, use:
22
23::
24
25 make CHECKPATCH=<path-to-linux>/linux/scripts/checkpatch.pl checkpatch
26
27By default, this will check all patches between ``origin/master`` and your local
28branch. If you wish to use a different reference commit, this can be specified
29using the ``BASE_COMMIT`` variable.
30
31--------------
32
33*Copyright (c) 2019, Arm Limited. All rights reserved.*
34
35.. _Linux master tree: https://github.com/torvalds/linux/tree/master/