/* Finds the sbp2_command for a given outstanding command ORB. Only looks at the in-use list.  */
static struct sbp2_command_info* sbp2util_find_command_for_orb(struct sbp2_lu *lu, dma_addr_t orb)
/* Finds the sbp2_command for a given outstanding command ORB. Only looks at the in-use list.  */
static struct sbp2_command_info* sbp2util_find_command_for_orb(struct sbp2_lu *lu, dma_addr_t orb)
{
	struct sbp2_command_info *cmd;
	unsigned long flags;
	spin_lock_irqsave(&lu->cmd_orb_lock, flags);
	if (!list_empty(&lu->cmd_orb_inuse))
		list_for_each_entry(cmd, &lu->cmd_orb_inuse, list)
			if (cmd->command_orb_dma == orb) {
				spin_unlock_irqrestore(
						&lu->cmd_orb_lock, flags);
				return cmd;
			}
	spin_unlock_irqrestore(&lu->cmd_orb_lock, flags);
	return NULL;
}