[U-Boot] [PATCH 1/2] phylib: reset mii bus only if reset handler is registered

Mike Frysinger vapier at gentoo.org
Fri Sep 23 00:13:08 CEST 2011


On Thursday, September 22, 2011 17:44:11 Andy Fleming wrote:
> On Mon, Sep 5, 2011 at 12:24 PM, Vladimir Zapolskiy <vz at mleia.com> wrote:
> > This change allows to cope with a mii bus device registered using
> > miiphy_register(), which doesn't assign a default reset handler.
> > 
> > --- a/drivers/net/phy/phy.c
> > +++ b/drivers/net/phy/phy.c
> > @@ -692,7 +692,8 @@ struct phy_device *phy_connect(struct mii_dev *bus,
> > int addr, struct phy_device *phydev;
> > 
> >        /* Reset the bus */
> > -       bus->reset(bus);
> > +       if (bus->reset)
> > +               bus->reset(bus);
> 
> The change is a good idea, but I find the motivation for it strange.
> If you register a bus with miiphy_register, you are declaring your
> intent to use the legacy PHY interface. But phy_connect() is part of
> the new phylib API. It was not intended that combining the two work at
> all. Looking at the code, I see no reason it wouldn't work, but I
> question why you would do that, instead of creating a proper MDIO
> driver?

hmm, is there an #ifdef check we could add that would cause an #error if 
people mix the old and the new ?  i think it makes sense to just force 
everyone to migrate to the new ...
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20110922/7f609d17/attachment.pgp 


More information about the U-Boot mailing list