From mboxrd@z Thu Jan 1 00:00:00 1970 From: Florian Fainelli Subject: Re: [PATCH 3/3] net: davinci_emac: match the mdio device against its compatible if possible Date: Tue, 19 Jun 2018 09:56:05 -0700 Message-ID: <39cd3e11-9967-f0da-8817-268c879a927e@gmail.com> References: <20180619160950.6283-1-brgl@bgdev.pl> <20180619160950.6283-4-brgl@bgdev.pl> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: linux-omap@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski To: Bartosz Golaszewski , Grygorii Strashko , "David S . Miller" , Dan Carpenter , Ivan Khoronzhuk , Rob Herring , Lukas Wunner , Kevin Hilman , David Lechner , Sekhar Nori , Andrew Lunn Return-path: In-Reply-To: <20180619160950.6283-4-brgl@bgdev.pl> Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org List-Id: netdev.vger.kernel.org On 06/19/2018 09:09 AM, Bartosz Golaszewski wrote: > From: Bartosz Golaszewski > > Device tree based systems without of_dev_auxdata will have the mdio > device named differently than "davinci_mdio(.0)". In this case use the > device's compatible string for matching. > > Signed-off-by: Bartosz Golaszewski > --- > drivers/net/ethernet/ti/davinci_emac.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c > index a1a6445b5a7e..c28a35bb852f 100644 > --- a/drivers/net/ethernet/ti/davinci_emac.c > +++ b/drivers/net/ethernet/ti/davinci_emac.c > @@ -1387,6 +1387,10 @@ static int emac_devioctl(struct net_device *ndev, struct ifreq *ifrq, int cmd) > > static int match_first_device(struct device *dev, void *data) > { > + if (dev->of_node) > + return of_device_is_compatible(dev->of_node, > + "ti,davinci_mdio"); Why would we be matching the PHY device with the MDIO controller compatibe string? Why not check dev->parent.of_node instead which would make more sense? -- Florian