thunderbolt (gcc13): synchronize tb_port_is_clx_enabled()'s 2nd param
Subsystems (2)
PATCH v2 1/1 thunderbolt (gcc13): synchronize tb_port_is_clx_enabled()'s 2nd param
tb_port_is_clx_enabled() generates a valid warning with gcc-13:
drivers/thunderbolt/switch.c:1286:6: error: conflicting types for 'tb_port_is_clx_enabled' due to enum/integer mismatch; have 'bool(struct tb_port *, unsigned int)' ... drivers/thunderbolt/tb.h:1050:6: note: previous declaration of 'tb_port_is_clx_enabled' with type 'bool(struct tb_port *, enum tb_clx)' ...
I.e. the type of the 2nd parameter of tb_port_is_clx_enabled() in the declaration is unsigned int, while the definition spells enum tb_clx. Synchronize them to the former as the parameter is in fact a mask of the enum values.
---
Notes:
[v2] switch to uint instead of to enum
drivers/thunderbolt/tb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/thunderbolt/tb.h +1 -1
@@ -1047,7 +1047,7 @@ void tb_port_lane_bonding_disable(struct tb_port *port);int tb_port_wait_for_link_width (struct tb_port *port,int width,int timeout_msec);int tb_port_update_credits (struct tb_port *port); -bool tb_port_is_clx_enabled (struct tb_port *port,enum tb_clx clx); +bool tb_port_is_clx_enabled (struct tb_port *port,unsigned int clx);int tb_switch_find_vse_cap (struct tb_switch *sw,enum tb_switch_vse_cap vsec);int tb_switch_find_cap (struct tb_switch *sw,enum tb_switch_cap cap);
Signature · 1 line
2.38.1
Hi,
Quoted 9 lines · Jiri Slaby (SUSE)
tb_port_is_clx_enabled()generates a valid warning with gcc-13:
drivers/thunderbolt/switch.c:1286:6: error: conflicting types for 'tb_port_is_clx_enabled' due to enum/integer mismatch; have 'bool(struct tb_port *, unsigned int)' ...drivers/thunderbolt/tb.h:1050:6: note: previous declaration of 'tb_port_is_clx_enabled' with type 'bool(struct tb_port *, enum tb_clx)' ...I.e. the type of the 2nd parameter of
tb_port_is_clx_enabled()in the declaration is unsigned int, while the definition spells enumtb_clx. Synchronize them to the former as the parameter is in fact a mask of the enum values.
Quoted 7 lines
Cc Martin Liska <[email protected]>Cc Andreas Noever <[email protected]>Cc Michael Jamet <[email protected]>Cc Mika Westerberg <[email protected]>Cc Yehezkel Bernat <[email protected]>Signed-off-by Jiri Slaby (SUSE) <[email protected]>
Looks good now. I will pick this up after the merge window closes. Thanks!
Quoted 9 lines · Jiri Slaby (SUSE)
tb_port_is_clx_enabled()generates a valid warning with gcc-13:
drivers/thunderbolt/switch.c:1286:6: error: conflicting types for 'tb_port_is_clx_enabled' due to enum/integer mismatch; have 'bool(struct tb_port *, unsigned int)' ...drivers/thunderbolt/tb.h:1050:6: note: previous declaration of 'tb_port_is_clx_enabled' with type 'bool(struct tb_port *, enum tb_clx)' ...I.e. the type of the 2nd parameter of
tb_port_is_clx_enabled()in the declaration is unsigned int, while the definition spells enumtb_clx. Synchronize them to the former as the parameter is in fact a mask of the enum values.
Quoted 7 lines
Cc Martin Liska <[email protected]>Cc Andreas Noever <[email protected]>Cc Michael Jamet <[email protected]>Cc Mika Westerberg <[email protected]>Cc Yehezkel Bernat <[email protected]>Signed-off-by Jiri Slaby (SUSE) <[email protected]>
Applied now, thanks!
I changed the title slightly to avoid words like "synchronize" because that makes me think this is fixing a race condition somewhere but in fact this is simply fixing a function prototope to match the definition :)