Skip to content

Commit

Permalink
isci: improve 'invalid state' warnings
Browse files Browse the repository at this point in the history
Convert controller state machine warnings to emit the state number (it
missed the number to string conversion, but since these error rarely
happen not much motivation to go further).

Fix up the rnc warnings to use the state name.

Signed-off-by: Dan Williams <[email protected]>
  • Loading branch information
djbw committed May 17, 2012
1 parent 36be505 commit 14e99b4
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 30 deletions.
33 changes: 16 additions & 17 deletions drivers/scsi/isci/host.c
Original file line number Diff line number Diff line change
Expand Up @@ -987,9 +987,8 @@ static enum sci_status sci_controller_start(struct isci_host *ihost,
u16 index;

if (ihost->sm.current_state_id != SCIC_INITIALIZED) {
dev_warn(&ihost->pdev->dev,
"SCIC Controller start operation requested in "
"invalid state\n");
dev_warn(&ihost->pdev->dev, "%s invalid state: %d\n",
__func__, ihost->sm.current_state_id);
return SCI_FAILURE_INVALID_STATE;
}

Expand Down Expand Up @@ -1213,9 +1212,8 @@ static void isci_host_completion_routine(unsigned long data)
static enum sci_status sci_controller_stop(struct isci_host *ihost, u32 timeout)
{
if (ihost->sm.current_state_id != SCIC_READY) {
dev_warn(&ihost->pdev->dev,
"SCIC Controller stop operation requested in "
"invalid state\n");
dev_warn(&ihost->pdev->dev, "%s invalid state: %d\n",
__func__, ihost->sm.current_state_id);
return SCI_FAILURE_INVALID_STATE;
}

Expand Down Expand Up @@ -1250,9 +1248,8 @@ static enum sci_status sci_controller_reset(struct isci_host *ihost)
sci_change_state(&ihost->sm, SCIC_RESETTING);
return SCI_SUCCESS;
default:
dev_warn(&ihost->pdev->dev,
"SCIC Controller reset operation requested in "
"invalid state\n");
dev_warn(&ihost->pdev->dev, "%s invalid state: %d\n",
__func__, ihost->sm.current_state_id);
return SCI_FAILURE_INVALID_STATE;
}
}
Expand Down Expand Up @@ -2279,9 +2276,8 @@ static enum sci_status sci_controller_initialize(struct isci_host *ihost)
unsigned long i, state, val;

if (ihost->sm.current_state_id != SCIC_RESET) {
dev_warn(&ihost->pdev->dev,
"SCIC Controller initialize operation requested "
"in invalid state\n");
dev_warn(&ihost->pdev->dev, "%s invalid state: %d\n",
__func__, ihost->sm.current_state_id);
return SCI_FAILURE_INVALID_STATE;
}

Expand Down Expand Up @@ -2842,7 +2838,8 @@ enum sci_status sci_controller_start_io(struct isci_host *ihost,
enum sci_status status;

if (ihost->sm.current_state_id != SCIC_READY) {
dev_warn(&ihost->pdev->dev, "invalid state to start I/O");
dev_warn(&ihost->pdev->dev, "%s invalid state: %d\n",
__func__, ihost->sm.current_state_id);
return SCI_FAILURE_INVALID_STATE;
}

Expand All @@ -2866,8 +2863,8 @@ enum sci_status sci_controller_terminate_request(struct isci_host *ihost,
enum sci_status status;

if (ihost->sm.current_state_id != SCIC_READY) {
dev_warn(&ihost->pdev->dev,
"invalid state to terminate request\n");
dev_warn(&ihost->pdev->dev, "%s invalid state: %d\n",
__func__, ihost->sm.current_state_id);
return SCI_FAILURE_INVALID_STATE;
}

Expand Down Expand Up @@ -2915,7 +2912,8 @@ enum sci_status sci_controller_complete_io(struct isci_host *ihost,
clear_bit(IREQ_ACTIVE, &ireq->flags);
return SCI_SUCCESS;
default:
dev_warn(&ihost->pdev->dev, "invalid state to complete I/O");
dev_warn(&ihost->pdev->dev, "%s invalid state: %d\n",
__func__, ihost->sm.current_state_id);
return SCI_FAILURE_INVALID_STATE;
}

Expand All @@ -2926,7 +2924,8 @@ enum sci_status sci_controller_continue_io(struct isci_request *ireq)
struct isci_host *ihost = ireq->owning_controller;

if (ihost->sm.current_state_id != SCIC_READY) {
dev_warn(&ihost->pdev->dev, "invalid state to continue I/O");
dev_warn(&ihost->pdev->dev, "%s invalid state: %d\n",
__func__, ihost->sm.current_state_id);
return SCI_FAILURE_INVALID_STATE;
}

Expand Down
33 changes: 20 additions & 13 deletions drivers/scsi/isci/remote_node_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -443,14 +443,16 @@ enum sci_status sci_remote_node_context_event_handler(struct sci_remote_node_con
break;
default:
dev_warn(scirdev_to_dev(rnc_to_dev(sci_rnc)),
"%s: invalid state %d\n", __func__, state);
"%s: invalid state: %s\n", __func__,
rnc_state_name(state));
return SCI_FAILURE_INVALID_STATE;
}
return SCI_SUCCESS;

out:
dev_warn(scirdev_to_dev(rnc_to_dev(sci_rnc)),
"%s: code: %#x state: %d\n", __func__, event_code, state);
"%s: code: %#x state: %s\n", __func__, event_code,
rnc_state_name(state));
return SCI_FAILURE;

}
Expand All @@ -477,15 +479,17 @@ enum sci_status sci_remote_node_context_destruct(struct sci_remote_node_context
return SCI_SUCCESS;
case SCI_RNC_INITIAL:
dev_warn(scirdev_to_dev(rnc_to_dev(sci_rnc)),
"%s: invalid state %d\n", __func__, state);
"%s: invalid state: %s\n", __func__,
rnc_state_name(state));
/* We have decided that the destruct request on the remote node context
* can not fail since it is either in the initial/destroyed state or is
* can be destroyed.
*/
return SCI_SUCCESS;
default:
dev_warn(scirdev_to_dev(rnc_to_dev(sci_rnc)),
"%s: invalid state %d\n", __func__, state);
"%s: invalid state %s\n", __func__,
rnc_state_name(state));
return SCI_FAILURE_INVALID_STATE;
}
}
Expand All @@ -500,7 +504,8 @@ enum sci_status sci_remote_node_context_suspend(struct sci_remote_node_context *
state = sci_rnc->sm.current_state_id;
if (state != SCI_RNC_READY) {
dev_warn(scirdev_to_dev(rnc_to_dev(sci_rnc)),
"%s: invalid state %d\n", __func__, state);
"%s: invalid state %s\n", __func__,
rnc_state_name(state));
return SCI_FAILURE_INVALID_STATE;
}

Expand Down Expand Up @@ -571,7 +576,8 @@ enum sci_status sci_remote_node_context_resume(struct sci_remote_node_context *s
return SCI_SUCCESS;
default:
dev_warn(scirdev_to_dev(rnc_to_dev(sci_rnc)),
"%s: invalid state %d\n", __func__, state);
"%s: invalid state %s\n", __func__,
rnc_state_name(state));
return SCI_FAILURE_INVALID_STATE;
}
}
Expand All @@ -590,15 +596,15 @@ enum sci_status sci_remote_node_context_start_io(struct sci_remote_node_context
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);
"%s: invalid state %s\n", __func__,
rnc_state_name(state));
return SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED;
default:
break;
dev_dbg(scirdev_to_dev(rnc_to_dev(sci_rnc)),
"%s: invalid state %s\n", __func__,
rnc_state_name(state));
return SCI_FAILURE_INVALID_STATE;
}
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 sci_remote_node_context_start_task(struct sci_remote_node_context *sci_rnc,
Expand All @@ -618,7 +624,8 @@ enum sci_status sci_remote_node_context_start_task(struct sci_remote_node_contex
return SCI_SUCCESS;
default:
dev_warn(scirdev_to_dev(rnc_to_dev(sci_rnc)),
"%s: invalid state %d\n", __func__, state);
"%s: invalid state %s\n", __func__,
rnc_state_name(state));
return SCI_FAILURE_INVALID_STATE;
}
}

0 comments on commit 14e99b4

Please sign in to comment.