summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/isci/phy.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/phy.c
parentf34d9e5d3f34f395a497a8747316b04ef3e865b1 (diff)
downloadblackbird-obmc-linux-9269e0e898594c65dee6b20d4ed48e33dbbd4eeb.tar.gz
blackbird-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/phy.c')
-rw-r--r--drivers/scsi/isci/phy.c70
1 files changed, 34 insertions, 36 deletions
diff --git a/drivers/scsi/isci/phy.c b/drivers/scsi/isci/phy.c
index 8bd1a85f621e..f21e10e2888c 100644
--- a/drivers/scsi/isci/phy.c
+++ b/drivers/scsi/isci/phy.c
@@ -1026,81 +1026,80 @@ enum sci_status scic_sds_phy_frame_handler(struct scic_sds_phy *sci_phy,
}
-static void scic_sds_phy_starting_initial_substate_enter(void *object)
+static void scic_sds_phy_starting_initial_substate_enter(struct sci_base_state_machine *sm)
{
- struct scic_sds_phy *sci_phy = object;
+ struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), state_machine);
/* This is just an temporary state go off to the starting state */
sci_base_state_machine_change_state(&sci_phy->state_machine,
SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_OSSP_EN);
}
-static void scic_sds_phy_starting_await_sas_power_substate_enter(void *object)
+static void scic_sds_phy_starting_await_sas_power_substate_enter(struct sci_base_state_machine *sm)
{
- struct scic_sds_phy *sci_phy = object;
+ struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), state_machine);
struct scic_sds_controller *scic = sci_phy->owning_port->owning_controller;
scic_sds_controller_power_control_queue_insert(scic, sci_phy);
}
-static void scic_sds_phy_starting_await_sas_power_substate_exit(void *object)
+static void scic_sds_phy_starting_await_sas_power_substate_exit(struct sci_base_state_machine *sm)
{
- struct scic_sds_phy *sci_phy = object;
+ struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), state_machine);
struct scic_sds_controller *scic = sci_phy->owning_port->owning_controller;
scic_sds_controller_power_control_queue_remove(scic, sci_phy);
}
-static void scic_sds_phy_starting_await_sata_power_substate_enter(void *object)
+static void scic_sds_phy_starting_await_sata_power_substate_enter(struct sci_base_state_machine *sm)
{
- struct scic_sds_phy *sci_phy = object;
+ struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), state_machine);
struct scic_sds_controller *scic = sci_phy->owning_port->owning_controller;
scic_sds_controller_power_control_queue_insert(scic, sci_phy);
}
-static void scic_sds_phy_starting_await_sata_power_substate_exit(void *object)
+static void scic_sds_phy_starting_await_sata_power_substate_exit(struct sci_base_state_machine *sm)
{
- struct scic_sds_phy *sci_phy = object;
+ struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), state_machine);
struct scic_sds_controller *scic = sci_phy->owning_port->owning_controller;
scic_sds_controller_power_control_queue_remove(scic, sci_phy);
}
-static void scic_sds_phy_starting_await_sata_phy_substate_enter(void *object)
+static void scic_sds_phy_starting_await_sata_phy_substate_enter(struct sci_base_state_machine *sm)
{
- struct scic_sds_phy *sci_phy = object;
+ struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), state_machine);
isci_timer_start(sci_phy->sata_timeout_timer,
SCIC_SDS_SATA_LINK_TRAINING_TIMEOUT);
}
-static void scic_sds_phy_starting_await_sata_phy_substate_exit(void *object)
+static void scic_sds_phy_starting_await_sata_phy_substate_exit(struct sci_base_state_machine *sm)
{
- struct scic_sds_phy *sci_phy = object;
+ struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), state_machine);
isci_timer_stop(sci_phy->sata_timeout_timer);
}
-static void scic_sds_phy_starting_await_sata_speed_substate_enter(void *object)
+static void scic_sds_phy_starting_await_sata_speed_substate_enter(struct sci_base_state_machine *sm)
{
- struct scic_sds_phy *sci_phy = object;
+ struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), state_machine);
isci_timer_start(sci_phy->sata_timeout_timer,
SCIC_SDS_SATA_LINK_TRAINING_TIMEOUT);
}
-static void scic_sds_phy_starting_await_sata_speed_substate_exit(
- void *object)
+static void scic_sds_phy_starting_await_sata_speed_substate_exit(struct sci_base_state_machine *sm)
{
- struct scic_sds_phy *sci_phy = object;
+ struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), state_machine);
isci_timer_stop(sci_phy->sata_timeout_timer);
}
-static void scic_sds_phy_starting_await_sig_fis_uf_substate_enter(void *object)
+static void scic_sds_phy_starting_await_sig_fis_uf_substate_enter(struct sci_base_state_machine *sm)
{
- struct scic_sds_phy *sci_phy = object;
+ struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), state_machine);
if (scic_sds_port_link_detected(sci_phy->owning_port, sci_phy)) {
@@ -1118,16 +1117,16 @@ static void scic_sds_phy_starting_await_sig_fis_uf_substate_enter(void *object)
sci_phy->is_in_link_training = false;
}
-static void scic_sds_phy_starting_await_sig_fis_uf_substate_exit(void *object)
+static void scic_sds_phy_starting_await_sig_fis_uf_substate_exit(struct sci_base_state_machine *sm)
{
- struct scic_sds_phy *sci_phy = object;
+ struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), state_machine);
isci_timer_stop(sci_phy->sata_timeout_timer);
}
-static void scic_sds_phy_starting_final_substate_enter(void *object)
+static void scic_sds_phy_starting_final_substate_enter(struct sci_base_state_machine *sm)
{
- struct scic_sds_phy *sci_phy = object;
+ struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), state_machine);
/* State machine has run to completion so exit out and change
* the base state machine to the ready state
@@ -1217,9 +1216,9 @@ static void scu_link_layer_tx_hard_reset(
&sci_phy->link_layer_registers->phy_configuration);
}
-static void scic_sds_phy_stopped_state_enter(void *object)
+static void scic_sds_phy_stopped_state_enter(struct sci_base_state_machine *sm)
{
- struct scic_sds_phy *sci_phy = object;
+ struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), state_machine);
struct scic_sds_port *sci_port = sci_phy->owning_port;
struct scic_sds_controller *scic = sci_port->owning_controller;
struct isci_host *ihost = scic_to_ihost(scic);
@@ -1242,9 +1241,9 @@ static void scic_sds_phy_stopped_state_enter(void *object)
sci_phy);
}
-static void scic_sds_phy_starting_state_enter(void *object)
+static void scic_sds_phy_starting_state_enter(struct sci_base_state_machine *sm)
{
- struct scic_sds_phy *sci_phy = object;
+ struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), state_machine);
scu_link_layer_stop_protocol_engine(sci_phy);
scu_link_layer_start_oob(sci_phy);
@@ -1262,9 +1261,9 @@ static void scic_sds_phy_starting_state_enter(void *object)
SCIC_SDS_PHY_STARTING_SUBSTATE_INITIAL);
}
-static void scic_sds_phy_ready_state_enter(void *object)
+static void scic_sds_phy_ready_state_enter(struct sci_base_state_machine *sm)
{
- struct scic_sds_phy *sci_phy = object;
+ struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), state_machine);
scic_sds_controller_link_up(scic_sds_phy_get_controller(sci_phy),
phy_get_non_dummy_port(sci_phy),
@@ -1272,16 +1271,16 @@ static void scic_sds_phy_ready_state_enter(void *object)
}
-static void scic_sds_phy_ready_state_exit(void *object)
+static void scic_sds_phy_ready_state_exit(struct sci_base_state_machine *sm)
{
- struct scic_sds_phy *sci_phy = object;
+ struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), state_machine);
scic_sds_phy_suspend(sci_phy);
}
-static void scic_sds_phy_resetting_state_enter(void *object)
+static void scic_sds_phy_resetting_state_enter(struct sci_base_state_machine *sm)
{
- struct scic_sds_phy *sci_phy = object;
+ struct scic_sds_phy *sci_phy = container_of(sm, typeof(*sci_phy), state_machine);
/* The phy is being reset, therefore deactivate it from the port. In
* the resetting state we don't notify the user regarding link up and
@@ -1351,7 +1350,6 @@ void scic_sds_phy_construct(struct scic_sds_phy *sci_phy,
struct scic_sds_port *owning_port, u8 phy_index)
{
sci_base_state_machine_construct(&sci_phy->state_machine,
- sci_phy,
scic_sds_phy_state_table,
SCI_BASE_PHY_STATE_INITIAL);
OpenPOWER on IntegriCloud