[PATCH v1 2/6] staging: atomisp: Replace open-coded i2c_acpi_find_client_by_adev()
From: Andy Shevchenko
Date: Wed May 26 2021 - 08:44:34 EST
gmin_i2c_dev_exists() is using open-coded variant of
i2c_acpi_find_client_by_adev(). Replace it with a corresponding call.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
---
.../staging/media/atomisp/pci/atomisp_gmin_platform.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c b/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c
index 135994d44802..a1064d1a3d6b 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c
@@ -378,19 +378,14 @@ static struct i2c_client *gmin_i2c_dev_exists(struct device *dev, char *name,
struct i2c_client **client)
{
struct acpi_device *adev;
- struct device *d;
adev = acpi_dev_get_first_match_dev(name, NULL, -1);
if (!adev)
return NULL;
- d = bus_find_device_by_acpi_dev(&i2c_bus_type, adev);
- acpi_dev_put(adev);
- if (!d)
- return NULL;
+ *client = i2c_acpi_find_client_by_adev(adev);
- *client = i2c_verify_client(d);
- put_device(d);
+ acpi_dev_put(adev);
dev_dbg(dev, "found '%s' at address 0x%02x, adapter %d\n",
(*client)->name, (*client)->addr, (*client)->adapter->nr);
--
2.30.2