devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding@gmail.com>
To: Rob Herring <robh+dt@kernel.org>, Frank Rowand <frowand.list@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Russell King <linux@armlinux.org.uk>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 05/22] net: cpsw-phy-sel: Use of_device_match()
Date: Mon,  6 Jun 2016 10:31:47 +0200	[thread overview]
Message-ID: <20160606083204.19760-6-thierry.reding@gmail.com> (raw)
In-Reply-To: <20160606083204.19760-1-thierry.reding@gmail.com>

From: Thierry Reding <treding@nvidia.com>

This driver uses bus_find_device() to go through every platform device
and match using the driver and device tree node. It's more efficient to
use driver_find_device() to iterate over all devices associated with a
particular driver, in which case the matching is reduced to the device
tree node and can be done using the common implementation.

Signed-off-by: Thierry Reding <treding@nvidia.com>
---
 drivers/net/ethernet/ti/cpsw-phy-sel.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/ti/cpsw-phy-sel.c b/drivers/net/ethernet/ti/cpsw-phy-sel.c
index c3e85acfdc70..bb0de7744681 100644
--- a/drivers/net/ethernet/ti/cpsw-phy-sel.c
+++ b/drivers/net/ethernet/ti/cpsw-phy-sel.c
@@ -143,12 +143,6 @@ static void cpsw_gmii_sel_dra7xx(struct cpsw_phy_sel_priv *priv,
 }
 
 static struct platform_driver cpsw_phy_sel_driver;
-static int match(struct device *dev, void *data)
-{
-	struct device_node *node = (struct device_node *)data;
-	return dev->of_node == node &&
-		dev->driver == &cpsw_phy_sel_driver.driver;
-}
 
 void cpsw_phy_sel(struct device *dev, phy_interface_t phy_mode, int slave)
 {
@@ -161,7 +155,8 @@ void cpsw_phy_sel(struct device *dev, phy_interface_t phy_mode, int slave)
 		return;
 	}
 
-	dev = bus_find_device(&platform_bus_type, NULL, node, match);
+	dev = driver_find_device(&cpsw_phy_sel_driver.driver, NULL, node,
+				 of_device_match);
 	priv = dev_get_drvdata(dev);
 
 	priv->cpsw_phy_sel(priv, phy_mode, slave);
-- 
2.8.3

  parent reply	other threads:[~2016-06-06  8:31 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-06  8:31 [PATCH 00/22] of: Introduce of_match_device() Thierry Reding
2016-06-06  8:31 ` [PATCH 02/22] amba: tegra-ahb: Use of_device_match() Thierry Reding
2016-06-06 18:51   ` Frank Rowand
2016-06-06  8:31 ` [PATCH 03/22] coresight: " Thierry Reding
2016-06-06  8:31 ` [PATCH 04/22] i2c: core: " Thierry Reding
2016-06-06  8:31 ` Thierry Reding [this message]
2016-06-06  8:31 ` [PATCH 07/22] of/platform: " Thierry Reding
2016-06-06  8:31 ` [PATCH 08/22] spi: " Thierry Reding
2016-06-06  8:31 ` [PATCH 09/22] of: mdio: " Thierry Reding
     [not found] ` <20160606083204.19760-1-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-06-06  8:31   ` [PATCH 01/22] of: Implement of_match_device() Thierry Reding
2016-06-06  8:31   ` [PATCH 06/22] nvmem: core: Use of_device_match() Thierry Reding
2016-06-06  8:31   ` [PATCH 10/22] usb: phy: am335x-control: " Thierry Reding
2016-06-06  8:31   ` [PATCH 13/22] drm/armada: " Thierry Reding
2016-06-06  8:31 ` [PATCH 11/22] usb: phy: isp1301: " Thierry Reding
2016-06-06  8:31 ` [PATCH 12/22] drm/hdlcd: " Thierry Reding
2016-06-06  8:31 ` [PATCH 14/22] drm/etnaviv: " Thierry Reding
2016-06-06  8:31 ` [PATCH 15/22] drm/hisilicon: " Thierry Reding
2016-06-06  8:31 ` [PATCH 16/22] drm/mediatek: " Thierry Reding
2016-06-06  8:31 ` [PATCH 17/22] drm/msm: " Thierry Reding
2016-06-06  8:32 ` [PATCH 18/22] drm/rockchip: " Thierry Reding
2016-06-06  8:32 ` [PATCH 19/22] drm/sti: " Thierry Reding
2016-06-06  8:32 ` [PATCH 20/22] drm/sun4i: " Thierry Reding
2016-06-06  8:32 ` [PATCH 21/22] drm/tilcdc: " Thierry Reding
2016-06-06  8:32 ` [PATCH 22/22] iommu/mediatek: " Thierry Reding
2016-06-06 18:50 ` [PATCH 00/22] of: Introduce of_match_device() Frank Rowand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160606083204.19760-6-thierry.reding@gmail.com \
    --to=thierry.reding@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=frowand.list@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).