maintainer-tip.rst 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799
  1. .. SPDX-License-Identifier: GPL-2.0
  2. The tip tree handbook
  3. =====================
  4. What is the tip tree?
  5. ---------------------
  6. The tip tree is a collection of several subsystems and areas of
  7. development. The tip tree is both a direct development tree and a
  8. aggregation tree for several sub-maintainer trees. The tip tree gitweb URL
  9. is: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
  10. The tip tree contains the following subsystems:
  11. - **x86 architecture**
  12. The x86 architecture development takes place in the tip tree except
  13. for the x86 KVM and XEN specific parts which are maintained in the
  14. corresponding subsystems and routed directly to mainline from
  15. there. It's still good practice to Cc the x86 maintainers on
  16. x86-specific KVM and XEN patches.
  17. Some x86 subsystems have their own maintainers in addition to the
  18. overall x86 maintainers. Please Cc the overall x86 maintainers on
  19. patches touching files in arch/x86 even when they are not called out
  20. by the MAINTAINER file.
  21. Note, that ``[email protected]`` is not a mailing list. It is merely a
  22. mail alias which distributes mails to the x86 top-level maintainer
  23. team. Please always Cc the Linux Kernel mailing list (LKML)
  24. ``[email protected]``, otherwise your mail ends up only in
  25. the private inboxes of the maintainers.
  26. - **Scheduler**
  27. Scheduler development takes place in the -tip tree, in the
  28. sched/core branch - with occasional sub-topic trees for
  29. work-in-progress patch-sets.
  30. - **Locking and atomics**
  31. Locking development (including atomics and other synchronization
  32. primitives that are connected to locking) takes place in the -tip
  33. tree, in the locking/core branch - with occasional sub-topic trees
  34. for work-in-progress patch-sets.
  35. - **Generic interrupt subsystem and interrupt chip drivers**:
  36. - interrupt core development happens in the irq/core branch
  37. - interrupt chip driver development also happens in the irq/core
  38. branch, but the patches are usually applied in a separate maintainer
  39. tree and then aggregated into irq/core
  40. - **Time, timers, timekeeping, NOHZ and related chip drivers**:
  41. - timekeeping, clocksource core, NTP and alarmtimer development
  42. happens in the timers/core branch, but patches are usually applied in
  43. a separate maintainer tree and then aggregated into timers/core
  44. - clocksource/event driver development happens in the timers/core
  45. branch, but patches are mostly applied in a separate maintainer tree
  46. and then aggregated into timers/core
  47. - **Performance counters core, architecture support and tooling**:
  48. - perf core and architecture support development happens in the
  49. perf/core branch
  50. - perf tooling development happens in the perf tools maintainer
  51. tree and is aggregated into the tip tree.
  52. - **CPU hotplug core**
  53. - **RAS core**
  54. Mostly x86-specific RAS patches are collected in the tip ras/core
  55. branch.
  56. - **EFI core**
  57. EFI development in the efi git tree. The collected patches are
  58. aggregated in the tip efi/core branch.
  59. - **RCU**
  60. RCU development happens in the linux-rcu tree. The resulting changes
  61. are aggregated into the tip core/rcu branch.
  62. - **Various core code components**:
  63. - debugobjects
  64. - objtool
  65. - random bits and pieces
  66. Patch submission notes
  67. ----------------------
  68. Selecting the tree/branch
  69. ^^^^^^^^^^^^^^^^^^^^^^^^^
  70. In general, development against the head of the tip tree master branch is
  71. fine, but for the subsystems which are maintained separately, have their
  72. own git tree and are only aggregated into the tip tree, development should
  73. take place against the relevant subsystem tree or branch.
  74. Bug fixes which target mainline should always be applicable against the
  75. mainline kernel tree. Potential conflicts against changes which are already
  76. queued in the tip tree are handled by the maintainers.
  77. Patch subject
  78. ^^^^^^^^^^^^^
  79. The tip tree preferred format for patch subject prefixes is
  80. 'subsys/component:', e.g. 'x86/apic:', 'x86/mm/fault:', 'sched/fair:',
  81. 'genirq/core:'. Please do not use file names or complete file paths as
  82. prefix. 'git log path/to/file' should give you a reasonable hint in most
  83. cases.
  84. The condensed patch description in the subject line should start with a
  85. uppercase letter and should be written in imperative tone.
  86. Changelog
  87. ^^^^^^^^^
  88. The general rules about changelogs in the process documentation, see
  89. :ref:`Documentation/process/ <submittingpatches>`, apply.
  90. The tip tree maintainers set value on following these rules, especially on
  91. the request to write changelogs in imperative mood and not impersonating
  92. code or the execution of it. This is not just a whim of the
  93. maintainers. Changelogs written in abstract words are more precise and
  94. tend to be less confusing than those written in the form of novels.
  95. It's also useful to structure the changelog into several paragraphs and not
  96. lump everything together into a single one. A good structure is to explain
  97. the context, the problem and the solution in separate paragraphs and this
  98. order.
  99. Examples for illustration:
  100. Example 1::
  101. x86/intel_rdt/mbm: Fix MBM overflow handler during hot cpu
  102. When a CPU is dying, we cancel the worker and schedule a new worker on a
  103. different CPU on the same domain. But if the timer is already about to
  104. expire (say 0.99s) then we essentially double the interval.
  105. We modify the hot cpu handling to cancel the delayed work on the dying
  106. cpu and run the worker immediately on a different cpu in same domain. We
  107. donot flush the worker because the MBM overflow worker reschedules the
  108. worker on same CPU and scans the domain->cpu_mask to get the domain
  109. pointer.
  110. Improved version::
  111. x86/intel_rdt/mbm: Fix MBM overflow handler during CPU hotplug
  112. When a CPU is dying, the overflow worker is canceled and rescheduled on a
  113. different CPU in the same domain. But if the timer is already about to
  114. expire this essentially doubles the interval which might result in a non
  115. detected overflow.
  116. Cancel the overflow worker and reschedule it immediately on a different CPU
  117. in the same domain. The work could be flushed as well, but that would
  118. reschedule it on the same CPU.
  119. Example 2::
  120. time: POSIX CPU timers: Ensure that variable is initialized
  121. If cpu_timer_sample_group returns -EINVAL, it will not have written into
  122. *sample. Checking for cpu_timer_sample_group's return value precludes the
  123. potential use of an uninitialized value of now in the following block.
  124. Given an invalid clock_idx, the previous code could otherwise overwrite
  125. *oldval in an undefined manner. This is now prevented. We also exploit
  126. short-circuiting of && to sample the timer only if the result will
  127. actually be used to update *oldval.
  128. Improved version::
  129. posix-cpu-timers: Make set_process_cpu_timer() more robust
  130. Because the return value of cpu_timer_sample_group() is not checked,
  131. compilers and static checkers can legitimately warn about a potential use
  132. of the uninitialized variable 'now'. This is not a runtime issue as all
  133. call sites hand in valid clock ids.
  134. Also cpu_timer_sample_group() is invoked unconditionally even when the
  135. result is not used because *oldval is NULL.
  136. Make the invocation conditional and check the return value.
  137. Example 3::
  138. The entity can also be used for other purposes.
  139. Let's rename it to be more generic.
  140. Improved version::
  141. The entity can also be used for other purposes.
  142. Rename it to be more generic.
  143. For complex scenarios, especially race conditions and memory ordering
  144. issues, it is valuable to depict the scenario with a table which shows
  145. the parallelism and the temporal order of events. Here is an example::
  146. CPU0 CPU1
  147. free_irq(X) interrupt X
  148. spin_lock(desc->lock)
  149. wake irq thread()
  150. spin_unlock(desc->lock)
  151. spin_lock(desc->lock)
  152. remove action()
  153. shutdown_irq()
  154. release_resources() thread_handler()
  155. spin_unlock(desc->lock) access released resources.
  156. ^^^^^^^^^^^^^^^^^^^^^^^^^
  157. synchronize_irq()
  158. Lockdep provides similar useful output to depict a possible deadlock
  159. scenario::
  160. CPU0 CPU1
  161. rtmutex_lock(&rcu->rt_mutex)
  162. spin_lock(&rcu->rt_mutex.wait_lock)
  163. local_irq_disable()
  164. spin_lock(&timer->it_lock)
  165. spin_lock(&rcu->mutex.wait_lock)
  166. --> Interrupt
  167. spin_lock(&timer->it_lock)
  168. Function references in changelogs
  169. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  170. When a function is mentioned in the changelog, either the text body or the
  171. subject line, please use the format 'function_name()'. Omitting the
  172. brackets after the function name can be ambiguous::
  173. Subject: subsys/component: Make reservation_count static
  174. reservation_count is only used in reservation_stats. Make it static.
  175. The variant with brackets is more precise::
  176. Subject: subsys/component: Make reservation_count() static
  177. reservation_count() is only called from reservation_stats(). Make it
  178. static.
  179. Backtraces in changelogs
  180. ^^^^^^^^^^^^^^^^^^^^^^^^
  181. See :ref:`backtraces`.
  182. Ordering of commit tags
  183. ^^^^^^^^^^^^^^^^^^^^^^^
  184. To have a uniform view of the commit tags, the tip maintainers use the
  185. following tag ordering scheme:
  186. - Fixes: 12char-SHA1 ("sub/sys: Original subject line")
  187. A Fixes tag should be added even for changes which do not need to be
  188. backported to stable kernels, i.e. when addressing a recently introduced
  189. issue which only affects tip or the current head of mainline. These tags
  190. are helpful to identify the original commit and are much more valuable
  191. than prominently mentioning the commit which introduced a problem in the
  192. text of the changelog itself because they can be automatically
  193. extracted.
  194. The following example illustrates the difference::
  195. Commit
  196. abcdef012345678 ("x86/xxx: Replace foo with bar")
  197. left an unused instance of variable foo around. Remove it.
  198. Signed-off-by: J.Dev <j.dev@mail>
  199. Please say instead::
  200. The recent replacement of foo with bar left an unused instance of
  201. variable foo around. Remove it.
  202. Fixes: abcdef012345678 ("x86/xxx: Replace foo with bar")
  203. Signed-off-by: J.Dev <j.dev@mail>
  204. The latter puts the information about the patch into the focus and
  205. amends it with the reference to the commit which introduced the issue
  206. rather than putting the focus on the original commit in the first place.
  207. - Reported-by: ``Reporter <reporter@mail>``
  208. - Originally-by: ``Original author <original-author@mail>``
  209. - Suggested-by: ``Suggester <suggester@mail>``
  210. - Co-developed-by: ``Co-author <co-author@mail>``
  211. Signed-off: ``Co-author <co-author@mail>``
  212. Note, that Co-developed-by and Signed-off-by of the co-author(s) must
  213. come in pairs.
  214. - Signed-off-by: ``Author <author@mail>``
  215. The first Signed-off-by (SOB) after the last Co-developed-by/SOB pair is the
  216. author SOB, i.e. the person flagged as author by git.
  217. - Signed-off-by: ``Patch handler <handler@mail>``
  218. SOBs after the author SOB are from people handling and transporting
  219. the patch, but were not involved in development. SOB chains should
  220. reflect the **real** route a patch took as it was propagated to us,
  221. with the first SOB entry signalling primary authorship of a single
  222. author. Acks should be given as Acked-by lines and review approvals
  223. as Reviewed-by lines.
  224. If the handler made modifications to the patch or the changelog, then
  225. this should be mentioned **after** the changelog text and **above**
  226. all commit tags in the following format::
  227. ... changelog text ends.
  228. [ handler: Replaced foo by bar and updated changelog ]
  229. First-tag: .....
  230. Note the two empty new lines which separate the changelog text and the
  231. commit tags from that notice.
  232. If a patch is sent to the mailing list by a handler then the author has
  233. to be noted in the first line of the changelog with::
  234. From: Author <author@mail>
  235. Changelog text starts here....
  236. so the authorship is preserved. The 'From:' line has to be followed
  237. by a empty newline. If that 'From:' line is missing, then the patch
  238. would be attributed to the person who sent (transported, handled) it.
  239. The 'From:' line is automatically removed when the patch is applied
  240. and does not show up in the final git changelog. It merely affects
  241. the authorship information of the resulting Git commit.
  242. - Tested-by: ``Tester <tester@mail>``
  243. - Reviewed-by: ``Reviewer <reviewer@mail>``
  244. - Acked-by: ``Acker <acker@mail>``
  245. - Cc: ``cc-ed-person <person@mail>``
  246. If the patch should be backported to stable, then please add a '``Cc:
  247. [email protected]``' tag, but do not Cc stable when sending your
  248. mail.
  249. - Link: ``https://link/to/information``
  250. For referring to an email on LKML or other kernel mailing lists,
  251. please use the lore.kernel.org redirector URL::
  252. https://lore.kernel.org/r/email-message@id
  253. The kernel.org redirector is considered a stable URL, unlike other email
  254. archives.
  255. Maintainers will add a Link tag referencing the email of the patch
  256. submission when they apply a patch to the tip tree. This tag is useful
  257. for later reference and is also used for commit notifications.
  258. Please do not use combined tags, e.g. ``Reported-and-tested-by``, as
  259. they just complicate automated extraction of tags.
  260. Links to documentation
  261. ^^^^^^^^^^^^^^^^^^^^^^
  262. Providing links to documentation in the changelog is a great help to later
  263. debugging and analysis. Unfortunately, URLs often break very quickly
  264. because companies restructure their websites frequently. Non-'volatile'
  265. exceptions include the Intel SDM and the AMD APM.
  266. Therefore, for 'volatile' documents, please create an entry in the kernel
  267. bugzilla https://bugzilla.kernel.org and attach a copy of these documents
  268. to the bugzilla entry. Finally, provide the URL of the bugzilla entry in
  269. the changelog.
  270. Patch resend or reminders
  271. ^^^^^^^^^^^^^^^^^^^^^^^^^
  272. See :ref:`resend_reminders`.
  273. Merge window
  274. ^^^^^^^^^^^^
  275. Please do not expect large patch series to be handled during the merge
  276. window or even during the week before. Such patches should be submitted in
  277. mergeable state *at* *least* a week before the merge window opens.
  278. Exceptions are made for bug fixes and *sometimes* for small standalone
  279. drivers for new hardware or minimally invasive patches for hardware
  280. enablement.
  281. During the merge window, the maintainers instead focus on following the
  282. upstream changes, fixing merge window fallout, collecting bug fixes, and
  283. allowing themselves a breath. Please respect that.
  284. The release candidate -rc1 is the starting point for new patches to be
  285. applied which are targeted for the next merge window.
  286. Git
  287. ^^^
  288. The tip maintainers accept git pull requests from maintainers who provide
  289. subsystem changes for aggregation in the tip tree.
  290. Pull requests for new patch submissions are usually not accepted and do not
  291. replace proper patch submission to the mailing list. The main reason for
  292. this is that the review workflow is email based.
  293. If you submit a larger patch series it is helpful to provide a git branch
  294. in a private repository which allows interested people to easily pull the
  295. series for testing. The usual way to offer this is a git URL in the cover
  296. letter of the patch series.
  297. Testing
  298. ^^^^^^^
  299. Code should be tested before submitting to the tip maintainers. Anything
  300. other than minor changes should be built, booted and tested with
  301. comprehensive (and heavyweight) kernel debugging options enabled.
  302. These debugging options can be found in kernel/configs/x86_debug.config
  303. and can be added to an existing kernel config by running:
  304. make x86_debug.config
  305. Some of these options are x86-specific and can be left out when testing
  306. on other architectures.
  307. Coding style notes
  308. ------------------
  309. Comment style
  310. ^^^^^^^^^^^^^
  311. Sentences in comments start with an uppercase letter.
  312. Single line comments::
  313. /* This is a single line comment */
  314. Multi-line comments::
  315. /*
  316. * This is a properly formatted
  317. * multi-line comment.
  318. *
  319. * Larger multi-line comments should be split into paragraphs.
  320. */
  321. No tail comments:
  322. Please refrain from using tail comments. Tail comments disturb the
  323. reading flow in almost all contexts, but especially in code::
  324. if (somecondition_is_true) /* Don't put a comment here */
  325. dostuff(); /* Neither here */
  326. seed = MAGIC_CONSTANT; /* Nor here */
  327. Use freestanding comments instead::
  328. /* This condition is not obvious without a comment */
  329. if (somecondition_is_true) {
  330. /* This really needs to be documented */
  331. dostuff();
  332. }
  333. /* This magic initialization needs a comment. Maybe not? */
  334. seed = MAGIC_CONSTANT;
  335. Comment the important things:
  336. Comments should be added where the operation is not obvious. Documenting
  337. the obvious is just a distraction::
  338. /* Decrement refcount and check for zero */
  339. if (refcount_dec_and_test(&p->refcnt)) {
  340. do;
  341. lots;
  342. of;
  343. magic;
  344. things;
  345. }
  346. Instead, comments should explain the non-obvious details and document
  347. constraints::
  348. if (refcount_dec_and_test(&p->refcnt)) {
  349. /*
  350. * Really good explanation why the magic things below
  351. * need to be done, ordering and locking constraints,
  352. * etc..
  353. */
  354. do;
  355. lots;
  356. of;
  357. magic;
  358. /* Needs to be the last operation because ... */
  359. things;
  360. }
  361. Function documentation comments:
  362. To document functions and their arguments please use kernel-doc format
  363. and not free form comments::
  364. /**
  365. * magic_function - Do lots of magic stuff
  366. * @magic: Pointer to the magic data to operate on
  367. * @offset: Offset in the data array of @magic
  368. *
  369. * Deep explanation of mysterious things done with @magic along
  370. * with documentation of the return values.
  371. *
  372. * Note, that the argument descriptors above are arranged
  373. * in a tabular fashion.
  374. */
  375. This applies especially to globally visible functions and inline
  376. functions in public header files. It might be overkill to use kernel-doc
  377. format for every (static) function which needs a tiny explanation. The
  378. usage of descriptive function names often replaces these tiny comments.
  379. Apply common sense as always.
  380. Documenting locking requirements
  381. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  382. Documenting locking requirements is a good thing, but comments are not
  383. necessarily the best choice. Instead of writing::
  384. /* Caller must hold foo->lock */
  385. void func(struct foo *foo)
  386. {
  387. ...
  388. }
  389. Please use::
  390. void func(struct foo *foo)
  391. {
  392. lockdep_assert_held(&foo->lock);
  393. ...
  394. }
  395. In PROVE_LOCKING kernels, lockdep_assert_held() emits a warning
  396. if the caller doesn't hold the lock. Comments can't do that.
  397. Bracket rules
  398. ^^^^^^^^^^^^^
  399. Brackets should be omitted only if the statement which follows 'if', 'for',
  400. 'while' etc. is truly a single line::
  401. if (foo)
  402. do_something();
  403. The following is not considered to be a single line statement even
  404. though C does not require brackets::
  405. for (i = 0; i < end; i++)
  406. if (foo[i])
  407. do_something(foo[i]);
  408. Adding brackets around the outer loop enhances the reading flow::
  409. for (i = 0; i < end; i++) {
  410. if (foo[i])
  411. do_something(foo[i]);
  412. }
  413. Variable declarations
  414. ^^^^^^^^^^^^^^^^^^^^^
  415. The preferred ordering of variable declarations at the beginning of a
  416. function is reverse fir tree order::
  417. struct long_struct_name *descriptive_name;
  418. unsigned long foo, bar;
  419. unsigned int tmp;
  420. int ret;
  421. The above is faster to parse than the reverse ordering::
  422. int ret;
  423. unsigned int tmp;
  424. unsigned long foo, bar;
  425. struct long_struct_name *descriptive_name;
  426. And even more so than random ordering::
  427. unsigned long foo, bar;
  428. int ret;
  429. struct long_struct_name *descriptive_name;
  430. unsigned int tmp;
  431. Also please try to aggregate variables of the same type into a single
  432. line. There is no point in wasting screen space::
  433. unsigned long a;
  434. unsigned long b;
  435. unsigned long c;
  436. unsigned long d;
  437. It's really sufficient to do::
  438. unsigned long a, b, c, d;
  439. Please also refrain from introducing line splits in variable declarations::
  440. struct long_struct_name *descriptive_name = container_of(bar,
  441. struct long_struct_name,
  442. member);
  443. struct foobar foo;
  444. It's way better to move the initialization to a separate line after the
  445. declarations::
  446. struct long_struct_name *descriptive_name;
  447. struct foobar foo;
  448. descriptive_name = container_of(bar, struct long_struct_name, member);
  449. Variable types
  450. ^^^^^^^^^^^^^^
  451. Please use the proper u8, u16, u32, u64 types for variables which are meant
  452. to describe hardware or are used as arguments for functions which access
  453. hardware. These types are clearly defining the bit width and avoid
  454. truncation, expansion and 32/64-bit confusion.
  455. u64 is also recommended in code which would become ambiguous for 32-bit
  456. kernels when 'unsigned long' would be used instead. While in such
  457. situations 'unsigned long long' could be used as well, u64 is shorter
  458. and also clearly shows that the operation is required to be 64 bits wide
  459. independent of the target CPU.
  460. Please use 'unsigned int' instead of 'unsigned'.
  461. Constants
  462. ^^^^^^^^^
  463. Please do not use literal (hexa)decimal numbers in code or initializers.
  464. Either use proper defines which have descriptive names or consider using
  465. an enum.
  466. Struct declarations and initializers
  467. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  468. Struct declarations should align the struct member names in a tabular
  469. fashion::
  470. struct bar_order {
  471. unsigned int guest_id;
  472. int ordered_item;
  473. struct menu *menu;
  474. };
  475. Please avoid documenting struct members within the declaration, because
  476. this often results in strangely formatted comments and the struct members
  477. become obfuscated::
  478. struct bar_order {
  479. unsigned int guest_id; /* Unique guest id */
  480. int ordered_item;
  481. /* Pointer to a menu instance which contains all the drinks */
  482. struct menu *menu;
  483. };
  484. Instead, please consider using the kernel-doc format in a comment preceding
  485. the struct declaration, which is easier to read and has the added advantage
  486. of including the information in the kernel documentation, for example, as
  487. follows::
  488. /**
  489. * struct bar_order - Description of a bar order
  490. * @guest_id: Unique guest id
  491. * @ordered_item: The item number from the menu
  492. * @menu: Pointer to the menu from which the item
  493. * was ordered
  494. *
  495. * Supplementary information for using the struct.
  496. *
  497. * Note, that the struct member descriptors above are arranged
  498. * in a tabular fashion.
  499. */
  500. struct bar_order {
  501. unsigned int guest_id;
  502. int ordered_item;
  503. struct menu *menu;
  504. };
  505. Static struct initializers must use C99 initializers and should also be
  506. aligned in a tabular fashion::
  507. static struct foo statfoo = {
  508. .a = 0,
  509. .plain_integer = CONSTANT_DEFINE_OR_ENUM,
  510. .bar = &statbar,
  511. };
  512. Note that while C99 syntax allows the omission of the final comma,
  513. we recommend the use of a comma on the last line because it makes
  514. reordering and addition of new lines easier, and makes such future
  515. patches slightly easier to read as well.
  516. Line breaks
  517. ^^^^^^^^^^^
  518. Restricting line length to 80 characters makes deeply indented code hard to
  519. read. Consider breaking out code into helper functions to avoid excessive
  520. line breaking.
  521. The 80 character rule is not a strict rule, so please use common sense when
  522. breaking lines. Especially format strings should never be broken up.
  523. When splitting function declarations or function calls, then please align
  524. the first argument in the second line with the first argument in the first
  525. line::
  526. static int long_function_name(struct foobar *barfoo, unsigned int id,
  527. unsigned int offset)
  528. {
  529. if (!id) {
  530. ret = longer_function_name(barfoo, DEFAULT_BARFOO_ID,
  531. offset);
  532. ...
  533. Namespaces
  534. ^^^^^^^^^^
  535. Function/variable namespaces improve readability and allow easy
  536. grepping. These namespaces are string prefixes for globally visible
  537. function and variable names, including inlines. These prefixes should
  538. combine the subsystem and the component name such as 'x86_comp\_',
  539. 'sched\_', 'irq\_', and 'mutex\_'.
  540. This also includes static file scope functions that are immediately put
  541. into globally visible driver templates - it's useful for those symbols
  542. to carry a good prefix as well, for backtrace readability.
  543. Namespace prefixes may be omitted for local static functions and
  544. variables. Truly local functions, only called by other local functions,
  545. can have shorter descriptive names - our primary concern is greppability
  546. and backtrace readability.
  547. Please note that 'xxx_vendor\_' and 'vendor_xxx_` prefixes are not
  548. helpful for static functions in vendor-specific files. After all, it
  549. is already clear that the code is vendor-specific. In addition, vendor
  550. names should only be for truly vendor-specific functionality.
  551. As always apply common sense and aim for consistency and readability.
  552. Commit notifications
  553. --------------------
  554. The tip tree is monitored by a bot for new commits. The bot sends an email
  555. for each new commit to a dedicated mailing list
  556. (``[email protected]``) and Cc's all people who are
  557. mentioned in one of the commit tags. It uses the email message ID from the
  558. Link tag at the end of the tag list to set the In-Reply-To email header so
  559. the message is properly threaded with the patch submission email.
  560. The tip maintainers and submaintainers try to reply to the submitter
  561. when merging a patch, but they sometimes forget or it does not fit the
  562. workflow of the moment. While the bot message is purely mechanical, it
  563. also implies a 'Thank you! Applied.'.