diff mbox series

[u-boot-net,12/14] net: phy: use ->is_c45 instead of is_10g_interface()

Message ID 20220317124958.27921-13-kabel@kernel.org
State Superseded
Delegated to: Ramon Fried
Headers show
Series u-boot-net refactors, fixes, cleanups | expand

Commit Message

Marek Behún March 17, 2022, 12:49 p.m. UTC
From: Marek Behún <marek.behun@nic.cz>

Use phydev->is_c45 instead of is_10g_interface(phydev->interface) to
determine whether clause 45 protocol should be used.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
---
 drivers/net/phy/phy.c |  8 ++++----
 include/phy.h         | 12 ------------
 2 files changed, 4 insertions(+), 16 deletions(-)

Comments

Ramon Fried March 18, 2022, 8:10 a.m. UTC | #1
On Thu, Mar 17, 2022 at 2:50 PM Marek Behún <kabel@kernel.org> wrote:
>
> From: Marek Behún <marek.behun@nic.cz>
>
> Use phydev->is_c45 instead of is_10g_interface(phydev->interface) to
> determine whether clause 45 protocol should be used.
>
> Signed-off-by: Marek Behún <marek.behun@nic.cz>
> ---
>  drivers/net/phy/phy.c |  8 ++++----
>  include/phy.h         | 12 ------------
>  2 files changed, 4 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
> index 4109676a51..10c724388f 100644
> --- a/drivers/net/phy/phy.c
> +++ b/drivers/net/phy/phy.c
> @@ -632,10 +632,10 @@ static int phy_probe(struct phy_device *phydev)
>         return err;
>  }
>
> -static struct phy_driver *generic_for_interface(phy_interface_t interface)
> +static struct phy_driver *generic_for_phy(struct phy_device *phydev)
>  {
>  #ifdef CONFIG_PHYLIB_10G
> -       if (is_10g_interface(interface))
> +       if (phydev->is_c45)
>                 return &gen10g_driver;
>  #endif
>
> @@ -656,7 +656,7 @@ static struct phy_driver *get_phy_driver(struct phy_device *phydev,
>         }
>
>         /* If we made it here, there's no driver for this PHY */
> -       return generic_for_interface(interface);
> +       return generic_for_phy(phydev);
>  }
>
>  static struct phy_device *phy_device_create(struct mii_dev *bus, int addr,
> @@ -859,7 +859,7 @@ int phy_reset(struct phy_device *phydev)
>
>  #ifdef CONFIG_PHYLIB_10G
>         /* If it's 10G, we need to issue reset through one of the MMDs */
> -       if (is_10g_interface(phydev->interface)) {
> +       if (phydev->is_c45) {
>                 if (!phydev->mmds)
>                         gen10g_discover_mmds(phydev);
>
> diff --git a/include/phy.h b/include/phy.h
> index dee8fb5f2e..9742ce6fe1 100644
> --- a/include/phy.h
> +++ b/include/phy.h
> @@ -359,18 +359,6 @@ static inline int phy_clear_bits_mmd(struct phy_device *phydev, int devad,
>
>  #ifdef CONFIG_PHYLIB_10G
>  extern struct phy_driver gen10g_driver;
> -
> -/*
> - * List all 10G interfaces here, the assumption being that PHYs on these
> - * interfaces are C45
> - */
> -static inline int is_10g_interface(phy_interface_t interface)
> -{
> -       return interface == PHY_INTERFACE_MODE_XGMII ||
> -              interface == PHY_INTERFACE_MODE_USXGMII ||
> -              interface == PHY_INTERFACE_MODE_10GBASER;
> -}
> -
>  #endif
>
>  /**
> --
> 2.34.1
>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
diff mbox series

Patch

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 4109676a51..10c724388f 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -632,10 +632,10 @@  static int phy_probe(struct phy_device *phydev)
 	return err;
 }
 
-static struct phy_driver *generic_for_interface(phy_interface_t interface)
+static struct phy_driver *generic_for_phy(struct phy_device *phydev)
 {
 #ifdef CONFIG_PHYLIB_10G
-	if (is_10g_interface(interface))
+	if (phydev->is_c45)
 		return &gen10g_driver;
 #endif
 
@@ -656,7 +656,7 @@  static struct phy_driver *get_phy_driver(struct phy_device *phydev,
 	}
 
 	/* If we made it here, there's no driver for this PHY */
-	return generic_for_interface(interface);
+	return generic_for_phy(phydev);
 }
 
 static struct phy_device *phy_device_create(struct mii_dev *bus, int addr,
@@ -859,7 +859,7 @@  int phy_reset(struct phy_device *phydev)
 
 #ifdef CONFIG_PHYLIB_10G
 	/* If it's 10G, we need to issue reset through one of the MMDs */
-	if (is_10g_interface(phydev->interface)) {
+	if (phydev->is_c45) {
 		if (!phydev->mmds)
 			gen10g_discover_mmds(phydev);
 
diff --git a/include/phy.h b/include/phy.h
index dee8fb5f2e..9742ce6fe1 100644
--- a/include/phy.h
+++ b/include/phy.h
@@ -359,18 +359,6 @@  static inline int phy_clear_bits_mmd(struct phy_device *phydev, int devad,
 
 #ifdef CONFIG_PHYLIB_10G
 extern struct phy_driver gen10g_driver;
-
-/*
- * List all 10G interfaces here, the assumption being that PHYs on these
- * interfaces are C45
- */
-static inline int is_10g_interface(phy_interface_t interface)
-{
-	return interface == PHY_INTERFACE_MODE_XGMII ||
-	       interface == PHY_INTERFACE_MODE_USXGMII ||
-	       interface == PHY_INTERFACE_MODE_10GBASER;
-}
-
 #endif
 
 /**