Skip to content

Commit cbdd50e

Browse files
dmantipovkuba-moo
authored andcommitted
net: liquidio: fix clang-specific W=1 build warnings
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 <[email protected]> Reviewed-by: Simon Horman <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 907ee66 commit cbdd50e

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1490,7 +1490,7 @@ int cn23xx_get_vf_stats(struct octeon_device *oct, int vfidx,
14901490
mbox_cmd.q_no = vfidx * oct->sriov_info.rings_per_vf;
14911491
mbox_cmd.recv_len = 0;
14921492
mbox_cmd.recv_status = 0;
1493-
mbox_cmd.fn = (octeon_mbox_callback_t)cn23xx_get_vf_stats_callback;
1493+
mbox_cmd.fn = cn23xx_get_vf_stats_callback;
14941494
ctx.stats = stats;
14951495
atomic_set(&ctx.status, 0);
14961496
mbox_cmd.fn_arg = (void *)&ctx;

drivers/net/ethernet/cavium/liquidio/cn23xx_vf_device.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ int cn23xx_octeon_pfvf_handshake(struct octeon_device *oct)
429429
mbox_cmd.q_no = 0;
430430
mbox_cmd.recv_len = 0;
431431
mbox_cmd.recv_status = 0;
432-
mbox_cmd.fn = (octeon_mbox_callback_t)octeon_pfvf_hs_callback;
432+
mbox_cmd.fn = octeon_pfvf_hs_callback;
433433
mbox_cmd.fn_arg = &status;
434434

435435
octeon_mbox_write(oct, &mbox_cmd);

drivers/net/ethernet/cavium/liquidio/octeon_mailbox.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,10 @@ union octeon_mbox_message {
5757
} s;
5858
};
5959

60-
typedef void (*octeon_mbox_callback_t)(void *, void *, void *);
60+
struct octeon_mbox_cmd;
61+
62+
typedef void (*octeon_mbox_callback_t)(struct octeon_device *,
63+
struct octeon_mbox_cmd *, void *);
6164

6265
struct octeon_mbox_cmd {
6366
union octeon_mbox_message msg;

0 commit comments

Comments
 (0)