isci: Removed sci_base_object from scic_sds_remote_device.
authorMaciej Patelczyk <maciej.patelczyk@intel.com>
Thu, 28 Apr 2011 22:06:21 +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_remote_device.

Signed-off-by: Maciej Patelczyk <maciej.patelczyk@intel.com>
[cleaned up sci_dev_to_idev]
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
drivers/scsi/isci/remote_device.c
drivers/scsi/isci/remote_device.h
drivers/scsi/isci/sci_environment.h
drivers/scsi/isci/smp_remote_device.c
drivers/scsi/isci/stp_remote_device.c

index bb696cf11f2c5beccca8f90d2f4d80cc5d54c404..3fc66b2a5992ac1ed15563b5ac4aed38e1dc04b6 100644 (file)
@@ -1101,9 +1101,8 @@ static const struct scic_sds_remote_device_state_handler scic_sds_remote_device_
 
 static void scic_sds_remote_device_initial_state_enter(void *object)
 {
-       struct scic_sds_remote_device *sci_dev = (struct scic_sds_remote_device *)object;
+       struct scic_sds_remote_device *sci_dev = object;
 
-       sci_dev = container_of(object, typeof(*sci_dev), parent);
        SET_STATE_HANDLER(sci_dev, scic_sds_remote_device_state_handler_table,
                          SCI_BASE_REMOTE_DEVICE_STATE_INITIAL);
 
@@ -1203,16 +1202,15 @@ static void isci_remote_device_stop_complete(struct isci_host *ihost,
 
 static void scic_sds_remote_device_stopped_state_enter(void *object)
 {
-       struct scic_sds_remote_device *sci_dev;
+       struct scic_sds_remote_device *sci_dev = object;
        struct scic_sds_controller *scic;
        struct isci_remote_device *idev;
        struct isci_host *ihost;
        u32 prev_state;
 
-       sci_dev = container_of(object, typeof(*sci_dev), parent);
        scic = scic_sds_remote_device_get_controller(sci_dev);
        ihost = scic->ihost;
-       idev = sci_object_get_association(sci_dev);
+       idev = sci_dev_to_idev(sci_dev);
 
        SET_STATE_HANDLER(sci_dev, scic_sds_remote_device_state_handler_table,
                          SCI_BASE_REMOTE_DEVICE_STATE_STOPPED);
@@ -1229,11 +1227,10 @@ static void scic_sds_remote_device_stopped_state_enter(void *object)
 
 static void scic_sds_remote_device_starting_state_enter(void *object)
 {
-       struct scic_sds_remote_device *sci_dev = container_of(object, typeof(*sci_dev),
-                                                             parent);
+       struct scic_sds_remote_device *sci_dev = object;
        struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev);
        struct isci_host *ihost = scic->ihost;
-       struct isci_remote_device *idev = sci_object_get_association(sci_dev);
+       struct isci_remote_device *idev = sci_dev_to_idev(sci_dev);
 
        SET_STATE_HANDLER(sci_dev, scic_sds_remote_device_state_handler_table,
                          SCI_BASE_REMOTE_DEVICE_STATE_STARTING);
@@ -1244,11 +1241,10 @@ static void scic_sds_remote_device_starting_state_enter(void *object)
 
 static void scic_sds_remote_device_ready_state_enter(void *object)
 {
-       struct scic_sds_remote_device *sci_dev = container_of(object, typeof(*sci_dev),
-                                                             parent);
+       struct scic_sds_remote_device *sci_dev = object;
        struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev);
        struct isci_host *ihost = scic->ihost;
-       struct isci_remote_device *idev = sci_object_get_association(sci_dev);
+       struct isci_remote_device *idev = sci_dev_to_idev(sci_dev);
 
        SET_STATE_HANDLER(sci_dev,
                          scic_sds_remote_device_state_handler_table,
@@ -1264,14 +1260,13 @@ static void scic_sds_remote_device_ready_state_enter(void *object)
 
 static void scic_sds_remote_device_ready_state_exit(void *object)
 {
-       struct scic_sds_remote_device *sci_dev = container_of(object, typeof(*sci_dev),
-                                                             parent);
+       struct scic_sds_remote_device *sci_dev = object;
        if (sci_dev->has_ready_substate_machine)
                sci_base_state_machine_stop(&sci_dev->ready_substate_machine);
        else {
                struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev);
                struct isci_host *ihost = scic->ihost;
-               struct isci_remote_device *idev = sci_object_get_association(sci_dev);
+               struct isci_remote_device *idev = sci_dev_to_idev(sci_dev);
 
                isci_remote_device_not_ready(ihost, idev,
                                             SCIC_REMOTE_DEVICE_NOT_READY_STOP_REQUESTED);
@@ -1280,7 +1275,7 @@ static void scic_sds_remote_device_ready_state_exit(void *object)
 
 static void scic_sds_remote_device_stopping_state_enter(void *object)
 {
-       struct scic_sds_remote_device *sci_dev = (struct scic_sds_remote_device *)object;
+       struct scic_sds_remote_device *sci_dev = object;
 
        SET_STATE_HANDLER(
                sci_dev,
@@ -1291,7 +1286,7 @@ static void scic_sds_remote_device_stopping_state_enter(void *object)
 
 static void scic_sds_remote_device_failed_state_enter(void *object)
 {
-       struct scic_sds_remote_device *sci_dev = (struct scic_sds_remote_device *)object;
+       struct scic_sds_remote_device *sci_dev = object;
 
        SET_STATE_HANDLER(
                sci_dev,
@@ -1302,7 +1297,7 @@ static void scic_sds_remote_device_failed_state_enter(void *object)
 
 static void scic_sds_remote_device_resetting_state_enter(void *object)
 {
-       struct scic_sds_remote_device *sci_dev = (struct scic_sds_remote_device *)object;
+       struct scic_sds_remote_device *sci_dev = object;
 
        SET_STATE_HANDLER(
                sci_dev,
@@ -1316,14 +1311,14 @@ static void scic_sds_remote_device_resetting_state_enter(void *object)
 
 static void scic_sds_remote_device_resetting_state_exit(void *object)
 {
-       struct scic_sds_remote_device *sci_dev = (struct scic_sds_remote_device *)object;
+       struct scic_sds_remote_device *sci_dev = object;
 
        scic_sds_remote_node_context_resume(&sci_dev->rnc, NULL, NULL);
 }
 
 static void scic_sds_remote_device_final_state_enter(void *object)
 {
-       struct scic_sds_remote_device *sci_dev = (struct scic_sds_remote_device *)object;
+       struct scic_sds_remote_device *sci_dev = object;
 
        SET_STATE_HANDLER(
                sci_dev,
@@ -1377,11 +1372,10 @@ static void scic_remote_device_construct(struct scic_sds_port *sci_port,
 {
        sci_dev->owning_port = sci_port;
        sci_dev->started_request_count = 0;
-       sci_dev->parent.private = NULL;
 
        sci_base_state_machine_construct(
                &sci_dev->state_machine,
-               &sci_dev->parent,
+               sci_dev,
                scic_sds_remote_device_state_table,
                SCI_BASE_REMOTE_DEVICE_STATE_INITIAL
                );
@@ -1440,7 +1434,7 @@ static enum sci_status scic_remote_device_da_construct(struct scic_sds_port *sci
 
                sci_base_state_machine_construct(
                                &sci_dev->ready_substate_machine,
-                               &sci_dev->parent,
+                               sci_dev,
                                scic_sds_stp_remote_device_ready_substate_table,
                                SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_IDLE);
        } else if (dev_is_expander(dev)) {
@@ -1449,7 +1443,7 @@ static enum sci_status scic_remote_device_da_construct(struct scic_sds_port *sci
                /* add the SMP ready substate machine construction here */
                sci_base_state_machine_construct(
                                &sci_dev->ready_substate_machine,
-                               &sci_dev->parent,
+                               sci_dev,
                                scic_sds_smp_remote_device_ready_substate_table,
                                SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_IDLE);
        } else
@@ -1497,7 +1491,7 @@ static enum sci_status scic_remote_device_ea_construct(struct scic_sds_port *sci
                /* add the SMP ready substate machine construction here */
                sci_base_state_machine_construct(
                                &sci_dev->ready_substate_machine,
-                               &sci_dev->parent,
+                               sci_dev,
                                scic_sds_smp_remote_device_ready_substate_table,
                                SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_IDLE);
        } else if (dev->dev_type == SATA_DEV || (dev->tproto & SAS_PROTOCOL_STP)) {
@@ -1505,7 +1499,7 @@ static enum sci_status scic_remote_device_ea_construct(struct scic_sds_port *sci
 
                sci_base_state_machine_construct(
                                &sci_dev->ready_substate_machine,
-                               &sci_dev->parent,
+                               sci_dev,
                                scic_sds_stp_remote_device_ready_substate_table,
                                SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_IDLE);
        }
@@ -1565,9 +1559,6 @@ static enum sci_status isci_remote_device_construct(struct isci_port *iport,
                return status;
        }
 
-       /* XXX will be killed with sci_base_object removal */
-       sci_object_set_association(&idev->sci, idev);
-
        /* start the device. */
        status = scic_remote_device_start(&idev->sci, ISCI_REMOTE_DEVICE_START_TIMEOUT);
 
index 5cceb6c5dc1ddc7d0bc7b403cca4b7e219ff6820..62623c766388e5d52a6eab775ef16f7ceefac2cf 100644 (file)
@@ -74,12 +74,6 @@ enum scic_remote_device_not_ready_reason_code {
 };
 
 struct scic_sds_remote_device {
-       /**
-        * The field specifies that the parent object for the base remote
-        * device is the base object itself.
-        */
-       struct sci_base_object parent;
-
        /**
         * This field contains the information for the base remote device state
         * machine.
@@ -417,11 +411,16 @@ static inline struct scic_sds_remote_device *rnc_to_dev(struct scic_sds_remote_n
        return sci_dev;
 }
 
-static inline struct domain_device *sci_dev_to_domain(struct scic_sds_remote_device *sci_dev)
+static inline struct isci_remote_device *sci_dev_to_idev(struct scic_sds_remote_device *sci_dev)
 {
        struct isci_remote_device *idev = container_of(sci_dev, typeof(*idev), sci);
 
-       return idev->domain_dev;
+       return idev;
+}
+
+static inline struct domain_device *sci_dev_to_domain(struct scic_sds_remote_device *sci_dev)
+{
+       return sci_dev_to_idev(sci_dev)->domain_dev;
 }
 
 static inline bool dev_is_expander(struct domain_device *dev)
index 3fb54ddaee1a25b42b0a65d9652e44844410a7c5..41636c34da9ee0942c3cd0bf9e788b0a25387406 100644 (file)
@@ -59,7 +59,6 @@
 #include "isci.h"
 #include "core/scic_sds_controller.h"
 
-struct scic_sds_remote_device;
 
 static inline struct device *scic_to_dev(struct scic_sds_controller *scic)
 {
@@ -88,9 +87,11 @@ static inline struct device *sciport_to_dev(struct scic_sds_port *sci_port)
        return &iport->isci_host->pdev->dev;
 }
 
-static inline struct device *scirdev_to_dev(struct scic_sds_remote_device *sci_dev)
+static inline struct device *scirdev_to_dev(
+               struct scic_sds_remote_device *sci_dev)
 {
-       struct isci_remote_device *idev = sci_object_get_association(sci_dev);
+       struct isci_remote_device *idev =
+                       container_of(sci_dev, typeof(*idev), sci);
 
        if (!idev || !idev->isci_port || !idev->isci_port->isci_host)
                return NULL;
index aae5c80c1341025b974fc277f6f0407206446520..45340a5c99c7cb7b1a6f981b20fe5865ad1480b7 100644 (file)
@@ -246,11 +246,10 @@ static const struct scic_sds_remote_device_state_handler scic_sds_smp_remote_dev
  */
 static void scic_sds_smp_remote_device_ready_idle_substate_enter(void *object)
 {
-       struct scic_sds_remote_device *sci_dev = container_of(object, typeof(*sci_dev),
-                                                             parent);
+       struct scic_sds_remote_device *sci_dev = object;
        struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev);
        struct isci_host *ihost = scic->ihost;
-       struct isci_remote_device *idev = sci_object_get_association(sci_dev);
+       struct isci_remote_device *idev = sci_dev_to_idev(sci_dev);
 
        SET_STATE_HANDLER(sci_dev,
                          scic_sds_smp_remote_device_ready_substate_handler_table,
@@ -270,11 +269,10 @@ static void scic_sds_smp_remote_device_ready_idle_substate_enter(void *object)
  */
 static void scic_sds_smp_remote_device_ready_cmd_substate_enter(void *object)
 {
-       struct scic_sds_remote_device *sci_dev = container_of(object, typeof(*sci_dev),
-                                                             parent);
+       struct scic_sds_remote_device *sci_dev = object;
        struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev);
        struct isci_host *ihost = scic->ihost;
-       struct isci_remote_device *idev = sci_object_get_association(sci_dev);
+       struct isci_remote_device *idev = sci_dev_to_idev(sci_dev);
 
        BUG_ON(sci_dev->working_request == NULL);
 
@@ -295,8 +293,7 @@ static void scic_sds_smp_remote_device_ready_cmd_substate_enter(void *object)
  */
 static void scic_sds_smp_remote_device_ready_cmd_substate_exit(void *object)
 {
-       struct scic_sds_remote_device *sci_dev = container_of(object, typeof(*sci_dev),
-                                                             parent);
+       struct scic_sds_remote_device *sci_dev = object;
        sci_dev->working_request = NULL;
 }
 
index c1c2f9b87cacc22961c7e319125ee902954123fc..d869764694283990a848f1bef55b97d9cb09a563 100644 (file)
@@ -580,7 +580,7 @@ static void
 scic_sds_stp_remote_device_ready_idle_substate_resume_complete_handler(void *user_cookie)
 {
        struct scic_sds_remote_device *sci_dev = user_cookie;
-       struct isci_remote_device *idev = sci_object_get_association(sci_dev);
+       struct isci_remote_device *idev = sci_dev_to_idev(sci_dev);
        struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev);
        struct isci_host *ihost = scic->ihost;
 
@@ -607,9 +607,7 @@ scic_sds_stp_remote_device_ready_idle_substate_resume_complete_handler(void *use
  */
 static void scic_sds_stp_remote_device_ready_idle_substate_enter(void *device)
 {
-       struct scic_sds_remote_device *sci_dev;
-
-       sci_dev = (struct scic_sds_remote_device *)device;
+       struct scic_sds_remote_device *sci_dev = device;
 
        SET_STATE_HANDLER(
                sci_dev,
@@ -636,11 +634,10 @@ static void scic_sds_stp_remote_device_ready_idle_substate_enter(void *device)
 
 static void scic_sds_stp_remote_device_ready_cmd_substate_enter(void *object)
 {
-       struct scic_sds_remote_device *sci_dev = container_of(object, typeof(*sci_dev),
-                                                             parent);
+       struct scic_sds_remote_device *sci_dev = object;
        struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev);
        struct isci_host *ihost = scic->ihost;
-       struct isci_remote_device *idev = sci_object_get_association(sci_dev);
+       struct isci_remote_device *idev = sci_dev_to_idev(sci_dev);
 
        BUG_ON(sci_dev->working_request == NULL);
 
@@ -654,8 +651,7 @@ static void scic_sds_stp_remote_device_ready_cmd_substate_enter(void *object)
 
 static void scic_sds_stp_remote_device_ready_ncq_substate_enter(void *object)
 {
-       struct scic_sds_remote_device *sci_dev = container_of(object, typeof(*sci_dev),
-                                                             parent);
+       struct scic_sds_remote_device *sci_dev = object;
        SET_STATE_HANDLER(sci_dev,
                          scic_sds_stp_remote_device_ready_substate_handler_table,
                          SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ);
@@ -664,11 +660,10 @@ static void scic_sds_stp_remote_device_ready_ncq_substate_enter(void *object)
 static void scic_sds_stp_remote_device_ready_ncq_error_substate_enter(
                void *object)
 {
-       struct scic_sds_remote_device *sci_dev = container_of(object, typeof(*sci_dev),
-                                                             parent);
+       struct scic_sds_remote_device *sci_dev = object;
        struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev);
        struct isci_host *ihost = scic->ihost;
-       struct isci_remote_device *idev = sci_object_get_association(sci_dev);
+       struct isci_remote_device *idev = sci_dev_to_idev(sci_dev);
 
        SET_STATE_HANDLER(sci_dev,
                          scic_sds_stp_remote_device_ready_substate_handler_table,