diff options
author | Bartosz Golaszewski | 2015-04-16 12:43:28 -0700 |
---|---|---|
committer | Linus Torvalds | 2015-04-17 09:03:54 -0400 |
commit | 95d119528b0b8440a63bc13904e9873fc3a70503 (patch) | |
tree | 8e9ee1f06bb4843879ffc4ac542e2454f72b6430 /sound/sound_core.c | |
parent | a7a2c02a40151811609ad8cd3bf5c4fc516fece5 (diff) |
util_macros.h: add find_closest() macro
This series unduplicates the code used to find the member in an array
closest to 'x'.
The first patch adds a macro implementing the algorithm in two flavors -
for arrays sorted in ascending and descending order. The second updates
Documentation/CodingStyle on the naming convention for local variables in
macros resembling functions. Other three patches replace duplicated code
with calls to one of these macros in some hwmon drivers.
This patch (of 5):
Searching for the member of an array closest to 'x' is duplicated in
several places.
Add a new include - util_macros.h - and two macros that implement this
algorithm for arrays sorted both in ascending and descending order.
Uses linear search.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'sound/sound_core.c')
0 files changed, 0 insertions, 0 deletions