summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2021-08-03 18:00:42 +0200
committerHans de Goede <hdegoede@redhat.com>2021-08-12 17:26:36 +0200
commitf13d483eafdf60fc809e555e0329ee6257582612 (patch)
treea23c281012a5576431b11a9130839963811331fd
parenti2c: acpi: Add an i2c_acpi_client_count() helper function (diff)
downloadlinux-f13d483eafdf60fc809e555e0329ee6257582612.tar.xz
linux-f13d483eafdf60fc809e555e0329ee6257582612.zip
platform/x86: dual_accel_detect: Use the new i2c_acpi_client_count() helper
Use the new i2c_acpi_client_count() helper, this results in a nice cleanup. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20210803160044.158802-3-hdegoede@redhat.com
-rw-r--r--drivers/platform/x86/dual_accel_detect.h26
1 files changed, 1 insertions, 25 deletions
diff --git a/drivers/platform/x86/dual_accel_detect.h b/drivers/platform/x86/dual_accel_detect.h
index a9eae17cc43d..72e9624331c8 100644
--- a/drivers/platform/x86/dual_accel_detect.h
+++ b/drivers/platform/x86/dual_accel_detect.h
@@ -17,30 +17,6 @@
#include <linux/acpi.h>
#include <linux/i2c.h>
-static int dual_accel_i2c_resource_count(struct acpi_resource *ares, void *data)
-{
- struct acpi_resource_i2c_serialbus *sb;
- int *count = data;
-
- if (i2c_acpi_get_i2c_resource(ares, &sb))
- *count = *count + 1;
-
- return 1;
-}
-
-static int dual_accel_i2c_client_count(struct acpi_device *adev)
-{
- int ret, count = 0;
- LIST_HEAD(r);
-
- ret = acpi_dev_get_resources(adev, &r, dual_accel_i2c_resource_count, &count);
- if (ret < 0)
- return ret;
-
- acpi_dev_free_resource_list(&r);
- return count;
-}
-
static bool dual_accel_detect_bosc0200(void)
{
struct acpi_device *adev;
@@ -50,7 +26,7 @@ static bool dual_accel_detect_bosc0200(void)
if (!adev)
return false;
- count = dual_accel_i2c_client_count(adev);
+ count = i2c_acpi_client_count(adev);
acpi_dev_put(adev);