<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
This commit is contained in:
John Baldwin 2025-04-28 13:06:07 -04:00
parent ac3110dc9e
commit dcb2a1ae46
4 changed files with 8 additions and 0 deletions

View file

@ -24,6 +24,8 @@
* SUCH DAMAGE.
*/
#define _WANT_SFF_8024_ID
#include <sys/types.h>
#include <sys/param.h>
#include <sys/ioctl.h>

View file

@ -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>

View file

@ -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

View file

@ -25,6 +25,8 @@
* SUCH DAMAGE.
*/
#define _WANT_SFF_8472_ID
#include <sys/param.h>
#include <sys/ioctl.h>
#include <sys/mman.h>