[gPXE-devel] [PATCH 1/3] Fix 64bit compile time errors

Piotr Jaroszyński p.jaroszynski at gmail.com
Tue Mar 30 13:09:09 EDT 2010


Apart from format specifier fixes there are two changes in proper code:
- Change type of regs in skge_hw to unsigned long
- Cast result of sizeof in myri10ge to uint32_t

Both don't change anything for i386 and should be fine on x86_64.
---
 src/drivers/net/ath5k/ath5k.c |    4 ++--
 src/drivers/net/eepro100.c    |    2 +-
 src/drivers/net/myri10ge.c    |    4 ++--
 src/drivers/net/skge.c        |    6 +++---
 src/drivers/net/skge.h        |    2 +-
 src/net/80211/wpa.c           |    6 +++---
 6 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/drivers/net/ath5k/ath5k.c b/src/drivers/net/ath5k/ath5k.c
index 37defce..108c0ac 100644
--- a/src/drivers/net/ath5k/ath5k.c
+++ b/src/drivers/net/ath5k/ath5k.c
@@ -843,7 +843,7 @@ ath5k_rxbuf_setup(struct ath5k_softc *sc, struct ath5k_buf *bf)
 	if (ah->ah_setup_rx_desc(ah, ds,
 				 iob_tailroom(iob),	/* buffer size */
 				 0) != 0) {
-		DBG("ath5k: error setting up RX descriptor for %d bytes\n", iob_tailroom(iob));
+		DBG("ath5k: error setting up RX descriptor for %zd bytes\n", iob_tailroom(iob));
 		return -EINVAL;
 	}
 
@@ -1293,7 +1293,7 @@ ath5k_tx_processq(struct ath5k_softc *sc, struct ath5k_txq *txq)
 		iob = bf->iob;
 		bf->iob = NULL;
 
-		DBG2("ath5k: tx %d bytes complete, %d retries\n",
+		DBG2("ath5k: tx %zd bytes complete, %d retries\n",
 		     iob_len(iob), ts.ts_retry[0]);
 
 		net80211_tx_complete(sc->dev, iob, ts.ts_retry[0],
diff --git a/src/drivers/net/eepro100.c b/src/drivers/net/eepro100.c
index 8a75608..d94f0ce 100644
--- a/src/drivers/net/eepro100.c
+++ b/src/drivers/net/eepro100.c
@@ -454,7 +454,7 @@ static int ifec_net_transmit ( struct net_device *netdev,
 		return -ENOBUFS;
 	}
 
-	DBG2 ( "transmitting packet (%d bytes). status = %hX, cmd=%hX\n",
+	DBG2 ( "transmitting packet (%zd bytes). status = %hX, cmd=%hX\n",
 		iob_len ( iobuf ), tcb->status, inw ( ioaddr + SCBCmd ) );
 
 	tcb->command   = CmdSuspend | CmdTx | CmdTxFlex;
diff --git a/src/drivers/net/myri10ge.c b/src/drivers/net/myri10ge.c
index ac2e124..353158b 100644
--- a/src/drivers/net/myri10ge.c
+++ b/src/drivers/net/myri10ge.c
@@ -723,7 +723,7 @@ static int myri10ge_net_open ( struct net_device *netdev )
 
 	/* Set the interrupt queue size. */
 
-	data[0] = ( sizeof ( priv->dma->receive_completion )
+	data[0] = ( (uint32_t)( sizeof ( priv->dma->receive_completion ) )
 		    | MXGEFW_CMD_SET_INTRQ_SIZE_FLAG_NO_STRICT_SIZE_CHECK );
 	TRY ( CMD_SET_ , INTRQ_SIZE , );
 
@@ -973,7 +973,7 @@ static int myri10ge_net_transmit ( struct net_device *netdev,
 		return -ENOBUFS;
 	}
 
-	DBG2 ( "TX %p+%d ", iobuf->data, iob_len ( iobuf ) );
+	DBG2 ( "TX %p+%zd ", iobuf->data, iob_len ( iobuf ) );
 	DBG2_HD ( iobuf->data, 14 );
 
 	/* Record the packet being transmitted, so we can later report
diff --git a/src/drivers/net/skge.c b/src/drivers/net/skge.c
index afe8273..baa9493 100755
--- a/src/drivers/net/skge.c
+++ b/src/drivers/net/skge.c
@@ -1983,13 +1983,13 @@ static void skge_rx_refill(struct net_device *dev)
 		if (iob || (control & BMU_OWN))
 			continue;
 
-		DBG2("refilling rx desc %d: ", (ring->to_clean - ring->start));
+		DBG2("refilling rx desc %zd: ", (ring->to_clean - ring->start));
 
 		iob = alloc_iob(RX_BUF_SIZE);
 		if (iob) {
 			skge_rx_setup(skge, e, iob, RX_BUF_SIZE);
 		} else {
-			DBG("descr %d: alloc_iob() failed\n",
+			DBG("descr %zd: alloc_iob() failed\n",
 			     (ring->to_clean - ring->start));
 			/* We pass the descriptor to the NIC even if the
 			 * allocation failed. The card will stop as soon as it
@@ -2354,7 +2354,7 @@ static int skge_probe(struct pci_device *pdev,
 
 	hw->pdev = pdev;
 
-	hw->regs = (u32)ioremap(pci_bar_start(pdev, PCI_BASE_ADDRESS_0),
+	hw->regs = (unsigned long)ioremap(pci_bar_start(pdev, PCI_BASE_ADDRESS_0),
 				SKGE_REG_SIZE);
 	if (!hw->regs) {
 		DBG(PFX "cannot map device registers\n");
diff --git a/src/drivers/net/skge.h b/src/drivers/net/skge.h
index 6b08daf..60d8a77 100755
--- a/src/drivers/net/skge.h
+++ b/src/drivers/net/skge.h
@@ -2461,7 +2461,7 @@ struct skge_ring {
 
 
 struct skge_hw {
-	u32	     regs;
+	unsigned long	     regs;
 	struct pci_device    *pdev;
 	u32		     intr_mask;
 	struct net_device    *dev[2];
diff --git a/src/net/80211/wpa.c b/src/net/80211/wpa.c
index 9bac8fe..074830c 100644
--- a/src/net/80211/wpa.c
+++ b/src/net/80211/wpa.c
@@ -421,7 +421,7 @@ static int wpa_maybe_install_gtk ( struct wpa_common_ctx *ctx,
 		return -ENOENT;
 
 	if ( ie->len - 6u > sizeof ( ctx->gtk.tk ) ) {
-		DBGC ( ctx, "WPA %p: GTK KDE is too long (%d bytes, max %d)\n",
+		DBGC ( ctx, "WPA %p: GTK KDE is too long (%d bytes, max %zd)\n",
 		       ctx, ie->len - 4, sizeof ( ctx->gtk.tk ) );
 		return -EINVAL;
 	}
@@ -801,7 +801,7 @@ static int wpa_handle_1_of_2 ( struct wpa_common_ctx *ctx,
 			return rc; /* non-fatal */
 		}
 		if ( pkt->datalen > sizeof ( ctx->gtk.tk ) ) {
-			DBGC ( ctx, "WPA %p: too much GTK data (%d > %d)\n",
+			DBGC ( ctx, "WPA %p: too much GTK data (%d > %zd)\n",
 			       ctx, pkt->datalen, sizeof ( ctx->gtk.tk ) );
 			return wpa_fail ( ctx, -EINVAL );
 		}
@@ -877,7 +877,7 @@ static int eapol_key_rx ( struct io_buffer *iob, struct net_device *netdev,
 	}
 
 	if ( ( void * ) ( pkt + 1 ) + ntohs ( pkt->datalen ) > iob->tail ) {
-		DBGC ( ctx, "WPA %p: packet truncated (has %d extra bytes, "
+		DBGC ( ctx, "WPA %p: packet truncated (has %zd extra bytes, "
 		       "states %d)\n", ctx, iob->tail - ( void * ) ( pkt + 1 ),
 		       ntohs ( pkt->datalen ) );
 		rc = -EINVAL;
-- 
1.7.0.3



More information about the gPXE-devel mailing list