/* Return: 0 if successful, negative error code otherwise  */
static int dwc2_periodic_channel_available(struct dwc2_hsotg *hsotg)
/* Return: 0 if successful, negative error code otherwise  */
static int dwc2_periodic_channel_available(struct dwc2_hsotg *hsotg)
{
	int status;
	int num_channels;
	num_channels = hsotg->core_params->host_channels;
	if (hsotg->periodic_channels + hsotg->non_periodic_channels <
								num_channels
	    && hsotg->periodic_channels < num_channels - 1) {
		status = 0;
	} else {
		dev_dbg(hsotg->dev,
			"%s: Total channels: %d, Periodic: %d, "
			"Non-periodic: %d\n", __func__, num_channels,
			hsotg->periodic_channels, hsotg->non_periodic_channels);
		status = -ENOSPC;
	}
	return status;
}