linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nvmem: only build nvmem_find_cell_by_index() if OF is enabled
@ 2018-10-02 11:02 Bartosz Golaszewski
  2018-10-02 11:49 ` Srinivas Kandagatla
  2018-10-02 22:26 ` Greg KH
  0 siblings, 2 replies; 5+ messages in thread
From: Bartosz Golaszewski @ 2018-10-02 11:02 UTC (permalink / raw)
  To: Srinivas Kandagatla, Arnd Bergmann, Greg KH, Stephen Rothwell
  Cc: linux-arm-kernel, linux-kernel, Bartosz Golaszewski

From: Bartosz Golaszewski <bgolaszewski@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 <bgolaszewski@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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] nvmem: only build nvmem_find_cell_by_index() if OF is enabled
  2018-10-02 11:02 [PATCH] nvmem: only build nvmem_find_cell_by_index() if OF is enabled Bartosz Golaszewski
@ 2018-10-02 11:49 ` Srinivas Kandagatla
  2018-10-02 11:59   ` Bartosz Golaszewski
  2018-10-02 22:26 ` Greg KH
  1 sibling, 1 reply; 5+ messages in thread
From: Srinivas Kandagatla @ 2018-10-02 11:49 UTC (permalink / raw)
  To: Bartosz Golaszewski, Arnd Bergmann, Greg KH, Stephen Rothwell
  Cc: linux-arm-kernel, linux-kernel, Bartosz Golaszewski



On 02/10/18 12:02, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bgolaszewski@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 <bgolaszewski@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)

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

--srini


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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] nvmem: only build nvmem_find_cell_by_index() if OF is enabled
  2018-10-02 11:49 ` Srinivas Kandagatla
@ 2018-10-02 11:59   ` Bartosz Golaszewski
  0 siblings, 0 replies; 5+ messages in thread
From: Bartosz Golaszewski @ 2018-10-02 11:59 UTC (permalink / raw)
  To: Srinivas Kandagatla
  Cc: Bartosz Golaszewski, Arnd Bergmann, GregKH, sfr, arm-soc, LKML

wt., 2 paź 2018 o 13:49 Srinivas Kandagatla
<srinivas.kandagatla@linaro.org> napisał(a):
>
>
>
> On 02/10/18 12:02, Bartosz Golaszewski wrote:
> > From: Bartosz Golaszewski <bgolaszewski@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 <bgolaszewski@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)
>
> 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

> --srini
>
>
> >   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)
> >

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] nvmem: only build nvmem_find_cell_by_index() if OF is enabled
  2018-10-02 11:02 [PATCH] nvmem: only build nvmem_find_cell_by_index() if OF is enabled Bartosz Golaszewski
  2018-10-02 11:49 ` Srinivas Kandagatla
@ 2018-10-02 22:26 ` Greg KH
  2018-10-03  7:19   ` Bartosz Golaszewski
  1 sibling, 1 reply; 5+ messages in thread
From: Greg KH @ 2018-10-02 22:26 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Srinivas Kandagatla, Arnd Bergmann, Stephen Rothwell,
	linux-arm-kernel, linux-kernel, Bartosz Golaszewski

On Tue, Oct 02, 2018 at 01:02:46PM +0200, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bgolaszewski@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 <bgolaszewski@baylibre.com>

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

Not nice :(

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] nvmem: only build nvmem_find_cell_by_index() if OF is enabled
  2018-10-02 22:26 ` Greg KH
@ 2018-10-03  7:19   ` Bartosz Golaszewski
  0 siblings, 0 replies; 5+ messages in thread
From: Bartosz Golaszewski @ 2018-10-03  7:19 UTC (permalink / raw)
  To: Greg KH
  Cc: Srinivas Kandagatla, Arnd Bergmann, Stephen Rothwell, Linux ARM,
	Linux Kernel Mailing List, Bartosz Golaszewski

śr., 3 paź 2018 o 00:26 Greg KH <greg@kroah.com> napisał(a):
>
> On Tue, Oct 02, 2018 at 01:02:46PM +0200, Bartosz Golaszewski wrote:
> > From: Bartosz Golaszewski <bgolaszewski@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 <bgolaszewski@baylibre.com>
>
> 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-10-03  7:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-02 11:02 [PATCH] nvmem: only build nvmem_find_cell_by_index() if OF is enabled Bartosz Golaszewski
2018-10-02 11:49 ` Srinivas Kandagatla
2018-10-02 11:59   ` Bartosz Golaszewski
2018-10-02 22:26 ` Greg KH
2018-10-03  7:19   ` Bartosz Golaszewski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).