git: dcb2a1ae46ad - main - <net/sff8472.h>: Conditionally export table of ID names
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 28 Apr 2025 17:07:35 UTC
The branch main has been updated by jhb:
URL: https://cgit.FreeBSD.org/src/commit/?id=dcb2a1ae46ad4a5b810203abcbf5ddebbfc1741d
commit dcb2a1ae46ad4a5b810203abcbf5ddebbfc1741d
Author: John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2025-04-28 17:06:07 +0000
Commit: John Baldwin <jhb@FreeBSD.org>
CommitDate: 2025-04-28 17:06:07 +0000
<net/sff8472.h>: Conditionally export table of ID names
Only export the array of ID names if either _WANT_SFF_8024_ID or
_WANT_SFF_8472_ID is defined. Exporting them unconditionally can
trigger unused variable warnings if a consumer doesn't use the array.
Reviewed by: olce, bz, brooks
Differential Revision: https://reviews.freebsd.org/D49955
---
lib/libifconfig/libifconfig_sfp.c | 2 ++
sys/dev/mlx5/mlx5_core/mlx5_diagnostics.c | 2 ++
sys/net/sff8472.h | 2 ++
usr.sbin/cxgbetool/cxgbetool.c | 2 ++
4 files changed, 8 insertions(+)
diff --git a/lib/libifconfig/libifconfig_sfp.c b/lib/libifconfig/libifconfig_sfp.c
index 8292135d3e47..1ba6d231a992 100644
--- a/lib/libifconfig/libifconfig_sfp.c
+++ b/lib/libifconfig/libifconfig_sfp.c
@@ -24,6 +24,8 @@
* SUCH DAMAGE.
*/
+#define _WANT_SFF_8024_ID
+
#include <sys/types.h>
#include <sys/param.h>
#include <sys/ioctl.h>
diff --git a/sys/dev/mlx5/mlx5_core/mlx5_diagnostics.c b/sys/dev/mlx5/mlx5_core/mlx5_diagnostics.c
index 182be547272a..9730ab3c56c1 100644
--- a/sys/dev/mlx5/mlx5_core/mlx5_diagnostics.c
+++ b/sys/dev/mlx5/mlx5_core/mlx5_diagnostics.c
@@ -26,6 +26,8 @@
#include "opt_rss.h"
#include "opt_ratelimit.h"
+#define _WANT_SFF_8024_ID
+
#include <dev/mlx5/driver.h>
#include <dev/mlx5/port.h>
#include <dev/mlx5/diagnostics.h>
diff --git a/sys/net/sff8472.h b/sys/net/sff8472.h
index a33dfed84b0b..33b6dddb5b9f 100644
--- a/sys/net/sff8472.h
+++ b/sys/net/sff8472.h
@@ -415,6 +415,7 @@ enum {
SFF_8024_ID_LAST = SFF_8024_ID_QSFP_CMIS
};
+#if defined(_WANT_SFF_8024_ID) || defined(_WANT_SFF_8472_ID)
static const char *sff_8024_id[SFF_8024_ID_LAST + 1] = {
"Unknown",
"GBIC",
@@ -448,6 +449,7 @@ static const char *sff_8024_id[SFF_8024_ID_LAST + 1] = {
"x8MiniLink",
"QSFP+(CIMS)"
};
+#endif
/* Keep compatibility with old definitions */
#define SFF_8472_ID_UNKNOWN SFF_8024_ID_UNKNOWN
diff --git a/usr.sbin/cxgbetool/cxgbetool.c b/usr.sbin/cxgbetool/cxgbetool.c
index 8f58fe8107dc..c3bd883b39fc 100644
--- a/usr.sbin/cxgbetool/cxgbetool.c
+++ b/usr.sbin/cxgbetool/cxgbetool.c
@@ -25,6 +25,8 @@
* SUCH DAMAGE.
*/
+#define _WANT_SFF_8472_ID
+
#include <sys/param.h>
#include <sys/ioctl.h>
#include <sys/mman.h>