From patchwork Wed Oct 5 12:04:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin LABBE X-Patchwork-Id: 12999191 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 66BF4C433F5 for ; Wed, 5 Oct 2022 12:05:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229972AbiJEMFN (ORCPT ); Wed, 5 Oct 2022 08:05:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229484AbiJEMFL (ORCPT ); Wed, 5 Oct 2022 08:05:11 -0400 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B864E1B787 for ; Wed, 5 Oct 2022 05:05:09 -0700 (PDT) Received: by mail-wm1-x32b.google.com with SMTP id ay36so10633175wmb.0 for ; Wed, 05 Oct 2022 05:05:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date; bh=KRm1i/FjODl/xyx7vhUvSFcaqvqmNQu9ppzqZg/T/ms=; b=QGdPK5xtP16USepja+6IFY3t0sutFWFGuiF9aUcx9bJ9o7194uWmKtswuYqxAcv5bM wb7omhj6AzKSYZMBjH+0czzPCKIpToHkvmOLK6XCgOpFJKRKJ+pFrxM2YhgeI0/lp0eL uZZTaQb2flYHuara6S0m/L0zo45uO7Hv+bITBTHsqNknbOJEpr1jppFU+9TO8TQ3xtEF XqN20K+U3vpTgv7KVs3wMINFnUg0O/JuVRlXB/HjlDf+RzQdZp0wDbLK4pSg15o7VjA7 45Pu97RZd1ibCcOQK47w1fRItxg1Jmgg6cDVvRbQDbUyLxVZx4NtrBtczwsOugyQGmJm GxoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date; bh=KRm1i/FjODl/xyx7vhUvSFcaqvqmNQu9ppzqZg/T/ms=; b=QX5/XvCAxSLp9+8w4gcg5iZZkPuWuAykPmBKXIuJhdlQzB+nGAFaAdIwuI2gxCd/SM M5S7Pkdo90wW21h9Lul0M3jzxjpxWasQqoWyk5Adb5TGLXXxRBqvfi7X772vgdTWRkO+ 7DhHZU4H1Bkw/zS4u/oIYpQ3fGQXCdVn0d3rbieD1fFngmgE1eDrGAtrwDyKOQpP6iJY bbv4Y9LyHjNBibTet6q2pL7f/gkhb/qSciu3VW7crYVsjvQvgSkOR55tudD4gPXxFDp2 cU8UmuByZVWaDXR1p/Vvo2oFD4kAkuHWBjN5JHorqCk6mM/r052ks0WOCY+pfRKaYBoV UHAQ== X-Gm-Message-State: ACrzQf2LDf/i3zs7vMDGFXuHmkLHr6gaQeKDhjmpBn4lGv7dXWzxw+FK hfLt1CUKSRKKHrGMDTB+5DCUJg== X-Google-Smtp-Source: AMsMyM7AnYe1pqnRsauylbxoTUQU0jGRG2FZqzUPWskH9jW2VW09NmxOnIodOZ/Ey98Lc3/tpRT91Q== X-Received: by 2002:a05:600c:35c5:b0:3b4:bf50:f84a with SMTP id r5-20020a05600c35c500b003b4bf50f84amr2972425wmq.22.1664971508060; Wed, 05 Oct 2022 05:05:08 -0700 (PDT) Received: from localhost.localdomain (laubervilliers-658-1-213-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.googlemail.com with ESMTPSA id v16-20020a5d6790000000b0022e3e7813f0sm7799583wru.107.2022.10.05.05.05.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Oct 2022 05:05:07 -0700 (PDT) From: Corentin Labbe To: davem@davemloft.net, edumazet@google.com, khalasa@piap.pl, kuba@kernel.org, pabeni@redhat.com Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Corentin Labbe Subject: [PATCH 1/4] net: ethernet: xscale: fix space style issues Date: Wed, 5 Oct 2022 12:04:58 +0000 Message-Id: <20221005120501.3527435-1-clabbe@baylibre.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Fix all checkpatch issue about space/newlines. Signed-off-by: Corentin Labbe --- drivers/net/ethernet/xscale/ixp4xx_eth.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/drivers/net/ethernet/xscale/ixp4xx_eth.c b/drivers/net/ethernet/xscale/ixp4xx_eth.c index 3b0c5f177447..71d36ff7cd1b 100644 --- a/drivers/net/ethernet/xscale/ixp4xx_eth.c +++ b/drivers/net/ethernet/xscale/ixp4xx_eth.c @@ -115,7 +115,6 @@ #define DEFAULT_RX_CNTRL0 RX_CNTRL0_RX_EN #define DEFAULT_CORE_CNTRL CORE_MDC_EN - /* NPE message codes */ #define NPE_GETSTATUS 0x00 #define NPE_EDB_SETPORTADDRESS 0x01 @@ -141,7 +140,6 @@ #define NPE_NOTIFY_MAC_RECOVERY_DONE 0x16 #define NPE_MAC_RECOVERY_START 0x17 - #ifdef __ARMEB__ typedef struct sk_buff buffer_t; #define free_buffer dev_kfree_skb @@ -247,7 +245,6 @@ struct desc { #endif }; - #define rx_desc_phys(port, n) ((port)->desc_tab_phys + \ (n) * sizeof(struct desc)) #define rx_desc_ptr(port, n) (&(port)->desc_tab[n]) @@ -260,6 +257,7 @@ struct desc { static inline void memcpy_swab32(u32 *dest, u32 *src, int cnt) { int i; + for (i = 0; i < cnt; i++) dest[i] = swab32(src[i]); } @@ -566,7 +564,6 @@ static void ixp4xx_mdio_remove(void) mdiobus_free(mdio_bus); } - static void ixp4xx_adjust_link(struct net_device *dev) { struct port *port = netdev_priv(dev); @@ -597,7 +594,6 @@ static void ixp4xx_adjust_link(struct net_device *dev) dev->name, port->speed, port->duplex ? "full" : "half"); } - static inline void debug_pkt(struct net_device *dev, const char *func, u8 *data, int len) { @@ -616,7 +612,6 @@ static inline void debug_pkt(struct net_device *dev, const char *func, #endif } - static inline void debug_desc(u32 phys, struct desc *desc) { #if DEBUG_DESC @@ -661,7 +656,6 @@ static inline void queue_put_desc(unsigned int queue, u32 phys, length and queues >= 32 don't support this check anyway. */ } - static inline void dma_unmap_tx(struct port *port, struct desc *desc) { #ifdef __ARMEB__ @@ -674,7 +668,6 @@ static inline void dma_unmap_tx(struct port *port, struct desc *desc) #endif } - static void eth_rx_irq(void *pdev) { struct net_device *dev = pdev; @@ -792,7 +785,6 @@ static int eth_poll(struct napi_struct *napi, int budget) return received; /* not all work done */ } - static void eth_txdone_irq(void *unused) { u32 phys; @@ -932,7 +924,6 @@ static netdev_tx_t eth_xmit(struct sk_buff *skb, struct net_device *dev) return NETDEV_TX_OK; } - static void eth_set_mcast_list(struct net_device *dev) { struct port *port = netdev_priv(dev); @@ -976,7 +967,6 @@ static void eth_set_mcast_list(struct net_device *dev) &port->regs->rx_control[0]); } - static int eth_ioctl(struct net_device *dev, struct ifreq *req, int cmd) { if (!netif_running(dev)) @@ -1046,7 +1036,6 @@ static const struct ethtool_ops ixp4xx_ethtool_ops = { .set_link_ksettings = phy_ethtool_set_link_ksettings, }; - static int request_queues(struct port *port) { int err; @@ -1157,6 +1146,7 @@ static void destroy_queues(struct port *port) for (i = 0; i < RX_DESCS; i++) { struct desc *desc = rx_desc_ptr(port, i); buffer_t *buff = port->rx_buff_tab[i]; + if (buff) { dma_unmap_single(&port->netdev->dev, desc->data - NET_IP_ALIGN, @@ -1167,6 +1157,7 @@ static void destroy_queues(struct port *port) for (i = 0; i < TX_DESCS; i++) { struct desc *desc = tx_desc_ptr(port, i); buffer_t *buff = port->tx_buff_tab[i]; + if (buff) { dma_unmap_tx(port, desc); free_buffer(buff); @@ -1320,6 +1311,7 @@ static int eth_close(struct net_device *dev) struct desc *desc; u32 phys; int n = queue_get_desc(port->plat->txreadyq, port, 1); + BUG_ON(n < 0); desc = tx_desc_ptr(port, n); phys = tx_desc_phys(port, n); From patchwork Wed Oct 5 12:04:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin LABBE X-Patchwork-Id: 12999193 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 87FE4C433FE for ; Wed, 5 Oct 2022 12:05:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229976AbiJEMFR (ORCPT ); Wed, 5 Oct 2022 08:05:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229696AbiJEMFM (ORCPT ); Wed, 5 Oct 2022 08:05:12 -0400 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3947427DF6 for ; Wed, 5 Oct 2022 05:05:10 -0700 (PDT) Received: by mail-wm1-x336.google.com with SMTP id z13-20020a7bc7cd000000b003b5054c6f9bso919150wmk.2 for ; Wed, 05 Oct 2022 05:05:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=ChX2Cf56JhEWgsWEPTBfPDBZm9CPjucsZ4lKeoQ8AzE=; b=FMSPvGuslzWxGUJajgjKNOmLO3wTEjYsEKpzfb1jICkBY5/h1gTehNmtiDyfMNI7bJ NBNHcUGBhfREWvy7ag+nA1O+fRTisdXI9DgkmhZndTA8iw0y+H32OMXmEsoCbE48fY84 m6KWrW/nUiuq3y4PYjHYinLHjjIpDfluf2Pfid3qmS7JywB9+0h4OpTSSbRO2XRoobFA zkPqpCm+xHngTbwtXIRBykpVI6zFcSRATzZ7GCha7n62/krJy16PHt4blj01IPo8ftPZ EYxFJq4tuCqIEAPvAtNWTzZuqHoufldlNrPw4h5nE0HyH3ee5uIpXCwN1BsEWk5aur0G 74xg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=ChX2Cf56JhEWgsWEPTBfPDBZm9CPjucsZ4lKeoQ8AzE=; b=5iFII9XzbgAsoYfZcy51sYwBQjWGBdDPnunqc13P7IynMAW6bg4AYZ/s4r6twfJzbe 9rYdWkBS6coIck65Epf7Oeq3Q956oPjXw4BVv2AK6ve8k0sJSPRearGytE3GcJc/oZJm O18b1WT166OoIydbEsnYUIldPgCxHu5e2jdXDREH1ZGOdBXQKJFkIomfkOWhyUe7z0LX XZbDFaDxXltVWJHcwuhLDj/NoqdlnhAOSoj5PYU8YnN/Y/jbhXRt9G5v041sl0qAo4c4 CxUydTuJ08rx7/f3HEs98eAqxE2tKs4jw5NLaS1gMUxzwfztGv4IdL3l0lHqJBzU0qhK IKVg== X-Gm-Message-State: ACrzQf01vgTRvXjtssnP/NQUT+8j+4EjzYniv3o+sw4F4w37QpunVaMO 9XYaMi8BQfLiMaBnmq8WM+33Rg== X-Google-Smtp-Source: AMsMyM6gRWq2At8AWaXG0SXWYal7lciklKQw7/JHXuUeSwrpnSeIkV+VSuiHh7cuIFD5DwcUBRbWgg== X-Received: by 2002:a7b:c84f:0:b0:3b4:84c1:1e7 with SMTP id c15-20020a7bc84f000000b003b484c101e7mr3132468wml.12.1664971508765; Wed, 05 Oct 2022 05:05:08 -0700 (PDT) Received: from localhost.localdomain (laubervilliers-658-1-213-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.googlemail.com with ESMTPSA id v16-20020a5d6790000000b0022e3e7813f0sm7799583wru.107.2022.10.05.05.05.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Oct 2022 05:05:08 -0700 (PDT) From: Corentin Labbe To: davem@davemloft.net, edumazet@google.com, khalasa@piap.pl, kuba@kernel.org, pabeni@redhat.com Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Corentin Labbe Subject: [PATCH 2/4] net: ethernet: xscale: fix printk issues Date: Wed, 5 Oct 2022 12:04:59 +0000 Message-Id: <20221005120501.3527435-2-clabbe@baylibre.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221005120501.3527435-1-clabbe@baylibre.com> References: <20221005120501.3527435-1-clabbe@baylibre.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Fix all checkpatch issues about printk and co. Some pr_xx are replaced by netdev_xxx when appropriate. Furthermore, there are lot of typo on netdev_debug instead of netdev_dbg; since this is ifdef-ed debug code, no need for a fixes tag. Signed-off-by: Corentin Labbe --- drivers/net/ethernet/xscale/ixp4xx_eth.c | 95 ++++++++++++------------ 1 file changed, 46 insertions(+), 49 deletions(-) diff --git a/drivers/net/ethernet/xscale/ixp4xx_eth.c b/drivers/net/ethernet/xscale/ixp4xx_eth.c index 71d36ff7cd1b..b4539dd2cfe4 100644 --- a/drivers/net/ethernet/xscale/ixp4xx_eth.c +++ b/drivers/net/ethernet/xscale/ixp4xx_eth.c @@ -462,7 +462,7 @@ static int ixp4xx_mdio_cmd(struct mii_bus *bus, int phy_id, int location, int cycles = 0; if (__raw_readl(&mdio_regs->mdio_command[3]) & 0x80) { - printk(KERN_ERR "%s: MII not ready to transmit\n", bus->name); + pr_err("%s: MII not ready to transmit\n", bus->name); return -1; } @@ -482,14 +482,13 @@ static int ixp4xx_mdio_cmd(struct mii_bus *bus, int phy_id, int location, } if (cycles == MAX_MDIO_RETRIES) { - printk(KERN_ERR "%s #%i: MII write failed\n", bus->name, - phy_id); + pr_err("%s #%i: MII write failed\n", bus->name, phy_id); return -1; } #if DEBUG_MDIO - printk(KERN_DEBUG "%s #%i: mdio_%s() took %i cycles\n", bus->name, - phy_id, write ? "write" : "read", cycles); + pr_debug("%s #%i: mdio_%s() took %i cycles\n", bus->name, + phy_id, write ? "write" : "read", cycles); #endif if (write) @@ -497,8 +496,7 @@ static int ixp4xx_mdio_cmd(struct mii_bus *bus, int phy_id, int location, if (__raw_readl(&mdio_regs->mdio_status[3]) & 0x80) { #if DEBUG_MDIO - printk(KERN_DEBUG "%s #%i: MII read failed\n", bus->name, - phy_id); + pr_debug("%s #%i: MII read failed\n", bus->name, phy_id); #endif return 0xFFFF; /* don't return error */ } @@ -516,8 +514,8 @@ static int ixp4xx_mdio_read(struct mii_bus *bus, int phy_id, int location) ret = ixp4xx_mdio_cmd(bus, phy_id, location, 0, 0); spin_unlock_irqrestore(&mdio_lock, flags); #if DEBUG_MDIO - printk(KERN_DEBUG "%s #%i: MII read [%i] -> 0x%X\n", bus->name, - phy_id, location, ret); + pr_debug("%s #%i: MII read [%i] -> 0x%X\n", bus->name, phy_id, + location, ret); #endif return ret; } @@ -532,8 +530,8 @@ static int ixp4xx_mdio_write(struct mii_bus *bus, int phy_id, int location, ret = ixp4xx_mdio_cmd(bus, phy_id, location, 1, val); spin_unlock_irqrestore(&mdio_lock, flags); #if DEBUG_MDIO - printk(KERN_DEBUG "%s #%i: MII write [%i] <- 0x%X, err = %i\n", - bus->name, phy_id, location, val, ret); + pr_debug("%s #%i: MII write [%i] <- 0x%X, err = %i\n", bus->name, + phy_id, location, val, ret); #endif return ret; } @@ -572,7 +570,7 @@ static void ixp4xx_adjust_link(struct net_device *dev) if (!phydev->link) { if (port->speed) { port->speed = 0; - printk(KERN_INFO "%s: link down\n", dev->name); + netdev_info(dev, "link down\n"); } return; } @@ -590,8 +588,8 @@ static void ixp4xx_adjust_link(struct net_device *dev) __raw_writel(DEFAULT_TX_CNTRL0 | TX_CNTRL0_HALFDUPLEX, &port->regs->tx_control[0]); - netdev_info(dev, "%s: link up, speed %u Mb/s, %s duplex\n", - dev->name, port->speed, port->duplex ? "full" : "half"); + netdev_info(dev, "link up, speed %u Mb/s, %s duplex\n", + port->speed, port->duplex ? "full" : "half"); } static inline void debug_pkt(struct net_device *dev, const char *func, @@ -600,30 +598,30 @@ static inline void debug_pkt(struct net_device *dev, const char *func, #if DEBUG_PKT_BYTES int i; - netdev_debug(dev, "%s(%i) ", func, len); + netdev_dbg(dev, "%s(%i) ", func, len); for (i = 0; i < len; i++) { if (i >= DEBUG_PKT_BYTES) break; - printk("%s%02X", - ((i == 6) || (i == 12) || (i >= 14)) ? " " : "", - data[i]); + netdev_dbg(dev, "%s%02X", + ((i == 6) || (i == 12) || (i >= 14)) ? " " : "", + data[i]); } - printk("\n"); + netdev_dbg(dev, "\n"); #endif } static inline void debug_desc(u32 phys, struct desc *desc) { #if DEBUG_DESC - printk(KERN_DEBUG "%X: %X %3X %3X %08X %2X < %2X %4X %X" - " %X %X %02X%02X%02X%02X%02X%02X < %02X%02X%02X%02X%02X%02X\n", - phys, desc->next, desc->buf_len, desc->pkt_len, - desc->data, desc->dest_id, desc->src_id, desc->flags, - desc->qos, desc->padlen, desc->vlan_tci, - desc->dst_mac_0, desc->dst_mac_1, desc->dst_mac_2, - desc->dst_mac_3, desc->dst_mac_4, desc->dst_mac_5, - desc->src_mac_0, desc->src_mac_1, desc->src_mac_2, - desc->src_mac_3, desc->src_mac_4, desc->src_mac_5); + pr_debug("%X: %X %3X %3X %08X %2X < %2X %4X %X" + " %X %X %02X%02X%02X%02X%02X%02X < %02X%02X%02X%02X%02X%02X\n", + phys, desc->next, desc->buf_len, desc->pkt_len, + desc->data, desc->dest_id, desc->src_id, desc->flags, + desc->qos, desc->padlen, desc->vlan_tci, + desc->dst_mac_0, desc->dst_mac_1, desc->dst_mac_2, + desc->dst_mac_3, desc->dst_mac_4, desc->dst_mac_5, + desc->src_mac_0, desc->src_mac_1, desc->src_mac_2, + desc->src_mac_3, desc->src_mac_4, desc->src_mac_5); #endif } @@ -674,7 +672,7 @@ static void eth_rx_irq(void *pdev) struct port *port = netdev_priv(dev); #if DEBUG_RX - printk(KERN_DEBUG "%s: eth_rx_irq\n", dev->name); + netdev_dbg(dev, "%s\n", __func__); #endif qmgr_disable_irq(port->plat->rxq); napi_schedule(&port->napi); @@ -688,7 +686,7 @@ static int eth_poll(struct napi_struct *napi, int budget) int received = 0; #if DEBUG_RX - netdev_debug(dev, "eth_poll\n"); + netdev_dbg(dev, "%s\n", __func__); #endif while (received < budget) { @@ -702,20 +700,21 @@ static int eth_poll(struct napi_struct *napi, int budget) if ((n = queue_get_desc(rxq, port, 0)) < 0) { #if DEBUG_RX - netdev_debug(dev, "eth_poll napi_complete\n"); + netdev_dbg(dev, "%s napi_complete\n", __func__); #endif napi_complete(napi); qmgr_enable_irq(rxq); if (!qmgr_stat_below_low_watermark(rxq) && napi_reschedule(napi)) { /* not empty again */ #if DEBUG_RX - netdev_debug(dev, "eth_poll napi_reschedule succeeded\n"); + netdev_dbg(dev, "%s napi_reschedule succeeded\n", + __func__); #endif qmgr_disable_irq(rxq); continue; } #if DEBUG_RX - netdev_debug(dev, "eth_poll all done\n"); + netdev_dbg(dev, "%s all done\n", __func__); #endif return received; /* all work done */ } @@ -760,7 +759,7 @@ static int eth_poll(struct napi_struct *napi, int budget) skb_reserve(skb, NET_IP_ALIGN); skb_put(skb, desc->pkt_len); - debug_pkt(dev, "eth_poll", skb->data, skb->len); + debug_pkt(dev, __func__, skb->data, skb->len); ixp_rx_timestamp(port, skb); skb->protocol = eth_type_trans(skb, dev); @@ -780,7 +779,7 @@ static int eth_poll(struct napi_struct *napi, int budget) } #if DEBUG_RX - netdev_debug(dev, "eth_poll(): end, not all work done\n"); + netdev_dbg(dev, "%s: end, not all work done\n", __func__); #endif return received; /* not all work done */ } @@ -790,7 +789,7 @@ static void eth_txdone_irq(void *unused) u32 phys; #if DEBUG_TX - printk(KERN_DEBUG DRV_NAME ": eth_txdone_irq\n"); + pr_debug(DRV_NAME ": %s\n", __func__); #endif while ((phys = qmgr_get_entry(TXDONE_QUEUE)) != 0) { u32 npe_id, n_desc; @@ -814,8 +813,8 @@ static void eth_txdone_irq(void *unused) dma_unmap_tx(port, desc); #if DEBUG_TX - printk(KERN_DEBUG "%s: eth_txdone_irq free %p\n", - port->netdev->name, port->tx_buff_tab[n_desc]); + netdev_dbg(port->netdev, "%s free %p\n", __func__, + port->tx_buff_tab[n_desc]); #endif free_buffer_irq(port->tx_buff_tab[n_desc]); port->tx_buff_tab[n_desc] = NULL; @@ -825,8 +824,7 @@ static void eth_txdone_irq(void *unused) queue_put_desc(port->plat->txreadyq, phys, desc); if (start) { /* TX-ready queue was empty */ #if DEBUG_TX - printk(KERN_DEBUG "%s: eth_txdone_irq xmit ready\n", - port->netdev->name); + netdev_dbg(port->netdev, "%s xmit ready\n", __func__); #endif netif_wake_queue(port->netdev); } @@ -843,7 +841,7 @@ static netdev_tx_t eth_xmit(struct sk_buff *skb, struct net_device *dev) struct desc *desc; #if DEBUG_TX - netdev_debug(dev, "eth_xmit\n"); + netdev_dbg(dev, "%s\n", __func__); #endif if (unlikely(skb->len > MAX_MRU)) { @@ -852,7 +850,7 @@ static netdev_tx_t eth_xmit(struct sk_buff *skb, struct net_device *dev) return NETDEV_TX_OK; } - debug_pkt(dev, "eth_xmit", skb->data, skb->len); + debug_pkt(dev, __func__, skb->data, skb->len); len = skb->len; #ifdef __ARMEB__ @@ -898,21 +896,21 @@ static netdev_tx_t eth_xmit(struct sk_buff *skb, struct net_device *dev) if (qmgr_stat_below_low_watermark(txreadyq)) { /* empty */ #if DEBUG_TX - netdev_debug(dev, "eth_xmit queue full\n"); + netdev_dbg(dev, "%s queue full\n", __func__); #endif netif_stop_queue(dev); /* we could miss TX ready interrupt */ /* really empty in fact */ if (!qmgr_stat_below_low_watermark(txreadyq)) { #if DEBUG_TX - netdev_debug(dev, "eth_xmit ready again\n"); + netdev_dbg(dev, "%s ready again\n", __func__); #endif netif_wake_queue(dev); } } #if DEBUG_TX - netdev_debug(dev, "eth_xmit end\n"); + netdev_dbg(dev, "%s end\n", __func__); #endif ixp_tx_timestamp(port, skb); @@ -1077,8 +1075,7 @@ static int request_queues(struct port *port) qmgr_release_queue(port->plat->rxq); rel_rxfree: qmgr_release_queue(RXFREE_QUEUE(port->id)); - printk(KERN_DEBUG "%s: unable to request hardware queues\n", - port->netdev->name); + netdev_dbg(port->netdev, "unable to request hardware queues\n"); return err; } @@ -1327,7 +1324,7 @@ static int eth_close(struct net_device *dev) " left in NPE\n", buffs); #if DEBUG_CLOSE if (!buffs) - netdev_debug(dev, "draining RX queue took %i cycles\n", i); + netdev_dbg(dev, "draining RX queue took %i cycles\n", i); #endif buffs = TX_DESCS; @@ -1347,7 +1344,7 @@ static int eth_close(struct net_device *dev) "left in NPE\n", buffs); #if DEBUG_CLOSE if (!buffs) - netdev_debug(dev, "draining TX queues took %i cycles\n", i); + netdev_dbg(dev, "draining TX queues took %i cycles\n", i); #endif msg.byte3 = 0; From patchwork Wed Oct 5 12:05:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin LABBE X-Patchwork-Id: 12999192 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2536DC433FE for ; Wed, 5 Oct 2022 12:05:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229980AbiJEMFP (ORCPT ); Wed, 5 Oct 2022 08:05:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229901AbiJEMFM (ORCPT ); Wed, 5 Oct 2022 08:05:12 -0400 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F0722870C for ; Wed, 5 Oct 2022 05:05:11 -0700 (PDT) Received: by mail-wm1-x32f.google.com with SMTP id bg9-20020a05600c3c8900b003bf249616b0so711763wmb.3 for ; Wed, 05 Oct 2022 05:05:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=Azv6wQXNpWBikFZ7YedVEP87aeuLGrZzJ94JVNBlROE=; b=f90XW/FBL9NtLBkODgOXxXHX4h9e4N/xXi1axs9BvYKOZhD/z6FKv0bAAl6gnA/jW5 v5iQoxypoqOwNC9M6UIvrxKOhLOdYI/a51iuFvK6Z0F0ilyTtjlHduHjFhnV5fKz03gk d1TPTZfc56xoioo1jRYZN1Acd3/toSPreMfURAzVaqk/GroerPdop4zSDPVdbfploZFw hT2MZktT7EWYkjpqaZhaJqZ46Zy49aDPctTyK2CAwUeLvn10aaoOYYws2ZIMWQA/mbev 4nROOv0yUvjPe90el/OfGjniLFG9PZdMf8Cl62cqUNFNZG/zLXC8xmMxG/twuZ7t2wXk MHyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=Azv6wQXNpWBikFZ7YedVEP87aeuLGrZzJ94JVNBlROE=; b=tBrqVAZz2ID07xUlM3ytrl93tTQ9QUYrL5hh7X/+AffmK2rH/+qpVEDpCLtTy6wPgk yYoh0SiwAOjIvplcaWcIimWsZqhzRZEBWq5GToeXMuEyk0tqasRqYFnnF4xvtnhvR3gR UKu9zyqMZO2WERd+zBKhBoBznFvrMh+KKhTZ14bSPQApiG6TK+TBc1WL+A1KhMDN8KpZ oy6IAJ6+0NqHeEPcxvzn0N5OV7/4iUIxJd8XJGowrJuJ4HA6FA2voPy9+m7rxJjDFu1d EYsLrjh97nr8ov2kV4F03AqwDUh/2Q3h6kK/GNq0IQZnUUOXXsn+Wz9pexk7lZ4TteO6 fzcg== X-Gm-Message-State: ACrzQf1Kaj6RJHlqm2lqzuJmAntjIA2VKKQkC9EwQq/PMISi4qwvGxYr CdGr0/g2E48jF8fhhd4Te0c/Ug== X-Google-Smtp-Source: AMsMyM4s7dO6DMyD3zAQ4zh4Dxzr3zHUcwFyK/2oKhuJWIrnJOJH/wvIkKi/wYe4u1xxGdDO0fhyBg== X-Received: by 2002:a7b:c4c2:0:b0:3b4:fdc4:6df9 with SMTP id g2-20020a7bc4c2000000b003b4fdc46df9mr3012311wmk.123.1664971509676; Wed, 05 Oct 2022 05:05:09 -0700 (PDT) Received: from localhost.localdomain (laubervilliers-658-1-213-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.googlemail.com with ESMTPSA id v16-20020a5d6790000000b0022e3e7813f0sm7799583wru.107.2022.10.05.05.05.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Oct 2022 05:05:09 -0700 (PDT) From: Corentin Labbe To: davem@davemloft.net, edumazet@google.com, khalasa@piap.pl, kuba@kernel.org, pabeni@redhat.com Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Corentin Labbe Subject: [PATCH 3/4] net: ethernet: xscale: remove assignment in if condition Date: Wed, 5 Oct 2022 12:05:00 +0000 Message-Id: <20221005120501.3527435-3-clabbe@baylibre.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221005120501.3527435-1-clabbe@baylibre.com> References: <20221005120501.3527435-1-clabbe@baylibre.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Fix checkpatch error about "do not use assignment in if condition"; Signed-off-by: Corentin Labbe --- drivers/net/ethernet/xscale/ixp4xx_eth.c | 36 ++++++++++++++++-------- 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/drivers/net/ethernet/xscale/ixp4xx_eth.c b/drivers/net/ethernet/xscale/ixp4xx_eth.c index b4539dd2cfe4..11e5c00f638d 100644 --- a/drivers/net/ethernet/xscale/ixp4xx_eth.c +++ b/drivers/net/ethernet/xscale/ixp4xx_eth.c @@ -540,7 +540,8 @@ static int ixp4xx_mdio_register(struct eth_regs __iomem *regs) { int err; - if (!(mdio_bus = mdiobus_alloc())) + mdio_bus = mdiobus_alloc(); + if (!mdio_bus) return -ENOMEM; mdio_regs = regs; @@ -631,7 +632,8 @@ static inline int queue_get_desc(unsigned int queue, struct port *port, u32 phys, tab_phys, n_desc; struct desc *tab; - if (!(phys = qmgr_get_entry(queue))) + phys = qmgr_get_entry(queue); + if (!phys) return -1; phys &= ~0x1F; /* mask out non-address bits */ @@ -698,7 +700,8 @@ static int eth_poll(struct napi_struct *napi, int budget) u32 phys; #endif - if ((n = queue_get_desc(rxq, port, 0)) < 0) { + n = queue_get_desc(rxq, port, 0); + if (n < 0) { #if DEBUG_RX netdev_dbg(dev, "%s napi_complete\n", __func__); #endif @@ -722,7 +725,8 @@ static int eth_poll(struct napi_struct *napi, int budget) desc = rx_desc_ptr(port, n); #ifdef __ARMEB__ - if ((skb = netdev_alloc_skb(dev, RX_BUFF_SIZE))) { + skb = netdev_alloc_skb(dev, RX_BUFF_SIZE); + if (skb) { phys = dma_map_single(&dev->dev, skb->data, RX_BUFF_SIZE, DMA_FROM_DEVICE); if (dma_mapping_error(&dev->dev, phys)) { @@ -860,7 +864,8 @@ static netdev_tx_t eth_xmit(struct sk_buff *skb, struct net_device *dev) #else offset = (uintptr_t)skb->data & 3; /* keep 32-bit alignment */ bytes = ALIGN(offset + len, 4); - if (!(mem = kmalloc(bytes, GFP_ATOMIC))) { + mem = kmalloc(bytes, GFP_ATOMIC); { + if (!mem) { dev_kfree_skb(skb); dev->stats.tx_dropped++; return NETDEV_TX_OK; @@ -1113,11 +1118,13 @@ static int init_queues(struct port *port) buffer_t *buff; /* skb or kmalloc()ated memory */ void *data; #ifdef __ARMEB__ - if (!(buff = netdev_alloc_skb(port->netdev, RX_BUFF_SIZE))) + buff = netdev_alloc_skb(port->netdev, RX_BUFF_SIZE); + if (!buff) return -ENOMEM; data = buff->data; #else - if (!(buff = kmalloc(RX_BUFF_SIZE, GFP_KERNEL))) + buff = kmalloc(RX_BUFF_SIZE, GFP_KERNEL); + if (!buff) return -ENOMEM; data = buff; #endif @@ -1220,10 +1227,12 @@ static int eth_open(struct net_device *dev) if (npe_send_recv_message(port->npe, &msg, "ETH_SET_FIREWALL_MODE")) return -EIO; - if ((err = request_queues(port)) != 0) + err = request_queues(port); + if (err != 0) return err; - if ((err = init_queues(port)) != 0) { + err = init_queues(port); + if (err != 0) { destroy_queues(port); release_queues(port); return err; @@ -1442,7 +1451,8 @@ static int ixp4xx_eth_probe(struct platform_device *pdev) if (!plat) return -ENODEV; - if (!(ndev = devm_alloc_etherdev(dev, sizeof(struct port)))) + ndev = devm_alloc_etherdev(dev, sizeof(struct port)); + if (!ndev) return -ENOMEM; SET_NETDEV_DEV(ndev, dev); @@ -1479,7 +1489,8 @@ static int ixp4xx_eth_probe(struct platform_device *pdev) netif_napi_add_weight(ndev, &port->napi, eth_poll, NAPI_WEIGHT); - if (!(port->npe = npe_request(NPE_ID(port->id)))) + port->npe = npe_request(NPE_ID(port->id)); + if (!port->npe) return -EIO; port->plat = plat; @@ -1506,7 +1517,8 @@ static int ixp4xx_eth_probe(struct platform_device *pdev) phydev->irq = PHY_POLL; - if ((err = register_netdev(ndev))) + err = register_netdev(ndev); + if (err) goto err_phy_dis; netdev_info(ndev, "%s: MII PHY %i on %s\n", ndev->name, plat->phy, From patchwork Wed Oct 5 12:05:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin LABBE X-Patchwork-Id: 12999194 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 225ABC433FE for ; Wed, 5 Oct 2022 12:05:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230055AbiJEMFU (ORCPT ); Wed, 5 Oct 2022 08:05:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229969AbiJEMFN (ORCPT ); Wed, 5 Oct 2022 08:05:13 -0400 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C44CB29352 for ; Wed, 5 Oct 2022 05:05:11 -0700 (PDT) Received: by mail-wm1-x32c.google.com with SMTP id 130-20020a1c0288000000b003b494ffc00bso934113wmc.0 for ; Wed, 05 Oct 2022 05:05:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=LRX7GpLdgFvRfe1C5DKcxd/ZrRqJlQC6DhuQ385RIqQ=; b=wY/qUjaA3apGo0Gn3YoQSlP+i/rJrR6NFQzrjw3Ks9dgh1lZdAbtAA02eY3deSRwJu YwX3UF9uJO+wgUbNA/sCaSgvKK1/8+rkenZVDL/cSEtKA9loqiZ8YM8qUm4p7Y1Jst7K mhw/UWardrSVYcqSH5GO2QtYAsEKAmcHgiaZ05pGz0vclD0jBFb/svUHz3Yc1SSUYJVt Q8iQjM4gmHtH72gcm4ukqE5qjDpBHpF1NUK3xlW0QddylLtLK13WG/BB/fjJZOXYfuFr rknTWHsL7IpSCfhU+IadnVmo0CAecCa2pXlSHqQxXeqJIZBdGgvODgxR97aXBxJsQjhM kHDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=LRX7GpLdgFvRfe1C5DKcxd/ZrRqJlQC6DhuQ385RIqQ=; b=UHftdz+H3im7Sq0VsqE8y7sQoE+KRWKs+NoduK2rguEcY13UauxKfwTclKy2oQAKeN NFKZcEOo46yldRroI26rPE0pOeeUe4OsTLsz+uGZGr2jjBEvTDPizQG5cIYMp6aTgR35 lc6r0Ccl17f2kwOb7yXO0lCpgvYlkLqPezokqXgBc/koGft6huO3x0+4gp8TjXSq9ZXV R4gBdrqXtLfweB9FvEDmPkCtIM9kVSINryoCICqw65wrPmAarkthR0OgfrrdLK6E6Ilt XGQDkBBVPl62jaLBP33q4O45JPFW+xjrEKXAq1+jZkZOz6HQyQjdxLnp7SQFIXwVGzMd THHA== X-Gm-Message-State: ACrzQf0x2ugo28LNlpGQ9N4alTvBmYS0CvjhyS0xiaD2+XE0jnkgOBjz U3TTnwXyM8Zl7v75Q3zY9j6WWw== X-Google-Smtp-Source: AMsMyM7Yk3vdlh17NVAK2oPOvU3tuGQHb5qFBVbuApIzXz+EL8rx7HRn0PP3bIYV5aleBURRZ57r2Q== X-Received: by 2002:a05:600c:1c19:b0:3b4:c1cb:d46d with SMTP id j25-20020a05600c1c1900b003b4c1cbd46dmr3055730wms.172.1664971510379; Wed, 05 Oct 2022 05:05:10 -0700 (PDT) Received: from localhost.localdomain (laubervilliers-658-1-213-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.googlemail.com with ESMTPSA id v16-20020a5d6790000000b0022e3e7813f0sm7799583wru.107.2022.10.05.05.05.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Oct 2022 05:05:10 -0700 (PDT) From: Corentin Labbe To: davem@davemloft.net, edumazet@google.com, khalasa@piap.pl, kuba@kernel.org, pabeni@redhat.com Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Corentin Labbe Subject: [PATCH 4/4] net: ethernet: xscale: fix easy remaining style issues Date: Wed, 5 Oct 2022 12:05:01 +0000 Message-Id: <20221005120501.3527435-4-clabbe@baylibre.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221005120501.3527435-1-clabbe@baylibre.com> References: <20221005120501.3527435-1-clabbe@baylibre.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Fix all easy remaining styles issues. Signed-off-by: Corentin Labbe --- drivers/net/ethernet/xscale/ixp4xx_eth.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/xscale/ixp4xx_eth.c b/drivers/net/ethernet/xscale/ixp4xx_eth.c index 11e5c00f638d..f3732b67cc44 100644 --- a/drivers/net/ethernet/xscale/ixp4xx_eth.c +++ b/drivers/net/ethernet/xscale/ixp4xx_eth.c @@ -356,8 +356,7 @@ static void ixp_tx_timestamp(struct port *port, struct sk_buff *skb) regs = port->timesync_regs; - /* - * This really stinks, but we have to poll for the Tx time stamp. + /* This really stinks, but we have to poll for the Tx time stamp. * Usually, the time stamp is ready after 4 to 6 microseconds. */ for (cnt = 0; cnt < 100; cnt++) { @@ -653,7 +652,8 @@ static inline void queue_put_desc(unsigned int queue, u32 phys, BUG_ON(phys & 0x1F); qmgr_put_entry(queue, phys); /* Don't check for queue overflow here, we've allocated sufficient - length and queues >= 32 don't support this check anyway. */ + * length and queues >= 32 don't support this check anyway. + */ } static inline void dma_unmap_tx(struct port *port, struct desc *desc) @@ -893,7 +893,8 @@ static netdev_tx_t eth_xmit(struct sk_buff *skb, struct net_device *dev) port->tx_buff_tab[n] = mem; #endif desc->data = phys + offset; - desc->buf_len = desc->pkt_len = len; + desc->buf_len = len; + desc->pkt_len = len; /* NPE firmware pads short frames with zeros internally */ wmb(); @@ -941,7 +942,7 @@ static void eth_set_mcast_list(struct net_device *dev) __raw_writel(allmulti[i], &port->regs->mcast_mask[i]); } __raw_writel(DEFAULT_RX_CNTRL0 | RX_CNTRL0_ADDR_FLTR_EN, - &port->regs->rx_control[0]); + &port->regs->rx_control[0]); return; } @@ -1321,7 +1322,8 @@ static int eth_close(struct net_device *dev) BUG_ON(n < 0); desc = tx_desc_ptr(port, n); phys = tx_desc_phys(port, n); - desc->buf_len = desc->pkt_len = 1; + desc->buf_len = 1; + desc->pkt_len = 1; wmb(); queue_put_desc(TX_QUEUE(port->id), phys, desc); }