* [PATCH] net: hwbm: if CONFIG_NET_HWBM unset, make stub functions static
@ 2019-10-22 15:18 Ben Dooks (Codethink)
2019-10-22 15:23 ` Ben Dooks
0 siblings, 1 reply; 2+ messages in thread
From: Ben Dooks (Codethink) @ 2019-10-22 15:18 UTC (permalink / raw)
To: linux-kernel; +Cc: Ben Dooks (Codethink), David S. Miller, netdev, linux-kernel
If CONFIG_NET_HWBM is not set, then these stub functions in
<net/hwbm.h> should be declared static to avoid trying to
export them from any driver that includes this.
Note, add __maybe_unused as the marvell mvneta.c driver will
otherwise cause gcc warnings from these.
Fixes the following sparse warnings:
./include/net/hwbm.h:24:6: warning: symbol 'hwbm_buf_free' was not declared. Should it be static?
./include/net/hwbm.h:25:5: warning: symbol 'hwbm_pool_refill' was not declared. Should it be static?
./include/net/hwbm.h:26:5: warning: symbol 'hwbm_pool_add' was not declared. Should it be static?
Signed-off-by: Ben Dooks (Codethink) <ben.dooks@codethink.co.uk>
---
Cc: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
include/net/hwbm.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/include/net/hwbm.h b/include/net/hwbm.h
index 81643cf8a1c4..cb5e6de8b7cd 100644
--- a/include/net/hwbm.h
+++ b/include/net/hwbm.h
@@ -21,9 +21,9 @@ void hwbm_buf_free(struct hwbm_pool *bm_pool, void *buf);
int hwbm_pool_refill(struct hwbm_pool *bm_pool, gfp_t gfp);
int hwbm_pool_add(struct hwbm_pool *bm_pool, unsigned int buf_num);
#else
-void hwbm_buf_free(struct hwbm_pool *bm_pool, void *buf) {}
-int hwbm_pool_refill(struct hwbm_pool *bm_pool, gfp_t gfp) { return 0; }
-int hwbm_pool_add(struct hwbm_pool *bm_pool, unsigned int buf_num)
+static void __maybe_unused hwbm_buf_free(struct hwbm_pool *bm_pool, void *buf) {}
+static int __maybe_unused hwbm_pool_refill(struct hwbm_pool *bm_pool, gfp_t gfp) { return 0; }
+static int __maybe_unused hwbm_pool_add(struct hwbm_pool *bm_pool, unsigned int buf_num)
{ return 0; }
#endif /* CONFIG_HWBM */
#endif /* _HWBM_H */
--
2.23.0
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] net: hwbm: if CONFIG_NET_HWBM unset, make stub functions static
2019-10-22 15:18 [PATCH] net: hwbm: if CONFIG_NET_HWBM unset, make stub functions static Ben Dooks (Codethink)
@ 2019-10-22 15:23 ` Ben Dooks
0 siblings, 0 replies; 2+ messages in thread
From: Ben Dooks @ 2019-10-22 15:23 UTC (permalink / raw)
To: linux-kernel; +Cc: David S. Miller, netdev, linux-kernel
On 22/10/2019 16:18, Ben Dooks (Codethink) wrote:
> If CONFIG_NET_HWBM is not set, then these stub functions in
> <net/hwbm.h> should be declared static to avoid trying to
> export them from any driver that includes this.
>
> Note, add __maybe_unused as the marvell mvneta.c driver will
> otherwise cause gcc warnings from these.
urgh, static inline was what I was actually searching for here.
> Fixes the following sparse warnings:
>
> ./include/net/hwbm.h:24:6: warning: symbol 'hwbm_buf_free' was not declared. Should it be static?
> ./include/net/hwbm.h:25:5: warning: symbol 'hwbm_pool_refill' was not declared. Should it be static?
> ./include/net/hwbm.h:26:5: warning: symbol 'hwbm_pool_add' was not declared. Should it be static?
>
> Signed-off-by: Ben Dooks (Codethink) <ben.dooks@codethink.co.uk>
> ---
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: netdev@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> ---
> include/net/hwbm.h | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/include/net/hwbm.h b/include/net/hwbm.h
> index 81643cf8a1c4..cb5e6de8b7cd 100644
> --- a/include/net/hwbm.h
> +++ b/include/net/hwbm.h
> @@ -21,9 +21,9 @@ void hwbm_buf_free(struct hwbm_pool *bm_pool, void *buf);
> int hwbm_pool_refill(struct hwbm_pool *bm_pool, gfp_t gfp);
> int hwbm_pool_add(struct hwbm_pool *bm_pool, unsigned int buf_num);
> #else
> -void hwbm_buf_free(struct hwbm_pool *bm_pool, void *buf) {}
> -int hwbm_pool_refill(struct hwbm_pool *bm_pool, gfp_t gfp) { return 0; }
> -int hwbm_pool_add(struct hwbm_pool *bm_pool, unsigned int buf_num)
> +static void __maybe_unused hwbm_buf_free(struct hwbm_pool *bm_pool, void *buf) {}
> +static int __maybe_unused hwbm_pool_refill(struct hwbm_pool *bm_pool, gfp_t gfp) { return 0; }
> +static int __maybe_unused hwbm_pool_add(struct hwbm_pool *bm_pool, unsigned int buf_num)
> { return 0; }
> #endif /* CONFIG_HWBM */
> #endif /* _HWBM_H */
>
--
Ben Dooks http://www.codethink.co.uk/
Senior Engineer Codethink - Providing Genius
https://www.codethink.co.uk/privacy.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-10-22 15:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-22 15:18 [PATCH] net: hwbm: if CONFIG_NET_HWBM unset, make stub functions static Ben Dooks (Codethink)
2019-10-22 15:23 ` Ben Dooks
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®