From ca82c06788422f7bff38e1282bf5057aefd70903 Mon Sep 17 00:00:00 2001 From: Andy Shevchenko Date: Fri, 21 May 2021 17:52:43 +0300 Subject: usb: phy: isp1301: Deduplicate of_find_i2c_device_by_node() The driver is using open-coded variant of of_find_i2c_device_by_node(). Replace it by the actual call to the above mentioned API. Signed-off-by: Andy Shevchenko Link: https://lore.kernel.org/r/20210521145243.87911-1-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman --- drivers/usb/phy/phy-isp1301.c | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) (limited to 'drivers') diff --git a/drivers/usb/phy/phy-isp1301.c b/drivers/usb/phy/phy-isp1301.c index 6cf6fbd39237..ad3d57f1c273 100644 --- a/drivers/usb/phy/phy-isp1301.c +++ b/drivers/usb/phy/phy-isp1301.c @@ -142,24 +142,17 @@ static struct i2c_driver isp1301_driver = { module_i2c_driver(isp1301_driver); -static int match(struct device *dev, const void *data) -{ - const struct device_node *node = (const struct device_node *)data; - return (dev->of_node == node) && - (dev->driver == &isp1301_driver.driver); -} - struct i2c_client *isp1301_get_client(struct device_node *node) { - if (node) { /* reference of ISP1301 I2C node via DT */ - struct device *dev = bus_find_device(&i2c_bus_type, NULL, - node, match); - if (!dev) - return NULL; - return to_i2c_client(dev); - } else { /* non-DT: only one ISP1301 chip supported */ - return isp1301_i2c_client; - } + struct i2c_client *client; + + /* reference of ISP1301 I2C node via DT */ + client = of_find_i2c_device_by_node(node); + if (client) + return client; + + /* non-DT: only one ISP1301 chip supported */ + return isp1301_i2c_client; } EXPORT_SYMBOL_GPL(isp1301_get_client); -- cgit v1.2.3