+ old_state = isci_request_change_started_to_newstate(
+ request,
+ &request_completion,
+ new_request_state);
+
+ spin_unlock_irqrestore(&isci_host->scic_lock, flags);
+
+ if ((old_state == started) ||
+ (old_state == completed) ||
+ (old_state == aborting)) {
+
+ dev_warn(&isci_host->pdev->dev,
+ "%s: isci_device=%p request=%p; task=%p "
+ "old_state=%d\n",
+ __func__,
+ isci_device, request,
+ ((request->ttype == io_task)
+ ? isci_request_access_task(request)
+ : NULL),
+ old_state);
+
+ /* If the old_state is started:
+ * This request was not already being aborted. If it had been,
+ * then the aborting I/O (ie. the TMF request) would not be in
+ * the aborting state, and thus would be terminated here. Note
+ * that since the TMF completion's call to the kernel function
+ * "complete()" does not happen until the pending I/O request
+ * terminate fully completes, we do not have to implement a
+ * special wait here for already aborting requests - the
+ * termination of the TMF request will force the request
+ * to finish it's already started terminate.
+ *
+ * If old_state == completed:
+ * This request completed from the SCU hardware perspective
+ * and now just needs cleaning up in terms of freeing the
+ * request and potentially calling up to libsas.
+ *
+ * If old_state == aborting:
+ * This request has already gone through a TMF timeout, but may
+ * not have been terminated; needs cleaning up at least.
+ */
+ isci_terminate_request_core(isci_host, isci_device,
+ request);
+ }
+ spin_lock_irqsave(&isci_host->scic_lock, flags);