diff options
Diffstat (limited to 'drivers/scsi/isci/remote_device.c')
-rw-r--r-- | drivers/scsi/isci/remote_device.c | 50 |
1 files changed, 30 insertions, 20 deletions
diff --git a/drivers/scsi/isci/remote_device.c b/drivers/scsi/isci/remote_device.c index 934d21ea14e7..8f501b0a81d6 100644 --- a/drivers/scsi/isci/remote_device.c +++ b/drivers/scsi/isci/remote_device.c | |||
@@ -62,6 +62,16 @@ | |||
62 | #include "scu_event_codes.h" | 62 | #include "scu_event_codes.h" |
63 | #include "task.h" | 63 | #include "task.h" |
64 | 64 | ||
65 | #undef C | ||
66 | #define C(a) (#a) | ||
67 | const char *dev_state_name(enum sci_remote_device_states state) | ||
68 | { | ||
69 | static const char * const strings[] = REMOTE_DEV_STATES; | ||
70 | |||
71 | return strings[state]; | ||
72 | } | ||
73 | #undef C | ||
74 | |||
65 | /** | 75 | /** |
66 | * isci_remote_device_not_ready() - This function is called by the ihost when | 76 | * isci_remote_device_not_ready() - This function is called by the ihost when |
67 | * the remote device is not ready. We mark the isci device as ready (not | 77 | * the remote device is not ready. We mark the isci device as ready (not |
@@ -167,8 +177,8 @@ enum sci_status sci_remote_device_stop(struct isci_remote_device *idev, | |||
167 | case SCI_DEV_FAILED: | 177 | case SCI_DEV_FAILED: |
168 | case SCI_DEV_FINAL: | 178 | case SCI_DEV_FINAL: |
169 | default: | 179 | default: |
170 | dev_warn(scirdev_to_dev(idev), "%s: in wrong state: %d\n", | 180 | dev_warn(scirdev_to_dev(idev), "%s: in wrong state: %s\n", |
171 | __func__, state); | 181 | __func__, dev_state_name(state)); |
172 | return SCI_FAILURE_INVALID_STATE; | 182 | return SCI_FAILURE_INVALID_STATE; |
173 | case SCI_DEV_STOPPED: | 183 | case SCI_DEV_STOPPED: |
174 | return SCI_SUCCESS; | 184 | return SCI_SUCCESS; |
@@ -226,8 +236,8 @@ enum sci_status sci_remote_device_reset(struct isci_remote_device *idev) | |||
226 | case SCI_DEV_RESETTING: | 236 | case SCI_DEV_RESETTING: |
227 | case SCI_DEV_FINAL: | 237 | case SCI_DEV_FINAL: |
228 | default: | 238 | default: |
229 | dev_warn(scirdev_to_dev(idev), "%s: in wrong state: %d\n", | 239 | dev_warn(scirdev_to_dev(idev), "%s: in wrong state: %s\n", |
230 | __func__, state); | 240 | __func__, dev_state_name(state)); |
231 | return SCI_FAILURE_INVALID_STATE; | 241 | return SCI_FAILURE_INVALID_STATE; |
232 | case SCI_DEV_READY: | 242 | case SCI_DEV_READY: |
233 | case SCI_STP_DEV_IDLE: | 243 | case SCI_STP_DEV_IDLE: |
@@ -246,8 +256,8 @@ enum sci_status sci_remote_device_reset_complete(struct isci_remote_device *idev | |||
246 | enum sci_remote_device_states state = sm->current_state_id; | 256 | enum sci_remote_device_states state = sm->current_state_id; |
247 | 257 | ||
248 | if (state != SCI_DEV_RESETTING) { | 258 | if (state != SCI_DEV_RESETTING) { |
249 | dev_warn(scirdev_to_dev(idev), "%s: in wrong state: %d\n", | 259 | dev_warn(scirdev_to_dev(idev), "%s: in wrong state: %s\n", |
250 | __func__, state); | 260 | __func__, dev_state_name(state)); |
251 | return SCI_FAILURE_INVALID_STATE; | 261 | return SCI_FAILURE_INVALID_STATE; |
252 | } | 262 | } |
253 | 263 | ||
@@ -262,8 +272,8 @@ enum sci_status sci_remote_device_suspend(struct isci_remote_device *idev, | |||
262 | enum sci_remote_device_states state = sm->current_state_id; | 272 | enum sci_remote_device_states state = sm->current_state_id; |
263 | 273 | ||
264 | if (state != SCI_STP_DEV_CMD) { | 274 | if (state != SCI_STP_DEV_CMD) { |
265 | dev_warn(scirdev_to_dev(idev), "%s: in wrong state: %d\n", | 275 | dev_warn(scirdev_to_dev(idev), "%s: in wrong state: %s\n", |
266 | __func__, state); | 276 | __func__, dev_state_name(state)); |
267 | return SCI_FAILURE_INVALID_STATE; | 277 | return SCI_FAILURE_INVALID_STATE; |
268 | } | 278 | } |
269 | 279 | ||
@@ -287,8 +297,8 @@ enum sci_status sci_remote_device_frame_handler(struct isci_remote_device *idev, | |||
287 | case SCI_SMP_DEV_IDLE: | 297 | case SCI_SMP_DEV_IDLE: |
288 | case SCI_DEV_FINAL: | 298 | case SCI_DEV_FINAL: |
289 | default: | 299 | default: |
290 | dev_warn(scirdev_to_dev(idev), "%s: in wrong state: %d\n", | 300 | dev_warn(scirdev_to_dev(idev), "%s: in wrong state: %s\n", |
291 | __func__, state); | 301 | __func__, dev_state_name(state)); |
292 | /* Return the frame back to the controller */ | 302 | /* Return the frame back to the controller */ |
293 | sci_controller_release_frame(ihost, frame_index); | 303 | sci_controller_release_frame(ihost, frame_index); |
294 | return SCI_FAILURE_INVALID_STATE; | 304 | return SCI_FAILURE_INVALID_STATE; |
@@ -502,8 +512,8 @@ enum sci_status sci_remote_device_start_io(struct isci_host *ihost, | |||
502 | case SCI_DEV_RESETTING: | 512 | case SCI_DEV_RESETTING: |
503 | case SCI_DEV_FINAL: | 513 | case SCI_DEV_FINAL: |
504 | default: | 514 | default: |
505 | dev_warn(scirdev_to_dev(idev), "%s: in wrong state: %d\n", | 515 | dev_warn(scirdev_to_dev(idev), "%s: in wrong state: %s\n", |
506 | __func__, state); | 516 | __func__, dev_state_name(state)); |
507 | return SCI_FAILURE_INVALID_STATE; | 517 | return SCI_FAILURE_INVALID_STATE; |
508 | case SCI_DEV_READY: | 518 | case SCI_DEV_READY: |
509 | /* attempt to start an io request for this device object. The remote | 519 | /* attempt to start an io request for this device object. The remote |
@@ -637,8 +647,8 @@ enum sci_status sci_remote_device_complete_io(struct isci_host *ihost, | |||
637 | case SCI_DEV_FAILED: | 647 | case SCI_DEV_FAILED: |
638 | case SCI_DEV_FINAL: | 648 | case SCI_DEV_FINAL: |
639 | default: | 649 | default: |
640 | dev_warn(scirdev_to_dev(idev), "%s: in wrong state: %d\n", | 650 | dev_warn(scirdev_to_dev(idev), "%s: in wrong state: %s\n", |
641 | __func__, state); | 651 | __func__, dev_state_name(state)); |
642 | return SCI_FAILURE_INVALID_STATE; | 652 | return SCI_FAILURE_INVALID_STATE; |
643 | case SCI_DEV_READY: | 653 | case SCI_DEV_READY: |
644 | case SCI_STP_DEV_AWAIT_RESET: | 654 | case SCI_STP_DEV_AWAIT_RESET: |
@@ -721,8 +731,8 @@ enum sci_status sci_remote_device_start_task(struct isci_host *ihost, | |||
721 | case SCI_DEV_RESETTING: | 731 | case SCI_DEV_RESETTING: |
722 | case SCI_DEV_FINAL: | 732 | case SCI_DEV_FINAL: |
723 | default: | 733 | default: |
724 | dev_warn(scirdev_to_dev(idev), "%s: in wrong state: %d\n", | 734 | dev_warn(scirdev_to_dev(idev), "%s: in wrong state: %s\n", |
725 | __func__, state); | 735 | __func__, dev_state_name(state)); |
726 | return SCI_FAILURE_INVALID_STATE; | 736 | return SCI_FAILURE_INVALID_STATE; |
727 | case SCI_STP_DEV_IDLE: | 737 | case SCI_STP_DEV_IDLE: |
728 | case SCI_STP_DEV_CMD: | 738 | case SCI_STP_DEV_CMD: |
@@ -853,8 +863,8 @@ static enum sci_status sci_remote_device_destruct(struct isci_remote_device *ide | |||
853 | struct isci_host *ihost; | 863 | struct isci_host *ihost; |
854 | 864 | ||
855 | if (state != SCI_DEV_STOPPED) { | 865 | if (state != SCI_DEV_STOPPED) { |
856 | dev_warn(scirdev_to_dev(idev), "%s: in wrong state: %d\n", | 866 | dev_warn(scirdev_to_dev(idev), "%s: in wrong state: %s\n", |
857 | __func__, state); | 867 | __func__, dev_state_name(state)); |
858 | return SCI_FAILURE_INVALID_STATE; | 868 | return SCI_FAILURE_INVALID_STATE; |
859 | } | 869 | } |
860 | 870 | ||
@@ -1204,8 +1214,8 @@ static enum sci_status sci_remote_device_start(struct isci_remote_device *idev, | |||
1204 | enum sci_status status; | 1214 | enum sci_status status; |
1205 | 1215 | ||
1206 | if (state != SCI_DEV_STOPPED) { | 1216 | if (state != SCI_DEV_STOPPED) { |
1207 | dev_warn(scirdev_to_dev(idev), "%s: in wrong state: %d\n", | 1217 | dev_warn(scirdev_to_dev(idev), "%s: in wrong state: %s\n", |
1208 | __func__, state); | 1218 | __func__, dev_state_name(state)); |
1209 | return SCI_FAILURE_INVALID_STATE; | 1219 | return SCI_FAILURE_INVALID_STATE; |
1210 | } | 1220 | } |
1211 | 1221 | ||