/* Returns the number of bytes that can safely be written in the FIFO. A return value of zero means that the calling function should terminate as fast as possible.  */
static unsigned int parport_ip32_fwp_wait_polling(struct parport *p)
/* Returns the number of bytes that can safely be written in the FIFO. A return value of zero means that the calling function should terminate as fast as possible.  */
static unsigned int parport_ip32_fwp_wait_polling(struct parport *p)
{
	struct parport_ip32_private * const priv = p->physport->private_data;
	struct parport * const physport = p->physport;
	unsigned long expire;
	unsigned int count;
	unsigned int ecr;
	expire = jiffies + physport->cad->timeout;
	count = 0;
	while (1) {
		if (parport_ip32_fifo_wait_break(p, expire))
			break;
		ecr = parport_ip32_read_econtrol(p);
		if (ecr & ECR_F_EMPTY) {
			count = priv->fifo_depth;
			break;
		}
		udelay(FIFO_POLLING_INTERVAL);
	}
	return count;
}