diff options
author | David S. Miller <davem@davemloft.net> | 2015-07-23 03:41:16 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-07-23 03:41:16 -0400 |
commit | c5e40ee287db61a79af1746954ee03ebbf1ff8a3 (patch) | |
tree | 007da00e75e9b84766ac4868421705300e1e2e14 /drivers/usb/dwc2/hcd_queue.c | |
parent | 052831879945be0d9fad2216b127147c565ec1b1 (diff) | |
parent | c5dfd654d0ec0a28fe81e7bd4d4fd984a9855e09 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Conflicts:
net/bridge/br_mdb.c
br_mdb.c conflict was a function call being removed to fix a bug in
'net' but whose signature was changed in 'net-next'.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/usb/dwc2/hcd_queue.c')
-rw-r--r-- | drivers/usb/dwc2/hcd_queue.c | 49 |
1 files changed, 12 insertions, 37 deletions
diff --git a/drivers/usb/dwc2/hcd_queue.c b/drivers/usb/dwc2/hcd_queue.c index 9b5c36256627..3ad63d392e13 100644 --- a/drivers/usb/dwc2/hcd_queue.c +++ b/drivers/usb/dwc2/hcd_queue.c | |||
@@ -191,7 +191,7 @@ static void dwc2_qh_init(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh, | |||
191 | * | 191 | * |
192 | * Return: Pointer to the newly allocated QH, or NULL on error | 192 | * Return: Pointer to the newly allocated QH, or NULL on error |
193 | */ | 193 | */ |
194 | static struct dwc2_qh *dwc2_hcd_qh_create(struct dwc2_hsotg *hsotg, | 194 | struct dwc2_qh *dwc2_hcd_qh_create(struct dwc2_hsotg *hsotg, |
195 | struct dwc2_hcd_urb *urb, | 195 | struct dwc2_hcd_urb *urb, |
196 | gfp_t mem_flags) | 196 | gfp_t mem_flags) |
197 | { | 197 | { |
@@ -767,57 +767,32 @@ void dwc2_hcd_qtd_init(struct dwc2_qtd *qtd, struct dwc2_hcd_urb *urb) | |||
767 | * | 767 | * |
768 | * @hsotg: The DWC HCD structure | 768 | * @hsotg: The DWC HCD structure |
769 | * @qtd: The QTD to add | 769 | * @qtd: The QTD to add |
770 | * @qh: Out parameter to return queue head | 770 | * @qh: Queue head to add qtd to |
771 | * @atomic_alloc: Flag to do atomic alloc if needed | ||
772 | * | 771 | * |
773 | * Return: 0 if successful, negative error code otherwise | 772 | * Return: 0 if successful, negative error code otherwise |
774 | * | 773 | * |
775 | * Finds the correct QH to place the QTD into. If it does not find a QH, it | 774 | * If the QH to which the QTD is added is not currently scheduled, it is placed |
776 | * will create a new QH. If the QH to which the QTD is added is not currently | 775 | * into the proper schedule based on its EP type. |
777 | * scheduled, it is placed into the proper schedule based on its EP type. | ||
778 | */ | 776 | */ |
779 | int dwc2_hcd_qtd_add(struct dwc2_hsotg *hsotg, struct dwc2_qtd *qtd, | 777 | int dwc2_hcd_qtd_add(struct dwc2_hsotg *hsotg, struct dwc2_qtd *qtd, |
780 | struct dwc2_qh **qh, gfp_t mem_flags) | 778 | struct dwc2_qh *qh) |
781 | { | 779 | { |
782 | struct dwc2_hcd_urb *urb = qtd->urb; | ||
783 | int allocated = 0; | ||
784 | int retval; | 780 | int retval; |
785 | 781 | ||
786 | /* | 782 | if (unlikely(!qh)) { |
787 | * Get the QH which holds the QTD-list to insert to. Create QH if it | 783 | dev_err(hsotg->dev, "%s: Invalid QH\n", __func__); |
788 | * doesn't exist. | 784 | retval = -EINVAL; |
789 | */ | 785 | goto fail; |
790 | if (*qh == NULL) { | ||
791 | *qh = dwc2_hcd_qh_create(hsotg, urb, mem_flags); | ||
792 | if (*qh == NULL) | ||
793 | return -ENOMEM; | ||
794 | allocated = 1; | ||
795 | } | 786 | } |
796 | 787 | ||
797 | retval = dwc2_hcd_qh_add(hsotg, *qh); | 788 | retval = dwc2_hcd_qh_add(hsotg, qh); |
798 | if (retval) | 789 | if (retval) |
799 | goto fail; | 790 | goto fail; |
800 | 791 | ||
801 | qtd->qh = *qh; | 792 | qtd->qh = qh; |
802 | list_add_tail(&qtd->qtd_list_entry, &(*qh)->qtd_list); | 793 | list_add_tail(&qtd->qtd_list_entry, &qh->qtd_list); |
803 | 794 | ||
804 | return 0; | 795 | return 0; |
805 | |||
806 | fail: | 796 | fail: |
807 | if (allocated) { | ||
808 | struct dwc2_qtd *qtd2, *qtd2_tmp; | ||
809 | struct dwc2_qh *qh_tmp = *qh; | ||
810 | |||
811 | *qh = NULL; | ||
812 | dwc2_hcd_qh_unlink(hsotg, qh_tmp); | ||
813 | |||
814 | /* Free each QTD in the QH's QTD list */ | ||
815 | list_for_each_entry_safe(qtd2, qtd2_tmp, &qh_tmp->qtd_list, | ||
816 | qtd_list_entry) | ||
817 | dwc2_hcd_qtd_unlink_and_free(hsotg, qtd2, qh_tmp); | ||
818 | |||
819 | dwc2_hcd_qh_free(hsotg, qh_tmp); | ||
820 | } | ||
821 | |||
822 | return retval; | 797 | return retval; |
823 | } | 798 | } |