From patchwork Sat Oct 31 00:49:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 315930 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 27C59C00A89 for ; Sat, 31 Oct 2020 00:50:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F31952087E for ; Sat, 31 Oct 2020 00:50:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726309AbgJaAuX (ORCPT ); Fri, 30 Oct 2020 20:50:23 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:55834 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726293AbgJaAuU (ORCPT ); Fri, 30 Oct 2020 20:50:20 -0400 Received: from andrew by vps0.lunn.ch with local (Exim 4.94) (envelope-from ) id 1kYf5z-004RiP-Ba; Sat, 31 Oct 2020 01:50:15 +0100 From: Andrew Lunn To: Jakub Kicinski Cc: netdev , Nicolas Pitre , Andrew Lunn Subject: [PATCH net-next 1/7] drivers: net: smc91x: Fix set but unused W=1 warning Date: Sat, 31 Oct 2020 01:49:52 +0100 Message-Id: <20201031004958.1059797-2-andrew@lunn.ch> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20201031004958.1059797-1-andrew@lunn.ch> References: <20201031004958.1059797-1-andrew@lunn.ch> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org drivers/net/ethernet/smsc/smc91x.c:706:51: warning: variable ‘pkt_len’ set but not used [-Wunused-but-set-variable] 706 | unsigned int saved_packet, packet_no, tx_status, pkt_len; Add a new macro for getting fields out of the header, which only gets the status, not the length which in this case is not needed. Signed-off-by: Andrew Lunn --- drivers/net/ethernet/smsc/smc91x.c | 4 ++-- drivers/net/ethernet/smsc/smc91x.h | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/smsc/smc91x.c b/drivers/net/ethernet/smsc/smc91x.c index f6b73afd1879..61333939a73e 100644 --- a/drivers/net/ethernet/smsc/smc91x.c +++ b/drivers/net/ethernet/smsc/smc91x.c @@ -703,7 +703,7 @@ static void smc_tx(struct net_device *dev) { struct smc_local *lp = netdev_priv(dev); void __iomem *ioaddr = lp->base; - unsigned int saved_packet, packet_no, tx_status, pkt_len; + unsigned int saved_packet, packet_no, tx_status; DBG(3, dev, "%s\n", __func__); @@ -720,7 +720,7 @@ static void smc_tx(struct net_device *dev) /* read the first word (status word) from this packet */ SMC_SET_PTR(lp, PTR_AUTOINC | PTR_READ); - SMC_GET_PKT_HDR(lp, tx_status, pkt_len); + SMC_GET_PKT_HDR_STATUS(lp, tx_status); DBG(2, dev, "TX STATUS 0x%04x PNR 0x%02x\n", tx_status, packet_no); diff --git a/drivers/net/ethernet/smsc/smc91x.h b/drivers/net/ethernet/smsc/smc91x.h index 387539a8094b..705d9d6ebaa5 100644 --- a/drivers/net/ethernet/smsc/smc91x.h +++ b/drivers/net/ethernet/smsc/smc91x.h @@ -1056,6 +1056,16 @@ static const char * chip_ids[ 16 ] = { } \ } while (0) +#define SMC_GET_PKT_HDR_STATUS(lp, status) \ + do { \ + if (SMC_32BIT(lp)) { \ + unsigned int __val = SMC_inl(ioaddr, DATA_REG(lp)); \ + (status) = __val & 0xffff; \ + } else { \ + (status) = SMC_inw(ioaddr, DATA_REG(lp)); \ + } \ + } while (0) + #define SMC_PUSH_DATA(lp, p, l) \ do { \ if (SMC_32BIT(lp)) { \ From patchwork Sat Oct 31 00:49:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 315932 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D453DC388F9 for ; Sat, 31 Oct 2020 00:50:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 833E9208B6 for ; Sat, 31 Oct 2020 00:50:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726312AbgJaAuZ (ORCPT ); Fri, 30 Oct 2020 20:50:25 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:55808 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726116AbgJaAuT (ORCPT ); Fri, 30 Oct 2020 20:50:19 -0400 Received: from andrew by vps0.lunn.ch with local (Exim 4.94) (envelope-from ) id 1kYf5z-004Rib-GV; Sat, 31 Oct 2020 01:50:15 +0100 From: Andrew Lunn To: Jakub Kicinski Cc: netdev , Nicolas Pitre , Andrew Lunn Subject: [PATCH net-next 5/7] drivers: net: smc911x: Fix passing wrong number of parameters to DBG() macro Date: Sat, 31 Oct 2020 01:49:56 +0100 Message-Id: <20201031004958.1059797-6-andrew@lunn.ch> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20201031004958.1059797-1-andrew@lunn.ch> References: <20201031004958.1059797-1-andrew@lunn.ch> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Now that the compiler always sees the parameters passed to the DBG() macro, it gives an error message about wrong parameters. The comment says it all: /* ndev is not valid yet, so avoid passing it in. */ DBG(SMC_DEBUG_FUNC, "--> %s\n", __func__); You cannot not just pass a parameter! The DBG does not seem to have any real value, to just remove it. Signed-off-by: Andrew Lunn --- drivers/net/ethernet/smsc/smc911x.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/net/ethernet/smsc/smc911x.c b/drivers/net/ethernet/smsc/smc911x.c index 33d0398c182e..4ec292563f38 100644 --- a/drivers/net/ethernet/smsc/smc911x.c +++ b/drivers/net/ethernet/smsc/smc911x.c @@ -2048,8 +2048,6 @@ static int smc911x_drv_probe(struct platform_device *pdev) void __iomem *addr; int ret; - /* ndev is not valid yet, so avoid passing it in. */ - DBG(SMC_DEBUG_FUNC, "--> %s\n", __func__); res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res) { ret = -ENODEV; From patchwork Sat Oct 31 00:49:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 315931 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 11A50C00A89 for ; Sat, 31 Oct 2020 00:50:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E10CA208B6 for ; Sat, 31 Oct 2020 00:50:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726325AbgJaAu1 (ORCPT ); Fri, 30 Oct 2020 20:50:27 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:55822 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726254AbgJaAuT (ORCPT ); Fri, 30 Oct 2020 20:50:19 -0400 Received: from andrew by vps0.lunn.ch with local (Exim 4.94) (envelope-from ) id 1kYf5z-004Rie-Ha; Sat, 31 Oct 2020 01:50:15 +0100 From: Andrew Lunn To: Jakub Kicinski Cc: netdev , Nicolas Pitre , Andrew Lunn Subject: [PATCH net-next 6/7] drivers: net: smc911x: Fix cast from pointer to integer of different size Date: Sat, 31 Oct 2020 01:49:57 +0100 Message-Id: <20201031004958.1059797-7-andrew@lunn.ch> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20201031004958.1059797-1-andrew@lunn.ch> References: <20201031004958.1059797-1-andrew@lunn.ch> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org drivers/net/ethernet/smsc/smc911x.c: In function ‘smc911x_hardware_send_pkt’: drivers/net/ethernet/smsc/smc911x.c:471:11: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] 471 | cmdA = (((u32)skb->data & 0x3) << 16) | When built on 64bit targets, the skb->data pointer cannot be cast to a u32 in a meaningful way. Use long instead. Signed-off-by: Andrew Lunn --- drivers/net/ethernet/smsc/smc911x.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/smsc/smc911x.c b/drivers/net/ethernet/smsc/smc911x.c index 4ec292563f38..f37832540364 100644 --- a/drivers/net/ethernet/smsc/smc911x.c +++ b/drivers/net/ethernet/smsc/smc911x.c @@ -466,9 +466,9 @@ static void smc911x_hardware_send_pkt(struct net_device *dev) TX_CMD_A_INT_FIRST_SEG_ | TX_CMD_A_INT_LAST_SEG_ | skb->len; #else - buf = (char*)((u32)skb->data & ~0x3); - len = (skb->len + 3 + ((u32)skb->data & 3)) & ~0x3; - cmdA = (((u32)skb->data & 0x3) << 16) | + buf = (char *)((long)skb->data & ~0x3); + len = (skb->len + 3 + ((long)skb->data & 3)) & ~0x3; + cmdA = (((long)skb->data & 0x3) << 16) | TX_CMD_A_INT_FIRST_SEG_ | TX_CMD_A_INT_LAST_SEG_ | skb->len; #endif