git: 35da55c28dbb - main - iwx: Fix 32-bit compilation

From: Olivier Certner <olce_at_FreeBSD.org>
Date: Thu, 05 Mar 2026 20:41:42 UTC
The branch main has been updated by olce:

URL: https://cgit.FreeBSD.org/src/commit/?id=35da55c28dbb56dd7056b7863efc5b547950d885

commit 35da55c28dbb56dd7056b7863efc5b547950d885
Author:     Olivier Certner <olce@FreeBSD.org>
AuthorDate: 2026-03-05 12:31:51 +0000
Commit:     Olivier Certner <olce@FreeBSD.org>
CommitDate: 2026-03-05 20:40:53 +0000

    iwx: Fix 32-bit compilation
    
    - Avoid shifts wider than integer types, by wrapping the corresponding
      checks into '#if __SIZEOF_SIZE_T__ > 32' blocks.  'bus_addr_t'
      currently has the same width as 'size_t' on all architectures (and
      this is not going to change for 32-bit architectures).
    - Use appropriate printf(3) format for 'wk_keytsc'.
    
    Reviewed by:    adrian
    MFC after:      1 minute
    MFC to:         stable/15
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D55667
---
 sys/dev/iwx/if_iwx.c | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/sys/dev/iwx/if_iwx.c b/sys/dev/iwx/if_iwx.c
index 8f11e6a414e7..ea1ba513734a 100644
--- a/sys/dev/iwx/if_iwx.c
+++ b/sys/dev/iwx/if_iwx.c
@@ -155,6 +155,7 @@
 #include <sys/epoch.h>
 #include <sys/kdb.h>
 
+#include <machine/_inttypes.h>
 #include <machine/bus.h>
 #include <machine/endian.h>
 #include <machine/resource.h>
@@ -5818,15 +5819,21 @@ iwx_tx(struct iwx_softc *sc, struct mbuf *m, struct ieee80211_node *ni)
 	desc->tbs[0].tb_len = htole16(IWX_FIRST_TB_SIZE);
 	paddr = htole64(data->cmd_paddr);
 	memcpy(&desc->tbs[0].addr, &paddr, sizeof(paddr));
-	if (data->cmd_paddr >> 32 != (data->cmd_paddr + le32toh(desc->tbs[0].tb_len)) >> 32)
+#if __SIZEOF_SIZE_T__ > 32
+	if (data->cmd_paddr >> 32 != (data->cmd_paddr +
+	    le32toh(desc->tbs[0].tb_len)) >> 32)
 		DPRINTF(("%s: TB0 crosses 32bit boundary\n", __func__));
+#endif
 	desc->tbs[1].tb_len = htole16(sizeof(struct iwx_cmd_header) +
 	    txcmd_size + hdrlen + pad - IWX_FIRST_TB_SIZE);
 	paddr = htole64(data->cmd_paddr + IWX_FIRST_TB_SIZE);
 	memcpy(&desc->tbs[1].addr, &paddr, sizeof(paddr));
 
-	if (data->cmd_paddr >> 32 != (data->cmd_paddr + le32toh(desc->tbs[1].tb_len)) >> 32)
+#if __SIZEOF_SIZE_T__ > 32
+	if (data->cmd_paddr >> 32 != (data->cmd_paddr +
+	    le32toh(desc->tbs[1].tb_len)) >> 32)
 		DPRINTF(("%s: TB1 crosses 32bit boundary\n", __func__));
+#endif
 
 	/* Other DMA segments are for data payload. */
 	for (i = 0; i < nsegs; i++) {
@@ -5834,8 +5841,12 @@ iwx_tx(struct iwx_softc *sc, struct mbuf *m, struct ieee80211_node *ni)
 		desc->tbs[i + 2].tb_len = htole16(seg->ds_len);
 		paddr = htole64(seg->ds_addr);
 		memcpy(&desc->tbs[i + 2].addr, &paddr, sizeof(paddr));
-		if (data->cmd_paddr >> 32 != (data->cmd_paddr + le32toh(desc->tbs[i + 2].tb_len)) >> 32)
-			DPRINTF(("%s: TB%d crosses 32bit boundary\n", __func__, i + 2));
+#if __SIZEOF_SIZE_T__ > 32
+		if (data->cmd_paddr >> 32 != (data->cmd_paddr +
+		    le32toh(desc->tbs[i + 2].tb_len)) >> 32)
+			DPRINTF(("%s: TB%d crosses 32bit boundary\n", __func__,
+			    i + 2));
+#endif
 	}
 
 	bus_dmamap_sync(ring->data_dmat, data->map, BUS_DMASYNC_PREWRITE);
@@ -11079,8 +11090,8 @@ iwx_key_set(struct ieee80211vap *vap, const struct ieee80211_key *k)
 	cmd.common.sta_id = IWX_STATION_ID;
 
 	cmd.transmit_seq_cnt = htole64(k->wk_keytsc);
-	IWX_DPRINTF(sc, IWX_DEBUG_KEYMGMT, "%s: k->wk_keytsc=%lu\n", __func__,
-	    k->wk_keytsc);
+	IWX_DPRINTF(sc, IWX_DEBUG_KEYMGMT, "%s: k->wk_keytsc=%" PRIu64 "\n",
+	    __func__, k->wk_keytsc);
 
 	status = IWX_ADD_STA_SUCCESS;
 	err = iwx_send_cmd_pdu_status(sc, IWX_ADD_STA_KEY, sizeof(cmd), &cmd,