From patchwork Tue Oct 15 20:02:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 13837047 X-Patchwork-Delegate: geert@linux-m68k.org 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?b?Q2zDqW1lbnQgTMOpZ2Vy?= , George McCollister , Richard Cochran , Rosen Penev , Simon Horman , Jacob Keller , =?utf-8?q?Uwe_Kleine-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-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 ------------------------------------------------------------ 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/ibm/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_instance *dev, int slot) /* NAPI poll context */ static int emac_poll_rx(void *param, int budget) { + LIST_HEAD(rx_list); struct emac_instance *dev = param; int slot = dev->rx_slot, received = 0; @@ -1783,8 +1784,7 @@ static int emac_poll_rx(void *param, int budget) skb->protocol = eth_type_trans(skb, dev->ndev); emac_rx_csum(dev, skb, ctrl); - if (unlikely(netif_receive_skb(skb) == 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; } + netif_receive_skb_list(&rx_list); + if (received) { DBG2(dev, "rx %d BDs" NL, received); dev->rx_slot = slot; From patchwork Tue Oct 15 20:02:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 13837049 X-Patchwork-Delegate: geert@linux-m68k.org 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?b?Q2zDqW1lbnQgTMOpZ2Vy?= , George McCollister , Richard Cochran , Rosen Penev , Simon Horman , Jacob Keller , =?utf-8?q?Uwe_Kleine-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-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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/ibm/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) static int __init emac_init(void) { - int rc; - - printk(KERN_INFO DRV_DESC ", version " DRV_VERSION "\n"); - /* Build EMAC boot list */ emac_make_bootlist(); - /* Init submodules */ - rc = mal_init(); - if (rc) - goto err; - rc = zmii_init(); - if (rc) - goto err_mal; - rc = rgmii_init(); - if (rc) - goto err_zmii; - rc = tah_init(); - if (rc) - goto err_rgmii; - rc = 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); } static void __exit emac_exit(void) @@ -3327,11 +3295,6 @@ static void __exit emac_exit(void) platform_driver_unregister(&emac_driver); - tah_exit(); - rgmii_exit(); - zmii_exit(); - mal_exit(); - /* Destroy EMAC boot list */ for (i = 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 = { .remove = mal_remove, }; -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); } -/* 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/ibm/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 = { .remove = rgmii_remove, }; -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/ibm/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 { #ifdef CONFIG_IBM_EMAC_RGMII -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); #else -# 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 = { .remove = tah_remove, }; -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 { #ifdef CONFIG_IBM_EMAC_TAH -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); #else -# 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/ibm/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 = { .remove = zmii_remove, }; -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/ibm/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 { #ifdef CONFIG_IBM_EMAC_ZMII -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); #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) From patchwork Tue Oct 15 20:02:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 13837050 X-Patchwork-Delegate: geert@linux-m68k.org 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?b?Q2zDqW1lbnQgTMOpZ2Vy?= , George McCollister , Richard Cochran , Rosen Penev , Simon Horman , Jacob Keller , =?utf-8?q?Uwe_Kleine-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-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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/ibm/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) ndev->irq = dev->emac_irq; - /* Map EMAC regs */ - // TODO : platform_get_resource() and devm_ioremap_resource() - dev->emacp = devm_of_iomap(&ofdev->dev, np, 0, NULL); - if (!dev->emacp) { + dev->emacp = devm_platform_ioremap_resource(ofdev, 0); + if (IS_ERR(dev->emacp)) { dev_err(&ofdev->dev, "can't map device registers"); - err = -ENOMEM; + err = PTR_ERR(dev->emacp); goto err_gone; } From patchwork Tue Oct 15 20:02:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 13837051 X-Patchwork-Delegate: geert@linux-m68k.org 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?b?Q2zDqW1lbnQgTMOpZ2Vy?= , George McCollister , Richard Cochran , Rosen Penev , Simon Horman , Jacob Keller , =?utf-8?q?Uwe_Kleine-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-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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/ibm/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; - /* Get interrupts. EMAC irq is mandatory */ - dev->emac_irq = irq_of_parse_and_map(np, 0); - if (!dev->emac_irq) { - printk(KERN_ERR "%pOF: Can't map main interrupt\n", np); - err = -ENODEV; - goto err_gone; - } - /* Setup error IRQ handler */ + dev->emac_irq = platform_get_irq(ofdev, 0); err = devm_request_irq(&ofdev->dev, dev->emac_irq, emac_irq, 0, "EMAC", dev); if (err) { From patchwork Tue Oct 15 20:02:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 13837052 X-Patchwork-Delegate: geert@linux-m68k.org 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?b?Q2zDqW1lbnQgTMOpZ2Vy?= , George McCollister , Richard Cochran , Rosen Penev , Simon Horman , Jacob Keller , =?utf-8?q?Uwe_Kleine-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-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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/ibm/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); /* Initialize some embedded data structures */ - mutex_init(&dev->mdio_lock); - mutex_init(&dev->link_lock); + err = devm_mutex_init(&ofdev->dev, &dev->mdio_lock); + if (err) + goto err_gone; + + err = 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); From patchwork Tue Oct 15 20:02:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 13837053 X-Patchwork-Delegate: geert@linux-m68k.org 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?b?Q2zDqW1lbnQgTMOpZ2Vy?= , George McCollister , Richard Cochran , Rosen Penev , Simon Horman , Jacob Keller , =?utf-8?q?Uwe_Kleine-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-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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/ibm/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 *dev) /* Read MAC-address */ err = 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 == -EPROBE_DEFER) + return err; + if (err) { + dev_warn(&dev->ofdev->dev, "Can't get valid mac-address. Generating random."); + eth_hw_addr_random(dev->ndev); + } /* IAHT and GAHT filter parameterization */ if (emac_has_feature(dev, EMAC_FTR_EMAC4SYNC)) {