Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> --- Documentation/agents/coding-style.rst | 35 +++++++++++++++++++++++++++ Documentation/agents/index.rst | 3 ++- Documentation/agents/main.rst | 5 ++++ 3 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 Documentation/agents/coding-style.rst diff --git a/Documentation/agents/coding-style.rst b/Documentation/agents/coding-style.rst new file mode 100644 index 000000000000..b0332ee91e6c --- /dev/null +++ b/Documentation/agents/coding-style.rst @@ -0,0 +1,35 @@ +.. SPDX-License-Identifier: GPL-2.0 + +========================== +Linux Kernel Coding Style +========================== + +Essential coding style documentation and rules for Linux kernel development. + +Coding Style Documentation +-------------------------- + +The comprehensive guide to Linux kernel coding style, covering indentation, naming conventions, functions, and more. + +See :ref:`Documentation/process/coding-style.rst <codingstyle>` + +Programming Language +-------------------- + +Information about the C programming language dialect used in the kernel, compiler options, and attributes. + +See :ref:`Documentation/process/programming-language.rst <programming_language>` + +Explicit Coding Rules +--------------------- + +The following rules must be followed when writing kernel code: + +**No trailing whitespaces** + Never leave whitespace at the end of lines. Git will warn about patches that introduce trailing whitespace. + +**80 character line limit** + The preferred limit on the length of a single line is 80 columns. Statements longer than 80 columns should be broken into sensible chunks, unless exceeding 80 columns significantly increases readability and does not hide information. + +**8 character tabs for indents** + Tabs are 8 characters, and thus indentations are also 8 characters. The kernel uses tabs for indentation, never spaces. This makes code structure clear and warns when nesting becomes too deep. \ No newline at end of file diff --git a/Documentation/agents/index.rst b/Documentation/agents/index.rst index 2737ab62efa0..354af3f025e5 100644 --- a/Documentation/agents/index.rst +++ b/Documentation/agents/index.rst @@ -8,4 +8,5 @@ Agents :maxdepth: 1 main - core \ No newline at end of file + core + coding-style \ No newline at end of file diff --git a/Documentation/agents/main.rst b/Documentation/agents/main.rst index 34f13d0b975a..8e0463794b76 100644 --- a/Documentation/agents/main.rst +++ b/Documentation/agents/main.rst @@ -10,3 +10,8 @@ Core Development Process ------------------------ For essential kernel development documentation, see :doc:`core` + +Coding Style +------------ + +For coding style guidelines and rules, see :doc:`coding-style` -- 2.39.5