Re: [PATCH] net: mvneta: make stub functions static inline
From: Jakub Kicinski
Date: Tue Oct 22 2019 - 18:26:27 EST
On Tue, 22 Oct 2019 16:22:05 +0100, Ben Dooks (Codethink) wrote:
> If the CONFIG_MVNET_BA is not set, then make the stub functions
> static inline to avoid trying to export them, and remove hte
> following sparse warnings:
>
> drivers/net/ethernet/marvell/mvneta_bm.h:163:6: warning: symbol 'mvneta_bm_pool_destroy' was not declared. Should it be static?
> drivers/net/ethernet/marvell/mvneta_bm.h:165:6: warning: symbol 'mvneta_bm_bufs_free' was not declared. Should it be static?
> drivers/net/ethernet/marvell/mvneta_bm.h:167:5: warning: symbol 'mvneta_bm_construct' was not declared. Should it be static?
> drivers/net/ethernet/marvell/mvneta_bm.h:168:5: warning: symbol 'mvneta_bm_pool_refill' was not declared. Should it be static?
> drivers/net/ethernet/marvell/mvneta_bm.h:170:23: warning: symbol 'mvneta_bm_pool_use' was not declared. Should it be static?
> drivers/net/ethernet/marvell/mvneta_bm.h:181:18: warning: symbol 'mvneta_bm_get' was not declared. Should it be static?
> drivers/net/ethernet/marvell/mvneta_bm.h:182:6: warning: symbol 'mvneta_bm_put' was not declared. Should it be static?
>
> Signed-off-by: Ben Dooks (Codethink) <ben.dooks@xxxxxxxxxxxxxxx>
Looks like this one will require a bit more work.
> drivers/net/ethernet/marvell/mvneta_bm.h | 20 ++++++++++----------
> 1 file changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/net/ethernet/marvell/mvneta_bm.h b/drivers/net/ethernet/marvell/mvneta_bm.h
> index c8425d35c049..9c0c6e20cf80 100644
> --- a/drivers/net/ethernet/marvell/mvneta_bm.h
> +++ b/drivers/net/ethernet/marvell/mvneta_bm.h
> @@ -160,14 +160,14 @@ static inline u32 mvneta_bm_pool_get_bp(struct mvneta_bm *priv,
> (bm_pool->id << MVNETA_BM_POOL_ACCESS_OFFS));
> }
> #else
> -void mvneta_bm_pool_destroy(struct mvneta_bm *priv,
> - struct mvneta_bm_pool *bm_pool, u8 port_map) {}
> -void mvneta_bm_bufs_free(struct mvneta_bm *priv, struct mvneta_bm_pool *bm_pool,
> - u8 port_map) {}
> -int mvneta_bm_construct(struct hwbm_pool *hwbm_pool, void *buf) { return 0; }
> -int mvneta_bm_pool_refill(struct mvneta_bm *priv,
> - struct mvneta_bm_pool *bm_pool) {return 0; }
> -struct mvneta_bm_pool *mvneta_bm_pool_use(struct mvneta_bm *priv, u8 pool_id,
> +static inline void mvneta_bm_pool_destroy(struct mvneta_bm *priv,
> + struct mvneta_bm_pool *bm_pool, u8 port_map) {}
> +static inline void mvneta_bm_bufs_free(struct mvneta_bm *priv, struct mvneta_bm_pool *bm_pool,
> + u8 port_map) {}
You're going over 80 characters now.
> +static inline int mvneta_bm_construct(struct hwbm_pool *hwbm_pool, void *buf) { return 0; }
> +static inline int mvneta_bm_pool_refill(struct mvneta_bm *priv,
> + struct mvneta_bm_pool *bm_pool) {return 0; }
> +static inline struct mvneta_bm_pool *mvneta_bm_pool_use(struct mvneta_bm *priv, u8 pool_id,
> enum mvneta_bm_type type, u8 port_id,
> int pkt_size) { return NULL; }
The follow up lines need to be adjusted so that they start on the same
column as the opening bracket.
checkpatch.pl catches those. Please run it with --strict while at it.
> @@ -178,7 +178,7 @@ static inline void mvneta_bm_pool_put_bp(struct mvneta_bm *priv,
> static inline u32 mvneta_bm_pool_get_bp(struct mvneta_bm *priv,
> struct mvneta_bm_pool *bm_pool)
> { return 0; }
> -struct mvneta_bm *mvneta_bm_get(struct device_node *node) { return NULL; }
> -void mvneta_bm_put(struct mvneta_bm *priv) {}
> +static inline struct mvneta_bm *mvneta_bm_get(struct device_node *node) { return NULL; }
> +static inline void mvneta_bm_put(struct mvneta_bm *priv) {}
> #endif /* CONFIG_MVNETA_BM */
> #endif