netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: liquidio: fix clang-specific W=1 build warnings
@ 2024-01-11 16:24 Dmitry Antipov
  2024-01-12 19:26 ` Simon Horman
  2024-01-13  2:20 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Dmitry Antipov @ 2024-01-11 16:24 UTC (permalink / raw)
  To: Derek Chickles; +Cc: Jakub Kicinski, netdev, Dmitry Antipov

When compiling with clang-18 and W=1, I've noticed the following
warnings:

drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.c:1493:16: warning: cast
from 'void (*)(struct octeon_device *, struct octeon_mbox_cmd *, void *)' to
'octeon_mbox_callback_t' (aka 'void (*)(void *, void *, void *)') converts to
incompatible function type [-Wcast-function-type-strict]
 1493 |         mbox_cmd.fn = (octeon_mbox_callback_t)cn23xx_get_vf_stats_callback;
      |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

and:

drivers/net/ethernet/cavium/liquidio/cn23xx_vf_device.c:432:16: warning: cast
from 'void (*)(struct octeon_device *, struct octeon_mbox_cmd *, void *)' to
'octeon_mbox_callback_t' (aka 'void (*)(void *, void *, void *)') converts to
incompatible function type [-Wcast-function-type-strict]
  432 |         mbox_cmd.fn = (octeon_mbox_callback_t)octeon_pfvf_hs_callback;
      |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Fix both of the above by adjusting 'octeon_mbox_callback_t' to match actual
callback definitions (at the cost of adding an extra forward declaration).

Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
---
 drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.c | 2 +-
 drivers/net/ethernet/cavium/liquidio/cn23xx_vf_device.c | 2 +-
 drivers/net/ethernet/cavium/liquidio/octeon_mailbox.h   | 5 ++++-
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.c b/drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.c
index 068ed52b66c9..b3c81a2e9d46 100644
--- a/drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.c
+++ b/drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.c
@@ -1490,7 +1490,7 @@ int cn23xx_get_vf_stats(struct octeon_device *oct, int vfidx,
 	mbox_cmd.q_no = vfidx * oct->sriov_info.rings_per_vf;
 	mbox_cmd.recv_len = 0;
 	mbox_cmd.recv_status = 0;
-	mbox_cmd.fn = (octeon_mbox_callback_t)cn23xx_get_vf_stats_callback;
+	mbox_cmd.fn = cn23xx_get_vf_stats_callback;
 	ctx.stats = stats;
 	atomic_set(&ctx.status, 0);
 	mbox_cmd.fn_arg = (void *)&ctx;
diff --git a/drivers/net/ethernet/cavium/liquidio/cn23xx_vf_device.c b/drivers/net/ethernet/cavium/liquidio/cn23xx_vf_device.c
index dd5d80fee24f..d2fcb3da484e 100644
--- a/drivers/net/ethernet/cavium/liquidio/cn23xx_vf_device.c
+++ b/drivers/net/ethernet/cavium/liquidio/cn23xx_vf_device.c
@@ -429,7 +429,7 @@ int cn23xx_octeon_pfvf_handshake(struct octeon_device *oct)
 	mbox_cmd.q_no = 0;
 	mbox_cmd.recv_len = 0;
 	mbox_cmd.recv_status = 0;
-	mbox_cmd.fn = (octeon_mbox_callback_t)octeon_pfvf_hs_callback;
+	mbox_cmd.fn = octeon_pfvf_hs_callback;
 	mbox_cmd.fn_arg = &status;
 
 	octeon_mbox_write(oct, &mbox_cmd);
diff --git a/drivers/net/ethernet/cavium/liquidio/octeon_mailbox.h b/drivers/net/ethernet/cavium/liquidio/octeon_mailbox.h
index d92bd7e16477..9ac85d22c615 100644
--- a/drivers/net/ethernet/cavium/liquidio/octeon_mailbox.h
+++ b/drivers/net/ethernet/cavium/liquidio/octeon_mailbox.h
@@ -57,7 +57,10 @@ union octeon_mbox_message {
 	} s;
 };
 
-typedef void (*octeon_mbox_callback_t)(void *, void *, void *);
+struct octeon_mbox_cmd;
+
+typedef void (*octeon_mbox_callback_t)(struct octeon_device *,
+				       struct octeon_mbox_cmd *, void *);
 
 struct octeon_mbox_cmd {
 	union octeon_mbox_message msg;
-- 
2.43.0


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

* Re: [PATCH] net: liquidio: fix clang-specific W=1 build warnings
  2024-01-11 16:24 [PATCH] net: liquidio: fix clang-specific W=1 build warnings Dmitry Antipov
@ 2024-01-12 19:26 ` Simon Horman
  2024-01-13  2:20 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2024-01-12 19:26 UTC (permalink / raw)
  To: Dmitry Antipov; +Cc: Derek Chickles, Jakub Kicinski, netdev

On Thu, Jan 11, 2024 at 07:24:29PM +0300, Dmitry Antipov wrote:
> When compiling with clang-18 and W=1, I've noticed the following
> warnings:
> 
> drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.c:1493:16: warning: cast
> from 'void (*)(struct octeon_device *, struct octeon_mbox_cmd *, void *)' to
> 'octeon_mbox_callback_t' (aka 'void (*)(void *, void *, void *)') converts to
> incompatible function type [-Wcast-function-type-strict]
>  1493 |         mbox_cmd.fn = (octeon_mbox_callback_t)cn23xx_get_vf_stats_callback;
>       |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> and:
> 
> drivers/net/ethernet/cavium/liquidio/cn23xx_vf_device.c:432:16: warning: cast
> from 'void (*)(struct octeon_device *, struct octeon_mbox_cmd *, void *)' to
> 'octeon_mbox_callback_t' (aka 'void (*)(void *, void *, void *)') converts to
> incompatible function type [-Wcast-function-type-strict]
>   432 |         mbox_cmd.fn = (octeon_mbox_callback_t)octeon_pfvf_hs_callback;
>       |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> Fix both of the above by adjusting 'octeon_mbox_callback_t' to match actual
> callback definitions (at the cost of adding an extra forward declaration).
> 
> Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>

I'm not entirely sure changes line this
are appropriate for an orphaned driver [1].
But if so, these look good to me.

Reviewed-by: Simon Horman <horms@kernel.org>

[1] MAINTAINERS: eth: mark Cavium liquidio as an Orphan
    https://git.kernel.org/netdev/net/c/384a35866f3a

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

* Re: [PATCH] net: liquidio: fix clang-specific W=1 build warnings
  2024-01-11 16:24 [PATCH] net: liquidio: fix clang-specific W=1 build warnings Dmitry Antipov
  2024-01-12 19:26 ` Simon Horman
@ 2024-01-13  2:20 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-01-13  2:20 UTC (permalink / raw)
  To: Dmitry Antipov; +Cc: dchickles, kuba, netdev

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Thu, 11 Jan 2024 19:24:29 +0300 you wrote:
> When compiling with clang-18 and W=1, I've noticed the following
> warnings:
> 
> drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.c:1493:16: warning: cast
> from 'void (*)(struct octeon_device *, struct octeon_mbox_cmd *, void *)' to
> 'octeon_mbox_callback_t' (aka 'void (*)(void *, void *, void *)') converts to
> incompatible function type [-Wcast-function-type-strict]
>  1493 |         mbox_cmd.fn = (octeon_mbox_callback_t)cn23xx_get_vf_stats_callback;
>       |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> [...]

Here is the summary with links:
  - net: liquidio: fix clang-specific W=1 build warnings
    https://git.kernel.org/netdev/net/c/cbdd50ec8b1d

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2024-01-13  2:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-11 16:24 [PATCH] net: liquidio: fix clang-specific W=1 build warnings Dmitry Antipov
2024-01-12 19:26 ` Simon Horman
2024-01-13  2:20 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).