/* Write buffer management. All of these assume proper locks taken by the caller.  */
static int acm_wb_alloc(struct acm *acm)
/* Write buffer management. All of these assume proper locks taken by the caller.  */
static int acm_wb_alloc(struct acm *acm)
{
	int i, wbn;
	struct acm_wb *wb;
	wbn = 0;
	i = 0;
	for (;;) {
		wb = &acm->wb[wbn];
		if (!wb->use) {
			wb->use = 1;
			return wbn;
		}
		wbn = (wbn + 1) % ACM_NW;
		if (++i >= ACM_NW)
			return -1;
	}
}