nvmem: hide unused nvmem_find_cell_by_index function
authorArnd Bergmann <arnd@arndb.de>
Tue, 2 Oct 2018 21:11:12 +0000 (23:11 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 15 Oct 2018 13:56:15 +0000 (15:56 +0200)
nvmem_find_cell_by_index() is only called from inside an #ifdef,
so we get a build warning without CONFIG_OF:

drivers/nvmem/core.c:496:1: error: 'nvmem_find_cell_by_index' defined but not used [-Werror=unused-function]

Move it into the same #ifdef as the caller to avoid the warning.

Fixes: e888d445ac33 ("nvmem: resolve cells from DT at registration time")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/nvmem/core.c

index 31ca04d46c1cc155d51110e4c452df8f60de3f9e..9b18ce90f90733a0b4d6ceec64921488cd19aa80 100644 (file)
@@ -493,22 +493,6 @@ out:
        return rval;
 }
 
-static struct nvmem_cell *
-nvmem_find_cell_by_index(struct nvmem_device *nvmem, int index)
-{
-       struct nvmem_cell *cell = NULL;
-       int i = 0;
-
-       mutex_lock(&nvmem_mutex);
-       list_for_each_entry(cell, &nvmem->cells, node) {
-               if (index == i++)
-                       break;
-       }
-       mutex_unlock(&nvmem_mutex);
-
-       return cell;
-}
-
 static struct nvmem_cell *
 nvmem_find_cell_by_name(struct nvmem_device *nvmem, const char *cell_id)
 {
@@ -975,6 +959,22 @@ out:
 }
 
 #if IS_ENABLED(CONFIG_OF)
+static struct nvmem_cell *
+nvmem_find_cell_by_index(struct nvmem_device *nvmem, int index)
+{
+       struct nvmem_cell *cell = NULL;
+       int i = 0;
+
+       mutex_lock(&nvmem_mutex);
+       list_for_each_entry(cell, &nvmem->cells, node) {
+               if (index == i++)
+                       break;
+       }
+       mutex_unlock(&nvmem_mutex);
+
+       return cell;
+}
+
 /**
  * of_nvmem_cell_get() - Get a nvmem cell from given device node and cell id
  *