]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
Merge remote-tracking branch 'usb-chipidea-next/ci-for-usb-next'
authorStephen Rothwell <sfr@canb.auug.org.au>
Thu, 5 Nov 2015 03:51:27 +0000 (14:51 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 5 Nov 2015 03:51:27 +0000 (14:51 +1100)
1  2 
drivers/usb/chipidea/debug.c
drivers/usb/chipidea/udc.c

index 58c8485a0715ada6c585a29e23883f25091fa127,244e8cb1b90491b2da0bdb45b4e379690da70bdd..a4f7db2e18ddc295fc4ff1a0cad99bc1ff8b04bd
@@@ -15,7 -15,6 +15,6 @@@
  #include "ci.h"
  #include "udc.h"
  #include "bits.h"
- #include "debug.h"
  #include "otg.h"
  
  /**
@@@ -322,10 -321,8 +321,10 @@@ static ssize_t ci_role_write(struct fil
                return -EINVAL;
  
        pm_runtime_get_sync(ci->dev);
 +      disable_irq(ci->irq);
        ci_role_stop(ci);
        ret = ci_role_start(ci, role);
 +      enable_irq(ci->irq);
        pm_runtime_put_sync(ci->dev);
  
        return ret ? ret : count;
index 391a1225b0ba330cd818028f240cb151e8ade65c,1473360cb74b2b2c672112372e38470810dcbbdb..2987a742ca3bef8251de32e8009e5727fd12312e
@@@ -26,7 -26,6 +26,6 @@@
  #include "ci.h"
  #include "udc.h"
  #include "bits.h"
- #include "debug.h"
  #include "otg.h"
  #include "otg_fsm.h"
  
@@@ -404,9 -403,9 +403,9 @@@ static inline u8 _usb_addr(struct ci_hw
  }
  
  /**
-  * _hardware_queue: configures a request at hardware level
-  * @gadget: gadget
+  * _hardware_enqueue: configures a request at hardware level
   * @hwep:   endpoint
+  * @hwreq:  request
   *
   * This function returns an error code
   */
@@@ -435,19 -434,28 +434,28 @@@ static int _hardware_enqueue(struct ci_
        if (hwreq->req.dma % PAGE_SIZE)
                pages--;
  
-       if (rest == 0)
-               add_td_to_list(hwep, hwreq, 0);
+       if (rest == 0) {
+               ret = add_td_to_list(hwep, hwreq, 0);
+               if (ret < 0)
+                       goto done;
+       }
  
        while (rest > 0) {
                unsigned count = min(hwreq->req.length - hwreq->req.actual,
                                        (unsigned)(pages * CI_HDRC_PAGE_SIZE));
-               add_td_to_list(hwep, hwreq, count);
+               ret = add_td_to_list(hwep, hwreq, count);
+               if (ret < 0)
+                       goto done;
                rest -= count;
        }
  
        if (hwreq->req.zero && hwreq->req.length && hwep->dir == TX
-           && (hwreq->req.length % hwep->ep.maxpacket == 0))
-               add_td_to_list(hwep, hwreq, 0);
+           && (hwreq->req.length % hwep->ep.maxpacket == 0)) {
+               ret = add_td_to_list(hwep, hwreq, 0);
+               if (ret < 0)
+                       goto done;
+       }
  
        firstnode = list_first_entry(&hwreq->tds, struct td_node, td);
  
@@@ -788,8 -796,12 +796,12 @@@ static void isr_get_status_complete(str
  
  /**
   * _ep_queue: queues (submits) an I/O request to an endpoint
+  * @ep:        endpoint
+  * @req:       request
+  * @gfp_flags: GFP flags (not used)
   *
   * Caller must hold lock
+  * This function returns an error code
   */
  static int _ep_queue(struct usb_ep *ep, struct usb_request *req,
                    gfp_t __maybe_unused gfp_flags)
@@@ -1751,22 -1763,6 +1763,22 @@@ static int ci_udc_start(struct usb_gadg
        return retval;
  }
  
 +static void ci_udc_stop_for_otg_fsm(struct ci_hdrc *ci)
 +{
 +      if (!ci_otg_is_fsm_mode(ci))
 +              return;
 +
 +      mutex_lock(&ci->fsm.lock);
 +      if (ci->fsm.otg->state == OTG_STATE_A_PERIPHERAL) {
 +              ci->fsm.a_bidl_adis_tmout = 1;
 +              ci_hdrc_otg_fsm_start(ci);
 +      } else if (ci->fsm.otg->state == OTG_STATE_B_PERIPHERAL) {
 +              ci->fsm.protocol = PROTO_UNDEF;
 +              ci->fsm.otg->state = OTG_STATE_UNDEFINED;
 +      }
 +      mutex_unlock(&ci->fsm.lock);
 +}
 +
  /**
   * ci_udc_stop: unregister a gadget driver
   */
@@@ -1791,7 -1787,6 +1803,7 @@@ static int ci_udc_stop(struct usb_gadge
        ci->driver = NULL;
        spin_unlock_irqrestore(&ci->lock, flags);
  
 +      ci_udc_stop_for_otg_fsm(ci);
        return 0;
  }