Re: [PATCH -next v4] docs: document all error message types in checkpatch

2021-03-25 Thread Jonathan Corbet
Dwaipayan Ray  writes:

> All the error message types now have a verbose description.
>
> Also there are two new groups of message types:
>
> - Macros, Attributes and Symbols
> - Functions and Variables
>
> Rearrange the message types to fit these new groups as needed.
>
> Reviewed-by: Lukas Bulwahn 
> Signed-off-by: Dwaipayan Ray 
> ---
>
> Changes in v4:
> - Use lore.kernel.org links
> - modify explanation for DEFINE_ARCH_HAS
>
> Changes in v3:
> - Add more explanation for LOCKDEP
> - Minor grammar fixes
>
> Changes in v2:
> - Replace 4.10 kernel doc links by latest
>
>  Documentation/dev-tools/checkpatch.rst | 318 ++---
>  1 file changed, 280 insertions(+), 38 deletions(-)

Applied, thanks.

jon


[PATCH -next v4] docs: document all error message types in checkpatch

2021-03-22 Thread Dwaipayan Ray
All the error message types now have a verbose description.

Also there are two new groups of message types:

- Macros, Attributes and Symbols
- Functions and Variables

Rearrange the message types to fit these new groups as needed.

Reviewed-by: Lukas Bulwahn 
Signed-off-by: Dwaipayan Ray 
---

Changes in v4:
- Use lore.kernel.org links
- modify explanation for DEFINE_ARCH_HAS

Changes in v3:
- Add more explanation for LOCKDEP
- Minor grammar fixes

Changes in v2:
- Replace 4.10 kernel doc links by latest

 Documentation/dev-tools/checkpatch.rst | 318 ++---
 1 file changed, 280 insertions(+), 38 deletions(-)

diff --git a/Documentation/dev-tools/checkpatch.rst 
b/Documentation/dev-tools/checkpatch.rst
index 2671e54c8320..51fed1bd72ec 100644
--- a/Documentation/dev-tools/checkpatch.rst
+++ b/Documentation/dev-tools/checkpatch.rst
@@ -280,43 +280,12 @@ API usage
 However this is not always the case (See signal.h).
 This message type is emitted only for includes from arch/.
 
-  **ARRAY_SIZE**
-The ARRAY_SIZE(foo) macro should be preferred over
-sizeof(foo)/sizeof(foo[0]) for finding number of elements in an
-array.
-
-The macro is defined in include/linux/kernel.h::
-
-  #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
-
   **AVOID_BUG**
 BUG() or BUG_ON() should be avoided totally.
 Use WARN() and WARN_ON() instead, and handle the "impossible"
 error condition as gracefully as possible.
 See: 
https://www.kernel.org/doc/html/latest/process/deprecated.html#bug-and-bug-on
 
-  **AVOID_EXTERNS**
-Function prototypes don't need to be declared extern in .h
-files.  It's assumed by the compiler and is unnecessary.
-
-  **AVOID_L_PREFIX**
-Local symbol names that are prefixed with `.L` should be avoided,
-as this has special meaning for the assembler; a symbol entry will
-not be emitted into the symbol table.  This can prevent `objtool`
-from generating correct unwind info.
-
-Symbols with STB_LOCAL binding may still be used, and `.L` prefixed
-local symbol names are still generally usable within a function,
-but `.L` prefixed local symbol names should not be used to denote
-the beginning or end of code regions via
-`SYM_CODE_START_LOCAL`/`SYM_CODE_END`
-
-  **BIT_MACRO**
-Defines like: 1 <<  could be BIT(digit).
-The BIT() macro is defined in include/linux/bitops.h::
-
-  #define BIT(nr) (1UL << (nr))
-
   **CONSIDER_KSTRTO**
 The simple_strtol(), simple_strtoll(), simple_strtoul(), and
 simple_strtoull() functions explicitly ignore overflows, which
@@ -325,6 +294,25 @@ API usage
 correct replacements.
 See: 
https://www.kernel.org/doc/html/latest/process/deprecated.html#simple-strtol-simple-strtoll-simple-strtoul-simple-strtoull
 
+  **LOCKDEP**
+The lockdep_no_validate class was added as a temporary measure to
+prevent warnings on conversion of device->sem to device->mutex.
+It should not be used for any other purpose.
+See: https://lore.kernel.org/lkml/1268959062.9440.467.camel@laptop/
+
+  **MALFORMED_INCLUDE**
+The #include statement has a malformed path.  This has happened
+because the author has included a double slash "//" in the pathname
+accidentally.
+
+  **USE_LOCKDEP**
+lockdep_assert_held() annotations should be preferred over
+assertions based on spin_is_locked()
+See: 
https://www.kernel.org/doc/html/latest/locking/lockdep-design.html#annotations
+
+  **UAPI_INCLUDE**
+No #include statements in include/uapi should use a uapi/ path.
+
 
 Comment style
 -
@@ -353,7 +341,6 @@ Comment style
 See: 
https://www.kernel.org/doc/html/latest/process/coding-style.html#commenting
 
 
-
 Commit message
 --
 
@@ -397,6 +384,35 @@ Commit message
 source patch.
 See: 
https://www.kernel.org/doc/html/latest/process/submitting-patches.html#sign-your-work-the-developer-s-certificate-of-origin
 
+  **DIFF_IN_COMMIT_MSG**
+Avoid having diff content in commit message.
+This causes problems when one tries to apply a file containing both
+the changelog and the diff because patch(1) tries to apply the diff
+which it found in the changelog.
+See: 
https://lore.kernel.org/lkml/20150611134006.9df79a893e3636019ad27...@linux-foundation.org/
+
+  **GERRIT_CHANGE_ID**
+To be picked up by gerrit, the footer of the commit message might
+have a Change-Id like::
+
+  Change-Id: Ic8aaa0728a43936cd4c6e1ed590e01ba8f0fbf5b
+  Signed-off-by: A. U. Thor 
+
+The Change-Id line must be removed before submitting.
+
+  **GIT_COMMIT_ID**
+The proper way to reference a commit id is:
+commit <12+ chars of sha1> ("")
+
+An example may be::
+
+  Commit e21d2170f36602ae2708 ("video: remove unnecessary
+  platform_set_drvdata()") removed the unnecessary
+  platform_set_drvdata(), but left the variable "dev" unused,
+  delete it.
+
+See: 
https://www.kernel