aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2011-10-31 03:47:01 -0400
committerFelipe Balbi <balbi@ti.com>2011-12-12 04:45:02 -0500
commitfc9d5c79f681a7bff588d32de9429be360996df7 (patch)
tree584b978ab20a62c499c42e11ab013b2c05ecb590 /drivers/usb
parentee8a0bf5a775098b1140195b6bfacb4813166e5f (diff)
usb: gadget: renesas_usbhs: usbhsh_ureq_alloc/free() care urb->hcpriv
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/renesas_usbhs/mod_host.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/drivers/usb/renesas_usbhs/mod_host.c b/drivers/usb/renesas_usbhs/mod_host.c
index 478366b571e..0b88e88c5ee 100644
--- a/drivers/usb/renesas_usbhs/mod_host.c
+++ b/drivers/usb/renesas_usbhs/mod_host.c
@@ -239,6 +239,7 @@ static struct usbhsh_request *usbhsh_ureq_alloc(struct usbhsh_hpriv *hpriv,
239 */ 239 */
240 list_add_tail(&ureq->ureq_link, &hpriv->ureq_link_active); 240 list_add_tail(&ureq->ureq_link, &hpriv->ureq_link_active);
241 ureq->urb = urb; 241 ureq->urb = urb;
242 usbhsh_urb_to_ureq(urb) = ureq;
242 243
243 return ureq; 244 return ureq;
244} 245}
@@ -254,6 +255,7 @@ static void usbhsh_ureq_free(struct usbhsh_hpriv *hpriv,
254 * removed from "active" list, 255 * removed from "active" list,
255 * and push it to "free" list 256 * and push it to "free" list
256 */ 257 */
258 usbhsh_urb_to_ureq(ureq->urb) = NULL;
257 ureq->urb = NULL; 259 ureq->urb = NULL;
258 list_del_init(&ureq->ureq_link); 260 list_del_init(&ureq->ureq_link);
259 list_add_tail(&ureq->ureq_link, &hpriv->ureq_link_free); 261 list_add_tail(&ureq->ureq_link, &hpriv->ureq_link_free);
@@ -495,7 +497,6 @@ static void usbhsh_queue_done(struct usbhs_priv *priv, struct usbhs_pkt *pkt)
495 497
496 urb->actual_length = pkt->actual; 498 urb->actual_length = pkt->actual;
497 usbhsh_ureq_free(hpriv, ureq); 499 usbhsh_ureq_free(hpriv, ureq);
498 usbhsh_urb_to_ureq(urb) = NULL;
499 500
500 usb_hcd_unlink_urb_from_ep(hcd, urb); 501 usb_hcd_unlink_urb_from_ep(hcd, urb);
501 usb_hcd_giveback_urb(hcd, urb, 0); 502 usb_hcd_giveback_urb(hcd, urb, 0);
@@ -523,7 +524,6 @@ static int usbhsh_queue_push(struct usb_hcd *hcd,
523 dev_err(dev, "ureq alloc fail\n"); 524 dev_err(dev, "ureq alloc fail\n");
524 return -ENOMEM; 525 return -ENOMEM;
525 } 526 }
526 usbhsh_urb_to_ureq(urb) = ureq;
527 527
528 if (usb_pipein(urb->pipe)) 528 if (usb_pipein(urb->pipe))
529 pipe->handler = &usbhs_fifo_pio_pop_handler; 529 pipe->handler = &usbhs_fifo_pio_pop_handler;
@@ -606,12 +606,10 @@ static void usbhsh_data_stage_packet_done(struct usbhs_priv *priv,
606{ 606{
607 struct usbhsh_request *ureq = usbhsh_pkt_to_ureq(pkt); 607 struct usbhsh_request *ureq = usbhsh_pkt_to_ureq(pkt);
608 struct usbhsh_hpriv *hpriv = usbhsh_priv_to_hpriv(priv); 608 struct usbhsh_hpriv *hpriv = usbhsh_priv_to_hpriv(priv);
609 struct urb *urb = ureq->urb;
610 609
611 /* this ureq was connected to urb when usbhsh_urb_enqueue() */ 610 /* this ureq was connected to urb when usbhsh_urb_enqueue() */
612 611
613 usbhsh_ureq_free(hpriv, ureq); 612 usbhsh_ureq_free(hpriv, ureq);
614 usbhsh_urb_to_ureq(urb) = NULL;
615} 613}
616 614
617static int usbhsh_data_stage_packet_push(struct usbhsh_hpriv *hpriv, 615static int usbhsh_data_stage_packet_push(struct usbhsh_hpriv *hpriv,
@@ -626,7 +624,6 @@ static int usbhsh_data_stage_packet_push(struct usbhsh_hpriv *hpriv,
626 ureq = usbhsh_ureq_alloc(hpriv, urb, mem_flags); 624 ureq = usbhsh_ureq_alloc(hpriv, urb, mem_flags);
627 if (unlikely(!ureq)) 625 if (unlikely(!ureq))
628 return -ENOMEM; 626 return -ENOMEM;
629 usbhsh_urb_to_ureq(urb) = ureq;
630 627
631 if (usb_pipein(urb->pipe)) 628 if (usb_pipein(urb->pipe))
632 pipe->handler = &usbhs_dcp_data_stage_in_handler; 629 pipe->handler = &usbhs_dcp_data_stage_in_handler;
@@ -656,7 +653,6 @@ static int usbhsh_status_stage_packet_push(struct usbhsh_hpriv *hpriv,
656 ureq = usbhsh_ureq_alloc(hpriv, urb, mem_flags); 653 ureq = usbhsh_ureq_alloc(hpriv, urb, mem_flags);
657 if (unlikely(!ureq)) 654 if (unlikely(!ureq))
658 return -ENOMEM; 655 return -ENOMEM;
659 usbhsh_urb_to_ureq(urb) = ureq;
660 656
661 if (usb_pipein(urb->pipe)) 657 if (usb_pipein(urb->pipe))
662 pipe->handler = &usbhs_dcp_status_stage_in_handler; 658 pipe->handler = &usbhs_dcp_status_stage_in_handler;
@@ -811,10 +807,8 @@ static int usbhsh_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status)
811 struct usbhsh_hpriv *hpriv = usbhsh_hcd_to_hpriv(hcd); 807 struct usbhsh_hpriv *hpriv = usbhsh_hcd_to_hpriv(hcd);
812 struct usbhsh_request *ureq = usbhsh_urb_to_ureq(urb); 808 struct usbhsh_request *ureq = usbhsh_urb_to_ureq(urb);
813 809
814 if (ureq) { 810 if (ureq)
815 usbhsh_ureq_free(hpriv, ureq); 811 usbhsh_ureq_free(hpriv, ureq);
816 usbhsh_urb_to_ureq(urb) = NULL;
817 }
818 812
819 return 0; 813 return 0;
820} 814}