[PATCH] clang-format: Update with v6.11-rc1's `for_each` macro list

Javier Carrasco posted 1 patch 1 year, 4 months ago
There is a newer version of this series
.clang-format | 38 ++++++++++++++++++++++++++++++--------
1 file changed, 30 insertions(+), 8 deletions(-)
[PATCH] clang-format: Update with v6.11-rc1's `for_each` macro list
Posted by Javier Carrasco 1 year, 4 months ago
Re-run the shell fragment that generated the original list.

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
---
Note that commit 4792f9dd1293 ("clang-format: Update with the latest
for_each macro list") added the macro `displayid_iter_for_each`, which
is not part of include/ and tools/ (it is defined in
drivers/gpu/drm/drm_displayid_internal.h), and the shell fragment used
to update the list will drop it. In order to keep the macro on the list,
manual intervention will always be required.
---
 .clang-format | 38 ++++++++++++++++++++++++++++++--------
 1 file changed, 30 insertions(+), 8 deletions(-)

diff --git a/.clang-format b/.clang-format
index 252820d9c80a..95b6d333b6e1 100644
--- a/.clang-format
+++ b/.clang-format
@@ -141,11 +141,14 @@ ForEachMacros:
   - 'damon_for_each_target_safe'
   - 'damos_for_each_filter'
   - 'damos_for_each_filter_safe'
+  - 'damos_for_each_quota_goal'
+  - 'damos_for_each_quota_goal_safe'
   - 'data__for_each_file'
   - 'data__for_each_file_new'
   - 'data__for_each_file_start'
   - 'device_for_each_child_node'
   - 'displayid_iter_for_each'
+  - 'device_for_each_child_node_scoped'
   - 'dma_fence_array_for_each'
   - 'dma_fence_chain_for_each'
   - 'dma_fence_unwrap_for_each'
@@ -172,11 +175,14 @@ ForEachMacros:
   - 'drm_for_each_plane'
   - 'drm_for_each_plane_mask'
   - 'drm_for_each_privobj'
-  - 'drm_gem_for_each_gpuva'
-  - 'drm_gem_for_each_gpuva_safe'
+  - 'drm_gem_for_each_gpuvm_bo'
+  - 'drm_gem_for_each_gpuvm_bo_safe'
   - 'drm_gpuva_for_each_op'
   - 'drm_gpuva_for_each_op_from_reverse'
+  - 'drm_gpuva_for_each_op_reverse'
   - 'drm_gpuva_for_each_op_safe'
+  - 'drm_gpuvm_bo_for_each_va'
+  - 'drm_gpuvm_bo_for_each_va_safe'
   - 'drm_gpuvm_for_each_va'
   - 'drm_gpuvm_for_each_va_range'
   - 'drm_gpuvm_for_each_va_range_safe'
@@ -192,11 +198,11 @@ ForEachMacros:
   - 'dsa_switch_for_each_port_continue_reverse'
   - 'dsa_switch_for_each_port_safe'
   - 'dsa_switch_for_each_user_port'
+  - 'dsa_switch_for_each_user_port_continue_reverse'
   - 'dsa_tree_for_each_cpu_port'
   - 'dsa_tree_for_each_user_port'
   - 'dsa_tree_for_each_user_port_continue_reverse'
   - 'dso__for_each_symbol'
-  - 'dsos__for_each_with_build_id'
   - 'elf_hash_for_each_possible'
   - 'elf_symtab__for_each_symbol'
   - 'evlist__for_each_cpu'
@@ -216,6 +222,7 @@ ForEachMacros:
   - 'for_each_and_bit'
   - 'for_each_andnot_bit'
   - 'for_each_available_child_of_node'
+  - 'for_each_available_child_of_node_scoped'
   - 'for_each_bench'
   - 'for_each_bio'
   - 'for_each_board_func_rsrc'
@@ -234,6 +241,7 @@ ForEachMacros:
   - 'for_each_card_widgets_safe'
   - 'for_each_cgroup_storage_type'
   - 'for_each_child_of_node'
+  - 'for_each_child_of_node_scoped'
   - 'for_each_clear_bit'
   - 'for_each_clear_bit_from'
   - 'for_each_clear_bitrange'
@@ -251,6 +259,7 @@ ForEachMacros:
   - 'for_each_cpu'
   - 'for_each_cpu_and'
   - 'for_each_cpu_andnot'
+  - 'for_each_cpu_from'
   - 'for_each_cpu_or'
   - 'for_each_cpu_wrap'
   - 'for_each_dapm_widgets'
@@ -269,13 +278,14 @@ ForEachMacros:
   - 'for_each_element'
   - 'for_each_element_extid'
   - 'for_each_element_id'
+  - 'for_each_enabled_cpu'
   - 'for_each_endpoint_of_node'
   - 'for_each_event'
   - 'for_each_event_tps'
   - 'for_each_evictable_lru'
   - 'for_each_fib6_node_rt_rcu'
   - 'for_each_fib6_walker_rt'
-  - 'for_each_free_mem_pfn_range_in_zone'
+  - 'for_each_file_lock'
   - 'for_each_free_mem_pfn_range_in_zone_from'
   - 'for_each_free_mem_range'
   - 'for_each_free_mem_range_reverse'
@@ -286,15 +296,18 @@ ForEachMacros:
   - 'for_each_group_member'
   - 'for_each_group_member_head'
   - 'for_each_hstate'
+  - 'for_each_hwgpio'
   - 'for_each_if'
   - 'for_each_inject_fn'
   - 'for_each_insn'
+  - 'for_each_insn_op_loc'
   - 'for_each_insn_prefix'
   - 'for_each_intid'
   - 'for_each_iommu'
   - 'for_each_ip_tunnel_rcu'
   - 'for_each_irq_nr'
   - 'for_each_lang'
+  - 'for_each_link_ch_maps'
   - 'for_each_link_codecs'
   - 'for_each_link_cpus'
   - 'for_each_link_platforms'
@@ -332,6 +345,9 @@ ForEachMacros:
   - 'for_each_new_plane_in_state_reverse'
   - 'for_each_new_private_obj_in_state'
   - 'for_each_new_reg'
+  - 'for_each_nhlt_endpoint'
+  - 'for_each_nhlt_endpoint_fmtcfg'
+  - 'for_each_nhlt_fmtcfg'
   - 'for_each_node'
   - 'for_each_node_by_name'
   - 'for_each_node_by_type'
@@ -387,12 +403,15 @@ ForEachMacros:
   - 'for_each_reloc_from'
   - 'for_each_requested_gpio'
   - 'for_each_requested_gpio_in_range'
+  - 'for_each_reserved_child_of_node'
   - 'for_each_reserved_mem_range'
   - 'for_each_reserved_mem_region'
+  - 'for_each_rtd_ch_maps'
   - 'for_each_rtd_codec_dais'
   - 'for_each_rtd_components'
   - 'for_each_rtd_cpu_dais'
   - 'for_each_rtd_dais'
+  - 'for_each_rtd_dais_reverse'
   - 'for_each_sband_iftype_data'
   - 'for_each_script'
   - 'for_each_sec'
@@ -533,8 +552,6 @@ ForEachMacros:
   - 'lwq_for_each_safe'
   - 'map__for_each_symbol'
   - 'map__for_each_symbol_by_name'
-  - 'maps__for_each_entry'
-  - 'maps__for_each_entry_safe'
   - 'mas_for_each'
   - 'mci_for_each_dimm'
   - 'media_device_for_each_entity'
@@ -560,7 +577,9 @@ ForEachMacros:
   - 'netdev_hw_addr_list_for_each'
   - 'nft_rule_for_each_expr'
   - 'nla_for_each_attr'
+  - 'nla_for_each_attr_type'
   - 'nla_for_each_nested'
+  - 'nla_for_each_nested_type'
   - 'nlmsg_for_each_attr'
   - 'nlmsg_for_each_msg'
   - 'nr_neigh_for_each'
@@ -579,6 +598,7 @@ ForEachMacros:
   - 'perf_config_sections__for_each_entry'
   - 'perf_config_set__for_each_entry'
   - 'perf_cpu_map__for_each_cpu'
+  - 'perf_cpu_map__for_each_cpu_skip_any'
   - 'perf_cpu_map__for_each_idx'
   - 'perf_evlist__for_each_entry'
   - 'perf_evlist__for_each_entry_reverse'
@@ -639,7 +659,6 @@ ForEachMacros:
   - 'shost_for_each_device'
   - 'sk_for_each'
   - 'sk_for_each_bound'
-  - 'sk_for_each_bound_bhash2'
   - 'sk_for_each_entry_offset_rcu'
   - 'sk_for_each_from'
   - 'sk_for_each_rcu'
@@ -653,6 +672,7 @@ ForEachMacros:
   - 'snd_soc_dapm_widget_for_each_path_safe'
   - 'snd_soc_dapm_widget_for_each_sink_path'
   - 'snd_soc_dapm_widget_for_each_source_path'
+  - 'sparsebit_for_each_set_range'
   - 'strlist__for_each_entry'
   - 'strlist__for_each_entry_safe'
   - 'sym_for_each_insn'
@@ -662,7 +682,6 @@ ForEachMacros:
   - 'tcf_act_for_each_action'
   - 'tcf_exts_for_each_action'
   - 'ttm_resource_manager_for_each_res'
-  - 'twsk_for_each_bound_bhash2'
   - 'udp_portaddr_for_each_entry'
   - 'udp_portaddr_for_each_entry_rcu'
   - 'usb_hub_for_each_child'
@@ -686,6 +705,9 @@ ForEachMacros:
   - 'xbc_node_for_each_child'
   - 'xbc_node_for_each_key_value'
   - 'xbc_node_for_each_subkey'
+  - 'ynl_attr_for_each'
+  - 'ynl_attr_for_each_nested'
+  - 'ynl_attr_for_each_payload'
   - 'zorro_for_each_dev'
 
 IncludeBlocks: Preserve

---
base-commit: 8400291e289ee6b2bf9779ff1c83a291501f017b
change-id: 20240729-clang-format-for-each-macro-update-604ee79ca29a

Best regards,
-- 
Javier Carrasco <javier.carrasco.cruz@gmail.com>
Re: [PATCH] clang-format: Update with v6.11-rc1's `for_each` macro list
Posted by Miguel Ojeda 1 year, 4 months ago
Hi Javier,

On Mon, Jul 29, 2024 at 9:56 PM Javier Carrasco
<javier.carrasco.cruz@gmail.com> wrote:
>
> Note that commit 4792f9dd1293 ("clang-format: Update with the latest
> for_each macro list") added the macro `displayid_iter_for_each`, which
> is not part of include/ and tools/ (it is defined in
> drivers/gpu/drm/drm_displayid_internal.h), and the shell fragment used
> to update the list will drop it. In order to keep the macro on the list,
> manual intervention will always be required.

Thanks for the patch!

That macro was inside `include/` back then, so now it should be
removed from the list.

Of course, if we want to include internal headers, that is also an
option to be discussed, but we should be consistent either way.

Cheers,
Miguel
Re: [PATCH] clang-format: Update with v6.11-rc1's `for_each` macro list
Posted by Javier Carrasco 1 year, 4 months ago
On 29/07/2024 22:14, Miguel Ojeda wrote:
> Hi Javier,
> 
> On Mon, Jul 29, 2024 at 9:56 PM Javier Carrasco
> <javier.carrasco.cruz@gmail.com> wrote:
>>
>> Note that commit 4792f9dd1293 ("clang-format: Update with the latest
>> for_each macro list") added the macro `displayid_iter_for_each`, which
>> is not part of include/ and tools/ (it is defined in
>> drivers/gpu/drm/drm_displayid_internal.h), and the shell fragment used
>> to update the list will drop it. In order to keep the macro on the list,
>> manual intervention will always be required.
> 
> Thanks for the patch!
> 
> That macro was inside `include/` back then, so now it should be
> removed from the list.
> 
> Of course, if we want to include internal headers, that is also an
> option to be discussed, but we should be consistent either way.
> 
> Cheers,
> Miguel


A quick test threw 326 extra macros that are defined in internal headers
under drivers/ and arch/. Including internal headers would remove the
need to update the list if a macro is moved from inlcude/ to an internal
header, but the list will need to be updated much more often.

Best regards,
Javier Carrasco
Re: [PATCH] clang-format: Update with v6.11-rc1's `for_each` macro list
Posted by Miguel Ojeda 1 year, 4 months ago
On Mon, Jul 29, 2024 at 11:39 PM Javier Carrasco
<javier.carrasco.cruz@gmail.com> wrote:
>
> A quick test threw 326 extra macros that are defined in internal headers
> under drivers/ and arch/. Including internal headers would remove the
> need to update the list if a macro is moved from inlcude/ to an internal
> header, but the list will need to be updated much more often.

There would be more changes in each iteration (which is why we avoided
scanning everything in the beginning), but currently it is
best-effort. If nowadays there are subsystems that want to start
considering soft-enforcing `clang-format` and that is why they need
them updated as soon as possible, then we should discuss other
alternatives (please let me know if that is the case!).

For instance, we could try to somehow divide the list into individual
subsystems, so that they control it and can perform the updates at the
same time in their commits as needed.

Anyway, for the time being, we should avoid editing the list "manually".

Cheers,
Miguel
Re: [PATCH] clang-format: Update with v6.11-rc1's `for_each` macro list
Posted by Javier Carrasco 1 year, 4 months ago
On 29/07/2024 23:55, Miguel Ojeda wrote:
> On Mon, Jul 29, 2024 at 11:39 PM Javier Carrasco
> <javier.carrasco.cruz@gmail.com> wrote:
>>
>> A quick test threw 326 extra macros that are defined in internal headers
>> under drivers/ and arch/. Including internal headers would remove the
>> need to update the list if a macro is moved from inlcude/ to an internal
>> header, but the list will need to be updated much more often.
> 
> There would be more changes in each iteration (which is why we avoided
> scanning everything in the beginning), but currently it is
> best-effort. If nowadays there are subsystems that want to start
> considering soft-enforcing `clang-format` and that is why they need
> them updated as soon as possible, then we should discuss other
> alternatives (please let me know if that is the case!).
> 
> For instance, we could try to somehow divide the list into individual
> subsystems, so that they control it and can perform the updates at the
> same time in their commits as needed.
> 
> Anyway, for the time being, we should avoid editing the list "manually".
> 
> Cheers,
> Miguel

That is not my particular case, I just wanted to add some macros that
reside under include/ (in particular, the _scoped macros).

Given that no one came with a need for macros defined in internal
headers, I will just drop `displayid_iter_for_each` for v2.

Best regards,
Javier Carrasco