Subject: [PATCH] whci: fix type and format warnings

From: Randy Dunlap <[email-masked]>
Date: Tue, 13 Oct 2009 10:01:28 -0700

From: Randy Dunlap <[email-masked]>

Fix format and type warnings in whci driver:

drivers/usb/host/whci/qset.c:440: warning: comparison of distinct pointer types lacks a cast
drivers/usb/host/whci/qset.c:442: warning: format '%d' expects type 'int', but argument 6 has type 'size_t'
drivers/usb/host/whci/qset.c:488: warning: format '%d' expects type 'int', but argument 4 has type 'size_t'
drivers/usb/host/whci/qset.c:509: warning: format '%08x' expects type 'unsigned int', but argument 5 has type 'dma_addr_t'
drivers/usb/host/whci/qset.c:568: warning: comparison of distinct pointer types lacks a cast
drivers/usb/host/whci/qset.c:571: warning: format '%d' expects type 'int', but argument 5 has type 'size_t'
drivers/usb/host/whci/qset.c:590: warning: format '%d' expects type 'int', but argument 4 has type 'size_t'
drivers/usb/host/whci/qset.c:590: warning: format '%d' expects type 'int', but argument 6 has type 'long int'

Signed-off-by: Randy Dunlap <[email-masked]>
---
 drivers/usb/host/whci/qset.c |   15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

--- linux-next-20091012.orig/drivers/usb/host/whci/qset.c
+++ linux-next-20091012/drivers/usb/host/whci/qset.c
@@ -437,9 +437,9 @@ static int qset_add_urb_sg(struct whc *w
 		}
 
 		dma_addr = sg_dma_address(sg);
-		dma_remaining = min(sg_dma_len(sg), remaining);
+		dma_remaining = min_t(size_t, sg_dma_len(sg), remaining);
 
-		dev_dbg(&whc->umc->dev, "adding sg[%d] %08x %d\n", i, (unsigned)dma_addr,
+		dev_dbg(&whc->umc->dev, "adding sg[%d] %08x %zu\n", i, (unsigned)dma_addr,
 			dma_remaining);
 
 		while (dma_remaining) {
@@ -485,7 +485,7 @@ static int qset_add_urb_sg(struct whc *w
 				dma_len = ep - dma_addr;
 			}
 
-			dev_dbg(&whc->umc->dev, "adding %d\n", dma_len);
+			dev_dbg(&whc->umc->dev, "adding %zu\n", dma_len);
 
 			std->len += dma_len;
 			std->ntds_remaining = -1; /* filled in later */
@@ -506,7 +506,8 @@ static int qset_add_urb_sg(struct whc *w
 			}
 
 			for (;p < std->num_pointers; p++, entry++) {
-				dev_dbg(&whc->umc->dev, "e[%d] %08x\n", p, dma_addr);
+				dev_dbg(&whc->umc->dev, "e[%d] %08llx\n", p,
+					(unsigned long long)dma_addr);
 				std->pl_virt[p].buf_ptr = cpu_to_le64(dma_addr);
 				dma_addr = (dma_addr + WHCI_PAGE_SIZE) & ~(WHCI_PAGE_SIZE-1);
 			}
@@ -565,10 +566,10 @@ static int qset_add_urb_sg_linearize(str
 			break;
 		}
 
-		sg_remaining = min(remaining, sg->length);
+		sg_remaining = min_t(size_t, remaining, sg->length);
 		orig = sg_virt(sg);
 
-		dev_dbg(&whc->umc->dev, "adding sg[%d] %d\n", i, sg_remaining);
+		dev_dbg(&whc->umc->dev, "adding sg[%d] %zu\n", i, sg_remaining);
 
 		while (sg_remaining) {
 			if (!std || std->len == max_std_len) {
@@ -587,7 +588,7 @@ static int qset_add_urb_sg_linearize(str
 
 			len = min(sg_remaining, max_std_len - std->len);
 
-			dev_dbg(&whc->umc->dev, "added %d from sg[%d] @ offset %d\n",
+			dev_dbg(&whc->umc->dev, "added %zu from sg[%d] @ offset %td\n",
 				len, i, orig - sg_virt(sg));
 
 			if (is_out)