<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/Documentation/process/coding-style.rst, branch v6.8</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v6.8</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v6.8'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2023-12-28T07:22:47Z</updated>
<entry>
<title>Add .editorconfig file for basic formatting</title>
<updated>2023-12-28T07:22:47Z</updated>
<author>
<name>Íñigo Huguet</name>
<email>ihuguet@redhat.com</email>
</author>
<published>2023-06-01T07:53:33Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=5a602de99797bddc9dd7f73592281a507196f69d'/>
<id>urn:sha1:5a602de99797bddc9dd7f73592281a507196f69d</id>
<content type='text'>
EditorConfig is a specification to define the most basic code formatting
stuff, and it's supported by many editors and IDEs, either directly or
via plugins, including VSCode/VSCodium, Vim, emacs and more.

It allows to define formatting style related to indentation, charset,
end of lines and trailing whitespaces. It also allows to apply different
formats for different files based on wildcards, so for example it is
possible to apply different configs to *.{c,h}, *.py and *.rs.

In linux project, defining a .editorconfig might help to those people
that work on different projects with different indentation styles, so
they cannot define a global style. Now they will directly see the
correct indentation on every fresh clone of the project.

See https://editorconfig.org

Co-developed-by: Danny Lin &lt;danny@kdrag0n.dev&gt;
Signed-off-by: Danny Lin &lt;danny@kdrag0n.dev&gt;
Signed-off-by: Íñigo Huguet &lt;ihuguet@redhat.com&gt;
Acked-by: Mickaël Salaün &lt;mic@digikod.net&gt;
Reviewed-by: Vincent Mailhol &lt;mailhol.vincent@wanadoo.fr&gt;
Tested-by: Vincent Mailhol &lt;mailhol.vincent@wanadoo.fr&gt;
Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
</entry>
<entry>
<title>coding-style: fix title of Greg K-H's talk</title>
<updated>2023-03-23T18:04:08Z</updated>
<author>
<name>Jakub Wilk</name>
<email>jwilk@jwilk.net</email>
</author>
<published>2023-03-22T21:53:11Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=775a445d9a638d8950b1831b605ae6a92a468d7e'/>
<id>urn:sha1:775a445d9a638d8950b1831b605ae6a92a468d7e</id>
<content type='text'>
The talk title was inadvertently mangled in 8c27ceff3604 ("docs: fix
locations of several documents that got moved").

Signed-off-by: Jakub Wilk &lt;jwilk@jwilk.net&gt;
Link: https://lore.kernel.org/r/20230322215311.6579-1-jwilk@jwilk.net
Signed-off-by: Jonathan Corbet &lt;corbet@lwn.net&gt;
</content>
</entry>
<entry>
<title>coding-style.rst: document BUG() and WARN() rules ("do not crash the kernel")</title>
<updated>2022-09-29T19:20:53Z</updated>
<author>
<name>David Hildenbrand</name>
<email>david@redhat.com</email>
</author>
<published>2022-09-23T11:34:24Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=1cfd9d7e43d5a1cf739d1420b10b1e65feb02f88'/>
<id>urn:sha1:1cfd9d7e43d5a1cf739d1420b10b1e65feb02f88</id>
<content type='text'>
Linus notes [1] that the introduction of new code that uses VM_BUG_ON()
is just as bad as BUG_ON(), because it will crash the kernel on
distributions that enable CONFIG_DEBUG_VM (like Fedora):

    VM_BUG_ON() has the exact same semantics as BUG_ON. It is literally
    no different, the only difference is "we can make the code smaller
    because these are less important". [2]

This resulted in a more generic discussion about usage of BUG() and
friends. While there might be corner cases that still deserve a BUG_ON(),
most BUG_ON() cases should simply use WARN_ON_ONCE() and implement a
recovery path if reasonable:

    The only possible case where BUG_ON can validly be used is "I have
    some fundamental data corruption and cannot possibly return an
    error". [2]

As a very good approximation is the general rule:

    "absolutely no new BUG_ON() calls _ever_" [2]

... not even if something really shouldn't ever happen and is merely for
documenting that an invariant always has to hold. However, there are sill
exceptions where BUG_ON() may be used:

    If you have a "this is major internal corruption, there's no way we can
    continue", then BUG_ON() is appropriate. [3]

There is only one good BUG_ON():

    Now, that said, there is one very valid sub-form of BUG_ON():
    BUILD_BUG_ON() is absolutely 100% fine. [2]

While WARN will also crash the machine with panic_on_warn set, that's
exactly to be expected:

    So we have two very different cases: the "virtual machine with good
    logging where a dead machine is fine" - use 'panic_on_warn'. And
    the actual real hardware with real drivers, running real loads by
    users. [4]

The basic idea is that warnings will similarly get reported by users
and be found during testing. However, in contrast to a BUG(), there is a
way to actually influence the expected behavior (e.g., panic_on_warn)
and to eventually keep the machine alive to extract some debug info.

Ingo notes that not all WARN_ON_ONCE cases need recovery. If we don't ever
expect this code to trigger in any case, recovery code is not really
helpful.

    I'd prefer to keep all these warnings 'simple' - i.e. no attempted
    recovery &amp; control flow, unless we ever expect these to trigger.
    [5]

There have been different rules floating around that were never properly
documented. Let's try to clarify.

[1] https://lkml.kernel.org/r/CAHk-=wiEAH+ojSpAgx_Ep=NKPWHU8AdO3V56BXcCsU97oYJ1EA@mail.gmail.com
[2] https://lore.kernel.org/r/CAHk-=wg40EAZofO16Eviaj7mfqDhZ2gVEbvfsMf6gYzspRjYvw@mail.gmail.com
[3] https://lkml.kernel.org/r/CAHk-=wit-DmhMfQErY29JSPjFgebx_Ld+pnerc4J2Ag990WwAA@mail.gmail.com
[4] https://lore.kernel.org/r/CAHk-=wgF7K2gSSpy=m_=K3Nov4zaceUX9puQf1TjkTJLA2XC_g@mail.gmail.com
[5] https://lore.kernel.org/r/YwIW+mVeZoTOxn%2F4@gmail.com

Reviewed-by: John Hubbard &lt;jhubbard@nvidia.com&gt;
Signed-off-by: David Hildenbrand &lt;david@redhat.com&gt;
Link: https://lore.kernel.org/r/20220923113426.52871-2-david@redhat.com
Signed-off-by: Jonathan Corbet &lt;corbet@lwn.net&gt;
</content>
</entry>
<entry>
<title>coding-style.rst: trivial: fix location of driver model macros</title>
<updated>2021-10-26T15:39:49Z</updated>
<author>
<name>Trevor Woerner</name>
<email>twoerner@gmail.com</email>
</author>
<published>2021-04-23T18:40:10Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=c04639a7d2fb46b4514780c844ea64545efbbaec'/>
<id>urn:sha1:c04639a7d2fb46b4514780c844ea64545efbbaec</id>
<content type='text'>
The dev_printk()-like functions moved to include/linux/dev_print.h in
commit af628aae8640 ("device.h: move dev_printk()-like functions to
dev_printk.h").

Signed-off-by: Trevor Woerner &lt;twoerner@gmail.com&gt;
Reviewed-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
Reviewed-by: Miguel Ojeda &lt;ojeda@kernel.org&gt;
Link: https://lore.kernel.org/r/20210423184012.39300-1-twoerner@gmail.com
Signed-off-by: Jonathan Corbet &lt;corbet@lwn.net&gt;
</content>
</entry>
<entry>
<title>docs: Explain the desired position of function attributes</title>
<updated>2021-10-12T19:35:02Z</updated>
<author>
<name>Kees Cook</name>
<email>keescook@chromium.org</email>
</author>
<published>2021-10-05T15:26:11Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=d5b421fe0282784a4a8235d549d6ac5d9efff967'/>
<id>urn:sha1:d5b421fe0282784a4a8235d549d6ac5d9efff967</id>
<content type='text'>
While discussing how to format the addition of various function
attributes, some "unwritten rules" of ordering surfaced[1]. Capture as
close as possible to Linus's preferences for future reference.

(Though I note the dissent voiced by Joe Perches, Alexey Dobriyan, and
others that would prefer all attributes live on a separate leading line.)

[1] https://lore.kernel.org/mm-commits/CAHk-=wiOCLRny5aifWNhr621kYrJwhfURsa0vFPeUEm8mF0ufg@mail.gmail.com/

Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Link: https://lore.kernel.org/r/20211005152611.4120605-1-keescook@chromium.org
Signed-off-by: Jonathan Corbet &lt;corbet@lwn.net&gt;
</content>
</entry>
<entry>
<title>docs: Remove the Microsoft rhetoric</title>
<updated>2021-02-11T16:42:17Z</updated>
<author>
<name>Yorick de Wid</name>
<email>yorickdewid@users.noreply.github.com</email>
</author>
<published>2021-02-08T15:04:48Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=b7592e5b82db19b72a34b471f3296ad3f651c8b9'/>
<id>urn:sha1:b7592e5b82db19b72a34b471f3296ad3f651c8b9</id>
<content type='text'>
There is no need to need to name Microsoft. The point is clear without that context.

Signed-off-by: Yorick de Wid &lt;ydewid@gmail.com&gt;
Link: https://lore.kernel.org/r/20210208150447.87104-1-ydewid@gmail.com
Signed-off-by: Jonathan Corbet &lt;corbet@lwn.net&gt;
</content>
</entry>
<entry>
<title>coding-style.rst: Avoid comma statements</title>
<updated>2021-02-04T21:40:02Z</updated>
<author>
<name>Joe Perches</name>
<email>joe@perches.com</email>
</author>
<published>2020-08-25T04:55:58Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=26606ce072d48ab82f640f75ab9673ee10ab4a5a'/>
<id>urn:sha1:26606ce072d48ab82f640f75ab9673ee10ab4a5a</id>
<content type='text'>
Commas are not how statements are terminated.
Always use semicolons and braces if necessary.

Signed-off-by: Joe Perches &lt;joe@perches.com&gt;
Link: https://lore.kernel.org/r/2a97b738bba335434461a5a918053a49c1fb6af4.1598331148.git.joe@perches.com
Signed-off-by: Jonathan Corbet &lt;corbet@lwn.net&gt;
</content>
</entry>
<entry>
<title>Merge tag 'docs-5.9' of git://git.lwn.net/linux</title>
<updated>2020-08-05T05:47:54Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2020-08-05T05:47:54Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=2324d50d051ec0f14a548e78554fb02513d6dcef'/>
<id>urn:sha1:2324d50d051ec0f14a548e78554fb02513d6dcef</id>
<content type='text'>
Pull documentation updates from Jonathan Corbet:
 "It's been a busy cycle for documentation - hopefully the busiest for a
  while to come. Changes include:

   - Some new Chinese translations

   - Progress on the battle against double words words and non-HTTPS
     URLs

   - Some block-mq documentation

   - More RST conversions from Mauro. At this point, that task is
     essentially complete, so we shouldn't see this kind of churn again
     for a while. Unless we decide to switch to asciidoc or
     something...:)

   - Lots of typo fixes, warning fixes, and more"

* tag 'docs-5.9' of git://git.lwn.net/linux: (195 commits)
  scripts/kernel-doc: optionally treat warnings as errors
  docs: ia64: correct typo
  mailmap: add entry for &lt;alobakin@marvell.com&gt;
  doc/zh_CN: add cpu-load Chinese version
  Documentation/admin-guide: tainted-kernels: fix spelling mistake
  MAINTAINERS: adjust kprobes.rst entry to new location
  devices.txt: document rfkill allocation
  PCI: correct flag name
  docs: filesystems: vfs: correct flag name
  docs: filesystems: vfs: correct sync_mode flag names
  docs: path-lookup: markup fixes for emphasis
  docs: path-lookup: more markup fixes
  docs: path-lookup: fix HTML entity mojibake
  CREDITS: Replace HTTP links with HTTPS ones
  docs: process: Add an example for creating a fixes tag
  doc/zh_CN: add Chinese translation prefer section
  doc/zh_CN: add clearing-warn-once Chinese version
  doc/zh_CN: add admin-guide index
  doc:it_IT: process: coding-style.rst: Correct __maybe_unused compiler label
  futex: MAINTAINERS: Re-add selftests directory
  ...
</content>
</entry>
<entry>
<title>CodingStyle: Inclusive Terminology</title>
<updated>2020-07-04T06:54:35Z</updated>
<author>
<name>Dan Williams</name>
<email>dan.j.williams@intel.com</email>
</author>
<published>2020-07-04T06:54:35Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=a5f526ecb075a08c4a082355020166c7fe13ae27'/>
<id>urn:sha1:a5f526ecb075a08c4a082355020166c7fe13ae27</id>
<content type='text'>
Linux maintains a coding-style and its own idiomatic set of terminology.
Update the style guidelines to recommend replacements for the terms
master/slave and blacklist/whitelist.

Link: http://lore.kernel.org/r/159389297140.2210796.13590142254668787525.stgit@dwillia2-desk3.amr.corp.intel.com
Acked-by: Randy Dunlap &lt;rdunlap@infradead.org&gt;
Acked-by: Dave Airlie &lt;airlied@redhat.com&gt;
Acked-by: SeongJae Park &lt;sjpark@amazon.de&gt;
Acked-by: Christian Brauner &lt;christian.brauner@ubuntu.com&gt;
Acked-by: James Bottomley &lt;James.Bottomley@HansenPartnership.com&gt;
Acked-by: Daniel Vetter &lt;daniel.vetter@ffwll.ch&gt;
Acked-by: Andy Lutomirski &lt;luto@kernel.org&gt;
Acked-by: Laura Abbott &lt;laura@labbott.name&gt;
Acked-by: Gustavo A. R. Silva &lt;gustavoars@kernel.org&gt;
Reviewed-by: Matthias Brugger &lt;matthias.bgg@gmail.com&gt;
Reviewed-by: Mark Brown &lt;broonie@kernel.org&gt;
Signed-off-by: Stephen Hemminger &lt;stephen@networkplumber.org&gt;
Signed-off-by: Theodore Ts'o &lt;tytso@mit.edu&gt;
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
Signed-off-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Signed-off-by: Olof Johansson &lt;olof@lixom.net&gt;
Signed-off-by: Jonathan Corbet &lt;corbet@lwn.net&gt;
Signed-off-by: Chris Mason &lt;clm@fb.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Dan Williams &lt;dan.j.williams@intel.com&gt;
</content>
</entry>
<entry>
<title>Replace HTTP links with HTTPS ones: Documentation/process</title>
<updated>2020-06-26T17:19:43Z</updated>
<author>
<name>Alexander A. Klimov</name>
<email>grandmaster@al2klimov.de</email>
</author>
<published>2020-06-21T13:36:30Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=e7b4311ebcac142be28c9fa1b9f63a9d35fc2a92'/>
<id>urn:sha1:e7b4311ebcac142be28c9fa1b9f63a9d35fc2a92</id>
<content type='text'>
Rationale:
Reduces attack surface on kernel devs opening the links for MITM
as HTTPS traffic is much harder to manipulate.

Deterministic algorithm:
For each file:
  If not .svg:
    For each line:
      If doesn't contain `\bxmlns\b`:
        For each link, `\bhttp://[^# \t\r\n]*(?:\w|/)`:
          If both the HTTP and HTTPS versions
          return 200 OK and serve the same content:
            Replace HTTP with HTTPS.

Signed-off-by: Alexander A. Klimov &lt;grandmaster@al2klimov.de&gt;
Acked-by: Miguel Ojeda &lt;miguel.ojeda.sandonis@gmail.com&gt;
Link: https://lore.kernel.org/r/20200621133630.46435-1-grandmaster@al2klimov.de
Signed-off-by: Jonathan Corbet &lt;corbet@lwn.net&gt;
</content>
</entry>
</feed>
