All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] thunderbolt (gcc13): synchronize tb_port_is_clx_enabled()'s 2nd param
@ 2022-10-31 11:43 Jiri Slaby (SUSE)
  2022-10-31 12:20 ` Mika Westerberg
  0 siblings, 1 reply; 2+ messages in thread
From: Jiri Slaby (SUSE) @ 2022-10-31 11:43 UTC (permalink / raw)
  To: andreas.noever
  Cc: linux-kernel, Jiri Slaby (SUSE),
	Martin Liska, Michael Jamet, Mika Westerberg, Yehezkel Bernat,
	linux-usb

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 <mliska@suse.cz>
Cc: Andreas Noever <andreas.noever@gmail.com>
Cc: Michael Jamet <michael.jamet@intel.com>
Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: Yehezkel Bernat <YehezkelShB@gmail.com>
Cc: linux-usb@vger.kernel.org
Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
---
 drivers/thunderbolt/switch.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/thunderbolt/switch.c b/drivers/thunderbolt/switch.c
index 363d712aa364..3693395253bb 100644
--- a/drivers/thunderbolt/switch.c
+++ b/drivers/thunderbolt/switch.c
@@ -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;
-- 
2.38.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] thunderbolt (gcc13): synchronize tb_port_is_clx_enabled()'s 2nd param
  2022-10-31 11:43 [PATCH] thunderbolt (gcc13): synchronize tb_port_is_clx_enabled()'s 2nd param Jiri Slaby (SUSE)
@ 2022-10-31 12:20 ` Mika Westerberg
  0 siblings, 0 replies; 2+ messages in thread
From: Mika Westerberg @ 2022-10-31 12:20 UTC (permalink / raw)
  To: Jiri Slaby (SUSE)
  Cc: andreas.noever, linux-kernel, Martin Liska, Michael Jamet,
	Yehezkel Bernat, linux-usb

Hi,

On Mon, Oct 31, 2022 at 12:43:23PM +0100, Jiri Slaby (SUSE) wrote:
> 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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-10-31 12:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-31 11:43 [PATCH] thunderbolt (gcc13): synchronize tb_port_is_clx_enabled()'s 2nd param Jiri Slaby (SUSE)
2022-10-31 12:20 ` Mika Westerberg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.