Merge tag 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm
[platform/kernel/linux-starfive.git] / .clang-format
1 # 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 ---
12 AccessModifierOffset: -4
13 AlignAfterOpenBracket: Align
14 AlignConsecutiveAssignments: false
15 AlignConsecutiveDeclarations: false
16 #AlignEscapedNewlines: Left # Unknown to clang-format-4.0
17 AlignOperands: true
18 AlignTrailingComments: false
19 AllowAllParametersOfDeclarationOnNextLine: false
20 AllowShortBlocksOnASingleLine: false
21 AllowShortCaseLabelsOnASingleLine: false
22 AllowShortFunctionsOnASingleLine: None
23 AllowShortIfStatementsOnASingleLine: false
24 AllowShortLoopsOnASingleLine: false
25 AlwaysBreakAfterDefinitionReturnType: None
26 AlwaysBreakAfterReturnType: None
27 AlwaysBreakBeforeMultilineStrings: false
28 AlwaysBreakTemplateDeclarations: false
29 BinPackArguments: true
30 BinPackParameters: true
31 BraceWrapping:
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
47 BreakBeforeBinaryOperators: None
48 BreakBeforeBraces: Custom
49 #BreakBeforeInheritanceComma: false # Unknown to clang-format-4.0
50 BreakBeforeTernaryOperators: false
51 BreakConstructorInitializersBeforeComma: false
52 #BreakConstructorInitializers: BeforeComma # Unknown to clang-format-4.0
53 BreakAfterJavaFieldAnnotations: false
54 BreakStringLiterals: false
55 ColumnLimit: 80
56 CommentPragmas: '^ IWYU pragma:'
57 #CompactNamespaces: false # Unknown to clang-format-4.0
58 ConstructorInitializerAllOnOneLineOrOnePerLine: false
59 ConstructorInitializerIndentWidth: 8
60 ContinuationIndentWidth: 8
61 Cpp11BracedListStyle: false
62 DerivePointerAlignment: false
63 DisableFormat: false
64 ExperimentalAutoDetectBinPacking: 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
71 ForEachMacros:
72   - 'apei_estatus_for_each_section'
73   - 'ata_for_each_dev'
74   - 'ata_for_each_link'
75   - '__ata_qc_for_each'
76   - 'ata_qc_for_each'
77   - 'ata_qc_for_each_raw'
78   - 'ata_qc_for_each_with_internal'
79   - 'ax25_for_each'
80   - 'ax25_uid_for_each'
81   - '__bio_for_each_bvec'
82   - 'bio_for_each_bvec'
83   - 'bio_for_each_integrity_vec'
84   - '__bio_for_each_segment'
85   - 'bio_for_each_segment'
86   - 'bio_for_each_segment_all'
87   - 'bio_list_for_each'
88   - 'bip_for_each_vec'
89   - 'blkg_for_each_descendant_post'
90   - 'blkg_for_each_descendant_pre'
91   - 'blk_queue_for_each_rl'
92   - 'bond_for_each_slave'
93   - 'bond_for_each_slave_rcu'
94   - 'bpf_for_each_spilled_reg'
95   - 'btree_for_each_safe128'
96   - 'btree_for_each_safe32'
97   - 'btree_for_each_safe64'
98   - 'btree_for_each_safel'
99   - 'card_for_each_dev'
100   - 'cgroup_taskset_for_each'
101   - 'cgroup_taskset_for_each_leader'
102   - 'cpufreq_for_each_entry'
103   - 'cpufreq_for_each_entry_idx'
104   - 'cpufreq_for_each_valid_entry'
105   - 'cpufreq_for_each_valid_entry_idx'
106   - 'css_for_each_child'
107   - 'css_for_each_descendant_post'
108   - 'css_for_each_descendant_pre'
109   - 'device_for_each_child_node'
110   - 'drm_atomic_crtc_for_each_plane'
111   - 'drm_atomic_crtc_state_for_each_plane'
112   - 'drm_atomic_crtc_state_for_each_plane_state'
113   - 'drm_atomic_for_each_plane_damage'
114   - 'drm_connector_for_each_possible_encoder'
115   - 'drm_for_each_connector_iter'
116   - 'drm_for_each_crtc'
117   - 'drm_for_each_encoder'
118   - 'drm_for_each_encoder_mask'
119   - 'drm_for_each_fb'
120   - 'drm_for_each_legacy_plane'
121   - 'drm_for_each_plane'
122   - 'drm_for_each_plane_mask'
123   - 'drm_for_each_privobj'
124   - 'drm_mm_for_each_hole'
125   - 'drm_mm_for_each_node'
126   - 'drm_mm_for_each_node_in_range'
127   - 'drm_mm_for_each_node_safe'
128   - 'flow_action_for_each'
129   - 'for_each_active_drhd_unit'
130   - 'for_each_active_iommu'
131   - 'for_each_available_child_of_node'
132   - 'for_each_bio'
133   - 'for_each_board_func_rsrc'
134   - 'for_each_bvec'
135   - 'for_each_card_components'
136   - 'for_each_card_links'
137   - 'for_each_card_links_safe'
138   - 'for_each_card_prelinks'
139   - 'for_each_card_rtds'
140   - 'for_each_card_rtds_safe'
141   - 'for_each_cgroup_storage_type'
142   - 'for_each_child_of_node'
143   - 'for_each_clear_bit'
144   - 'for_each_clear_bit_from'
145   - 'for_each_cmsghdr'
146   - 'for_each_compatible_node'
147   - 'for_each_component_dais'
148   - 'for_each_component_dais_safe'
149   - 'for_each_comp_order'
150   - 'for_each_console'
151   - 'for_each_cpu'
152   - 'for_each_cpu_and'
153   - 'for_each_cpu_not'
154   - 'for_each_cpu_wrap'
155   - 'for_each_dev_addr'
156   - 'for_each_dma_cap_mask'
157   - 'for_each_dpcm_be'
158   - 'for_each_dpcm_be_rollback'
159   - 'for_each_dpcm_be_safe'
160   - 'for_each_dpcm_fe'
161   - 'for_each_drhd_unit'
162   - 'for_each_dss_dev'
163   - 'for_each_efi_memory_desc'
164   - 'for_each_efi_memory_desc_in_map'
165   - 'for_each_element'
166   - 'for_each_element_extid'
167   - 'for_each_element_id'
168   - 'for_each_endpoint_of_node'
169   - 'for_each_evictable_lru'
170   - 'for_each_fib6_node_rt_rcu'
171   - 'for_each_fib6_walker_rt'
172   - 'for_each_free_mem_range'
173   - 'for_each_free_mem_range_reverse'
174   - 'for_each_func_rsrc'
175   - 'for_each_hstate'
176   - 'for_each_if'
177   - 'for_each_iommu'
178   - 'for_each_ip_tunnel_rcu'
179   - 'for_each_irq_nr'
180   - 'for_each_link_codecs'
181   - 'for_each_lru'
182   - 'for_each_matching_node'
183   - 'for_each_matching_node_and_match'
184   - 'for_each_memblock'
185   - 'for_each_memblock_type'
186   - 'for_each_memcg_cache_index'
187   - 'for_each_mem_pfn_range'
188   - 'for_each_mem_range'
189   - 'for_each_mem_range_rev'
190   - 'for_each_migratetype_order'
191   - 'for_each_msi_entry'
192   - 'for_each_msi_entry_safe'
193   - 'for_each_net'
194   - 'for_each_netdev'
195   - 'for_each_netdev_continue'
196   - 'for_each_netdev_continue_rcu'
197   - 'for_each_netdev_feature'
198   - 'for_each_netdev_in_bond_rcu'
199   - 'for_each_netdev_rcu'
200   - 'for_each_netdev_reverse'
201   - 'for_each_netdev_safe'
202   - 'for_each_net_rcu'
203   - 'for_each_new_connector_in_state'
204   - 'for_each_new_crtc_in_state'
205   - 'for_each_new_mst_mgr_in_state'
206   - 'for_each_new_plane_in_state'
207   - 'for_each_new_private_obj_in_state'
208   - 'for_each_node'
209   - 'for_each_node_by_name'
210   - 'for_each_node_by_type'
211   - 'for_each_node_mask'
212   - 'for_each_node_state'
213   - 'for_each_node_with_cpus'
214   - 'for_each_node_with_property'
215   - 'for_each_of_allnodes'
216   - 'for_each_of_allnodes_from'
217   - 'for_each_of_cpu_node'
218   - 'for_each_of_pci_range'
219   - 'for_each_old_connector_in_state'
220   - 'for_each_old_crtc_in_state'
221   - 'for_each_old_mst_mgr_in_state'
222   - 'for_each_oldnew_connector_in_state'
223   - 'for_each_oldnew_crtc_in_state'
224   - 'for_each_oldnew_mst_mgr_in_state'
225   - 'for_each_oldnew_plane_in_state'
226   - 'for_each_oldnew_plane_in_state_reverse'
227   - 'for_each_oldnew_private_obj_in_state'
228   - 'for_each_old_plane_in_state'
229   - 'for_each_old_private_obj_in_state'
230   - 'for_each_online_cpu'
231   - 'for_each_online_node'
232   - 'for_each_online_pgdat'
233   - 'for_each_pci_bridge'
234   - 'for_each_pci_dev'
235   - 'for_each_pci_msi_entry'
236   - 'for_each_populated_zone'
237   - 'for_each_possible_cpu'
238   - 'for_each_present_cpu'
239   - 'for_each_prime_number'
240   - 'for_each_prime_number_from'
241   - 'for_each_process'
242   - 'for_each_process_thread'
243   - 'for_each_property_of_node'
244   - 'for_each_registered_fb'
245   - 'for_each_reserved_mem_region'
246   - 'for_each_rtd_codec_dai'
247   - 'for_each_rtd_codec_dai_rollback'
248   - 'for_each_rtdcom'
249   - 'for_each_rtdcom_safe'
250   - 'for_each_set_bit'
251   - 'for_each_set_bit_from'
252   - 'for_each_sg'
253   - 'for_each_sg_dma_page'
254   - 'for_each_sg_page'
255   - 'for_each_sibling_event'
256   - 'for_each_subelement'
257   - 'for_each_subelement_extid'
258   - 'for_each_subelement_id'
259   - '__for_each_thread'
260   - 'for_each_thread'
261   - 'for_each_zone'
262   - 'for_each_zone_zonelist'
263   - 'for_each_zone_zonelist_nodemask'
264   - 'fwnode_for_each_available_child_node'
265   - 'fwnode_for_each_child_node'
266   - 'fwnode_graph_for_each_endpoint'
267   - 'gadget_for_each_ep'
268   - 'genradix_for_each'
269   - 'genradix_for_each_from'
270   - 'hash_for_each'
271   - 'hash_for_each_possible'
272   - 'hash_for_each_possible_rcu'
273   - 'hash_for_each_possible_rcu_notrace'
274   - 'hash_for_each_possible_safe'
275   - 'hash_for_each_rcu'
276   - 'hash_for_each_safe'
277   - 'hctx_for_each_ctx'
278   - 'hlist_bl_for_each_entry'
279   - 'hlist_bl_for_each_entry_rcu'
280   - 'hlist_bl_for_each_entry_safe'
281   - 'hlist_for_each'
282   - 'hlist_for_each_entry'
283   - 'hlist_for_each_entry_continue'
284   - 'hlist_for_each_entry_continue_rcu'
285   - 'hlist_for_each_entry_continue_rcu_bh'
286   - 'hlist_for_each_entry_from'
287   - 'hlist_for_each_entry_from_rcu'
288   - 'hlist_for_each_entry_rcu'
289   - 'hlist_for_each_entry_rcu_bh'
290   - 'hlist_for_each_entry_rcu_notrace'
291   - 'hlist_for_each_entry_safe'
292   - '__hlist_for_each_rcu'
293   - 'hlist_for_each_safe'
294   - 'hlist_nulls_for_each_entry'
295   - 'hlist_nulls_for_each_entry_from'
296   - 'hlist_nulls_for_each_entry_rcu'
297   - 'hlist_nulls_for_each_entry_safe'
298   - 'i3c_bus_for_each_i2cdev'
299   - 'i3c_bus_for_each_i3cdev'
300   - 'ide_host_for_each_port'
301   - 'ide_port_for_each_dev'
302   - 'ide_port_for_each_present_dev'
303   - 'idr_for_each_entry'
304   - 'idr_for_each_entry_continue'
305   - 'idr_for_each_entry_ul'
306   - 'inet_bind_bucket_for_each'
307   - 'inet_lhash2_for_each_icsk_rcu'
308   - 'key_for_each'
309   - 'key_for_each_safe'
310   - 'klp_for_each_func'
311   - 'klp_for_each_func_safe'
312   - 'klp_for_each_func_static'
313   - 'klp_for_each_object'
314   - 'klp_for_each_object_safe'
315   - 'klp_for_each_object_static'
316   - 'kvm_for_each_memslot'
317   - 'kvm_for_each_vcpu'
318   - 'list_for_each'
319   - 'list_for_each_codec'
320   - 'list_for_each_codec_safe'
321   - 'list_for_each_entry'
322   - 'list_for_each_entry_continue'
323   - 'list_for_each_entry_continue_rcu'
324   - 'list_for_each_entry_continue_reverse'
325   - 'list_for_each_entry_from'
326   - 'list_for_each_entry_from_rcu'
327   - 'list_for_each_entry_from_reverse'
328   - 'list_for_each_entry_lockless'
329   - 'list_for_each_entry_rcu'
330   - 'list_for_each_entry_reverse'
331   - 'list_for_each_entry_safe'
332   - 'list_for_each_entry_safe_continue'
333   - 'list_for_each_entry_safe_from'
334   - 'list_for_each_entry_safe_reverse'
335   - 'list_for_each_prev'
336   - 'list_for_each_prev_safe'
337   - 'list_for_each_safe'
338   - 'llist_for_each'
339   - 'llist_for_each_entry'
340   - 'llist_for_each_entry_safe'
341   - 'llist_for_each_safe'
342   - 'media_device_for_each_entity'
343   - 'media_device_for_each_intf'
344   - 'media_device_for_each_link'
345   - 'media_device_for_each_pad'
346   - 'mp_bvec_for_each_page'
347   - 'mp_bvec_for_each_segment'
348   - 'nanddev_io_for_each_page'
349   - 'netdev_for_each_lower_dev'
350   - 'netdev_for_each_lower_private'
351   - 'netdev_for_each_lower_private_rcu'
352   - 'netdev_for_each_mc_addr'
353   - 'netdev_for_each_uc_addr'
354   - 'netdev_for_each_upper_dev_rcu'
355   - 'netdev_hw_addr_list_for_each'
356   - 'nft_rule_for_each_expr'
357   - 'nla_for_each_attr'
358   - 'nla_for_each_nested'
359   - 'nlmsg_for_each_attr'
360   - 'nlmsg_for_each_msg'
361   - 'nr_neigh_for_each'
362   - 'nr_neigh_for_each_safe'
363   - 'nr_node_for_each'
364   - 'nr_node_for_each_safe'
365   - 'of_for_each_phandle'
366   - 'of_property_for_each_string'
367   - 'of_property_for_each_u32'
368   - 'pci_bus_for_each_resource'
369   - 'ping_portaddr_for_each_entry'
370   - 'plist_for_each'
371   - 'plist_for_each_continue'
372   - 'plist_for_each_entry'
373   - 'plist_for_each_entry_continue'
374   - 'plist_for_each_entry_safe'
375   - 'plist_for_each_safe'
376   - 'pnp_for_each_card'
377   - 'pnp_for_each_dev'
378   - 'protocol_for_each_card'
379   - 'protocol_for_each_dev'
380   - 'queue_for_each_hw_ctx'
381   - 'radix_tree_for_each_slot'
382   - 'radix_tree_for_each_tagged'
383   - 'rbtree_postorder_for_each_entry_safe'
384   - 'rdma_for_each_port'
385   - 'resource_list_for_each_entry'
386   - 'resource_list_for_each_entry_safe'
387   - 'rhl_for_each_entry_rcu'
388   - 'rhl_for_each_rcu'
389   - 'rht_for_each'
390   - 'rht_for_each_from'
391   - 'rht_for_each_entry'
392   - 'rht_for_each_entry_from'
393   - 'rht_for_each_entry_rcu'
394   - 'rht_for_each_entry_rcu_from'
395   - 'rht_for_each_entry_safe'
396   - 'rht_for_each_rcu'
397   - 'rht_for_each_rcu_from'
398   - '__rq_for_each_bio'
399   - 'rq_for_each_bvec'
400   - 'rq_for_each_segment'
401   - 'scsi_for_each_prot_sg'
402   - 'scsi_for_each_sg'
403   - 'sctp_for_each_hentry'
404   - 'sctp_skb_for_each'
405   - 'shdma_for_each_chan'
406   - '__shost_for_each_device'
407   - 'shost_for_each_device'
408   - 'sk_for_each'
409   - 'sk_for_each_bound'
410   - 'sk_for_each_entry_offset_rcu'
411   - 'sk_for_each_from'
412   - 'sk_for_each_rcu'
413   - 'sk_for_each_safe'
414   - 'sk_nulls_for_each'
415   - 'sk_nulls_for_each_from'
416   - 'sk_nulls_for_each_rcu'
417   - 'snd_array_for_each'
418   - 'snd_pcm_group_for_each_entry'
419   - 'snd_soc_dapm_widget_for_each_path'
420   - 'snd_soc_dapm_widget_for_each_path_safe'
421   - 'snd_soc_dapm_widget_for_each_sink_path'
422   - 'snd_soc_dapm_widget_for_each_source_path'
423   - 'tb_property_for_each'
424   - 'tcf_exts_for_each_action'
425   - 'udp_portaddr_for_each_entry'
426   - 'udp_portaddr_for_each_entry_rcu'
427   - 'usb_hub_for_each_child'
428   - 'v4l2_device_for_each_subdev'
429   - 'v4l2_m2m_for_each_dst_buf'
430   - 'v4l2_m2m_for_each_dst_buf_safe'
431   - 'v4l2_m2m_for_each_src_buf'
432   - 'v4l2_m2m_for_each_src_buf_safe'
433   - 'virtio_device_for_each_vq'
434   - 'xa_for_each'
435   - 'xa_for_each_marked'
436   - 'xa_for_each_start'
437   - 'xas_for_each'
438   - 'xas_for_each_conflict'
439   - 'xas_for_each_marked'
440   - 'zorro_for_each_dev'
441
442 #IncludeBlocks: Preserve # Unknown to clang-format-5.0
443 IncludeCategories:
444   - Regex: '.*'
445     Priority: 1
446 IncludeIsMainRegex: '(Test)?$'
447 IndentCaseLabels: false
448 #IndentPPDirectives: None # Unknown to clang-format-5.0
449 IndentWidth: 8
450 IndentWrappedFunctionNames: false
451 JavaScriptQuotes: Leave
452 JavaScriptWrapImports: true
453 KeepEmptyLinesAtTheStartOfBlocks: false
454 MacroBlockBegin: ''
455 MacroBlockEnd: ''
456 MaxEmptyLinesToKeep: 1
457 NamespaceIndentation: Inner
458 #ObjCBinPackProtocolList: Auto # Unknown to clang-format-5.0
459 ObjCBlockIndentWidth: 8
460 ObjCSpaceAfterProperty: true
461 ObjCSpaceBeforeProtocolList: true
462
463 # Taken from git's rules
464 #PenaltyBreakAssignment: 10 # Unknown to clang-format-4.0
465 PenaltyBreakBeforeFirstCallParameter: 30
466 PenaltyBreakComment: 10
467 PenaltyBreakFirstLessLess: 0
468 PenaltyBreakString: 10
469 PenaltyExcessCharacter: 100
470 PenaltyReturnTypeOnItsOwnLine: 60
471
472 PointerAlignment: Right
473 ReflowComments: false
474 SortIncludes: false
475 #SortUsingDeclarations: false # Unknown to clang-format-4.0
476 SpaceAfterCStyleCast: false
477 SpaceAfterTemplateKeyword: true
478 SpaceBeforeAssignmentOperators: true
479 #SpaceBeforeCtorInitializerColon: true # Unknown to clang-format-5.0
480 #SpaceBeforeInheritanceColon: true # Unknown to clang-format-5.0
481 SpaceBeforeParens: ControlStatements
482 #SpaceBeforeRangeBasedForLoopColon: true # Unknown to clang-format-5.0
483 SpaceInEmptyParentheses: false
484 SpacesBeforeTrailingComments: 1
485 SpacesInAngles: false
486 SpacesInContainerLiterals: false
487 SpacesInCStyleCastParentheses: false
488 SpacesInParentheses: false
489 SpacesInSquareBrackets: false
490 Standard: Cpp03
491 TabWidth: 8
492 UseTab: Always
493 ...