* [PATCH] nvmem: hide unused nvmem_find_cell_by_index function
@ 2018-10-02 21:11 Arnd Bergmann
2018-10-02 21:23 ` Bartosz Golaszewski
2018-10-03 8:30 ` Srinivas Kandagatla
0 siblings, 2 replies; 3+ messages in thread
From: Arnd Bergmann @ 2018-10-02 21:11 UTC (permalink / raw)
To: Srinivas Kandagatla
Cc: Arnd Bergmann, Greg Kroah-Hartman, Bartosz Golaszewski,
Andrey Smirnov, Heiner Kallweit, linux-kernel
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>
---
drivers/nvmem/core.c | 32 ++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
index cc815bb2eebd..f99fb74a646e 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -492,22 +492,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)
{
@@ -972,6 +956,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
*
--
2.18.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] nvmem: hide unused nvmem_find_cell_by_index function
2018-10-02 21:11 [PATCH] nvmem: hide unused nvmem_find_cell_by_index function Arnd Bergmann
@ 2018-10-02 21:23 ` Bartosz Golaszewski
2018-10-03 8:30 ` Srinivas Kandagatla
1 sibling, 0 replies; 3+ messages in thread
From: Bartosz Golaszewski @ 2018-10-02 21:23 UTC (permalink / raw)
To: Srinivas Kandagatla
Cc: Arnd Bergmann, Greg Kroah-Hartman, Bartosz Golaszewski,
Andrey Smirnov, Heiner Kallweit, Linux Kernel Mailing List
wt., 2 paź 2018 o 23:11 Arnd Bergmann <arnd@arndb.de> napisał(a):
>
> 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>
> ---
> drivers/nvmem/core.c | 32 ++++++++++++++++----------------
> 1 file changed, 16 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
> index cc815bb2eebd..f99fb74a646e 100644
> --- a/drivers/nvmem/core.c
> +++ b/drivers/nvmem/core.c
> @@ -492,22 +492,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)
> {
> @@ -972,6 +956,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
> *
> --
> 2.18.0
>
Srinivas,
I think this is even better than __maybe_unused so if you're fine I
won't resend my patch tomorrow.
Thanks,
Bart
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] nvmem: hide unused nvmem_find_cell_by_index function
2018-10-02 21:11 [PATCH] nvmem: hide unused nvmem_find_cell_by_index function Arnd Bergmann
2018-10-02 21:23 ` Bartosz Golaszewski
@ 2018-10-03 8:30 ` Srinivas Kandagatla
1 sibling, 0 replies; 3+ messages in thread
From: Srinivas Kandagatla @ 2018-10-03 8:30 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Greg Kroah-Hartman, Bartosz Golaszewski, Andrey Smirnov,
Heiner Kallweit, linux-kernel
On 02/10/18 22:11, Arnd Bergmann wrote:
> 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>
Missing Reported-by: other than that..
Acked-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-10-03 8:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-02 21:11 [PATCH] nvmem: hide unused nvmem_find_cell_by_index function Arnd Bergmann
2018-10-02 21:23 ` Bartosz Golaszewski
2018-10-03 8:30 ` Srinivas Kandagatla
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.