Re: [PATCH] net: ravb: Fix PHY state warning splat during system resume

From: Geert Uytterhoeven
Date: Tue Sep 20 2022 - 03:07:39 EST


Hi Sergey,

On Mon, Sep 19, 2022 at 8:40 PM Sergey Shtylyov <s.shtylyov@xxxxxx> wrote:
> On 9/19/22 5:48 PM, Geert Uytterhoeven wrote:
> > Since commit 744d23c71af39c7d ("net: phy: Warn about incorrect
> > mdio_bus_phy_resume() state"), a warning splat is printed during system
> > resume with Wake-on-LAN disabled:
> >
> > WARNING: CPU: 0 PID: 1197 at drivers/net/phy/phy_device.c:323 mdio_bus_phy_resume+0xbc/0xc8
> >
> > As the Renesas Ethernet AVB driver already calls phy_{stop,start}() in
> > its suspend/resume callbacks, it is sufficient to just mark the MAC
> > responsible for managing the power state of the PHY.
> >
> > Fixes: fba863b816049b03 ("net: phy: make PHY PM ops a no-op if MAC driver manages PHY PM")
> > Signed-off-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>
>
> Reviewed-by: Sergey Shtylyov <s.shtylyov@xxxxxx>

Thanks for your review!

> > --- a/drivers/net/ethernet/renesas/ravb_main.c
> > +++ b/drivers/net/ethernet/renesas/ravb_main.c
> > @@ -1449,6 +1449,8 @@ static int ravb_phy_init(struct net_device *ndev)
> > phy_remove_link_mode(phydev, ETHTOOL_LINK_MODE_100baseT_Half_BIT);
> > }
> >
> > + /* Indicate that the MAC is responsible for managing PHY PM */
> > + phydev->mac_managed_pm = true;
>
> Hm, this field is declared as *unsigned*...

True, I copied this from drivers/net/ethernet/broadcom/genet/bcmmii.c.
But true/false are fully compatible with single-bit values.

The linuxdoc suggests to use true, like for all other single-bit fields used
as booleans:

include/linux/phy.h: * @mac_managed_pm: Set true if MAC driver takes
of suspending/resuming PHY

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds