From 169f28f02c85f2069493896c4387dfd9c513160b Mon Sep 17 00:00:00 2001
From: "Him Kalyan Bordoloi" <bordoloih@vmware.com>
Date: Mon, 21 Aug 2023 10:00:44 -0800
Subject: [PATCH] ice: Remove inline from ethtool_sprintf
Function with variable argument list cannot be inlined by GCC
error: function 'ethtool_sprintf' can never be inlined because it uses variable argument lists
---
src/kcompat_impl.h | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/src/ice_ethtool.c b/src/ice_ethtool.c
--- a/src/ice_ethtool.c 2023-07-21 12:26:53.728843952 +0000
+++ b/src/ice_ethtool.c 2023-08-21 16:39:27.558505780 +0000
@@ -10,6 +10,25 @@
#include "ice_dcb_lib.h"
#include "ice_dcb_nl.h"
+/*
+ * Upstream commit 7888fe53b706 ("ethtool: Add common function for filling out
+ * strings") introduced ethtool_sprintf, which landed in Linux v5.13
+ *
+ * The function is easy to directly implement.
+ */
+#ifdef NEED_ETHTOOL_SPRINTF
+__printf(2, 3) void ethtool_sprintf(u8 **data, const char *fmt, ...)
+{
+ va_list args;
+
+ va_start(args, fmt);
+ vsnprintf(*data, ETH_GSTRING_LEN, fmt, args);
+ va_end(args);
+
+ *data += ETH_GSTRING_LEN;
+}
+#endif /* NEED_ETHTOOL_SPRINTF */
+
static int ice_q_stats_len(struct net_device *netdev)
{
struct ice_netdev_priv *np = netdev_priv(netdev);
diff --git a/src/kcompat_impl.h b/src/kcompat_impl.h
--- a/src/kcompat_impl.h 2023-07-21 12:28:32.524838676 +0000
+++ b/src/kcompat_impl.h 2023-08-21 16:41:33.579752222 +0000
@@ -1697,21 +1697,9 @@
*
* Upstream commit 7888fe53b706 ("ethtool: Add common function for filling out
* strings") introduced ethtool_sprintf, which landed in Linux v5.13
- *
- * The function is easy to directly implement.
*/
#ifdef NEED_ETHTOOL_SPRINTF
-static inline
-__printf(2, 3) void ethtool_sprintf(u8 **data, const char *fmt, ...)
-{
- va_list args;
-
- va_start(args, fmt);
- vsnprintf(*data, ETH_GSTRING_LEN, fmt, args);
- va_end(args);
-
- *data += ETH_GSTRING_LEN;
-}
+extern __printf(2, 3) void ethtool_sprintf(u8 **data, const char *fmt, ...);
#endif /* NEED_ETHTOOL_SPRINTF */
/*