diff options
author | Edmund Nadolski <edmund.nadolski@intel.com> | 2011-06-01 20:10:50 -0400 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2011-07-03 07:04:50 -0400 |
commit | 12ef65444de9d387a383b9991960848bed5bbe74 (patch) | |
tree | cc7145adf102b57ae4bc347974b23974d795d2c8 /drivers/scsi/isci/host.c | |
parent | e301370ac553a9a0ac0d1d25e769b86cf60395b3 (diff) |
isci: additional state machine cleanup
Additional state machine cleanups:
o Remove static functions sci_state_machine_exit_state() and
sci_state_machine_enter_state()
o Combines sci_base_state_machine_construct() and
sci_base_state_machine_start() into a single function,
sci_init_sm()
o Remove sci_base_state_machine_stop() which is unused.
o Kill state_machine.[ch]
Signed-off-by: Edmund Nadolski <edmund.nadolski@intel.com>
[fixed too large to inline functions]
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/scsi/isci/host.c')
-rw-r--r-- | drivers/scsi/isci/host.c | 39 |
1 files changed, 34 insertions, 5 deletions
diff --git a/drivers/scsi/isci/host.c b/drivers/scsi/isci/host.c index 81ee64c0a4b7..f502882a2e17 100644 --- a/drivers/scsi/isci/host.c +++ b/drivers/scsi/isci/host.c | |||
@@ -197,6 +197,39 @@ | |||
197 | */ | 197 | */ |
198 | #define COMPLETION_QUEUE_CYCLE_BIT(x) ((x) & 0x80000000) | 198 | #define COMPLETION_QUEUE_CYCLE_BIT(x) ((x) & 0x80000000) |
199 | 199 | ||
200 | /* Init the state machine and call the state entry function (if any) */ | ||
201 | void sci_init_sm(struct sci_base_state_machine *sm, | ||
202 | const struct sci_base_state *state_table, u32 initial_state) | ||
203 | { | ||
204 | sci_state_transition_t handler; | ||
205 | |||
206 | sm->initial_state_id = initial_state; | ||
207 | sm->previous_state_id = initial_state; | ||
208 | sm->current_state_id = initial_state; | ||
209 | sm->state_table = state_table; | ||
210 | |||
211 | handler = sm->state_table[initial_state].enter_state; | ||
212 | if (handler) | ||
213 | handler(sm); | ||
214 | } | ||
215 | |||
216 | /* Call the state exit fn, update the current state, call the state entry fn */ | ||
217 | void sci_change_state(struct sci_base_state_machine *sm, u32 next_state) | ||
218 | { | ||
219 | sci_state_transition_t handler; | ||
220 | |||
221 | handler = sm->state_table[sm->current_state_id].exit_state; | ||
222 | if (handler) | ||
223 | handler(sm); | ||
224 | |||
225 | sm->previous_state_id = sm->current_state_id; | ||
226 | sm->current_state_id = next_state; | ||
227 | |||
228 | handler = sm->state_table[sm->current_state_id].enter_state; | ||
229 | if (handler) | ||
230 | handler(sm); | ||
231 | } | ||
232 | |||
200 | static bool scic_sds_controller_completion_queue_has_entries( | 233 | static bool scic_sds_controller_completion_queue_has_entries( |
201 | struct scic_sds_controller *scic) | 234 | struct scic_sds_controller *scic) |
202 | { | 235 | { |
@@ -1807,11 +1840,7 @@ static enum sci_status scic_controller_construct(struct scic_sds_controller *sci | |||
1807 | struct isci_host *ihost = scic_to_ihost(scic); | 1840 | struct isci_host *ihost = scic_to_ihost(scic); |
1808 | u8 i; | 1841 | u8 i; |
1809 | 1842 | ||
1810 | sci_base_state_machine_construct(&scic->sm, | 1843 | sci_init_sm(&scic->sm, scic_sds_controller_state_table, SCIC_INITIAL); |
1811 | scic_sds_controller_state_table, | ||
1812 | SCIC_INITIAL); | ||
1813 | |||
1814 | sci_base_state_machine_start(&scic->sm); | ||
1815 | 1844 | ||
1816 | scic->scu_registers = scu_base; | 1845 | scic->scu_registers = scu_base; |
1817 | scic->smu_registers = smu_base; | 1846 | scic->smu_registers = smu_base; |