diff options
author | Dan Williams <dan.j.williams@intel.com> | 2011-05-12 15:02:07 +0400 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2011-07-03 15:04:48 +0400 |
commit | 0cf36fa9f1197e669ac6f5efc51d0587bcc95e6e (patch) | |
tree | 570d71d24ba7ffe1410bc04f4004f35e94fd09a4 /drivers | |
parent | 931532364e7966f61683bdf40fa1698d6707f523 (diff) | |
download | linux-0cf36fa9f1197e669ac6f5efc51d0587bcc95e6e.tar.xz |
isci: unify phy reset handlers
Unify the implementations in scic_sds_phy_reset(), and kill the state handler
Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/scsi/isci/phy.c | 53 | ||||
-rw-r--r-- | drivers/scsi/isci/phy.h | 6 |
2 files changed, 12 insertions, 47 deletions
diff --git a/drivers/scsi/isci/phy.c b/drivers/scsi/isci/phy.c index cf8f2e9f6b25..b606e2f317d5 100644 --- a/drivers/scsi/isci/phy.c +++ b/drivers/scsi/isci/phy.c @@ -490,17 +490,19 @@ enum sci_status scic_sds_phy_stop(struct scic_sds_phy *sci_phy) return SCI_SUCCESS; } -/** - * This method will attempt to reset the phy. This request is only valid when - * the phy is in an ready state - * @sci_phy: - * - * enum sci_status - */ -enum sci_status scic_sds_phy_reset( - struct scic_sds_phy *sci_phy) +enum sci_status scic_sds_phy_reset(struct scic_sds_phy *sci_phy) { - return sci_phy->state_handlers->reset_handler(sci_phy); + enum scic_sds_phy_states state = sci_phy->state_machine.current_state_id; + + if (state != SCI_BASE_PHY_STATE_READY) { + dev_dbg(sciphy_to_dev(sci_phy), + "%s: in wrong state: %d\n", __func__, state); + return SCI_FAILURE_INVALID_STATE; + } + + sci_base_state_machine_change_state(&sci_phy->state_machine, + SCI_BASE_PHY_STATE_RESETTING); + return SCI_SUCCESS; } /** @@ -1266,12 +1268,6 @@ static enum sci_status default_phy_handler(struct scic_sds_phy *sci_phy, } static enum sci_status -scic_sds_phy_default_reset_handler(struct scic_sds_phy *sci_phy) -{ - return default_phy_handler(sci_phy, __func__); -} - -static enum sci_status scic_sds_phy_default_destroy_handler(struct scic_sds_phy *sci_phy) { return default_phy_handler(sci_phy, __func__); @@ -1308,15 +1304,6 @@ scic_sds_phy_stopped_state_destroy_handler(struct scic_sds_phy *sci_phy) return SCI_SUCCESS; } -static enum sci_status -scic_sds_phy_ready_state_reset_handler(struct scic_sds_phy *sci_phy) -{ - sci_base_state_machine_change_state(&sci_phy->state_machine, - SCI_BASE_PHY_STATE_RESETTING); - - return SCI_SUCCESS; -} - /** * scic_sds_phy_ready_state_event_handler - * @phy: This is the struct scic_sds_phy object which has received the event. @@ -1392,112 +1379,96 @@ static enum sci_status scic_sds_phy_resetting_state_event_handler(struct scic_sd static const struct scic_sds_phy_state_handler scic_sds_phy_state_handler_table[] = { [SCI_BASE_PHY_STATE_INITIAL] = { - .reset_handler = scic_sds_phy_default_reset_handler, .destruct_handler = scic_sds_phy_default_destroy_handler, .frame_handler = scic_sds_phy_default_frame_handler, .event_handler = scic_sds_phy_default_event_handler, .consume_power_handler = scic_sds_phy_default_consume_power_handler }, [SCI_BASE_PHY_STATE_STOPPED] = { - .reset_handler = scic_sds_phy_default_reset_handler, .destruct_handler = scic_sds_phy_stopped_state_destroy_handler, .frame_handler = scic_sds_phy_default_frame_handler, .event_handler = scic_sds_phy_default_event_handler, .consume_power_handler = scic_sds_phy_default_consume_power_handler }, [SCI_BASE_PHY_STATE_STARTING] = { - .reset_handler = scic_sds_phy_default_reset_handler, .destruct_handler = scic_sds_phy_default_destroy_handler, .frame_handler = scic_sds_phy_default_frame_handler, .event_handler = scic_sds_phy_default_event_handler, .consume_power_handler = scic_sds_phy_default_consume_power_handler }, [SCIC_SDS_PHY_STARTING_SUBSTATE_INITIAL] = { - .reset_handler = scic_sds_phy_default_reset_handler, .destruct_handler = scic_sds_phy_default_destroy_handler, .frame_handler = scic_sds_phy_default_frame_handler, .event_handler = scic_sds_phy_default_event_handler, .consume_power_handler = scic_sds_phy_default_consume_power_handler }, [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_OSSP_EN] = { - .reset_handler = scic_sds_phy_default_reset_handler, .destruct_handler = scic_sds_phy_default_destroy_handler, .frame_handler = scic_sds_phy_default_frame_handler, .event_handler = scic_sds_phy_starting_substate_await_ossp_event_handler, .consume_power_handler = scic_sds_phy_default_consume_power_handler }, [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SAS_SPEED_EN] = { - .reset_handler = scic_sds_phy_default_reset_handler, .destruct_handler = scic_sds_phy_default_destroy_handler, .frame_handler = scic_sds_phy_default_frame_handler, .event_handler = scic_sds_phy_starting_substate_await_sas_phy_speed_event_handler, .consume_power_handler = scic_sds_phy_default_consume_power_handler }, [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_IAF_UF] = { - .reset_handler = scic_sds_phy_default_reset_handler, .destruct_handler = scic_sds_phy_default_destroy_handler, .frame_handler = scic_sds_phy_starting_substate_await_iaf_uf_frame_handler, .event_handler = scic_sds_phy_starting_substate_await_iaf_uf_event_handler, .consume_power_handler = scic_sds_phy_default_consume_power_handler }, [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SAS_POWER] = { - .reset_handler = scic_sds_phy_default_reset_handler, .destruct_handler = scic_sds_phy_default_destroy_handler, .frame_handler = scic_sds_phy_default_frame_handler, .event_handler = scic_sds_phy_starting_substate_await_sas_power_event_handler, .consume_power_handler = scic_sds_phy_starting_substate_await_sas_power_consume_power_handler }, [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_POWER] = { - .reset_handler = scic_sds_phy_default_reset_handler, .destruct_handler = scic_sds_phy_default_destroy_handler, .frame_handler = scic_sds_phy_default_frame_handler, .event_handler = scic_sds_phy_starting_substate_await_sata_power_event_handler, .consume_power_handler = scic_sds_phy_starting_substate_await_sata_power_consume_power_handler }, [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_PHY_EN] = { - .reset_handler = scic_sds_phy_default_reset_handler, .destruct_handler = scic_sds_phy_default_destroy_handler, .frame_handler = scic_sds_phy_default_frame_handler, .event_handler = scic_sds_phy_starting_substate_await_sata_phy_event_handler, .consume_power_handler = scic_sds_phy_default_consume_power_handler }, [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_SPEED_EN] = { - .reset_handler = scic_sds_phy_default_reset_handler, .destruct_handler = scic_sds_phy_default_destroy_handler, .frame_handler = scic_sds_phy_default_frame_handler, .event_handler = scic_sds_phy_starting_substate_await_sata_speed_event_handler, .consume_power_handler = scic_sds_phy_default_consume_power_handler }, [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SIG_FIS_UF] = { - .reset_handler = scic_sds_phy_default_reset_handler, .destruct_handler = scic_sds_phy_default_destroy_handler, .frame_handler = scic_sds_phy_starting_substate_await_sig_fis_frame_handler, .event_handler = scic_sds_phy_starting_substate_await_sig_fis_event_handler, .consume_power_handler = scic_sds_phy_default_consume_power_handler }, [SCIC_SDS_PHY_STARTING_SUBSTATE_FINAL] = { - .reset_handler = scic_sds_phy_default_reset_handler, .destruct_handler = scic_sds_phy_default_destroy_handler, .frame_handler = scic_sds_phy_default_frame_handler, .event_handler = scic_sds_phy_default_event_handler, .consume_power_handler = scic_sds_phy_default_consume_power_handler }, [SCI_BASE_PHY_STATE_READY] = { - .reset_handler = scic_sds_phy_ready_state_reset_handler, .destruct_handler = scic_sds_phy_default_destroy_handler, .frame_handler = scic_sds_phy_default_frame_handler, .event_handler = scic_sds_phy_ready_state_event_handler, .consume_power_handler = scic_sds_phy_default_consume_power_handler }, [SCI_BASE_PHY_STATE_RESETTING] = { - .reset_handler = scic_sds_phy_default_reset_handler, .destruct_handler = scic_sds_phy_default_destroy_handler, .frame_handler = scic_sds_phy_default_frame_handler, .event_handler = scic_sds_phy_resetting_state_event_handler, .consume_power_handler = scic_sds_phy_default_consume_power_handler }, [SCI_BASE_PHY_STATE_FINAL] = { - .reset_handler = scic_sds_phy_default_reset_handler, .destruct_handler = scic_sds_phy_default_destroy_handler, .frame_handler = scic_sds_phy_default_frame_handler, .event_handler = scic_sds_phy_default_event_handler, diff --git a/drivers/scsi/isci/phy.h b/drivers/scsi/isci/phy.h index d829e15eed10..56474333dfca 100644 --- a/drivers/scsi/isci/phy.h +++ b/drivers/scsi/isci/phy.h @@ -512,12 +512,6 @@ typedef enum sci_status (*scic_sds_phy_power_handler_t)(struct scic_sds_phy *); struct scic_sds_phy_state_handler { /** - * The reset_handler specifies the method invoked when there is an - * attempt to reset a phy. - */ - scic_sds_phy_handler_t reset_handler; - - /** * The destruct_handler specifies the method invoked when attempting to * destruct a phy. */ |