/* Manipulate the waiting for selection list and return the scb that follows the one that we remove.  */
static u_int ahc_rem_wscb(struct ahc_softc *ahc, u_int scbpos, u_int prev)
/* Manipulate the waiting for selection list and return the scb that follows the one that we remove.  */
static u_int ahc_rem_wscb(struct ahc_softc *ahc, u_int scbpos, u_int prev)
{
	u_int curscb, next;
	curscb = ahc_inb(ahc, SCBPTR);
	ahc_outb(ahc, SCBPTR, scbpos);
	next = ahc_inb(ahc, SCB_NEXT);
	ahc_outb(ahc, SCB_CONTROL, 0);
	ahc_add_curscb_to_free_list(ahc);
	if (prev == SCB_LIST_NULL) {
		ahc_outb(ahc, WAITING_SCBH, next); 
		ahc_outb(ahc, SCSISEQ, (ahc_inb(ahc, SCSISEQ) & ~ENSELO));
	} else {
		ahc_outb(ahc, SCBPTR, prev);
		ahc_outb(ahc, SCB_NEXT, next);
	}
	ahc_outb(ahc, SCBPTR, curscb);
	return next;
}