Skip to content

Commit d6a24d0

Browse files
committed
Merge tag 'docs-for-linus' of git://git.lwn.net/linux-2.6
Pull documentation updates from Jonathan Corbet: "Numerous fixes, the overdue removal of the i2o docs, some new Chinese translations, and, hopefully, the README fix that will end the flow of identical patches to that file" * tag 'docs-for-linus' of git://git.lwn.net/linux-2.6: (34 commits) Documentation/memcg: update memcg/kmem status Documentation: blackfin: Makefile: Typo building issue Documentation/vm/pagemap.txt: correct location of page-types tool Documentation/memory-barriers.txt: typo fix doc: Add guest_nice column to example output of `cat /proc/stat' Documentation/kernel-parameters: Move "eagerfpu" to its right place Documentation: gpio: Update ACPI part of the document to mention _DSD docs/completion.txt: Various tweaks and corrections doc: completion: context, scope and language fixes Documentation:Update Documentation/zh_CN/arm64/memory.txt Documentation:Update Documentation/zh_CN/arm64/booting.txt Documentation: Chinese translation of arm64/legacy_instructions.txt DocBook media: fix broken EIA hyperlink Documentation: tweak the maintainers entry README: Change gzip/bzip2 to xz compression format README: Update version number reference doc:pci: Fix typo in Documentation/PCI Documentation: drm: Use '->' when describing access through pointers. Documentation: Remove mentioning of block barriers Documentation/email-clients.txt: Fix one grammar mistake, add extra info about TB ...
2 parents 1f5014d + 1971754 commit d6a24d0

40 files changed

Lines changed: 490 additions & 778 deletions

‎Documentation/CodingStyle‎

Lines changed: 76 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ and NOT read it. Burn them, it's a great symbolic gesture.
1313
Anyway, here goes:
1414

1515

16-
Chapter 1: Indentation
16+
Chapter 1: Indentation
1717

1818
Tabs are 8 characters, and thus indentations are also 8 characters.
1919
There are heretic movements that try to make indentations 4 (or even 2!)
@@ -56,7 +56,6 @@ instead of "double-indenting" the "case" labels. E.g.:
5656
break;
5757
}
5858

59-
6059
Don't put multiple statements on a single line unless you have
6160
something to hide:
6261

@@ -156,25 +155,25 @@ comments on.
156155

157156
Do not unnecessarily use braces where a single statement will do.
158157

159-
if (condition)
160-
action();
158+
if (condition)
159+
action();
161160

162161
and
163162

164-
if (condition)
165-
do_this();
166-
else
167-
do_that();
163+
if (condition)
164+
do_this();
165+
else
166+
do_that();
168167

169168
This does not apply if only one branch of a conditional statement is a single
170169
statement; in the latter case use braces in both branches:
171170

172-
if (condition) {
173-
do_this();
174-
do_that();
175-
} else {
176-
otherwise();
177-
}
171+
if (condition) {
172+
do_this();
173+
do_that();
174+
} else {
175+
otherwise();
176+
}
178177

179178
3.1: Spaces
180179

@@ -186,8 +185,11 @@ although they are not required in the language, as in: "sizeof info" after
186185
"struct fileinfo info;" is declared).
187186

188187
So use a space after these keywords:
188+
189189
if, switch, case, for, do, while
190+
190191
but not with sizeof, typeof, alignof, or __attribute__. E.g.,
192+
191193
s = sizeof(struct file);
192194

193195
Do not add spaces around (inside) parenthesized expressions. This example is
@@ -209,12 +211,15 @@ such as any of these:
209211
= + - < > * / % | & ^ <= >= == != ? :
210212

211213
but no space after unary operators:
214+
212215
& * + - ~ ! sizeof typeof alignof __attribute__ defined
213216

214217
no space before the postfix increment & decrement unary operators:
218+
215219
++ --
216220

217221
no space after the prefix increment & decrement unary operators:
222+
218223
++ --
219224

220225
and no space around the '.' and "->" structure member operators.
@@ -268,13 +273,11 @@ See chapter 6 (Functions).
268273
Chapter 5: Typedefs
269274

270275
Please don't use things like "vps_t".
271-
272276
It's a _mistake_ to use typedef for structures and pointers. When you see a
273277

274278
vps_t a;
275279

276280
in the source, what does it mean?
277-
278281
In contrast, if it says
279282

280283
struct virtual_container *a;
@@ -372,11 +375,11 @@ In source files, separate functions with one blank line. If the function is
372375
exported, the EXPORT* macro for it should follow immediately after the closing
373376
function brace line. E.g.:
374377

375-
int system_is_up(void)
376-
{
377-
return system_state == SYSTEM_RUNNING;
378-
}
379-
EXPORT_SYMBOL(system_is_up);
378+
int system_is_up(void)
379+
{
380+
return system_state == SYSTEM_RUNNING;
381+
}
382+
EXPORT_SYMBOL(system_is_up);
380383

381384
In function prototypes, include parameter names with their data types.
382385
Although this is not required by the C language, it is preferred in Linux
@@ -405,34 +408,34 @@ The rationale for using gotos is:
405408
modifications are prevented
406409
- saves the compiler work to optimize redundant code away ;)
407410

408-
int fun(int a)
409-
{
410-
int result = 0;
411-
char *buffer;
412-
413-
buffer = kmalloc(SIZE, GFP_KERNEL);
414-
if (!buffer)
415-
return -ENOMEM;
416-
417-
if (condition1) {
418-
while (loop1) {
419-
...
411+
int fun(int a)
412+
{
413+
int result = 0;
414+
char *buffer;
415+
416+
buffer = kmalloc(SIZE, GFP_KERNEL);
417+
if (!buffer)
418+
return -ENOMEM;
419+
420+
if (condition1) {
421+
while (loop1) {
422+
...
423+
}
424+
result = 1;
425+
goto out_buffer;
420426
}
421-
result = 1;
422-
goto out_buffer;
427+
...
428+
out_buffer:
429+
kfree(buffer);
430+
return result;
423431
}
424-
...
425-
out_buffer:
426-
kfree(buffer);
427-
return result;
428-
}
429432

430433
A common type of bug to be aware of it "one err bugs" which look like this:
431434

432-
err:
433-
kfree(foo->bar);
434-
kfree(foo);
435-
return ret;
435+
err:
436+
kfree(foo->bar);
437+
kfree(foo);
438+
return ret;
436439

437440
The bug in this code is that on some exit paths "foo" is NULL. Normally the
438441
fix for this is to split it up into two error labels "err_bar:" and "err_foo:".
@@ -503,9 +506,9 @@ values. To do the latter, you can stick the following in your .emacs file:
503506
(defun c-lineup-arglist-tabs-only (ignored)
504507
"Line up argument lists by tabs, not spaces"
505508
(let* ((anchor (c-langelem-pos c-syntactic-element))
506-
(column (c-langelem-2nd-pos c-syntactic-element))
507-
(offset (- (1+ column) anchor))
508-
(steps (floor offset c-basic-offset)))
509+
(column (c-langelem-2nd-pos c-syntactic-element))
510+
(offset (- (1+ column) anchor))
511+
(steps (floor offset c-basic-offset)))
509512
(* (max steps 1)
510513
c-basic-offset)))
511514

@@ -612,7 +615,7 @@ have a reference count on it, you almost certainly have a bug.
612615

613616
Names of macros defining constants and labels in enums are capitalized.
614617

615-
#define CONSTANT 0x12345
618+
#define CONSTANT 0x12345
616619

617620
Enums are preferred when defining several related constants.
618621

@@ -623,28 +626,28 @@ Generally, inline functions are preferable to macros resembling functions.
623626

624627
Macros with multiple statements should be enclosed in a do - while block:
625628

626-
#define macrofun(a, b, c) \
627-
do { \
628-
if (a == 5) \
629-
do_this(b, c); \
630-
} while (0)
629+
#define macrofun(a, b, c) \
630+
do { \
631+
if (a == 5) \
632+
do_this(b, c); \
633+
} while (0)
631634

632635
Things to avoid when using macros:
633636

634637
1) macros that affect control flow:
635638

636-
#define FOO(x) \
637-
do { \
638-
if (blah(x) < 0) \
639-
return -EBUGGERED; \
640-
} while(0)
639+
#define FOO(x) \
640+
do { \
641+
if (blah(x) < 0) \
642+
return -EBUGGERED; \
643+
} while(0)
641644

642645
is a _very_ bad idea. It looks like a function call but exits the "calling"
643646
function; don't break the internal parsers of those who will read the code.
644647

645648
2) macros that depend on having a local variable with a magic name:
646649

647-
#define FOO(val) bar(index, val)
650+
#define FOO(val) bar(index, val)
648651

649652
might look like a good thing, but it's confusing as hell when one reads the
650653
code and it's prone to breakage from seemingly innocent changes.
@@ -656,8 +659,8 @@ bite you if somebody e.g. turns FOO into an inline function.
656659
must enclose the expression in parentheses. Beware of similar issues with
657660
macros using parameters.
658661

659-
#define CONSTANT 0x4000
660-
#define CONSTEXP (CONSTANT | 3)
662+
#define CONSTANT 0x4000
663+
#define CONSTEXP (CONSTANT | 3)
661664

662665
5) namespace collisions when defining local variables in macros resembling
663666
functions:
@@ -809,11 +812,11 @@ you should use, rather than explicitly coding some variant of them yourself.
809812
For example, if you need to calculate the length of an array, take advantage
810813
of the macro
811814

812-
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
815+
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
813816

814817
Similarly, if you need to calculate the size of some structure member, use
815818

816-
#define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f))
819+
#define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f))
817820

818821
There are also min() and max() macros that do strict type checking if you
819822
need them. Feel free to peruse that header file to see what else is already
@@ -826,19 +829,19 @@ Some editors can interpret configuration information embedded in source files,
826829
indicated with special markers. For example, emacs interprets lines marked
827830
like this:
828831

829-
-*- mode: c -*-
832+
-*- mode: c -*-
830833

831834
Or like this:
832835

833-
/*
834-
Local Variables:
835-
compile-command: "gcc -DMAGIC_DEBUG_FLAG foo.c"
836-
End:
837-
*/
836+
/*
837+
Local Variables:
838+
compile-command: "gcc -DMAGIC_DEBUG_FLAG foo.c"
839+
End:
840+
*/
838841

839842
Vim interprets markers that look like this:
840843

841-
/* vim:set sw=8 noet */
844+
/* vim:set sw=8 noet */
842845

843846
Do not include any of these in source files. People have their own personal
844847
editor configurations, and your source files should not override them. This
@@ -915,9 +918,9 @@ At the end of any non-trivial #if or #ifdef block (more than a few lines),
915918
place a comment after the #endif on the same line, noting the conditional
916919
expression used. For instance:
917920

918-
#ifdef CONFIG_SOMETHING
919-
...
920-
#endif /* CONFIG_SOMETHING */
921+
#ifdef CONFIG_SOMETHING
922+
...
923+
#endif /* CONFIG_SOMETHING */
921924

922925

923926
Appendix I: References

‎Documentation/DocBook/drm.tmpl‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1293,7 +1293,7 @@ int max_width, max_height;</synopsis>
12931293
</para>
12941294
<para>
12951295
If a page flip can be successfully scheduled the driver must set the
1296-
<code>drm_crtc-&lt;fb</code> field to the new framebuffer pointed to
1296+
<code>drm_crtc-&gt;fb</code> field to the new framebuffer pointed to
12971297
by <code>fb</code>. This is important so that the reference counting
12981298
on framebuffers stays balanced.
12991299
</para>

‎Documentation/DocBook/media/v4l/biblio.xml‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
<bibliography>
22
<title>References</title>
33

4-
<biblioentry id="eia608">
5-
<abbrev>EIA&nbsp;608-B</abbrev>
4+
<biblioentry id="cea608">
5+
<abbrev>CEA&nbsp;608-E</abbrev>
66
<authorgroup>
7-
<corpauthor>Electronic Industries Alliance (<ulink
8-
url="http://www.eia.org">http://www.eia.org</ulink>)</corpauthor>
7+
<corpauthor>Consumer Electronics Association (<ulink
8+
url="http://www.ce.org">http://www.ce.org</ulink>)</corpauthor>
99
</authorgroup>
10-
<title>EIA 608-B "Recommended Practice for Line 21 Data
11-
Service"</title>
10+
<title>CEA-608-E R-2014 "Line 21 Data Services"</title>
1211
</biblioentry>
1312

1413
<biblioentry id="en300294">

‎Documentation/DocBook/media/v4l/dev-sliced-vbi.xml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ ETS&nbsp;300&nbsp;231, lsb first transmitted.</entry>
254254
<row>
255255
<entry><constant>V4L2_SLICED_CAPTION_525</constant></entry>
256256
<entry>0x1000</entry>
257-
<entry><xref linkend="eia608" /></entry>
257+
<entry><xref linkend="cea608" /></entry>
258258
<entry>NTSC line 21, 284 (second field 21)</entry>
259259
<entry>Two bytes in transmission order, including parity
260260
bit, lsb first transmitted.</entry>

‎Documentation/DocBook/media/v4l/vidioc-g-sliced-vbi-cap.xml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ ETS&nbsp;300&nbsp;231, lsb first transmitted.</entry>
205205
<row>
206206
<entry><constant>V4L2_SLICED_CAPTION_525</constant></entry>
207207
<entry>0x1000</entry>
208-
<entry><xref linkend="eia608" /></entry>
208+
<entry><xref linkend="cea608" /></entry>
209209
<entry>NTSC line 21, 284 (second field 21)</entry>
210210
<entry>Two bytes in transmission order, including parity
211211
bit, lsb first transmitted.</entry>

‎Documentation/PCI/MSI-HOWTO.txt‎

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ retry:
353353
rc = pci_enable_msix_range(adapter->pdev, adapter->msix_entries,
354354
maxvec, maxvec);
355355
/*
356-
* -ENOSPC is the only error code allowed to be analized
356+
* -ENOSPC is the only error code allowed to be analyzed
357357
*/
358358
if (rc == -ENOSPC) {
359359
if (maxvec == 1)
@@ -370,7 +370,7 @@ retry:
370370
return rc;
371371
}
372372

373-
Note how pci_enable_msix_range() return value is analized for a fallback -
373+
Note how pci_enable_msix_range() return value is analyzed for a fallback -
374374
any error code other than -ENOSPC indicates a fatal error and should not
375375
be retried.
376376

@@ -486,7 +486,7 @@ during development.
486486
If your device supports both MSI-X and MSI capabilities, you should use
487487
the MSI-X facilities in preference to the MSI facilities. As mentioned
488488
above, MSI-X supports any number of interrupts between 1 and 2048.
489-
In constrast, MSI is restricted to a maximum of 32 interrupts (and
489+
In contrast, MSI is restricted to a maximum of 32 interrupts (and
490490
must be a power of two). In addition, the MSI interrupt vectors must
491491
be allocated consecutively, so the system might not be able to allocate
492492
as many vectors for MSI as it could for MSI-X. On some platforms, MSI
@@ -501,18 +501,9 @@ necessary to disable interrupts (Linux guarantees the same interrupt will
501501
not be re-entered). If a device uses multiple interrupts, the driver
502502
must disable interrupts while the lock is held. If the device sends
503503
a different interrupt, the driver will deadlock trying to recursively
504-
acquire the spinlock.
505-
506-
There are two solutions. The first is to take the lock with
507-
spin_lock_irqsave() or spin_lock_irq() (see
508-
Documentation/DocBook/kernel-locking). The second is to specify
509-
IRQF_DISABLED to request_irq() so that the kernel runs the entire
510-
interrupt routine with interrupts disabled.
511-
512-
If your MSI interrupt routine does not hold the lock for the whole time
513-
it is running, the first solution may be best. The second solution is
514-
normally preferred as it avoids making two transitions from interrupt
515-
disabled to enabled and back again.
504+
acquire the spinlock. Such deadlocks can be avoided by using
505+
spin_lock_irqsave() or spin_lock_irq() which disable local interrupts
506+
and acquire the lock (see Documentation/DocBook/kernel-locking).
516507

517508
4.6 How to tell whether MSI/MSI-X is enabled on a device
518509

0 commit comments

Comments
 (0)