diff options
Diffstat (limited to 'drivers/usb/host/uhci-hcd.c')
-rw-r--r-- | drivers/usb/host/uhci-hcd.c | 42 |
1 files changed, 27 insertions, 15 deletions
diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c index 17de9ee910f6..b44094fcd779 100644 --- a/drivers/usb/host/uhci-hcd.c +++ b/drivers/usb/host/uhci-hcd.c | |||
@@ -212,7 +212,7 @@ static void configure_hc(struct uhci_hcd *uhci) | |||
212 | outb(USBSOF_DEFAULT, uhci->io_addr + USBSOF); | 212 | outb(USBSOF_DEFAULT, uhci->io_addr + USBSOF); |
213 | 213 | ||
214 | /* Store the frame list base address */ | 214 | /* Store the frame list base address */ |
215 | outl(uhci->fl->dma_handle, uhci->io_addr + USBFLBASEADD); | 215 | outl(uhci->frame_dma_handle, uhci->io_addr + USBFLBASEADD); |
216 | 216 | ||
217 | /* Set the current frame number */ | 217 | /* Set the current frame number */ |
218 | outw(uhci->frame_number, uhci->io_addr + USBFRNUM); | 218 | outw(uhci->frame_number, uhci->io_addr + USBFRNUM); |
@@ -445,8 +445,11 @@ static void release_uhci(struct uhci_hcd *uhci) | |||
445 | 445 | ||
446 | dma_pool_destroy(uhci->td_pool); | 446 | dma_pool_destroy(uhci->td_pool); |
447 | 447 | ||
448 | dma_free_coherent(uhci_dev(uhci), sizeof(*uhci->fl), | 448 | kfree(uhci->frame_cpu); |
449 | uhci->fl, uhci->fl->dma_handle); | 449 | |
450 | dma_free_coherent(uhci_dev(uhci), | ||
451 | UHCI_NUMFRAMES * sizeof(*uhci->frame), | ||
452 | uhci->frame, uhci->frame_dma_handle); | ||
450 | 453 | ||
451 | debugfs_remove(uhci->dentry); | 454 | debugfs_remove(uhci->dentry); |
452 | } | 455 | } |
@@ -527,7 +530,6 @@ static int uhci_start(struct usb_hcd *hcd) | |||
527 | struct uhci_hcd *uhci = hcd_to_uhci(hcd); | 530 | struct uhci_hcd *uhci = hcd_to_uhci(hcd); |
528 | int retval = -EBUSY; | 531 | int retval = -EBUSY; |
529 | int i; | 532 | int i; |
530 | dma_addr_t dma_handle; | ||
531 | struct dentry *dentry; | 533 | struct dentry *dentry; |
532 | 534 | ||
533 | hcd->uses_new_polling = 1; | 535 | hcd->uses_new_polling = 1; |
@@ -561,17 +563,23 @@ static int uhci_start(struct usb_hcd *hcd) | |||
561 | 563 | ||
562 | init_waitqueue_head(&uhci->waitqh); | 564 | init_waitqueue_head(&uhci->waitqh); |
563 | 565 | ||
564 | uhci->fl = dma_alloc_coherent(uhci_dev(uhci), sizeof(*uhci->fl), | 566 | uhci->frame = dma_alloc_coherent(uhci_dev(uhci), |
565 | &dma_handle, 0); | 567 | UHCI_NUMFRAMES * sizeof(*uhci->frame), |
566 | if (!uhci->fl) { | 568 | &uhci->frame_dma_handle, 0); |
569 | if (!uhci->frame) { | ||
567 | dev_err(uhci_dev(uhci), "unable to allocate " | 570 | dev_err(uhci_dev(uhci), "unable to allocate " |
568 | "consistent memory for frame list\n"); | 571 | "consistent memory for frame list\n"); |
569 | goto err_alloc_fl; | 572 | goto err_alloc_frame; |
570 | } | 573 | } |
574 | memset(uhci->frame, 0, UHCI_NUMFRAMES * sizeof(*uhci->frame)); | ||
571 | 575 | ||
572 | memset((void *)uhci->fl, 0, sizeof(*uhci->fl)); | 576 | uhci->frame_cpu = kcalloc(UHCI_NUMFRAMES, sizeof(*uhci->frame_cpu), |
573 | 577 | GFP_KERNEL); | |
574 | uhci->fl->dma_handle = dma_handle; | 578 | if (!uhci->frame_cpu) { |
579 | dev_err(uhci_dev(uhci), "unable to allocate " | ||
580 | "memory for frame pointers\n"); | ||
581 | goto err_alloc_frame_cpu; | ||
582 | } | ||
575 | 583 | ||
576 | uhci->td_pool = dma_pool_create("uhci_td", uhci_dev(uhci), | 584 | uhci->td_pool = dma_pool_create("uhci_td", uhci_dev(uhci), |
577 | sizeof(struct uhci_td), 16, 0); | 585 | sizeof(struct uhci_td), 16, 0); |
@@ -654,7 +662,7 @@ static int uhci_start(struct usb_hcd *hcd) | |||
654 | irq = 7; | 662 | irq = 7; |
655 | 663 | ||
656 | /* Only place we don't use the frame list routines */ | 664 | /* Only place we don't use the frame list routines */ |
657 | uhci->fl->frame[i] = UHCI_PTR_QH | | 665 | uhci->frame[i] = UHCI_PTR_QH | |
658 | cpu_to_le32(uhci->skelqh[irq]->dma_handle); | 666 | cpu_to_le32(uhci->skelqh[irq]->dma_handle); |
659 | } | 667 | } |
660 | 668 | ||
@@ -686,10 +694,14 @@ err_create_qh_pool: | |||
686 | dma_pool_destroy(uhci->td_pool); | 694 | dma_pool_destroy(uhci->td_pool); |
687 | 695 | ||
688 | err_create_td_pool: | 696 | err_create_td_pool: |
689 | dma_free_coherent(uhci_dev(uhci), sizeof(*uhci->fl), | 697 | kfree(uhci->frame_cpu); |
690 | uhci->fl, uhci->fl->dma_handle); | 698 | |
699 | err_alloc_frame_cpu: | ||
700 | dma_free_coherent(uhci_dev(uhci), | ||
701 | UHCI_NUMFRAMES * sizeof(*uhci->frame), | ||
702 | uhci->frame, uhci->frame_dma_handle); | ||
691 | 703 | ||
692 | err_alloc_fl: | 704 | err_alloc_frame: |
693 | debugfs_remove(uhci->dentry); | 705 | debugfs_remove(uhci->dentry); |
694 | 706 | ||
695 | err_create_debug_entry: | 707 | err_create_debug_entry: |