aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host
diff options
context:
space:
mode:
authorDavid Vrabel <david.vrabel@csr.com>2009-10-14 09:23:55 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2009-12-11 14:55:14 -0500
commitf0ad073f043b5ac04620bb80ecfc92114d348044 (patch)
treef106d954a13881b5f6e810b73061d1091c376129 /drivers/usb/host
parent8e08b9766b50826e12139a821b6b3bdfcadcceda (diff)
USB: whci-hcd: fix type and format warnings in sg code
Fix type and format warning in the new sg code. Remove the very chatty debug messages that were left in by mistake and use min_t() as required (no one seems to agree on a type for buffer sizes). Reported-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: David Vrabel <david.vrabel@csr.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/host')
-rw-r--r--drivers/usb/host/whci/qset.c26
1 files changed, 2 insertions, 24 deletions
diff --git a/drivers/usb/host/whci/qset.c b/drivers/usb/host/whci/qset.c
index 88e51ea8620b..08280869ed1c 100644
--- a/drivers/usb/host/whci/qset.c
+++ b/drivers/usb/host/whci/qset.c
@@ -422,8 +422,6 @@ static int qset_add_urb_sg(struct whc *whc, struct whc_qset *qset, struct urb *u
422 size_t pl_len; 422 size_t pl_len;
423 int p = 0; 423 int p = 0;
424 424
425 dev_dbg(&whc->umc->dev, "adding urb w/ sg of length %d\n", urb->transfer_buffer_length);
426
427 remaining = urb->transfer_buffer_length; 425 remaining = urb->transfer_buffer_length;
428 426
429 for_each_sg(urb->sg->sg, sg, urb->num_sgs, i) { 427 for_each_sg(urb->sg->sg, sg, urb->num_sgs, i) {
@@ -437,10 +435,7 @@ static int qset_add_urb_sg(struct whc *whc, struct whc_qset *qset, struct urb *u
437 } 435 }
438 436
439 dma_addr = sg_dma_address(sg); 437 dma_addr = sg_dma_address(sg);
440 dma_remaining = min(sg_dma_len(sg), remaining); 438 dma_remaining = min_t(size_t, sg_dma_len(sg), remaining);
441
442 dev_dbg(&whc->umc->dev, "adding sg[%d] %08x %d\n", i, (unsigned)dma_addr,
443 dma_remaining);
444 439
445 while (dma_remaining) { 440 while (dma_remaining) {
446 size_t dma_len; 441 size_t dma_len;
@@ -463,7 +458,6 @@ static int qset_add_urb_sg(struct whc *whc, struct whc_qset *qset, struct urb *u
463 || std->len + WHCI_PAGE_SIZE > QTD_MAX_XFER_SIZE) { 458 || std->len + WHCI_PAGE_SIZE > QTD_MAX_XFER_SIZE) {
464 if (prev_end % qset->max_packet != 0) 459 if (prev_end % qset->max_packet != 0)
465 return -EINVAL; 460 return -EINVAL;
466 dev_dbg(&whc->umc->dev, "need new std\n");
467 std = qset_new_std(whc, qset, urb, mem_flags); 461 std = qset_new_std(whc, qset, urb, mem_flags);
468 if (std == NULL) { 462 if (std == NULL) {
469 return -ENOMEM; 463 return -ENOMEM;
@@ -485,8 +479,6 @@ static int qset_add_urb_sg(struct whc *whc, struct whc_qset *qset, struct urb *u
485 dma_len = ep - dma_addr; 479 dma_len = ep - dma_addr;
486 } 480 }
487 481
488 dev_dbg(&whc->umc->dev, "adding %d\n", dma_len);
489
490 std->len += dma_len; 482 std->len += dma_len;
491 std->ntds_remaining = -1; /* filled in later */ 483 std->ntds_remaining = -1; /* filled in later */
492 484
@@ -495,9 +487,6 @@ static int qset_add_urb_sg(struct whc *whc, struct whc_qset *qset, struct urb *u
495 num_pointers = DIV_ROUND_UP(ep - sp, WHCI_PAGE_SIZE); 487 num_pointers = DIV_ROUND_UP(ep - sp, WHCI_PAGE_SIZE);
496 std->num_pointers += num_pointers; 488 std->num_pointers += num_pointers;
497 489
498 dev_dbg(&whc->umc->dev, "need %d more (%d total) page pointers\n",
499 num_pointers, std->num_pointers);
500
501 pl_len = std->num_pointers * sizeof(struct whc_page_list_entry); 490 pl_len = std->num_pointers * sizeof(struct whc_page_list_entry);
502 491
503 std->pl_virt = krealloc(std->pl_virt, pl_len, mem_flags); 492 std->pl_virt = krealloc(std->pl_virt, pl_len, mem_flags);
@@ -506,7 +495,6 @@ static int qset_add_urb_sg(struct whc *whc, struct whc_qset *qset, struct urb *u
506 } 495 }
507 496
508 for (;p < std->num_pointers; p++, entry++) { 497 for (;p < std->num_pointers; p++, entry++) {
509 dev_dbg(&whc->umc->dev, "e[%d] %08x\n", p, dma_addr);
510 std->pl_virt[p].buf_ptr = cpu_to_le64(dma_addr); 498 std->pl_virt[p].buf_ptr = cpu_to_le64(dma_addr);
511 dma_addr = (dma_addr + WHCI_PAGE_SIZE) & ~(WHCI_PAGE_SIZE-1); 499 dma_addr = (dma_addr + WHCI_PAGE_SIZE) & ~(WHCI_PAGE_SIZE-1);
512 } 500 }
@@ -517,8 +505,6 @@ static int qset_add_urb_sg(struct whc *whc, struct whc_qset *qset, struct urb *u
517 } 505 }
518 } 506 }
519 507
520 dev_dbg(&whc->umc->dev, "used %d tds\n", ntds);
521
522 /* Now the number of stds is know, go back and fill in 508 /* Now the number of stds is know, go back and fill in
523 std->ntds_remaining. */ 509 std->ntds_remaining. */
524 list_for_each_entry(std, &qset->stds, list_node) { 510 list_for_each_entry(std, &qset->stds, list_node) {
@@ -565,14 +551,11 @@ static int qset_add_urb_sg_linearize(struct whc *whc, struct whc_qset *qset,
565 break; 551 break;
566 } 552 }
567 553
568 sg_remaining = min(remaining, sg->length); 554 sg_remaining = min_t(size_t, remaining, sg->length);
569 orig = sg_virt(sg); 555 orig = sg_virt(sg);
570 556
571 dev_dbg(&whc->umc->dev, "adding sg[%d] %d\n", i, sg_remaining);
572
573 while (sg_remaining) { 557 while (sg_remaining) {
574 if (!std || std->len == max_std_len) { 558 if (!std || std->len == max_std_len) {
575 dev_dbg(&whc->umc->dev, "need new std\n");
576 std = qset_new_std(whc, qset, urb, mem_flags); 559 std = qset_new_std(whc, qset, urb, mem_flags);
577 if (std == NULL) 560 if (std == NULL)
578 return -ENOMEM; 561 return -ENOMEM;
@@ -587,9 +570,6 @@ static int qset_add_urb_sg_linearize(struct whc *whc, struct whc_qset *qset,
587 570
588 len = min(sg_remaining, max_std_len - std->len); 571 len = min(sg_remaining, max_std_len - std->len);
589 572
590 dev_dbg(&whc->umc->dev, "added %d from sg[%d] @ offset %d\n",
591 len, i, orig - sg_virt(sg));
592
593 if (is_out) 573 if (is_out)
594 memcpy(bounce, orig, len); 574 memcpy(bounce, orig, len);
595 575
@@ -650,8 +630,6 @@ int qset_add_urb(struct whc *whc, struct whc_qset *qset, struct urb *urb,
650 if (urb->sg) { 630 if (urb->sg) {
651 ret = qset_add_urb_sg(whc, qset, urb, mem_flags); 631 ret = qset_add_urb_sg(whc, qset, urb, mem_flags);
652 if (ret == -EINVAL) { 632 if (ret == -EINVAL) {
653 dev_dbg(&whc->umc->dev, "linearizing %d octet urb\n",
654 urb->transfer_buffer_length);
655 qset_free_stds(qset, urb); 633 qset_free_stds(qset, urb);
656 ret = qset_add_urb_sg_linearize(whc, qset, urb, mem_flags); 634 ret = qset_add_urb_sg_linearize(whc, qset, urb, mem_flags);
657 } 635 }