From: "Pali Rohár" <pali@kernel.org>
To: "Stefan Roese" <sr@denx.de>,
"Vladimir Oltean" <vladimir.oltean@nxp.com>,
"Marek Behún" <marek.behun@nic.cz>
Cc: u-boot@lists.denx.de
Subject: [PATCH] phy: Fix phy_string_for_interface() function
Date: Thu, 19 May 2022 14:49:12 +0200 [thread overview]
Message-ID: <20220519124912.1995-1-pali@kernel.org> (raw)
Commit c677fb1e3196 ("phy: Move PHY_INTERFACE_MODE_NA to the beginning of
the enum definition") broke function phy_string_for_interface(). And
therefore completely broke support for 2500base-x mode in Armada 3720
comphy driver.
Since that commit function phy_string_for_interface() returns constant
value PHY_INTERFACE_MODE_NA because PHY_INTERFACE_MODE_NA from moved from
end to the beginning.
Previous value of PHY_INTERFACE_MODE_NA was PHY_INTERFACE_MODE_MAX-1. So
change phy_string_for_interface() code to check upper bound via previous
value.
This patch fixes 2500base-x mode on Armada 3720
Fixes: c677fb1e3196 ("phy: Move PHY_INTERFACE_MODE_NA to the beginning of the enum definition")
Signed-off-by: Pali Rohár <pali@kernel.org>
---
include/phy_interface.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/phy_interface.h b/include/phy_interface.h
index ce3b5004ec22..fed3357b9a26 100644
--- a/include/phy_interface.h
+++ b/include/phy_interface.h
@@ -85,7 +85,7 @@ 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_NA)
+ if (i >= PHY_INTERFACE_MODE_MAX)
i = PHY_INTERFACE_MODE_NA;
return phy_interface_strings[i];
--
2.20.1
next reply other threads:[~2022-05-19 12:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-19 12:49 Pali Rohár [this message]
2022-05-19 13:03 ` [PATCH] phy: Fix phy_string_for_interface() function Vladimir Oltean
2022-05-19 13:20 ` Pali Rohár
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220519124912.1995-1-pali@kernel.org \
--to=pali@kernel.org \
--cc=marek.behun@nic.cz \
--cc=sr@denx.de \
--cc=u-boot@lists.denx.de \
--cc=vladimir.oltean@nxp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.