How do i put multiline or single line comments in device tree source files. I couldn't find it anywhere. Does the default c way of using comments work?
Asked
Active
Viewed 1.9k times
2 Answers
20
Does the default c way of using comments work?
Yes, use /* comment */
.
ADDENDUM
I've also used C preprocessor #if 0
and #endif
directives to quickly disable (or enable) multiple lines of a node during testing.
I have not seen any conditional directives in DT files elsewhere, so such use may be frowned upon.

sawdust
- 16,103
- 3
- 40
- 50
-
yeah i was about to post the same answer for my own question. Got some hands on experience with using device tree now and i was sure we use the comments /* my comment */. Thanks sawdust. – mdsingh Feb 20 '14 at 06:20
12
Here is what devicetree documentation says:
The format of the .dts "source" file is "C" like, supports C and C++ style comments.
So you can use both
/* multiline (C style)
comments */
and
// single line (C++ style) comments,
although the latter is not commonly used for some reason.

il--ya
- 315
- 3
- 7
-
2*"the latter is not commonly used for some reason"* -- The reason would be that C++ style comments are not part of the [(Linux) kernel coding style](https://www.kernel.org/doc/html/v4.10/process/coding-style.html). – sawdust Sep 12 '19 at 22:22