unsigned cmd, struct dwc3_gadget_ep_cmd_params *params)
 {
        struct dwc3_ep          *dep = dwc->eps[ep];
-       unsigned long           timeout = 500;
+       u32                     timeout = 500;
        u32                     reg;
 
        dev_vdbg(dwc->dev, "%s: cmd '%s' params %08x %08x %08x\n",
                }
 
                /*
-                * XXX Figure out a sane timeout here. 500ms is way too much.
                 * We can't sleep here, because it is also called from
                 * interrupt context.
                 */
                if (!timeout)
                        return -ETIMEDOUT;
 
-               mdelay(1);
+               udelay(1);
        } while (1);
 }
 
 static void dwc3_gadget_run_stop(struct dwc3 *dwc, int is_on)
 {
        u32                     reg;
-       unsigned long           timeout = 500;
+       u32                     timeout = 500;
 
        reg = dwc3_readl(dwc->regs, DWC3_DCTL);
        if (is_on)
                        if (reg & DWC3_DSTS_DEVCTRLHLT)
                                break;
                }
-               /*
-                * XXX reduce the 500ms delay
-                */
                timeout--;
                if (!timeout)
                        break;
-               mdelay(1);
+               udelay(1);
        } while (1);
 
        dev_vdbg(dwc->dev, "gadget %s data soft-%s\n",