From patchwork Fri Oct 11 19:56:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 13833101 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pj1-f42.google.com (mail-pj1-f42.google.com [209.85.216.42]) (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 386541D1730; Fri, 11 Oct 2024 19:56:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728676589; cv=none; b=Cvn16xQHsd3KCjd11eeVM59vTTHf7r/DNvrWc3q7yzoa2nry4LPXfIr9M1kO6D6kSq+BRGOrPoFWLJ9dzRQq3fzMULHeOvqTS4kqeDCyD65hlQhsOvsm8kVlbgHZUYX++rGCSStF9igQuRRnG/3kHxqQna0tURr84fL+lOK24hM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728676589; c=relaxed/simple; bh=TMU4bAQ+d2GOR7cncoUYvItGThGrkyP690zABMBRGBg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Qw6lJi+CcJKy4vOPgLZk9/vN/HY+FDnp2yTclr/PiLwG2/044p6+RVZ/BJXDK5Jh6OBbU8/CBOApr3OG0hHDByGOTa+UFgPxa/5OZfSOdeCmJuAVlfFCOxShWUSCaqBR1YhLz7pwg9O4+mI5tXhkUnEP2iL4mpWjsHNaYsQI8Go= 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=d98HJkim; arc=none smtp.client-ip=209.85.216.42 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="d98HJkim" Received: by mail-pj1-f42.google.com with SMTP id 98e67ed59e1d1-2e2e88cb0bbso1083274a91.3; Fri, 11 Oct 2024 12:56:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728676586; x=1729281386; 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=RlSmsxsN2AWmmxqltlUVL5filzfCnO6lBSiOTP1+mQc=; b=d98HJkimO9q0xzBVd1f81e0KTAZ6AiCZ/dbXXOTutbFn+9e/tJEhvxvh2oykObpP3h Db+1mO/qxMaAu4+C2uf/dFRXXx9PI5dzweNjfLTKhXPXsrJXY7ZJWkujq1cnW+7WeyCc ET3X7IR//15jD8kFcf0BfziU0wxqnZih0d4+Tu+AZ5ZU4ZcIVGfSBcsLgzSHNdvoLdQM sYtPTmGcUIy5bzzqxS/JHZAu9/iRK1k3ut2JyMYZ1fHAntyY6lTuIZ67k2JByaNQtDlo IV+JV5FH7JK4UmSgUnPSBUGjbvdieWstnhIs7XdmobLUCyEVNd+bL68qiu3WaJ5c8rzo VeGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728676586; x=1729281386; 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=RlSmsxsN2AWmmxqltlUVL5filzfCnO6lBSiOTP1+mQc=; b=w2AemUMNVFyMv+AviIz82pOp+VwCbi8tjl2gln7nqmDOtYMW9jHN07NS14ASl5BbGk gJf1OGlEVPVZOCzB8bX9C/nKUk5QjjWJcrhlT9p1O+7s+4t/YsaVIUe28IuefbtWbE5o r80xIjmprTLoQi5HcKDYWhvXk695RneFXOTi+w15azD9Zxvp1mI5pH0P7BB2gUA36WuI ojRU42QHlooLLtHa08CDahjj9txpZjDcXnJ6xOETvoiTPtuwgGrrISsdomE3Cqbh+ppf uNA7VR06hgNXYYvc9MLvYlDeGSwX6td7hSSjFELrUh+UY4lNHwbLtoKAFpE3wr9I3hLM rUXw== X-Forwarded-Encrypted: i=1; AJvYcCXzgxnbTl1+zY/GCVzFbwoX5Wxj539vZYNytwE68bApWygSFO2htX4jtlmiFVgsd2ULcfASRP2dWu8NOQ8=@vger.kernel.org X-Gm-Message-State: AOJu0YwOowhwyiJLgaLx7V89kX52h5h56d74ih9SO4PdstCyQFn0Hyis cqJpqlgjBYu/xJ1/+pDlqGAk/RRW1mB+2ffXkNQSt5T3L2+fyswDRaJJ5C9+ X-Google-Smtp-Source: AGHT+IFK2UZLLbkwCtsTuKVufWcy+Xi2ShsDG5ulCqv+ehFoTuFQIKQRMpGP3UOi/yqoPtQEdLDeBg== X-Received: by 2002:a17:90b:4a08:b0:2c9:6a38:54e4 with SMTP id 98e67ed59e1d1-2e2f0dd81efmr4583993a91.41.1728676586249; Fri, 11 Oct 2024 12:56:26 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7ea44907ea9sm2846025a12.40.2024.10.11.12.56.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Oct 2024 12:56:25 -0700 (PDT) From: Rosen Penev To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rosen Penev , Andrew Lunn , Simon Horman , Shannon Nelson , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Breno Leitao , Jeff Johnson , Christian Marangi , linux-kernel@vger.kernel.org (open list) Subject: [PATCHv6 net-next 1/7] net: ibm: emac: use netif_receive_skb_list Date: Fri, 11 Oct 2024 12:56:16 -0700 Message-ID: <20241011195622.6349-2-rosenp@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241011195622.6349-1-rosenp@gmail.com> References: <20241011195622.6349-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org 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 Fri Oct 11 19:56: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: 13833102 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-il1-f175.google.com (mail-il1-f175.google.com [209.85.166.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 101501D12FA; Fri, 11 Oct 2024 19:56:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728676590; cv=none; b=oz21VNCCeaPr7FUDqIkR87dzjbmjXPNx1NdRCg8nrg6K2hkdYELrMZiPqg6YHvM9b8+Xo69N0xYSPlU0eUr7H5D0CTJs86PrzDwPxjbXTIFHQ8KsqqPjBK3zIKdfGZcyrAuDnmnUQpPxWMTX5SU9n2GTsM6NQXSvYD+vOMvYR4M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728676590; c=relaxed/simple; bh=rWIE6AzEKpQ/pvQarynoXz/6Z4ynRunIhDPpAobfBU8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=k6QWUiOW6iPZ3DctVDSpwv1OHkuNdwAKatiLYO3K8Pkcx6nxnF9LkK6ZFq93px0gXxHr5ty636zdqCWh9vtTlQ7cS/tWY9VTWTOb8uizcFNajItqsCKjfsGl/xl09G9mwZyIjP8Jutlwi0n7ke5JvQ+rJyOIVpe4aJO/Ux5js58= 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=evO+HeBl; arc=none smtp.client-ip=209.85.166.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="evO+HeBl" Received: by mail-il1-f175.google.com with SMTP id e9e14a558f8ab-3a39f73a2c7so10162105ab.0; Fri, 11 Oct 2024 12:56:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728676588; x=1729281388; 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=b5AdPdwexmsdQ/Ip3yENErmE21+w4ARrrMDZEEMRiss=; b=evO+HeBlgwh8gYxNC/FLCtemKsq2Pu+BSc0LXswMRChESYYJA+J8F2qewMeFqXFtrV 0blztv/ECgfmdV6ZRxCYVVTLvEMA5lV0mrBYfL2AS8ThIllWkurqRU/3FDU/UYKeMhZb CSvHGlKJSPwpnjFsUF/B3CdyGSWEyAI66eAwfrUTqlWtCnpuZ3hKxKC5o0BeY4uyv/rf yhmGO/D1HbWAnQ+CoSosKA4MFH+2loR5azfRfQLjmTj6qIXYwgp++P3Hc7lNVsVwe+68 SsSLVYzHRvOBlJUohvPEI3o2ZR1oOihb11xLr3YweATauqo6BO2bTGcS1elwftEgZzP0 CFqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728676588; x=1729281388; 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=b5AdPdwexmsdQ/Ip3yENErmE21+w4ARrrMDZEEMRiss=; b=ssHRn5jMDbhZHi62yZ4F5ShqvQrfHbKLQc124ebm0aJU2JryPbDEdTH4VEVyQXcrZV xnXLC5/AGXT0RxlzE7jFjroZTHfWJ5pVUnQMntb7llXj8vNijXlOsVhsRScm2O8V+neH khAgeMMPUTMKI7tqmlRNAoV/bZbsMJyfYTE9iu68cOz3ztH6CSty+6ScKpNMSeiYAGV3 0569OtjEeWAFCBP5iqhX6y6pVSTaUuRlGyoweNlv7TyRgQPXAAM8ayHKCXKPOTp3Ha+/ sqJAr4WZiY0HieIph9qYaii3DCpWJ3szJmppaBz1yl5NHXv9iAdBoFHyKchGpfaokbQ2 bulw== X-Forwarded-Encrypted: i=1; AJvYcCV7xVEUjrCBsrK+wdbqig+3z1RhaY3AMs6yXa3brLaYKdQXClwXl3ug45fTorCYd5xOXtR3NEdg/8Is/GY=@vger.kernel.org X-Gm-Message-State: AOJu0YyiNrri+gB32YrST9hyvZGPmuji6c2RISvYMQB0K9AoU6MCejbP wP9/OE9MimpUj+sRAJOUG4wgKBRX3oZSaq4Lrsl1ObwEK3e6awZqzT9yvykh X-Google-Smtp-Source: AGHT+IEvm46yJY1ltCeK+PSyYlevHyboN7e2hUk18afnl7CNyGCe1Q1NwLU1ceIBtm9+JkxN7ZTfMw== X-Received: by 2002:a05:6e02:1caf:b0:3a3:778e:45cd with SMTP id e9e14a558f8ab-3a3b5fbc20cmr40973765ab.21.1728676587882; Fri, 11 Oct 2024 12:56:27 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7ea44907ea9sm2846025a12.40.2024.10.11.12.56.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Oct 2024 12:56:27 -0700 (PDT) From: Rosen Penev To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rosen Penev , Andrew Lunn , Simon Horman , Shannon Nelson , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Breno Leitao , Jeff Johnson , Christian Marangi , linux-kernel@vger.kernel.org (open list) Subject: [PATCHv6 net-next 2/7] net: ibm: emac: remove custom init/exit functions Date: Fri, 11 Oct 2024 12:56:17 -0700 Message-ID: <20241011195622.6349-3-rosenp@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241011195622.6349-1-rosenp@gmail.com> References: <20241011195622.6349-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org c092d0be38f4f754cdbdc76dc6df628ca48ac0eb 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 --- 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 Fri Oct 11 19:56: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: 13833103 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-il1-f177.google.com (mail-il1-f177.google.com [209.85.166.177]) (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 84D821D173F; Fri, 11 Oct 2024 19:56:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728676593; cv=none; b=C8CBKqVmylaoEMeLz7Ho1uKbHu5ITEC5E8ZyBYqMiYLlnBcJCH2A7eGqS3yJWmmpFwve2dpcc6cflh4abSUaCln3t88cfOXmVLiXvh3gQPqI/wYPfNf5otxRurOY+2YwflcL094AgBDt/lonei4gKtyp4pSjgPmGm3fHmMC4ZWA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728676593; c=relaxed/simple; bh=tniUXV6qEoLdBOPzJKqDpO8qKcTzjxc7U/9coruMqC4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ViVOgD8yRYqujZxzdTdGufB36bdFwD5BXmlpsekHAEA78ly92xt2rzP7uKJ6bJ88a9UxD37dzYPd657Qm5DHjhQeUf0/44KwF1bk03O2j3dGwlPGkVs0t91vk2NKSb1zRcneZbqKvUrsvZg/vYa4Qf/vpKg5e59fm2KKuYpsucc= 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=lZQXroWg; arc=none smtp.client-ip=209.85.166.177 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="lZQXroWg" Received: by mail-il1-f177.google.com with SMTP id e9e14a558f8ab-3a3b98d8a7eso2612345ab.3; Fri, 11 Oct 2024 12:56:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728676589; x=1729281389; 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=I6ITQx9ZkcEUR17rYZmaK0CYrDABtxSCN0Y/5i0Ckw4=; b=lZQXroWgH+a3dGfXjwlmT2FQDPFuax7o7canxb/R+m6/zXo7ufR+0mlltJtNmiGTZq oNeSwRxDchOD8CbcYDWxaU7CCtcQwaFaL1cBy3qBNe1MY+uiZh4qBrub09JgdxthxYWB gZrKmusPmA7+bjU9XRaQinhXetNa+l38Ocp1wj19hqKJNRNzpraiHQ48PNwrSwVPuFyZ twOiRaTZoITebZsmxJtMwzK6d/O1MUbTqvooRarXLtgA8o52LenPpr6F+tj8pIF4N5Qf rKkBH3a1XxN1DpK+aiy6r2bk8iNutY06sZYamzhREDGaFUWY/xhcBXxus2Vu4jUmyQsd A6FA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728676589; x=1729281389; 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=I6ITQx9ZkcEUR17rYZmaK0CYrDABtxSCN0Y/5i0Ckw4=; b=YVKq+WO+/zNfXVFNAtp0nXoO4eD2PD82Ghj2+rAyBQ46da1jReY5Z7IprMAHdSQP81 QzTQq81J+O6i8vWWMxfXOxi+uPpsPWMvLXipV929xwLH86Zax2rI9JNyU55A7UdisoGC Q/sI9LpUe7dnVvqni/KjFv3zmfalOe2zmmr6xI/6Nlp/WZ0/PDO6dWefVEW9W6HrDt2N soZFoPf11BRmDp2iHAtDs+bHOCavlUeeQxKJkcRkVKNT0+db86/wccXg+QUMHwXV5Hi4 tijzqzb2/QZwVoZTYu0ePHBEvZ5w6NlwqgB2NLVMufTWBTVCjZP366UTtnqKU45KDq7G +M8Q== X-Forwarded-Encrypted: i=1; AJvYcCXZx63tnqmtJoFfF4VGdZt92fyJ07tDQFPmxE2EplyIwVMx2wOwRSu2xLqfFWNQMCjV/fO/94RGWKn4+Fg=@vger.kernel.org X-Gm-Message-State: AOJu0YzWaFuTXItsj+M1xiXkjovt7VDdqqurv3WuIiPVzTDiKWrwpHjH 9IrONZLkYri+82uZoHSrIOhe3eOEojSkk7tDmfNx/wr18ukrrHLZ8OlW+2As X-Google-Smtp-Source: AGHT+IGl1pZNNeKiwLw346Fxdrc4k+rkfoaNFBOUuY8one0D3Kdj1x9y8bj92ky2QyaC71I2ueDlqw== X-Received: by 2002:a92:c544:0:b0:3a3:6b20:5e33 with SMTP id e9e14a558f8ab-3a3b5f70cd7mr45678225ab.12.1728676589466; Fri, 11 Oct 2024 12:56:29 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7ea44907ea9sm2846025a12.40.2024.10.11.12.56.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Oct 2024 12:56:29 -0700 (PDT) From: Rosen Penev To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rosen Penev , Andrew Lunn , Simon Horman , Shannon Nelson , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Breno Leitao , Jeff Johnson , Christian Marangi , linux-kernel@vger.kernel.org (open list) Subject: [PATCHv6 net-next 3/7] net: ibm: emac: use devm_platform_ioremap_resource Date: Fri, 11 Oct 2024 12:56:18 -0700 Message-ID: <20241011195622.6349-4-rosenp@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241011195622.6349-1-rosenp@gmail.com> References: <20241011195622.6349-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org 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 Fri Oct 11 19:56: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: 13833104 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-il1-f171.google.com (mail-il1-f171.google.com [209.85.166.171]) (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 4AF0A1DC182; Fri, 11 Oct 2024 19:56:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728676593; cv=none; b=VDTye1grCxcG+DQsY7771G5UYW/sJkTu44nvSZpZdOkB4SEnYW5KHWBEKiG+Ku/zUZChynVo8TcqG+e7IS9Rn4BoKMBV7QtJ7D9lk9GDN/2dNL/4Up3pQHrItMvZjo0NioxgYNdOFoZhY3rYQ1HLHP9cWJNdVf+pEfqTnv1pv1Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728676593; c=relaxed/simple; bh=QV1W4Kc4VLGRNtRwL6p3Ya8X6twJW+la+Nteg5jhrpg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kgnBJ3op9BVcGhmD5Xyx5jYOpT/oRfOzXDBKhIWPfPEnajpX2FArJpe5iDM4YHzbxzw6xTuvsCxzhF5AmEl59wsQaruCCk0aNKgSarQJsyFSo3xRMGnCrkE6hoz7bpiN+qKcpamXs20PXyY7dDRnW0A+XpuVxxoabiIc27cySC4= 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=Dq+FPWu3; arc=none smtp.client-ip=209.85.166.171 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="Dq+FPWu3" Received: by mail-il1-f171.google.com with SMTP id e9e14a558f8ab-3a3bb6a020dso1832595ab.2; Fri, 11 Oct 2024 12:56:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728676591; x=1729281391; 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=v5gK0xTOYXUXTEJtX13WwQH4aVPq/amuVyUotISmIoU=; b=Dq+FPWu3TFHPTOTUE7sCZAB0Z2rFq2Yu3lhUS6bp9D7zhP1/zJPl2NCzS0vZ3lfTYC RQOv7vGaGqtIZNyHCxhcZg6atac6QXzYmlngw4QzAQ6BCM98sdkWCU6dcsWoXbct9Qkx fl8LGSreMTQqmvelAz22H4BfLawN9d4D+yX9gi2HClDBBGkKQD6cFABuJtmGkzxGFNTO bT9Zo6GBR6gWus3RN8D+mkCJ9YVyojC2Gk/XqvAGjvKDT4gkK5jNZGNPBC/vmCVRuvPg GbO1x8jqXnPOIeM8A9OIjeS4VV60lWY2DYUnKrZOk+RGrlPJ4KkFAdGnsSOG5ekTIuta SAtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728676591; x=1729281391; 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=v5gK0xTOYXUXTEJtX13WwQH4aVPq/amuVyUotISmIoU=; b=tuSrk4OqxhpM9eTCvj7xLczHiclJd5fXdvHh5jw9BUNiaMO4PAxKv7ZdN6bh5pmUcC DjFDmrFLxE+WKAtzUTR5coOH1ZJPa/9eGzo9cHqR6TglHXF5eMOsANMrJ6VI8BZ3/JXK d+MD7CfzF5LVrBpW3AedKz7NP5lqE6CBAcwfuPJUW/o/E+vGSTOwSame9zM33DiAZKpb cBA3J4i39zaD1Xo2RzDPzTQToF6M823C0D/osRaWB542JQ79wC/NeMbOfNnLp3S8gI+E rNxdYjGCPK+XLVmGfdQx7k/vA/P8OAMZaRp1IzoOUyAXHtX6cXvmP/i+y2bkKY96u2HB 4j3Q== X-Forwarded-Encrypted: i=1; AJvYcCXfEMscg0+xW3lE0jiJ4MQlrtCQp40xDxnAXR16yCMH7tCqK1PZAd5CfxCKnY/G/V7qXvKEPMo8VmyLKkA=@vger.kernel.org X-Gm-Message-State: AOJu0YxuksOOWO5P0Re7bhwvlMCQii3JdseJhJOmr7ePxayMnokG5mGm foz/uACX0XYiGD1/2VU7JUkvYRyqHKWC9b0+IKC8rZzfB3np/ePqwTD5B55W X-Google-Smtp-Source: AGHT+IE6qVJXB0PklUn7SNveERcWh5F3gMsKRfzV536/jy+qw94Smr5y03U2tQFe9f2vX0deaQh7uA== X-Received: by 2002:a05:6e02:1d15:b0:3a0:9238:d38 with SMTP id e9e14a558f8ab-3a3b5f95ee6mr32901115ab.10.1728676591045; Fri, 11 Oct 2024 12:56:31 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7ea44907ea9sm2846025a12.40.2024.10.11.12.56.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Oct 2024 12:56:30 -0700 (PDT) From: Rosen Penev To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rosen Penev , Andrew Lunn , Simon Horman , Shannon Nelson , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Breno Leitao , Jeff Johnson , Christian Marangi , linux-kernel@vger.kernel.org (open list) Subject: [PATCHv6 net-next 4/7] net: ibm: emac: use platform_get_irq Date: Fri, 11 Oct 2024 12:56:19 -0700 Message-ID: <20241011195622.6349-5-rosenp@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241011195622.6349-1-rosenp@gmail.com> References: <20241011195622.6349-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org 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 Fri Oct 11 19:56: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: 13833105 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pg1-f179.google.com (mail-pg1-f179.google.com [209.85.215.179]) (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 84E641E1A11; Fri, 11 Oct 2024 19:56:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728676595; cv=none; b=Rjg9uWPkcfgQHXw70fwBHwhHaAlPX8sOXc0EdZPLQ+a/62ytQCoTfMjbrekSnlcKXzBUwkxy/wAj0EeTP4psKVLxFkLPpnp98QFTbN3ThYnp75Ge9twOq7MDGPZHLLGcM+jSajefXf1zn1u07vf/oQX6jPKuLK/dHBVqpKtzbCo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728676595; c=relaxed/simple; bh=6LNSwhGbgx5mQWB9kCqZHHpn/5KiBcN4BZyRtBum/7A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XRQBKkuPGbw99ar2WnVseAURBAf86huIqNFkFMQlb98eHKjI95p3hAKkspupc9YyWN3lGvBKvjvlNdSagQUkYDKR85sZfvUaEJU7SId1yLUtDiChMGebfWGZuw8ojF+QdHVOndg1aXCxJihMZOjd/XwiXjye51RJMVrIsau/dPM= 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=K7FxsFGq; arc=none smtp.client-ip=209.85.215.179 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="K7FxsFGq" Received: by mail-pg1-f179.google.com with SMTP id 41be03b00d2f7-7db908c9c83so1432885a12.2; Fri, 11 Oct 2024 12:56:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728676592; x=1729281392; 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=0+1Ht4o02/NZ1TbMESeBGJqpwRvjVzZmcVshE1Z8vJc=; b=K7FxsFGqOIeBT49V/5oEpgPIaROvd1lESczAAVQyhRzLcQ0tF/SScsc51mAicATEin 9yw9lq6CKYF7+QQHM/Io6eQCy1vG5gq+ySj3gAzx5+GDALaRCUoBpOBFgBE2DNS7/EEy qQa0rh4G43aGiJQhP3Blk9iaxiFeWbE8zKdR77ACpfTbLEkbqvq9zzYrf0ZXT4BrUHdq /u1q+mV+efEZ4Xvj640I5MSi/aORO4WERu4uC6sPzZBpIsMhWJ2lKBQd6a+gStKjfDc8 yxKLJ5txk6Uoyfacmfq7H80R2ZCmJ8W/VVY8hl5aWqQF10Oph9hCKV9QhxqtY/lCBtAb IwWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728676592; x=1729281392; 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=0+1Ht4o02/NZ1TbMESeBGJqpwRvjVzZmcVshE1Z8vJc=; b=RkmTZRXHUSd8jHJxZf2OMEety3aovXfqubxn1k/NFegUZI20qpa43l/+xZ5W+hlBYm b0edO0fv+oskd4VlwLF7ouTrPEGLp3cZU9+BU/vG50pnYuoyMitAzB2QErksCvYfNqeY r8nf3i18Huj3MkPSdjicO08tGk4B6dHgVZZSMaLsfkaa6lJyKIkQab5h4rr6mmkv765V /y9PVNySnoia3x5uMamjbWYkdIvk6zO7WhW0uZvhZary+oqE00GAlkQLkoFHrYZdEtU/ Q8hSrbux9FspZSzI2ZiGR4erVlZj22G1ALfmhm+eYJvopR/GOPSaq0Hm1b+UemVzdeuB CzWA== X-Forwarded-Encrypted: i=1; AJvYcCVADoyUFfc1wj0HM6y1yXtisGnsboChuswvesCpoos3B2R7qFqX8m59SUG9cG2xCe5/emEJyDm//wVpbnc=@vger.kernel.org X-Gm-Message-State: AOJu0YwMJYA1glcCFO+juWe7tVMJsVx/wY+XEfgIMta4BvelzSFbq7wE /CFzioODnMHmxYT94EBSt6TDcQpU+v/Izhhqm+BsexuOXzLu4HdNg0ZyzGOB X-Google-Smtp-Source: AGHT+IFo4d079lERGmChQFTVVbReeF/5alvj5f5eC6e5n6mmMO+wSZJBgruYFCMtJ6vjQcrp/XOZkg== X-Received: by 2002:a05:6a21:1813:b0:1d2:ba9c:6d9f with SMTP id adf61e73a8af0-1d8c9595bf2mr784149637.17.1728676592544; Fri, 11 Oct 2024 12:56:32 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7ea44907ea9sm2846025a12.40.2024.10.11.12.56.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Oct 2024 12:56:32 -0700 (PDT) From: Rosen Penev To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rosen Penev , Andrew Lunn , Simon Horman , Shannon Nelson , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Breno Leitao , Jeff Johnson , Christian Marangi , linux-kernel@vger.kernel.org (open list) Subject: [PATCHv6 net-next 5/7] net: ibm: emac: use devm for mutex_init Date: Fri, 11 Oct 2024 12:56:20 -0700 Message-ID: <20241011195622.6349-6-rosenp@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241011195622.6349-1-rosenp@gmail.com> References: <20241011195622.6349-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org 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 --- 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..b9ccaae61c48 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) + return err; + + err = devm_mutex_init(&ofdev->dev, &dev->link_lock); + if (err) + return err; + spin_lock_init(&dev->lock); INIT_WORK(&dev->reset_work, emac_reset_work); From patchwork Fri Oct 11 19:56: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: 13833106 X-Patchwork-Delegate: kuba@kernel.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 DC5171E5738; Fri, 11 Oct 2024 19:56: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=1728676596; cv=none; b=Eqmr14sNnRYbLiImIuM0QZ+DugZwCyQ3iezzGhDg8sFU/VuiGHAg08dqevNfVx//QIQLqXcK+Pn7NPN5+1SNw3BVn2tEDDrx7m/jgi9rFPQOT2BqN+0b0OkI09YXK3jJMQ/tTaWE6sowi1sgQ0Tua8mQuU0Kl6ZGN0vcj0WNbWk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728676596; c=relaxed/simple; bh=ZFLwNIwVctzCdMWUmYqjFWKxhWyGXaQSvfsB3UlKlms=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=G8d39DAb1szu1q+GALR7hHPzm6WRPjU/sdH2fW59mCTXZru0hW3e95q1NoS5CdHbTKd7uEwIRrOPu+A6+P8UgLIFe7L0Cy4UxyU78YnWMzuFvlZ3jEpv03HF62dcKpSVYDSOQC1rNVSSPHXaSwUoHjIN0LRL9NuUM4B43AoT7Xg= 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=UB4PgeA4; 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="UB4PgeA4" Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-71e427e29c7so514799b3a.3; Fri, 11 Oct 2024 12:56:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728676594; x=1729281394; 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=D2WAmEDR6gKCLxTUFCfK9dcDmpMYacx8M4fUpcsQvz4=; b=UB4PgeA4jSgZJ4+xcKszMpUybEiPToMd6lBejRmVfNUiwaRA5T8x9GoRiXbB0AZlpp YI5FJJdaBIp3WmQzrmWzOr65xVRJ+hqWywvwGGNx8DD1XvuTfqXoB6GwuaKK0wXPD03l LRz/THSWRTY+RXAERcVbxabAOaA8QnJmayqHTxXuMbXp2BboYaFrEakKXEuR4MdkSTUp YQhCM/azALN8WZe6Jd55JAJ5QfbNKMP92pTnIJBL1V+tS6/PP6hwJSc1cIDuRJSsfbyq gf4Bf3y5AcgUBZ+QfV9ydZklJ1zvdPNObHeQ3XiIb21v7sNkPfvhil7IiuRy8ZqvVTPO YX5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728676594; x=1729281394; 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=D2WAmEDR6gKCLxTUFCfK9dcDmpMYacx8M4fUpcsQvz4=; b=MUATfSmJvsYpCJtkSmqeNXq7HM1viaUsw2baJdXWnCgZIx0S7FqRRVERoE/f0k6zHy Jy8P2uVpLgT7onF1BQyual04T4kiOu57898MEmC86+YH6WIN8a37/eW51BqVC1tkQUDk zPuN6wK1uqqnDFyJmyM0iAKSeiiRVLMNhv3ZPmLHHul7WrsEnuHjFSj/ad4Z0Au8Y+zh QPrRExUKzzUSSxWPcCL8t+t36oFpLXgY/Sr/IG2DJbTzvS2b3uzRm4wiW5Q0zLKZ16aC qs5q/ym5BE23cqLm4t1/rrwVzTSvTPaIsmymJkYeWSCAKGGzRn1l8e9lPL6QL21jF20v 58qA== X-Forwarded-Encrypted: i=1; AJvYcCUW1gR+T5EaVq+uWQPmU2i3ZHGCBsO1oAZ7+W3VF/skBY0+zkPakaJ00QnJtlpv1wcQq+jxG9iTiYwFArQ=@vger.kernel.org X-Gm-Message-State: AOJu0YygKLav0oSo8bAyvuAOxPrbz2sNLwsagLVnoEnu9v2mhLKwkZxf kjPHIIokq56hektuyxvJEkgsIKjGYJlx4f9hpic75Xni3jdsoCWjSFKuwvYy X-Google-Smtp-Source: AGHT+IGKtuXO8HpH3Q29vbeuin2SpoxWZ4wtdof68DM7RwFmhSHYfQUt48LOGAT07h7L3J9hI4SBjw== X-Received: by 2002:a05:6a20:c88d:b0:1d7:11af:6a with SMTP id adf61e73a8af0-1d8c9690587mr896919637.37.1728676594083; Fri, 11 Oct 2024 12:56:34 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7ea44907ea9sm2846025a12.40.2024.10.11.12.56.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Oct 2024 12:56:33 -0700 (PDT) From: Rosen Penev To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rosen Penev , Andrew Lunn , Simon Horman , Shannon Nelson , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Breno Leitao , Jeff Johnson , Christian Marangi , linux-kernel@vger.kernel.org (open list) Subject: [PATCHv6 net-next 6/7] net: ibm: emac: generate random MAC if not found Date: Fri, 11 Oct 2024 12:56:21 -0700 Message-ID: <20241011195622.6349-7-rosenp@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241011195622.6349-1-rosenp@gmail.com> References: <20241011195622.6349-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org 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 --- 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 b9ccaae61c48..faa483790b29 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)) { From patchwork Fri Oct 11 19:56:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 13833107 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) (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 6F7521E766D; Fri, 11 Oct 2024 19:56:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728676598; cv=none; b=EXMKb1GijsNm1R0GpNogSUUe3yCbD16v3r4KGmP8N4rqEF8xSnJk7z57aGjI+5jX7jFBHAUE5tqqXtjJ2NM0S8pDgzB9d7h2QbMzIFFKo1Dx/CzsoAeBdtlRGZeOhjnBuYJLn4nrN83OjVyU3h17soRVZjUka8667f32KS443fk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728676598; c=relaxed/simple; bh=Q+2VmB7zmwm1vNofxnzfIwwJAhE9qy4N4+vT35MU/DE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LVYFqG3n/LcK/VyYRtnr1h3cXY5zjtG5CAt9dthko+MB4NHw2PvowIQHpmqVv3ZN/+VIoT3UDsaC+HC43ZezTLbAts+sX6zP8AzX9LCCizI9BSBmxexmDw2oJu7kBIjgz10epPP7vtrfqm1fmeSPGmYByZ/MNQj+b2iz937R+Sc= 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=iu7ISXP4; arc=none smtp.client-ip=209.85.210.178 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="iu7ISXP4" Received: by mail-pf1-f178.google.com with SMTP id d2e1a72fcca58-71df468496fso2228028b3a.1; Fri, 11 Oct 2024 12:56:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728676596; x=1729281396; 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=F8hI452n5jGYTy09LuqtDFWI02BUPHpDd5D1l/Si5SU=; b=iu7ISXP42LWfEzeZgWIZeK/ZNsRY6kxXO3DroVp4Gxhxz+09s6cmRNiTmMGG5+sjZ1 MGzpg4shHHbsbIzSgeNFjgEQo0+45rZBkpBxVUVhctL8JS2R2vltBYih2/DRD6YFy7Cf WqvMMq5V7qe7PELECoU8HUBSr+IrgX+IwuM0d8yJ0j61+Wv5jX3ZZQ9FoLRJWkoYBz40 JBnJyEZON3sJJH4FsKbQBGS1lClgwb60yYzp+YeC4iOtl5q+Q01T+iCvuYxSsT3bS/Ht W4ullV8bRTkDF3wwuN1u+GiBHrdoAIeoUUK8a2vSJHJi3FWU2uaJBXSkGsSKnuJZ0FTM aSwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728676596; x=1729281396; 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=F8hI452n5jGYTy09LuqtDFWI02BUPHpDd5D1l/Si5SU=; b=q2PrS76xvNtEOHkr/qFICDmQ+nHCBvWYdTWRf/9XqUUMUJoEWOOLlhOEi/e6CoXuod /D7abM63/ACUTlV/GIks1Vd0MM9Hupv23ktizm9dqia9xCGVIKxbhuuxYAjo+S88dJf5 P3aRyBUXKsvDYF5HAG0DmK+ibYuzdBndsGH332zP9P8XX8GE3pk7dDDFIvYhsCHHZJby 6AdpBevQoyHoNtqLZJfOZTIADAbZ7S+iOshPWkvk2rtO9d9gZQYUh9d9x2FS9C7TXF/n WKAvaDbULBGUSnQrHjKaeETbITnf++Bf2ZZI1mSn/xXhuTy5eA6hO9xalcxjQFvOZeOp ayrA== X-Forwarded-Encrypted: i=1; AJvYcCVesPNkCuFdV8PL7XiIOPDx4tZH2bvuC/GSG8kSlX5JdtSQBaoSlt2V1T2xnOY6GT/AKJDeQ/7l9q+0n3k=@vger.kernel.org X-Gm-Message-State: AOJu0Yzv2sOGB4TerUqwoLXbhFuNUPt3M0pKE/NN88PJ7F++vG1ssBC2 HMVfk6b+VO34XWVrqFF4xqYVdmcwlIEqST72irYm6XSw/PygiCauxqMv/3v7 X-Google-Smtp-Source: AGHT+IGJVzIq8XjXkrMRO8UiphyJSQ5kK/ZaUXkNpMjkU8CBPHmpUJoc+tx8Q3qJizT56BjCuoKyDQ== X-Received: by 2002:a05:6a21:6e4a:b0:1d8:a9c0:8853 with SMTP id adf61e73a8af0-1d8bcf3bd6amr6957438637.23.1728676595598; Fri, 11 Oct 2024 12:56:35 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7ea44907ea9sm2846025a12.40.2024.10.11.12.56.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Oct 2024 12:56:35 -0700 (PDT) From: Rosen Penev To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rosen Penev , Andrew Lunn , Simon Horman , Shannon Nelson , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Breno Leitao , Jeff Johnson , Christian Marangi , linux-kernel@vger.kernel.org (open list) Subject: [PATCHv6 net-next 7/7] net: ibm: emac: use of_find_matching_node Date: Fri, 11 Oct 2024 12:56:22 -0700 Message-ID: <20241011195622.6349-8-rosenp@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241011195622.6349-1-rosenp@gmail.com> References: <20241011195622.6349-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Cleaner than using of_find_all_nodes and then of_match_node. Also modified EMAC_BOOT_LIST_SIZE check to run before of_node_get to avoid having to call of_node_put on failure. Signed-off-by: Rosen Penev --- drivers/net/ethernet/ibm/emac/core.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/ibm/emac/core.c b/drivers/net/ethernet/ibm/emac/core.c index faa483790b29..5265616400c2 100644 --- a/drivers/net/ethernet/ibm/emac/core.c +++ b/drivers/net/ethernet/ibm/emac/core.c @@ -3253,21 +3253,17 @@ static void __init emac_make_bootlist(void) int cell_indices[EMAC_BOOT_LIST_SIZE]; /* Collect EMACs */ - while((np = of_find_all_nodes(np)) != NULL) { + while((np = of_find_matching_node(np, emac_match))) { u32 idx; - if (of_match_node(emac_match, np) == NULL) - continue; if (of_property_read_bool(np, "unused")) continue; if (of_property_read_u32(np, "cell-index", &idx)) continue; cell_indices[i] = idx; - emac_boot_list[i++] = of_node_get(np); - if (i >= EMAC_BOOT_LIST_SIZE) { - of_node_put(np); + if (i >= EMAC_BOOT_LIST_SIZE) break; - } + emac_boot_list[i++] = of_node_get(np); } max = i;