diff mbox series

[u-boot-net,11/14] net: phy: xilinx: Check interface type in ->config(), not ->probe()

Message ID 20220317124958.27921-12-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>

We want to be able to have phydev->interface uninitialized during
->probe(). We should assume that phydev->interface is initialized only
before ->config().

Signed-off-by: Marek Behún <marek.behun@nic.cz>
---
 drivers/net/phy/xilinx_gmii2rgmii.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Ramon Fried March 18, 2022, 8:09 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>
>
> We want to be able to have phydev->interface uninitialized during
> ->probe(). We should assume that phydev->interface is initialized only
> before ->config().
>
> Signed-off-by: Marek Behún <marek.behun@nic.cz>
> ---
>  drivers/net/phy/xilinx_gmii2rgmii.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/phy/xilinx_gmii2rgmii.c b/drivers/net/phy/xilinx_gmii2rgmii.c
> index 635c0570ef..d92a364365 100644
> --- a/drivers/net/phy/xilinx_gmii2rgmii.c
> +++ b/drivers/net/phy/xilinx_gmii2rgmii.c
> @@ -26,6 +26,11 @@ static int xilinxgmiitorgmii_config(struct phy_device *phydev)
>
>         debug("%s\n", __func__);
>
> +       if (phydev->interface != PHY_INTERFACE_MODE_GMII) {
> +               printf("Incorrect interface type\n");
> +               return -EINVAL;
> +       }
> +
>         if (!ofnode_valid(node))
>                 return -EINVAL;
>
> @@ -114,11 +119,6 @@ static int xilinxgmiitorgmii_probe(struct phy_device *phydev)
>  {
>         debug("%s\n", __func__);
>
> -       if (phydev->interface != PHY_INTERFACE_MODE_GMII) {
> -               printf("Incorrect interface type\n");
> -               return -EINVAL;
> -       }
> -
>         phydev->flags |= PHY_FLAG_BROKEN_RESET;
>
>         return 0;
> --
> 2.34.1
>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
diff mbox series

Patch

diff --git a/drivers/net/phy/xilinx_gmii2rgmii.c b/drivers/net/phy/xilinx_gmii2rgmii.c
index 635c0570ef..d92a364365 100644
--- a/drivers/net/phy/xilinx_gmii2rgmii.c
+++ b/drivers/net/phy/xilinx_gmii2rgmii.c
@@ -26,6 +26,11 @@  static int xilinxgmiitorgmii_config(struct phy_device *phydev)
 
 	debug("%s\n", __func__);
 
+	if (phydev->interface != PHY_INTERFACE_MODE_GMII) {
+		printf("Incorrect interface type\n");
+		return -EINVAL;
+	}
+
 	if (!ofnode_valid(node))
 		return -EINVAL;
 
@@ -114,11 +119,6 @@  static int xilinxgmiitorgmii_probe(struct phy_device *phydev)
 {
 	debug("%s\n", __func__);
 
-	if (phydev->interface != PHY_INTERFACE_MODE_GMII) {
-		printf("Incorrect interface type\n");
-		return -EINVAL;
-	}
-
 	phydev->flags |= PHY_FLAG_BROKEN_RESET;
 
 	return 0;