From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bartosz Golaszewski Subject: [PATCH v2 2/2] net: davinci_emac: match the mdio device against its compatible if possible Date: Wed, 20 Jun 2018 10:03:56 +0200 Message-ID: <20180620080356.11900-3-brgl@bgdev.pl> References: <20180620080356.11900-1-brgl@bgdev.pl> Cc: linux-omap@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski To: Grygorii Strashko , "David S . Miller" , Florian Fainelli , Dan Carpenter , Ivan Khoronzhuk , Rob Herring , Lukas Wunner , Kevin Hilman , David Lechner , Sekhar Nori , Andrew Lunn Return-path: Received: from mail-wm0-f65.google.com ([74.125.82.65]:52470 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753995AbeFTIaS (ORCPT ); Wed, 20 Jun 2018 04:30:18 -0400 Received: by mail-wm0-f65.google.com with SMTP id p126-v6so4556585wmb.2 for ; Wed, 20 Jun 2018 01:30:17 -0700 (PDT) In-Reply-To: <20180620080356.11900-1-brgl@bgdev.pl> Sender: netdev-owner@vger.kernel.org List-ID: 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 parent'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..f270beebb428 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->parent && dev->parent->of_node) + return of_device_is_compatible(dev->parent->of_node, + "ti,davinci_mdio"); + return !strncmp(dev_name(dev), "davinci_mdio", 12); } -- 2.17.1