summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/isci/state_machine.c
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2011-05-12 07:42:17 -0700
committerDan Williams <dan.j.williams@intel.com>2011-07-03 04:04:49 -0700
commit9269e0e898594c65dee6b20d4ed48e33dbbd4eeb (patch)
treef08aebe48d8005eec30a439c1c2d0e1e4b15d4a4 /drivers/scsi/isci/state_machine.c
parentf34d9e5d3f34f395a497a8747316b04ef3e865b1 (diff)
downloadtalos-obmc-linux-9269e0e898594c65dee6b20d4ed48e33dbbd4eeb.tar.gz
talos-obmc-linux-9269e0e898594c65dee6b20d4ed48e33dbbd4eeb.zip
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 <hch@lst.de> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/scsi/isci/state_machine.c')
-rw-r--r--drivers/scsi/isci/state_machine.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/drivers/scsi/isci/state_machine.c b/drivers/scsi/isci/state_machine.c
index 6057782af8c2..1bcd925e502f 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;
OpenPOWER on IntegriCloud