aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBehan Webster <behanw@converseincode.com>2014-09-23 22:43:11 -0700
committerBernhard Rosenkränzer <bero@linaro.org>2017-02-01 16:51:36 +0100
commit6788398f4879b06a865bdc241f843d137d5361e9 (patch)
treeb1f3bc56f2f2ea533e8103a71223780ebe659eb2
parentb9c61082902e37822ac5c9fabf2410bd22eb9243 (diff)
downloadhikey-clang-6788398f4879b06a865bdc241f843d137d5361e9.tar.gz
md, sysfs, LLVMLinux: Remove nested function from bcache sysfs
Replace the use of nested functions where a normal function will suffice. Nested functions are not liked by upstream kernel developers in general. Their use breaks the use of clang as a compiler, and doesn't make the code any better. This code now works for both gcc and clang. Signed-off-by: Behan Webster <behanw@converseincode.com> Reviewed-by: Mark Charlebois <charlebm@gmail.com> Suggested-by: Arnd Bergmann <arnd@arndb.de> Cc: Arnd Bergmann <arnd@arndb.de>
-rw-r--r--drivers/md/bcache/sysfs.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/md/bcache/sysfs.c b/drivers/md/bcache/sysfs.c
index b3ff57d61dde..53d8baa741fb 100644
--- a/drivers/md/bcache/sysfs.c
+++ b/drivers/md/bcache/sysfs.c
@@ -731,6 +731,11 @@ static struct attribute *bch_cache_set_internal_files[] = {
};
KTYPE(bch_cache_set_internal);
+static int __bch_cache_cmp(const void *l, const void *r)
+{
+ return *((uint16_t *) r) - *((uint16_t *) l);
+}
+
SHOW(__bch_cache)
{
struct cache *ca = container_of(kobj, struct cache, kobj);
@@ -755,9 +760,6 @@ SHOW(__bch_cache)
CACHE_REPLACEMENT(&ca->sb));
if (attr == &sysfs_priority_stats) {
- int cmp(const void *l, const void *r)
- { return *((uint16_t *) r) - *((uint16_t *) l); }
-
struct bucket *b;
size_t n = ca->sb.nbuckets, i;
size_t unused = 0, available = 0, dirty = 0, meta = 0;
@@ -786,7 +788,7 @@ SHOW(__bch_cache)
p[i] = ca->buckets[i].prio;
mutex_unlock(&ca->set->bucket_lock);
- sort(p, n, sizeof(uint16_t), cmp, NULL);
+ sort(p, n, sizeof(uint16_t), __bch_cache_cmp, NULL);
while (n &&
!cached[n - 1])