Re: [PATCH net-next 2/2] net: stmmac: platform: add support for phy-supply

From: Andrew Lunn
Date: Tue Jul 18 2023 - 09:11:02 EST


On Tue, Jul 18, 2023 at 10:38:41AM +0200, Marco Felsch wrote:
> On 23-07-18, Andrew Lunn wrote:
> > > +static int stmmac_phy_power(struct platform_device *pdev,
> > > + struct plat_stmmacenet_data *plat,
> > > + bool enable)
> > > +{
> > > + struct regulator *regulator = plat->phy_regulator;
> > > + int ret = 0;
> > > +
> > > + if (regulator) {
> > > + if (enable)
> > > + ret = regulator_enable(regulator);
> > > + else
> > > + regulator_disable(regulator);
> > > + }
> > > +
> > > + if (ret)
> > > + dev_err(&pdev->dev, "Fail to enable regulator\n");
> >
> > 'enable' is only correct 50% of the time.
>
> You mean to move it under the enable path.

Or don't use the word 'enable'. 'modify' ?

> Good point didn't consider WOL. Is there a way to check if WOL is
> enabled?

Yes, plenty of MAC drivers do this. Look around.

Andrew