[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 6 Jun 2016 10:31:47 +0200
From: Thierry Reding <thierry.reding@...il.com>
To: Rob Herring <robh+dt@...nel.org>,
Frank Rowand <frowand.list@...il.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Russell King <linux@...linux.org.uk>,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH 05/22] net: cpsw-phy-sel: Use of_device_match()
From: Thierry Reding <treding@...dia.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@...dia.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
Powered by blists - more mailing lists