Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux
[platform/kernel/linux-rpi.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   - 'bitmap_for_each_clear_region'
90   - 'bitmap_for_each_set_region'
91   - 'blkg_for_each_descendant_post'
92   - 'blkg_for_each_descendant_pre'
93   - 'blk_queue_for_each_rl'
94   - 'bond_for_each_slave'
95   - 'bond_for_each_slave_rcu'
96   - 'bpf_for_each_spilled_reg'
97   - 'btree_for_each_safe128'
98   - 'btree_for_each_safe32'
99   - 'btree_for_each_safe64'
100   - 'btree_for_each_safel'
101   - 'card_for_each_dev'
102   - 'cgroup_taskset_for_each'
103   - 'cgroup_taskset_for_each_leader'
104   - 'cpufreq_for_each_entry'
105   - 'cpufreq_for_each_entry_idx'
106   - 'cpufreq_for_each_valid_entry'
107   - 'cpufreq_for_each_valid_entry_idx'
108   - 'css_for_each_child'
109   - 'css_for_each_descendant_post'
110   - 'css_for_each_descendant_pre'
111   - 'device_for_each_child_node'
112   - 'dma_fence_chain_for_each'
113   - 'drm_atomic_crtc_for_each_plane'
114   - 'drm_atomic_crtc_state_for_each_plane'
115   - 'drm_atomic_crtc_state_for_each_plane_state'
116   - 'drm_atomic_for_each_plane_damage'
117   - 'drm_client_for_each_connector_iter'
118   - 'drm_client_for_each_modeset'
119   - 'drm_connector_for_each_possible_encoder'
120   - 'drm_for_each_bridge_in_chain'
121   - 'drm_for_each_connector_iter'
122   - 'drm_for_each_crtc'
123   - 'drm_for_each_encoder'
124   - 'drm_for_each_encoder_mask'
125   - 'drm_for_each_fb'
126   - 'drm_for_each_legacy_plane'
127   - 'drm_for_each_plane'
128   - 'drm_for_each_plane_mask'
129   - 'drm_for_each_privobj'
130   - 'drm_mm_for_each_hole'
131   - 'drm_mm_for_each_node'
132   - 'drm_mm_for_each_node_in_range'
133   - 'drm_mm_for_each_node_safe'
134   - 'flow_action_for_each'
135   - 'for_each_active_dev_scope'
136   - 'for_each_active_drhd_unit'
137   - 'for_each_active_iommu'
138   - 'for_each_available_child_of_node'
139   - 'for_each_bio'
140   - 'for_each_board_func_rsrc'
141   - 'for_each_bvec'
142   - 'for_each_card_auxs'
143   - 'for_each_card_auxs_safe'
144   - 'for_each_card_components'
145   - 'for_each_card_dapms'
146   - 'for_each_card_pre_auxs'
147   - 'for_each_card_prelinks'
148   - 'for_each_card_rtds'
149   - 'for_each_card_rtds_safe'
150   - 'for_each_card_widgets'
151   - 'for_each_card_widgets_safe'
152   - 'for_each_cgroup_storage_type'
153   - 'for_each_child_of_node'
154   - 'for_each_clear_bit'
155   - 'for_each_clear_bit_from'
156   - 'for_each_cmsghdr'
157   - 'for_each_compatible_node'
158   - 'for_each_component_dais'
159   - 'for_each_component_dais_safe'
160   - 'for_each_comp_order'
161   - 'for_each_console'
162   - 'for_each_cpu'
163   - 'for_each_cpu_and'
164   - 'for_each_cpu_not'
165   - 'for_each_cpu_wrap'
166   - 'for_each_dapm_widgets'
167   - 'for_each_dev_addr'
168   - 'for_each_dev_scope'
169   - 'for_each_displayid_db'
170   - 'for_each_dma_cap_mask'
171   - 'for_each_dpcm_be'
172   - 'for_each_dpcm_be_rollback'
173   - 'for_each_dpcm_be_safe'
174   - 'for_each_dpcm_fe'
175   - 'for_each_drhd_unit'
176   - 'for_each_dss_dev'
177   - 'for_each_efi_memory_desc'
178   - 'for_each_efi_memory_desc_in_map'
179   - 'for_each_element'
180   - 'for_each_element_extid'
181   - 'for_each_element_id'
182   - 'for_each_endpoint_of_node'
183   - 'for_each_evictable_lru'
184   - 'for_each_fib6_node_rt_rcu'
185   - 'for_each_fib6_walker_rt'
186   - 'for_each_free_mem_pfn_range_in_zone'
187   - 'for_each_free_mem_pfn_range_in_zone_from'
188   - 'for_each_free_mem_range'
189   - 'for_each_free_mem_range_reverse'
190   - 'for_each_func_rsrc'
191   - 'for_each_hstate'
192   - 'for_each_if'
193   - 'for_each_iommu'
194   - 'for_each_ip_tunnel_rcu'
195   - 'for_each_irq_nr'
196   - 'for_each_link_codecs'
197   - 'for_each_link_cpus'
198   - 'for_each_link_platforms'
199   - 'for_each_lru'
200   - 'for_each_matching_node'
201   - 'for_each_matching_node_and_match'
202   - 'for_each_member'
203   - 'for_each_memblock'
204   - 'for_each_memblock_type'
205   - 'for_each_memcg_cache_index'
206   - 'for_each_mem_pfn_range'
207   - 'for_each_mem_range'
208   - 'for_each_mem_range_rev'
209   - 'for_each_migratetype_order'
210   - 'for_each_msi_entry'
211   - 'for_each_msi_entry_safe'
212   - 'for_each_net'
213   - 'for_each_net_continue_reverse'
214   - 'for_each_netdev'
215   - 'for_each_netdev_continue'
216   - 'for_each_netdev_continue_rcu'
217   - 'for_each_netdev_continue_reverse'
218   - 'for_each_netdev_feature'
219   - 'for_each_netdev_in_bond_rcu'
220   - 'for_each_netdev_rcu'
221   - 'for_each_netdev_reverse'
222   - 'for_each_netdev_safe'
223   - 'for_each_net_rcu'
224   - 'for_each_new_connector_in_state'
225   - 'for_each_new_crtc_in_state'
226   - 'for_each_new_mst_mgr_in_state'
227   - 'for_each_new_plane_in_state'
228   - 'for_each_new_private_obj_in_state'
229   - 'for_each_node'
230   - 'for_each_node_by_name'
231   - 'for_each_node_by_type'
232   - 'for_each_node_mask'
233   - 'for_each_node_state'
234   - 'for_each_node_with_cpus'
235   - 'for_each_node_with_property'
236   - 'for_each_of_allnodes'
237   - 'for_each_of_allnodes_from'
238   - 'for_each_of_cpu_node'
239   - 'for_each_of_pci_range'
240   - 'for_each_old_connector_in_state'
241   - 'for_each_old_crtc_in_state'
242   - 'for_each_old_mst_mgr_in_state'
243   - 'for_each_oldnew_connector_in_state'
244   - 'for_each_oldnew_crtc_in_state'
245   - 'for_each_oldnew_mst_mgr_in_state'
246   - 'for_each_oldnew_plane_in_state'
247   - 'for_each_oldnew_plane_in_state_reverse'
248   - 'for_each_oldnew_private_obj_in_state'
249   - 'for_each_old_plane_in_state'
250   - 'for_each_old_private_obj_in_state'
251   - 'for_each_online_cpu'
252   - 'for_each_online_node'
253   - 'for_each_online_pgdat'
254   - 'for_each_pci_bridge'
255   - 'for_each_pci_dev'
256   - 'for_each_pci_msi_entry'
257   - 'for_each_pcm_streams'
258   - 'for_each_populated_zone'
259   - 'for_each_possible_cpu'
260   - 'for_each_present_cpu'
261   - 'for_each_prime_number'
262   - 'for_each_prime_number_from'
263   - 'for_each_process'
264   - 'for_each_process_thread'
265   - 'for_each_property_of_node'
266   - 'for_each_registered_fb'
267   - 'for_each_reserved_mem_region'
268   - 'for_each_rtd_codec_dais'
269   - 'for_each_rtd_codec_dais_rollback'
270   - 'for_each_rtd_components'
271   - 'for_each_rtd_cpu_dais'
272   - 'for_each_rtd_cpu_dais_rollback'
273   - 'for_each_rtd_dais'
274   - 'for_each_set_bit'
275   - 'for_each_set_bit_from'
276   - 'for_each_set_clump8'
277   - 'for_each_sg'
278   - 'for_each_sg_dma_page'
279   - 'for_each_sg_page'
280   - 'for_each_sibling_event'
281   - 'for_each_subelement'
282   - 'for_each_subelement_extid'
283   - 'for_each_subelement_id'
284   - '__for_each_thread'
285   - 'for_each_thread'
286   - 'for_each_wakeup_source'
287   - 'for_each_zone'
288   - 'for_each_zone_zonelist'
289   - 'for_each_zone_zonelist_nodemask'
290   - 'fwnode_for_each_available_child_node'
291   - 'fwnode_for_each_child_node'
292   - 'fwnode_graph_for_each_endpoint'
293   - 'gadget_for_each_ep'
294   - 'genradix_for_each'
295   - 'genradix_for_each_from'
296   - 'hash_for_each'
297   - 'hash_for_each_possible'
298   - 'hash_for_each_possible_rcu'
299   - 'hash_for_each_possible_rcu_notrace'
300   - 'hash_for_each_possible_safe'
301   - 'hash_for_each_rcu'
302   - 'hash_for_each_safe'
303   - 'hctx_for_each_ctx'
304   - 'hlist_bl_for_each_entry'
305   - 'hlist_bl_for_each_entry_rcu'
306   - 'hlist_bl_for_each_entry_safe'
307   - 'hlist_for_each'
308   - 'hlist_for_each_entry'
309   - 'hlist_for_each_entry_continue'
310   - 'hlist_for_each_entry_continue_rcu'
311   - 'hlist_for_each_entry_continue_rcu_bh'
312   - 'hlist_for_each_entry_from'
313   - 'hlist_for_each_entry_from_rcu'
314   - 'hlist_for_each_entry_rcu'
315   - 'hlist_for_each_entry_rcu_bh'
316   - 'hlist_for_each_entry_rcu_notrace'
317   - 'hlist_for_each_entry_safe'
318   - '__hlist_for_each_rcu'
319   - 'hlist_for_each_safe'
320   - 'hlist_nulls_for_each_entry'
321   - 'hlist_nulls_for_each_entry_from'
322   - 'hlist_nulls_for_each_entry_rcu'
323   - 'hlist_nulls_for_each_entry_safe'
324   - 'i3c_bus_for_each_i2cdev'
325   - 'i3c_bus_for_each_i3cdev'
326   - 'ide_host_for_each_port'
327   - 'ide_port_for_each_dev'
328   - 'ide_port_for_each_present_dev'
329   - 'idr_for_each_entry'
330   - 'idr_for_each_entry_continue'
331   - 'idr_for_each_entry_continue_ul'
332   - 'idr_for_each_entry_ul'
333   - 'in_dev_for_each_ifa_rcu'
334   - 'in_dev_for_each_ifa_rtnl'
335   - 'inet_bind_bucket_for_each'
336   - 'inet_lhash2_for_each_icsk_rcu'
337   - 'key_for_each'
338   - 'key_for_each_safe'
339   - 'klp_for_each_func'
340   - 'klp_for_each_func_safe'
341   - 'klp_for_each_func_static'
342   - 'klp_for_each_object'
343   - 'klp_for_each_object_safe'
344   - 'klp_for_each_object_static'
345   - 'kunit_suite_for_each_test_case'
346   - 'kvm_for_each_memslot'
347   - 'kvm_for_each_vcpu'
348   - 'list_for_each'
349   - 'list_for_each_codec'
350   - 'list_for_each_codec_safe'
351   - 'list_for_each_continue'
352   - 'list_for_each_entry'
353   - 'list_for_each_entry_continue'
354   - 'list_for_each_entry_continue_rcu'
355   - 'list_for_each_entry_continue_reverse'
356   - 'list_for_each_entry_from'
357   - 'list_for_each_entry_from_rcu'
358   - 'list_for_each_entry_from_reverse'
359   - 'list_for_each_entry_lockless'
360   - 'list_for_each_entry_rcu'
361   - 'list_for_each_entry_reverse'
362   - 'list_for_each_entry_safe'
363   - 'list_for_each_entry_safe_continue'
364   - 'list_for_each_entry_safe_from'
365   - 'list_for_each_entry_safe_reverse'
366   - 'list_for_each_prev'
367   - 'list_for_each_prev_safe'
368   - 'list_for_each_safe'
369   - 'llist_for_each'
370   - 'llist_for_each_entry'
371   - 'llist_for_each_entry_safe'
372   - 'llist_for_each_safe'
373   - 'mci_for_each_dimm'
374   - 'media_device_for_each_entity'
375   - 'media_device_for_each_intf'
376   - 'media_device_for_each_link'
377   - 'media_device_for_each_pad'
378   - 'nanddev_io_for_each_page'
379   - 'netdev_for_each_lower_dev'
380   - 'netdev_for_each_lower_private'
381   - 'netdev_for_each_lower_private_rcu'
382   - 'netdev_for_each_mc_addr'
383   - 'netdev_for_each_uc_addr'
384   - 'netdev_for_each_upper_dev_rcu'
385   - 'netdev_hw_addr_list_for_each'
386   - 'nft_rule_for_each_expr'
387   - 'nla_for_each_attr'
388   - 'nla_for_each_nested'
389   - 'nlmsg_for_each_attr'
390   - 'nlmsg_for_each_msg'
391   - 'nr_neigh_for_each'
392   - 'nr_neigh_for_each_safe'
393   - 'nr_node_for_each'
394   - 'nr_node_for_each_safe'
395   - 'of_for_each_phandle'
396   - 'of_property_for_each_string'
397   - 'of_property_for_each_u32'
398   - 'pci_bus_for_each_resource'
399   - 'pcm_for_each_format'
400   - 'ping_portaddr_for_each_entry'
401   - 'plist_for_each'
402   - 'plist_for_each_continue'
403   - 'plist_for_each_entry'
404   - 'plist_for_each_entry_continue'
405   - 'plist_for_each_entry_safe'
406   - 'plist_for_each_safe'
407   - 'pnp_for_each_card'
408   - 'pnp_for_each_dev'
409   - 'protocol_for_each_card'
410   - 'protocol_for_each_dev'
411   - 'queue_for_each_hw_ctx'
412   - 'radix_tree_for_each_slot'
413   - 'radix_tree_for_each_tagged'
414   - 'rbtree_postorder_for_each_entry_safe'
415   - 'rdma_for_each_block'
416   - 'rdma_for_each_port'
417   - 'resource_list_for_each_entry'
418   - 'resource_list_for_each_entry_safe'
419   - 'rhl_for_each_entry_rcu'
420   - 'rhl_for_each_rcu'
421   - 'rht_for_each'
422   - 'rht_for_each_entry'
423   - 'rht_for_each_entry_from'
424   - 'rht_for_each_entry_rcu'
425   - 'rht_for_each_entry_rcu_from'
426   - 'rht_for_each_entry_safe'
427   - 'rht_for_each_from'
428   - 'rht_for_each_rcu'
429   - 'rht_for_each_rcu_from'
430   - '__rq_for_each_bio'
431   - 'rq_for_each_bvec'
432   - 'rq_for_each_segment'
433   - 'scsi_for_each_prot_sg'
434   - 'scsi_for_each_sg'
435   - 'sctp_for_each_hentry'
436   - 'sctp_skb_for_each'
437   - 'shdma_for_each_chan'
438   - '__shost_for_each_device'
439   - 'shost_for_each_device'
440   - 'sk_for_each'
441   - 'sk_for_each_bound'
442   - 'sk_for_each_entry_offset_rcu'
443   - 'sk_for_each_from'
444   - 'sk_for_each_rcu'
445   - 'sk_for_each_safe'
446   - 'sk_nulls_for_each'
447   - 'sk_nulls_for_each_from'
448   - 'sk_nulls_for_each_rcu'
449   - 'snd_array_for_each'
450   - 'snd_pcm_group_for_each_entry'
451   - 'snd_soc_dapm_widget_for_each_path'
452   - 'snd_soc_dapm_widget_for_each_path_safe'
453   - 'snd_soc_dapm_widget_for_each_sink_path'
454   - 'snd_soc_dapm_widget_for_each_source_path'
455   - 'tb_property_for_each'
456   - 'tcf_exts_for_each_action'
457   - 'udp_portaddr_for_each_entry'
458   - 'udp_portaddr_for_each_entry_rcu'
459   - 'usb_hub_for_each_child'
460   - 'v4l2_device_for_each_subdev'
461   - 'v4l2_m2m_for_each_dst_buf'
462   - 'v4l2_m2m_for_each_dst_buf_safe'
463   - 'v4l2_m2m_for_each_src_buf'
464   - 'v4l2_m2m_for_each_src_buf_safe'
465   - 'virtio_device_for_each_vq'
466   - 'xa_for_each'
467   - 'xa_for_each_marked'
468   - 'xa_for_each_range'
469   - 'xa_for_each_start'
470   - 'xas_for_each'
471   - 'xas_for_each_conflict'
472   - 'xas_for_each_marked'
473   - 'xbc_array_for_each_value'
474   - 'xbc_for_each_key_value'
475   - 'xbc_node_for_each_array_value'
476   - 'xbc_node_for_each_child'
477   - 'xbc_node_for_each_key_value'
478   - 'zorro_for_each_dev'
479
480 #IncludeBlocks: Preserve # Unknown to clang-format-5.0
481 IncludeCategories:
482   - Regex: '.*'
483     Priority: 1
484 IncludeIsMainRegex: '(Test)?$'
485 IndentCaseLabels: false
486 #IndentPPDirectives: None # Unknown to clang-format-5.0
487 IndentWidth: 8
488 IndentWrappedFunctionNames: false
489 JavaScriptQuotes: Leave
490 JavaScriptWrapImports: true
491 KeepEmptyLinesAtTheStartOfBlocks: false
492 MacroBlockBegin: ''
493 MacroBlockEnd: ''
494 MaxEmptyLinesToKeep: 1
495 NamespaceIndentation: None
496 #ObjCBinPackProtocolList: Auto # Unknown to clang-format-5.0
497 ObjCBlockIndentWidth: 8
498 ObjCSpaceAfterProperty: true
499 ObjCSpaceBeforeProtocolList: true
500
501 # Taken from git's rules
502 #PenaltyBreakAssignment: 10 # Unknown to clang-format-4.0
503 PenaltyBreakBeforeFirstCallParameter: 30
504 PenaltyBreakComment: 10
505 PenaltyBreakFirstLessLess: 0
506 PenaltyBreakString: 10
507 PenaltyExcessCharacter: 100
508 PenaltyReturnTypeOnItsOwnLine: 60
509
510 PointerAlignment: Right
511 ReflowComments: false
512 SortIncludes: false
513 #SortUsingDeclarations: false # Unknown to clang-format-4.0
514 SpaceAfterCStyleCast: false
515 SpaceAfterTemplateKeyword: true
516 SpaceBeforeAssignmentOperators: true
517 #SpaceBeforeCtorInitializerColon: true # Unknown to clang-format-5.0
518 #SpaceBeforeInheritanceColon: true # Unknown to clang-format-5.0
519 SpaceBeforeParens: ControlStatements
520 #SpaceBeforeRangeBasedForLoopColon: true # Unknown to clang-format-5.0
521 SpaceInEmptyParentheses: false
522 SpacesBeforeTrailingComments: 1
523 SpacesInAngles: false
524 SpacesInContainerLiterals: false
525 SpacesInCStyleCastParentheses: false
526 SpacesInParentheses: false
527 SpacesInSquareBrackets: false
528 Standard: Cpp03
529 TabWidth: 8
530 UseTab: Always
531 ...