[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87d1o75uco.fsf@ketchup.mtl.sfl>
Date: Fri, 27 May 2016 12:38:47 -0400
From: Vivien Didelot <vivien.didelot@...oirfairelinux.com>
To: Andrew Lunn <andrew@...n.ch>
Cc: netdev <netdev@...r.kernel.org>,
Florian Fainelli <f.fainelli@...il.com>,
John Crispin <john@...ozen.org>, Bryan.Whitehead@...rochip.com
Subject: Re: [RFC PATCH 12/16] dsa: Make mdio bus optional
Hi Andrew,
Andrew Lunn <andrew@...n.ch> writes:
> On Fri, May 27, 2016 at 10:55:45AM -0400, Vivien Didelot wrote:
>> Hi Andrew,
>>
>> Andrew Lunn <andrew@...n.ch> writes:
>>
>> > - mdiobus_unregister(ds->slave_mii_bus);
>> > + if (ds->slave_mii_bus && ds->drv->phy_read)
>> > + mdiobus_unregister(ds->slave_mii_bus);
>>
>> So if a driver registered the slave MII bus itself, it may have
>> unregistered it itself as well, so checking ds->slave_mii_bus is OK
>> (assuming the driver correctly zero'ed it).
>>
>> But is it necessary to check ds->drv->phy_read?
>
> It makes the code symmetrical to the register code, which makes the
> same check. My experience is that keeping the code symmetrical results
> in less surprises late on.
>
> One such surprise could be a driver that does not zero
> ds->slave_mii_bus. In fact, mv88e6xxx does not zero it. So we would
> get a double unregister happening. We also don't want the core
> unregistering it, since we have other cleanup work to do, we have an
> of_node_put() to call.
OK good for me, as long as it is intuitive for the driver
implementation.
Thanks,
Vivien
Powered by blists - more mailing lists