From nobody Tue Nov 26 22:40:11 2024 Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 48ED21B6CF4; Tue, 15 Oct 2024 20:02:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729022550; cv=none; b=BuG+CfuwkzR1ZXFk/NhUH9cwhlISSf6YWhZmMcL0siU5KL42mkC7521zb3N2fXS1cfkFrVoF2Na8BCpluXnxfTLIsoIeoEyTxGpSmQBlaIuWkzAO/kXjICLTPbEnYEGGIshh6ccks1xE+7v6lBsYuLGY7pXZZ++Na7TRwu/Dvk4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729022550; c=relaxed/simple; bh=MpPzqbf3QaeIL408JP0EEziCl+Tb8FH98+72eTKTBUI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AkS0Ud5BRasPOoJNsFPTZlhw9/G6dby8XabWy/2WeIqro3Fko5NM3wzsFcpNlFaCjvGiFaFlt8mi5BYLQ2zlJPxo1Lr4y3n6d/njlEiB45cDjVKOzMRAM72oV/37s6swCELA0OiqDeYz+kpYn3JoHA9YLhJhf6I9pRs8df4FfHM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=kz87yrYP; arc=none smtp.client-ip=209.85.210.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="kz87yrYP" Received: by mail-pf1-f180.google.com with SMTP id d2e1a72fcca58-71e681bc315so158083b3a.0; Tue, 15 Oct 2024 13:02:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729022547; x=1729627347; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=2Skv/FwWiqOmJCmi289YOKQkgyeCp5KZu2TwCeimUcA=; b=kz87yrYP9tDoFFBoNEszKKnVhxroXDVsp21PlIlVlBWkUBNYiCy+Q5kDF0GFZx2aV8 RPFcF89M7HW1/mneT9bAI/xkdjvbdQaf1MZLwXHyDAasGLtY1aDV90fhBQR78URVCH+I hXU0R5gF7CiTrlXiVHwcds0bnYyU35tpo/pPj5BL+HfoXQqHRBWqjp8z0XhCeqVBj+pZ hacTHWF3LLK/7wWOomxs24DroDQ7dLgUtbcR+zcoqSPMlGvYz6DTsFPmYSjouHausNg3 sUO6i/TuzRovgoL/JGg3xBJmiGxGnmXnQHK8Qu/NuHmADV9Z/82SFKPVEgllLgmIRGd9 CaxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729022547; x=1729627347; 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:message-id:reply-to; bh=2Skv/FwWiqOmJCmi289YOKQkgyeCp5KZu2TwCeimUcA=; b=BOFMq+QUKy7pW236mBwUYLVFfT3Z6arPhAEfpa3NjSCDEwKPS5Hi80mlg4pMY7kW56 LtUDTZFzH4kr7bAk5wbH4jRGIrmENUOsZbW3tX4qqvlc/1h2meqnOFIi9JuWUvco0kK/ tPHZ2wlcb7lKNeE1JP2mvHDtuj6DRFJsgHVNGVVAycd9tUidFbJ+Z6gmUez/+S8rjIWv 1MwzjHZ09KuX5sPfYE3ebIS7MT34V+0Z1a/uVbXy6LwxddeO6pEOFNgyXJktx4BqJRuH JOENtWo0L2rxtz7Z9TpXC1h7ofkjdO8b0yzK+2QJuzaiz6DjGLHHvIgC5sy3hr/x1D21 xGTA== X-Forwarded-Encrypted: i=1; AJvYcCWXBCQILHOTYOciLttxJa9EAZX0keCq7sSFZ65LAmeobFA02ePhMSBXT9sZI1B9qSrChHKCgBzquvwbly/L8V1GGNg=@vger.kernel.org, AJvYcCXksJFFgwav12ebv02HP377v2no9Sqhz6aiZL/FpG6Zl0UL5M+KEQYpYR3K/7quNTIFktUeQwvgLtNgocg=@vger.kernel.org X-Gm-Message-State: AOJu0YwmhrdrDMdpwkbvrGIBiH8omfD8xLNGuTrw/cv0Cx625DrJUID8 WWYVh/s1p1MWhheQi7WngyaoaLstTPdlew296iOti0GkKQZ1iZMfTAGYQ6Ou X-Google-Smtp-Source: AGHT+IEQnw7F9c7Ey8W9o134olUzK03vIKaAJnu+pqnhlh9tRdXyW3YGwXlQQhzrHqsD0mCukl7z1g== X-Received: by 2002:a05:6a00:8c2:b0:71e:6f09:c0a8 with SMTP id d2e1a72fcca58-71e7d7f0e50mr2802760b3a.10.1729022547232; Tue, 15 Oct 2024 13:02:27 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71e77518a1csm1690163b3a.187.2024.10.15.13.02.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Oct 2024 13:02:26 -0700 (PDT) From: Rosen Penev To: netdev@vger.kernel.org Cc: Florian Fainelli , Andrew Lunn , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Kurt Kanzenbach , Woojung Huh , UNGLinuxDriver@microchip.com (maintainer:MICROCHIP KSZ SERIES ETHERNET SWITCH DRIVER), =?UTF-8?q?Cl=C3=A9ment=20L=C3=A9ger?= , George McCollister , Richard Cochran , Rosen Penev , Simon Horman , Jacob Keller , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Breno Leitao , linux-kernel@vger.kernel.org (open list), linux-renesas-soc@vger.kernel.org (open list:RENESAS RZ/N1 A5PSW SWITCH DRIVER) Subject: [PATCHv7 net-next 1/6] net: ibm: emac: use netif_receive_skb_list Date: Tue, 15 Oct 2024 13:02:15 -0700 Message-ID: <20241015200222.12452-2-rosenp@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241015200222.12452-1-rosenp@gmail.com> References: <20241015200222.12452-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Small rx improvement. Would use napi_gro_receive instead but that's a lot more involved than netif_receive_skb_list because of how the function is implemented. Before: > iperf -c 192.168.1.1 Reviewed-by: Simon Horman ------------------------------------------------------------ Client connecting to 192.168.1.1, TCP port 5001 TCP window size: 16.0 KByte (default) ------------------------------------------------------------ [ 1] local 192.168.1.101 port 51556 connected with 192.168.1.1 port 5001 [ ID] Interval Transfer Bandwidth [ 1] 0.00-10.04 sec 559 MBytes 467 Mbits/sec > iperf -c 192.168.1.1 ------------------------------------------------------------ Client connecting to 192.168.1.1, TCP port 5001 TCP window size: 16.0 KByte (default) ------------------------------------------------------------ [ 1] local 192.168.1.101 port 48228 connected with 192.168.1.1 port 5001 [ ID] Interval Transfer Bandwidth [ 1] 0.00-10.03 sec 558 MBytes 467 Mbits/sec > iperf -c 192.168.1.1 ------------------------------------------------------------ Client connecting to 192.168.1.1, TCP port 5001 TCP window size: 16.0 KByte (default) ------------------------------------------------------------ [ 1] local 192.168.1.101 port 47600 connected with 192.168.1.1 port 5001 [ ID] Interval Transfer Bandwidth [ 1] 0.00-10.04 sec 557 MBytes 466 Mbits/sec > iperf -c 192.168.1.1 ------------------------------------------------------------ Client connecting to 192.168.1.1, TCP port 5001 TCP window size: 16.0 KByte (default) ------------------------------------------------------------ [ 1] local 192.168.1.101 port 37252 connected with 192.168.1.1 port 5001 [ ID] Interval Transfer Bandwidth [ 1] 0.00-10.05 sec 559 MBytes 467 Mbits/sec After: > iperf -c 192.168.1.1 ------------------------------------------------------------ Client connecting to 192.168.1.1, TCP port 5001 TCP window size: 16.0 KByte (default) ------------------------------------------------------------ [ 1] local 192.168.1.101 port 40786 connected with 192.168.1.1 port 5001 [ ID] Interval Transfer Bandwidth [ 1] 0.00-10.05 sec 572 MBytes 478 Mbits/sec > iperf -c 192.168.1.1 ------------------------------------------------------------ Client connecting to 192.168.1.1, TCP port 5001 TCP window size: 16.0 KByte (default) ------------------------------------------------------------ [ 1] local 192.168.1.101 port 52482 connected with 192.168.1.1 port 5001 [ ID] Interval Transfer Bandwidth [ 1] 0.00-10.04 sec 571 MBytes 477 Mbits/sec > iperf -c 192.168.1.1 ------------------------------------------------------------ Client connecting to 192.168.1.1, TCP port 5001 TCP window size: 16.0 KByte (default) ------------------------------------------------------------ [ 1] local 192.168.1.101 port 48370 connected with 192.168.1.1 port 5001 [ ID] Interval Transfer Bandwidth [ 1] 0.00-10.04 sec 572 MBytes 478 Mbits/sec > iperf -c 192.168.1.1 ------------------------------------------------------------ Client connecting to 192.168.1.1, TCP port 5001 TCP window size: 16.0 KByte (default) ------------------------------------------------------------ [ 1] local 192.168.1.101 port 46086 connected with 192.168.1.1 port 5001 [ ID] Interval Transfer Bandwidth [ 1] 0.00-10.05 sec 571 MBytes 476 Mbits/sec > iperf -c 192.168.1.1 ------------------------------------------------------------ Client connecting to 192.168.1.1, TCP port 5001 TCP window size: 16.0 KByte (default) ------------------------------------------------------------ [ 1] local 192.168.1.101 port 46062 connected with 192.168.1.1 port 5001 [ ID] Interval Transfer Bandwidth [ 1] 0.00-10.04 sec 572 MBytes 478 Mbits/sec Signed-off-by: Rosen Penev Reviewed-by: Simon Horman --- drivers/net/ethernet/ibm/emac/core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/ibm/emac/core.c b/drivers/net/ethernet/ib= m/emac/core.c index dadd987efb6b..0edcb435e62f 100644 --- a/drivers/net/ethernet/ibm/emac/core.c +++ b/drivers/net/ethernet/ibm/emac/core.c @@ -1727,6 +1727,7 @@ static inline int emac_rx_sg_append(struct emac_insta= nce *dev, int slot) /* NAPI poll context */ static int emac_poll_rx(void *param, int budget) { + LIST_HEAD(rx_list); struct emac_instance *dev =3D param; int slot =3D dev->rx_slot, received =3D 0; =20 @@ -1783,8 +1784,7 @@ static int emac_poll_rx(void *param, int budget) skb->protocol =3D eth_type_trans(skb, dev->ndev); emac_rx_csum(dev, skb, ctrl); =20 - if (unlikely(netif_receive_skb(skb) =3D=3D NET_RX_DROP)) - ++dev->estats.rx_dropped_stack; + list_add_tail(&skb->list, &rx_list); next: ++dev->stats.rx_packets; skip: @@ -1828,6 +1828,8 @@ static int emac_poll_rx(void *param, int budget) goto next; } =20 + netif_receive_skb_list(&rx_list); + if (received) { DBG2(dev, "rx %d BDs" NL, received); dev->rx_slot =3D slot; --=20 2.47.0 From nobody Tue Nov 26 22:40:11 2024 Received: from mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8B9741FAEE9; Tue, 15 Oct 2024 20:02:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729022554; cv=none; b=lgFPQjYlCxEykBfgZ+Aplb9eBE9FiJ9YEPjKiBQocLnzw9K+UMNvXgPzhLXgUfiPrT/u/sMagD5KB7qHXkWH0vr+TyX+hL/OYn17WaoVwvBdCrI4cjmc4V4oxRKMdFl86IZmSVlHjoVWH14AcexK1W6m1Z4ytqw5Y382xPMpvIY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729022554; c=relaxed/simple; bh=75JVrD24v16KjLTu54UYmfXIQ+t/gyyF/L1I/wcTerw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jlu/yQ9MnISsS3bX9c3oYyYTK2iE11wsTXOqZhqQvBg2piTaRqgNyaucroVkF6YdqCabstKp2q7rLQ2K8LrzoG8LTAkSBs78XbjLLX9WVwQvcxZVHSAfz0CsufZJ5lUbToig4OeWV2boDP7i9ajYclwQExu9tgEDw3tS+h2zyc8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=nduW39EU; arc=none smtp.client-ip=209.85.210.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="nduW39EU" Received: by mail-pf1-f169.google.com with SMTP id d2e1a72fcca58-71e49ad46b1so2582669b3a.1; Tue, 15 Oct 2024 13:02:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729022552; x=1729627352; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=TkbSsN14s7NiTNL86cW8tgPqYzNs0WYgisqP89WFaog=; b=nduW39EUN3KwgTsqBfaFkh5qjQ1Ojw/KWWmuP6hWPOVZ5QJFmDc5/M7D80kqGGLX/m dxevo/m194PYfLurV+M3gmYoD4L1RjXprG7l5laxtb9XZYaPaFQiN53lZLfOlDSu625z kxKwidbJXnTKESpBN1/x0UR+Rb+gzbXcmWIOlvUEoVbTB2M871n5uNUwlKA0YOrE8e/z eUTFqH2vadbecZ5FwF6sVTTVe+Ntn+drlyercyjPJc5cvuEBVoVyLxsYXau+yy4bvEoB oEP53KFp9eF52/QNsxXbTU1DFfqpR+E7+WI3dRJCRJ2OJr4OoTbBss7SmHdoiOCtn88E 1P/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729022552; x=1729627352; 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:message-id:reply-to; bh=TkbSsN14s7NiTNL86cW8tgPqYzNs0WYgisqP89WFaog=; b=DH6QEuDSVMTudCO4h1EnRPlk087yhapfwrLo0v2kighkIJv8CGOWpK2wdfA4cqwbjF qG2QU0Y/F2XxQLyBr42RecSHDg1hN5x2pDJFf89+IAqVirMjLMhatq8SxCtCeef8T4av OTJkmj63ITTjwrbD/ScGSYKLj7rSX7328hhVnUm5hL36JMyZaiUZE+SHaYjetgjs+Aew PhpvzF+6dbJNX9iSmwzl98wv51rwDcQAZWZ5kcW5s7GnbUS8pOR5SxoAN7LS09yup0WJ RzVkTmWviZM5EArJwwONJ3xJIL1L3lHljM4eyZGUxcKZjW+NA1uKcNjs+/bfEmYIQOx+ 9qFw== X-Forwarded-Encrypted: i=1; AJvYcCVjf7eqfrgLfX07QlEZj8zeG6Ua8TcHjAnP9ypnB0IeEyHfpSfA6dcwRpOVmYV8B5twylMxYiEGm/16Y14=@vger.kernel.org, AJvYcCXW+xOkwgFFbDhUVIzCiPeOmZL4Q8sh4vdtsunGjjkPSeB/E6kT5P+fyoTjaaYpmKpL55oCIPybXIqZisXMKGAYujA=@vger.kernel.org X-Gm-Message-State: AOJu0YyqmzE3MzvYlR8oaN1Konm4nHZJGvV0NK4zV2xx86MV6osx3kkr Kp+s7r3+UmJtVIcaTJUN8yVUvKEQdOfW0Q0zykurnQXZx0KnZqnG+HdqmQYP X-Google-Smtp-Source: AGHT+IHT8+OniKvnjQhdouXGEqLFDigw3s1Mfix2D1tSbPNsJEovnUG50aU0s6KNRSlJY5pCviJkng== X-Received: by 2002:a05:6a20:b2a8:b0:1d9:ae4:91ef with SMTP id adf61e73a8af0-1d90ae49d8cmr480037637.22.1729022551547; Tue, 15 Oct 2024 13:02:31 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71e77518a1csm1690163b3a.187.2024.10.15.13.02.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Oct 2024 13:02:31 -0700 (PDT) From: Rosen Penev To: netdev@vger.kernel.org Cc: Florian Fainelli , Andrew Lunn , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Kurt Kanzenbach , Woojung Huh , UNGLinuxDriver@microchip.com (maintainer:MICROCHIP KSZ SERIES ETHERNET SWITCH DRIVER), =?UTF-8?q?Cl=C3=A9ment=20L=C3=A9ger?= , George McCollister , Richard Cochran , Rosen Penev , Simon Horman , Jacob Keller , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Breno Leitao , linux-kernel@vger.kernel.org (open list), linux-renesas-soc@vger.kernel.org (open list:RENESAS RZ/N1 A5PSW SWITCH DRIVER) Subject: [PATCHv7 net-next 2/6] net: ibm: emac: remove custom init/exit functions Date: Tue, 15 Oct 2024 13:02:17 -0700 Message-ID: <20241015200222.12452-4-rosenp@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241015200222.12452-1-rosenp@gmail.com> References: <20241015200222.12452-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" commit c092d0be38f4 ("net: ibm: emac: remove all waiting code") introduced EPROBE_DEFER support. Because of that, we can defer initialization until all modules are ready instead of handling it explicitly with custom init/exit functions. As a consequence of removing explicit module initialization and deferring probe until everything is ready, there's no need for custom init and exit functions. There are now module_init and module_exit calls but no real change in functionality as these init and exit functions are no longer directly called by core. Signed-off-by: Rosen Penev Reviewed-by: Simon Horman --- drivers/net/ethernet/ibm/emac/core.c | 39 +-------------------------- drivers/net/ethernet/ibm/emac/mal.c | 10 +------ drivers/net/ethernet/ibm/emac/mal.h | 4 --- drivers/net/ethernet/ibm/emac/rgmii.c | 10 +------ drivers/net/ethernet/ibm/emac/rgmii.h | 4 --- drivers/net/ethernet/ibm/emac/tah.c | 10 +------ drivers/net/ethernet/ibm/emac/tah.h | 4 --- drivers/net/ethernet/ibm/emac/zmii.c | 10 +------ drivers/net/ethernet/ibm/emac/zmii.h | 4 --- 9 files changed, 5 insertions(+), 90 deletions(-) diff --git a/drivers/net/ethernet/ibm/emac/core.c b/drivers/net/ethernet/ib= m/emac/core.c index 0edcb435e62f..644abd37cfb4 100644 --- a/drivers/net/ethernet/ibm/emac/core.c +++ b/drivers/net/ethernet/ibm/emac/core.c @@ -3283,42 +3283,10 @@ static void __init emac_make_bootlist(void) =20 static int __init emac_init(void) { - int rc; - - printk(KERN_INFO DRV_DESC ", version " DRV_VERSION "\n"); - /* Build EMAC boot list */ emac_make_bootlist(); =20 - /* Init submodules */ - rc =3D mal_init(); - if (rc) - goto err; - rc =3D zmii_init(); - if (rc) - goto err_mal; - rc =3D rgmii_init(); - if (rc) - goto err_zmii; - rc =3D tah_init(); - if (rc) - goto err_rgmii; - rc =3D platform_driver_register(&emac_driver); - if (rc) - goto err_tah; - - return 0; - - err_tah: - tah_exit(); - err_rgmii: - rgmii_exit(); - err_zmii: - zmii_exit(); - err_mal: - mal_exit(); - err: - return rc; + return platform_driver_register(&emac_driver); } =20 static void __exit emac_exit(void) @@ -3327,11 +3295,6 @@ static void __exit emac_exit(void) =20 platform_driver_unregister(&emac_driver); =20 - tah_exit(); - rgmii_exit(); - zmii_exit(); - mal_exit(); - /* Destroy EMAC boot list */ for (i =3D 0; i < EMAC_BOOT_LIST_SIZE; i++) of_node_put(emac_boot_list[i]); diff --git a/drivers/net/ethernet/ibm/emac/mal.c b/drivers/net/ethernet/ibm= /emac/mal.c index c634534710d9..c66adb7f4e7a 100644 --- a/drivers/net/ethernet/ibm/emac/mal.c +++ b/drivers/net/ethernet/ibm/emac/mal.c @@ -781,12 +781,4 @@ static struct platform_driver mal_of_driver =3D { .remove =3D mal_remove, }; =20 -int __init mal_init(void) -{ - return platform_driver_register(&mal_of_driver); -} - -void mal_exit(void) -{ - platform_driver_unregister(&mal_of_driver); -} +module_platform_driver(mal_of_driver); diff --git a/drivers/net/ethernet/ibm/emac/mal.h b/drivers/net/ethernet/ibm= /emac/mal.h index e0ddc41186a2..2963b36be6f5 100644 --- a/drivers/net/ethernet/ibm/emac/mal.h +++ b/drivers/net/ethernet/ibm/emac/mal.h @@ -252,10 +252,6 @@ static inline int mal_has_feature(struct mal_instance = *dev, (MAL_FTRS_POSSIBLE & dev->features & feature); } =20 -/* Register MAL devices */ -int mal_init(void); -void mal_exit(void); - int mal_register_commac(struct mal_instance *mal, struct mal_commac *commac); void mal_unregister_commac(struct mal_instance *mal, diff --git a/drivers/net/ethernet/ibm/emac/rgmii.c b/drivers/net/ethernet/i= bm/emac/rgmii.c index 317c22d09172..f275ebeb7158 100644 --- a/drivers/net/ethernet/ibm/emac/rgmii.c +++ b/drivers/net/ethernet/ibm/emac/rgmii.c @@ -303,12 +303,4 @@ static struct platform_driver rgmii_driver =3D { .remove =3D rgmii_remove, }; =20 -int __init rgmii_init(void) -{ - return platform_driver_register(&rgmii_driver); -} - -void rgmii_exit(void) -{ - platform_driver_unregister(&rgmii_driver); -} +module_platform_driver(rgmii_driver); diff --git a/drivers/net/ethernet/ibm/emac/rgmii.h b/drivers/net/ethernet/i= bm/emac/rgmii.h index 8e4e36eed172..170bcd35039b 100644 --- a/drivers/net/ethernet/ibm/emac/rgmii.h +++ b/drivers/net/ethernet/ibm/emac/rgmii.h @@ -52,8 +52,6 @@ struct rgmii_instance { =20 #ifdef CONFIG_IBM_EMAC_RGMII =20 -int rgmii_init(void); -void rgmii_exit(void); int rgmii_attach(struct platform_device *ofdev, int input, int mode); void rgmii_detach(struct platform_device *ofdev, int input); void rgmii_get_mdio(struct platform_device *ofdev, int input); @@ -64,8 +62,6 @@ void *rgmii_dump_regs(struct platform_device *ofdev, void= *buf); =20 #else =20 -# define rgmii_init() 0 -# define rgmii_exit() do { } while(0) # define rgmii_attach(x,y,z) (-ENXIO) # define rgmii_detach(x,y) do { } while(0) # define rgmii_get_mdio(o,i) do { } while (0) diff --git a/drivers/net/ethernet/ibm/emac/tah.c b/drivers/net/ethernet/ibm= /emac/tah.c index c605c8ff933e..77e881efa598 100644 --- a/drivers/net/ethernet/ibm/emac/tah.c +++ b/drivers/net/ethernet/ibm/emac/tah.c @@ -161,12 +161,4 @@ static struct platform_driver tah_driver =3D { .remove =3D tah_remove, }; =20 -int __init tah_init(void) -{ - return platform_driver_register(&tah_driver); -} - -void tah_exit(void) -{ - platform_driver_unregister(&tah_driver); -} +module_platform_driver(tah_driver); diff --git a/drivers/net/ethernet/ibm/emac/tah.h b/drivers/net/ethernet/ibm= /emac/tah.h index 86c2b6b9d460..60c16cf7a41a 100644 --- a/drivers/net/ethernet/ibm/emac/tah.h +++ b/drivers/net/ethernet/ibm/emac/tah.h @@ -68,8 +68,6 @@ struct tah_instance { =20 #ifdef CONFIG_IBM_EMAC_TAH =20 -int tah_init(void); -void tah_exit(void); int tah_attach(struct platform_device *ofdev, int channel); void tah_detach(struct platform_device *ofdev, int channel); void tah_reset(struct platform_device *ofdev); @@ -78,8 +76,6 @@ void *tah_dump_regs(struct platform_device *ofdev, void *= buf); =20 #else =20 -# define tah_init() 0 -# define tah_exit() do { } while(0) # define tah_attach(x,y) (-ENXIO) # define tah_detach(x,y) do { } while(0) # define tah_reset(x) do { } while(0) diff --git a/drivers/net/ethernet/ibm/emac/zmii.c b/drivers/net/ethernet/ib= m/emac/zmii.c index 03bab3f95fe4..211e843fdc7e 100644 --- a/drivers/net/ethernet/ibm/emac/zmii.c +++ b/drivers/net/ethernet/ibm/emac/zmii.c @@ -309,12 +309,4 @@ static struct platform_driver zmii_driver =3D { .remove =3D zmii_remove, }; =20 -int __init zmii_init(void) -{ - return platform_driver_register(&zmii_driver); -} - -void zmii_exit(void) -{ - platform_driver_unregister(&zmii_driver); -} +module_platform_driver(zmii_driver); diff --git a/drivers/net/ethernet/ibm/emac/zmii.h b/drivers/net/ethernet/ib= m/emac/zmii.h index 65daedc78594..213de06d8ea2 100644 --- a/drivers/net/ethernet/ibm/emac/zmii.h +++ b/drivers/net/ethernet/ibm/emac/zmii.h @@ -48,8 +48,6 @@ struct zmii_instance { =20 #ifdef CONFIG_IBM_EMAC_ZMII =20 -int zmii_init(void); -void zmii_exit(void); int zmii_attach(struct platform_device *ofdev, int input, phy_interface_t *mode); void zmii_detach(struct platform_device *ofdev, int input); @@ -60,8 +58,6 @@ int zmii_get_regs_len(struct platform_device *ocpdev); void *zmii_dump_regs(struct platform_device *ofdev, void *buf); =20 #else -# define zmii_init() 0 -# define zmii_exit() do { } while(0) # define zmii_attach(x,y,z) (-ENXIO) # define zmii_detach(x,y) do { } while(0) # define zmii_get_mdio(x,y) do { } while(0) --=20 2.47.0 From nobody Tue Nov 26 22:40:11 2024 Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 78CB51FBF6A; Tue, 15 Oct 2024 20:02:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729022556; cv=none; b=TEdMH8ensv+m8DvK53n5qfxnAJc4r8fENNV/OGo61++ELudNeIj/nR3mDnZqGd/yGb6RqdZVyVrVKEFeWjXxoAHfMkt8C3c7A7sujMZ4vardM6nIbbLXVkg6fFUdFwrJE4uwcoUpXtzcllhKuoekcPSnbBTQuOg3pJh9gO4A0fw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729022556; c=relaxed/simple; bh=kpfwe+fvowXcGzmJqpdKyJMDtf4fb+tX8OFMZdBRE3k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OPkZX4Dnk4bDst5dw2geXA6GbCe9/1zLTeGE2nX9PbZ8YTpWzO8oV1g198tj2WtJ8350PhRIDgsZjFZOpVxkThUpyStHTG6H2Buj0PliUjkmROB8vpi26gcKx5EoITtHENzAk7h+TwhsQagwk4jK1fr61Al2tS+V07bsAtppMAI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=HWo4tPMl; arc=none smtp.client-ip=209.85.210.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="HWo4tPMl" Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-71e79f73aaeso627863b3a.3; Tue, 15 Oct 2024 13:02:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729022554; x=1729627354; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=2a9VUDfAgcqpZiCfPNq4jXdzK+N7TPauvAcKBYTOtR4=; b=HWo4tPMlc2JWSwqeqSGJW0W3B2OZLd2gFXQzZi7eVzHcrYkYWJR6x9ZTFo4NVj+QvI Vyaa+go3tLPUkmCBGfFJDZENXEQw/nkqdVSdgiBx+rsEEggspDsR/z3GZR1+EDQlno70 8RSx6TdL2IzPIqj4TUbRLwHEqQoEjOyk63QjXDJwgsT8aAoZyEhe0guzFbpSpOOKsqvk nO+Z9JQJ+vkeD/lzJORBp45omkeF0tIFKRBHUzIzpTD91/VfYIohQHoW5giPWNk2DkKg I1nIaI2SlusLhWHE8V3MFASLuEcKpKGWtjklaVyceAsQDQO4yqrj5C30fKuLWmsJXVub bT2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729022554; x=1729627354; 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:message-id:reply-to; bh=2a9VUDfAgcqpZiCfPNq4jXdzK+N7TPauvAcKBYTOtR4=; b=rxH3y3dfLSKbF46bqsfqcH016JwXMlnmX4dqIliVHa1vGxiG3ZloruFW4krsa/bFr8 0RkFMgsTf49brzqRG7NqE9gc/Sba4Ej48SeLzUZSlz10mAaRGPMmiFjPR5FOb+vFx9cM IVnaIVo6H6SEPupZH8JBA5gNisdaq07xZr3vGfOc9zbGtqkuKobJdl1qnqN4SLPTHHk1 pHeUCE/Cq89mXrVwNG9RDuvISH/wB8BUcCcsgl02YrYZsHhON5OeFVwHD7eyMK4+ekv1 XYCQUlG2V/DVm0y4nNe249d7mzQxRp6JIDfnkGVqQTtifp87mw2CU6D8oELDla7KBrhJ YgFQ== X-Forwarded-Encrypted: i=1; AJvYcCUy5TXA8ShDwEF56dVa4cXkE8+/pvuMF7e3w/WUKtkrk5ep5v/yE6NPjSj6j0ns8iV+QIBlGk1Rq6hG22c=@vger.kernel.org, AJvYcCXFS9/m0gZ//f0ERhPjMdred42B46NEGkZ7LyuNYRuzEOhDbDJ1Nv1lk9y9IqnMcGxQwbYlU6fFukdfRtOQT6k5x2M=@vger.kernel.org X-Gm-Message-State: AOJu0YyMh9dWLUn7+j4dnkT1c25gpHPIWurs5lrF0FzFCG8jV1iLwswp 0XOFJrstbZDE24yLYq0KVR7RmuwpCfWZwGRhjTZ5p4SJ8DNoXnhsefrg//iA X-Google-Smtp-Source: AGHT+IELspwjwMAi6GQ1tPEVnlmyu5/Vbdj26aLViYHWoDdgTLetyOAF0oSQLCMTAUGIxqmJP1ABaw== X-Received: by 2002:a05:6a21:8cc8:b0:1d8:a759:525c with SMTP id adf61e73a8af0-1d905f63a39mr1581237637.39.1729022553614; Tue, 15 Oct 2024 13:02:33 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71e77518a1csm1690163b3a.187.2024.10.15.13.02.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Oct 2024 13:02:33 -0700 (PDT) From: Rosen Penev To: netdev@vger.kernel.org Cc: Florian Fainelli , Andrew Lunn , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Kurt Kanzenbach , Woojung Huh , UNGLinuxDriver@microchip.com (maintainer:MICROCHIP KSZ SERIES ETHERNET SWITCH DRIVER), =?UTF-8?q?Cl=C3=A9ment=20L=C3=A9ger?= , George McCollister , Richard Cochran , Rosen Penev , Simon Horman , Jacob Keller , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Breno Leitao , linux-kernel@vger.kernel.org (open list), linux-renesas-soc@vger.kernel.org (open list:RENESAS RZ/N1 A5PSW SWITCH DRIVER) Subject: [PATCHv7 net-next 3/6] net: ibm: emac: use devm_platform_ioremap_resource Date: Tue, 15 Oct 2024 13:02:18 -0700 Message-ID: <20241015200222.12452-5-rosenp@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241015200222.12452-1-rosenp@gmail.com> References: <20241015200222.12452-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" No need to have a struct resource. Gets rid of the TODO. Signed-off-by: Rosen Penev Reviewed-by: Simon Horman --- drivers/net/ethernet/ibm/emac/core.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/ibm/emac/core.c b/drivers/net/ethernet/ib= m/emac/core.c index 644abd37cfb4..438b08e8e956 100644 --- a/drivers/net/ethernet/ibm/emac/core.c +++ b/drivers/net/ethernet/ibm/emac/core.c @@ -3050,12 +3050,10 @@ static int emac_probe(struct platform_device *ofdev) =20 ndev->irq =3D dev->emac_irq; =20 - /* Map EMAC regs */ - // TODO : platform_get_resource() and devm_ioremap_resource() - dev->emacp =3D devm_of_iomap(&ofdev->dev, np, 0, NULL); - if (!dev->emacp) { + dev->emacp =3D devm_platform_ioremap_resource(ofdev, 0); + if (IS_ERR(dev->emacp)) { dev_err(&ofdev->dev, "can't map device registers"); - err =3D -ENOMEM; + err =3D PTR_ERR(dev->emacp); goto err_gone; } =20 --=20 2.47.0 From nobody Tue Nov 26 22:40:11 2024 Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A75611FE0E8; Tue, 15 Oct 2024 20:02:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729022558; cv=none; b=n45E7bnOxNvHf93w/yRctOehCL3TR59i4BQsWzDKPdrEToglZxu/sMf7gwf53ba/25OAQXNOgR02PgR1SqCYTleDK3c8+5kMWyJ8IAbcYLbxRXJVaionTU30xtw4mb7aTrKYNmUXIDgJPP6/UDhwMjFBl4boX22mfnAe8nw+Rfs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729022558; c=relaxed/simple; bh=MxcjwNRsJEkibeU9qt9Ob1eMqP5pSgwTyK6ABqwj2lE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=afSF1QKkVEyg7shI9R+xU2y3vdAwFO/esPI8Uvmfi+vaIUi4L2IkFmK5GYTouttHVCesU0z2I38f/BHQyV5eN7YrAMx5uSJIvtGLWCL1kec81Q/PGY61GUuNIb8gkVA+oRCIJoYreYN9wlhfJJ8njyoLhRu6LTUKbuPUAlQwp90= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=emz5YJnd; arc=none smtp.client-ip=209.85.210.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="emz5YJnd" Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-71e5ae69880so2355705b3a.2; Tue, 15 Oct 2024 13:02:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729022556; x=1729627356; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ZQoU6YjRXNNAK08rrFMt8U2srpp4T9KT027SMoMKFg8=; b=emz5YJndoO6GuCdB3eZCSvMYU+TbGtE+D71NMcuJITL5XWfrJXTliUnWXFibx1f3dx 5LtMng9RzhNyKNsPDEHOgMwHDnxHqQJQ3nrrNzJjmuyJgqOMBQhr9mYXelWi/yURhleR U2LPk0neTgVtj/YydQ0zpI4I4uPECnOROmqUdpyHwTzva/kzIk5uOctxU1oxrC0vY3s0 9XRzvYBiWCTAgbA3M1+ChpymAxhXPAkyBqj/xq6iskZrLmLo2K2ZrHwOZnrkY+7UK06w kHf04g0y4uUYP5UMnbsBSs4cywua0d5IbYAgBPBr0ltYkeUtgFz4hrxirsnYcN5XFloi CLYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729022556; x=1729627356; 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:message-id:reply-to; bh=ZQoU6YjRXNNAK08rrFMt8U2srpp4T9KT027SMoMKFg8=; b=uKkB/Y5tuql4AvIHyktpHvvO6V77WArqQfCIv5EZwQJM7YynfkLcQvlYYEDQYtzpQ3 WprHwN+v4WSkE0YljFnTennYvTuanQfSX/v14Z2bfaM3a9vAhCA1c49jKnrKuPa5Hc15 C3FUtjRqWsM5wMJdPS1hd0f6olidkDm0EKLDLkgktlr7S3N7oFgEO78L6FPx8GCnAyQJ rK1NikT+l0nHnDdve8mqnea2p/IcdWUrLlVQdo0w6ZYt9OqQOye4rSE9tXo84eDfgdBh TogZ3b0+6zBTeL0dyKBo+Qk0tkqprrHcGsWkQaipM4068ZIDA6l6+me3DGXTUCvj/eQJ rydA== X-Forwarded-Encrypted: i=1; AJvYcCVi7vlq9GTQhAXNT+1bHQmdC//SdhBbDNsje3l3VkqQ3zk+DZwYp2/l1kbx/N8elswGMzMQRDfuPs5bbB/Quv6bhxQ=@vger.kernel.org, AJvYcCWryy4GQ6njJnzYPcaZ6cOu7Ux8cSUGuYrO+DNfNeu5O0tlK89jklRNi0afKOCK2Aa6vd5FNERWdxE+Sik=@vger.kernel.org X-Gm-Message-State: AOJu0Ywohu4Qf1bBimBbzgiabI67GKPgUy4LMwANYoU5IAO2i2SsA+RM 2lWj/xicoJhcadEiDoi+9oYY23Qfh4iVAgACWVrVsrV0jxXDbyIBPp4KG73E X-Google-Smtp-Source: AGHT+IEywEDsjqBaxDmLL/0uOwFhMks8HPSdKV76o0jiRzfmJgSM44EjZk2oiS/fIAzSoL7OLmtQSA== X-Received: by 2002:a05:6a00:4f8e:b0:71e:634e:fe0d with SMTP id d2e1a72fcca58-71e634eff2dmr12688917b3a.12.1729022555712; Tue, 15 Oct 2024 13:02:35 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71e77518a1csm1690163b3a.187.2024.10.15.13.02.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Oct 2024 13:02:35 -0700 (PDT) From: Rosen Penev To: netdev@vger.kernel.org Cc: Florian Fainelli , Andrew Lunn , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Kurt Kanzenbach , Woojung Huh , UNGLinuxDriver@microchip.com (maintainer:MICROCHIP KSZ SERIES ETHERNET SWITCH DRIVER), =?UTF-8?q?Cl=C3=A9ment=20L=C3=A9ger?= , George McCollister , Richard Cochran , Rosen Penev , Simon Horman , Jacob Keller , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Breno Leitao , linux-kernel@vger.kernel.org (open list), linux-renesas-soc@vger.kernel.org (open list:RENESAS RZ/N1 A5PSW SWITCH DRIVER) Subject: [PATCHv7 net-next 4/6] net: ibm: emac: use platform_get_irq Date: Tue, 15 Oct 2024 13:02:19 -0700 Message-ID: <20241015200222.12452-6-rosenp@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241015200222.12452-1-rosenp@gmail.com> References: <20241015200222.12452-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" No need for irq_of_parse_and_map since we have platform_device. Signed-off-by: Rosen Penev Reviewed-by: Simon Horman --- drivers/net/ethernet/ibm/emac/core.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/net/ethernet/ibm/emac/core.c b/drivers/net/ethernet/ib= m/emac/core.c index 438b08e8e956..f8478f0026af 100644 --- a/drivers/net/ethernet/ibm/emac/core.c +++ b/drivers/net/ethernet/ibm/emac/core.c @@ -3031,15 +3031,8 @@ static int emac_probe(struct platform_device *ofdev) if (err) goto err_gone; =20 - /* Get interrupts. EMAC irq is mandatory */ - dev->emac_irq =3D irq_of_parse_and_map(np, 0); - if (!dev->emac_irq) { - printk(KERN_ERR "%pOF: Can't map main interrupt\n", np); - err =3D -ENODEV; - goto err_gone; - } - /* Setup error IRQ handler */ + dev->emac_irq =3D platform_get_irq(ofdev, 0); err =3D devm_request_irq(&ofdev->dev, dev->emac_irq, emac_irq, 0, "EMAC", dev); if (err) { --=20 2.47.0 From nobody Tue Nov 26 22:40:11 2024 Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B37711F5859; Tue, 15 Oct 2024 20:02:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729022560; cv=none; b=PoeI4OoKN1gJks9z/hoWepC5S2L0mQ+IGmzZHOKB/uq7gzscqF7fgjj1I6qmxWH7kqVGxnqzH1LxFFXuHMsUuftpm3NG4DNURTIYo1AL09aLuIj93fGxd8jYzRDqpFPd75gg7RzH7FvgDNwqvqB21Hffh9/eTtOs7BUOuWfl4mU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729022560; c=relaxed/simple; bh=1cY2g8wmG1oo6pAhaNxYqbKxrPxrt5V9OGrm5OzdG8Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SC2kGa1Kp3tZR+qYvFEJe/9PrDMHk+S1lrcrQ+mNhr18YLIRXuGE4KRmgVgGbRnlx8m5jCxM+eKssrwyX4zMcWppeBILBPS9XcH1+wRYLDA68lt1WD75q9g4vWFUpPUIzs8tpXp+rz/+TqMuX4v9eHYz0LAPCnuBwWFQdUnk/Qk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=jaBs2570; arc=none smtp.client-ip=209.85.210.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="jaBs2570" Received: by mail-pf1-f180.google.com with SMTP id d2e1a72fcca58-71e483c83dbso3809674b3a.3; Tue, 15 Oct 2024 13:02:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729022558; x=1729627358; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=xg/AWmjc7rpXKjOckhX6UccKQoP1O8ZQP4gdZCQ8byU=; b=jaBs25704FedjHpT2wv5scFIbTLyxihsN0lghzy4R7oEZ3cTd540zhVoqXVDKClFQM aM/g2ZNcTE1nysf57merQCJF/KsLNxFrfmkFbB8rRf8h0PAvKdAWVRQLp4LuPbhDEEMF GuteCNMThiIclNU9Npd8n83nHpOsELi0MDQgg2LLMjbBI/YfFOKFYBDj+DCz+If5xaGj oToU8VbqvyKUBRh7Lpfq9LTpHAXnXfdHFeBxvuemeEF2WTNvhMdk2mQJcIP/Kr04TMxe AefKNqsWsN4SJk3h7roDJh9YkC+0/5RaEAMN8mabYjE0XQvk+XE1N+jngI18bL1zXqAw s0TA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729022558; x=1729627358; 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:message-id:reply-to; bh=xg/AWmjc7rpXKjOckhX6UccKQoP1O8ZQP4gdZCQ8byU=; b=qlwnf2u7gbzk1eDlXM8nz0hcLFFQW+ECldSYV3KZFy1zK10FvxlZjZGWUfTuVUOeRw Imlj9AEwIxqA+6yR8XewjLU0umIRoBSEMJvWp7gJxN3ZWFBbxp6U15LcO8VBVuzO+L6v FqavWP840qifA5+FK4J1NXDh/ieaCpBVlIcQa8HZrJSbgZjXbqIfvBKyRoMx6oGKYDjk ctwvuhWNaxAqon+J70UEO0HRcOAWImq/S0369pjkhK0YtzyCbpBlw0Zkw7c52sNlg9I+ dfk2DEQ0EZiRAabQZTkAsfO/FDQdUxagWUMdQJ+BcRN62WQmtDNEE4Ol0YOUbNy2198b quXA== X-Forwarded-Encrypted: i=1; AJvYcCVCZNYPCgLS2+rO1Y4sjCDV4GIdN8ZQpjNenOO6uUf/r7i+/Gb90cwI7CPwlv7IAx+N2ce7wqPwfAv6WbUEEsKz840=@vger.kernel.org, AJvYcCXxwDsF4M+yo+8S4ZcdQ59jcyVLu7Udpc1nG6X4KwWFBc65A+xQSuXPWLHral15h2vu1MhA1CLhqaQLhF4=@vger.kernel.org X-Gm-Message-State: AOJu0YxgSYJcMWtUW/SOzzaj0omQPNWXjaw7hRlEMnCCkz+4Rofw5Uun toi00vmXRGfMnnRQZd5c6u4meUKRGmUK09ElQK6+lsxYLSDp+xH+UWTgYf6s X-Google-Smtp-Source: AGHT+IHNDj6pz4SyLoJL5Rvt1Brm/2XJh5cX6NKapT51Fcpng6PQCjYAl6SfOsMq5VKgB7QOvN5R7w== X-Received: by 2002:a05:6a20:d818:b0:1cf:2a35:6d21 with SMTP id adf61e73a8af0-1d905f69115mr1898016637.45.1729022557723; Tue, 15 Oct 2024 13:02:37 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71e77518a1csm1690163b3a.187.2024.10.15.13.02.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Oct 2024 13:02:37 -0700 (PDT) From: Rosen Penev To: netdev@vger.kernel.org Cc: Florian Fainelli , Andrew Lunn , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Kurt Kanzenbach , Woojung Huh , UNGLinuxDriver@microchip.com (maintainer:MICROCHIP KSZ SERIES ETHERNET SWITCH DRIVER), =?UTF-8?q?Cl=C3=A9ment=20L=C3=A9ger?= , George McCollister , Richard Cochran , Rosen Penev , Simon Horman , Jacob Keller , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Breno Leitao , linux-kernel@vger.kernel.org (open list), linux-renesas-soc@vger.kernel.org (open list:RENESAS RZ/N1 A5PSW SWITCH DRIVER) Subject: [PATCHv7 net-next 5/6] net: ibm: emac: use devm for mutex_init Date: Tue, 15 Oct 2024 13:02:20 -0700 Message-ID: <20241015200222.12452-7-rosenp@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241015200222.12452-1-rosenp@gmail.com> References: <20241015200222.12452-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" It seems since inception that mutex_destroy was never called for these in _remove. Instead of handling this manually, just use devm for simplicity. Signed-off-by: Rosen Penev Reviewed-by: Simon Horman --- drivers/net/ethernet/ibm/emac/core.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/ibm/emac/core.c b/drivers/net/ethernet/ib= m/emac/core.c index f8478f0026af..3bea10624291 100644 --- a/drivers/net/ethernet/ibm/emac/core.c +++ b/drivers/net/ethernet/ibm/emac/core.c @@ -3021,8 +3021,14 @@ static int emac_probe(struct platform_device *ofdev) SET_NETDEV_DEV(ndev, &ofdev->dev); =20 /* Initialize some embedded data structures */ - mutex_init(&dev->mdio_lock); - mutex_init(&dev->link_lock); + err =3D devm_mutex_init(&ofdev->dev, &dev->mdio_lock); + if (err) + goto err_gone; + + err =3D devm_mutex_init(&ofdev->dev, &dev->link_lock); + if (err) + goto err_gone; + spin_lock_init(&dev->lock); INIT_WORK(&dev->reset_work, emac_reset_work); =20 --=20 2.47.0 From nobody Tue Nov 26 22:40:11 2024 Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CF2C21FF044; Tue, 15 Oct 2024 20:02:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729022562; cv=none; b=TJR4nqK87z/Yck8NmzJKVrGVjIeOM3m8QZS7yg6hFPAN+lCnGRqBQsDftwI+JG52kZ/PUN+QY8y1eOLjPs/kE1WGTBuyGwAJ53DDEOVkouyFkDCuoxkDViZrO/T7pPhvEgHfWtlEA0fc2mZxLxOeIAlLwGX407IhzkDuNmsQ/+w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729022562; c=relaxed/simple; bh=bk+3487l6q9TzfLOX73ymPMg2rI1oPjPCENy0GqRe+o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GxcQkY+MZjfRHuP18e65o4jSwHU6X7YrS8kut+nzBJoKLjJVhscohubCAMZwtjxROU3zpzoO8wLs1qY1FOhQPsodNNu2rAKrTCY6Sa3hRuAjeN8W7nq8dWguX/JXKoKq1JFauzMTYfSVTjbrybRi3YSSRTg6fPkHDwpQ/f540qY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=WYezYEl3; arc=none smtp.client-ip=209.85.210.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="WYezYEl3" Received: by mail-pf1-f180.google.com with SMTP id d2e1a72fcca58-71e4c2e36daso162115b3a.0; Tue, 15 Oct 2024 13:02:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729022560; x=1729627360; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=K2zTTCNmsBFr9AQAiKF1M8ZtwCExJpwgSSti0BgjQY0=; b=WYezYEl38GutEwI4875fOvafbOCAVaTxL9QThnIGNO7TM+YmDcGduPkYWdB7b0oLou i3G7ewyLL1T/RORUdhIH9dYEA0z7ZPUEIo20gvNCb5lv4bUlnR9Fu6suGLTkHgFQm8sj g4KPTMNwE7kqAd8mls1LT3+uNqt158p5llg2kgOxJVoC8ca9Id5SLGBqysXa3wXoVBT8 eVQdKCA0NzREWYDaZwjdzO+2kRuqJmW/+JHxUzuq/41nDY2xCZj1zP5o1mtqCRi9YO/f BqVCo05+KRT08q7xmJacdT/Tl+7GLhWrwbxxlV7cHZEeTYDImrWgnFg2gPbqdZ4dm+RX dHLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729022560; x=1729627360; 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:message-id:reply-to; bh=K2zTTCNmsBFr9AQAiKF1M8ZtwCExJpwgSSti0BgjQY0=; b=qVWI1Ry5dEVMjAmB0Xi37HdP1WijxXX9JmK0uDu2D6pOEWpxVjtH98Eo0C3bmW8lSf pAPeNEbbUZHoyGU//I5enHREeNcJ/R9rGfQc2LNZ66fQEJ+qBqM7Jr4XPrKDn2nKAYef zKcXUph4fztzr3h7gdmkNbf+Eoz8cgh6kIe2LZ08EdBEkO7gH1v6dKgJxBsvoCvUuzy9 GbegS+aSvsc2+YJAivBO/4LmEsGJVcsq3wIMNuOqJ34YC2MZdHaZiCs7shIsZoAG6Y/H mkV8ZBI5UBM46RhWj822NOSFK1tzqWLc1U7T7qAg8i2SBZVtrO6HzTQ7eY8Wpg6aXYA+ xUVQ== X-Forwarded-Encrypted: i=1; AJvYcCXAe0yLUmM8AHcNJD9w/ZDFcq7GIg+tg//BiVqUXq8n1JHI7MZBUndsQEZzQpIwjy/1KLkO2HTQrEJCJ24=@vger.kernel.org, AJvYcCXUcfmoh6lJrnzmiAl1Scqm8/vHG4xQ4w3cXU8m2yeECbrUkbN4iz6UEniNg/GqoE+4MtrLCO3/WC79/uJuciE0yJ4=@vger.kernel.org X-Gm-Message-State: AOJu0Yxsw1hPYrv02dUGSiYfYt5t/jYDw5juPU+CXM3bpOJ3P0egC9g6 2HuaZCcI/Fj9wgSscFt+Jx/0nk7uO+XG93NTMTUyc2OH231jBa5UzWT7wueI X-Google-Smtp-Source: AGHT+IE4PDveGExp+bQG/xt0ssoR3HWs/WP6wUGZmAnugEy0L9fjqD5Pj6SBoncfA1l4nIlJ0bUaSA== X-Received: by 2002:a05:6a20:c888:b0:1c8:de01:e7e5 with SMTP id adf61e73a8af0-1d8bc8c8c47mr19937000637.15.1729022559748; Tue, 15 Oct 2024 13:02:39 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71e77518a1csm1690163b3a.187.2024.10.15.13.02.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Oct 2024 13:02:39 -0700 (PDT) From: Rosen Penev To: netdev@vger.kernel.org Cc: Florian Fainelli , Andrew Lunn , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Kurt Kanzenbach , Woojung Huh , UNGLinuxDriver@microchip.com (maintainer:MICROCHIP KSZ SERIES ETHERNET SWITCH DRIVER), =?UTF-8?q?Cl=C3=A9ment=20L=C3=A9ger?= , George McCollister , Richard Cochran , Rosen Penev , Simon Horman , Jacob Keller , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Breno Leitao , linux-kernel@vger.kernel.org (open list), linux-renesas-soc@vger.kernel.org (open list:RENESAS RZ/N1 A5PSW SWITCH DRIVER) Subject: [PATCHv7 net-next 6/6] net: ibm: emac: generate random MAC if not found Date: Tue, 15 Oct 2024 13:02:21 -0700 Message-ID: <20241015200222.12452-8-rosenp@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241015200222.12452-1-rosenp@gmail.com> References: <20241015200222.12452-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" On this Cisco MX60W, u-boot sets the local-mac-address property. Unfortunately by default, the MAC is wrong and is actually located on a UBI partition. Which means nvmem needs to be used to grab it. In the case where that fails, EMAC fails to initialize instead of generating a random MAC as many other drivers do. Match behavior with other drivers to have a working ethernet interface. Signed-off-by: Rosen Penev Reviewed-by: Simon Horman --- drivers/net/ethernet/ibm/emac/core.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/ibm/emac/core.c b/drivers/net/ethernet/ib= m/emac/core.c index 3bea10624291..fb9adcc3a16d 100644 --- a/drivers/net/ethernet/ibm/emac/core.c +++ b/drivers/net/ethernet/ibm/emac/core.c @@ -2937,9 +2937,12 @@ static int emac_init_config(struct emac_instance *de= v) =20 /* Read MAC-address */ err =3D of_get_ethdev_address(np, dev->ndev); - if (err) - return dev_err_probe(&dev->ofdev->dev, err, - "Can't get valid [local-]mac-address from OF !\n"); + if (err =3D=3D -EPROBE_DEFER) + return err; + if (err) { + dev_warn(&dev->ofdev->dev, "Can't get valid mac-address. Generating rand= om."); + eth_hw_addr_random(dev->ndev); + } =20 /* IAHT and GAHT filter parameterization */ if (emac_has_feature(dev, EMAC_FTR_EMAC4SYNC)) { --=20 2.47.0 From nobody Tue Nov 26 22:40:11 2024 Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5FD8D1F5836; Tue, 15 Oct 2024 20:02:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729022552; cv=none; b=BePZSkqvsuBFUd2XeFyCkydY4AgkcW4Vnuny69bcDpK5HgUlpPQfL9tOD6pdoQwUkgZkd46rVEyTULegUPI+VTceZOEW/13utsREuybvaFlkKrbiNSsqGZauX/elpBGwumFopWi7YLwYEODDFOF/KmlfGa6lbBUwdAT1cidtGnY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729022552; c=relaxed/simple; bh=TQb2BDzVQuGXYXCviFcUoFwCJMnSpYzGGJ4UVh59etE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=T32c+ZGbXI7z9EyaFLN2qnhITSfE88MU12fKzR97z4ZVfcqXkV3aAH26EBbSXAiVDlfWX9ZOOw3FoNslSEnE8b9FiUUNVPK5zOz9zyDNvT+G+P60QINRQ77yNP/vVz/QIHX8Y03tvWqNxmJyzbh4yrh8TiQDsi9jdfEeR06M/6o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=i0ZpXkyR; arc=none smtp.client-ip=209.85.210.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="i0ZpXkyR" Received: by mail-pf1-f175.google.com with SMTP id d2e1a72fcca58-71e6f1a5a19so1481355b3a.3; Tue, 15 Oct 2024 13:02:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729022549; x=1729627349; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=PhK8TlC8OBuAKbLOpGav2a0vgjsHfERtSU7FB7P1BFg=; b=i0ZpXkyRPbY6rXsMrM3Xf8KYnlYhuMadRwu/0auOozAhfpF0J6I6wRE1uqslJ/MRfv 6HoX2s8CvF2ZjX8V/A0ThWSXnHhBDFSEMQeDG6uKPwmFAsBT40RL8KbzyTGbMrPvkglB 2yAlrVqp/OI9gLu1jVOKovJkxh+eTxG5O+muE1tjbrF4fohGzqoFM3meqc4pafIX9E5o 9VbAUPR08NyaUiHR5Ubz1JOfXiODBIjcCa/voW+j9Kiw9GyFIinnWy67kvg0Jrspumgi 6G+/6xe1HZwkF+vXAazxiAIyosjpOPAYAwGQkwODyb6Q1vdaJQDhcBwh1Cg3nyHfq/X9 gpoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729022549; x=1729627349; 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:message-id:reply-to; bh=PhK8TlC8OBuAKbLOpGav2a0vgjsHfERtSU7FB7P1BFg=; b=pgZ7/NaSa5uU45LlEOPBDejTFPqij9k/GIbns2bP0NSTgl2f2w8a4LpLqzspn6/ewg OJVuiYRVaNno7PObbO50bP+rVn+v5C/EtJEWhdRziGLmHnUVe6ncxnjhK/k7jXC2CZAF q+w6J+MHeQn+RpzS+bUtKAnt/25kFDibnCtHb12//ke0A3se0mAGzpVreoqXNu4laX+3 GMUKZ0UeCKEV2T6FOXrH7la6BfEE14qvhu8sMHoc+drBzC3ANHh0fYF3mbwrCufmdl7M 0rMv23c1iohYxUGR/Mmplm6v6QugqZouDEYF8UTWyCwG1OCZk5iik0VYsZZoxSiUku6q pn9Q== X-Forwarded-Encrypted: i=1; AJvYcCUqvI+kOq2e1MI366g9lgm0mutwkLvShYCESOCbCW2TJGn8d/sRTkI7uHUeuHNgf+Yxzds1ivdeaQ8Ows/tpYcoUHY=@vger.kernel.org, AJvYcCXQS5hWnH5YE9PEny/sj51yLmLrZ4NZwvoOHJ/LzYd28+Q3pLH9J2Q78esokXKCDDyj6lIHvWTyM17AcIc=@vger.kernel.org X-Gm-Message-State: AOJu0YyIl/h9oMUauBkYl4Hwz61knzYbcLg6+SuCKBV7+QuHsrbDGSZJ hOc7qxjtgsNokyTkueT/ZyzJkpC1UaR1C7ZglK9bGIe3pG3+dZCO6BIokc8R X-Google-Smtp-Source: AGHT+IFdb+mOanDwPwdfGBDDfu4cR0p5AHExBKddPFuKRxK36OkQ45CLIHQTxckxleQvezZKyq9dwg== X-Received: by 2002:a05:6a00:1818:b0:71e:688c:1edd with SMTP id d2e1a72fcca58-71e7db0d026mr2362171b3a.27.1729022549400; Tue, 15 Oct 2024 13:02:29 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71e77518a1csm1690163b3a.187.2024.10.15.13.02.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Oct 2024 13:02:29 -0700 (PDT) From: Rosen Penev To: netdev@vger.kernel.org Cc: Florian Fainelli , Andrew Lunn , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Kurt Kanzenbach , Woojung Huh , UNGLinuxDriver@microchip.com (maintainer:MICROCHIP KSZ SERIES ETHERNET SWITCH DRIVER), =?UTF-8?q?Cl=C3=A9ment=20L=C3=A9ger?= , George McCollister , Richard Cochran , Rosen Penev , Simon Horman , Jacob Keller , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Breno Leitao , linux-kernel@vger.kernel.org (open list), linux-renesas-soc@vger.kernel.org (open list:RENESAS RZ/N1 A5PSW SWITCH DRIVER) Subject: [PATCH] net: memcpy to ethtool_puts Date: Tue, 15 Oct 2024 13:02:16 -0700 Message-ID: <20241015200222.12452-3-rosenp@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241015200222.12452-1-rosenp@gmail.com> References: <20241015200222.12452-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The latter is the prefered way to copy ethtool strings. Transformed with the following coccinelle script: virtual org virtual report virtual context virtual patch @depends on patch@ expression E1, E2; identifier I; position p; @@ - memcpy@p(E1 + I * ETH_GSTRING_LEN, E2, ETH_GSTRING_LEN); + ethtool_puts(&E1, E2); Signed-off-by: Rosen Penev --- drivers/net/dsa/b53/b53_common.c | 3 +- drivers/net/dsa/bcm_sf2.c | 5 +- drivers/net/dsa/bcm_sf2_cfp.c | 17 ++-- drivers/net/dsa/hirschmann/hellcreek.c | 8 +- drivers/net/dsa/microchip/ksz_common.c | 3 +- drivers/net/dsa/mv88e6xxx/chip.c | 5 +- drivers/net/dsa/rzn1_a5psw.c | 3 +- drivers/net/dsa/sja1105/sja1105_ethtool.c | 7 +- drivers/net/dsa/xrs700x/xrs700x.c | 6 +- drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c | 22 +++--- drivers/net/ethernet/apm/xgene-v2/ethtool.c | 13 +--- .../ethernet/apm/xgene/xgene_enet_ethtool.c | 13 +--- drivers/net/ethernet/atheros/atlx/atl1.c | 8 +- .../ethernet/broadcom/asp2/bcmasp_ethtool.c | 5 +- drivers/net/ethernet/broadcom/bcm63xx_enet.c | 10 +-- drivers/net/ethernet/broadcom/bcmsysport.c | 16 ++-- drivers/net/ethernet/broadcom/bgmac.c | 3 +- .../net/ethernet/broadcom/genet/bcmgenet.c | 5 +- drivers/net/ethernet/cadence/macb_main.c | 19 ++--- drivers/net/ethernet/calxeda/xgmac.c | 9 +-- .../ethernet/cavium/liquidio/lio_ethtool.c | 50 +++++------- .../ethernet/cavium/thunder/nicvf_ethtool.c | 48 ++++-------- .../net/ethernet/cisco/enic/enic_ethtool.c | 40 ++++------ .../net/ethernet/emulex/benet/be_ethtool.c | 39 ++++------ drivers/net/ethernet/engleder/tsnep_ethtool.c | 32 ++++---- .../ethernet/freescale/dpaa/dpaa_ethtool.c | 38 +++------ .../ethernet/freescale/dpaa2/dpaa2-ethtool.c | 15 ++-- .../net/ethernet/freescale/dpaa2/dpaa2-mac.c | 7 +- .../freescale/dpaa2/dpaa2-switch-ethtool.c | 12 ++- .../ethernet/freescale/enetc/enetc_ethtool.c | 33 +++----- .../net/ethernet/freescale/gianfar_ethtool.c | 8 +- .../net/ethernet/freescale/ucc_geth_ethtool.c | 23 +++--- .../ethernet/hisilicon/hns/hns_dsaf_main.c | 66 ++++++---------- .../hns3/hns3_common/hclge_comm_tqp_stats.c | 6 +- .../ethernet/hisilicon/hns3/hns3_ethtool.c | 9 +-- .../hisilicon/hns3/hns3pf/hclge_main.c | 49 +++++------- drivers/net/ethernet/ibm/ibmveth.c | 4 +- drivers/net/ethernet/ibm/ibmvnic.c | 30 +++---- .../net/ethernet/intel/e1000/e1000_ethtool.c | 13 ++-- drivers/net/ethernet/intel/e1000e/ethtool.c | 13 ++-- drivers/net/ethernet/intel/igbvf/ethtool.c | 9 +-- drivers/net/ethernet/intel/ixgbevf/ethtool.c | 35 ++++----- .../net/ethernet/marvell/mvpp2/mvpp2_main.c | 38 +++------ .../marvell/octeon_ep/octep_ethtool.c | 34 +++----- .../marvell/octeon_ep_vf/octep_vf_ethtool.c | 37 ++++----- .../marvell/octeontx2/nic/otx2_ethtool.c | 78 +++++++------------ drivers/net/ethernet/marvell/skge.c | 3 +- drivers/net/ethernet/marvell/sky2.c | 3 +- .../mellanox/mlxsw/spectrum_ethtool.c | 77 +++++++----------- .../ethernet/mellanox/mlxsw/spectrum_ptp.c | 7 +- drivers/net/ethernet/micrel/ksz884x.c | 5 +- .../microchip/lan966x/lan966x_ethtool.c | 3 +- .../ethernet/microsoft/mana/mana_ethtool.c | 55 +++++-------- drivers/net/ethernet/mscc/ocelot_stats.c | 3 +- .../ethernet/netronome/nfp/nfp_net_ethtool.c | 3 +- .../oki-semi/pch_gbe/pch_gbe_ethtool.c | 8 +- .../qlogic/netxen/netxen_nic_ethtool.c | 10 +-- .../net/ethernet/qlogic/qede/qede_ethtool.c | 34 ++++---- .../ethernet/qlogic/qlcnic/qlcnic_ethtool.c | 49 +++++------- .../net/ethernet/qualcomm/emac/emac-ethtool.c | 7 +- drivers/net/ethernet/rocker/rocker_main.c | 7 +- .../ethernet/samsung/sxgbe/sxgbe_ethtool.c | 9 +-- drivers/net/ethernet/sfc/ethtool_common.c | 21 +++-- drivers/net/ethernet/sfc/falcon/ethtool.c | 14 ++-- drivers/net/ethernet/sfc/falcon/nic.c | 7 +- drivers/net/ethernet/sfc/nic.c | 7 +- .../net/ethernet/sfc/siena/ethtool_common.c | 25 +++--- drivers/net/ethernet/sfc/siena/nic.c | 7 +- .../ethernet/stmicro/stmmac/stmmac_ethtool.c | 60 ++++++-------- .../stmicro/stmmac/stmmac_selftests.c | 7 +- drivers/net/ethernet/sun/cassini.c | 6 +- .../ethernet/synopsys/dwc-xlgmac-ethtool.c | 8 +- drivers/net/ethernet/ti/am65-cpsw-ethtool.c | 20 ++--- drivers/net/ethernet/ti/cpsw_ethtool.c | 15 ++-- drivers/net/ethernet/ti/netcp_ethss.c | 7 +- drivers/net/fjes/fjes_ethtool.c | 52 +++++-------- drivers/net/phy/aquantia/aquantia_main.c | 3 +- drivers/net/phy/bcm-phy-lib.c | 3 +- drivers/net/usb/cdc_ncm.c | 8 +- drivers/net/xen-netback/interface.c | 3 +- drivers/net/xen-netfront.c | 3 +- net/dsa/user.c | 11 ++- 82 files changed, 550 insertions(+), 966 deletions(-) diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_com= mon.c index c39cb119e760..285785c942b0 100644 --- a/drivers/net/dsa/b53/b53_common.c +++ b/drivers/net/dsa/b53/b53_common.c @@ -989,8 +989,7 @@ void b53_get_strings(struct dsa_switch *ds, int port, u= 32 stringset, =20 if (stringset =3D=3D ETH_SS_STATS) { for (i =3D 0; i < mib_size; i++) - strscpy(data + i * ETH_GSTRING_LEN, - mibs[i].name, ETH_GSTRING_LEN); + ethtool_puts(&data, mibs[i].name); } else if (stringset =3D=3D ETH_SS_PHY_STATS) { phydev =3D b53_get_phy_device(ds, port); if (!phydev) diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c index 9201f07839ad..2bb1832d21bc 100644 --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c @@ -1180,11 +1180,8 @@ static const struct b53_io_ops bcm_sf2_io_ops =3D { static void bcm_sf2_sw_get_strings(struct dsa_switch *ds, int port, u32 stringset, uint8_t *data) { - int cnt =3D b53_get_sset_count(ds, port, stringset); - b53_get_strings(ds, port, stringset, data); - bcm_sf2_cfp_get_strings(ds, port, stringset, - data + cnt * ETH_GSTRING_LEN); + bcm_sf2_cfp_get_strings(ds, port, stringset, data); } =20 static void bcm_sf2_sw_get_ethtool_stats(struct dsa_switch *ds, int port, diff --git a/drivers/net/dsa/bcm_sf2_cfp.c b/drivers/net/dsa/bcm_sf2_cfp.c index c88ee3dd4299..8ba23e643a42 100644 --- a/drivers/net/dsa/bcm_sf2_cfp.c +++ b/drivers/net/dsa/bcm_sf2_cfp.c @@ -1284,22 +1284,15 @@ void bcm_sf2_cfp_get_strings(struct dsa_switch *ds,= int port, { struct bcm_sf2_priv *priv =3D bcm_sf2_to_priv(ds); unsigned int s =3D ARRAY_SIZE(bcm_sf2_cfp_stats); - char buf[ETH_GSTRING_LEN]; - unsigned int i, j, iter; + unsigned int i, j; =20 if (stringset !=3D ETH_SS_STATS) return; =20 - for (i =3D 1; i < priv->num_cfp_rules; i++) { - for (j =3D 0; j < s; j++) { - snprintf(buf, sizeof(buf), - "CFP%03d_%sCntr", - i, bcm_sf2_cfp_stats[j].name); - iter =3D (i - 1) * s + j; - strscpy(data + iter * ETH_GSTRING_LEN, - buf, ETH_GSTRING_LEN); - } - } + for (i =3D 1; i < priv->num_cfp_rules; i++) + for (j =3D 0; j < s; j++) + ethtool_sprintf(&data, "CFP%03d_%sCntr", i, + bcm_sf2_cfp_stats[j].name); } =20 void bcm_sf2_cfp_get_ethtool_stats(struct dsa_switch *ds, int port, diff --git a/drivers/net/dsa/hirschmann/hellcreek.c b/drivers/net/dsa/hirsc= hmann/hellcreek.c index d798f17cf7ea..283ec5a6e23c 100644 --- a/drivers/net/dsa/hirschmann/hellcreek.c +++ b/drivers/net/dsa/hirschmann/hellcreek.c @@ -294,12 +294,8 @@ static void hellcreek_get_strings(struct dsa_switch *d= s, int port, { int i; =20 - for (i =3D 0; i < ARRAY_SIZE(hellcreek_counter); ++i) { - const struct hellcreek_counter *counter =3D &hellcreek_counter[i]; - - strscpy(data + i * ETH_GSTRING_LEN, - counter->name, ETH_GSTRING_LEN); - } + for (i =3D 0; i < ARRAY_SIZE(hellcreek_counter); ++i) + ethtool_puts(&data, hellcreek_counter[i].name); } =20 static int hellcreek_get_sset_count(struct dsa_switch *ds, int port, int s= set) diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/micro= chip/ksz_common.c index 4e8710c7cb7b..408ccb1f012e 100644 --- a/drivers/net/dsa/microchip/ksz_common.c +++ b/drivers/net/dsa/microchip/ksz_common.c @@ -2113,8 +2113,7 @@ static void ksz_get_strings(struct dsa_switch *ds, in= t port, return; =20 for (i =3D 0; i < dev->info->mib_cnt; i++) { - memcpy(buf + i * ETH_GSTRING_LEN, - dev->info->mib_names[i].string, ETH_GSTRING_LEN); + ethtool_puts(&buf, dev->info->mib_names[i].string); } } =20 diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/c= hip.c index 69cf19d3dd5e..bc813d97afa7 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c @@ -1220,12 +1220,9 @@ static void mv88e6xxx_get_strings(struct dsa_switch = *ds, int port, if (chip->info->ops->stats_get_strings) count =3D chip->info->ops->stats_get_strings(chip, data); =20 - if (chip->info->ops->serdes_get_strings) { - data +=3D count * ETH_GSTRING_LEN; + if (chip->info->ops->serdes_get_strings) count =3D chip->info->ops->serdes_get_strings(chip, port, data); - } =20 - data +=3D count * ETH_GSTRING_LEN; mv88e6xxx_atu_vtu_get_strings(data); =20 mv88e6xxx_reg_unlock(chip); diff --git a/drivers/net/dsa/rzn1_a5psw.c b/drivers/net/dsa/rzn1_a5psw.c index 1135a32e4b7e..b3e127f64b08 100644 --- a/drivers/net/dsa/rzn1_a5psw.c +++ b/drivers/net/dsa/rzn1_a5psw.c @@ -803,8 +803,7 @@ static void a5psw_get_strings(struct dsa_switch *ds, in= t port, u32 stringset, return; =20 for (u =3D 0; u < ARRAY_SIZE(a5psw_stats); u++) { - memcpy(data + u * ETH_GSTRING_LEN, a5psw_stats[u].name, - ETH_GSTRING_LEN); + ethtool_puts(&data, a5psw_stats[u].name); } } =20 diff --git a/drivers/net/dsa/sja1105/sja1105_ethtool.c b/drivers/net/dsa/sj= a1105/sja1105_ethtool.c index decc6c931dc1..2ea64b1d026d 100644 --- a/drivers/net/dsa/sja1105/sja1105_ethtool.c +++ b/drivers/net/dsa/sja1105/sja1105_ethtool.c @@ -586,7 +586,6 @@ void sja1105_get_strings(struct dsa_switch *ds, int por= t, { struct sja1105_private *priv =3D ds->priv; enum sja1105_counter_index max_ctr, i; - char *p =3D data; =20 if (stringset !=3D ETH_SS_STATS) return; @@ -597,10 +596,8 @@ void sja1105_get_strings(struct dsa_switch *ds, int po= rt, else max_ctr =3D __MAX_SJA1105PQRS_PORT_COUNTER; =20 - for (i =3D 0; i < max_ctr; i++) { - strscpy(p, sja1105_port_counters[i].name, ETH_GSTRING_LEN); - p +=3D ETH_GSTRING_LEN; - } + for (i =3D 0; i < max_ctr; i++) + ethtool_puts(&data, sja1105_port_counters[i].name); } =20 int sja1105_get_sset_count(struct dsa_switch *ds, int port, int sset) diff --git a/drivers/net/dsa/xrs700x/xrs700x.c b/drivers/net/dsa/xrs700x/xr= s700x.c index de3b768f2ff9..4dbcc49a9e52 100644 --- a/drivers/net/dsa/xrs700x/xrs700x.c +++ b/drivers/net/dsa/xrs700x/xrs700x.c @@ -91,10 +91,8 @@ static void xrs700x_get_strings(struct dsa_switch *ds, i= nt port, if (stringset !=3D ETH_SS_STATS) return; =20 - for (i =3D 0; i < ARRAY_SIZE(xrs700x_mibs); i++) { - strscpy(data, xrs700x_mibs[i].name, ETH_GSTRING_LEN); - data +=3D ETH_GSTRING_LEN; - } + for (i =3D 0; i < ARRAY_SIZE(xrs700x_mibs); i++) + ethtool_puts(&data, xrs700x_mibs[i].name); } =20 static int xrs700x_get_sset_count(struct dsa_switch *ds, int port, int sse= t)