diff options
author | Dan Williams <dan.j.williams@intel.com> | 2011-05-01 17:53:00 -0400 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2011-07-03 07:04:45 -0400 |
commit | 815151826553f875846ebba9696777a424ee62e5 (patch) | |
tree | 1043e6bddd8f83f89dafc7cce8691a86e0293720 /drivers/scsi/isci/remote_device.c | |
parent | 4fd0d2e9bf5152456952ad7c5b6f3d8565de7737 (diff) |
isci: unify remote_device reset_complete_handlers
Implement all states in scic_remote_device_reset_complete() and delete the
state handler.
Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/scsi/isci/remote_device.c')
-rw-r--r-- | drivers/scsi/isci/remote_device.c | 49 |
1 files changed, 12 insertions, 37 deletions
diff --git a/drivers/scsi/isci/remote_device.c b/drivers/scsi/isci/remote_device.c index d8968f32ad9a..658781dd65e6 100644 --- a/drivers/scsi/isci/remote_device.c +++ b/drivers/scsi/isci/remote_device.c | |||
@@ -246,15 +246,20 @@ enum sci_status scic_remote_device_reset(struct scic_sds_remote_device *sci_dev) | |||
246 | } | 246 | } |
247 | } | 247 | } |
248 | 248 | ||
249 | 249 | enum sci_status scic_remote_device_reset_complete(struct scic_sds_remote_device *sci_dev) | |
250 | enum sci_status scic_remote_device_reset_complete( | ||
251 | struct scic_sds_remote_device *sci_dev) | ||
252 | { | 250 | { |
253 | return sci_dev->state_handlers->reset_complete_handler(sci_dev); | 251 | struct sci_base_state_machine *sm = &sci_dev->state_machine; |
254 | } | 252 | enum scic_sds_remote_device_states state = sm->current_state_id; |
253 | |||
254 | if (state != SCI_BASE_REMOTE_DEVICE_STATE_RESETTING) { | ||
255 | dev_warn(scirdev_to_dev(sci_dev), "%s: in wrong state: %d\n", | ||
256 | __func__, state); | ||
257 | return SCI_FAILURE_INVALID_STATE; | ||
258 | } | ||
255 | 259 | ||
256 | #define SCIC_SDS_REMOTE_DEVICE_MINIMUM_TIMER_COUNT (0) | 260 | sci_base_state_machine_change_state(sm, SCI_BASE_REMOTE_DEVICE_STATE_READY); |
257 | #define SCIC_SDS_REMOTE_DEVICE_MAXIMUM_TIMER_COUNT (SCI_MAX_REMOTE_DEVICES) | 261 | return SCI_SUCCESS; |
262 | } | ||
258 | 263 | ||
259 | /** | 264 | /** |
260 | * | 265 | * |
@@ -457,12 +462,6 @@ default_device_handler(struct scic_sds_remote_device *sci_dev, | |||
457 | return SCI_FAILURE_INVALID_STATE; | 462 | return SCI_FAILURE_INVALID_STATE; |
458 | } | 463 | } |
459 | 464 | ||
460 | static enum sci_status scic_sds_remote_device_default_reset_complete_handler( | ||
461 | struct scic_sds_remote_device *sci_dev) | ||
462 | { | ||
463 | return default_device_handler(sci_dev, __func__); | ||
464 | } | ||
465 | |||
466 | static enum sci_status scic_sds_remote_device_default_suspend_handler( | 465 | static enum sci_status scic_sds_remote_device_default_suspend_handler( |
467 | struct scic_sds_remote_device *sci_dev, u32 suspend_type) | 466 | struct scic_sds_remote_device *sci_dev, u32 suspend_type) |
468 | { | 467 | { |
@@ -795,15 +794,6 @@ static enum sci_status scic_sds_remote_device_stopping_state_complete_request_ha | |||
795 | return SCI_SUCCESS; | 794 | return SCI_SUCCESS; |
796 | } | 795 | } |
797 | 796 | ||
798 | static enum sci_status scic_sds_remote_device_resetting_state_reset_complete_handler( | ||
799 | struct scic_sds_remote_device *sci_dev) | ||
800 | { | ||
801 | sci_base_state_machine_change_state(&sci_dev->state_machine, | ||
802 | SCI_BASE_REMOTE_DEVICE_STATE_READY); | ||
803 | |||
804 | return SCI_SUCCESS; | ||
805 | } | ||
806 | |||
807 | /* complete requests for this device while it is in the | 797 | /* complete requests for this device while it is in the |
808 | * SCI_BASE_REMOTE_DEVICE_STATE_RESETTING state. This method calls the complete | 798 | * SCI_BASE_REMOTE_DEVICE_STATE_RESETTING state. This method calls the complete |
809 | * method for the request object and if that is successful the port object is | 799 | * method for the request object and if that is successful the port object is |
@@ -1223,7 +1213,6 @@ static enum sci_status scic_sds_smp_remote_device_ready_cmd_substate_frame_handl | |||
1223 | 1213 | ||
1224 | static const struct scic_sds_remote_device_state_handler scic_sds_remote_device_state_handler_table[] = { | 1214 | static const struct scic_sds_remote_device_state_handler scic_sds_remote_device_state_handler_table[] = { |
1225 | [SCI_BASE_REMOTE_DEVICE_STATE_INITIAL] = { | 1215 | [SCI_BASE_REMOTE_DEVICE_STATE_INITIAL] = { |
1226 | .reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler, | ||
1227 | .start_io_handler = scic_sds_remote_device_default_start_request_handler, | 1216 | .start_io_handler = scic_sds_remote_device_default_start_request_handler, |
1228 | .complete_io_handler = scic_sds_remote_device_default_complete_request_handler, | 1217 | .complete_io_handler = scic_sds_remote_device_default_complete_request_handler, |
1229 | .continue_io_handler = scic_sds_remote_device_default_continue_request_handler, | 1218 | .continue_io_handler = scic_sds_remote_device_default_continue_request_handler, |
@@ -1235,7 +1224,6 @@ static const struct scic_sds_remote_device_state_handler scic_sds_remote_device_ | |||
1235 | .frame_handler = scic_sds_remote_device_default_frame_handler | 1224 | .frame_handler = scic_sds_remote_device_default_frame_handler |
1236 | }, | 1225 | }, |
1237 | [SCI_BASE_REMOTE_DEVICE_STATE_STOPPED] = { | 1226 | [SCI_BASE_REMOTE_DEVICE_STATE_STOPPED] = { |
1238 | .reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler, | ||
1239 | .start_io_handler = scic_sds_remote_device_default_start_request_handler, | 1227 | .start_io_handler = scic_sds_remote_device_default_start_request_handler, |
1240 | .complete_io_handler = scic_sds_remote_device_default_complete_request_handler, | 1228 | .complete_io_handler = scic_sds_remote_device_default_complete_request_handler, |
1241 | .continue_io_handler = scic_sds_remote_device_default_continue_request_handler, | 1229 | .continue_io_handler = scic_sds_remote_device_default_continue_request_handler, |
@@ -1247,7 +1235,6 @@ static const struct scic_sds_remote_device_state_handler scic_sds_remote_device_ | |||
1247 | .frame_handler = scic_sds_remote_device_default_frame_handler | 1235 | .frame_handler = scic_sds_remote_device_default_frame_handler |
1248 | }, | 1236 | }, |
1249 | [SCI_BASE_REMOTE_DEVICE_STATE_STARTING] = { | 1237 | [SCI_BASE_REMOTE_DEVICE_STATE_STARTING] = { |
1250 | .reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler, | ||
1251 | .start_io_handler = scic_sds_remote_device_default_start_request_handler, | 1238 | .start_io_handler = scic_sds_remote_device_default_start_request_handler, |
1252 | .complete_io_handler = scic_sds_remote_device_default_complete_request_handler, | 1239 | .complete_io_handler = scic_sds_remote_device_default_complete_request_handler, |
1253 | .continue_io_handler = scic_sds_remote_device_default_continue_request_handler, | 1240 | .continue_io_handler = scic_sds_remote_device_default_continue_request_handler, |
@@ -1259,7 +1246,6 @@ static const struct scic_sds_remote_device_state_handler scic_sds_remote_device_ | |||
1259 | .frame_handler = scic_sds_remote_device_default_frame_handler | 1246 | .frame_handler = scic_sds_remote_device_default_frame_handler |
1260 | }, | 1247 | }, |
1261 | [SCI_BASE_REMOTE_DEVICE_STATE_READY] = { | 1248 | [SCI_BASE_REMOTE_DEVICE_STATE_READY] = { |
1262 | .reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler, | ||
1263 | .start_io_handler = scic_sds_remote_device_ready_state_start_io_handler, | 1249 | .start_io_handler = scic_sds_remote_device_ready_state_start_io_handler, |
1264 | .complete_io_handler = scic_sds_remote_device_ready_state_complete_request_handler, | 1250 | .complete_io_handler = scic_sds_remote_device_ready_state_complete_request_handler, |
1265 | .continue_io_handler = scic_sds_remote_device_default_continue_request_handler, | 1251 | .continue_io_handler = scic_sds_remote_device_default_continue_request_handler, |
@@ -1271,7 +1257,6 @@ static const struct scic_sds_remote_device_state_handler scic_sds_remote_device_ | |||
1271 | .frame_handler = scic_sds_remote_device_general_frame_handler, | 1257 | .frame_handler = scic_sds_remote_device_general_frame_handler, |
1272 | }, | 1258 | }, |
1273 | [SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_IDLE] = { | 1259 | [SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_IDLE] = { |
1274 | .reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler, | ||
1275 | .start_io_handler = scic_sds_stp_remote_device_ready_idle_substate_start_io_handler, | 1260 | .start_io_handler = scic_sds_stp_remote_device_ready_idle_substate_start_io_handler, |
1276 | .complete_io_handler = scic_sds_remote_device_default_complete_request_handler, | 1261 | .complete_io_handler = scic_sds_remote_device_default_complete_request_handler, |
1277 | .continue_io_handler = scic_sds_remote_device_default_continue_request_handler, | 1262 | .continue_io_handler = scic_sds_remote_device_default_continue_request_handler, |
@@ -1283,7 +1268,6 @@ static const struct scic_sds_remote_device_state_handler scic_sds_remote_device_ | |||
1283 | .frame_handler = scic_sds_remote_device_default_frame_handler | 1268 | .frame_handler = scic_sds_remote_device_default_frame_handler |
1284 | }, | 1269 | }, |
1285 | [SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_CMD] = { | 1270 | [SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_CMD] = { |
1286 | .reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler, | ||
1287 | .start_io_handler = scic_sds_stp_remote_device_ready_cmd_substate_start_io_handler, | 1271 | .start_io_handler = scic_sds_stp_remote_device_ready_cmd_substate_start_io_handler, |
1288 | .complete_io_handler = scic_sds_stp_remote_device_complete_request, | 1272 | .complete_io_handler = scic_sds_stp_remote_device_complete_request, |
1289 | .continue_io_handler = scic_sds_remote_device_default_continue_request_handler, | 1273 | .continue_io_handler = scic_sds_remote_device_default_continue_request_handler, |
@@ -1295,7 +1279,6 @@ static const struct scic_sds_remote_device_state_handler scic_sds_remote_device_ | |||
1295 | .frame_handler = scic_sds_stp_remote_device_ready_cmd_substate_frame_handler | 1279 | .frame_handler = scic_sds_stp_remote_device_ready_cmd_substate_frame_handler |
1296 | }, | 1280 | }, |
1297 | [SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ] = { | 1281 | [SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ] = { |
1298 | .reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler, | ||
1299 | .start_io_handler = scic_sds_stp_remote_device_ready_ncq_substate_start_io_handler, | 1282 | .start_io_handler = scic_sds_stp_remote_device_ready_ncq_substate_start_io_handler, |
1300 | .complete_io_handler = scic_sds_stp_remote_device_complete_request, | 1283 | .complete_io_handler = scic_sds_stp_remote_device_complete_request, |
1301 | .continue_io_handler = scic_sds_remote_device_default_continue_request_handler, | 1284 | .continue_io_handler = scic_sds_remote_device_default_continue_request_handler, |
@@ -1307,7 +1290,6 @@ static const struct scic_sds_remote_device_state_handler scic_sds_remote_device_ | |||
1307 | .frame_handler = scic_sds_stp_remote_device_ready_ncq_substate_frame_handler | 1290 | .frame_handler = scic_sds_stp_remote_device_ready_ncq_substate_frame_handler |
1308 | }, | 1291 | }, |
1309 | [SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ_ERROR] = { | 1292 | [SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ_ERROR] = { |
1310 | .reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler, | ||
1311 | .start_io_handler = scic_sds_remote_device_default_start_request_handler, | 1293 | .start_io_handler = scic_sds_remote_device_default_start_request_handler, |
1312 | .complete_io_handler = scic_sds_stp_remote_device_complete_request, | 1294 | .complete_io_handler = scic_sds_stp_remote_device_complete_request, |
1313 | .continue_io_handler = scic_sds_remote_device_default_continue_request_handler, | 1295 | .continue_io_handler = scic_sds_remote_device_default_continue_request_handler, |
@@ -1319,7 +1301,6 @@ static const struct scic_sds_remote_device_state_handler scic_sds_remote_device_ | |||
1319 | .frame_handler = scic_sds_remote_device_general_frame_handler | 1301 | .frame_handler = scic_sds_remote_device_general_frame_handler |
1320 | }, | 1302 | }, |
1321 | [SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_AWAIT_RESET] = { | 1303 | [SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_AWAIT_RESET] = { |
1322 | .reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler, | ||
1323 | .start_io_handler = scic_sds_stp_remote_device_ready_await_reset_substate_start_io_handler, | 1304 | .start_io_handler = scic_sds_stp_remote_device_ready_await_reset_substate_start_io_handler, |
1324 | .complete_io_handler = scic_sds_stp_remote_device_ready_await_reset_substate_complete_request_handler, | 1305 | .complete_io_handler = scic_sds_stp_remote_device_ready_await_reset_substate_complete_request_handler, |
1325 | .continue_io_handler = scic_sds_remote_device_default_continue_request_handler, | 1306 | .continue_io_handler = scic_sds_remote_device_default_continue_request_handler, |
@@ -1331,7 +1312,6 @@ static const struct scic_sds_remote_device_state_handler scic_sds_remote_device_ | |||
1331 | .frame_handler = scic_sds_remote_device_general_frame_handler | 1312 | .frame_handler = scic_sds_remote_device_general_frame_handler |
1332 | }, | 1313 | }, |
1333 | [SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_IDLE] = { | 1314 | [SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_IDLE] = { |
1334 | .reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler, | ||
1335 | .start_io_handler = scic_sds_smp_remote_device_ready_idle_substate_start_io_handler, | 1315 | .start_io_handler = scic_sds_smp_remote_device_ready_idle_substate_start_io_handler, |
1336 | .complete_io_handler = scic_sds_remote_device_default_complete_request_handler, | 1316 | .complete_io_handler = scic_sds_remote_device_default_complete_request_handler, |
1337 | .continue_io_handler = scic_sds_remote_device_default_continue_request_handler, | 1317 | .continue_io_handler = scic_sds_remote_device_default_continue_request_handler, |
@@ -1343,7 +1323,6 @@ static const struct scic_sds_remote_device_state_handler scic_sds_remote_device_ | |||
1343 | .frame_handler = scic_sds_remote_device_default_frame_handler | 1323 | .frame_handler = scic_sds_remote_device_default_frame_handler |
1344 | }, | 1324 | }, |
1345 | [SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_CMD] = { | 1325 | [SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_CMD] = { |
1346 | .reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler, | ||
1347 | .start_io_handler = scic_sds_smp_remote_device_ready_cmd_substate_start_io_handler, | 1326 | .start_io_handler = scic_sds_smp_remote_device_ready_cmd_substate_start_io_handler, |
1348 | .complete_io_handler = scic_sds_smp_remote_device_ready_cmd_substate_complete_io_handler, | 1327 | .complete_io_handler = scic_sds_smp_remote_device_ready_cmd_substate_complete_io_handler, |
1349 | .continue_io_handler = scic_sds_remote_device_default_continue_request_handler, | 1328 | .continue_io_handler = scic_sds_remote_device_default_continue_request_handler, |
@@ -1355,7 +1334,6 @@ static const struct scic_sds_remote_device_state_handler scic_sds_remote_device_ | |||
1355 | .frame_handler = scic_sds_smp_remote_device_ready_cmd_substate_frame_handler | 1334 | .frame_handler = scic_sds_smp_remote_device_ready_cmd_substate_frame_handler |
1356 | }, | 1335 | }, |
1357 | [SCI_BASE_REMOTE_DEVICE_STATE_STOPPING] = { | 1336 | [SCI_BASE_REMOTE_DEVICE_STATE_STOPPING] = { |
1358 | .reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler, | ||
1359 | .start_io_handler = scic_sds_remote_device_default_start_request_handler, | 1337 | .start_io_handler = scic_sds_remote_device_default_start_request_handler, |
1360 | .complete_io_handler = scic_sds_remote_device_stopping_state_complete_request_handler, | 1338 | .complete_io_handler = scic_sds_remote_device_stopping_state_complete_request_handler, |
1361 | .continue_io_handler = scic_sds_remote_device_default_continue_request_handler, | 1339 | .continue_io_handler = scic_sds_remote_device_default_continue_request_handler, |
@@ -1367,7 +1345,6 @@ static const struct scic_sds_remote_device_state_handler scic_sds_remote_device_ | |||
1367 | .frame_handler = scic_sds_remote_device_general_frame_handler | 1345 | .frame_handler = scic_sds_remote_device_general_frame_handler |
1368 | }, | 1346 | }, |
1369 | [SCI_BASE_REMOTE_DEVICE_STATE_FAILED] = { | 1347 | [SCI_BASE_REMOTE_DEVICE_STATE_FAILED] = { |
1370 | .reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler, | ||
1371 | .start_io_handler = scic_sds_remote_device_default_start_request_handler, | 1348 | .start_io_handler = scic_sds_remote_device_default_start_request_handler, |
1372 | .complete_io_handler = scic_sds_remote_device_default_complete_request_handler, | 1349 | .complete_io_handler = scic_sds_remote_device_default_complete_request_handler, |
1373 | .continue_io_handler = scic_sds_remote_device_default_continue_request_handler, | 1350 | .continue_io_handler = scic_sds_remote_device_default_continue_request_handler, |
@@ -1379,7 +1356,6 @@ static const struct scic_sds_remote_device_state_handler scic_sds_remote_device_ | |||
1379 | .frame_handler = scic_sds_remote_device_general_frame_handler | 1356 | .frame_handler = scic_sds_remote_device_general_frame_handler |
1380 | }, | 1357 | }, |
1381 | [SCI_BASE_REMOTE_DEVICE_STATE_RESETTING] = { | 1358 | [SCI_BASE_REMOTE_DEVICE_STATE_RESETTING] = { |
1382 | .reset_complete_handler = scic_sds_remote_device_resetting_state_reset_complete_handler, | ||
1383 | .start_io_handler = scic_sds_remote_device_default_start_request_handler, | 1359 | .start_io_handler = scic_sds_remote_device_default_start_request_handler, |
1384 | .complete_io_handler = scic_sds_remote_device_resetting_state_complete_request_handler, | 1360 | .complete_io_handler = scic_sds_remote_device_resetting_state_complete_request_handler, |
1385 | .continue_io_handler = scic_sds_remote_device_default_continue_request_handler, | 1361 | .continue_io_handler = scic_sds_remote_device_default_continue_request_handler, |
@@ -1391,7 +1367,6 @@ static const struct scic_sds_remote_device_state_handler scic_sds_remote_device_ | |||
1391 | .frame_handler = scic_sds_remote_device_general_frame_handler | 1367 | .frame_handler = scic_sds_remote_device_general_frame_handler |
1392 | }, | 1368 | }, |
1393 | [SCI_BASE_REMOTE_DEVICE_STATE_FINAL] = { | 1369 | [SCI_BASE_REMOTE_DEVICE_STATE_FINAL] = { |
1394 | .reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler, | ||
1395 | .start_io_handler = scic_sds_remote_device_default_start_request_handler, | 1370 | .start_io_handler = scic_sds_remote_device_default_start_request_handler, |
1396 | .complete_io_handler = scic_sds_remote_device_default_complete_request_handler, | 1371 | .complete_io_handler = scic_sds_remote_device_default_complete_request_handler, |
1397 | .continue_io_handler = scic_sds_remote_device_default_continue_request_handler, | 1372 | .continue_io_handler = scic_sds_remote_device_default_continue_request_handler, |