/* Convert the given wIndex into a pointer to an driver endpoint structure, or return NULL if it is not a valid endpoint.  */
static struct s3c_hsotg_ep* ep_from_windex(struct s3c_hsotg *hsotg, u32 windex)
/* Convert the given wIndex into a pointer to an driver endpoint structure, or return NULL if it is not a valid endpoint.  */
static struct s3c_hsotg_ep* ep_from_windex(struct s3c_hsotg *hsotg, u32 windex)
{
	struct s3c_hsotg_ep *ep = &hsotg->eps[windex & 0x7F];
	int dir = (windex & USB_DIR_IN) ? 1 : 0;
	int idx = windex & 0x7F;
	if (windex >= 0x100)
		return NULL;
	if (idx > S3C_HSOTG_EPS)
		return NULL;
	if (idx && ep->dir_in != dir)
		return NULL;
	return ep;
}