Skip to content

Commit

Permalink
net: liquidio: fix clang-specific W=1 build warnings
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
dmantipov authored and kuba-moo committed Jan 13, 2024
1 parent 907ee66 commit cbdd50e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/cavium/liquidio/cn23xx_vf_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 4 additions & 1 deletion drivers/net/ethernet/cavium/liquidio/octeon_mailbox.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit cbdd50e

Please sign in to comment.