Author: hselasky
Date: Thu Oct  2 16:56:00 2014
New Revision: 272422
URL: https://svnweb.freebsd.org/changeset/base/272422

Log:
  Make sure we always set the maximum number of valid contexts.
  
  MFC after:    3 days

Modified:
  head/sys/dev/usb/controller/xhci.c

Modified: head/sys/dev/usb/controller/xhci.c
==============================================================================
--- head/sys/dev/usb/controller/xhci.c  Thu Oct  2 16:49:22 2014        
(r272421)
+++ head/sys/dev/usb/controller/xhci.c  Thu Oct  2 16:56:00 2014        
(r272422)
@@ -2271,14 +2271,17 @@ xhci_configure_mask(struct usb_device *u
                /* adjust */
                x--;
 
-               /* figure out maximum */
-               if (x > sc->sc_hw.devs[index].context_num) {
+               /* figure out the maximum number of contexts */
+               if (x > sc->sc_hw.devs[index].context_num)
                        sc->sc_hw.devs[index].context_num = x;
-                       temp = xhci_ctx_get_le32(sc, &pinp->ctx_slot.dwSctx0);
-                       temp &= ~XHCI_SCTX_0_CTX_NUM_SET(31);
-                       temp |= XHCI_SCTX_0_CTX_NUM_SET(x + 1);
-                       xhci_ctx_set_le32(sc, &pinp->ctx_slot.dwSctx0, temp);
-               }
+               else
+                       x = sc->sc_hw.devs[index].context_num;
+
+               /* update number of contexts */
+               temp = xhci_ctx_get_le32(sc, &pinp->ctx_slot.dwSctx0);
+               temp &= ~XHCI_SCTX_0_CTX_NUM_SET(31);
+               temp |= XHCI_SCTX_0_CTX_NUM_SET(x + 1);
+               xhci_ctx_set_le32(sc, &pinp->ctx_slot.dwSctx0, temp);
        }
        return (0);
 }
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to