From nobody Thu Nov 28 00:45:28 2024 Received: from mail-pg1-f181.google.com (mail-pg1-f181.google.com [209.85.215.181]) (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 8BE8E54279; Sun, 6 Oct 2024 02:06:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728180383; cv=none; b=NGt0a1ka+CgyghftkOEs8g5YPdh8kbblGVcWT924iCIyKmRSgmYIlebWZLy23fCbJWcV5icQm1ZPH0HqN5a0p9X9dyCYqqf/i7ssPvhDBrdLtU18VQubZeXFO9uKuOssFLFGdlMx8rXeG4WFf2opeHazajbSfPG+hJb3PJJZ00Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728180383; c=relaxed/simple; bh=VLHNOJVF2xYI9xFz0sdYpst/JrodikRXh5fZnHMPKUw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nj6CTddLQL4fyfp/sktr0EMJ0f8qEPamjCXwkF+4tBYxxlLSqh4ee7uqmNGPaAt2WPptU6jEQOAkR263GQF80wY+eD+K2zZQ33esoH93j3Fs6myFHlaQoFFZjPg9cENuWnbPizwLb1/aZPHHBlOml5zzWowI4bBWISoWxZ4kCto= 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=ETsUxyKd; arc=none smtp.client-ip=209.85.215.181 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="ETsUxyKd" Received: by mail-pg1-f181.google.com with SMTP id 41be03b00d2f7-7e9f8d67df9so644133a12.1; Sat, 05 Oct 2024 19:06:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728180381; x=1728785181; 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=nTFOaXTef0G9oTg4z249QNFPMYARm/rD0bt+cP8X3Pw=; b=ETsUxyKdXeKCN4lMlqEz9M5uOmAKlN5iUzm6ZcA3utt3jLfM8whlRVvqxiuqjHvAeA etDJASqA5+nviPVtHi/+gg6TNVh5c70KLnkmFprZx8PYYeciw33mmCNUyVo9EOsDYil8 B5IZRkEvUxAX+Xa83hfyEB8T4CWaDxtWfRA8A3Hy/VN5BZACtj4An2UzvJeaUPrs0eU1 daYBbdAR93yZ9i7lryERfJhos9Q2WYKCIEdMd/KtUyP8vwyaGYC1NDSPJ5WibiPCkzl5 c2ZGP1IkB0+3vKoOXXdnjSkJhzOf1iiqmWQd2BpVresTk2zT+sVkAIQT0OqXfwBROuRK JjYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728180381; x=1728785181; 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=nTFOaXTef0G9oTg4z249QNFPMYARm/rD0bt+cP8X3Pw=; b=In0IZ6DclniVNXEGzNIQ0D1s7GRjA7hTi80jVKjMms9xiLSbSsWfRC5szjiUoxN4JX Tv5tMiJnmakVRB/uqTBEQnRN2YtfU7dbZAvC9zGRuIIlAO+9yDZOOS7JpHbFC2JNAaZH xhDBuYtiwyORD091NwxFA+ytfTlNlOlTQCYf3qTCmcEIBzsogYyoYrCEY8TpKsEC/RFj yvXqyvvSsE9OvWVJYQ0T20UMNBCanRcArmPpEWzn+vaSS09eQdGSqiE5SmUo3oASAD+e dmUUFuZcMcF9tYyaR8Ziz3/QJUTzc98GJrJ1P+BJpCuMokNvc7XeJBm3U+eG6SNx7wph VxWg== X-Forwarded-Encrypted: i=1; AJvYcCU0pX+F6DhZ0eEVUGrME3GYHaiQ29vWdYVrH66lM5I8P7ZMhZkW2A2yzBJBUejs7uJMcha/xMpjOySHEOM=@vger.kernel.org X-Gm-Message-State: AOJu0Yw+nDzijXY1K/Of7lNhNfx4fM6pFCXLCz2x/wHTn4p1stzG1Qoy 6ESjo5Ci7zm24CjnEc0pww15aZeMIXHdtzYvkvqcoMstphUyqLC8furOqA== X-Google-Smtp-Source: AGHT+IFV/YLn8XmzNejfUy4gdSvSwG+Zgf4OOBR/2Hh5w97aKvTT6kEjftoGYA1zEf2uFp4Bk6LYHA== X-Received: by 2002:a05:6a21:9204:b0:1d6:97f2:4c11 with SMTP id adf61e73a8af0-1d6dfa23bd7mr11474133637.5.1728180380568; Sat, 05 Oct 2024 19:06:20 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7e9f683153asm2034212a12.50.2024.10.05.19.06.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2024 19:06:20 -0700 (PDT) From: Rosen Penev To: netdev@vger.kernel.org Cc: andrew@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-kernel@vger.kernel.org, jacob.e.keller@intel.com, horms@kernel.org, sd@queasysnail.net, chunkeey@gmail.com Subject: [PATCHv4 net-next 1/8] net: ibm: emac: use netif_receive_skb_list Date: Sat, 5 Oct 2024 19:06:09 -0700 Message-ID: <20241006020616.951543-2-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241006020616.951543-1-rosenp@gmail.com> References: <20241006020616.951543-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Small rx improvement. Would use napi_gro_receive instead but that's a lot more involved than netif_receive_skb_list because of how the function is implemented. Before: > iperf -c 192.168.1.1 ------------------------------------------------------------ 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/ib= m/emac/core.c index dac570f3c110..d476844bae3e 100644 --- a/drivers/net/ethernet/ibm/emac/core.c +++ b/drivers/net/ethernet/ibm/emac/core.c @@ -1727,6 +1727,7 @@ static inline int emac_rx_sg_append(struct emac_insta= nce *dev, int slot) /* NAPI poll context */ static int emac_poll_rx(void *param, int budget) { + LIST_HEAD(rx_list); struct emac_instance *dev =3D param; int slot =3D dev->rx_slot, received =3D 0; =20 @@ -1783,8 +1784,7 @@ static int emac_poll_rx(void *param, int budget) skb->protocol =3D eth_type_trans(skb, dev->ndev); emac_rx_csum(dev, skb, ctrl); =20 - if (unlikely(netif_receive_skb(skb) =3D=3D NET_RX_DROP)) - ++dev->estats.rx_dropped_stack; + list_add_tail(&skb->list, &rx_list); next: ++dev->stats.rx_packets; skip: @@ -1828,6 +1828,8 @@ static int emac_poll_rx(void *param, int budget) goto next; } =20 + netif_receive_skb_list(&rx_list); + if (received) { DBG2(dev, "rx %d BDs" NL, received); dev->rx_slot =3D slot; --=20 2.46.2 From nobody Thu Nov 28 00:45:28 2024 Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) (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 EB9E01684A3; Sun, 6 Oct 2024 02:06:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728180388; cv=none; b=l2V2QmuBXY6zTyHvw24BMNjzuhI+Ht/De85Jl4NpG+cn4oJUTIzuodUtDEKKV73vN4HTJywz39Q4531jVe0U1jx1qf+NBUEuRJgw2LsMrfAnFRpk/7nVZFu1wRM9vet+99iyp5Xyhlxo10nq5+c1CHlU2cOTY2aiJ9XXi5+3rG8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728180388; c=relaxed/simple; bh=q7o0cJMxi0DzV78pTyqjiFVSs0dDSozXPCzq6LyjX4Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=b9uST8ulnCI6hCWkhEae8tk3XRfnRzI14JIIPcSIerTNsU9juGIQxYfd7Ok4wgvCifjYoYt6U9e3v7+9vp3vhRyzugi6HyGDVHfkr67vlphaDbWKVZhJnyWgOZdNBfyUmwSx+4f+bpyVgQuiCbOMto9BLmmHQHNh+0rR77t6b5M= 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=RZeN8UCr; arc=none smtp.client-ip=209.85.210.181 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="RZeN8UCr" Received: by mail-pf1-f181.google.com with SMTP id d2e1a72fcca58-71e01207fa0so22966b3a.3; Sat, 05 Oct 2024 19:06:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728180382; x=1728785182; 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=0TyijJ9HqzRmIYvYkc7oUYJVhtfbDNhwf/UapPkOZEc=; b=RZeN8UCr4xKQDdFeWLziL3mG9AqNvtNNjoW8ju62LfF2auE8meahbd6frHoSYeCh2g F8Y1S6rEXfA8nA5mNT9y7jt0sEjdTEDchNCTRpmtlpgKImtbDH2RyFp6SWFIN23FN0UP EIFx3I6+COreIYFus9pz8+p+vdEQHddbDOgN1mchOTdudNfLQbt2AeYY3sYMGGYCq5PQ Fs/TXSkWniBdleKsFY5zLfzdfOGvzA69cwYQqJyJD4V8eT5z3jEVEhbr/KxOJ1iB35o/ ys6S4WC1DAKr5a/UuFgiXlEKsZ5bwLhH42fGya0sS+/xuYTfxeBLgBZwjd3F+fKmL+7n dlPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728180382; x=1728785182; 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=0TyijJ9HqzRmIYvYkc7oUYJVhtfbDNhwf/UapPkOZEc=; b=ketnjvD1MIKp1RY9z1lbeMD+jIlxfugS3y9f9nQctXKC8GsYGcsiSYzzHpL3UABUcM SVyex8s8mctTTq6o51D9AI6bVYxFa9e4n5+UOyZJ4gQmetf26MIJMhe4RS3qBH2rEdzQ 0pDnKv0MGd4rK+hgWlOnBGEJhpOdv/IvxP8+ISo2PizOBCyGwiU2eWKbZHhxuILbW+NR +ISn/laYGIS1e08v3qkGqkOKCYeFOG+VIZxpa9O1Y7j1uL4qkKWm/s5ERN9cQoZqVUDi ndrd7FW8rX3sjOqVNcTmb7qOGZFBZln392yStR9VJYbJmz6KRbKvli2Rg8XE4d9ssrOn 7Kqw== X-Forwarded-Encrypted: i=1; AJvYcCXgHWnGkuBxNgIfH+2S2cuP6rvw2b8+vnhMMWfjea37LmmNlgjiYV0FXUefBY6ZlV3UHvt0uv5F0VFRMvE=@vger.kernel.org X-Gm-Message-State: AOJu0YxFJi+xeG9YSBEho6XNGLUBizP7cHaKvvuvBZ3EtGfu0u5IhrI1 cqjeljyYdDdcm5U25hwRnhrWs0iZuOPF8rRS5eZGYZp/2BHK4dMiLZDafQ== X-Google-Smtp-Source: AGHT+IEc5g/BlvwiwXAXkwe/98XTL8Fuh9OOOXGnaFAURcBolsBmcmCy6x/pPzhUnAqh0jal+xUTow== X-Received: by 2002:a05:6a21:3941:b0:1cf:2513:8a01 with SMTP id adf61e73a8af0-1d6dfa41684mr12206855637.26.1728180382059; Sat, 05 Oct 2024 19:06:22 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7e9f683153asm2034212a12.50.2024.10.05.19.06.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2024 19:06:21 -0700 (PDT) From: Rosen Penev To: netdev@vger.kernel.org Cc: andrew@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-kernel@vger.kernel.org, jacob.e.keller@intel.com, horms@kernel.org, sd@queasysnail.net, chunkeey@gmail.com Subject: [PATCHv4 net-next 2/8] net: ibm: emac: remove custom init/exit functions Date: Sat, 5 Oct 2024 19:06:10 -0700 Message-ID: <20241006020616.951543-3-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241006020616.951543-1-rosenp@gmail.com> References: <20241006020616.951543-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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. Signed-off-by: Rosen Penev --- drivers/net/ethernet/ibm/emac/core.c | 39 +-------------------------- drivers/net/ethernet/ibm/emac/mal.h | 4 --- drivers/net/ethernet/ibm/emac/rgmii.h | 4 --- drivers/net/ethernet/ibm/emac/tah.h | 4 --- drivers/net/ethernet/ibm/emac/zmii.h | 4 --- 5 files changed, 1 insertion(+), 54 deletions(-) diff --git a/drivers/net/ethernet/ibm/emac/core.c b/drivers/net/ethernet/ib= m/emac/core.c index d476844bae3e..97ae0b7ccb0d 100644 --- a/drivers/net/ethernet/ibm/emac/core.c +++ b/drivers/net/ethernet/ibm/emac/core.c @@ -3283,42 +3283,10 @@ static void __init emac_make_bootlist(void) =20 static int __init emac_init(void) { - int rc; - - printk(KERN_INFO DRV_DESC ", version " DRV_VERSION "\n"); - /* Build EMAC boot list */ emac_make_bootlist(); =20 - /* Init submodules */ - rc =3D mal_init(); - if (rc) - goto err; - rc =3D zmii_init(); - if (rc) - goto err_mal; - rc =3D rgmii_init(); - if (rc) - goto err_zmii; - rc =3D tah_init(); - if (rc) - goto err_rgmii; - rc =3D platform_driver_register(&emac_driver); - if (rc) - goto err_tah; - - return 0; - - err_tah: - tah_exit(); - err_rgmii: - rgmii_exit(); - err_zmii: - zmii_exit(); - err_mal: - mal_exit(); - err: - return rc; + return platform_driver_register(&emac_driver); } =20 static void __exit emac_exit(void) @@ -3327,11 +3295,6 @@ static void __exit emac_exit(void) =20 platform_driver_unregister(&emac_driver); =20 - tah_exit(); - rgmii_exit(); - zmii_exit(); - mal_exit(); - /* Destroy EMAC boot list */ for (i =3D 0; i < EMAC_BOOT_LIST_SIZE; i++) of_node_put(emac_boot_list[i]); diff --git a/drivers/net/ethernet/ibm/emac/mal.h b/drivers/net/ethernet/ibm= /emac/mal.h index e0ddc41186a2..2963b36be6f5 100644 --- a/drivers/net/ethernet/ibm/emac/mal.h +++ b/drivers/net/ethernet/ibm/emac/mal.h @@ -252,10 +252,6 @@ static inline int mal_has_feature(struct mal_instance = *dev, (MAL_FTRS_POSSIBLE & dev->features & feature); } =20 -/* Register MAL devices */ -int mal_init(void); -void mal_exit(void); - int mal_register_commac(struct mal_instance *mal, struct mal_commac *commac); void mal_unregister_commac(struct mal_instance *mal, diff --git a/drivers/net/ethernet/ibm/emac/rgmii.h b/drivers/net/ethernet/i= bm/emac/rgmii.h index 8e4e36eed172..170bcd35039b 100644 --- a/drivers/net/ethernet/ibm/emac/rgmii.h +++ b/drivers/net/ethernet/ibm/emac/rgmii.h @@ -52,8 +52,6 @@ struct rgmii_instance { =20 #ifdef CONFIG_IBM_EMAC_RGMII =20 -int rgmii_init(void); -void rgmii_exit(void); int rgmii_attach(struct platform_device *ofdev, int input, int mode); void rgmii_detach(struct platform_device *ofdev, int input); void rgmii_get_mdio(struct platform_device *ofdev, int input); @@ -64,8 +62,6 @@ void *rgmii_dump_regs(struct platform_device *ofdev, void= *buf); =20 #else =20 -# define rgmii_init() 0 -# define rgmii_exit() do { } while(0) # define rgmii_attach(x,y,z) (-ENXIO) # define rgmii_detach(x,y) do { } while(0) # define rgmii_get_mdio(o,i) do { } while (0) diff --git a/drivers/net/ethernet/ibm/emac/tah.h b/drivers/net/ethernet/ibm= /emac/tah.h index 86c2b6b9d460..60c16cf7a41a 100644 --- a/drivers/net/ethernet/ibm/emac/tah.h +++ b/drivers/net/ethernet/ibm/emac/tah.h @@ -68,8 +68,6 @@ struct tah_instance { =20 #ifdef CONFIG_IBM_EMAC_TAH =20 -int tah_init(void); -void tah_exit(void); int tah_attach(struct platform_device *ofdev, int channel); void tah_detach(struct platform_device *ofdev, int channel); void tah_reset(struct platform_device *ofdev); @@ -78,8 +76,6 @@ void *tah_dump_regs(struct platform_device *ofdev, void *= buf); =20 #else =20 -# define tah_init() 0 -# define tah_exit() do { } while(0) # define tah_attach(x,y) (-ENXIO) # define tah_detach(x,y) do { } while(0) # define tah_reset(x) do { } while(0) diff --git a/drivers/net/ethernet/ibm/emac/zmii.h b/drivers/net/ethernet/ib= m/emac/zmii.h index 65daedc78594..213de06d8ea2 100644 --- a/drivers/net/ethernet/ibm/emac/zmii.h +++ b/drivers/net/ethernet/ibm/emac/zmii.h @@ -48,8 +48,6 @@ struct zmii_instance { =20 #ifdef CONFIG_IBM_EMAC_ZMII =20 -int zmii_init(void); -void zmii_exit(void); int zmii_attach(struct platform_device *ofdev, int input, phy_interface_t *mode); void zmii_detach(struct platform_device *ofdev, int input); @@ -60,8 +58,6 @@ int zmii_get_regs_len(struct platform_device *ocpdev); void *zmii_dump_regs(struct platform_device *ofdev, void *buf); =20 #else -# define zmii_init() 0 -# define zmii_exit() do { } while(0) # define zmii_attach(x,y,z) (-ENXIO) # define zmii_detach(x,y) do { } while(0) # define zmii_get_mdio(x,y) do { } while(0) --=20 2.46.2 From nobody Thu Nov 28 00:45:28 2024 Received: from mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9F5B11EB3D; Sun, 6 Oct 2024 02:06:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728180386; cv=none; b=KITs8dpPPTYmxqSN0RZzbDn1MoKPmrHBW9Cau/7+Lf1swQ60VvPx3WAQs98WaeUt16ULvfq31xFk++y16Ly7KX6foClgqO3rIlP9wyeNahlcxvFSsCJfIqOcHWDlGf2QNJq9fvMUSv/WYNM4FOb5OTsFb9YSJ9xkJ0lrYhTDnek= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728180386; c=relaxed/simple; bh=d7G7xDlXNdUXfohj1+x3twk/5hqwlSMTAj+w5XeGHMo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ThPH1oT5o4wA2NAIcF6u/hl+2FRm8lX1kqfsV+Wa3WEYOv/exX/hLkp99UUExDSAF3njBWh9mcUkYf3GYmpGmxDKj5Jn9xP7wZ7tGAVc+EgXi5UFeGclqUK93oVgb3BU5sRShdK0YTe5knym3cDYgQICbcDDWgtx7yy7FJHf2Iw= 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=gq3KncfR; arc=none smtp.client-ip=209.85.210.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gq3KncfR" Received: by mail-pf1-f169.google.com with SMTP id d2e1a72fcca58-71def8abc2fso1126616b3a.1; Sat, 05 Oct 2024 19:06:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728180384; x=1728785184; 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=lHwdxpLFsmkFWIWIZKleRWek06HcsjEkdbhkqXrCUps=; b=gq3KncfRZ9I/0fJM8DaFP46RxA1JZv+KP+V4p3j6UcgIYUFLgmMiECmcRoUyoYopd+ +W48n1L7tZER15txvqJHHhMIUbqvrNZFSv+ndNYMnhqgQui9xxYMfS7Q458AoM7lAiOS wbc61R7PLbD0sPgZenNr7YudPuVE6ALC4/ZL6dFZ/pXwTrpEF18aiarfcJzkKhlz2QIA ituEU911YiMs3gBDl3P6Q/7agvGFzVP8ARxg41tm5xGHaMJPLUb8ys/iZtIbH2SMuG0F aHjpRjTPRLPqiw5glKZHzq2esrt3gxrJz2XKhtvs0s2vMGngLs7lTWobVhfXjbev9UbW 37NA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728180384; x=1728785184; 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=lHwdxpLFsmkFWIWIZKleRWek06HcsjEkdbhkqXrCUps=; b=dKeqVyLrNO2sEVPxOvoVVH1X9mjc48JhsU1xdaDqcbA6W36frmdEueqou3JQUDsv4d KefQ1IuWPiNO+A6Ri07DyurJB545oW+iFA2xz4lemT3Vv36gByS4uCon1OPlzpNUf0gq IAZ9esJEwSee/s/sz0CHdDGbB+THMLiCsmUcKp+p5X1lE7vdv4Bi0H1KfpXSujB2+6qx LoeG0gWUrOVpJZwSBqDbg9yl/0M1ZaG56AHha+NhSWwVD1IhpKH0t3a+SQLwGPwuPEYL iOJpr3oOorstwd3nstZrhc+XAmuMocQMSrgEt05vRcoDZW9La5B54+FGgYe4m7gQcHL+ E9qA== X-Forwarded-Encrypted: i=1; AJvYcCXOyB4YgEN0yfabI80m4zg9pbQi1+KCSPrJmg2Mfdkz7WqA3H7hER9f4nNZVDDUPNpWDIeLNM6xnCuHjw0=@vger.kernel.org X-Gm-Message-State: AOJu0YzTxuLmNdZsPibdrbUMFjMCXSeldKkZKJ1VjvF5vJ/pldLfEbl6 JZEYLMR2lyQ1Zy0mr1njQ73IV5KgzMy8wgBtvxROOzPNuiyH/6X6XgqUzg== X-Google-Smtp-Source: AGHT+IF80gU/S2SHEvoZ8qAxWjR6LoUr1gRWpHtxdZKqi7ZyffYiZnA2iEi+89TEnJd36TwNH3OkSg== X-Received: by 2002:a05:6a20:cc0a:b0:1d5:10c1:4939 with SMTP id adf61e73a8af0-1d6dfa27eeamr9157204637.8.1728180383713; Sat, 05 Oct 2024 19:06:23 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7e9f683153asm2034212a12.50.2024.10.05.19.06.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2024 19:06:23 -0700 (PDT) From: Rosen Penev To: netdev@vger.kernel.org Cc: andrew@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-kernel@vger.kernel.org, jacob.e.keller@intel.com, horms@kernel.org, sd@queasysnail.net, chunkeey@gmail.com Subject: [PATCHv4 net-next 3/8] net: ibm: emac: use module_platform_driver for modules Date: Sat, 5 Oct 2024 19:06:11 -0700 Message-ID: <20241006020616.951543-4-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241006020616.951543-1-rosenp@gmail.com> References: <20241006020616.951543-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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/mal.c | 10 +--------- drivers/net/ethernet/ibm/emac/rgmii.c | 10 +--------- drivers/net/ethernet/ibm/emac/tah.c | 10 +--------- drivers/net/ethernet/ibm/emac/zmii.c | 10 +--------- 4 files changed, 4 insertions(+), 36 deletions(-) diff --git a/drivers/net/ethernet/ibm/emac/mal.c b/drivers/net/ethernet/ibm= /emac/mal.c index c6c5d417b227..e6354843d856 100644 --- a/drivers/net/ethernet/ibm/emac/mal.c +++ b/drivers/net/ethernet/ibm/emac/mal.c @@ -752,12 +752,4 @@ static struct platform_driver mal_of_driver =3D { .remove_new =3D mal_remove, }; =20 -int __init mal_init(void) -{ - return platform_driver_register(&mal_of_driver); -} - -void mal_exit(void) -{ - platform_driver_unregister(&mal_of_driver); -} +module_platform_driver(mal_of_driver); diff --git a/drivers/net/ethernet/ibm/emac/rgmii.c b/drivers/net/ethernet/i= bm/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 =3D { .probe =3D rgmii_probe, }; =20 -int __init rgmii_init(void) -{ - return platform_driver_register(&rgmii_driver); -} - -void rgmii_exit(void) -{ - platform_driver_unregister(&rgmii_driver); -} +module_platform_driver(rgmii_driver); diff --git a/drivers/net/ethernet/ibm/emac/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 =3D { .probe =3D tah_probe, }; =20 -int __init tah_init(void) -{ - return platform_driver_register(&tah_driver); -} - -void tah_exit(void) -{ - platform_driver_unregister(&tah_driver); -} +module_platform_driver(tah_driver); diff --git a/drivers/net/ethernet/ibm/emac/zmii.c b/drivers/net/ethernet/ib= m/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 =3D { .probe =3D zmii_probe, }; =20 -int __init zmii_init(void) -{ - return platform_driver_register(&zmii_driver); -} - -void zmii_exit(void) -{ - platform_driver_unregister(&zmii_driver); -} +module_platform_driver(zmii_driver); --=20 2.46.2 From nobody Thu Nov 28 00:45:28 2024 Received: from mail-pf1-f182.google.com (mail-pf1-f182.google.com [209.85.210.182]) (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 DEEED16EB55; Sun, 6 Oct 2024 02:06:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728180387; cv=none; b=mV3r9aPnOj/gLFctHbUZGoiSH7x84y1lrdRs55vqYqDjjffmyRYBZ47T2tnFWqH7cVW95nTP775eL0Ihd6w5nlKIX/aOBSqYMkAQ5Gd2DqBiFJAk+rfsGvMPIkbvLcPiVYP0VLa3bW3toz3bsgInJVr5+DkqRF6VcAyB2oDD5b4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728180387; c=relaxed/simple; bh=kk6BZgx6e1aK6qkYUJ4gDXK7X1PwsJgqDQzdqq529+8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Y504p7fXHkX39ypTZozoejBnYucA3AlBg2NO1vv+CKcfrTpfQr2rOKf1FsVCLmgQmIIvvkUlugYXI54OI/6yh5KwHx6s3e62zQ3k/sPX0YPJIwt7DcYNsaBxiM5iqQt9AN3zTvwYqHYjGL+Eo12LgdegI7q8Vj5bwork2dQ9/Bs= 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=eeMSWoKA; arc=none smtp.client-ip=209.85.210.182 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="eeMSWoKA" Received: by mail-pf1-f182.google.com with SMTP id d2e1a72fcca58-71dae4fc4c9so2786756b3a.0; Sat, 05 Oct 2024 19:06:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728180385; x=1728785185; 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=FTdchS1usQhL1WtM0gjI76UYTIDbC6vW1SK3n+i286A=; b=eeMSWoKAGOoBC3jQRaYumgz7A3vrpLnhNEZBK0fyps02iiLdZX/d7TEVTxPJkR2sTy ZUxhEeDn7tZRmJUibM11EcrlvBXdionSaggIHt94Yw4YgY6Yp2IgFXeTWgsAQU3WBYWC zLBgjS2sIWL9a0MiEP3y5WgLvUSoYDVdnSB7uzbTwu/ZRpJlpijlLr7h4GMgTQLICDOv QWSVu+CPqdPxMWQWp6dPngBAj4ffb9fOfhJ/jEyOc8tuNbS0oT83GIVfrC97tfckttgY kIy/dGty8690KSe6g+WUezpK98SEPCkvWNlTunrEFAZ2JCu7IfpBeaCylvvfxqoMinF+ L6lw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728180385; x=1728785185; 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=FTdchS1usQhL1WtM0gjI76UYTIDbC6vW1SK3n+i286A=; b=Exyr9mYOsbyVA5TgIQMQzxwVSPJ1g6tyJY235tnT98/G5fGhGa8VHk2/Sj5TCBdmvN boKVp57ZAifgCTaGsIT72LF4hH4MwzaQ3cqZAYpjR+z7XILRo88gf83bl2ZwYXUc7xpY k6RkLE1K1JcH3QOo9BkT9XDGzYU7I5on3Bd5nAJ045b7Rtb7T6wYk8cIpKb++Fl4rvue OGbiizGIRcVToclsi7h3HICdwHRfJQZa3JR1zhWUy6nLqXqF9NkaU9p9e8edNhF9Remu eheqt4xMMCjjrTU9plRBnwG8NaZv4mcC71Ily0pC4gbBw0jb+pW9BOkq7OdfFaaUZP9A 3zQA== X-Forwarded-Encrypted: i=1; AJvYcCWg8FdBlQ3PxzMWJblj9/0znRWIFlcD3J8CprxXgcSaEyElyEJIKutWIGDUtX83IRaMopBz66VEpjOYAeI=@vger.kernel.org X-Gm-Message-State: AOJu0Yzz01ZEBngCZB4ZBWIiuCbo+ZJB33jPz8ex7d7xuG9ZrdxoFyLZ iTSgFbGlzMVequaLy3lEPJFTnmmP6Cpxxbt2dPu2JnEZ+lADiml/LcFeVg== X-Google-Smtp-Source: AGHT+IFRSmQuNLULqemyX/VjdJxRBlrXBvNhk6NrJRfE9EtZblC3F8zawLFXDaHGcoqX+7Oy189esg== X-Received: by 2002:a05:6a20:438c:b0:1d2:e78a:36a2 with SMTP id adf61e73a8af0-1d6dfa24b28mr10615218637.8.1728180385121; Sat, 05 Oct 2024 19:06:25 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7e9f683153asm2034212a12.50.2024.10.05.19.06.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2024 19:06:24 -0700 (PDT) From: Rosen Penev To: netdev@vger.kernel.org Cc: andrew@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-kernel@vger.kernel.org, jacob.e.keller@intel.com, horms@kernel.org, sd@queasysnail.net, chunkeey@gmail.com Subject: [PATCHv4 net-next 4/8] net: ibm: emac: use devm_platform_ioremap_resource Date: Sat, 5 Oct 2024 19:06:12 -0700 Message-ID: <20241006020616.951543-5-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241006020616.951543-1-rosenp@gmail.com> References: <20241006020616.951543-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" No need to have a struct resource. Gets rid of the TODO. Signed-off-by: Rosen Penev --- drivers/net/ethernet/ibm/emac/core.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/ibm/emac/core.c b/drivers/net/ethernet/ib= m/emac/core.c index 97ae0b7ccb0d..205ba7aa02d4 100644 --- a/drivers/net/ethernet/ibm/emac/core.c +++ b/drivers/net/ethernet/ibm/emac/core.c @@ -3050,12 +3050,10 @@ static int emac_probe(struct platform_device *ofdev) =20 ndev->irq =3D dev->emac_irq; =20 - /* Map EMAC regs */ - // TODO : platform_get_resource() and devm_ioremap_resource() - dev->emacp =3D devm_of_iomap(&ofdev->dev, np, 0, NULL); - if (!dev->emacp) { + dev->emacp =3D devm_platform_ioremap_resource(ofdev, 0); + if (IS_ERR(dev->emacp)) { dev_err(&ofdev->dev, "can't map device registers"); - err =3D -ENOMEM; + err =3D PTR_ERR(dev->emacp); goto err_gone; } =20 --=20 2.46.2 From nobody Thu Nov 28 00:45:28 2024 Received: from mail-pg1-f176.google.com (mail-pg1-f176.google.com [209.85.215.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 893C817084F; Sun, 6 Oct 2024 02:06:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728180388; cv=none; b=GF39HaShOreIKHoddx390GPTLMG2F5vMwM0zz46wsmDZmJFjemOoShlQmstko0w+naEnZnvB3ql69Gn0JqM3xbV6JlyYoO/P4JaM1KenVio3vP3GT2+kfFPduIMe0VQUlxioW9PTpiALuZNxyyaDp5371Zea05GiH4L77zOQuSQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728180388; c=relaxed/simple; bh=k+hWWt4RJCuaq34feyjRdwmdzmEmgz88H7zHH0eqdeo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lXHTHmqaC8MBLu0B7ZBg5OnOpykUWy4UOk4Pas8URZCBHQvK47OP1R8DFEnwxnlGKNVHNtL6QGbt7GRr5wgZJQq2Cch7Ix/Dk9TTRBeUAcaviN1N1rOkz67eprd2YkjmEDUzQxm7MdEDqaZ8T7maV3tCdrPVoEu4TUrI9QKeniY= 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=k9lf8mV8; arc=none smtp.client-ip=209.85.215.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="k9lf8mV8" Received: by mail-pg1-f176.google.com with SMTP id 41be03b00d2f7-7e9ff6fb4c6so801445a12.3; Sat, 05 Oct 2024 19:06:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728180387; x=1728785187; 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=qFaFgc9POesph+LsrZhmZjoY7P5q5F3QfbVs+MT0fXs=; b=k9lf8mV8IhKcVNWjNSddVQcVN2k4HBaQMvddtNxVDomKrljmyHgNr5E/Mx1O0sszMw Gjn2h7xLaAujURzUtJfi4SVidSRQzBQUm4nEugD/fiqJISOr4qtBHGqPKS1xgVpxqZef d/NwDJZpA2+1Vr7KafvFdSZtDrlJeSOHkSOUAHI1Xv4QwiqQ3xIlK4QJlgN/P/gsO8r0 CP0MQQviq82wFj9oL1ANKWc3eXyqm+xG46bVqH1Y7961kOU3sUttpA4jDXVptyjfX5Mg NhR5OSLe2gGr5pTxMhl/soBmjebinkP5DprVdZeRi7qL7P+f6mtOunFNEX/jVyJQxe/k qf6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728180387; x=1728785187; 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=qFaFgc9POesph+LsrZhmZjoY7P5q5F3QfbVs+MT0fXs=; b=sNwVKMAx0omyBms7L5InbtziF1uZjZCwBD3+CJ4evni0m7EvMYRJsIP5v+1k5psfPv 8gNxpfP4EOPJqgB3Ne+/JMiPLBdbwRjTWrVXa4UPjEjRYsNJwjSd7J/C7FtjHd2dx8gU 2d/mzFwCciRd3nP25ng5D/yybg4oGRu8gRWnpDAh/rHkTBxOHZU6QMtxQCXU2xX7eYR2 d6qvMB+fLWHBmnuyF3/rrOTubnYnVmsIvWjRD1nlzJahQOVA29O0mMIXt4u1JVVRq1Wu lPr5tyc6jtTRS5GLFhf1cbChQGzMfhzxL3OzSebGG86vGjtqPEjrwzzBex0kwUS/qUar LrQQ== X-Forwarded-Encrypted: i=1; AJvYcCWeZhtp8UhBGJ06CaF+q3CZiOqDWzXVI/s/plX0zZCWBa1X3VTh3LivO5RlZ5l5zB2UGEUHun6rrzirq/Q=@vger.kernel.org X-Gm-Message-State: AOJu0YyXGjzhv3cEqimne06WlL2k20vqXLVuehy4gjjYb4JXReuDBG8s 1wT3iAd8DL9YR9N0AGiKs5lonlbNvfCU5D7FdEHNZVfhhbWrdCkvheWuBQ== X-Google-Smtp-Source: AGHT+IGOoEIT3gp2HtncwWltZZZjI/OM2B8JpQhGwlSSc9+H351UPiooEk+zNDoRiYwzYgsV3wOdkA== X-Received: by 2002:a05:6a20:c916:b0:1d2:ea38:39bc with SMTP id adf61e73a8af0-1d6dfa33d08mr12888642637.11.1728180386711; Sat, 05 Oct 2024 19:06:26 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7e9f683153asm2034212a12.50.2024.10.05.19.06.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2024 19:06:26 -0700 (PDT) From: Rosen Penev To: netdev@vger.kernel.org Cc: andrew@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-kernel@vger.kernel.org, jacob.e.keller@intel.com, horms@kernel.org, sd@queasysnail.net, chunkeey@gmail.com Subject: [PATCHv4 net-next 5/8] net: ibm: emac: use platform_get_irq Date: Sat, 5 Oct 2024 19:06:13 -0700 Message-ID: <20241006020616.951543-6-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241006020616.951543-1-rosenp@gmail.com> References: <20241006020616.951543-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" No need for irq_of_parse_and_map since we have platform_device. Signed-off-by: Rosen Penev --- drivers/net/ethernet/ibm/emac/core.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/net/ethernet/ibm/emac/core.c b/drivers/net/ethernet/ib= m/emac/core.c index 205ba7aa02d4..a55e84eb1d4d 100644 --- a/drivers/net/ethernet/ibm/emac/core.c +++ b/drivers/net/ethernet/ibm/emac/core.c @@ -3031,15 +3031,8 @@ static int emac_probe(struct platform_device *ofdev) if (err) goto err_gone; =20 - /* Get interrupts. EMAC irq is mandatory */ - dev->emac_irq =3D irq_of_parse_and_map(np, 0); - if (!dev->emac_irq) { - printk(KERN_ERR "%pOF: Can't map main interrupt\n", np); - err =3D -ENODEV; - goto err_gone; - } - /* Setup error IRQ handler */ + dev->emac_irq =3D platform_get_irq(ofdev, 0); err =3D devm_request_irq(&ofdev->dev, dev->emac_irq, emac_irq, 0, "EMAC", dev); if (err) { --=20 2.46.2 From nobody Thu Nov 28 00:45:28 2024 Received: from mail-pg1-f182.google.com (mail-pg1-f182.google.com [209.85.215.182]) (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 02AAA1714D7; Sun, 6 Oct 2024 02:06:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728180390; cv=none; b=n2pMgOmvnZGAb5UsRalhbKFqk5Qk8SJE3imFwH0aQ8m0qpm7NOszwfQHyQKOmNt41yvvBlixNHWhSx1nZr9XE+Hf49S93L2w67eLB4ugzzCUaZcVD556PtVLUR2H0npqtctrery+4VbqRLGKDjOTgiCxbgZTv2AgaUOidxAITw0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728180390; c=relaxed/simple; bh=P8sJeGgHwVnEkli6RKvIJ7QED4Rvrpgj9uc7txlQ+EQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fgA19RU209BpqMwTjNfhmhX7OFxlf4VIITBBRuB+4/YVMpv2EY3b79S0seuU1neOzAs+m+6UDacwaa80eLFd6SC7UPBHPBblwK0vpHr2SOtLV1DO4yUDDY29Z3Y7Q0rvNHgjg86cPJfEoII8L9UDPLPo1sKSp82pWn2QJFm2mYY= 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=nBQCm1qD; arc=none smtp.client-ip=209.85.215.182 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="nBQCm1qD" Received: by mail-pg1-f182.google.com with SMTP id 41be03b00d2f7-7ea06275ef2so71117a12.0; Sat, 05 Oct 2024 19:06:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728180388; x=1728785188; 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=pLrUlrlOioienJvbmM0BeIVC5LeCN6f3Qnt3aoZJr6A=; b=nBQCm1qD84a1gTklkmstDWkLc1OvBSX08jl99NpZgXqD5NwHrWjlhNgXLZx8KJuaJ6 3WOMOmiN2SJ2AoOevdMsvkM/gP8NT/WLwC3z3oE6i8LfizsZUcAGGn+1g5HMH0vJLpXh Bwp3I05jyuQtVxXDavTj4CadgxfYoRs7Dl06WhsQp31VoTP4SI0451G05MfbeAFpOJwN K6adjofNydhipJpe05HwK/kFEPJqJ4x6OYn1xA3LdGVjdi++ZR+2RuJV/c06g5Bbft0b o1fbeUEfOrdWLJHXRL7/ockkQ3ja+YIvPqCjSNZcZ6f4Byc//2KdgRhP3Qkoja8GI0CA UqLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728180388; x=1728785188; 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=pLrUlrlOioienJvbmM0BeIVC5LeCN6f3Qnt3aoZJr6A=; b=bf68aQsRpRvr1Hj4pcbkmzs+TrBeEfUJBVxEXT2kej3vaZ23wTwUX/RPV4nXc7o/Q8 bg8THb7kq4ygg0z2tKnvMD4v0NK2YgRV45kqUH/LGO7ZdxqrPWwXUiAXU1iiuQ9qMAUt 5IPuH1YFb8WK2vOyRjuXBKhU5DmI4PPawiFnpBVeX0LSJCErob4gBaJJhdD2no54uMVU JQzp6I20R77RaUhuf06nMoCJVSerQLRhDBpTVceDhty0yXedW7/l0c2RIOgzJFOW9hPf WC2To+dqX2JgycYyIBRcLq9Jf8opaTC0Z6UGYaq8o70kaqWOlT3Lo8ZC/e8dSRtKK2gM Xpfw== X-Forwarded-Encrypted: i=1; AJvYcCUtxl8HhhGm2NgmMki0s8wQcPJEo8OVn1Oix8C0XtZ24IeAK1Sjz9oDuiOXNbArsD0n/Hs0rvSI7MvyK38=@vger.kernel.org X-Gm-Message-State: AOJu0Ywwure0iXwVR+QUkLmco/YuNBkit1f+JyZf1nu3u4h/xJfxWhrW kJfALiLt0JH9QIPOQsk0UYv9rK58WhzcdO+x7vfPMU3mBlksC2A83bbqGg== X-Google-Smtp-Source: AGHT+IFP2hTXUcd1Xzdbvyrki0o0tSktDU4uoIimL5wmKvt8MrCCMVY/pq0SSJ+4ObXYArKpMxQ6qw== X-Received: by 2002:a05:6a21:9cca:b0:1cf:6c64:ee72 with SMTP id adf61e73a8af0-1d6dfacaf8amr11032607637.34.1728180388156; Sat, 05 Oct 2024 19:06:28 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7e9f683153asm2034212a12.50.2024.10.05.19.06.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2024 19:06:27 -0700 (PDT) From: Rosen Penev To: netdev@vger.kernel.org Cc: andrew@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-kernel@vger.kernel.org, jacob.e.keller@intel.com, horms@kernel.org, sd@queasysnail.net, chunkeey@gmail.com Subject: [PATCHv4 net-next 6/8] net: ibm: emac: use devm for mutex_init Date: Sat, 5 Oct 2024 19:06:14 -0700 Message-ID: <20241006020616.951543-7-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241006020616.951543-1-rosenp@gmail.com> References: <20241006020616.951543-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" It seems since inception that mutex_destroy was never called for these in _remove. Instead of handling this manually, just use devm for simplicity. Signed-off-by: Rosen Penev --- drivers/net/ethernet/ibm/emac/core.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/ibm/emac/core.c b/drivers/net/ethernet/ib= m/emac/core.c index a55e84eb1d4d..872cdd88bc61 100644 --- a/drivers/net/ethernet/ibm/emac/core.c +++ b/drivers/net/ethernet/ibm/emac/core.c @@ -3021,8 +3021,14 @@ static int emac_probe(struct platform_device *ofdev) SET_NETDEV_DEV(ndev, &ofdev->dev); =20 /* Initialize some embedded data structures */ - mutex_init(&dev->mdio_lock); - mutex_init(&dev->link_lock); + err =3D devm_mutex_init(&ofdev->dev, &dev->mdio_lock); + if (err) + return err; + + err =3D 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); =20 --=20 2.46.2 From nobody Thu Nov 28 00:45:28 2024 Received: from mail-pg1-f182.google.com (mail-pg1-f182.google.com [209.85.215.182]) (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 756A9173345; Sun, 6 Oct 2024 02:06:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728180391; cv=none; b=TnGHQ1LgoVOR9g2e+76JdlzJrnLlyLMn4uYepXdJzt/ds4gvqzGfAMGGvUxzMXimsP053IiIRfO1NYRs/tC1LlQLGOxImC2ii7qJPj2i7XZIpAubspjmCL7N4zcOc1k+ouwYURXZ8swxAqmmR7dRT2BYjROEk4EZABmPWmRUaxo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728180391; c=relaxed/simple; bh=mPCw//3/NkAquXj1e7ytaC+VRmOxrlfvhfwk36WqbMQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YVuhDQipxThbPES3mQFdLY7BE9xE5z4N2R9cVPWOd576Ex+2Vs8HBn1XrmWnKjjwBKxMett35FnCKSYT3k35P1kkPj+iVmPWTwbGMmInBGWZJaMd1yPzDp/l87ojZVUnCT3qal0e/FQfNIIZgxyxorArShA6CorCpOiQHfG3rS4= 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=mUaG/ju8; arc=none smtp.client-ip=209.85.215.182 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="mUaG/ju8" Received: by mail-pg1-f182.google.com with SMTP id 41be03b00d2f7-7d4f85766f0so2739242a12.2; Sat, 05 Oct 2024 19:06:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728180390; x=1728785190; 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=5rzW8YzuDHWe4n9H/n3l2GQc4YFTMP1PFG9vBHpmUnY=; b=mUaG/ju8vDITmEw6duyXO9TFxIm8Vy1ZlLFgGL+3gEwqwTu2FRphBgewj7P65HWFKc mfXHNKUPuuAXw+wCxP4jfnnhhBmk8CLS6/7glg0Eg6p6DmcWZke7vdyVBEQOXihFNNNK o3XqCoGJ82LOI4Nj1imCRwHsujFhtWt6XeemtVvB/kb2uqLFOe8ssfWvL9hRvVPHOS4v xFfsqGaPI3PSPlfknyhMnriD+DohWXaTFrQGeeLOUK0+xEogXEBbnl4YIt2F0wF9FRz3 e2H3Q3xM6VGWotuFPPmkfdegQ1A64/9S5pnzf7QMUpfmUjo9ICv8Gwnp1lOuagCbg/dm BE6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728180390; x=1728785190; 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=5rzW8YzuDHWe4n9H/n3l2GQc4YFTMP1PFG9vBHpmUnY=; b=j3y48CpvCGqaLRfdXNfHORevZvceX0rP38KS869kCvUykJN4qTmpClRY+34E8fmi4E jw4yX54yu9GBfEsEbTZOmvDhLMYl6jRSBgbOnP4rAXu+eeTkhDN4F2Tgn3wMnitwLilc OI4sX4pXUzu/ICwBQaXEadnGTCVUFMtIuPzlaaxIHpGuVFVYDMU+kWOocqGiRsds8buA cPtsZ1DBxdH3yNQSR2TGC21pcqjYVoBpy080PI7C4uYxBQ3EEuCps76XKaoMvJf+fSPf NDJ0JeaqQTFQiZhZFM/Cctia+OTstsHEwPAuYjrsF/JiuZ9zGcqT4R9M9z6D2Il0E5HC eppw== X-Forwarded-Encrypted: i=1; AJvYcCX48k3AObujWMgCAHMjf88q7Gex34f44C6oVXBaCVjT4LToVc9dXyTx5+tm8T85I5eCl88OSsp8SQmEkG4=@vger.kernel.org X-Gm-Message-State: AOJu0Yw5nb853CoFQQ62RelEVoOuZHvMqgF4jHLrFa1nUePGpGpUZS37 bVLCMMLmWYTmmJpqV8/7ZUmqoTCfGQjtuGBu00l+ES4kN2U+NY7qFKYNZQ== X-Google-Smtp-Source: AGHT+IHDkkBIJf1J8vkmIr/p9z6Akv6WM8QHdk2+PS+bcH042beHONthlCna/BCZpGNNFsERlLjlOg== X-Received: by 2002:a05:6a20:2d13:b0:1cc:ef11:f2bf with SMTP id adf61e73a8af0-1d6dfadd03emr10918608637.31.1728180389627; Sat, 05 Oct 2024 19:06:29 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7e9f683153asm2034212a12.50.2024.10.05.19.06.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2024 19:06:29 -0700 (PDT) From: Rosen Penev To: netdev@vger.kernel.org Cc: andrew@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-kernel@vger.kernel.org, jacob.e.keller@intel.com, horms@kernel.org, sd@queasysnail.net, chunkeey@gmail.com Subject: [PATCHv4 net-next 7/8] net: ibm: emac: generate random MAC if not found Date: Sat, 5 Oct 2024 19:06:15 -0700 Message-ID: <20241006020616.951543-8-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241006020616.951543-1-rosenp@gmail.com> References: <20241006020616.951543-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" On this Cisco MX60W, u-boot sets the local-mac-address property. Unfortunately by default, the MAC is wrong and is actually located on a UBI partition. Which means nvmem needs to be used to grab it. In the case where that fails, EMAC fails to initialize instead of generating a random MAC as many other drivers do. Match behavior with other drivers to have a working ethernet interface. Signed-off-by: Rosen Penev --- drivers/net/ethernet/ibm/emac/core.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/ibm/emac/core.c b/drivers/net/ethernet/ib= m/emac/core.c index 872cdd88bc61..4b21bf2d3267 100644 --- a/drivers/net/ethernet/ibm/emac/core.c +++ b/drivers/net/ethernet/ibm/emac/core.c @@ -2937,9 +2937,12 @@ static int emac_init_config(struct emac_instance *de= v) =20 /* Read MAC-address */ err =3D of_get_ethdev_address(np, dev->ndev); - if (err) - return dev_err_probe(&dev->ofdev->dev, err, - "Can't get valid [local-]mac-address from OF !\n"); + if (err =3D=3D -EPROBE_DEFER) + return err; + if (err) { + dev_warn(&dev->ofdev->dev, "Can't get valid mac-address. Generating rand= om."); + eth_hw_addr_random(dev->ndev); + } =20 /* IAHT and GAHT filter parameterization */ if (emac_has_feature(dev, EMAC_FTR_EMAC4SYNC)) { --=20 2.46.2 From nobody Thu Nov 28 00:45:28 2024 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 4517317622F; Sun, 6 Oct 2024 02:06:32 +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=1728180397; cv=none; b=XmraNj1mFnR4y/JuiGPnkyeQnO1S7r1tmQEKILVpx5ICRtChC1xLLPOt0bu1iE1KF5ULd0OFhS5FdBioECztI2NgwdceqbcOH284YR9TRI9W/EnWUuXlBS40LIqeSjjdQYXtk0M3J0VreCpAYArxdOJoRgYyn0ws7uP790Oytgc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728180397; c=relaxed/simple; bh=XpD5MBQNCdNE3E6DcHQM/wLKwiuZxSq0ZeTsC+ryFQs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=szKkE+v7qvcetcxGO8ZMZT6t8Ayx92ruNXvkMvEXBqUEHpnzD/v2K1DJf+zDsFJK7IhuMdXO1adQW+5ZHjhsQkvhmFfuJ3zUQ+y48wXv+w2bLUuAIMZh3wxyc5rM1cmjTn7WNsDCndf4DSmmXPAJubipagvW0qoE0yIL3LIyhqA= 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=bcy44svx; 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="bcy44svx" Received: by mail-pg1-f170.google.com with SMTP id 41be03b00d2f7-7ea07610762so34853a12.0; Sat, 05 Oct 2024 19:06:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728180391; x=1728785191; 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=OGZsdm5qLKZIv0DQdpgKSNQfTpwe6/VrtKx9+RL1Io4=; b=bcy44svxNDCEZJG0aw8OuRlq6KaUF9dnT5EyIKY8e1O+KF1NbVsASgga1UC9sjwx2W Cr6MSKT8dzZQi9yPBjQ29b84HVHGhjZMuWqsIpRTVzo/bCIVH34lDF8VIRdhRjcuurEH 2TH2IsTkzQHSMkPJ+6dVeJJN7zi26TQ45zp405ue6aX7ZOKI5217N/h8GsqGOZTUyh/a V0gXt8YVZQEOEwZGywT5HWYZMj8sGNzyQ0ZeQHSr96cKZQ3M4YBStnbk4CnTguXgcQIt N3yAOMDXJrZV0vC9FXu4zL9fJ+ob403fWMrkDsWEz1j2/63YT17lkgea5jHXyVkXJHPD 8n6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728180391; x=1728785191; 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=OGZsdm5qLKZIv0DQdpgKSNQfTpwe6/VrtKx9+RL1Io4=; b=gOdj1usSI76dCf26ih5DMloWLzZwlkxYBbp+CjfoSiN6Wel1AHsvf4Xh73BF6/hm/E 8dhMvXmZm1jFaYlUf3nu9zS3WIwgoJ5KhuHWPdnyG+MUMN58r4z7aF1G+3anrGkvEFeq bxOB90LQJO2LkBwjEgKJ1h8p7UH+3Zt4qIhEbdLcKF0JikB7cXdH8guKIQb41RzYDJBC diY3ERJi9Xs4veCH2gZrGLtr8BKNRvW4Y34uI8sjowYyWCKvRV6ZhbfLDL0JzQxI0M4X O21tx79FWArHrdRABV7mRLvaARYQgoOXYf6udTrmieP3npyetjMmV5rqq58BKOYiqXzr vp7A== X-Forwarded-Encrypted: i=1; AJvYcCX41ZXh4kP+KrBnhkft7JmX0pfFKKKHkwvF51WJfOn9bxR+V/LI/1iaCF0ZeSskP0t7S+NPSFUchWZ9t1A=@vger.kernel.org X-Gm-Message-State: AOJu0YzBmlDN9xypgpHW86/d72hEChtakF5vERFci/fvreDNZnQPmBqh OntA96qiqgUsKax9Fu/PbfSfc0KyNu2JLp5gQzNKb0jtVRp9bzkocnGx/g== X-Google-Smtp-Source: AGHT+IFEqVdWdibs/SLVYCm/jAh9OWwcs/OuFTMgRkRZ2AqBUaKP3HjWo2kqAb1P6DVdwKUMizXHdA== X-Received: by 2002:a05:6a21:1706:b0:1d3:294e:6c8d with SMTP id adf61e73a8af0-1d6dfa3fccfmr11089992637.21.1728180391463; Sat, 05 Oct 2024 19:06:31 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7e9f683153asm2034212a12.50.2024.10.05.19.06.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2024 19:06:31 -0700 (PDT) From: Rosen Penev To: netdev@vger.kernel.org Cc: andrew@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-kernel@vger.kernel.org, jacob.e.keller@intel.com, horms@kernel.org, sd@queasysnail.net, chunkeey@gmail.com Subject: [PATCHv4 net-next 8/8] net: ibm: emac: use of_find_matching_node Date: Sat, 5 Oct 2024 19:06:16 -0700 Message-ID: <20241006020616.951543-9-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241006020616.951543-1-rosenp@gmail.com> References: <20241006020616.951543-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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/ib= m/emac/core.c index 4b21bf2d3267..bc92cc35d8d5 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]; =20 /* Collect EMACs */ - while((np =3D of_find_all_nodes(np)) !=3D NULL) { + while ((np =3D of_find_matching_node(np, emac_match))) { u32 idx; =20 - if (of_match_node(emac_match, np) =3D=3D NULL) - continue; if (of_property_read_bool(np, "unused")) continue; if (of_property_read_u32(np, "cell-index", &idx)) continue; cell_indices[i] =3D idx; - emac_boot_list[i++] =3D of_node_get(np); - if (i >=3D EMAC_BOOT_LIST_SIZE) { - of_node_put(np); + if (i >=3D EMAC_BOOT_LIST_SIZE) break; - } + emac_boot_list[i++] =3D of_node_get(np); } max =3D i; =20 --=20 2.46.2