summaryrefslogtreecommitdiffstats
path: root/Documentation/hwmon
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2016-06-11 00:01:28 -0400
committerGuenter Roeck <linux@roeck-us.net>2016-06-27 21:58:03 -0400
commit165720d9ff3e33f626802da6cef3118ebfc6940c (patch)
treeed4e4fc94f88aed016a2c54bed7f7572d882a5da /Documentation/hwmon
parent7cb6dcff1956ec9e338abfa2f298d2971cfbab79 (diff)
hwmon: Update guildelines for submitting patches
Add more details to the guidelines for submitting patches. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'Documentation/hwmon')
-rw-r--r--Documentation/hwmon/submitting-patches40
1 files changed, 34 insertions, 6 deletions
diff --git a/Documentation/hwmon/submitting-patches b/Documentation/hwmon/submitting-patches
index d201828d202f..57f60307accc 100644
--- a/Documentation/hwmon/submitting-patches
+++ b/Documentation/hwmon/submitting-patches
@@ -15,10 +15,15 @@ increase the chances of your change being accepted.
15 Documentation/SubmittingPatches 15 Documentation/SubmittingPatches
16 Documentation/CodingStyle 16 Documentation/CodingStyle
17 17
18* If your patch generates checkpatch warnings, please refrain from explanations 18* Please run your patch through 'checkpatch --strict'. There should be no
19 such as "I don't like that coding style". Keep in mind that each unnecessary 19 errors, no warnings, and few if any check messages. If there are any
20 warning helps hiding a real problem. If you don't like the kernel coding 20 messages, please be prepared to explain.
21 style, don't write kernel drivers. 21
22* If your patch generates checkpatch errors, warnings, or check messages,
23 please refrain from explanations such as "I prefer that coding style".
24 Keep in mind that each unnecessary message helps hiding a real problem,
25 and a consistent coding style makes it easier for others to understand
26 and review the code.
22 27
23* Please test your patch thoroughly. We are not your test group. 28* Please test your patch thoroughly. We are not your test group.
24 Sometimes a patch can not or not completely be tested because of missing 29 Sometimes a patch can not or not completely be tested because of missing
@@ -61,15 +66,30 @@ increase the chances of your change being accepted.
61 66
62* Make sure that all dependencies are listed in Kconfig. 67* Make sure that all dependencies are listed in Kconfig.
63 68
69* Please list include files in alphabetic order.
70
71* Please align continuation lines with '(' on the previous line.
72
64* Avoid forward declarations if you can. Rearrange the code if necessary. 73* Avoid forward declarations if you can. Rearrange the code if necessary.
65 74
75* Avoid macros to generate groups of sensor attributes. It not only confuses
76 checkpatch, but also makes it more difficult to review the code.
77
66* Avoid calculations in macros and macro-generated functions. While such macros 78* Avoid calculations in macros and macro-generated functions. While such macros
67 may save a line or so in the source, it obfuscates the code and makes code 79 may save a line or so in the source, it obfuscates the code and makes code
68 review more difficult. It may also result in code which is more complicated 80 review more difficult. It may also result in code which is more complicated
69 than necessary. Use inline functions or just regular functions instead. 81 than necessary. Use inline functions or just regular functions instead.
70 82
83* Limit the number of kernel log messages. In general, your driver should not
84 generate an error message just because a runtime operation failed. Report
85 errors to user space instead, using an appropriate error code. Keep in mind
86 that kernel error log messages not only fill up the kernel log, but also are
87 printed synchronously, most likely with interrupt disabled, often to a serial
88 console. Excessive logging can seriously affect system performance.
89
71* Use devres functions whenever possible to allocate resources. For rationale 90* Use devres functions whenever possible to allocate resources. For rationale
72 and supported functions, please see Documentation/driver-model/devres.txt. 91 and supported functions, please see Documentation/driver-model/devres.txt.
92 If a function is not supported by devres, consider using devm_add_action().
73 93
74* If the driver has a detect function, make sure it is silent. Debug messages 94* If the driver has a detect function, make sure it is silent. Debug messages
75 and messages printed after a successful detection are acceptable, but it 95 and messages printed after a successful detection are acceptable, but it
@@ -96,8 +116,16 @@ increase the chances of your change being accepted.
96 writing to it might cause a bad misconfiguration. 116 writing to it might cause a bad misconfiguration.
97 117
98* Make sure there are no race conditions in the probe function. Specifically, 118* Make sure there are no race conditions in the probe function. Specifically,
99 completely initialize your chip first, then create sysfs entries and register 119 completely initialize your chip and your driver first, then register with
100 with the hwmon subsystem. 120 the hwmon subsystem.
121
122* Use devm_hwmon_device_register_with_groups() or, if your driver needs a remove
123 function, hwmon_device_register_with_groups() to register your driver with the
124 hwmon subsystem. Try using devm_add_action() instead of a remove function if
125 possible. Do not use hwmon_device_register().
126
127* Your driver should be buildable as module. If not, please be prepared to
128 explain why it has to be built into the kernel.
101 129
102* Do not provide support for deprecated sysfs attributes. 130* Do not provide support for deprecated sysfs attributes.
103 131