Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20210521145243.87911-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Andy Shevchenko and committed by
Greg Kroah-Hartman
ca82c067 08377263

+9 -16
+9 -16
drivers/usb/phy/phy-isp1301.c
··· 142 142 143 143 module_i2c_driver(isp1301_driver); 144 144 145 - static int match(struct device *dev, const void *data) 146 - { 147 - const struct device_node *node = (const struct device_node *)data; 148 - return (dev->of_node == node) && 149 - (dev->driver == &isp1301_driver.driver); 150 - } 151 - 152 145 struct i2c_client *isp1301_get_client(struct device_node *node) 153 146 { 154 - if (node) { /* reference of ISP1301 I2C node via DT */ 155 - struct device *dev = bus_find_device(&i2c_bus_type, NULL, 156 - node, match); 157 - if (!dev) 158 - return NULL; 159 - return to_i2c_client(dev); 160 - } else { /* non-DT: only one ISP1301 chip supported */ 161 - return isp1301_i2c_client; 162 - } 147 + struct i2c_client *client; 148 + 149 + /* reference of ISP1301 I2C node via DT */ 150 + client = of_find_i2c_device_by_node(node); 151 + if (client) 152 + return client; 153 + 154 + /* non-DT: only one ISP1301 chip supported */ 155 + return isp1301_i2c_client; 163 156 } 164 157 EXPORT_SYMBOL_GPL(isp1301_get_client); 165 158