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

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

+1 -25
+1 -25
drivers/platform/x86/dual_accel_detect.h
··· 17 17 #include <linux/acpi.h> 18 18 #include <linux/i2c.h> 19 19 20 - static int dual_accel_i2c_resource_count(struct acpi_resource *ares, void *data) 21 - { 22 - struct acpi_resource_i2c_serialbus *sb; 23 - int *count = data; 24 - 25 - if (i2c_acpi_get_i2c_resource(ares, &sb)) 26 - *count = *count + 1; 27 - 28 - return 1; 29 - } 30 - 31 - static int dual_accel_i2c_client_count(struct acpi_device *adev) 32 - { 33 - int ret, count = 0; 34 - LIST_HEAD(r); 35 - 36 - ret = acpi_dev_get_resources(adev, &r, dual_accel_i2c_resource_count, &count); 37 - if (ret < 0) 38 - return ret; 39 - 40 - acpi_dev_free_resource_list(&r); 41 - return count; 42 - } 43 - 44 20 static bool dual_accel_detect_bosc0200(void) 45 21 { 46 22 struct acpi_device *adev; ··· 26 50 if (!adev) 27 51 return false; 28 52 29 - count = dual_accel_i2c_client_count(adev); 53 + count = i2c_acpi_client_count(adev); 30 54 31 55 acpi_dev_put(adev); 32 56