/* This routine is called just prior to a HARD RESET to return all outstanding commands back to the Operating System. Caller should make sure that the following locks are released before this calling routine: Hardware lock, and io_request_lock.  */
static void qla4xxx_flush_active_srbs(struct scsi_qla_host *ha)
/* This routine is called just prior to a HARD RESET to return all outstanding commands back to the Operating System. Caller should make sure that the following locks are released before this calling routine: Hardware lock, and io_request_lock.  */
static void qla4xxx_flush_active_srbs(struct scsi_qla_host *ha)
{
	struct srb *srb;
	int i;
	unsigned long flags;
	spin_lock_irqsave(&ha->hardware_lock, flags);
	for (i = 0; i < ha->host->can_queue; i++) {
		srb = qla4xxx_del_from_active_array(ha, i);
		if (srb != NULL) {
			srb->cmd->result = DID_RESET << 16;
			qla4xxx_srb_compl(ha, srb);
		}
	}
	spin_unlock_irqrestore(&ha->hardware_lock, flags);
}