From patchwork Tue Feb 13 10:07:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 200352 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp447425dyb; Tue, 13 Feb 2024 02:34:00 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXWw8/LdAK/HAwfETaftTi1Ycf+ufrgOSUGw/LZUjWTWmgl81Zmx8xEQTv9wLUXG4o89Mi66dU+ZXeHDUv53THQHC2Mjw== X-Google-Smtp-Source: AGHT+IEPF+vyEFhU363hOSGsD1Btw2aNzmnSyNis9IqA9qhTKcYQ9pJ2rL+EeQbFvXeO1tnXWrQ/ X-Received: by 2002:a17:90b:19ce:b0:296:f32e:c3b9 with SMTP id nm14-20020a17090b19ce00b00296f32ec3b9mr6901340pjb.26.1707820440380; Tue, 13 Feb 2024 02:34:00 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707820440; cv=pass; d=google.com; s=arc-20160816; b=uhm4CdpXotLfBOwiICBcR4CI++p0eI1JzyGocaV7o41L0ebUrkuWKbp69w+MLHi99A P59tTC9toUnYUJiks/FqNWUmPzGTZ76IANX3vXSI2lpjxHgXaWf5KBT6x6NV16VwqlHT LWCGl+FQTfvc2wUzk0CHY7bO2FQ35iYgnHv9yxPKrzcwAbCOKkDE92i/x9Mm6c9VmdNp Pb47ChpWDF/11jbz0mnWeC2EvwDaWTuhrAflrRO9Isbnp/IMH9RXdvZ1DLpAHydhOJbY /qsSTKqrwkGt0Vme5se3BGF5cxtkQSXNbpiHsdEQ9aGHTq72wx9no1WP1cnAEhKvlrhp hmdA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=D+hFE5gPY3RpKTQh495xey27RzRjq40dtCWRjZCgwKI=; fh=jPyiFyfkZ4gZX+6yceect4nNL4iLXA/tZjyFKBw7iDk=; b=Ty/eQFe0w6G4RGaAaoVTN0UmVPIiq63kwG9fqo5H7AegcsEM0ynd8qJsuK+9naE7BT +6TNmAdzlMq2lAgDg1QpbjYwjqgjBNl4lLzLQx7+Nxn/tEhb08b+u8mskTEEbuaEhZrX cgFQKyxeBhTgLt21CXXlaIoJMBB6tu8RRwJ8AcpUuc+wIEUBrt9qz2pCsG65Dpo1mWOd 0oH4MPy46Aj6VGCdXkFOirStqQU79Dfl/RFLH94fMQjWIbDfFz1De4F6ChlZCwlz3oRK z1bTo2UiV+4UihtRa6/xUsz/nemywJ+xxKRzt7kvdSevdUezH2GKH/OZHPcRlQXu0SXV 9KVg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hHLxAmSG; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-63307-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63307-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=2; AJvYcCWFsv3xXjHck2G7v5L+qSqc0w6i9RP0TZaKoZ4XbKgWQmtE1EC4GIfomenFfheF/q5NtwGkmfct/e+lWoPU1Z8SY4xv7Q== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id m6-20020a17090a2c0600b002962e4f27b2si1773626pjd.69.2024.02.13.02.34.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 02:34:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-63307-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hHLxAmSG; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-63307-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63307-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 656B5B219DE for ; Tue, 13 Feb 2024 10:08:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E0C5122636; Tue, 13 Feb 2024 10:08:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="hHLxAmSG" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4091A22606; Tue, 13 Feb 2024 10:08:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707818896; cv=none; b=krHvL0oYJPmBm6TakV6dDFQBii3CrMqWzfG+C/v8eyzNbWsV+l1gOS04Uw15NczBX7kqzj3RZ289uTBw9HaxGlFhD6Oqtq6O9b6DuxnTnDXqhUMxDiY9tC92CtF/tD0rk678JCWrgb80QfVwv2wzaJpxC3cOt7+dApQoxkCqaHo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707818896; c=relaxed/simple; bh=3kTC3hEoJgDbJR86DA/K8LcbeDgwurEbXjVDgtNlqcI=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=lmNLhJ0xoB0j04qYztWQlyuPuk5ttHx49aVmFBu0wTNiX3qFwfPdNLwToAuGAoQ/z+HjFmcCKRHeNluRyaJf5bJDvGl2UejC4CRCxNOGqXUmZo/YoBmQyY5ReYVL7yrhRghSHUodGDRZLBlL1lZPVZOBmjo/LRfs1pQZziuTZEk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=hHLxAmSG; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 347DFC433F1; Tue, 13 Feb 2024 10:08:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707818895; bh=3kTC3hEoJgDbJR86DA/K8LcbeDgwurEbXjVDgtNlqcI=; h=From:To:Cc:Subject:Date:From; b=hHLxAmSG6+Ig+3zRzlwxnnSRf5/OmGhS+v5Cu1oNTfInj+Tv3kRHk+5dLiIQDtyYg h2eDGMXs6JlNfomulCJfjy33NXXDZwyphjcz0mCEnPxTYFT3N+Ua3Gjs03z1FAHjgM rumiwlWK6MH2EvnyHIZyMd68QSK/w1ycpKDz/ylEjNZU51tcAtrFceOkT/0ZaZeT2L 1TEJhnTk900XsbMiZQwzw+JNNgXZZi8DzAzXAMYZGsNORHYj49BYelNbB2beUbQTKi 62he7VrSjL8fyxHIeqkcEW8k4lbTnHtZPtzUfgOAyRYiS1eM633WK+QYXmf9AXi7Oc ND/OgfokMMZIw== From: Arnd Bergmann To: Rasesh Mody , Sudarsana Kalluru , GR-Linux-NIC-Dev@marvell.com, Jakub Kicinski Cc: Arnd Bergmann , "David S. Miller" , Eric Dumazet , Paolo Abeni , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Wu Yunchuan , Jing Huang , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH] bnad: fix work_queue type mismatch Date: Tue, 13 Feb 2024 11:07:50 +0100 Message-Id: <20240213100809.458571-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790779526120583264 X-GMAIL-MSGID: 1790779526120583264 From: Arnd Bergmann 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: 01b54b145185 ("bna: tx rx cleanup fix") Signed-off-by: Arnd Bergmann --- drivers/net/ethernet/brocade/bna/bnad.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/brocade/bna/bnad.c b/drivers/net/ethernet/brocade/bna/bnad.c index 31191b520b58..c32174484a96 100644 --- a/drivers/net/ethernet/brocade/bna/bnad.c +++ b/drivers/net/ethernet/brocade/bna/bnad.c @@ -1091,10 +1091,10 @@ bnad_cb_tx_resume(struct bnad *bnad, struct bna_tx *tx) * Free all TxQs buffers and then notify TX_E_CLEANUP_DONE to Tx fsm. */ static void -bnad_tx_cleanup(struct delayed_work *work) +bnad_tx_cleanup(struct work_struct *work) { struct bnad_tx_info *tx_info = - container_of(work, struct bnad_tx_info, tx_cleanup_work); + container_of(work, struct bnad_tx_info, tx_cleanup_work.work); struct bnad *bnad = NULL; struct bna_tcb *tcb; unsigned long flags; @@ -1170,7 +1170,7 @@ bnad_cb_rx_stall(struct bnad *bnad, struct bna_rx *rx) * Free all RxQs buffers and then notify RX_E_CLEANUP_DONE to Rx fsm. */ static void -bnad_rx_cleanup(void *work) +bnad_rx_cleanup(struct work_struct *work) { struct bnad_rx_info *rx_info = container_of(work, struct bnad_rx_info, rx_cleanup_work); @@ -1991,8 +1991,7 @@ bnad_setup_tx(struct bnad *bnad, u32 tx_id) } tx_info->tx = tx; - INIT_DELAYED_WORK(&tx_info->tx_cleanup_work, - (work_func_t)bnad_tx_cleanup); + INIT_DELAYED_WORK(&tx_info->tx_cleanup_work, bnad_tx_cleanup); /* Register ISR for the Tx object */ if (intr_info->intr_type == BNA_INTR_T_MSIX) { @@ -2248,8 +2247,7 @@ bnad_setup_rx(struct bnad *bnad, u32 rx_id) rx_info->rx = rx; spin_unlock_irqrestore(&bnad->bna_lock, flags); - INIT_WORK(&rx_info->rx_cleanup_work, - (work_func_t)(bnad_rx_cleanup)); + INIT_WORK(&rx_info->rx_cleanup_work, bnad_rx_cleanup); /* * Init NAPI, so that state is set to NAPI_STATE_SCHED,