/* floppy-change is never called from an interrupt, so we can relax a bit here, sleep etc. Note that floppy-on tries to set current_DOR to point to the desired drive, but it will probably not survive the sleep if several floppies are used at the same time: thus the loop.  */
static int amiga_floppy_change(struct gendisk *disk)
/* floppy-change is never called from an interrupt, so we can relax a bit here, sleep etc. Note that floppy-on tries to set current_DOR to point to the desired drive, but it will probably not survive the sleep if several floppies are used at the same time: thus the loop.  */
static int amiga_floppy_change(struct gendisk *disk)
{
	struct amiga_floppy_struct *p = disk->private_data;
	int drive = p - unit;
	int changed;
	static int first_time = 1;
	if (first_time)
		changed = first_time--;
	else {
		get_fdc(drive);
		fd_select (drive);
		changed = !(ciaa.pra & DSKCHANGE);
		fd_deselect (drive);
		rel_fdc();
	}
	if (changed) {
		fd_probe(drive);
		p->track = -1;
		p->dirty = 0;
		writepending = 0;
		writefromint = 0;
		return 1;
	}
	return 0;
}