/* For simplicity, this calculation assumes that all the transfers in the periodic schedule may occur in the same (micro)frame  */
static int dwc2_check_periodic_bandwidth(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh)
/* For simplicity, this calculation assumes that all the transfers in the periodic schedule may occur in the same (micro)frame  */
static int dwc2_check_periodic_bandwidth(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh)
{
	int status;
	s16 max_claimed_usecs;
	status = 0;
	if (qh->dev_speed == USB_SPEED_HIGH || qh->do_split) {
		max_claimed_usecs = 100 - qh->usecs;
	} else {
		max_claimed_usecs = 900 - qh->usecs;
	}
	if (hsotg->periodic_usecs > max_claimed_usecs) {
		dev_err(hsotg->dev,
			"%s: already claimed usecs %d, required usecs %d\n",
			__func__, hsotg->periodic_usecs, qh->usecs);
		status = -ENOSPC;
	}
	return status;
}