aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2012-02-10 04:05:43 -0500
committerDan Williams <dan.j.williams@intel.com>2012-05-17 15:27:11 -0400
commit14e99b4a3f5323bb961754de5024daff79e59b98 (patch)
tree379c3f28a33865d135969981862eed44e2aba243
parent36be50515fe2aef61533b516fa2576a2c7fe7664 (diff)
isci: improve 'invalid state' warnings
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 <dan.j.williams@intel.com>
-rw-r--r--drivers/scsi/isci/host.c33
-rw-r--r--drivers/scsi/isci/remote_node_context.c33
2 files changed, 36 insertions, 30 deletions
diff --git a/drivers/scsi/isci/host.c b/drivers/scsi/isci/host.c
index d4bf9c12ecd4..3822ffb71caf 100644
--- a/drivers/scsi/isci/host.c
+++ b/drivers/scsi/isci/host.c
@@ -987,9 +987,8 @@ static enum sci_status sci_controller_start(struct isci_host *ihost,
987 u16 index; 987 u16 index;
988 988
989 if (ihost->sm.current_state_id != SCIC_INITIALIZED) { 989 if (ihost->sm.current_state_id != SCIC_INITIALIZED) {
990 dev_warn(&ihost->pdev->dev, 990 dev_warn(&ihost->pdev->dev, "%s invalid state: %d\n",
991 "SCIC Controller start operation requested in " 991 __func__, ihost->sm.current_state_id);
992 "invalid state\n");
993 return SCI_FAILURE_INVALID_STATE; 992 return SCI_FAILURE_INVALID_STATE;
994 } 993 }
995 994
@@ -1213,9 +1212,8 @@ static void isci_host_completion_routine(unsigned long data)
1213static enum sci_status sci_controller_stop(struct isci_host *ihost, u32 timeout) 1212static enum sci_status sci_controller_stop(struct isci_host *ihost, u32 timeout)
1214{ 1213{
1215 if (ihost->sm.current_state_id != SCIC_READY) { 1214 if (ihost->sm.current_state_id != SCIC_READY) {
1216 dev_warn(&ihost->pdev->dev, 1215 dev_warn(&ihost->pdev->dev, "%s invalid state: %d\n",
1217 "SCIC Controller stop operation requested in " 1216 __func__, ihost->sm.current_state_id);
1218 "invalid state\n");
1219 return SCI_FAILURE_INVALID_STATE; 1217 return SCI_FAILURE_INVALID_STATE;
1220 } 1218 }
1221 1219
@@ -1250,9 +1248,8 @@ static enum sci_status sci_controller_reset(struct isci_host *ihost)
1250 sci_change_state(&ihost->sm, SCIC_RESETTING); 1248 sci_change_state(&ihost->sm, SCIC_RESETTING);
1251 return SCI_SUCCESS; 1249 return SCI_SUCCESS;
1252 default: 1250 default:
1253 dev_warn(&ihost->pdev->dev, 1251 dev_warn(&ihost->pdev->dev, "%s invalid state: %d\n",
1254 "SCIC Controller reset operation requested in " 1252 __func__, ihost->sm.current_state_id);
1255 "invalid state\n");
1256 return SCI_FAILURE_INVALID_STATE; 1253 return SCI_FAILURE_INVALID_STATE;
1257 } 1254 }
1258} 1255}
@@ -2279,9 +2276,8 @@ static enum sci_status sci_controller_initialize(struct isci_host *ihost)
2279 unsigned long i, state, val; 2276 unsigned long i, state, val;
2280 2277
2281 if (ihost->sm.current_state_id != SCIC_RESET) { 2278 if (ihost->sm.current_state_id != SCIC_RESET) {
2282 dev_warn(&ihost->pdev->dev, 2279 dev_warn(&ihost->pdev->dev, "%s invalid state: %d\n",
2283 "SCIC Controller initialize operation requested " 2280 __func__, ihost->sm.current_state_id);
2284 "in invalid state\n");
2285 return SCI_FAILURE_INVALID_STATE; 2281 return SCI_FAILURE_INVALID_STATE;
2286 } 2282 }
2287 2283
@@ -2842,7 +2838,8 @@ enum sci_status sci_controller_start_io(struct isci_host *ihost,
2842 enum sci_status status; 2838 enum sci_status status;
2843 2839
2844 if (ihost->sm.current_state_id != SCIC_READY) { 2840 if (ihost->sm.current_state_id != SCIC_READY) {
2845 dev_warn(&ihost->pdev->dev, "invalid state to start I/O"); 2841 dev_warn(&ihost->pdev->dev, "%s invalid state: %d\n",
2842 __func__, ihost->sm.current_state_id);
2846 return SCI_FAILURE_INVALID_STATE; 2843 return SCI_FAILURE_INVALID_STATE;
2847 } 2844 }
2848 2845
@@ -2866,8 +2863,8 @@ enum sci_status sci_controller_terminate_request(struct isci_host *ihost,
2866 enum sci_status status; 2863 enum sci_status status;
2867 2864
2868 if (ihost->sm.current_state_id != SCIC_READY) { 2865 if (ihost->sm.current_state_id != SCIC_READY) {
2869 dev_warn(&ihost->pdev->dev, 2866 dev_warn(&ihost->pdev->dev, "%s invalid state: %d\n",
2870 "invalid state to terminate request\n"); 2867 __func__, ihost->sm.current_state_id);
2871 return SCI_FAILURE_INVALID_STATE; 2868 return SCI_FAILURE_INVALID_STATE;
2872 } 2869 }
2873 2870
@@ -2915,7 +2912,8 @@ enum sci_status sci_controller_complete_io(struct isci_host *ihost,
2915 clear_bit(IREQ_ACTIVE, &ireq->flags); 2912 clear_bit(IREQ_ACTIVE, &ireq->flags);
2916 return SCI_SUCCESS; 2913 return SCI_SUCCESS;
2917 default: 2914 default:
2918 dev_warn(&ihost->pdev->dev, "invalid state to complete I/O"); 2915 dev_warn(&ihost->pdev->dev, "%s invalid state: %d\n",
2916 __func__, ihost->sm.current_state_id);
2919 return SCI_FAILURE_INVALID_STATE; 2917 return SCI_FAILURE_INVALID_STATE;
2920 } 2918 }
2921 2919
@@ -2926,7 +2924,8 @@ enum sci_status sci_controller_continue_io(struct isci_request *ireq)
2926 struct isci_host *ihost = ireq->owning_controller; 2924 struct isci_host *ihost = ireq->owning_controller;
2927 2925
2928 if (ihost->sm.current_state_id != SCIC_READY) { 2926 if (ihost->sm.current_state_id != SCIC_READY) {
2929 dev_warn(&ihost->pdev->dev, "invalid state to continue I/O"); 2927 dev_warn(&ihost->pdev->dev, "%s invalid state: %d\n",
2928 __func__, ihost->sm.current_state_id);
2930 return SCI_FAILURE_INVALID_STATE; 2929 return SCI_FAILURE_INVALID_STATE;
2931 } 2930 }
2932 2931
diff --git a/drivers/scsi/isci/remote_node_context.c b/drivers/scsi/isci/remote_node_context.c
index 3a9463481f38..994ec0c25a74 100644
--- a/drivers/scsi/isci/remote_node_context.c
+++ b/drivers/scsi/isci/remote_node_context.c
@@ -443,14 +443,16 @@ enum sci_status sci_remote_node_context_event_handler(struct sci_remote_node_con
443 break; 443 break;
444 default: 444 default:
445 dev_warn(scirdev_to_dev(rnc_to_dev(sci_rnc)), 445 dev_warn(scirdev_to_dev(rnc_to_dev(sci_rnc)),
446 "%s: invalid state %d\n", __func__, state); 446 "%s: invalid state: %s\n", __func__,
447 rnc_state_name(state));
447 return SCI_FAILURE_INVALID_STATE; 448 return SCI_FAILURE_INVALID_STATE;
448 } 449 }
449 return SCI_SUCCESS; 450 return SCI_SUCCESS;
450 451
451 out: 452 out:
452 dev_warn(scirdev_to_dev(rnc_to_dev(sci_rnc)), 453 dev_warn(scirdev_to_dev(rnc_to_dev(sci_rnc)),
453 "%s: code: %#x state: %d\n", __func__, event_code, state); 454 "%s: code: %#x state: %s\n", __func__, event_code,
455 rnc_state_name(state));
454 return SCI_FAILURE; 456 return SCI_FAILURE;
455 457
456} 458}
@@ -477,7 +479,8 @@ enum sci_status sci_remote_node_context_destruct(struct sci_remote_node_context
477 return SCI_SUCCESS; 479 return SCI_SUCCESS;
478 case SCI_RNC_INITIAL: 480 case SCI_RNC_INITIAL:
479 dev_warn(scirdev_to_dev(rnc_to_dev(sci_rnc)), 481 dev_warn(scirdev_to_dev(rnc_to_dev(sci_rnc)),
480 "%s: invalid state %d\n", __func__, state); 482 "%s: invalid state: %s\n", __func__,
483 rnc_state_name(state));
481 /* We have decided that the destruct request on the remote node context 484 /* We have decided that the destruct request on the remote node context
482 * can not fail since it is either in the initial/destroyed state or is 485 * can not fail since it is either in the initial/destroyed state or is
483 * can be destroyed. 486 * can be destroyed.
@@ -485,7 +488,8 @@ enum sci_status sci_remote_node_context_destruct(struct sci_remote_node_context
485 return SCI_SUCCESS; 488 return SCI_SUCCESS;
486 default: 489 default:
487 dev_warn(scirdev_to_dev(rnc_to_dev(sci_rnc)), 490 dev_warn(scirdev_to_dev(rnc_to_dev(sci_rnc)),
488 "%s: invalid state %d\n", __func__, state); 491 "%s: invalid state %s\n", __func__,
492 rnc_state_name(state));
489 return SCI_FAILURE_INVALID_STATE; 493 return SCI_FAILURE_INVALID_STATE;
490 } 494 }
491} 495}
@@ -500,7 +504,8 @@ enum sci_status sci_remote_node_context_suspend(struct sci_remote_node_context *
500 state = sci_rnc->sm.current_state_id; 504 state = sci_rnc->sm.current_state_id;
501 if (state != SCI_RNC_READY) { 505 if (state != SCI_RNC_READY) {
502 dev_warn(scirdev_to_dev(rnc_to_dev(sci_rnc)), 506 dev_warn(scirdev_to_dev(rnc_to_dev(sci_rnc)),
503 "%s: invalid state %d\n", __func__, state); 507 "%s: invalid state %s\n", __func__,
508 rnc_state_name(state));
504 return SCI_FAILURE_INVALID_STATE; 509 return SCI_FAILURE_INVALID_STATE;
505 } 510 }
506 511
@@ -571,7 +576,8 @@ enum sci_status sci_remote_node_context_resume(struct sci_remote_node_context *s
571 return SCI_SUCCESS; 576 return SCI_SUCCESS;
572 default: 577 default:
573 dev_warn(scirdev_to_dev(rnc_to_dev(sci_rnc)), 578 dev_warn(scirdev_to_dev(rnc_to_dev(sci_rnc)),
574 "%s: invalid state %d\n", __func__, state); 579 "%s: invalid state %s\n", __func__,
580 rnc_state_name(state));
575 return SCI_FAILURE_INVALID_STATE; 581 return SCI_FAILURE_INVALID_STATE;
576 } 582 }
577} 583}
@@ -590,15 +596,15 @@ enum sci_status sci_remote_node_context_start_io(struct sci_remote_node_context
590 case SCI_RNC_TX_RX_SUSPENDED: 596 case SCI_RNC_TX_RX_SUSPENDED:
591 case SCI_RNC_AWAIT_SUSPENSION: 597 case SCI_RNC_AWAIT_SUSPENSION:
592 dev_warn(scirdev_to_dev(rnc_to_dev(sci_rnc)), 598 dev_warn(scirdev_to_dev(rnc_to_dev(sci_rnc)),
593 "%s: invalid state %d\n", __func__, state); 599 "%s: invalid state %s\n", __func__,
600 rnc_state_name(state));
594 return SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED; 601 return SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED;
595 default: 602 default:
596 break; 603 dev_dbg(scirdev_to_dev(rnc_to_dev(sci_rnc)),
604 "%s: invalid state %s\n", __func__,
605 rnc_state_name(state));
606 return SCI_FAILURE_INVALID_STATE;
597 } 607 }
598 dev_dbg(scirdev_to_dev(rnc_to_dev(sci_rnc)),
599 "%s: requested to start IO while still resuming, %d\n",
600 __func__, state);
601 return SCI_FAILURE_INVALID_STATE;
602} 608}
603 609
604enum sci_status sci_remote_node_context_start_task(struct sci_remote_node_context *sci_rnc, 610enum sci_status sci_remote_node_context_start_task(struct sci_remote_node_context *sci_rnc,
@@ -618,7 +624,8 @@ enum sci_status sci_remote_node_context_start_task(struct sci_remote_node_contex
618 return SCI_SUCCESS; 624 return SCI_SUCCESS;
619 default: 625 default:
620 dev_warn(scirdev_to_dev(rnc_to_dev(sci_rnc)), 626 dev_warn(scirdev_to_dev(rnc_to_dev(sci_rnc)),
621 "%s: invalid state %d\n", __func__, state); 627 "%s: invalid state %s\n", __func__,
628 rnc_state_name(state));
622 return SCI_FAILURE_INVALID_STATE; 629 return SCI_FAILURE_INVALID_STATE;
623 } 630 }
624} 631}