isci: Removed sci_base_object from scic_sds_phy.
authorMaciej Patelczyk <maciej.patelczyk@intel.com>
Thu, 28 Apr 2011 22:06:11 +0000 (22:06 +0000)
committerDan Williams <dan.j.williams@intel.com>
Sun, 3 Jul 2011 11:00:38 +0000 (04:00 -0700)
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 <maciej.patelczyk@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
drivers/scsi/isci/core/scic_sds_phy.c
drivers/scsi/isci/core/scic_sds_phy.h
drivers/scsi/isci/core/scic_sds_port.c
drivers/scsi/isci/phy.c
drivers/scsi/isci/port.c
drivers/scsi/isci/sci_environment.h

index 3b53968..c935c04 100644 (file)
@@ -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);
 }
index fb99d47..fca95c1 100644 (file)
@@ -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.
index 857482b..d6339c4 100644 (file)
@@ -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);
 
index 9e081a4..a690b6b 100644 (file)
@@ -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");
index c0916b1..d600b09 100644 (file)
@@ -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;
 
index 6be9274..744016d 100644 (file)
@@ -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;