From e1e72a00dd9db0cd2b7d106916645626f53c0382 Mon Sep 17 00:00:00 2001 From: Maciej Patelczyk Date: Thu, 28 Apr 2011 22:06:11 +0000 Subject: [PATCH] isci: Removed sci_base_object from scic_sds_phy. The 'struct sci_base_object' was removed from the struct scic_sds_phy and was replaced by a pointer to struct isci_phy. Signed-off-by: Maciej Patelczyk Signed-off-by: Dan Williams --- drivers/scsi/isci/core/scic_sds_phy.c | 83 ++++++++------------------ drivers/scsi/isci/core/scic_sds_phy.h | 5 +- drivers/scsi/isci/core/scic_sds_port.c | 2 +- drivers/scsi/isci/phy.c | 3 +- drivers/scsi/isci/port.c | 6 +- drivers/scsi/isci/sci_environment.h | 2 +- 6 files changed, 33 insertions(+), 68 deletions(-) diff --git a/drivers/scsi/isci/core/scic_sds_phy.c b/drivers/scsi/isci/core/scic_sds_phy.c index 3b53968abb0..c935c048247 100644 --- a/drivers/scsi/isci/core/scic_sds_phy.c +++ b/drivers/scsi/isci/core/scic_sds_phy.c @@ -1565,9 +1565,7 @@ static const struct scic_sds_phy_state_handler scic_sds_phy_starting_substate_ha */ static void scic_sds_phy_starting_initial_substate_enter(void *object) { - struct scic_sds_phy *sci_phy; - - sci_phy = (struct scic_sds_phy *)object; + struct scic_sds_phy *sci_phy = object; scic_sds_phy_set_starting_substate_handlers( sci_phy, SCIC_SDS_PHY_STARTING_SUBSTATE_INITIAL); @@ -1587,9 +1585,7 @@ static void scic_sds_phy_starting_initial_substate_enter(void *object) */ static void scic_sds_phy_starting_await_ossp_en_substate_enter(void *object) { - struct scic_sds_phy *sci_phy; - - sci_phy = (struct scic_sds_phy *)object; + struct scic_sds_phy *sci_phy = object; scic_sds_phy_set_starting_substate_handlers( sci_phy, SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_OSSP_EN @@ -1607,9 +1603,7 @@ static void scic_sds_phy_starting_await_ossp_en_substate_enter(void *object) static void scic_sds_phy_starting_await_sas_speed_en_substate_enter( void *object) { - struct scic_sds_phy *sci_phy; - - sci_phy = (struct scic_sds_phy *)object; + struct scic_sds_phy *sci_phy = object; scic_sds_phy_set_starting_substate_handlers( sci_phy, SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SAS_SPEED_EN @@ -1626,9 +1620,7 @@ static void scic_sds_phy_starting_await_sas_speed_en_substate_enter( */ static void scic_sds_phy_starting_await_iaf_uf_substate_enter(void *object) { - struct scic_sds_phy *sci_phy; - - sci_phy = (struct scic_sds_phy *)object; + struct scic_sds_phy *sci_phy = object; scic_sds_phy_set_starting_substate_handlers( sci_phy, SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_IAF_UF @@ -1646,9 +1638,7 @@ static void scic_sds_phy_starting_await_iaf_uf_substate_enter(void *object) */ static void scic_sds_phy_starting_await_sas_power_substate_enter(void *object) { - struct scic_sds_phy *sci_phy; - - sci_phy = (struct scic_sds_phy *)object; + struct scic_sds_phy *sci_phy = object; scic_sds_phy_set_starting_substate_handlers( sci_phy, SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SAS_POWER @@ -1670,9 +1660,7 @@ static void scic_sds_phy_starting_await_sas_power_substate_enter(void *object) */ static void scic_sds_phy_starting_await_sas_power_substate_exit(void *object) { - struct scic_sds_phy *sci_phy; - - sci_phy = (struct scic_sds_phy *)object; + struct scic_sds_phy *sci_phy = object; scic_sds_controller_power_control_queue_remove( scic_sds_phy_get_controller(sci_phy), sci_phy @@ -1690,9 +1678,7 @@ static void scic_sds_phy_starting_await_sas_power_substate_exit(void *object) */ static void scic_sds_phy_starting_await_sata_power_substate_enter(void *object) { - struct scic_sds_phy *sci_phy; - - sci_phy = (struct scic_sds_phy *)object; + struct scic_sds_phy *sci_phy = object; scic_sds_phy_set_starting_substate_handlers( sci_phy, SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_POWER @@ -1714,9 +1700,7 @@ static void scic_sds_phy_starting_await_sata_power_substate_enter(void *object) */ static void scic_sds_phy_starting_await_sata_power_substate_exit(void *object) { - struct scic_sds_phy *sci_phy; - - sci_phy = (struct scic_sds_phy *)object; + struct scic_sds_phy *sci_phy = object; scic_sds_controller_power_control_queue_remove( scic_sds_phy_get_controller(sci_phy), @@ -1734,7 +1718,7 @@ static void scic_sds_phy_starting_await_sata_power_substate_exit(void *object) */ static void scic_sds_phy_starting_await_sata_phy_substate_enter(void *object) { - struct scic_sds_phy *sci_phy = (struct scic_sds_phy *)object; + struct scic_sds_phy *sci_phy = object; scic_sds_phy_set_starting_substate_handlers( sci_phy, @@ -1756,7 +1740,7 @@ static void scic_sds_phy_starting_await_sata_phy_substate_enter(void *object) static inline void scic_sds_phy_starting_await_sata_phy_substate_exit( void *object) { - struct scic_sds_phy *sci_phy = (struct scic_sds_phy *)object; + struct scic_sds_phy *sci_phy = object; isci_timer_stop(sci_phy->sata_timeout_timer); } @@ -1771,7 +1755,7 @@ static inline void scic_sds_phy_starting_await_sata_phy_substate_exit( */ static void scic_sds_phy_starting_await_sata_speed_substate_enter(void *object) { - struct scic_sds_phy *sci_phy = (struct scic_sds_phy *)object; + struct scic_sds_phy *sci_phy = object; scic_sds_phy_set_starting_substate_handlers( sci_phy, @@ -1793,7 +1777,7 @@ static void scic_sds_phy_starting_await_sata_speed_substate_enter(void *object) static inline void scic_sds_phy_starting_await_sata_speed_substate_exit( void *object) { - struct scic_sds_phy *sci_phy = (struct scic_sds_phy *)object; + struct scic_sds_phy *sci_phy = object; isci_timer_stop(sci_phy->sata_timeout_timer); } @@ -1811,7 +1795,7 @@ static inline void scic_sds_phy_starting_await_sata_speed_substate_exit( static void scic_sds_phy_starting_await_sig_fis_uf_substate_enter(void *object) { bool continue_to_ready_state; - struct scic_sds_phy *sci_phy = (struct scic_sds_phy *)object; + struct scic_sds_phy *sci_phy = object; scic_sds_phy_set_starting_substate_handlers( sci_phy, @@ -1848,9 +1832,7 @@ static void scic_sds_phy_starting_await_sig_fis_uf_substate_enter(void *object) static inline void scic_sds_phy_starting_await_sig_fis_uf_substate_exit( void *object) { - struct scic_sds_phy *sci_phy; - - sci_phy = (struct scic_sds_phy *)object; + struct scic_sds_phy *sci_phy = object; isci_timer_stop(sci_phy->sata_timeout_timer); } @@ -1866,9 +1848,7 @@ static inline void scic_sds_phy_starting_await_sig_fis_uf_substate_exit( */ static void scic_sds_phy_starting_final_substate_enter(void *object) { - struct scic_sds_phy *sci_phy; - - sci_phy = container_of(object, typeof(*sci_phy), parent); + struct scic_sds_phy *sci_phy = object; scic_sds_phy_set_starting_substate_handlers(sci_phy, SCIC_SDS_PHY_STARTING_SUBSTATE_FINAL); @@ -2200,9 +2180,7 @@ static void scu_link_layer_tx_hard_reset( */ static void scic_sds_phy_initial_state_enter(void *object) { - struct scic_sds_phy *sci_phy; - - sci_phy = (struct scic_sds_phy *)object; + struct scic_sds_phy *sci_phy = object; scic_sds_phy_set_base_state_handlers(sci_phy, SCI_BASE_PHY_STATE_INITIAL); } @@ -2218,12 +2196,10 @@ static void scic_sds_phy_initial_state_enter(void *object) */ static void scic_sds_phy_stopped_state_enter(void *object) { - struct scic_sds_phy *sci_phy = (struct scic_sds_phy *)object; + struct scic_sds_phy *sci_phy = object; struct scic_sds_controller *scic = scic_sds_phy_get_controller(sci_phy); struct isci_host *ihost = scic->ihost; - sci_phy = (struct scic_sds_phy *)object; - /* * @todo We need to get to the controller to place this PE in a * reset state @@ -2262,9 +2238,7 @@ static void scic_sds_phy_stopped_state_enter(void *object) */ static void scic_sds_phy_starting_state_enter(void *object) { - struct scic_sds_phy *sci_phy; - - sci_phy = (struct scic_sds_phy *)object; + struct scic_sds_phy *sci_phy = object; scic_sds_phy_set_base_state_handlers(sci_phy, SCI_BASE_PHY_STATE_STARTING); @@ -2300,9 +2274,7 @@ static void scic_sds_phy_starting_state_enter(void *object) */ static void scic_sds_phy_ready_state_enter(void *object) { - struct scic_sds_phy *sci_phy; - - sci_phy = (struct scic_sds_phy *)object; + struct scic_sds_phy *sci_phy = object; scic_sds_phy_set_base_state_handlers(sci_phy, SCI_BASE_PHY_STATE_READY); @@ -2323,9 +2295,7 @@ static void scic_sds_phy_ready_state_enter(void *object) */ static void scic_sds_phy_ready_state_exit(void *object) { - struct scic_sds_phy *sci_phy; - - sci_phy = (struct scic_sds_phy *)object; + struct scic_sds_phy *sci_phy = object; scic_sds_phy_suspend(sci_phy); } @@ -2340,9 +2310,7 @@ static void scic_sds_phy_ready_state_exit(void *object) */ static void scic_sds_phy_resetting_state_enter(void *object) { - struct scic_sds_phy *sci_phy; - - sci_phy = (struct scic_sds_phy *)object; + struct scic_sds_phy *sci_phy = object; scic_sds_phy_set_base_state_handlers(sci_phy, SCI_BASE_PHY_STATE_RESETTING); @@ -2375,9 +2343,7 @@ static void scic_sds_phy_resetting_state_enter(void *object) */ static void scic_sds_phy_final_state_enter(void *object) { - struct scic_sds_phy *sci_phy; - - sci_phy = (struct scic_sds_phy *)object; + struct scic_sds_phy *sci_phy = object; scic_sds_phy_set_base_state_handlers(sci_phy, SCI_BASE_PHY_STATE_FINAL); @@ -2412,9 +2378,8 @@ void scic_sds_phy_construct(struct scic_sds_phy *sci_phy, struct scic_sds_port *owning_port, u8 phy_index) { - sci_phy->parent.private = NULL; sci_base_state_machine_construct(&sci_phy->state_machine, - &sci_phy->parent, + sci_phy, scic_sds_phy_state_table, SCI_BASE_PHY_STATE_INITIAL); @@ -2434,7 +2399,7 @@ void scic_sds_phy_construct(struct scic_sds_phy *sci_phy, /* Initialize the the substate machines */ sci_base_state_machine_construct(&sci_phy->starting_substate_machine, - &sci_phy->parent, + sci_phy, scic_sds_phy_starting_substates, SCIC_SDS_PHY_STARTING_SUBSTATE_INITIAL); } diff --git a/drivers/scsi/isci/core/scic_sds_phy.h b/drivers/scsi/isci/core/scic_sds_phy.h index fb99d472ce6..fca95c1c027 100644 --- a/drivers/scsi/isci/core/scic_sds_phy.h +++ b/drivers/scsi/isci/core/scic_sds_phy.h @@ -217,6 +217,7 @@ enum scic_sds_phy_protocol { SCIC_SDS_MAX_PHY_PROTOCOLS }; +struct isci_phy; /** * struct scic_sds_phy - This structure contains or references all of the data * necessary to represent the core phy object and SCU harware protocol @@ -226,9 +227,9 @@ enum scic_sds_phy_protocol { */ struct scic_sds_phy { /** - * This field depicts the parent object (struct sci_base_object) for the phy. + * This field depicts the peer object for the phy. */ - struct sci_base_object parent; + struct isci_phy *iphy; /** * This field contains the information for the base phy state machine. diff --git a/drivers/scsi/isci/core/scic_sds_port.c b/drivers/scsi/isci/core/scic_sds_port.c index 857482b27ff..d6339c41c39 100644 --- a/drivers/scsi/isci/core/scic_sds_port.c +++ b/drivers/scsi/isci/core/scic_sds_port.c @@ -680,7 +680,7 @@ void scic_sds_port_deactivate_phy(struct scic_sds_port *sci_port, struct scic_sds_controller *scic = scic_sds_port_get_controller(sci_port); struct isci_port *iport = sci_object_get_association(sci_port); struct isci_host *ihost = scic->ihost; - struct isci_phy *iphy = sci_object_get_association(sci_phy); + struct isci_phy *iphy = sci_phy->iphy; sci_port->active_phy_mask &= ~(1 << sci_phy->phy_index); diff --git a/drivers/scsi/isci/phy.c b/drivers/scsi/isci/phy.c index 9e081a4c8a3..a690b6b664f 100644 --- a/drivers/scsi/isci/phy.c +++ b/drivers/scsi/isci/phy.c @@ -57,6 +57,7 @@ #include "phy.h" #include "scic_port.h" #include "scic_config_parameters.h" +#include "core/scic_sds_phy.h" struct scic_sds_phy; extern enum sci_status scic_sds_phy_start(struct scic_sds_phy *sci_phy); @@ -88,8 +89,8 @@ void isci_phy_init( status = scic_controller_get_phy_handle(scic, index, &scic_phy); if (status == SCI_SUCCESS) { - sci_object_set_association(scic_phy, (void *)phy); phy->sci_phy_handle = scic_phy; + scic_phy->iphy = phy; } else dev_err(&isci_host->pdev->dev, "failed scic_controller_get_phy_handle\n"); diff --git a/drivers/scsi/isci/port.c b/drivers/scsi/isci/port.c index c0916b199b7..d600b09192e 100644 --- a/drivers/scsi/isci/port.c +++ b/drivers/scsi/isci/port.c @@ -137,8 +137,7 @@ void isci_port_bc_change_received( struct scic_sds_port *port, struct scic_sds_phy *phy) { - struct isci_phy *isci_phy = - (struct isci_phy *)sci_object_get_association(phy); + struct isci_phy *isci_phy = phy->iphy; dev_dbg(&isci_host->pdev->dev, "%s: isci_phy = %p, sas_phy = %p\n", @@ -170,10 +169,9 @@ void isci_port_link_up( { unsigned long flags; struct scic_port_properties properties; - struct isci_phy *isci_phy - = (struct isci_phy *)sci_object_get_association(phy); struct isci_port *isci_port = (struct isci_port *)sci_object_get_association(port); + struct isci_phy *isci_phy = phy->iphy; enum sci_status call_status; unsigned long success = true; diff --git a/drivers/scsi/isci/sci_environment.h b/drivers/scsi/isci/sci_environment.h index 6be9274975d..744016dffec 100644 --- a/drivers/scsi/isci/sci_environment.h +++ b/drivers/scsi/isci/sci_environment.h @@ -73,7 +73,7 @@ static inline struct device *scic_to_dev(struct scic_sds_controller *scic) static inline struct device *sciphy_to_dev(struct scic_sds_phy *sci_phy) { - struct isci_phy *iphy = sci_object_get_association(sci_phy); + struct isci_phy *iphy = sci_phy->iphy; if (!iphy || !iphy->isci_port || !iphy->isci_port->isci_host) return NULL; -- 2.46.0