linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net/mlx5i: avoid unused function warning for mlx5i_flow_type_mask
@ 2021-10-22  6:47 Arnd Bergmann
  2021-10-25 19:58 ` Saeed Mahameed
  0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2021-10-22  6:47 UTC (permalink / raw)
  To: Saeed Mahameed, Leon Romanovsky, David S. Miller, Jakub Kicinski,
	Tariq Toukan, Moosa Baransi
  Cc: Arnd Bergmann, Meir Lichtinger, Yufeng Mo, netdev, linux-rdma,
	linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

Without CONFIG_MLX5_EN_RXNFC, the function is unused, breaking the
build with CONFIG_WERROR:

mlx5/core/ipoib/ethtool.c:36:12: error: unused function 'mlx5i_flow_type_mask' [-Werror,-Wunused-function]
static u32 mlx5i_flow_type_mask(u32 flow_type)

We could add another #ifdef or mark this function inline, but
replacing the existing #ifdef with a __maybe_unused seems best
because that improves build coverage and avoids introducing
similar problems the next time this code changes.

Fixes: 9fbe1c25ecca ("net/mlx5i: Enable Rx steering for IPoIB via ethtool")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 .../net/ethernet/mellanox/mlx5/core/ipoib/ethtool.c    | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ethtool.c
index ee0eb4a4b819..ae95677a01f0 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ethtool.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ethtool.c
@@ -222,8 +222,8 @@ static int mlx5i_get_link_ksettings(struct net_device *netdev,
 	return 0;
 }
 
-#ifdef CONFIG_MLX5_EN_RXNFC
-static int mlx5i_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd)
+static __maybe_unused int mlx5i_set_rxnfc(struct net_device *dev,
+					  struct ethtool_rxnfc *cmd)
 {
 	struct mlx5e_priv *priv = mlx5i_epriv(dev);
 	struct ethtool_rx_flow_spec *fs = &cmd->fs;
@@ -234,14 +234,14 @@ static int mlx5i_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd)
 	return mlx5e_ethtool_set_rxnfc(priv, cmd);
 }
 
-static int mlx5i_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *info,
-			   u32 *rule_locs)
+static __maybe_unused int mlx5i_get_rxnfc(struct net_device *dev,
+					  struct ethtool_rxnfc *info,
+					  u32 *rule_locs)
 {
 	struct mlx5e_priv *priv = mlx5i_epriv(dev);
 
 	return mlx5e_ethtool_get_rxnfc(priv, info, rule_locs);
 }
-#endif
 
 const struct ethtool_ops mlx5i_ethtool_ops = {
 	.supported_coalesce_params = ETHTOOL_COALESCE_USECS |
-- 
2.29.2


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

* Re: [PATCH net-next] net/mlx5i: avoid unused function warning for mlx5i_flow_type_mask
  2021-10-22  6:47 [PATCH net-next] net/mlx5i: avoid unused function warning for mlx5i_flow_type_mask Arnd Bergmann
@ 2021-10-25 19:58 ` Saeed Mahameed
  0 siblings, 0 replies; 2+ messages in thread
From: Saeed Mahameed @ 2021-10-25 19:58 UTC (permalink / raw)
  To: Tariq Toukan, arnd, davem, kuba, leon, Moosa Baransi
  Cc: linux-rdma, Meir Lichtinger, netdev, moyufeng, arnd, linux-kernel

On Fri, 2021-10-22 at 08:47 +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> Without CONFIG_MLX5_EN_RXNFC, the function is unused, breaking the
> build with CONFIG_WERROR:
> 
> mlx5/core/ipoib/ethtool.c:36:12: error: unused function
> 'mlx5i_flow_type_mask' [-Werror,-Wunused-function]
> static u32 mlx5i_flow_type_mask(u32 flow_type)
> 
> We could add another #ifdef or mark this function inline, but
> replacing the existing #ifdef with a __maybe_unused seems best
> because that improves build coverage and avoids introducing
> similar problems the next time this code changes.
> 

Hi Arnd, thanks for your patch,
we have a pending patch that simply moves mlx5i_flow_type_mask() into
the #ifdef, where this function is only used

will submit it shortly.

Thanks again for your patch.


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

end of thread, other threads:[~2021-10-25 20:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-22  6:47 [PATCH net-next] net/mlx5i: avoid unused function warning for mlx5i_flow_type_mask Arnd Bergmann
2021-10-25 19:58 ` Saeed Mahameed

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