Skip to contentSkip to conversation

nvmem: only build nvmem_find_cell_by_index() if OF is enabled

PATCH In review Bartosz Golaszewski 4 participants 5 messages Oct 2, 2018 – Oct 3, 2018 NVMEM framework

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvmem: only build nvmem_find_cell_by_index() if OF is enabled

From: Bartosz Golaszewski <[email protected]>

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.

---
 drivers/nvmem/core.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/nvmem/core.c +2 -0
index cc815bb2eebd..65f61cd0a687 100644
@@ -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)
Signature · 1 line
2.19.0
#1 lore raw
Quoted 23 lines · Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

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.

---
  drivers/nvmem/core.c | 2 ++
  1 file changed, 2 insertions(+)
drivers/nvmem/core.c +0 -0
index cc815bb2eebd..65f61cd0a687 100644

drivers/nvmem/core.c static int nvmem_add_cells_from_table(struct nvmem_device *nvmem) · line 495

Quoted 4 lines
drivers/nvmem/core.c +1 -0
@@ -492,6 +492,7 @@ static int nvmem_add_cells_from_table(struct nvmem_device *nvmem)
  	return rval;
  }
 
+#if IS_ENABLED(CONFIG_OF)

You should probably attribute the function with "__maybe_unused" Instead of adding this condition.

--srini

Quoted 12 lines
drivers/nvmem/core.c +1 -0
  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 lore raw

wt., 2 pa? 2018 o 13:49 Srinivas Kandagatla
<[email protected]> napisa?(a):

Quoted 30 lines · Bartosz Golaszewski
Quoted 26 lines

From: Bartosz Golaszewski <[email protected]>

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.

---
  drivers/nvmem/core.c | 2 ++
  1 file changed, 2 insertions(+)
drivers/nvmem/core.c +0 -0
index cc815bb2eebd..65f61cd0a687 100644
@@ -492,6 +492,7 @@ static int nvmem_add_cells_from_table(struct nvmem_device *nvmem)
      return rval;
  }
 
Quoted 5 lines

drivers/nvmem/core.c static int nvmem_add_cells_from_table(struct nvmem_device *nvmem) · line 495

Quoted 1 line
drivers/nvmem/core.c +1 -0
+#if IS_ENABLED(CONFIG_OF)

You should probably attribute the function with "__maybe_unused" Instead of adding this condition.

Sounds better indeed. I'll resend tomorrow to avoid spamming.

Bart

Quoted 15 lines

--srini

Quoted 12 lines
drivers/nvmem/core.c +1 -0
  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)
#3 lore raw
In reply to Bartosz Golaszewski
Quoted 9 lines · Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

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) ^~~~~~~~~~~~~~~~~~~~~~~~

Quoted 5 lines

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.

No "reported-by:" lines on this and the other patch?

Not nice :(

#4 lore raw

?r., 3 pa? 2018 o 00:26 Greg KH <[email protected]> napisa?(a):

Quoted 15 lines · Bartosz Golaszewski
Quoted 13 lines

From: Bartosz Golaszewski <[email protected]>

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.

Quoted 5 lines
Quoted 1 line

No "reported-by:" lines on this and the other patch?

Not nice :(

Sorry, I normally remeber about it. Anyway Arnd sent a better alternative for this one.

Bart