Skip to contentSkip to conversation

thunderbolt (gcc13): synchronize tb_port_is_clx_enabled()'s 2nd param

PATCH Superseded Jiri Slaby (SUSE) 2 participants 2 messages Oct 31, 2022

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 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 latter. And do the same for tb_port_clx_supported() where the enum is propagated.

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]>
---
 drivers/thunderbolt/switch.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/thunderbolt/switch.c +2 -2
index 363d712aa364..3693395253bb 100644
@@ -1205,7 +1205,7 @@ static int tb_port_pm_secondary_disable(struct tb_port *port)
 }
 
 /* Called for USB4 or Titan Ridge routers only */
-static bool tb_port_clx_supported(struct tb_port *port, unsigned int clx_mask)
+static bool tb_port_clx_supported(struct tb_port *port, enum tb_clx clx_mask)
 {
 	u32 val, mask = 0;
 	bool ret;
@@ -1283,7 +1283,7 @@ static int tb_port_clx_enable(struct tb_port *port, enum tb_clx clx)
  *
  * Returns true if any of the given CL states is enabled for @port.
  */
-bool tb_port_is_clx_enabled(struct tb_port *port, unsigned int clx_mask)
+bool tb_port_is_clx_enabled(struct tb_port *port, enum tb_clx clx_mask)
 {
 	u32 val, mask = 0;
 	int ret;
Signature · 1 line
2.38.1
#1 lore raw

Hi,

Quoted 8 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 enum tb_clx. Synchronize them to the latter. And do the same for tb_port_clx_supported() where the enum is propagated.

Actually in both places we want to have bitmask of possible states so I think unsigned int is the right one here.