/* wait_for_space - check ring buffer free space @space: amount of ringbuffer space needed in bytes  */
static int wait_for_space(struct fb_info *info, u32 space)
/* wait_for_space - check ring buffer free space @space: amount of ringbuffer space needed in bytes  */
static int wait_for_space(struct fb_info *info, u32 space)
{
	struct i810fb_par *par = info->par;
	u32 head, count = WAIT_COUNT, tail;
	u8 __iomem *mmio = par->mmio_start_virtual;
	tail = par->cur_tail;
	while (count--) {
		head = i810_readl(IRING + 4, mmio) & RBUFFER_HEAD_MASK;		if ((tail == head) || 
		    (tail > head && 
		     (par->iring.size - tail + head) >= space) || 
		    (tail < head && (head - tail) >= space)) {
			return 0;		}
	}
	printk("ringbuffer lockup!!!\n");
	i810_report_error(mmio); 
	par->dev_flags |= LOCKUP;
	info->pixmap.scan_align = 1;
	return 1;
}