From patchwork Thu Oct 10 17:44: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: 13830583 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.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 2819E1C7B70; Thu, 10 Oct 2024 17:44:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728582270; cv=none; b=l+Y73wWd/B3UEjez5e8HbwpPsV81tjxqRYke+Lo1l91vNINcK2urtJDf2O5wv233Rk4ZG9mXKM7hIBtN4MhVFxpdbPKJ4Ezos3TBv3UORCzi8XckFT9tP8r6P6pxzuo+nfnQyAXN0c4DvGNLCVYHMyZAAhVQrfLTW6XodsKAy24= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728582270; c=relaxed/simple; bh=Qxsoz51VZJyHMDxqxqNVqB+2m7V5J27IuxQi+7VCcME=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=eRwheJ5vKGQQ4Fyj98w7w6/oyjUU7H0N0G05D3gxvUAYR8Jh8qs4ZL9z+9HImLsYiYYvPvBJYdXfMs+wYOgGUQnQDRp9Breju5j8tuzlzE+QJE3frzuYQjZL4Aa5x9ZGITg3YvmVLTckwliq4KdJKSvsHo1EhvO7Qse20QjRFto= 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=RPRhq7R2; arc=none smtp.client-ip=209.85.214.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="RPRhq7R2" Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-20c8c50fdd9so5697375ad.0; Thu, 10 Oct 2024 10:44:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728582268; x=1729187068; 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=TP8WQ67T+F83vpCMppV7EVGcd0m/hdO1rsD5cKr0SlQ=; b=RPRhq7R22QMA0dvwTYkeOnZWVTJwVs09CGqeFgfnGe4SQzmR3tJ8HhF4u2ZDA/BuHN ygSg6C+6xJcKjk3XCrJENteB12S1+lcRQVo6ZPrCsA0azc5olzZ2e/jUM01yRSjftJYG jDEBAqlJ6g0kge8ihbWiefzyTnpL3LDNTH2sm6KTKntY2h5j08hDsM9YiDTF+zfappjv DFKnNZRZ2/Wp+FeV4FbE1JED4kaQOAjUVaqPz5AwkDImy6DmFg4pgFQrAC9xpAQToBVT d70My5KdWi8cEy0vuAcGGJvzRT9NLlBQo19w1DpO1t0MjGOcqIILnUAAtQo0gp64aoiG 1PRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728582268; x=1729187068; 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=TP8WQ67T+F83vpCMppV7EVGcd0m/hdO1rsD5cKr0SlQ=; b=t8qq1KZTp/SOXVIDRe8B9y0NeXcml/2SC9fngKEoNIIdHxcSSHMGlYsakRw5ycbn6D uThNInTcv7YkXcnvBjXzaNWiWDt7Rl678C17nUlNdHrblVkKpSlvTT/u8nq8T3nWjTD9 CgZR0UEgIFa3v5WnLu73nxOSzOKao+GPzIlt3BeeU37p58OpOap0uqECzWY2+55nSa/t w1dg7y2z2KZDeqIFKWiPebPh0u+qMWXDMI9sO5PA8JU2cBWS0duLgRjDtqwR4qg6IX4y 31xuZmAAjRkN59Qs0OK66WDeYhANhUGBKXs2j6GcqXuvpAeaS/FHGPPWQJoV8UXD2HdQ v/kQ== X-Forwarded-Encrypted: i=1; AJvYcCWWMyTID/+xdZAzkjK37OjnhX8COL//FABwaSWobYKWqUr2koOV44kZNy+94tfJ591YTBWwGYKt7NM71go=@vger.kernel.org X-Gm-Message-State: AOJu0Yzx4d8wdAQapZeGFnVoPZxVFo3h80aFFcvXNg+0RAUhv06CQxa7 zZiADRTPNeLfM7ifHCwhFh2oWaSZjG6r5lLuX79hZCzxU9VzQ+dTrzZQj0g7 X-Google-Smtp-Source: AGHT+IF+FoqglhO6Mx7gcwyh9QZV6BDUFuDOzK17THaRC+xlIs7NAYMohoVyzBKavc4wADKsttMk5Q== X-Received: by 2002:a17:903:32d2:b0:20c:7509:d958 with SMTP id d9443c01a7336-20c8047c240mr62944145ad.5.1728582268224; Thu, 10 Oct 2024 10:44:28 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c8c0eb470sm11826495ad.126.2024.10.10.10.44.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2024 10:44: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 , =?utf-8?q?Uw?= =?utf-8?q?e_Kleine-K=C3=B6nig?= , Breno Leitao , Jeff Johnson , Christian Marangi , linux-kernel@vger.kernel.org (open list) Subject: [PATCHv5 net-next 1/7] net: ibm: emac: use netif_receive_skb_list Date: Thu, 10 Oct 2024 10:44:18 -0700 Message-ID: <20241010174424.7310-2-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241010174424.7310-1-rosenp@gmail.com> References: <20241010174424.7310-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 --- 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 Thu Oct 10 17:44: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: 13830584 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pg1-f170.google.com (mail-pg1-f170.google.com [209.85.215.170]) (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 A18FA1CB526; Thu, 10 Oct 2024 17:44:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728582272; cv=none; b=cv7aGwOc6bmgNeczbzKMT2oajrXn0plw1Hh8ysyMlhKmV/UnCgvsOEhSv0wjGwAEv9sKnNp0mf2w/QQcjS2NQtQhSfTGvkWkwcDc2fRP5fTS5w8261whPYntJrvWLz+Aikt0aaBefgycQyPn1iofl6UjXV9vOQVW61XW/6E2N10= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728582272; c=relaxed/simple; bh=b3COy/bCyxAsFDqcstoYVVq7OIpHQpWBc95pMEOzU6k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fLxhTnhhXYhPYbRx1goVhLWkEl2VWahg4NvoKEX/6ksBR3WKg/2nK5UhnAMOI1Umr/McvT281MA0YzTHY/+CllvdY8WK4sWJEN4KupCsivyRJQ5YlUFbS0+MJkO9KeQVrJaovWQrXEPMvSy6jETXocTvIBoUDPqRCrzxwC0gElk= 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=OzzuHwcw; arc=none smtp.client-ip=209.85.215.170 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="OzzuHwcw" Received: by mail-pg1-f170.google.com with SMTP id 41be03b00d2f7-7c1324be8easo1654227a12.1; Thu, 10 Oct 2024 10:44:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728582270; x=1729187070; 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=ZKCACtY/jZU9xUxgPtIRpsO4jXSZMWh6ueCItzG0rys=; b=OzzuHwcwtkrRLN770R7+DXFJLALp2or92rErwDC+H400bKW+n9xWdNUY8AVm4C0JH4 g1DCHDF44HIvozlB2gTdmhiVivnwi59rerPJgj39e7x6h0aJc0LtXVcKhgq0Q/O9c0mF T0WDBApsuEJuta3C8IL8NGYaYpTx32xys10DJIpTpJNxJZs+fHIwNdOvL2AxKbejCfr2 bR1/FuY1IdPv3P10knBITWF5fxmk+DUQd/qn+pHI1zZS9d0JnPylBzxh2kcL6vFxIn8H PNJJbqGVP1hpYDbcyIhZA0XTXzXONoomjwvDea4T/C0uIYLqaUhWrBVsVEz91Sx/urki uzTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728582270; x=1729187070; 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=ZKCACtY/jZU9xUxgPtIRpsO4jXSZMWh6ueCItzG0rys=; b=CpAFi4n4KAFgLq8gNCaIt6UJv6lkld4b68qICWytm9FqvobuIP6SONxlIMa+mBQWRA JL6JklcLFpP8kP45q9aPTPgm1y+eLQu0zXOrbhzpzursbXVLRSjyr7iG9DS3ZhhOM+0d 0PuQDzXwyDniOnlcm9l1Ir+U8toBdnYwQWMPJ/RjYOodr97W38ZUpd7mKKcUkF0iLgh0 JdTnMTzFLl/SdZI330xCJe4Vj1vq5wPtUla5rS/BHM3ksSNzcwa5to5McnmUTKUL6ImO 9Z8TAN5xRuDxeiP2OayNKNSI02OHMXbUE/CRUj8otYM+kvNpVr84RoT5EaGVZb3eJnr7 dqQQ== X-Forwarded-Encrypted: i=1; AJvYcCWhCDnmjuRQ+XA1FsEbeAzgbLB522LbHDgsAWQ3TliKalhnDpkGT+gWcIBtkDNxC8Fs2miDq5bgqtqK3LI=@vger.kernel.org X-Gm-Message-State: AOJu0YzVvoK2DnXqeP55p9CJwjqggFYL9nAX1qXrFXjbDm162vqxE5j0 q/tI9ufHcDCR4meTsJz0JrGbqb3VMsZCWtjijfVu4EN5E31tYi7BlzB9qqUQ X-Google-Smtp-Source: AGHT+IHLIBfslHC+Inva6Xxmsqu1yy9RJWhUE+2slKLhlPYRhaM0C9rDXrQLvc61KAwQyNk7igJXHw== X-Received: by 2002:a17:902:d510:b0:206:9dfb:3e9e with SMTP id d9443c01a7336-20c80460f43mr58381025ad.10.1728582269797; Thu, 10 Oct 2024 10:44:29 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c8c0eb470sm11826495ad.126.2024.10.10.10.44.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2024 10:44: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 , =?utf-8?q?Uw?= =?utf-8?q?e_Kleine-K=C3=B6nig?= , Breno Leitao , Jeff Johnson , Christian Marangi , linux-kernel@vger.kernel.org (open list) Subject: [PATCHv5 net-next 2/7] net: ibm: emac: remove custom init/exit functions Date: Thu, 10 Oct 2024 10:44:19 -0700 Message-ID: <20241010174424.7310-3-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241010174424.7310-1-rosenp@gmail.com> References: <20241010174424.7310-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 7d70056e9008..6c1c47bdc607 100644 --- a/drivers/net/ethernet/ibm/emac/mal.c +++ b/drivers/net/ethernet/ibm/emac/mal.c @@ -753,12 +753,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 b544dd8633b7..6b61c49aa1f4 100644 --- a/drivers/net/ethernet/ibm/emac/rgmii.c +++ b/drivers/net/ethernet/ibm/emac/rgmii.c @@ -280,12 +280,4 @@ static struct platform_driver rgmii_driver = { .probe = rgmii_probe, }; -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 09f6373ed2f9..9e7d79e76a12 100644 --- a/drivers/net/ethernet/ibm/emac/tah.c +++ b/drivers/net/ethernet/ibm/emac/tah.c @@ -138,12 +138,4 @@ static struct platform_driver tah_driver = { .probe = tah_probe, }; -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 69ca6065de1c..40744733fd02 100644 --- a/drivers/net/ethernet/ibm/emac/zmii.c +++ b/drivers/net/ethernet/ibm/emac/zmii.c @@ -286,12 +286,4 @@ static struct platform_driver zmii_driver = { .probe = zmii_probe, }; -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 Thu Oct 10 17:44: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: 13830585 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.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 42F511CB309; Thu, 10 Oct 2024 17:44:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728582273; cv=none; b=X2IANYVCgWXXahBptnj9Je6vUt44l1NfIW7Abqpm73bUy7VtWDybFebUmY07Z7nsSJE7Wsi+jA0h2uQlSjHaoHjL0QwDFtk4Pq6TxAcM24UdWTgPM4jO8XceUPSMtGYDAaYo3zBvErrZnvrDVbo6LTI4abzqpk2GSuqt4DCB6Vk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728582273; c=relaxed/simple; bh=NisjLQ6AG+ayXJO1Uc/n/ydfucUugy/6A8GMWeGKP0Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VTmgRHeHIUWWJ1IMVoeq2h2DYUDUJEb1CyDZAJmBNFcCDFbWavL56qGr1wdjMDeoGdw7eszpUAcnTEE4kvBwgtYN7Tqd/uAwEyKIx6fIH7qUNJvFd4uqtoej1RUqDJxR4AWuuKqiXeG4OvMT2un826Zhx6zk1AvZewuslEmsq9o= 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=EXGClQcV; arc=none smtp.client-ip=209.85.214.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="EXGClQcV" Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-20c71603217so10394175ad.3; Thu, 10 Oct 2024 10:44:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728582271; x=1729187071; 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=1eKq5WBmYRanNBUMYgcDZuAxZpmoeLTNGUJJx7uGfFQ=; b=EXGClQcVugWQqCajUWG35P2K8sxu9QMuYSbouZ1dgp0MWc8gK4fbzNZYapCEWXPnST ivswZmpac0GDhyuPb4b7FA7g+l1c9MIOBSqQbw7/wBfDr1P3BezCtbXMFreslFDv0SxN FrUjxTzOtOwdE5thWzPJIGyjwQOOGYweVTygAuWNyp4jZRHpgb0wxXpnvbqkakMV0SC9 WEOIh4RrkCw4qzkFlzBcNKO00044t6y2g6x76ReEYl43LldzWs8Du7qNLB47gKcULafm Ck+aFso8R++Qtor2uInmElwOPLXWUpusQRI/WNBRlPUH10atvvAbp0qjODMTLYdYydkY r6hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728582271; x=1729187071; 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=1eKq5WBmYRanNBUMYgcDZuAxZpmoeLTNGUJJx7uGfFQ=; b=rwBR2gaj6p24tZ4Kw46m228f7UsWdWS5yULYAGoZs9IMKU8BypQ+7ooil7yImu90OM 5qcm26Wx80gQrPTZ11XcZab05aiqYmmnAqllAHxztFV4SoDkmwLrcOoutEioB0aTUgyb RsD1UMAib/d1FFR0653XWx5XKWBDuv5SQO7yJA6WBhVKfJWbuJVZ+lp6r//7gUBOuwvh uPWCXJ1NNrYUF+lH+2eHrKGE2qI5FxWILyfBxixoNF7gCoZupzTrXn0rdL2tztultPVC HCMp7lzq09r9yuMUa6ySqZlcQxMwRuXnevhWtMJ5YQgWvWt1lVoKF4Elqz6GX4fK9G6r WNDQ== X-Forwarded-Encrypted: i=1; AJvYcCX1iUN/pRZTfDbLu0u7KOPD5Y4q6Nxp/Blgke5X7uCu2J+EbTKedDcVySSxviY2dWiSSEfIauPrb6OR61Q=@vger.kernel.org X-Gm-Message-State: AOJu0Yz1tRbOfgU7q2AlCk5MJ/F8tieYrPQNUfuDPPEhNPIEIo0ps1Rr wQm7QBxF7ZwYjhlDmPA/cHuu5baGYQwjWHRQ3FB1ZltKAC45TAnKPwa+8gWT X-Google-Smtp-Source: AGHT+IENUzlYT8m3mkT0ObIFRL2AdiWZqp0/Dg3jBFtDxQMmPCeRAwNTvkKl05W961ZIGUPx1uk2cQ== X-Received: by 2002:a17:903:41cc:b0:20b:449c:8978 with SMTP id d9443c01a7336-20c9d8c8d00mr4829805ad.31.1728582271359; Thu, 10 Oct 2024 10:44:31 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c8c0eb470sm11826495ad.126.2024.10.10.10.44.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2024 10:44:31 -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 , =?utf-8?q?Uw?= =?utf-8?q?e_Kleine-K=C3=B6nig?= , Breno Leitao , Jeff Johnson , Christian Marangi , linux-kernel@vger.kernel.org (open list) Subject: [PATCHv5 net-next 3/7] net: ibm: emac: use devm_platform_ioremap_resource Date: Thu, 10 Oct 2024 10:44:20 -0700 Message-ID: <20241010174424.7310-4-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241010174424.7310-1-rosenp@gmail.com> References: <20241010174424.7310-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 --- 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 Thu Oct 10 17:44: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: 13830586 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.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 AF9A81CEAD2; Thu, 10 Oct 2024 17:44:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728582275; cv=none; b=CAhIDvFrAQJFQ5Majiz/4SZanWJMvRF4+zhXYkyN4RH8xWI6zubzJCUVGc4WbHG7vVG9AvbLBnRJ/Oxhpg4lTq6eZbxiRVkSz1oF/PpdZGArGDJ1LrDyPqZEYvWOmFSjA0EGVq0hspP495Y6lnjyjUy71VMt2tZZFgoyJWwAd3A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728582275; c=relaxed/simple; bh=iE480TPIwoPhiXVrh3xXe2lyIM9ZDdeFT+n0VlmBVG0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ByXADMd69x89yiRBOWNaWuYIN+f74ZVCOfJ2K5xQeOAYzafQX3C/gQZzoP5YnaFJWHYy7rgVtrnxCpqNcRs89/x2hbpapcgsYY7qCd7nVYbSW/Lyi3mLt1M0n9Ip/6EnJ509AYn7sbdkKvE/mSZsHsbWkt4tpqxq5SlcT9lJ/UA= 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=MHmEZeHC; arc=none smtp.client-ip=209.85.214.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="MHmEZeHC" Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-20b8be13cb1so12933475ad.1; Thu, 10 Oct 2024 10:44:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728582273; x=1729187073; 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=ycsHydRgWHXHWh2o8rVz39zXN41pbx4gmwtA3KWdmo0=; b=MHmEZeHC6QWaZUp5r3v00ucJpV3xvWJWRvGnOsrV8WV4w7T0JlA/FFI4PIpfUw3MbW L8xPkt9078JtPkRbzHWprJ/1GGO5QS2OzMCU/6r0EBrEj2ytG/dTGdXS7ySKYGvdQ1vb 0LicM7IO5jy5y/oiK1wLMJgMHml9UrUhP+WhX+h3BuMreVQ8RSMwTnsRnuECNHfnIpOI HiP8yvSR1CIxAOziysDXvCOMHm+0JQmsjGJDmSpWEBGM2YbiDrqBF86hJIeqhkobmDRb TKDZDrNuM3xZZbasSYJUWNt4dgF08SFpf6SircVhVqy27UpeQLIAXKd4dW1SvPqKjST+ Y0aw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728582273; x=1729187073; 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=ycsHydRgWHXHWh2o8rVz39zXN41pbx4gmwtA3KWdmo0=; b=IU5XXTydxTdw9rifhNUVeJiCX4NjNlD5D6SZMUKcvTtfHlefnzmiuh+HHdjyYBY8SD vy71xJ9WC2/05KgNAXXyL4BqDAnS8rwqNJiMgXe0PoAT82+FCOYfPDaDB2QS884t7r8t LRINU/RigKtlRV2OtP8CtUJVlaqPftzvEx2HK2txtWEs5vADB9OMizncT2pk5PaeieuT EKuETqhEGr7W2unygRLshYXcthO2nIfsP1oeXZ357f6Fx4UAdeeGKiP5BaNNsyqtYoBM +g0TDdy04BVWUL3jKj+EajCDti7I4IcPfCK2HRJ+9e/DutDmoGRtotdOB0MIiQpn5DHm MlUg== X-Forwarded-Encrypted: i=1; AJvYcCXYu5BdkogVwibEkTRwrZNZprtg9nAtZawLcT9ih9TEhiSB5fyX5TZuZ3LSKANg88bIukKKuN76xUiihE8=@vger.kernel.org X-Gm-Message-State: AOJu0YxzqwMEkRecI3+7zErzNjFEsATlj7NW8hS7clIRxmuo2AicxJp+ jZW05SdljZdtdVKkZGNhGBpBdZnv5rlmfX0UN404wsgpR/qQVOUZkm+stgzJ X-Google-Smtp-Source: AGHT+IHgQ6l34uzZjnWuGBrugVxw5AeGVCiNDA0JvfYBarFgBeT5q6OazA2SSH2TfGb8hKLV0sJxJg== X-Received: by 2002:a17:903:1cc:b0:205:8407:6321 with SMTP id d9443c01a7336-20c6375b06emr95588175ad.9.1728582272781; Thu, 10 Oct 2024 10:44:32 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c8c0eb470sm11826495ad.126.2024.10.10.10.44.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2024 10:44: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 , =?utf-8?q?Uw?= =?utf-8?q?e_Kleine-K=C3=B6nig?= , Breno Leitao , Jeff Johnson , Christian Marangi , linux-kernel@vger.kernel.org (open list) Subject: [PATCHv5 net-next 4/7] net: ibm: emac: use platform_get_irq Date: Thu, 10 Oct 2024 10:44:21 -0700 Message-ID: <20241010174424.7310-5-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241010174424.7310-1-rosenp@gmail.com> References: <20241010174424.7310-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 --- 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 Thu Oct 10 17:44: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: 13830587 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.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 48A761CF2A5; Thu, 10 Oct 2024 17:44:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728582276; cv=none; b=LHSE6frcmfo/XI3IYiC3mKfPtt0IGKBP+QM3wrQb+8LwpUoD4gj1aRNS5PyE7uK0To3aJGMmFUyn9EepF9bCOrPzwJUCEU1Vw+b7LxhZIFPv1QnebBJr4H8R7VYKnXgqCGUA6GHjTEoHASv83dmwT5X7JIr1GZnvpoKAqctgsyk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728582276; c=relaxed/simple; bh=lNeanO6FjGs6OMbM0mJk22206OtOXjWZSQs9VsCFo1I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LCW0vD5LGqeQpDxuca6bQobb+/5bHo1utNn2MoFaTVLyNbBuEq8vFMX2PrLDXjj7FJjFr3qNLdue+tvFHxG7KPY6BB4kgDgIiPWRylGlHzMh0UuNaARIi22j6XjN2rbxDn797/vj0FKOXz3/1hlBJcjCZ6+k4LJVdT/4LW5K3TE= 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=mCzEWcJL; arc=none smtp.client-ip=209.85.214.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="mCzEWcJL" Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-207115e3056so9370665ad.2; Thu, 10 Oct 2024 10:44:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728582274; x=1729187074; 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+jlGybBZxdqFMaVmSrBN0CYjTmN1Z4Nta9bwH1E2Xg=; b=mCzEWcJLCvX/aukPxv5HHExG9wh+rDGHQbLiEVXxajLN2nhilZdBfrkxma8CBsnQnl hgcsvgiegWEBNAYt3A3SuSdM8PdA6HVSckUQxAAK0mb7aDTKBjuElcG35WLK488zEafa GVobXqjyNjdZ3FlFIo7jUxTzCKdMqy6UOMId2ZHFxE+qJMmBfkUdOZy3WfCa+x77YM/p Eh4qAkE/mm6rzqeDE7wBdB8qGL6UEctTilFyQjjGtuVWm/bWk8ygaSs3FAD6rFKQfI6p HNI6KFWEiej/tbsKOJIcVYkYwwun+VphV6TUVDjRj+kJ2CD/JDjG4plh8y+iBXKPMIuO n2Xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728582274; x=1729187074; 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+jlGybBZxdqFMaVmSrBN0CYjTmN1Z4Nta9bwH1E2Xg=; b=GEEsP/GL7tFDvNBFOciE1z1ElY4Zzw/G0grb6iYKxRlVb2YksrGgphNLWocyxoMeSc z930KgGrVxcdRUaE6++LEA/ep+szcvPBzANrTCpYO9/WLX3033En/Y07Pa2kIgEs0yf3 g24r8mb+519l0WsUmggmhp8oF+SnipDIqdI9CSXCGJA6PLNYOelmz1VSVplNJhjkDW3t RcTGK7tLeoNF0djiBBDHfXb6G82o55YDq+STJxBw+SiYGB9e3Eia7T01rc9Hl4aoHwX7 LtrxDc2NYu8EchAPJQKP5KMGlufyVpMGGPMF7fCxShYHtbEI6fibb9IzqNd0i6jrPTkM xOqA== X-Forwarded-Encrypted: i=1; AJvYcCX9WJowAD1sqr0liMqQOVzMYohyZz0RkYxj6e2DrsbD2e76I4fNSQlpWwaCEcb992lZ9jwLxFVfyTnDldU=@vger.kernel.org X-Gm-Message-State: AOJu0YwMBZMXsUroCUPMuZSNwItPZy9/6SRv6ZwP6oBmSVQvCUJDsga3 QaA//BT61WspLIZ9Oi/o/an4j/IvzxvD39L9KsIlrq3XOD+R9H28UB9Hw1J1 X-Google-Smtp-Source: AGHT+IFX7bS4F7RJ8uOszGGrmUetDxkHmycvZd45t5y7AS4HAIPXd/I4hBzF1uervJe26Tx83c0ilA== X-Received: by 2002:a17:902:c952:b0:20c:5508:b64 with SMTP id d9443c01a7336-20c6378003fmr89663725ad.47.1728582274310; Thu, 10 Oct 2024 10:44:34 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c8c0eb470sm11826495ad.126.2024.10.10.10.44.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2024 10:44: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 , =?utf-8?q?Uw?= =?utf-8?q?e_Kleine-K=C3=B6nig?= , Breno Leitao , Jeff Johnson , Christian Marangi , linux-kernel@vger.kernel.org (open list) Subject: [PATCHv5 net-next 5/7] net: ibm: emac: use devm for mutex_init Date: Thu, 10 Oct 2024 10:44:22 -0700 Message-ID: <20241010174424.7310-6-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241010174424.7310-1-rosenp@gmail.com> References: <20241010174424.7310-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 Thu Oct 10 17:44:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 13830588 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.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 D09061CEADC; Thu, 10 Oct 2024 17:44:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728582278; cv=none; b=jez117xgIn+aUPGi6Au8G9Xu5PUjOaBMXj0cVWObptW9Qa49JceGtMWzJvetL/RFpuu6cNQw5HvfxNfuGLUPSqKsVAO8mpVCMzIIMA7z3tUzEEvbq3THs2czCGga5BTqN6xzdIPIY9Y8mSJkKIqpd2mXiidpkrszCa4F31WaxK8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728582278; c=relaxed/simple; bh=J8aO3wzaOWSK9zLJo0TwDlDRlAzhsMjbW+BlKYWpN44=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hfCTN2LDVEORN4h9HPrlAavpOp43GzlbXqZw0/7HZ2g4v/EvM4lXvwyXmX0zoMNuouh7+ye3fQOj3hNlBoslzeeg21l1hVgivTraTaEu3YYwRnnsATwdlCEDHZyJzTGax+PDuSIl3pHfAFKlcVzIFxHyukRbEj44xC6ggFkkHvQ= 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=AcSXwSZa; arc=none smtp.client-ip=209.85.214.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="AcSXwSZa" Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-20c8c50fdd9so5698315ad.0; Thu, 10 Oct 2024 10:44:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728582276; x=1729187076; 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=5/2/UNZRyK+UetM6hDhtPP8oB0m6JLdOgOrPpMpO8bM=; b=AcSXwSZajEYv0iAi+Nyikw3YymWXwIB/Cy/HQKhdeJeXcQ8R5vyQgBIhtzsT5QMiiM 2+of+w+qivsWLJt9YrQZ3Y0BmUlCgZzvCp9kG3PDus959/XrDnj8UAq3cmtkQ8W2/dnI +KYAgwajyVo/1VerQsGu22Sz48pagjydmWOlMmvyWdD/whMZHHhAzEg2vyKplD4geE1/ FJBY/QnzzKJK3e/3GQFd2TeYqnt+xGIw7mk3k1ziWFHJcXU7SBvf0tm4X9SbFkKwMbDa Wuktok1yfKEW4kgYasNnLj/TgwI2kbAP9eJuNRuKAsWzKyXMeddGzejmAV5ExaqVv1/g uLjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728582276; x=1729187076; 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=5/2/UNZRyK+UetM6hDhtPP8oB0m6JLdOgOrPpMpO8bM=; b=nxbqTndwlme3iypuWhy/jUPqw8JivVeFYUP8CM0rSSXRNWGNfLY70XxIK/qWC1L8Gf GuSmdn6ZmbL7opDZDzYJ4At7uy2AV+g90cr4viBlgcKwsw+hbHtjmJeDGRLaJqhQXb+V k9NvI4JC91mXHIhTASfL88mhy/NZitrne2c0+QUOxLIto5SS1WLVixfNoHgzhgG7O+SJ Rb9mq7fcXAiNU1mGP0Wi5JKIVBtf4lsuqBFvB959EkWipOuxA8JG+UjCRi99QtvXz/OK 2839HHD27+bZn1XxF7SoO02pB6fBmSNMi3lK5T3SMoQlg905Fzl+MLTMZ2E8Di1gor23 tQuA== X-Forwarded-Encrypted: i=1; AJvYcCXdqApcQ09PYWlaRa3i1j0+5QQhcLYaeDRgKK1qygcjVBdhj+q6vAUgsk5ecOG4fT9aNQcSNEI6dCLWarU=@vger.kernel.org X-Gm-Message-State: AOJu0Yy//gXjZkx71mJ1jr26cwpg8cr7ksguP6iGvwpdb92p2wc8pyIo p7sT/uAUUl32vz+joS0mpVfPtaqzqV/IfXaYg/d4X8MbkXRoLBKmhDOzEI33 X-Google-Smtp-Source: AGHT+IFC0+KRrQ1otME3XOPyDBpWqGVPD2MvtN4lmastUZR5lMAm+qeuU02fG4QWSzWa+h71Drz0Ww== X-Received: by 2002:a17:903:120e:b0:20b:c043:3873 with SMTP id d9443c01a7336-20c805023a9mr70043265ad.21.1728582275944; Thu, 10 Oct 2024 10:44:35 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c8c0eb470sm11826495ad.126.2024.10.10.10.44.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2024 10:44: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 , =?utf-8?q?Uw?= =?utf-8?q?e_Kleine-K=C3=B6nig?= , Breno Leitao , Jeff Johnson , Christian Marangi , linux-kernel@vger.kernel.org (open list) Subject: [PATCHv5 net-next 6/7] net: ibm: emac: generate random MAC if not found Date: Thu, 10 Oct 2024 10:44:23 -0700 Message-ID: <20241010174424.7310-7-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241010174424.7310-1-rosenp@gmail.com> References: <20241010174424.7310-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 Thu Oct 10 17:44:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 13830589 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.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 AF9541D0BA3; Thu, 10 Oct 2024 17:44:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728582280; cv=none; b=qSQJP0y80l/YN8nnC/q0wmd9IqJ4BEg3rY2Y7zPQS23c6EEKVidIEk8mEpWTaRFaxGWnIN9bBLIb6yKUOPQXt7mcsM4nQ8aqQmndg7gnOugUrOORApKeUKFnvizf66PgyC6GUkPY3KRu1Gkul8qkcD9j6l1BVcWr8KZrRTZNpOY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728582280; c=relaxed/simple; bh=nttGTSgyEVPTWS7n4XZdeVO6CJF4ScHLOM5doeOV4IU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SfjCctuqczg9+bJ8XVufF17tIp35uOp5oT/kX9JLN+2tgKTGHy4uIC1QI6b/hvuaLPjLmoE2BC1bQTdizjnJxFuGSh6DlWrhInAwO0rhJ58RFIudHmYlLXmrvA1PfL9GUrk+LQI/C4gCHirVmpzmu6vzVLl+MXf1GyNAyMfhRGE= 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=P58KyRAJ; arc=none smtp.client-ip=209.85.214.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="P58KyRAJ" Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-20c544d34bcso11309555ad.1; Thu, 10 Oct 2024 10:44:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728582278; x=1729187078; 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=uhwhRxeJtKkhLdaXr2bQEoCNtmrAgCvULfHrUXbH9jw=; b=P58KyRAJQiDcWzRx5TP0PglrItjkv7JtW7zAOCYNKc9ELdF/zzeKdNKsZL7Kae2fBZ c67BeoIJUQDij0c24c8ZbthRqdMEhpbomyCa4d/hE0fnqDvf6xq8BSHm7e86JhDfeBqx ROLTjLAMMYT7wpR2bgoTu3ehzSOU4PHJCuTvC0Kd/1cw+v4oSVW0AmvqID42dQsaFMJs LHiKASno5T+h3gWEHgFEdhXLVZ9CCnQIInUSVy8NPaKx528Z7Bmmlc3N1/3PKxq/s0oO /qcKM2uq+yvdZyRlTix9XtBGglHoCFq3ONPMnEBycRxZlfkO6g+glPIbRTPSVSnjbalB zHUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728582278; x=1729187078; 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=uhwhRxeJtKkhLdaXr2bQEoCNtmrAgCvULfHrUXbH9jw=; b=skkLEc+vZdjwb2eEllQ/1bgSIEf7CmxqYvEezrA72aKkUWjSx7kxfqunlylHEA8jwd U8tc8xZmKJ0wacZppjZSMLyE5nx5q/C9IYdLN3J9GttAD+Hj+Xp0NgCeTxImPwjllLxN zAeGeE9dnU0OLgigUpyw1kXrES42LBZRqUKLwftPP8ycsibzZ0kINIvVU8+YaOhCZiFB A2X9hF4/j9yoUcTwWxqlk9N75EuTkx58GJXWnLxqu4lWVlGYqED2nz24m3hLZw+5TGe1 rH0MPc2/UHwbDEx+O782XeJ9zSWtfh07VmHLBIrLlJywmd14l/ss5B92/ht47Zx7Q16O 8e4A== X-Forwarded-Encrypted: i=1; AJvYcCWJ5LkNRt0d5HmwMFs53bxDuSUB5orK4uRM6IV1eiHpFRxZBDDdlX4HKtxoSFfIBp1wiVazvrfmS1vBtf0=@vger.kernel.org X-Gm-Message-State: AOJu0YxiXy0g2BoTbPt9KXjAlRo7RrcB3FFJZZNrfbvwJTJpiOJa+oI0 cTs5YKi+QCtptW7b9ZpJ3si8ktqHqlm0UzJ23avMG9gZgjaTRrAORr8bNcIi X-Google-Smtp-Source: AGHT+IGgp/tYjenlyvreHhrTgC1PGkW7rcZCy2gP9yQh1JUqDZ0y0YSHbG2/4vzwG3V5Kdv/KCxnIg== X-Received: by 2002:a17:903:22cf:b0:20b:7731:e3f8 with SMTP id d9443c01a7336-20c6373695bmr104753185ad.26.1728582277839; Thu, 10 Oct 2024 10:44:37 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c8c0eb470sm11826495ad.126.2024.10.10.10.44.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2024 10:44:37 -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 , =?utf-8?q?Uw?= =?utf-8?q?e_Kleine-K=C3=B6nig?= , Breno Leitao , Jeff Johnson , Christian Marangi , linux-kernel@vger.kernel.org (open list) Subject: [PATCHv5 net-next 7/7] net: ibm: emac: use of_find_matching_node Date: Thu, 10 Oct 2024 10:44:24 -0700 Message-ID: <20241010174424.7310-8-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241010174424.7310-1-rosenp@gmail.com> References: <20241010174424.7310-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;