Skip to content

Commit 5d07e43

Browse files
arndbdavem330
authored andcommitted
bnad: fix work_queue type mismatch
clang-16 warns about a function pointer cast: drivers/net/ethernet/brocade/bna/bnad.c:1995:4: error: cast from 'void (*)(struct delayed_work *)' to 'work_func_t' (aka 'void (*)(struct work_struct *)') converts to incompatible function type [-Werror,-Wcast-function-type-strict] 1995 | (work_func_t)bnad_tx_cleanup); drivers/net/ethernet/brocade/bna/bnad.c:2252:4: error: cast from 'void (*)(void *)' to 'work_func_t' (aka 'void (*)(struct work_struct *)') converts to incompatible function type [-Werror,-Wcast-function-type-strict] 2252 | (work_func_t)(bnad_rx_cleanup)); The problem here is mixing up work_struct and delayed_work, which relies the former being the first member of the latter. Change the code to use consistent types here to address the warning and make it more robust against workqueue interface changes. Side note: the use of a delayed workqueue for cleaning up TX descriptors is probably a bad idea since this introduces a noticeable delay. The driver currently does not appear to use BQL, but if one wanted to add that, this would have to be changed as well. Fixes: 01b54b1 ("bna: tx rx cleanup fix") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 6cf9ff4 commit 5d07e43

File tree

1 file changed

+5
-7
lines changed
  • drivers/net/ethernet/brocade/bna

1 file changed

+5
-7
lines changed

drivers/net/ethernet/brocade/bna/bnad.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,10 +1091,10 @@ bnad_cb_tx_resume(struct bnad *bnad, struct bna_tx *tx)
10911091
* Free all TxQs buffers and then notify TX_E_CLEANUP_DONE to Tx fsm.
10921092
*/
10931093
static void
1094-
bnad_tx_cleanup(struct delayed_work *work)
1094+
bnad_tx_cleanup(struct work_struct *work)
10951095
{
10961096
struct bnad_tx_info *tx_info =
1097-
container_of(work, struct bnad_tx_info, tx_cleanup_work);
1097+
container_of(work, struct bnad_tx_info, tx_cleanup_work.work);
10981098
struct bnad *bnad = NULL;
10991099
struct bna_tcb *tcb;
11001100
unsigned long flags;
@@ -1170,7 +1170,7 @@ bnad_cb_rx_stall(struct bnad *bnad, struct bna_rx *rx)
11701170
* Free all RxQs buffers and then notify RX_E_CLEANUP_DONE to Rx fsm.
11711171
*/
11721172
static void
1173-
bnad_rx_cleanup(void *work)
1173+
bnad_rx_cleanup(struct work_struct *work)
11741174
{
11751175
struct bnad_rx_info *rx_info =
11761176
container_of(work, struct bnad_rx_info, rx_cleanup_work);
@@ -1991,8 +1991,7 @@ bnad_setup_tx(struct bnad *bnad, u32 tx_id)
19911991
}
19921992
tx_info->tx = tx;
19931993

1994-
INIT_DELAYED_WORK(&tx_info->tx_cleanup_work,
1995-
(work_func_t)bnad_tx_cleanup);
1994+
INIT_DELAYED_WORK(&tx_info->tx_cleanup_work, bnad_tx_cleanup);
19961995

19971996
/* Register ISR for the Tx object */
19981997
if (intr_info->intr_type == BNA_INTR_T_MSIX) {
@@ -2248,8 +2247,7 @@ bnad_setup_rx(struct bnad *bnad, u32 rx_id)
22482247
rx_info->rx = rx;
22492248
spin_unlock_irqrestore(&bnad->bna_lock, flags);
22502249

2251-
INIT_WORK(&rx_info->rx_cleanup_work,
2252-
(work_func_t)(bnad_rx_cleanup));
2250+
INIT_WORK(&rx_info->rx_cleanup_work, bnad_rx_cleanup);
22532251

22542252
/*
22552253
* Init NAPI, so that state is set to NAPI_STATE_SCHED,

0 commit comments

Comments
 (0)