/* In principle, this could be tied to an interrupt, but the adapter doesn't appear to be designed to support interrupts. We spin on the 0x80 ready bit.  */
static unsigned char imm_wait(imm_struct *dev)
/* In principle, this could be tied to an interrupt, but the adapter doesn't appear to be designed to support interrupts. We spin on the 0x80 ready bit.  */
static unsigned char imm_wait(imm_struct *dev)
{
	int k;
	unsigned short ppb = dev->base;
	unsigned char r;
	w_ctr(ppb, 0x0c);
	k = IMM_SPIN_TMO;
	do {
		r = r_str(ppb);
		k--;
		udelay(1);
	}
	while (!(r & 0x80) && (k));
	w_ctr(ppb, 0x04);
	if (k)
		return (r & 0xb8);
	imm_fail(dev, DID_TIME_OUT);
	printk("imm timeout in imm_wait\n");
	return 0;
}