Re: [PATCH net-next 2/3] net: ag71xx: use devm for of_mdiobus_register
From: Rosen Penev
Date: Mon Aug 12 2024 - 17:36:09 EST
On Mon, Aug 12, 2024 at 2:28 PM Andrew Lunn <andrew@xxxxxxx> wrote:
>
> On Mon, Aug 12, 2024 at 12:06:52PM -0700, Rosen Penev wrote:
> > Allows removing ag71xx_mdio_remove.
> >
> > Removed local mii_bus variable and assign struct members directly.
> > Easier to reason about.
>
> This mixes up two different things, making the patch harder to
> review. Ideally you want lots of little patches, each doing one thing,
> and being obviously correct.
>
> Is ag->mii_bus actually used anywhere, outside of ag71xx_mdio_probe()?
> Often swapping to devm_ means the driver does not need to keep hold of
> the resources. So i actually think you can remove ag->mii_bus. This
> might of been more obvious if you had first swapped to
> devm_of_mdiobus_register() without the other changes mixed in.
not sure I follow. mdiobus_unregister would need to be called in
remove without devm. That would need a private mii_bus of some kind.
So with devm this is unneeded?
>
> Andrew
>
> ---
> pw-bot: cr