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>
This commit is contained in:
Родитель
4fd0d2e9bf
Коммит
8151518265
|
@ -246,15 +246,20 @@ enum sci_status scic_remote_device_reset(struct scic_sds_remote_device *sci_dev)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
enum sci_status scic_remote_device_reset_complete(
|
||||
struct scic_sds_remote_device *sci_dev)
|
||||
enum sci_status scic_remote_device_reset_complete(struct scic_sds_remote_device *sci_dev)
|
||||
{
|
||||
return sci_dev->state_handlers->reset_complete_handler(sci_dev);
|
||||
}
|
||||
struct sci_base_state_machine *sm = &sci_dev->state_machine;
|
||||
enum scic_sds_remote_device_states state = sm->current_state_id;
|
||||
|
||||
#define SCIC_SDS_REMOTE_DEVICE_MINIMUM_TIMER_COUNT (0)
|
||||
#define SCIC_SDS_REMOTE_DEVICE_MAXIMUM_TIMER_COUNT (SCI_MAX_REMOTE_DEVICES)
|
||||
if (state != SCI_BASE_REMOTE_DEVICE_STATE_RESETTING) {
|
||||
dev_warn(scirdev_to_dev(sci_dev), "%s: in wrong state: %d\n",
|
||||
__func__, state);
|
||||
return SCI_FAILURE_INVALID_STATE;
|
||||
}
|
||||
|
||||
sci_base_state_machine_change_state(sm, SCI_BASE_REMOTE_DEVICE_STATE_READY);
|
||||
return SCI_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -457,12 +462,6 @@ default_device_handler(struct scic_sds_remote_device *sci_dev,
|
|||
return SCI_FAILURE_INVALID_STATE;
|
||||
}
|
||||
|
||||
static enum sci_status scic_sds_remote_device_default_reset_complete_handler(
|
||||
struct scic_sds_remote_device *sci_dev)
|
||||
{
|
||||
return default_device_handler(sci_dev, __func__);
|
||||
}
|
||||
|
||||
static enum sci_status scic_sds_remote_device_default_suspend_handler(
|
||||
struct scic_sds_remote_device *sci_dev, u32 suspend_type)
|
||||
{
|
||||
|
@ -795,15 +794,6 @@ static enum sci_status scic_sds_remote_device_stopping_state_complete_request_ha
|
|||
return SCI_SUCCESS;
|
||||
}
|
||||
|
||||
static enum sci_status scic_sds_remote_device_resetting_state_reset_complete_handler(
|
||||
struct scic_sds_remote_device *sci_dev)
|
||||
{
|
||||
sci_base_state_machine_change_state(&sci_dev->state_machine,
|
||||
SCI_BASE_REMOTE_DEVICE_STATE_READY);
|
||||
|
||||
return SCI_SUCCESS;
|
||||
}
|
||||
|
||||
/* complete requests for this device while it is in the
|
||||
* SCI_BASE_REMOTE_DEVICE_STATE_RESETTING state. This method calls the complete
|
||||
* 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
|
|||
|
||||
static const struct scic_sds_remote_device_state_handler scic_sds_remote_device_state_handler_table[] = {
|
||||
[SCI_BASE_REMOTE_DEVICE_STATE_INITIAL] = {
|
||||
.reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
|
||||
.start_io_handler = scic_sds_remote_device_default_start_request_handler,
|
||||
.complete_io_handler = scic_sds_remote_device_default_complete_request_handler,
|
||||
.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_
|
|||
.frame_handler = scic_sds_remote_device_default_frame_handler
|
||||
},
|
||||
[SCI_BASE_REMOTE_DEVICE_STATE_STOPPED] = {
|
||||
.reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
|
||||
.start_io_handler = scic_sds_remote_device_default_start_request_handler,
|
||||
.complete_io_handler = scic_sds_remote_device_default_complete_request_handler,
|
||||
.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_
|
|||
.frame_handler = scic_sds_remote_device_default_frame_handler
|
||||
},
|
||||
[SCI_BASE_REMOTE_DEVICE_STATE_STARTING] = {
|
||||
.reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
|
||||
.start_io_handler = scic_sds_remote_device_default_start_request_handler,
|
||||
.complete_io_handler = scic_sds_remote_device_default_complete_request_handler,
|
||||
.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_
|
|||
.frame_handler = scic_sds_remote_device_default_frame_handler
|
||||
},
|
||||
[SCI_BASE_REMOTE_DEVICE_STATE_READY] = {
|
||||
.reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
|
||||
.start_io_handler = scic_sds_remote_device_ready_state_start_io_handler,
|
||||
.complete_io_handler = scic_sds_remote_device_ready_state_complete_request_handler,
|
||||
.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_
|
|||
.frame_handler = scic_sds_remote_device_general_frame_handler,
|
||||
},
|
||||
[SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_IDLE] = {
|
||||
.reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
|
||||
.start_io_handler = scic_sds_stp_remote_device_ready_idle_substate_start_io_handler,
|
||||
.complete_io_handler = scic_sds_remote_device_default_complete_request_handler,
|
||||
.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_
|
|||
.frame_handler = scic_sds_remote_device_default_frame_handler
|
||||
},
|
||||
[SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_CMD] = {
|
||||
.reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
|
||||
.start_io_handler = scic_sds_stp_remote_device_ready_cmd_substate_start_io_handler,
|
||||
.complete_io_handler = scic_sds_stp_remote_device_complete_request,
|
||||
.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_
|
|||
.frame_handler = scic_sds_stp_remote_device_ready_cmd_substate_frame_handler
|
||||
},
|
||||
[SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ] = {
|
||||
.reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
|
||||
.start_io_handler = scic_sds_stp_remote_device_ready_ncq_substate_start_io_handler,
|
||||
.complete_io_handler = scic_sds_stp_remote_device_complete_request,
|
||||
.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_
|
|||
.frame_handler = scic_sds_stp_remote_device_ready_ncq_substate_frame_handler
|
||||
},
|
||||
[SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ_ERROR] = {
|
||||
.reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
|
||||
.start_io_handler = scic_sds_remote_device_default_start_request_handler,
|
||||
.complete_io_handler = scic_sds_stp_remote_device_complete_request,
|
||||
.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_
|
|||
.frame_handler = scic_sds_remote_device_general_frame_handler
|
||||
},
|
||||
[SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_AWAIT_RESET] = {
|
||||
.reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
|
||||
.start_io_handler = scic_sds_stp_remote_device_ready_await_reset_substate_start_io_handler,
|
||||
.complete_io_handler = scic_sds_stp_remote_device_ready_await_reset_substate_complete_request_handler,
|
||||
.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_
|
|||
.frame_handler = scic_sds_remote_device_general_frame_handler
|
||||
},
|
||||
[SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_IDLE] = {
|
||||
.reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
|
||||
.start_io_handler = scic_sds_smp_remote_device_ready_idle_substate_start_io_handler,
|
||||
.complete_io_handler = scic_sds_remote_device_default_complete_request_handler,
|
||||
.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_
|
|||
.frame_handler = scic_sds_remote_device_default_frame_handler
|
||||
},
|
||||
[SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_CMD] = {
|
||||
.reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
|
||||
.start_io_handler = scic_sds_smp_remote_device_ready_cmd_substate_start_io_handler,
|
||||
.complete_io_handler = scic_sds_smp_remote_device_ready_cmd_substate_complete_io_handler,
|
||||
.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_
|
|||
.frame_handler = scic_sds_smp_remote_device_ready_cmd_substate_frame_handler
|
||||
},
|
||||
[SCI_BASE_REMOTE_DEVICE_STATE_STOPPING] = {
|
||||
.reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
|
||||
.start_io_handler = scic_sds_remote_device_default_start_request_handler,
|
||||
.complete_io_handler = scic_sds_remote_device_stopping_state_complete_request_handler,
|
||||
.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_
|
|||
.frame_handler = scic_sds_remote_device_general_frame_handler
|
||||
},
|
||||
[SCI_BASE_REMOTE_DEVICE_STATE_FAILED] = {
|
||||
.reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
|
||||
.start_io_handler = scic_sds_remote_device_default_start_request_handler,
|
||||
.complete_io_handler = scic_sds_remote_device_default_complete_request_handler,
|
||||
.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_
|
|||
.frame_handler = scic_sds_remote_device_general_frame_handler
|
||||
},
|
||||
[SCI_BASE_REMOTE_DEVICE_STATE_RESETTING] = {
|
||||
.reset_complete_handler = scic_sds_remote_device_resetting_state_reset_complete_handler,
|
||||
.start_io_handler = scic_sds_remote_device_default_start_request_handler,
|
||||
.complete_io_handler = scic_sds_remote_device_resetting_state_complete_request_handler,
|
||||
.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_
|
|||
.frame_handler = scic_sds_remote_device_general_frame_handler
|
||||
},
|
||||
[SCI_BASE_REMOTE_DEVICE_STATE_FINAL] = {
|
||||
.reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
|
||||
.start_io_handler = scic_sds_remote_device_default_start_request_handler,
|
||||
.complete_io_handler = scic_sds_remote_device_default_complete_request_handler,
|
||||
.continue_io_handler = scic_sds_remote_device_default_continue_request_handler,
|
||||
|
|
|
@ -386,12 +386,6 @@ typedef void (*scic_sds_remote_device_ready_not_ready_handler_t)(
|
|||
*
|
||||
*/
|
||||
struct scic_sds_remote_device_state_handler {
|
||||
/**
|
||||
* The reset complete handler specifies the method invloked when
|
||||
* reporting that a reset has completed to the remote device.
|
||||
*/
|
||||
scic_sds_remote_device_handler_t reset_complete_handler;
|
||||
|
||||
/**
|
||||
* The start_io_handler specifies the method invoked when a user
|
||||
* attempts to start an IO request for a remote device.
|
||||
|
|
Загрузка…
Ссылка в новой задаче