From a7a96ef812976d9fa73376fa44686a1ee4af16ee Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Beh=C3=BAn?= Date: Thu, 7 Apr 2022 00:32:56 +0200 Subject: [PATCH] net: mdio-uclass: use ARRAY_SIZE() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Use the ARRAY_SIZE() macro instead of hardcoding sizes of arrays in macros. Signed-off-by: Marek Behún Reviewed-by: Vladimir Oltean --- 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 5735afe..649dc60 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); -- 2.7.4