Commit 8f31550c authored by Dan Williams's avatar Dan Williams

isci: phy state machine cleanup step1

 c99 the struct initializers:
	1/ allows grep to consistently show method name associations.  The
	   naming is mostly consistent (except when it isn't) so this guarantees
	   coverage of present and future exception cases.
	2/ let's the compiler guarantee that the state table array entry
	   correlates with an actual state name and detect accidental reordering or
	   deletion of states.
	/ allows default handler's to be identified easily
Signed-off-by: default avatarJacek Danecki <Jacek.Danecki@intel.com>
Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
parent 858d4aa7
......@@ -115,9 +115,6 @@ enum sci_base_phy_states {
* Simply the final state for the base phy state machine.
*/
SCI_BASE_PHY_STATE_FINAL,
SCI_BASE_PHY_MAX_STATES
};
/**
......@@ -138,9 +135,7 @@ struct sci_base_phy {
struct sci_base_state_machine state_machine;
};
typedef enum sci_status (*SCI_BASE_PHY_HANDLER_T)(
struct sci_base_phy *
);
typedef enum sci_status (*sci_base_phy_handler_t)(struct sci_base_phy *);
/**
* struct sci_base_phy_state_handler - This structure contains all of the state
......@@ -155,25 +150,25 @@ struct sci_base_phy_state_handler {
* The start_handler specifies the method invoked when there is an
* attempt to start a phy.
*/
SCI_BASE_PHY_HANDLER_T start_handler;
sci_base_phy_handler_t start_handler;
/**
* The stop_handler specifies the method invoked when there is an
* attempt to stop a phy.
*/
SCI_BASE_PHY_HANDLER_T stop_handler;
sci_base_phy_handler_t stop_handler;
/**
* The reset_handler specifies the method invoked when there is an
* attempt to reset a phy.
*/
SCI_BASE_PHY_HANDLER_T reset_handler;
sci_base_phy_handler_t reset_handler;
/**
* The destruct_handler specifies the method invoked when attempting to
* destruct a phy.
*/
SCI_BASE_PHY_HANDLER_T destruct_handler;
sci_base_phy_handler_t destruct_handler;
};
......
This diff is collapsed.
......@@ -146,11 +146,6 @@ enum SCIC_SDS_PHY_STARTING_SUBSTATES {
* Exit state for this state machine
*/
SCIC_SDS_PHY_STARTING_SUBSTATE_FINAL,
/**
* Maximum number of substates for the STARTING state machine
*/
SCIC_SDS_PHY_STARTING_MAX_SUBSTATES
};
struct scic_sds_port;
......@@ -248,7 +243,7 @@ struct scic_sds_phy {
*/
void *sata_timeout_timer;
struct scic_sds_phy_state_handler *state_handlers;
const struct scic_sds_phy_state_handler *state_handlers;
struct sci_base_state_machine starting_substate_machine;
......@@ -260,9 +255,9 @@ struct scic_sds_phy {
};
typedef enum sci_status (*SCIC_SDS_PHY_EVENT_HANDLER_T)(struct scic_sds_phy *, u32);
typedef enum sci_status (*SCIC_SDS_PHY_FRAME_HANDLER_T)(struct scic_sds_phy *, u32);
typedef enum sci_status (*SCIC_SDS_PHY_POWER_HANDLER_T)(struct scic_sds_phy *);
typedef enum sci_status (*scic_sds_phy_event_handler_t)(struct scic_sds_phy *, u32);
typedef enum sci_status (*scic_sds_phy_frame_handler_t)(struct scic_sds_phy *, u32);
typedef enum sci_status (*scic_sds_phy_power_handler_t)(struct scic_sds_phy *);
/**
* struct scic_sds_phy_state_handler -
......@@ -278,25 +273,24 @@ struct scic_sds_phy_state_handler {
/**
* The state handler for unsolicited frames received from the SCU hardware.
*/
SCIC_SDS_PHY_FRAME_HANDLER_T frame_handler;
scic_sds_phy_frame_handler_t frame_handler;
/**
* The state handler for events received from the SCU hardware.
*/
SCIC_SDS_PHY_EVENT_HANDLER_T event_handler;
scic_sds_phy_event_handler_t event_handler;
/**
* The state handler for staggered spinup.
*/
SCIC_SDS_PHY_POWER_HANDLER_T consume_power_handler;
scic_sds_phy_power_handler_t consume_power_handler;
};
extern struct scic_sds_phy_state_handler scic_sds_phy_state_handler_table[];
extern const struct scic_sds_phy_state_handler scic_sds_phy_state_handler_table[];
extern const struct sci_base_state scic_sds_phy_state_table[];
extern const struct sci_base_state scic_sds_phy_starting_substates[];
extern struct scic_sds_phy_state_handler
scic_sds_phy_starting_substate_handler_table[];
extern const struct scic_sds_phy_state_handler scic_sds_phy_starting_substate_handler_table[];
/**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment