[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6ca8f12d-9413-400d-bfc4-9a6c4a2d8896@lunn.ch>
Date: Tue, 28 Oct 2025 22:02:27 +0100
From: Andrew Lunn <andrew@...n.ch>
To: Alexander Duyck <alexander.duyck@...il.com>
Cc: netdev@...r.kernel.org, kuba@...nel.org, kernel-team@...a.com,
	andrew+netdev@...n.ch, hkallweit1@...il.com, linux@...linux.org.uk,
	pabeni@...hat.com, davem@...emloft.net
Subject: Re: [net-next PATCH 8/8] fbnic: Add phydev representing PMD to
 phylink setup
> +/**
> + * fbnic_phylink_connect - Connect phylink structure to IRQ, PHY, and enable it
> + * @fbn: FBNIC Netdev private data struct phylink device attached to
> + *
> + * This function connects the phylink structure to the PHY and IRQ and then
> + * enables it to resuem operations. With this function completed the PHY will
resume
> + * be able to obtain link and notify the netdev of its current state.
> + **/
> +int fbnic_phylink_connect(struct fbnic_net *fbn)
> +{
> +	struct fbnic_dev *fbd = fbn->fbd;
> +	struct phy_device *phydev;
> +	int err;
> +
> +	phydev = phy_find_first(fbd->mii_bus);
phy_find_first() is generally used when you have no idea what address
the PHY is using. It can cause future surprises when additional
devices appear on the bus.
In this case, you know what address the device is on the bus, so
mdiobus_get_phy() would be better.
> +	if (!phydev) {
> +		dev_err(fbd->dev, "No PHY found\n");
> +		return -ENODEV;
> +	}
> +
> +	/* We don't need to poll, the MAC will notify us of events */
> +	phydev->irq = PHY_MAC_INTERRUPT;
> +
> +	phy_attached_info(phydev);
> +
> +	err = phylink_connect_phy(fbn->phylink, phydev);
> +	if (err) {
> +		dev_err(fbd->dev, "Error connecting phy, err: %d\n", err);
> +		return err;
> +	}
> +
> +	err = fbnic_mac_request_irq(fbd);
> +	if (err) {
> +		phylink_disconnect_phy(fbn->phylink);
> +		dev_err(fbd->dev, "Error requesting MAC IRQ, err: %d", err);
> +		return err;
> +	}
> +
> +	phylink_resume(fbn->phylink);
When was is suspended?
	Andrew
Powered by blists - more mailing lists
 
