* This is purely hueristic.  This is a fast path. * Sometimes when we enter, BSY will be cleared in * a chk-status or two.  If not, the drive is probably seeking * or something.  Snooze for a couple msecs, then * chk-status again.  If still busy, fall back to 
* This is purely heuristic.  This is a fast path.  Sometimes when * we enter, BSY will be cleared in a chk-status or two.  If not, * the drive is probably seeking or something.  Snooze for a couple * msecs, then chk-status again.  If still busy, fall back to 
static void ata_pio_complete (struct ata_port *ap){	struct ata_queued_cmd *qc;	u8 drv_stat;	/*	 * This is purely hueristic.  This is a fast path.	 * Sometimes when we enter, BSY will be cleared in	 * a chk-status or two.  If not, the drive is probably seeking	 * or something.  Snooze for a couple msecs, then	 * chk-status again.  If still busy, fall back to	 * PIO_ST_POLL state.	 */	drv_stat = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 10);	if (drv_stat & (ATA_BUSY | ATA_DRQ)) {		msleep(2);		drv_stat = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 10);		if (drv_stat & (ATA_BUSY | ATA_DRQ)) {			ap->pio_task_state = PIO_ST_LAST_POLL;			ap->pio_task_timeout = jiffies + ATA_TMOUT_PIO;			return;		}	}	drv_stat = ata_wait_idle(ap);	if (!ata_ok(drv_stat)) {		ap->pio_task_state = PIO_ST_ERR;		return;	}	qc = ata_qc_from_tag(ap, ap->active_tag);	assert(qc != NULL);	ap->pio_task_state = PIO_ST_IDLE;	ata_poll_qc_complete(qc, drv_stat);}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/31433ea369d250ad011577eee6110d3efcb9d861/libata-core.c/buggy/drivers/scsi/libata-core.c