From 9269e0e898594c65dee6b20d4ed48e33dbbd4eeb Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Thu, 12 May 2011 07:42:17 -0700 Subject: isci: add some type safety to the state machine interface Now that any given object type only has one state_machine we can use container_of() to get back to the given state machine owner. Reported-by: Christoph Hellwig Signed-off-by: Dan Williams --- drivers/scsi/isci/state_machine.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) (limited to 'drivers/scsi/isci/state_machine.c') diff --git a/drivers/scsi/isci/state_machine.c b/drivers/scsi/isci/state_machine.c index 6057782af8c..1bcd925e502 100644 --- a/drivers/scsi/isci/state_machine.c +++ b/drivers/scsi/isci/state_machine.c @@ -68,7 +68,7 @@ static void sci_state_machine_exit_state(struct sci_base_state_machine *sm) sci_state_transition_t exit = sm->state_table[state].exit_state; if (exit) - exit(sm->state_machine_owner); + exit(sm); } static void sci_state_machine_enter_state(struct sci_base_state_machine *sm) @@ -77,22 +77,15 @@ static void sci_state_machine_enter_state(struct sci_base_state_machine *sm) sci_state_transition_t enter = sm->state_table[state].enter_state; if (enter) - enter(sm->state_machine_owner); + enter(sm); } -/* - * ****************************************************************************** - * * P R O T E C T E D M E T H O D S - * ****************************************************************************** */ - /** * This method will set the initial state and state table for the state * machine. The caller should follow this request with the initialize * request to cause the state machine to start. * @sm: This parameter provides the state machine object to be * constructed. - * @state_machine_owner: This parameter indicates the object that is owns the - * state machine being constructed. * @state_table: This parameter specifies the table of state objects that is * managed by this state machine. * @initial_state: This parameter specifies the value of the initial state for @@ -100,11 +93,9 @@ static void sci_state_machine_enter_state(struct sci_base_state_machine *sm) * */ void sci_base_state_machine_construct(struct sci_base_state_machine *sm, - void *owner, const struct sci_base_state *state_table, u32 initial_state) { - sm->state_machine_owner = owner; sm->initial_state_id = initial_state; sm->previous_state_id = initial_state; sm->current_state_id = initial_state; -- cgit v1.2.3