[openib-general] [PATCH][3/3] Fix errors and warnings on 64-bit archs

Roland Dreier roland at topspin.com
Sun Oct 24 21:27:40 PDT 2004


Fix improper use of pci_umap_addr macros (code would not compile on
platforms where the macros are non-trivial).  Also fix some printk
format warnings (pointers can't be cast to ints on 64-bit platforms;
u64 is not unsigned long long either).

Index: linux-kernel/infiniband/core/ib_agent.c
===================================================================
--- linux-kernel.orig/infiniband/core/ib_agent.c	2004-10-24 20:32:58.000000000 -0700
+++ linux-kernel/infiniband/core/ib_agent.c	2004-10-24 21:12:23.000000000 -0700
@@ -329,8 +329,8 @@
 	}
 	spin_unlock_irqrestore(&ib_agent_port_list_lock, flags);
 	if (!port_priv) {
-		printk(KERN_ERR SPFX "agent_mad_send: no matching MAD agent 0x%x\n",
-		       (unsigned int)mad_agent);
+		printk(KERN_ERR SPFX "agent_mad_send: no matching MAD agent %p\n",
+		       mad_agent);
 		return;
 	}
 
@@ -395,13 +395,13 @@
 	send_wr.wr.ud.mad_hdr = (struct ib_mad_hdr *)mad;
 	send_wr.wr_id = ++port_priv->wr_id;
 
-	pci_unmap_addr_set(mad, agent_send_wr->mapping, gather_list.addr);
+	pci_unmap_addr_set(agent_send_wr, mapping, gather_list.addr);
 
 	/* Send */
 	spin_lock_irqsave(&port_priv->send_list_lock, flags);
 	if (ib_post_send_mad(mad_agent, &send_wr, &bad_send_wr)) {
 		pci_unmap_single(mad_agent->device->dma_device,
-				 pci_unmap_addr(mad, agent_send_wr->mapping),
+				 pci_unmap_addr(agent_send_wr, mapping),
 				 sizeof(struct ib_mad),
 				 PCI_DMA_TODEVICE);
 	} else {
@@ -542,7 +542,7 @@
 	spin_unlock_irqrestore(&ib_agent_port_list_lock, flags);
 	if (!port_priv) {
 		printk(KERN_ERR SPFX "agent_send_handler: no matching MAD agent "
-		       "0x%x\n", (unsigned int)mad_agent);
+		       "%p\n", mad_agent);
 		return;
 	}
 
@@ -551,7 +551,7 @@
 	if (list_empty(&port_priv->send_posted_list)) {
 		spin_unlock_irqrestore(&port_priv->send_list_lock, flags);
 		printk(KERN_ERR SPFX "Send completion WR ID 0x%Lx but send list "
-		       "is empty\n", mad_send_wc->wr_id);
+		       "is empty\n", (unsigned long long) mad_send_wc->wr_id);
 		return;
 	}
                                                                                 
@@ -568,8 +568,7 @@
 
 	/* Unmap PCI */
 	pci_unmap_single(mad_agent->device->dma_device,
-			 pci_unmap_addr(agent_send_wr->smp,
-					agent_send_wr->mapping),
+			 pci_unmap_addr(agent_send_wr, mapping),
 			 sizeof(struct ib_mad),
 			 PCI_DMA_TODEVICE);
 
@@ -595,9 +594,8 @@
 	}
 	spin_unlock_irqrestore(&ib_agent_port_list_lock, flags);
 	if (!port_priv) {
-		printk(KERN_ERR SPFX "agent_recv_handler: no matching MAD agent 0x%x\n",
-		       (unsigned int)mad_agent);
-
+		printk(KERN_ERR SPFX "agent_recv_handler: no matching MAD agent %p\n",
+		       mad_agent);
 	} else {
 		agent_recv_mad(mad_agent, 
 			       mad_recv_wc->recv_buf->mad,
Index: linux-kernel/infiniband/core/ib_mad.c
===================================================================
--- linux-kernel.orig/infiniband/core/ib_mad.c	2004-10-24 20:36:01.000000000 -0700
+++ linux-kernel/infiniband/core/ib_mad.c	2004-10-24 21:12:09.000000000 -0700
@@ -790,8 +790,8 @@
 ret:
 	if (!mad_agent->agent.recv_handler) {
 		printk(KERN_ERR PFX "No receive handler for client "
-		       "0x%x on port %d\n",
-		       (unsigned int)&mad_agent->agent,
+		       "%p on port %d\n",
+		       &mad_agent->agent,
 		       port_priv->port_num);
 		mad_agent = NULL;
 	}
@@ -957,7 +957,8 @@
 
 	} else {
 		printk(KERN_ERR PFX "Receive completion WR ID 0x%Lx on QP %d "
-		       "with no posted receive\n", wc->wr_id, qp_num);
+		       "with no posted receive\n", (unsigned long long) wc->wr_id,
+		       qp_num);
 		spin_unlock_irqrestore(&port_priv->recv_list_lock, flags);
 		ib_mad_post_receive_mad(port_priv, port_priv->qp[qp_num]);
 		return;
@@ -1123,7 +1124,7 @@
 	spin_lock_irqsave(&port_priv->send_list_lock, flags);
 	if (list_empty(&port_priv->send_posted_mad_list)) {
 		printk(KERN_ERR PFX "Send completion WR ID 0x%Lx but send "
-		       "list is empty\n", wc->wr_id);
+		       "list is empty\n", (unsigned long long) wc->wr_id);
 		goto error;
 	}
 
@@ -1133,7 +1134,7 @@
 	if (wc->wr_id != (unsigned long)mad_send_wr) {
 		printk(KERN_ERR PFX "Send completion WR ID 0x%Lx doesn't match "
 		       "posted send WR ID 0x%lx\n",
-		       wc->wr_id,
+		       (unsigned long long) wc->wr_id,
 		       (unsigned long)mad_send_wr);
 		goto error;
 	}
@@ -1163,7 +1164,7 @@
 	
 	while (ib_poll_cq(port_priv->cq, 1, &wc) == 1) {
 		printk(KERN_DEBUG PFX "Completion opcode 0x%x WRID 0x%Lx\n",
-		       wc.opcode, wc.wr_id);
+		       wc.opcode, (unsigned long long) wc.wr_id);
 		switch (wc.opcode) {
 		case IB_WC_SEND:
 			if (wc.status != IB_WC_SUCCESS)
@@ -1463,7 +1464,7 @@
 
 		kmem_cache_free(ib_mad_cache, mad_priv);
 		printk(KERN_NOTICE PFX "ib_post_recv WRID 0x%Lx failed ret = %d\n",
-		       recv_wr.wr_id, ret);
+		       (unsigned long long) recv_wr.wr_id, ret);
 		return -EINVAL;
 	}
 




More information about the general mailing list