All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] phy: Fix phy_string_for_interface() function
@ 2022-05-19 12:49 Pali Rohár
  2022-05-19 13:03 ` Vladimir Oltean
  0 siblings, 1 reply; 3+ messages in thread
From: Pali Rohár @ 2022-05-19 12:49 UTC (permalink / raw)
  To: Stefan Roese, Vladimir Oltean, Marek Behún; +Cc: u-boot

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] phy: Fix phy_string_for_interface() function
  2022-05-19 12:49 [PATCH] phy: Fix phy_string_for_interface() function Pali Rohár
@ 2022-05-19 13:03 ` Vladimir Oltean
  2022-05-19 13:20   ` Pali Rohár
  0 siblings, 1 reply; 3+ messages in thread
From: Vladimir Oltean @ 2022-05-19 13:03 UTC (permalink / raw)
  To: Ramon Fried, Pali Rohár
  Cc: Stefan Roese, Marek Behún, u-boot@lists.denx.de

On Thu, May 19, 2022 at 02:49:12PM +0200, Pali Rohár wrote:
> 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>
> ---

Ramon, can you please apply this patch, since people are hitting the issue?
https://patchwork.ozlabs.org/project/uboot/patch/20220510224910.12553-1-tharvey@gateworks.com/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] phy: Fix phy_string_for_interface() function
  2022-05-19 13:03 ` Vladimir Oltean
@ 2022-05-19 13:20   ` Pali Rohár
  0 siblings, 0 replies; 3+ messages in thread
From: Pali Rohár @ 2022-05-19 13:20 UTC (permalink / raw)
  To: Vladimir Oltean
  Cc: Ramon Fried, Stefan Roese, Marek Behún, u-boot@lists.denx.de

On Thursday 19 May 2022 13:03:43 Vladimir Oltean wrote:
> On Thu, May 19, 2022 at 02:49:12PM +0200, Pali Rohár wrote:
> > 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>
> > ---
> 
> Ramon, can you please apply this patch, since people are hitting the issue?
> https://patchwork.ozlabs.org/project/uboot/patch/20220510224910.12553-1-tharvey@gateworks.com/

Ou, I did not know that this patch is already on ML.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-05-19 13:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-19 12:49 [PATCH] phy: Fix phy_string_for_interface() function Pali Rohár
2022-05-19 13:03 ` Vladimir Oltean
2022-05-19 13:20   ` Pali Rohár

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.