BACKPORT: 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: 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> Git-commit: 3c53e2352a9bf87128e7a8ddb69c7543941a3092 Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git [gkohli@codeaurora: Resolve trivial merge conflicts] Signed-off-by: Gaurav Kohli <gkohli@codeaurora.org> (cherry picked from commit 3c53e2352a9bf87128e7a8ddb69c7543941a3092) Signed-off-by: Mark Salyzyn <salyzyn@google.com> Bug: 150014847 Change-Id: I9259be4385810eeda4c4feebf1ebe9464228d6f8
This commit is contained in:
parent
0fc0aae624
commit
630590db62
1 changed files with 16 additions and 16 deletions
|
@ -446,22 +446,6 @@ static int nvmem_setup_compat(struct nvmem_device *nvmem,
|
|||
return 0;
|
||||
}
|
||||
|
||||
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 int nvmem_add_cells_from_of(struct nvmem_device *nvmem)
|
||||
{
|
||||
struct device_node *parent, *child;
|
||||
|
@ -907,6 +891,22 @@ static struct nvmem_cell *nvmem_cell_get_from_list(const char *cell_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
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue