From 6706d7dcbee15ac41f3ddb50b31ff96d16567883 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Beh=C3=BAn?= Date: Thu, 7 Apr 2022 00:33:02 +0200 Subject: treewide: Rename PHY_INTERFACE_MODE_COUNT to PHY_INTERFACE_MODE_MAX MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rename constant PHY_INTERFACE_MODE_COUNT to PHY_INTERFACE_MODE_MAX to make it compatible with Linux' naming. Signed-off-by: Marek Behún Reviewed-by: Stefan Roese Reviewed-by: Vladimir Oltean --- include/phy_interface.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/phy_interface.h') diff --git a/include/phy_interface.h b/include/phy_interface.h index f075abe9c9c..494bc87e679 100644 --- a/include/phy_interface.h +++ b/include/phy_interface.h @@ -41,7 +41,7 @@ typedef enum { PHY_INTERFACE_MODE_USXGMII, PHY_INTERFACE_MODE_NONE, /* Must be last */ - PHY_INTERFACE_MODE_COUNT, + PHY_INTERFACE_MODE_MAX, } phy_interface_t; static const char * const phy_interface_strings[] = { -- cgit v1.2.3 From ffb0f6f488b9eee2822c3c691778a26e1590694c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Beh=C3=BAn?= Date: Thu, 7 Apr 2022 00:33:03 +0200 Subject: treewide: Rename PHY_INTERFACE_MODE_NONE to PHY_INTERFACE_MODE_NA MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rename constant PHY_INTERFACE_MODE_NONE to PHY_INTERFACE_MODE_NA to make it compatible with Linux' naming. Signed-off-by: Marek Behún Reviewed-by: Stefan Roese Reviewed-by: Ramon Fried Reviewed-by: Vladimir Oltean --- include/phy_interface.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'include/phy_interface.h') diff --git a/include/phy_interface.h b/include/phy_interface.h index 494bc87e679..59e119a6399 100644 --- a/include/phy_interface.h +++ b/include/phy_interface.h @@ -39,7 +39,7 @@ typedef enum { PHY_INTERFACE_MODE_NCSI, PHY_INTERFACE_MODE_10GBASER, PHY_INTERFACE_MODE_USXGMII, - PHY_INTERFACE_MODE_NONE, /* Must be last */ + PHY_INTERFACE_MODE_NA, /* Must be last */ PHY_INTERFACE_MODE_MAX, } phy_interface_t; @@ -71,7 +71,7 @@ static const char * const phy_interface_strings[] = { [PHY_INTERFACE_MODE_NCSI] = "NC-SI", [PHY_INTERFACE_MODE_10GBASER] = "10gbase-r", [PHY_INTERFACE_MODE_USXGMII] = "usxgmii", - [PHY_INTERFACE_MODE_NONE] = "", + [PHY_INTERFACE_MODE_NA] = "", }; /* Backplane modes: @@ -86,8 +86,8 @@ static const char * const backplane_mode_strings[] = { static inline const char *phy_string_for_interface(phy_interface_t i) { /* Default to unknown */ - if (i > PHY_INTERFACE_MODE_NONE) - i = PHY_INTERFACE_MODE_NONE; + if (i > PHY_INTERFACE_MODE_NA) + i = PHY_INTERFACE_MODE_NA; return phy_interface_strings[i]; } -- cgit v1.2.3 From c677fb1e3196e1be1fcbbdb04650eed262708317 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Beh=C3=BAn?= Date: Thu, 7 Apr 2022 00:33:04 +0200 Subject: phy: Move PHY_INTERFACE_MODE_NA to the beginning of the enum definition MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move PHY_INTERFACE_MODE_NA to the beginning of the enum definition to make it have zero value. This makes it possible (although not encouraged) to test for invalid/nonexistent interface mode with !val instead of val == PHY_INTERFACE_MODE_NA. The comment near the definition says "Must be last", because when the constant was introduced in commit 5f184715ecd3 ("Create PHY Lib for U-Boot"), it was used as the maximum value when interating over the constants. But this is no longer true - we use PHY_INTERFACE_MODE_MAX for that now, and so we can move it. Signed-off-by: Marek Behún Reviewed-by: Stefan Roese Reviewed-by: Ramon Fried --- include/phy_interface.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'include/phy_interface.h') diff --git a/include/phy_interface.h b/include/phy_interface.h index 59e119a6399..ce3b5004ec2 100644 --- a/include/phy_interface.h +++ b/include/phy_interface.h @@ -13,6 +13,7 @@ #include typedef enum { + PHY_INTERFACE_MODE_NA, /* don't touch */ PHY_INTERFACE_MODE_MII, PHY_INTERFACE_MODE_GMII, PHY_INTERFACE_MODE_SGMII, @@ -39,12 +40,11 @@ typedef enum { PHY_INTERFACE_MODE_NCSI, PHY_INTERFACE_MODE_10GBASER, PHY_INTERFACE_MODE_USXGMII, - PHY_INTERFACE_MODE_NA, /* Must be last */ - PHY_INTERFACE_MODE_MAX, } phy_interface_t; static const char * const phy_interface_strings[] = { + [PHY_INTERFACE_MODE_NA] = "", [PHY_INTERFACE_MODE_MII] = "mii", [PHY_INTERFACE_MODE_GMII] = "gmii", [PHY_INTERFACE_MODE_SGMII] = "sgmii", @@ -71,7 +71,6 @@ static const char * const phy_interface_strings[] = { [PHY_INTERFACE_MODE_NCSI] = "NC-SI", [PHY_INTERFACE_MODE_10GBASER] = "10gbase-r", [PHY_INTERFACE_MODE_USXGMII] = "usxgmii", - [PHY_INTERFACE_MODE_NA] = "", }; /* Backplane modes: -- cgit v1.2.3