From: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Date: Mon, 20 Jun 2011 21:09:22 +0000 (-0700)
Subject: isci: Explicitly decode remote node ready and suspended states
X-Git-Tag: firefly_0821_release~3680^2~5121^2~1^2~34
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=fd53660120b5eda06539225de56755dc389a4e64;p=firefly-linux-kernel-4.4.55.git

isci: Explicitly decode remote node ready and suspended states

The remote node context should only signal a device reset condition
in a suspended state.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---

diff --git a/drivers/scsi/isci/remote_node_context.c b/drivers/scsi/isci/remote_node_context.c
index 9e8967e19688..b6774bcdabd8 100644
--- a/drivers/scsi/isci/remote_node_context.c
+++ b/drivers/scsi/isci/remote_node_context.c
@@ -603,12 +603,23 @@ enum sci_status scic_sds_remote_node_context_start_io(struct scic_sds_remote_nod
 	enum scis_sds_remote_node_context_states state;
 
 	state = sci_rnc->sm.current_state_id;
-	if (state != SCI_RNC_READY) {
+
+	switch (state) {
+	case SCI_RNC_READY:
+		return SCI_SUCCESS;
+	case SCI_RNC_TX_SUSPENDED:
+	case SCI_RNC_TX_RX_SUSPENDED:
+	case SCI_RNC_AWAIT_SUSPENSION:
 		dev_warn(scirdev_to_dev(rnc_to_dev(sci_rnc)),
 			 "%s: invalid state %d\n", __func__, state);
 		return SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED;
+	default:
+		break;
 	}
-	return SCI_SUCCESS;
+	dev_dbg(scirdev_to_dev(rnc_to_dev(sci_rnc)),
+		"%s: requested to start IO while still resuming, %d\n",
+		__func__, state);
+	return SCI_FAILURE_INVALID_STATE;
 }
 
 enum sci_status scic_sds_remote_node_context_start_task(struct scic_sds_remote_node_context *sci_rnc,