/* Remove a instance of a timer. 
If there are no more instances it stops the hardware timer.  */
int32_t timer_remove(struct timer_desc *desc)
/* Remove a instance of a timer. 
If there are no more instances it stops the hardware timer.  */
int32_t timer_remove(struct timer_desc *desc)
{
	if (!desc)
		return FAILURE;
	free(desc->extra);
	free(desc);
	nb_instances--;
	if (nb_instances == 0) {
		while (ADI_TMR_DEVICE_BUSY == adi_tmr_Enable(timer_id, false));
		g_count = 0;
		nb_enables = 0;
	}
	return SUCCESS;
}