* @u2pel: parameter from Set SEL request.
  * @u1sel: parameter from Set SEL request.
  * @u1pel: parameter from Set SEL request.
- * @num_out_eps: number of out endpoints
- * @num_in_eps: number of in endpoints
+ * @num_eps: number of endpoints
  * @ep0_next_event: hold the next expected event
  * @ep0state: state of endpoint zero
  * @link_state: link state
 
        u8                      speed;
 
-       u8                      num_out_eps;
-       u8                      num_in_eps;
+       u8                      num_eps;
 
        struct dwc3_hwparams    hwparams;
        struct dentry           *root;
 
 {
        int                     i;
 
-       for (i = 0; i < dwc->num_in_eps; i++) {
-               u8              epnum = (i << 1) | 1;
-               struct dwc3_ep  *dep = dwc->eps[epnum];
-
-               if (!dep)
-                       continue;
-
-               dwc3_debugfs_create_endpoint_dir(dep, parent);
-       }
-
-       for (i = 0; i < dwc->num_out_eps; i++) {
-               u8              epnum = (i << 1);
-               struct dwc3_ep  *dep = dwc->eps[epnum];
+       for (i = 0; i < dwc->num_eps; i++) {
+               struct dwc3_ep  *dep = dwc->eps[i];
 
                if (!dep)
                        continue;
 
 
 /* -------------------------------------------------------------------------- */
 
-static int dwc3_gadget_init_hw_endpoints(struct dwc3 *dwc,
-               u8 num, u32 direction)
+static int dwc3_gadget_init_hw_endpoints(struct dwc3 *dwc, u8 num)
 {
        struct dwc3_ep                  *dep;
-       u8                              i;
+       u8                              epnum;
 
-       for (i = 0; i < num; i++) {
-               u8 epnum = (i << 1) | (direction ? 1 : 0);
+       for (epnum = 0; epnum < num; epnum++) {
+               bool                    direction = epnum & 1;
 
                dep = kzalloc(sizeof(*dep), GFP_KERNEL);
                if (!dep)
 
                dep->dwc = dwc;
                dep->number = epnum;
-               dep->direction = !!direction;
+               dep->direction = direction;
                dep->regs = dwc->regs + DWC3_DEP_BASE(epnum);
                dwc->eps[epnum] = dep;
 
                snprintf(dep->name, sizeof(dep->name), "ep%d%s", epnum >> 1,
-                               (epnum & 1) ? "in" : "out");
+                               direction ? "in" : "out");
 
                dep->endpoint.name = dep->name;
 
                        /* MDWIDTH is represented in bits, we need it in bytes */
                        mdwidth /= 8;
 
-                       size = dwc3_readl(dwc->regs, DWC3_GTXFIFOSIZ(i));
+                       size = dwc3_readl(dwc->regs, DWC3_GTXFIFOSIZ(epnum >> 1));
                        size = DWC3_GTXFIFOSIZ_TXFDEF(size);
 
                        /* FIFO Depth is in MDWDITH bytes. Multiply */
                        dep->endpoint.caps.type_int = true;
                }
 
-               dep->endpoint.caps.dir_in = !!direction;
+               dep->endpoint.caps.dir_in = direction;
                dep->endpoint.caps.dir_out = !direction;
 
                INIT_LIST_HEAD(&dep->pending_list);
 
 static int dwc3_gadget_init_endpoints(struct dwc3 *dwc)
 {
-       int                             ret;
-
        INIT_LIST_HEAD(&dwc->gadget.ep_list);
 
-       ret = dwc3_gadget_init_hw_endpoints(dwc, dwc->num_out_eps, 0);
-       if (ret < 0) {
-               dev_err(dwc->dev, "failed to initialize OUT endpoints\n");
-               return ret;
-       }
-
-       ret = dwc3_gadget_init_hw_endpoints(dwc, dwc->num_in_eps, 1);
-       if (ret < 0) {
-               dev_err(dwc->dev, "failed to initialize IN endpoints\n");
-               return ret;
-       }
-
-       return 0;
+       return dwc3_gadget_init_hw_endpoints(dwc, dwc->num_eps);
 }
 
 static void dwc3_gadget_free_endpoints(struct dwc3 *dwc)