From: Bartosz Golaszewski <bgolaszew...@baylibre.com>

The following warning is produced when building nvmem core if
CONFIG_OF is disabled:

drivers/nvmem/core.c:496:1: warning: 'nvmem_find_cell_by_index' defined but not 
used [-Wunused-function]
 nvmem_find_cell_by_index(struct nvmem_device *nvmem, int index)
 ^~~~~~~~~~~~~~~~~~~~~~~~

This is caused by the fact that the only caller of this routine is
under an ifdef depending on this option. Fix it by adding a relevant
ifdef to the function in question as well.

Signed-off-by: Bartosz Golaszewski <bgolaszew...@baylibre.com>
---
 drivers/nvmem/core.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
index cc815bb2eebd..65f61cd0a687 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -492,6 +492,7 @@ static int nvmem_add_cells_from_table(struct nvmem_device 
*nvmem)
        return rval;
 }
 
+#if IS_ENABLED(CONFIG_OF)
 static struct nvmem_cell *
 nvmem_find_cell_by_index(struct nvmem_device *nvmem, int index)
 {
@@ -507,6 +508,7 @@ nvmem_find_cell_by_index(struct nvmem_device *nvmem, int 
index)
 
        return cell;
 }
+#endif
 
 static struct nvmem_cell *
 nvmem_find_cell_by_name(struct nvmem_device *nvmem, const char *cell_id)
-- 
2.19.0

Reply via email to