Commit 3c53e235 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Greg Kroah-Hartman

nvmem: hide unused nvmem_find_cell_by_index function

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: e888d445 ("nvmem: resolve cells from DT at registration time")
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Acked-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 098ec84f
......@@ -493,22 +493,6 @@ static int nvmem_add_cells_from_table(struct nvmem_device *nvmem)
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 @@ nvmem_cell_get_from_lookup(struct device *dev, const char *con_id)
}
#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
*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment