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

Configure Feed

Select the types of activity you want to include in your feed.

iio: core: Replace iio_sysfs_match_string_with_gaps() by __sysfs_match_string()

None of the current users is using gaps in the list of the items.
No need to have a specific function for that, just replace it by
library available __sysfs_match_string().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20230118074828.66155-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Andy Shevchenko and committed by
Jonathan Cameron
122fb873 cd19fbfe

+1 -31
+1 -31
drivers/iio/industrialio-core.c
··· 205 205 } 206 206 EXPORT_SYMBOL_GPL(iio_buffer_enabled); 207 207 208 - /** 209 - * iio_sysfs_match_string_with_gaps - matches given string in an array with gaps 210 - * @array: array of strings 211 - * @n: number of strings in the array 212 - * @str: string to match with 213 - * 214 - * Returns index of @str in the @array or -EINVAL, similar to match_string(). 215 - * Uses sysfs_streq instead of strcmp for matching. 216 - * 217 - * This routine will look for a string in an array of strings. 218 - * The search will continue until the element is found or the n-th element 219 - * is reached, regardless of any NULL elements in the array. 220 - */ 221 - static int iio_sysfs_match_string_with_gaps(const char * const *array, size_t n, 222 - const char *str) 223 - { 224 - const char *item; 225 - int index; 226 - 227 - for (index = 0; index < n; index++) { 228 - item = array[index]; 229 - if (!item) 230 - continue; 231 - if (sysfs_streq(item, str)) 232 - return index; 233 - } 234 - 235 - return -EINVAL; 236 - } 237 - 238 208 #if defined(CONFIG_DEBUG_FS) 239 209 /* 240 210 * There's also a CONFIG_DEBUG_FS guard in include/linux/iio/iio.h for ··· 539 569 if (!e->set) 540 570 return -EINVAL; 541 571 542 - ret = iio_sysfs_match_string_with_gaps(e->items, e->num_items, buf); 572 + ret = __sysfs_match_string(e->items, e->num_items, buf); 543 573 if (ret < 0) 544 574 return ret; 545 575