blob: 201a4f531b90a5ad360ac2f8b6cec374a7c05d44 [file] [log] [blame]
Miguel Ojedad4ef8d32018-04-10 16:32:40 -07001# SPDX-License-Identifier: GPL-2.0
2#
3# clang-format configuration file. Intended for clang-format >= 4.
4#
5# For more information, see:
6#
7# Documentation/process/clang-format.rst
8# https://clang.llvm.org/docs/ClangFormat.html
9# https://clang.llvm.org/docs/ClangFormatStyleOptions.html
10#
11---
12AccessModifierOffset: -4
13AlignAfterOpenBracket: Align
14AlignConsecutiveAssignments: false
15AlignConsecutiveDeclarations: false
16#AlignEscapedNewlines: Left # Unknown to clang-format-4.0
17AlignOperands: true
18AlignTrailingComments: false
19AllowAllParametersOfDeclarationOnNextLine: false
20AllowShortBlocksOnASingleLine: false
21AllowShortCaseLabelsOnASingleLine: false
22AllowShortFunctionsOnASingleLine: None
23AllowShortIfStatementsOnASingleLine: false
24AllowShortLoopsOnASingleLine: false
25AlwaysBreakAfterDefinitionReturnType: None
26AlwaysBreakAfterReturnType: None
27AlwaysBreakBeforeMultilineStrings: false
28AlwaysBreakTemplateDeclarations: false
29BinPackArguments: true
30BinPackParameters: true
31BraceWrapping:
32 AfterClass: false
33 AfterControlStatement: false
34 AfterEnum: false
35 AfterFunction: true
36 AfterNamespace: true
37 AfterObjCDeclaration: false
38 AfterStruct: false
39 AfterUnion: false
40 #AfterExternBlock: false # Unknown to clang-format-5.0
41 BeforeCatch: false
42 BeforeElse: false
43 IndentBraces: false
44 #SplitEmptyFunction: true # Unknown to clang-format-4.0
45 #SplitEmptyRecord: true # Unknown to clang-format-4.0
46 #SplitEmptyNamespace: true # Unknown to clang-format-4.0
47BreakBeforeBinaryOperators: None
48BreakBeforeBraces: Custom
49#BreakBeforeInheritanceComma: false # Unknown to clang-format-4.0
50BreakBeforeTernaryOperators: false
51BreakConstructorInitializersBeforeComma: false
52#BreakConstructorInitializers: BeforeComma # Unknown to clang-format-4.0
53BreakAfterJavaFieldAnnotations: false
54BreakStringLiterals: false
55ColumnLimit: 80
56CommentPragmas: '^ IWYU pragma:'
57#CompactNamespaces: false # Unknown to clang-format-4.0
58ConstructorInitializerAllOnOneLineOrOnePerLine: false
59ConstructorInitializerIndentWidth: 8
60ContinuationIndentWidth: 8
61Cpp11BracedListStyle: false
62DerivePointerAlignment: false
63DisableFormat: false
64ExperimentalAutoDetectBinPacking: false
65#FixNamespaceComments: false # Unknown to clang-format-4.0
66
67# Taken from:
68# git grep -h '^#define [^[:space:]]*for_each[^[:space:]]*(' include/ \
69# | sed "s,^#define \([^[:space:]]*for_each[^[:space:]]*\)(.*$, - '\1'," \
70# | sort | uniq
71ForEachMacros:
72 - 'apei_estatus_for_each_section'
73 - 'ata_for_each_dev'
74 - 'ata_for_each_link'
Jason Gunthorpe99e309b2019-01-18 22:57:04 +000075 - '__ata_qc_for_each'
76 - 'ata_qc_for_each'
77 - 'ata_qc_for_each_raw'
78 - 'ata_qc_for_each_with_internal'
Miguel Ojedad4ef8d32018-04-10 16:32:40 -070079 - 'ax25_for_each'
80 - 'ax25_uid_for_each'
81 - 'bio_for_each_integrity_vec'
82 - '__bio_for_each_segment'
83 - 'bio_for_each_segment'
84 - 'bio_for_each_segment_all'
85 - 'bio_list_for_each'
86 - 'bip_for_each_vec'
87 - 'blkg_for_each_descendant_post'
88 - 'blkg_for_each_descendant_pre'
89 - 'blk_queue_for_each_rl'
90 - 'bond_for_each_slave'
91 - 'bond_for_each_slave_rcu'
Jason Gunthorpe99e309b2019-01-18 22:57:04 +000092 - 'bpf_for_each_spilled_reg'
Miguel Ojedad4ef8d32018-04-10 16:32:40 -070093 - 'btree_for_each_safe128'
94 - 'btree_for_each_safe32'
95 - 'btree_for_each_safe64'
96 - 'btree_for_each_safel'
97 - 'card_for_each_dev'
98 - 'cgroup_taskset_for_each'
99 - 'cgroup_taskset_for_each_leader'
100 - 'cpufreq_for_each_entry'
101 - 'cpufreq_for_each_entry_idx'
102 - 'cpufreq_for_each_valid_entry'
103 - 'cpufreq_for_each_valid_entry_idx'
104 - 'css_for_each_child'
105 - 'css_for_each_descendant_post'
106 - 'css_for_each_descendant_pre'
107 - 'device_for_each_child_node'
108 - 'drm_atomic_crtc_for_each_plane'
109 - 'drm_atomic_crtc_state_for_each_plane'
110 - 'drm_atomic_crtc_state_for_each_plane_state'
Jason Gunthorpe99e309b2019-01-18 22:57:04 +0000111 - 'drm_atomic_for_each_plane_damage'
112 - 'drm_connector_for_each_possible_encoder'
Miguel Ojedad4ef8d32018-04-10 16:32:40 -0700113 - 'drm_for_each_connector_iter'
114 - 'drm_for_each_crtc'
115 - 'drm_for_each_encoder'
116 - 'drm_for_each_encoder_mask'
117 - 'drm_for_each_fb'
118 - 'drm_for_each_legacy_plane'
119 - 'drm_for_each_plane'
120 - 'drm_for_each_plane_mask'
121 - 'drm_mm_for_each_hole'
122 - 'drm_mm_for_each_node'
123 - 'drm_mm_for_each_node_in_range'
124 - 'drm_mm_for_each_node_safe'
125 - 'for_each_active_drhd_unit'
126 - 'for_each_active_iommu'
127 - 'for_each_available_child_of_node'
128 - 'for_each_bio'
129 - 'for_each_board_func_rsrc'
130 - 'for_each_bvec'
Jason Gunthorpe99e309b2019-01-18 22:57:04 +0000131 - 'for_each_card_components'
132 - 'for_each_card_links'
133 - 'for_each_card_links_safe'
134 - 'for_each_card_prelinks'
135 - 'for_each_card_rtds'
136 - 'for_each_card_rtds_safe'
137 - 'for_each_cgroup_storage_type'
Miguel Ojedad4ef8d32018-04-10 16:32:40 -0700138 - 'for_each_child_of_node'
139 - 'for_each_clear_bit'
140 - 'for_each_clear_bit_from'
141 - 'for_each_cmsghdr'
142 - 'for_each_compatible_node'
Jason Gunthorpe99e309b2019-01-18 22:57:04 +0000143 - 'for_each_component_dais'
144 - 'for_each_component_dais_safe'
145 - 'for_each_comp_order'
Miguel Ojedad4ef8d32018-04-10 16:32:40 -0700146 - 'for_each_console'
147 - 'for_each_cpu'
148 - 'for_each_cpu_and'
149 - 'for_each_cpu_not'
150 - 'for_each_cpu_wrap'
151 - 'for_each_dev_addr'
152 - 'for_each_dma_cap_mask'
Jason Gunthorpe99e309b2019-01-18 22:57:04 +0000153 - 'for_each_dpcm_be'
154 - 'for_each_dpcm_be_rollback'
155 - 'for_each_dpcm_be_safe'
156 - 'for_each_dpcm_fe'
Miguel Ojedad4ef8d32018-04-10 16:32:40 -0700157 - 'for_each_drhd_unit'
158 - 'for_each_dss_dev'
159 - 'for_each_efi_memory_desc'
160 - 'for_each_efi_memory_desc_in_map'
161 - 'for_each_endpoint_of_node'
162 - 'for_each_evictable_lru'
163 - 'for_each_fib6_node_rt_rcu'
164 - 'for_each_fib6_walker_rt'
165 - 'for_each_free_mem_range'
166 - 'for_each_free_mem_range_reverse'
167 - 'for_each_func_rsrc'
168 - 'for_each_hstate'
169 - 'for_each_if'
170 - 'for_each_iommu'
171 - 'for_each_ip_tunnel_rcu'
172 - 'for_each_irq_nr'
Jason Gunthorpe99e309b2019-01-18 22:57:04 +0000173 - 'for_each_link_codecs'
Miguel Ojedad4ef8d32018-04-10 16:32:40 -0700174 - 'for_each_lru'
175 - 'for_each_matching_node'
176 - 'for_each_matching_node_and_match'
177 - 'for_each_memblock'
178 - 'for_each_memblock_type'
179 - 'for_each_memcg_cache_index'
180 - 'for_each_mem_pfn_range'
181 - 'for_each_mem_range'
182 - 'for_each_mem_range_rev'
183 - 'for_each_migratetype_order'
184 - 'for_each_msi_entry'
Jason Gunthorpe99e309b2019-01-18 22:57:04 +0000185 - 'for_each_msi_entry_safe'
Miguel Ojedad4ef8d32018-04-10 16:32:40 -0700186 - 'for_each_net'
187 - 'for_each_netdev'
188 - 'for_each_netdev_continue'
189 - 'for_each_netdev_continue_rcu'
190 - 'for_each_netdev_feature'
191 - 'for_each_netdev_in_bond_rcu'
192 - 'for_each_netdev_rcu'
193 - 'for_each_netdev_reverse'
194 - 'for_each_netdev_safe'
195 - 'for_each_net_rcu'
196 - 'for_each_new_connector_in_state'
197 - 'for_each_new_crtc_in_state'
198 - 'for_each_new_plane_in_state'
199 - 'for_each_new_private_obj_in_state'
200 - 'for_each_node'
201 - 'for_each_node_by_name'
202 - 'for_each_node_by_type'
203 - 'for_each_node_mask'
204 - 'for_each_node_state'
205 - 'for_each_node_with_cpus'
206 - 'for_each_node_with_property'
207 - 'for_each_of_allnodes'
208 - 'for_each_of_allnodes_from'
Jason Gunthorpe99e309b2019-01-18 22:57:04 +0000209 - 'for_each_of_cpu_node'
Miguel Ojedad4ef8d32018-04-10 16:32:40 -0700210 - 'for_each_of_pci_range'
211 - 'for_each_old_connector_in_state'
212 - 'for_each_old_crtc_in_state'
213 - 'for_each_oldnew_connector_in_state'
214 - 'for_each_oldnew_crtc_in_state'
215 - 'for_each_oldnew_plane_in_state'
Jason Gunthorpe99e309b2019-01-18 22:57:04 +0000216 - 'for_each_oldnew_plane_in_state_reverse'
Miguel Ojedad4ef8d32018-04-10 16:32:40 -0700217 - 'for_each_oldnew_private_obj_in_state'
218 - 'for_each_old_plane_in_state'
219 - 'for_each_old_private_obj_in_state'
220 - 'for_each_online_cpu'
221 - 'for_each_online_node'
222 - 'for_each_online_pgdat'
223 - 'for_each_pci_bridge'
224 - 'for_each_pci_dev'
225 - 'for_each_pci_msi_entry'
226 - 'for_each_populated_zone'
227 - 'for_each_possible_cpu'
228 - 'for_each_present_cpu'
229 - 'for_each_prime_number'
230 - 'for_each_prime_number_from'
231 - 'for_each_process'
232 - 'for_each_process_thread'
233 - 'for_each_property_of_node'
Jason Gunthorpe99e309b2019-01-18 22:57:04 +0000234 - 'for_each_registered_fb'
Miguel Ojedad4ef8d32018-04-10 16:32:40 -0700235 - 'for_each_reserved_mem_region'
Jason Gunthorpe99e309b2019-01-18 22:57:04 +0000236 - 'for_each_rtd_codec_dai'
237 - 'for_each_rtd_codec_dai_rollback'
Miguel Ojedad4ef8d32018-04-10 16:32:40 -0700238 - 'for_each_rtdcom'
239 - 'for_each_rtdcom_safe'
240 - 'for_each_set_bit'
241 - 'for_each_set_bit_from'
242 - 'for_each_sg'
Jason Gunthorped901b272019-01-04 11:40:21 -0700243 - 'for_each_sg_dma_page'
Miguel Ojedad4ef8d32018-04-10 16:32:40 -0700244 - 'for_each_sg_page'
Jason Gunthorpe99e309b2019-01-18 22:57:04 +0000245 - 'for_each_sibling_event'
Miguel Ojedad4ef8d32018-04-10 16:32:40 -0700246 - '__for_each_thread'
247 - 'for_each_thread'
248 - 'for_each_zone'
249 - 'for_each_zone_zonelist'
250 - 'for_each_zone_zonelist_nodemask'
251 - 'fwnode_for_each_available_child_node'
252 - 'fwnode_for_each_child_node'
253 - 'fwnode_graph_for_each_endpoint'
254 - 'gadget_for_each_ep'
255 - 'hash_for_each'
256 - 'hash_for_each_possible'
257 - 'hash_for_each_possible_rcu'
258 - 'hash_for_each_possible_rcu_notrace'
259 - 'hash_for_each_possible_safe'
260 - 'hash_for_each_rcu'
261 - 'hash_for_each_safe'
262 - 'hctx_for_each_ctx'
263 - 'hlist_bl_for_each_entry'
264 - 'hlist_bl_for_each_entry_rcu'
265 - 'hlist_bl_for_each_entry_safe'
266 - 'hlist_for_each'
267 - 'hlist_for_each_entry'
268 - 'hlist_for_each_entry_continue'
269 - 'hlist_for_each_entry_continue_rcu'
270 - 'hlist_for_each_entry_continue_rcu_bh'
271 - 'hlist_for_each_entry_from'
272 - 'hlist_for_each_entry_from_rcu'
273 - 'hlist_for_each_entry_rcu'
274 - 'hlist_for_each_entry_rcu_bh'
275 - 'hlist_for_each_entry_rcu_notrace'
276 - 'hlist_for_each_entry_safe'
277 - '__hlist_for_each_rcu'
278 - 'hlist_for_each_safe'
279 - 'hlist_nulls_for_each_entry'
280 - 'hlist_nulls_for_each_entry_from'
281 - 'hlist_nulls_for_each_entry_rcu'
282 - 'hlist_nulls_for_each_entry_safe'
Jason Gunthorpe99e309b2019-01-18 22:57:04 +0000283 - 'i3c_bus_for_each_i2cdev'
284 - 'i3c_bus_for_each_i3cdev'
Miguel Ojedad4ef8d32018-04-10 16:32:40 -0700285 - 'ide_host_for_each_port'
286 - 'ide_port_for_each_dev'
287 - 'ide_port_for_each_present_dev'
288 - 'idr_for_each_entry'
289 - 'idr_for_each_entry_continue'
290 - 'idr_for_each_entry_ul'
291 - 'inet_bind_bucket_for_each'
292 - 'inet_lhash2_for_each_icsk_rcu'
293 - 'iov_for_each'
294 - 'key_for_each'
295 - 'key_for_each_safe'
296 - 'klp_for_each_func'
297 - 'klp_for_each_object'
298 - 'kvm_for_each_memslot'
299 - 'kvm_for_each_vcpu'
300 - 'list_for_each'
Jason Gunthorpe99e309b2019-01-18 22:57:04 +0000301 - 'list_for_each_codec'
302 - 'list_for_each_codec_safe'
Miguel Ojedad4ef8d32018-04-10 16:32:40 -0700303 - 'list_for_each_entry'
304 - 'list_for_each_entry_continue'
305 - 'list_for_each_entry_continue_rcu'
306 - 'list_for_each_entry_continue_reverse'
307 - 'list_for_each_entry_from'
Jason Gunthorpe99e309b2019-01-18 22:57:04 +0000308 - 'list_for_each_entry_from_rcu'
Miguel Ojedad4ef8d32018-04-10 16:32:40 -0700309 - 'list_for_each_entry_from_reverse'
310 - 'list_for_each_entry_lockless'
311 - 'list_for_each_entry_rcu'
312 - 'list_for_each_entry_reverse'
313 - 'list_for_each_entry_safe'
314 - 'list_for_each_entry_safe_continue'
315 - 'list_for_each_entry_safe_from'
316 - 'list_for_each_entry_safe_reverse'
317 - 'list_for_each_prev'
318 - 'list_for_each_prev_safe'
319 - 'list_for_each_safe'
320 - 'llist_for_each'
321 - 'llist_for_each_entry'
322 - 'llist_for_each_entry_safe'
323 - 'llist_for_each_safe'
324 - 'media_device_for_each_entity'
325 - 'media_device_for_each_intf'
326 - 'media_device_for_each_link'
327 - 'media_device_for_each_pad'
Jason Gunthorpe99e309b2019-01-18 22:57:04 +0000328 - 'nanddev_io_for_each_page'
Miguel Ojedad4ef8d32018-04-10 16:32:40 -0700329 - 'netdev_for_each_lower_dev'
330 - 'netdev_for_each_lower_private'
331 - 'netdev_for_each_lower_private_rcu'
332 - 'netdev_for_each_mc_addr'
333 - 'netdev_for_each_uc_addr'
334 - 'netdev_for_each_upper_dev_rcu'
335 - 'netdev_hw_addr_list_for_each'
336 - 'nft_rule_for_each_expr'
337 - 'nla_for_each_attr'
338 - 'nla_for_each_nested'
339 - 'nlmsg_for_each_attr'
340 - 'nlmsg_for_each_msg'
341 - 'nr_neigh_for_each'
342 - 'nr_neigh_for_each_safe'
343 - 'nr_node_for_each'
344 - 'nr_node_for_each_safe'
345 - 'of_for_each_phandle'
346 - 'of_property_for_each_string'
347 - 'of_property_for_each_u32'
348 - 'pci_bus_for_each_resource'
349 - 'ping_portaddr_for_each_entry'
350 - 'plist_for_each'
351 - 'plist_for_each_continue'
352 - 'plist_for_each_entry'
353 - 'plist_for_each_entry_continue'
354 - 'plist_for_each_entry_safe'
355 - 'plist_for_each_safe'
356 - 'pnp_for_each_card'
357 - 'pnp_for_each_dev'
358 - 'protocol_for_each_card'
359 - 'protocol_for_each_dev'
360 - 'queue_for_each_hw_ctx'
Miguel Ojedad4ef8d32018-04-10 16:32:40 -0700361 - 'radix_tree_for_each_slot'
362 - 'radix_tree_for_each_tagged'
363 - 'rbtree_postorder_for_each_entry_safe'
Jason Gunthorpeea1075e2019-02-12 21:12:47 -0700364 - 'rdma_for_each_port'
Miguel Ojedad4ef8d32018-04-10 16:32:40 -0700365 - 'resource_list_for_each_entry'
366 - 'resource_list_for_each_entry_safe'
367 - 'rhl_for_each_entry_rcu'
368 - 'rhl_for_each_rcu'
369 - 'rht_for_each'
370 - 'rht_for_each_continue'
371 - 'rht_for_each_entry'
372 - 'rht_for_each_entry_continue'
373 - 'rht_for_each_entry_rcu'
374 - 'rht_for_each_entry_rcu_continue'
375 - 'rht_for_each_entry_safe'
376 - 'rht_for_each_rcu'
377 - 'rht_for_each_rcu_continue'
378 - '__rq_for_each_bio'
379 - 'rq_for_each_segment'
380 - 'scsi_for_each_prot_sg'
381 - 'scsi_for_each_sg'
382 - 'sctp_for_each_hentry'
383 - 'sctp_skb_for_each'
384 - 'shdma_for_each_chan'
385 - '__shost_for_each_device'
386 - 'shost_for_each_device'
387 - 'sk_for_each'
388 - 'sk_for_each_bound'
389 - 'sk_for_each_entry_offset_rcu'
390 - 'sk_for_each_from'
391 - 'sk_for_each_rcu'
392 - 'sk_for_each_safe'
393 - 'sk_nulls_for_each'
394 - 'sk_nulls_for_each_from'
395 - 'sk_nulls_for_each_rcu'
Jason Gunthorpe99e309b2019-01-18 22:57:04 +0000396 - 'snd_array_for_each'
Miguel Ojedad4ef8d32018-04-10 16:32:40 -0700397 - 'snd_pcm_group_for_each_entry'
398 - 'snd_soc_dapm_widget_for_each_path'
399 - 'snd_soc_dapm_widget_for_each_path_safe'
400 - 'snd_soc_dapm_widget_for_each_sink_path'
401 - 'snd_soc_dapm_widget_for_each_source_path'
402 - 'tb_property_for_each'
Jason Gunthorpe99e309b2019-01-18 22:57:04 +0000403 - 'tcf_exts_for_each_action'
Miguel Ojedad4ef8d32018-04-10 16:32:40 -0700404 - 'udp_portaddr_for_each_entry'
405 - 'udp_portaddr_for_each_entry_rcu'
406 - 'usb_hub_for_each_child'
407 - 'v4l2_device_for_each_subdev'
408 - 'v4l2_m2m_for_each_dst_buf'
409 - 'v4l2_m2m_for_each_dst_buf_safe'
410 - 'v4l2_m2m_for_each_src_buf'
411 - 'v4l2_m2m_for_each_src_buf_safe'
Jason Gunthorpe99e309b2019-01-18 22:57:04 +0000412 - 'virtio_device_for_each_vq'
413 - 'xa_for_each'
414 - 'xas_for_each'
415 - 'xas_for_each_conflict'
416 - 'xas_for_each_marked'
Miguel Ojedad4ef8d32018-04-10 16:32:40 -0700417 - 'zorro_for_each_dev'
418
419#IncludeBlocks: Preserve # Unknown to clang-format-5.0
420IncludeCategories:
421 - Regex: '.*'
422 Priority: 1
423IncludeIsMainRegex: '(Test)?$'
424IndentCaseLabels: false
425#IndentPPDirectives: None # Unknown to clang-format-5.0
426IndentWidth: 8
Jason Gunthorpe7bee9bd2018-06-25 16:44:30 -0600427IndentWrappedFunctionNames: false
Miguel Ojedad4ef8d32018-04-10 16:32:40 -0700428JavaScriptQuotes: Leave
429JavaScriptWrapImports: true
430KeepEmptyLinesAtTheStartOfBlocks: false
431MacroBlockBegin: ''
432MacroBlockEnd: ''
433MaxEmptyLinesToKeep: 1
434NamespaceIndentation: Inner
435#ObjCBinPackProtocolList: Auto # Unknown to clang-format-5.0
436ObjCBlockIndentWidth: 8
437ObjCSpaceAfterProperty: true
438ObjCSpaceBeforeProtocolList: true
439
440# Taken from git's rules
441#PenaltyBreakAssignment: 10 # Unknown to clang-format-4.0
442PenaltyBreakBeforeFirstCallParameter: 30
443PenaltyBreakComment: 10
444PenaltyBreakFirstLessLess: 0
445PenaltyBreakString: 10
446PenaltyExcessCharacter: 100
447PenaltyReturnTypeOnItsOwnLine: 60
448
449PointerAlignment: Right
450ReflowComments: false
451SortIncludes: false
452#SortUsingDeclarations: false # Unknown to clang-format-4.0
453SpaceAfterCStyleCast: false
454SpaceAfterTemplateKeyword: true
455SpaceBeforeAssignmentOperators: true
456#SpaceBeforeCtorInitializerColon: true # Unknown to clang-format-5.0
457#SpaceBeforeInheritanceColon: true # Unknown to clang-format-5.0
458SpaceBeforeParens: ControlStatements
459#SpaceBeforeRangeBasedForLoopColon: true # Unknown to clang-format-5.0
460SpaceInEmptyParentheses: false
461SpacesBeforeTrailingComments: 1
462SpacesInAngles: false
463SpacesInContainerLiterals: false
464SpacesInCStyleCastParentheses: false
465SpacesInParentheses: false
466SpacesInSquareBrackets: false
467Standard: Cpp03
468TabWidth: 8
469UseTab: Always
470...