Commit 0a2d47aa authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Greg Kroah-Hartman

i2c: acpi: Replace custom function with device_match_acpi_handle()

Since driver core provides a generic device_match_acpi_handle()
we may replace the custom one with it. This unifies code to find
an adapter with the similar one which finds a client.
Acked-by: default avatarWolfram Sang <wsa@kernel.org>
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Link: https://lore.kernel.org/r/20211014134756.39092-2-andriy.shevchenko@linux.intel.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent a164ff53
...@@ -398,24 +398,20 @@ u32 i2c_acpi_find_bus_speed(struct device *dev) ...@@ -398,24 +398,20 @@ u32 i2c_acpi_find_bus_speed(struct device *dev)
} }
EXPORT_SYMBOL_GPL(i2c_acpi_find_bus_speed); EXPORT_SYMBOL_GPL(i2c_acpi_find_bus_speed);
static int i2c_acpi_find_match_adapter(struct device *dev, const void *data)
{
struct i2c_adapter *adapter = i2c_verify_adapter(dev);
if (!adapter)
return 0;
return ACPI_HANDLE(dev) == (acpi_handle)data;
}
struct i2c_adapter *i2c_acpi_find_adapter_by_handle(acpi_handle handle) struct i2c_adapter *i2c_acpi_find_adapter_by_handle(acpi_handle handle)
{ {
struct i2c_adapter *adapter;
struct device *dev; struct device *dev;
dev = bus_find_device(&i2c_bus_type, NULL, handle, dev = bus_find_device(&i2c_bus_type, NULL, handle, device_match_acpi_handle);
i2c_acpi_find_match_adapter); if (!dev)
return NULL;
adapter = i2c_verify_adapter(dev);
if (!adapter)
put_device(dev);
return dev ? i2c_verify_adapter(dev) : NULL; return adapter;
} }
EXPORT_SYMBOL_GPL(i2c_acpi_find_adapter_by_handle); EXPORT_SYMBOL_GPL(i2c_acpi_find_adapter_by_handle);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment