From patchwork Thu Mar 17 12:49:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Beh=C3=BAn?= X-Patchwork-Id: 1606550 X-Patchwork-Delegate: rfried.dev@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=I9Xth75g; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KK6Sg5GVMz9s5V for ; Thu, 17 Mar 2022 23:50:43 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8ABA683D65; Thu, 17 Mar 2022 13:50:39 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="I9Xth75g"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CE21783CF3; Thu, 17 Mar 2022 13:50:18 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-3.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 20B5783CD8 for ; Thu, 17 Mar 2022 13:50:12 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=kabel@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A9E42B81EA9; Thu, 17 Mar 2022 12:50:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 547DBC340ED; Thu, 17 Mar 2022 12:50:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1647521409; bh=2N/OEtiucHyG6lDUD2vsW9r5wn8PHpOHY/Sjv+UszIM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I9Xth75g1IkA3ZNnkswArRv9j99Ui1wLbaNe/F/cUagcpJ8bDOM6PLT5AB8ByPbgj AqWu19/Q5K4VVpWRuvXmHYLX/4Te5Pe16ee9AtW8NfjN1jdhd92uiyff4oQag2738c omqf9rJvVJFmbgLI6Ww7fAlfxUL3m/ox4+eFlf1E9xzOi87Cg9GkpsvDLtEPvmpEif 5vvVhiHau9c7ephQmvW2ZoHdmG91617dKvGw6ReSOu8OxWHAvd5uL5wUEtwA3RH3rJ gw1Sp/2m/HmoDh/kO6rztTcmtlyJhFQ9iAGAbW+kKqUhj9Qe0WKpdFwd+0w45ybq9R I3jXaO1Pzeb8Q== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: Joe Hershberger , Ramon Fried Cc: u-boot@lists.denx.de, =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH u-boot-net 02/14] net: mdio-uclass: use ARRAY_SIZE() Date: Thu, 17 Mar 2022 13:49:46 +0100 Message-Id: <20220317124958.27921-3-kabel@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220317124958.27921-1-kabel@kernel.org> References: <20220317124958.27921-1-kabel@kernel.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean From: Marek BehĂșn Use the ARRAY_SIZE() macro instead of hardcoding sizes of arrays in macors. Signed-off-by: Marek BehĂșn --- net/mdio-uclass.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/net/mdio-uclass.c b/net/mdio-uclass.c index 5735afe49e..649dc60f73 100644 --- a/net/mdio-uclass.c +++ b/net/mdio-uclass.c @@ -16,13 +16,12 @@ #include /* DT node properties for MAC-PHY interface */ -#define PHY_MODE_STR_CNT 2 -static const char * const phy_mode_str[PHY_MODE_STR_CNT] = { +static const char * const phy_mode_str[] = { "phy-mode", "phy-connection-type" }; + /* DT node properties that reference a PHY node */ -#define PHY_HANDLE_STR_CNT 3 -static const char * const phy_handle_str[PHY_HANDLE_STR_CNT] = { +static const char * const phy_handle_str[] = { "phy-handle", "phy", "phy-device" }; @@ -149,7 +148,7 @@ static struct phy_device *dm_eth_connect_phy_handle(struct udevice *ethdev, goto out; } - for (i = 0; i < PHY_HANDLE_STR_CNT; i++) + for (i = 0; i < ARRAY_SIZE(phy_handle_str); i++) if (!dev_read_phandle_with_args(ethdev, phy_handle_str[i], NULL, 0, 0, &phandle)) break; @@ -199,7 +198,7 @@ struct phy_device *dm_eth_phy_connect(struct udevice *ethdev) } interface = PHY_INTERFACE_MODE_NONE; - for (i = 0; i < PHY_MODE_STR_CNT; i++) { + for (i = 0; i < ARRAY_SIZE(phy_mode_str); i++) { if_str = dev_read_string(ethdev, phy_mode_str[i]); if (if_str) { interface = phy_get_interface_by_name(if_str);