mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-23 01:10:04 +00:00
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>
This commit is contained in:
parent
08377263a9
commit
ca82c06788
1 changed files with 9 additions and 16 deletions
|
@ -142,24 +142,17 @@ static struct i2c_driver isp1301_driver = {
|
||||||
|
|
||||||
module_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)
|
struct i2c_client *isp1301_get_client(struct device_node *node)
|
||||||
{
|
{
|
||||||
if (node) { /* reference of ISP1301 I2C node via DT */
|
struct i2c_client *client;
|
||||||
struct device *dev = bus_find_device(&i2c_bus_type, NULL,
|
|
||||||
node, match);
|
/* reference of ISP1301 I2C node via DT */
|
||||||
if (!dev)
|
client = of_find_i2c_device_by_node(node);
|
||||||
return NULL;
|
if (client)
|
||||||
return to_i2c_client(dev);
|
return client;
|
||||||
} else { /* non-DT: only one ISP1301 chip supported */
|
|
||||||
return isp1301_i2c_client;
|
/* non-DT: only one ISP1301 chip supported */
|
||||||
}
|
return isp1301_i2c_client;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(isp1301_get_client);
|
EXPORT_SYMBOL_GPL(isp1301_get_client);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue