Re: [PATCH net-next v4 2/2] rust: net: phy: pass &Device to suspend, read_mmd and write_mmd

From: FUJITA Tomonori

Date: Mon Nov 30 2026 - 04:54:55 EST


On Thu, 26 Nov 2026 23:08:33 +0900
SeungJong Ha <engineer.jjhama@xxxxxxxxx> wrote:

> /// Overrides the default MMD read function for reading a MMD register.
> - fn read_mmd(_dev: &mut Device, _devnum: u8, _regnum: u16) -> Result<u16> {
> + ///
> + /// PHYLIB calls this with the MDIO bus lock held, so calling [`Device::read`] or
> + /// [`Device::write`] here deadlocks.

As sashiko pointed out, genphy_suspend() also takes the MDIO bus lock.
Maybe say "methods that take the MDIO bus lock" instead of listing
them.

> + fn read_mmd(_dev: &Device, _devnum: u8, _regnum: u16) -> Result<u16> {
> build_error!(VTABLE_DEFAULT_ERROR)
> }
>
> /// Overrides the default MMD write function for writing a MMD register.
> - fn write_mmd(_dev: &mut Device, _devnum: u8, _regnum: u16, _val: u16) -> Result {
> + ///
> + /// PHYLIB calls this with the MDIO bus lock held, so calling [`Device::read`] or
> + /// [`Device::write`] here deadlocks.

Ditto.