/* Drain the FIFO and device of any stuck data following a command failing to complete. In some cases this is neccessary before a reset will recover the device.  */
void pcmcia_8bit_drain_fifo(struct ata_queued_cmd *qc)
/* Drain the FIFO and device of any stuck data following a command failing to complete. In some cases this is neccessary before a reset will recover the device.  */
void pcmcia_8bit_drain_fifo(struct ata_queued_cmd *qc)
{
	int count;
	struct ata_port *ap;
	if (qc == NULL || qc->dma_dir == DMA_TO_DEVICE)
		return;
	ap = qc->ap;
	for (count = 0; (ap->ops->sff_check_status(ap) & ATA_DRQ)
							&& count++ < 65536;)
		ioread8(ap->ioaddr.data_addr);
	if (count)
		ata_port_printk(ap, KERN_WARNING, "drained %d bytes to clear DRQ.\n",
								count);
}