From af668d6518dcf7106bf4eef1641d8143842dc9cc Mon Sep 17 00:00:00 2001 From: Andy Shevchenko Date: Fri, 21 Jun 2019 14:36:24 +0300 Subject: i2c: i801: Use match_string() helper to simplify the code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit match_string() returns the array index of a matching string. Use it instead of the open-coded implementation. Signed-off-by: Andy Shevchenko Reviewed-by: Pali Rohár Reviewed-by: Jean Delvare Signed-off-by: Wolfram Sang --- drivers/i2c/busses/i2c-i801.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'drivers/i2c/busses') diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c index 7d14b6729772..88e4dd2adbfe 100644 --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c @@ -100,6 +100,7 @@ #include #include #include +#include #include #include #include @@ -1172,14 +1173,12 @@ static acpi_status check_acpi_smo88xx_device(acpi_handle obj_handle, if (!hid) return AE_OK; - for (i = 0; i < ARRAY_SIZE(acpi_smo8800_ids); ++i) { - if (strcmp(hid, acpi_smo8800_ids[i]) == 0) { - *((bool *)return_value) = true; - return AE_CTRL_TERMINATE; - } - } + i = match_string(acpi_smo8800_ids, ARRAY_SIZE(acpi_smo8800_ids), hid); + if (i < 0) + return AE_OK; - return AE_OK; + *((bool *)return_value) = true; + return AE_CTRL_TERMINATE; } static bool is_dell_system_with_lis3lv02d(void) -- cgit v1.2.3