isci: remove base_remote_device abstraction
authorMaciej Trela <maciej.trela@intel.com>
Wed, 13 Apr 2011 00:28:35 +0000 (17:28 -0700)
committerDan Williams <dan.j.williams@intel.com>
Sun, 3 Jul 2011 11:00:37 +0000 (04:00 -0700)
Merge struct sci_base_remote_device into scic_sds_remote_device.  As for
now sci_base_remote_device was accessed indirectly using
scic_sds_remote_device->parent field.  Both machine state handlers are
also merged together.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Maciej Trela <Maciej.Trela@intel.com>
Signed-off-by: Maciej Patelczyk <maciej.patelczyk@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
drivers/scsi/isci/core/sci_base_remote_device.h [deleted file]
drivers/scsi/isci/core/scic_sds_controller.c
drivers/scsi/isci/core/scic_sds_remote_device.c
drivers/scsi/isci/core/scic_sds_remote_device.h
drivers/scsi/isci/core/scic_sds_smp_remote_device.c
drivers/scsi/isci/core/scic_sds_stp_remote_device.c

diff --git a/drivers/scsi/isci/core/sci_base_remote_device.h b/drivers/scsi/isci/core/sci_base_remote_device.h
deleted file mode 100644 (file)
index 5db5f31..0000000
+++ /dev/null
@@ -1,274 +0,0 @@
-/*
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
- * The full GNU General Public License is included in this distribution
- * in the file called LICENSE.GPL.
- *
- * BSD LICENSE
- *
- * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *   * Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *   * Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in
- *     the documentation and/or other materials provided with the
- *     distribution.
- *   * Neither the name of Intel Corporation nor the names of its
- *     contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _SCI_BASE_REMOTE_DEVICE_H_
-#define _SCI_BASE_REMOTE_DEVICE_H_
-
-/**
- * This file contains all of the structures, constants, and methods common to
- *    all remote device object definitions.
- *
- *
- */
-
-#include "sci_base_state_machine.h"
-
-struct scic_sds_request;
-
-/**
- * enum sci_base_remote_device_states - This enumeration depicts all the states
- *    for the common remote device state machine.
- *
- *
- */
-enum sci_base_remote_device_states {
-       /**
-        * Simply the initial state for the base remote device state machine.
-        */
-       SCI_BASE_REMOTE_DEVICE_STATE_INITIAL,
-
-       /**
-        * This state indicates that the remote device has successfully been
-        * stopped.  In this state no new IO operations are permitted.
-        * This state is entered from the INITIAL state.
-        * This state is entered from the STOPPING state.
-        */
-       SCI_BASE_REMOTE_DEVICE_STATE_STOPPED,
-
-       /**
-        * This state indicates the the remote device is in the process of
-        * becoming ready (i.e. starting).  In this state no new IO operations
-        * are permitted.
-        * This state is entered from the STOPPED state.
-        */
-       SCI_BASE_REMOTE_DEVICE_STATE_STARTING,
-
-       /**
-        * This state indicates the remote device is now ready.  Thus, the user
-        * is able to perform IO operations on the remote device.
-        * This state is entered from the STARTING state.
-        */
-       SCI_BASE_REMOTE_DEVICE_STATE_READY,
-
-       /**
-        * This state indicates that the remote device is in the process of
-        * stopping.  In this state no new IO operations are permitted, but
-        * existing IO operations are allowed to complete.
-        * This state is entered from the READY state.
-        * This state is entered from the FAILED state.
-        */
-       SCI_BASE_REMOTE_DEVICE_STATE_STOPPING,
-
-       /**
-        * This state indicates that the remote device has failed.
-        * In this state no new IO operations are permitted.
-        * This state is entered from the INITIALIZING state.
-        * This state is entered from the READY state.
-        */
-       SCI_BASE_REMOTE_DEVICE_STATE_FAILED,
-
-       /**
-        * This state indicates the device is being reset.
-        * In this state no new IO operations are permitted.
-        * This state is entered from the READY state.
-        */
-       SCI_BASE_REMOTE_DEVICE_STATE_RESETTING,
-
-       /**
-        * Simply the final state for the base remote device state machine.
-        */
-       SCI_BASE_REMOTE_DEVICE_STATE_FINAL,
-};
-
-/**
- * struct sci_base_remote_device - The base remote device object abstracts the
- *    fields common to all SCI remote device objects.
- *
- *
- */
-struct sci_base_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.
-        */
-       struct sci_base_state_machine state_machine;
-};
-
-
-typedef enum sci_status (*sci_base_remote_device_handler_t)(
-       struct sci_base_remote_device *
-       );
-
-typedef enum sci_status (*sci_base_remote_device_request_handler_t)(
-       struct sci_base_remote_device *,
-       struct scic_sds_request *
-       );
-
-typedef enum sci_status (*sci_base_remote_device_high_priority_request_complete_handler_t)(
-       struct sci_base_remote_device *,
-       struct scic_sds_request *,
-       void *,
-       enum sci_io_status
-       );
-
-/**
- * struct sci_base_remote_device_state_handler - This structure contains all of
- *    the state handler methods common to base remote device state machines.
- *    Handler methods provide the ability to change the behavior for user
- *    requests or transitions depending on the state the machine is in.
- *
- *
- */
-struct sci_base_remote_device_state_handler {
-       /**
-        * The start_handler specifies the method invoked when a user attempts to
-        * start a remote device.
-        */
-       sci_base_remote_device_handler_t start_handler;
-
-       /**
-        * The stop_handler specifies the method invoked when a user attempts to
-        * stop a remote device.
-        */
-       sci_base_remote_device_handler_t stop_handler;
-
-       /**
-        * The fail_handler specifies the method invoked when a remote device
-        * failure has occurred.  A failure may be due to an inability to
-        * initialize/configure the device.
-        */
-       sci_base_remote_device_handler_t fail_handler;
-
-       /**
-        * The destruct_handler specifies the method invoked when attempting to
-        * destruct a remote device.
-        */
-       sci_base_remote_device_handler_t destruct_handler;
-
-       /**
-        * The reset handler specifies the method invloked when requesting to reset a
-        * remote device.
-        */
-       sci_base_remote_device_handler_t reset_handler;
-
-       /**
-        * The reset complete handler specifies the method invloked when reporting
-        * that a reset has completed to the remote device.
-        */
-       sci_base_remote_device_handler_t reset_complete_handler;
-
-       /**
-        * The start_io_handler specifies the method invoked when a user
-        * attempts to start an IO request for a remote device.
-        */
-       sci_base_remote_device_request_handler_t start_io_handler;
-
-       /**
-        * The complete_io_handler specifies the method invoked when a user
-        * attempts to complete an IO request for a remote device.
-        */
-       sci_base_remote_device_request_handler_t complete_io_handler;
-
-       /**
-        * The continue_io_handler specifies the method invoked when a user
-        * attempts to continue an IO request for a remote device.
-        */
-       sci_base_remote_device_request_handler_t continue_io_handler;
-
-       /**
-        * The start_task_handler specifies the method invoked when a user
-        * attempts to start a task management request for a remote device.
-        */
-       sci_base_remote_device_request_handler_t start_task_handler;
-
-       /**
-        * The complete_task_handler specifies the method invoked when a user
-        * attempts to complete a task management request for a remote device.
-        */
-       sci_base_remote_device_request_handler_t complete_task_handler;
-
-};
-
-/**
- * sci_base_remote_device_construct() - Construct the base remote device
- * @this_remote_device: This parameter specifies the base remote device to be
- *    constructed.
- * @state_table: This parameter specifies the table of state definitions to be
- *    utilized for the remote device state machine.
- *
- */
-static inline void sci_base_remote_device_construct(
-       struct sci_base_remote_device *base_dev,
-       const struct sci_base_state *state_table)
-{
-       base_dev->parent.private = NULL;
-       sci_base_state_machine_construct(
-               &base_dev->state_machine,
-               &base_dev->parent,
-               state_table,
-               SCI_BASE_REMOTE_DEVICE_STATE_INITIAL
-               );
-
-       sci_base_state_machine_start(
-               &base_dev->state_machine
-               );
-}
-#endif /* _SCI_BASE_REMOTE_DEVICE_H_ */
index f16a23a2f9e4865608dc5bcade0171673e916077..7a0c5905cfbea8a703bfeef832663dfde86fb873 100644 (file)
@@ -1500,13 +1500,13 @@ void scic_sds_controller_link_down(struct scic_sds_controller *scic,
  *
  */
 static bool scic_sds_controller_has_remote_devices_stopping(
-       struct scic_sds_controller *this_controller)
+       struct scic_sds_controller *controller)
 {
        u32 index;
 
-       for (index = 0; index < this_controller->remote_node_entries; index++) {
-               if ((this_controller->device_table[index] != NULL) &&
-                  (this_controller->device_table[index]->parent.state_machine.current_state_id
+       for (index = 0; index < controller->remote_node_entries; index++) {
+               if ((controller->device_table[index] != NULL) &&
+                  (controller->device_table[index]->state_machine.current_state_id
                    == SCI_BASE_REMOTE_DEVICE_STATE_STOPPING))
                        return true;
        }
index f0d1c098f9b639efc679fae2a0abdeea5c1f1fcf..d756216872b53226626c141a4ebb2279c9233a54 100644 (file)
@@ -123,7 +123,7 @@ enum sci_status scic_remote_device_da_construct(
 
                        sci_base_state_machine_construct(
                                &sci_dev->ready_substate_machine,
-                               &sci_dev->parent.parent,
+                               &sci_dev->parent,
                                scic_sds_stp_remote_device_ready_substate_table,
                                SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_IDLE);
                } else if (sci_dev->target_protocols.u.bits.attached_smp_target) {
@@ -132,7 +132,7 @@ enum sci_status scic_remote_device_da_construct(
                        /* add the SMP ready substate machine construction here */
                        sci_base_state_machine_construct(
                                &sci_dev->ready_substate_machine,
-                               &sci_dev->parent.parent,
+                               &sci_dev->parent,
                                scic_sds_smp_remote_device_ready_substate_table,
                                SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_IDLE);
                }
@@ -187,7 +187,7 @@ enum sci_status scic_remote_device_ea_construct(
                        /* add the SMP ready substate machine construction here */
                        sci_base_state_machine_construct(
                                &sci_dev->ready_substate_machine,
-                               &sci_dev->parent.parent,
+                               &sci_dev->parent,
                                scic_sds_smp_remote_device_ready_substate_table,
                                SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_IDLE);
                } else if (sci_dev->target_protocols.u.bits.attached_stp_target) {
@@ -195,7 +195,7 @@ enum sci_status scic_remote_device_ea_construct(
 
                        sci_base_state_machine_construct(
                                &sci_dev->ready_substate_machine,
-                               &sci_dev->parent.parent,
+                               &sci_dev->parent,
                                scic_sds_stp_remote_device_ready_substate_table,
                                SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_IDLE);
                }
@@ -222,7 +222,7 @@ enum sci_status scic_remote_device_ea_construct(
 enum sci_status scic_remote_device_destruct(
        struct scic_sds_remote_device *sci_dev)
 {
-       return sci_dev->state_handlers->parent.destruct_handler(&sci_dev->parent);
+       return sci_dev->state_handlers->destruct_handler(sci_dev);
 }
 
 
@@ -230,7 +230,7 @@ enum sci_status scic_remote_device_start(
        struct scic_sds_remote_device *sci_dev,
        u32 timeout)
 {
-       return sci_dev->state_handlers->parent.start_handler(&sci_dev->parent);
+       return sci_dev->state_handlers->start_handler(sci_dev);
 }
 
 
@@ -238,21 +238,21 @@ enum sci_status scic_remote_device_stop(
        struct scic_sds_remote_device *sci_dev,
        u32 timeout)
 {
-       return sci_dev->state_handlers->parent.stop_handler(&sci_dev->parent);
+       return sci_dev->state_handlers->stop_handler(sci_dev);
 }
 
 
 enum sci_status scic_remote_device_reset(
        struct scic_sds_remote_device *sci_dev)
 {
-       return sci_dev->state_handlers->parent.reset_handler(&sci_dev->parent);
+       return sci_dev->state_handlers->reset_handler(sci_dev);
 }
 
 
 enum sci_status scic_remote_device_reset_complete(
        struct scic_sds_remote_device *sci_dev)
 {
-       return sci_dev->state_handlers->parent.reset_complete_handler(&sci_dev->parent);
+       return sci_dev->state_handlers->reset_complete_handler(sci_dev);
 }
 
 
@@ -362,8 +362,8 @@ enum sci_status scic_sds_remote_device_start_io(
        struct scic_sds_remote_device *this_device,
        struct scic_sds_request *io_request)
 {
-       return this_device->state_handlers->parent.start_io_handler(
-                      &this_device->parent, io_request);
+       return this_device->state_handlers->start_io_handler(
+                      this_device, io_request);
 }
 
 /**
@@ -380,8 +380,8 @@ enum sci_status scic_sds_remote_device_complete_io(
        struct scic_sds_remote_device *this_device,
        struct scic_sds_request *io_request)
 {
-       return this_device->state_handlers->parent.complete_io_handler(
-                      &this_device->parent, io_request);
+       return this_device->state_handlers->complete_io_handler(
+                      this_device, io_request);
 }
 
 /**
@@ -398,8 +398,8 @@ enum sci_status scic_sds_remote_device_start_task(
        struct scic_sds_remote_device *this_device,
        struct scic_sds_request *io_request)
 {
-       return this_device->state_handlers->parent.start_task_handler(
-                      &this_device->parent, io_request);
+       return this_device->state_handlers->start_task_handler(
+                      this_device, io_request);
 }
 
 /**
@@ -491,7 +491,7 @@ static void scic_sds_cb_remote_device_rnc_destruct_complete(
 
        BUG_ON(sci_dev->started_request_count != 0);
 
-       sci_base_state_machine_change_state(&sci_dev->parent.state_machine,
+       sci_base_state_machine_change_state(&sci_dev->state_machine,
                                            SCI_BASE_REMOTE_DEVICE_STATE_STOPPED);
 }
 
@@ -511,11 +511,11 @@ static void scic_sds_remote_device_resume_complete_handler(
        this_device = (struct scic_sds_remote_device *)user_parameter;
 
        if (
-               sci_base_state_machine_get_state(&this_device->parent.state_machine)
+               sci_base_state_machine_get_state(&this_device->state_machine)
                != SCI_BASE_REMOTE_DEVICE_STATE_READY
                ) {
                sci_base_state_machine_change_state(
-                       &this_device->parent.state_machine,
+                       &this_device->state_machine,
                        SCI_BASE_REMOTE_DEVICE_STATE_READY
                        );
        }
@@ -614,69 +614,67 @@ static enum sci_status scic_sds_remote_device_terminate_requests(
        return status;
 }
 
-static enum sci_status default_device_handler(struct sci_base_remote_device *base_dev,
-                                             const char *func)
+static enum sci_status
+default_device_handler(struct scic_sds_remote_device *sci_dev,
+                      const char *func)
 {
-       struct scic_sds_remote_device *sci_dev;
-
-       sci_dev = container_of(base_dev, typeof(*sci_dev), parent);
        dev_warn(scirdev_to_dev(sci_dev),
                 "%s: in wrong state: %d\n", func,
-                sci_base_state_machine_get_state(&base_dev->state_machine));
+                sci_base_state_machine_get_state(&sci_dev->state_machine));
        return SCI_FAILURE_INVALID_STATE;
 }
 
 enum sci_status scic_sds_remote_device_default_start_handler(
-       struct sci_base_remote_device *base_dev)
+       struct scic_sds_remote_device *sci_dev)
 {
-       return default_device_handler(base_dev, __func__);
+       return default_device_handler(sci_dev, __func__);
 }
 
 static enum sci_status scic_sds_remote_device_default_stop_handler(
-       struct sci_base_remote_device *base_dev)
+       struct scic_sds_remote_device *sci_dev)
 {
-       return default_device_handler(base_dev, __func__);
+       return default_device_handler(sci_dev, __func__);
 }
 
 enum sci_status scic_sds_remote_device_default_fail_handler(
-       struct sci_base_remote_device *base_dev)
+       struct scic_sds_remote_device *sci_dev)
 {
-       return default_device_handler(base_dev, __func__);
+       return default_device_handler(sci_dev, __func__);
 }
 
 enum sci_status scic_sds_remote_device_default_destruct_handler(
-       struct sci_base_remote_device *base_dev)
+       struct scic_sds_remote_device *sci_dev)
 {
-       return default_device_handler(base_dev, __func__);
+       return default_device_handler(sci_dev, __func__);
 }
 
 enum sci_status scic_sds_remote_device_default_reset_handler(
-       struct sci_base_remote_device *base_dev)
+       struct scic_sds_remote_device *sci_dev)
 {
-       return default_device_handler(base_dev, __func__);
+       return default_device_handler(sci_dev, __func__);
 }
 
 enum sci_status scic_sds_remote_device_default_reset_complete_handler(
-       struct sci_base_remote_device *base_dev)
+       struct scic_sds_remote_device *sci_dev)
 {
-       return default_device_handler(base_dev, __func__);
+       return default_device_handler(sci_dev, __func__);
 }
 
 enum sci_status scic_sds_remote_device_default_suspend_handler(
        struct scic_sds_remote_device *sci_dev, u32 suspend_type)
 {
-       return default_device_handler(&sci_dev->parent, __func__);
+       return default_device_handler(sci_dev, __func__);
 }
 
 enum sci_status scic_sds_remote_device_default_resume_handler(
        struct scic_sds_remote_device *sci_dev)
 {
-       return default_device_handler(&sci_dev->parent, __func__);
+       return default_device_handler(sci_dev, __func__);
 }
 
 /**
  *
- * @device: The struct sci_base_remote_device which is then cast into a
+ * @device: The struct scic_sds_remote_device which is then cast into a
  *    struct scic_sds_remote_device.
  * @event_code: The event code that the struct scic_sds_controller wants the device
  *    object to process.
@@ -734,7 +732,7 @@ static enum sci_status  scic_sds_remote_device_core_event_handler(
 }
 /**
  *
- * @device: The struct sci_base_remote_device which is then cast into a
+ * @device: The struct scic_sds_remote_device which is then cast into a
  *    struct scic_sds_remote_device.
  * @event_code: The event code that the struct scic_sds_controller wants the device
  *    object to process.
@@ -754,7 +752,7 @@ static enum sci_status  scic_sds_remote_device_default_event_handler(
 
 /**
  *
- * @device: The struct sci_base_remote_device which is then cast into a
+ * @device: The struct scic_sds_remote_device which is then cast into a
  *    struct scic_sds_remote_device.
  * @frame_index: The frame index for which the struct scic_sds_controller wants this
  *    device object to process.
@@ -773,7 +771,7 @@ enum sci_status scic_sds_remote_device_default_frame_handler(
                 __func__,
                 frame_index,
                 sci_base_state_machine_get_state(
-                        &this_device->parent.state_machine));
+                        &this_device->state_machine));
 
        /* Return the frame back to the controller */
        scic_sds_controller_release_frame(
@@ -784,29 +782,29 @@ enum sci_status scic_sds_remote_device_default_frame_handler(
 }
 
 enum sci_status scic_sds_remote_device_default_start_request_handler(
-       struct sci_base_remote_device *base_dev,
+       struct scic_sds_remote_device *sci_dev,
        struct scic_sds_request *request)
 {
-       return default_device_handler(base_dev, __func__);
+       return default_device_handler(sci_dev, __func__);
 }
 
 enum sci_status scic_sds_remote_device_default_complete_request_handler(
-       struct sci_base_remote_device *base_dev,
+       struct scic_sds_remote_device *sci_dev,
        struct scic_sds_request *request)
 {
-       return default_device_handler(base_dev, __func__);
+       return default_device_handler(sci_dev, __func__);
 }
 
 enum sci_status scic_sds_remote_device_default_continue_request_handler(
-       struct sci_base_remote_device *base_dev,
+       struct scic_sds_remote_device *sci_dev,
        struct scic_sds_request *request)
 {
-       return default_device_handler(base_dev, __func__);
+       return default_device_handler(sci_dev, __func__);
 }
 
 /**
  *
- * @device: The struct sci_base_remote_device which is then cast into a
+ * @device: The struct scic_sds_remote_device which is then cast into a
  *    struct scic_sds_remote_device.
  * @frame_index: The frame index for which the struct scic_sds_controller wants this
  *    device object to process.
@@ -887,32 +885,29 @@ enum sci_status scic_sds_remote_device_general_event_handler(
  * which to construct the remote device.
  */
 static enum sci_status scic_sds_remote_device_stopped_state_start_handler(
-       struct sci_base_remote_device *base_dev)
+       struct scic_sds_remote_device *sci_dev)
 {
        enum sci_status status;
-       struct scic_sds_remote_device *sci_dev;
-
-       sci_dev = container_of(base_dev, typeof(*sci_dev), parent);
 
        status = scic_sds_remote_node_context_resume(sci_dev->rnc,
                        scic_sds_remote_device_resume_complete_handler, sci_dev);
 
        if (status == SCI_SUCCESS)
-               sci_base_state_machine_change_state(&base_dev->state_machine,
+               sci_base_state_machine_change_state(&sci_dev->state_machine,
                                                    SCI_BASE_REMOTE_DEVICE_STATE_STARTING);
 
        return status;
 }
 
 static enum sci_status scic_sds_remote_device_stopped_state_stop_handler(
-       struct sci_base_remote_device *base_dev)
+       struct scic_sds_remote_device *sci_dev)
 {
        return SCI_SUCCESS;
 }
 
 /**
  *
- * @sci_dev: The struct sci_base_remote_device which is cast into a
+ * @sci_dev: The struct scic_sds_remote_device which is cast into a
  *    struct scic_sds_remote_device.
  *
  * This method will destruct a struct scic_sds_remote_device that is in a stopped
@@ -922,18 +917,16 @@ static enum sci_status scic_sds_remote_device_stopped_state_stop_handler(
  * enum sci_status SCI_SUCCESS
  */
 static enum sci_status scic_sds_remote_device_stopped_state_destruct_handler(
-       struct sci_base_remote_device *base_dev)
+       struct scic_sds_remote_device *sci_dev)
 {
-       struct scic_sds_remote_device *sci_dev;
        struct scic_sds_controller *scic;
 
-       sci_dev = container_of(base_dev, typeof(*sci_dev), parent);
        scic = scic_sds_remote_device_get_controller(sci_dev);
        scic_sds_controller_free_remote_node_context(scic, sci_dev,
                                                     sci_dev->rnc->remote_node_index);
        sci_dev->rnc->remote_node_index = SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX;
 
-       sci_base_state_machine_change_state(&base_dev->state_machine,
+       sci_base_state_machine_change_state(&sci_dev->state_machine,
                                            SCI_BASE_REMOTE_DEVICE_STATE_FINAL);
 
        return SCI_SUCCESS;
@@ -945,11 +938,8 @@ static enum sci_status scic_sds_remote_device_stopped_state_destruct_handler(
  * ***************************************************************************** */
 
 static enum sci_status scic_sds_remote_device_starting_state_stop_handler(
-       struct sci_base_remote_device *base_dev)
+       struct scic_sds_remote_device *sci_dev)
 {
-       struct scic_sds_remote_device *sci_dev;
-
-       sci_dev = container_of(base_dev, typeof(*sci_dev), parent);
        /*
         * This device has not yet started so there had better be no IO requests
         */
@@ -965,21 +955,19 @@ static enum sci_status scic_sds_remote_device_starting_state_stop_handler(
         * Transition to the stopping state and wait for the remote node to
         * complete being posted and invalidated.
         */
-       sci_base_state_machine_change_state(&base_dev->state_machine,
+       sci_base_state_machine_change_state(&sci_dev->state_machine,
                                            SCI_BASE_REMOTE_DEVICE_STATE_STOPPING);
 
        return SCI_SUCCESS;
 }
 
 enum sci_status scic_sds_remote_device_ready_state_stop_handler(
-       struct sci_base_remote_device *base_dev)
+       struct scic_sds_remote_device *sci_dev)
 {
-       struct scic_sds_remote_device *sci_dev;
        enum sci_status status = SCI_SUCCESS;
 
-       sci_dev = container_of(base_dev, typeof(*sci_dev), parent);
        /* Request the parent state machine to transition to the stopping state */
-       sci_base_state_machine_change_state(&base_dev->state_machine,
+       sci_base_state_machine_change_state(&sci_dev->state_machine,
                                            SCI_BASE_REMOTE_DEVICE_STATE_STOPPING);
 
        if (sci_dev->started_request_count == 0) {
@@ -994,19 +982,16 @@ enum sci_status scic_sds_remote_device_ready_state_stop_handler(
 
 /**
  *
- * @device: The struct sci_base_remote_device object which is cast to a
+ * @device: The struct scic_sds_remote_device object which is cast to a
  *    struct scic_sds_remote_device object.
  *
  * This is the ready state device reset handler enum sci_status
  */
 enum sci_status scic_sds_remote_device_ready_state_reset_handler(
-       struct sci_base_remote_device *base_dev)
+       struct scic_sds_remote_device *sci_dev)
 {
-       struct scic_sds_remote_device *sci_dev;
-
-       sci_dev = container_of(base_dev, typeof(*sci_dev), parent);
        /* Request the parent state machine to transition to the stopping state */
-       sci_base_state_machine_change_state(&base_dev->state_machine,
+       sci_base_state_machine_change_state(&sci_dev->state_machine,
                                            SCI_BASE_REMOTE_DEVICE_STATE_RESETTING);
 
        return SCI_SUCCESS;
@@ -1021,23 +1006,22 @@ enum sci_status scic_sds_remote_device_ready_state_reset_handler(
  * object could not get the resources to start.
  */
 static enum sci_status scic_sds_remote_device_ready_state_start_task_handler(
-       struct sci_base_remote_device *device,
+       struct scic_sds_remote_device *sci_dev,
        struct scic_sds_request *request)
 {
        enum sci_status result;
-       struct scic_sds_remote_device *this_device  = (struct scic_sds_remote_device *)device;
 
        /* See if the port is in a state where we can start the IO request */
        result = scic_sds_port_start_io(
-               scic_sds_remote_device_get_port(this_device), this_device, request);
+               scic_sds_remote_device_get_port(sci_dev), sci_dev, request);
 
        if (result == SCI_SUCCESS) {
                result = scic_sds_remote_node_context_start_task(
-                       this_device->rnc, request);
+                       sci_dev->rnc, request);
                if (result == SCI_SUCCESS)
                        result = scic_sds_request_start(request);
 
-               scic_sds_remote_device_start_request(this_device, request, result);
+               scic_sds_remote_device_start_request(sci_dev, request, result);
        }
 
        return result;
@@ -1052,23 +1036,22 @@ static enum sci_status scic_sds_remote_device_ready_state_start_task_handler(
  * object could not get the resources to start.
  */
 static enum sci_status scic_sds_remote_device_ready_state_start_io_handler(
-       struct sci_base_remote_device *device,
+       struct scic_sds_remote_device *sci_dev,
        struct scic_sds_request *request)
 {
        enum sci_status result;
-       struct scic_sds_remote_device *this_device = (struct scic_sds_remote_device *)device;
 
        /* See if the port is in a state where we can start the IO request */
        result = scic_sds_port_start_io(
-               scic_sds_remote_device_get_port(this_device), this_device, request);
+               scic_sds_remote_device_get_port(sci_dev), sci_dev, request);
 
        if (result == SCI_SUCCESS) {
                result = scic_sds_remote_node_context_start_io(
-                       this_device->rnc, request);
+                       sci_dev->rnc, request);
                if (result == SCI_SUCCESS)
                        result = scic_sds_request_start(request);
 
-               scic_sds_remote_device_start_request(this_device, request, result);
+               scic_sds_remote_device_start_request(sci_dev, request, result);
        }
 
        return result;
@@ -1081,23 +1064,24 @@ static enum sci_status scic_sds_remote_device_ready_state_start_io_handler(
  * its own started_request_count. enum sci_status
  */
 static enum sci_status scic_sds_remote_device_ready_state_complete_request_handler(
-       struct sci_base_remote_device *device,
+       struct scic_sds_remote_device *sci_dev,
        struct scic_sds_request *request)
 {
        enum sci_status result;
-       struct scic_sds_remote_device *this_device = (struct scic_sds_remote_device *)device;
 
        result = scic_sds_request_complete(request);
 
-       if (result == SCI_SUCCESS) {
-               /* See if the port is in a state where we can start the IO request */
-               result = scic_sds_port_complete_io(
-                       scic_sds_remote_device_get_port(this_device), this_device, request);
+       if (result != SCI_SUCCESS)
+               return result;
 
-               if (result == SCI_SUCCESS) {
-                       scic_sds_remote_device_decrement_request_count(this_device);
-               }
-       }
+       /* See if the port is in a state
+        * where we can start the IO request */
+       result = scic_sds_port_complete_io(
+                       scic_sds_remote_device_get_port(sci_dev),
+                       sci_dev, request);
+
+       if (result == SCI_SUCCESS)
+               scic_sds_remote_device_decrement_request_count(sci_dev);
 
        return result;
 }
@@ -1109,7 +1093,7 @@ static enum sci_status scic_sds_remote_device_ready_state_complete_request_handl
 
 /**
  *
- * @this_device: The struct sci_base_remote_device which is cast into a
+ * @this_device: The struct scic_sds_remote_device which is cast into a
  *    struct scic_sds_remote_device.
  *
  * This method will stop a struct scic_sds_remote_device that is already in the
@@ -1118,14 +1102,13 @@ static enum sci_status scic_sds_remote_device_ready_state_complete_request_handl
  * stopped. enum sci_status SCI_SUCCESS
  */
 static enum sci_status scic_sds_remote_device_stopping_state_stop_handler(
-       struct sci_base_remote_device *device)
+       struct scic_sds_remote_device *device)
 {
        /*
         * All requests should have been terminated, but if there is an
         * attempt to stop a device already in the stopping state, then
         * try again to terminate. */
-       return scic_sds_remote_device_terminate_requests(
-                      (struct scic_sds_remote_device *)device);
+       return scic_sds_remote_device_terminate_requests(device);
 }
 
 
@@ -1143,54 +1126,44 @@ static enum sci_status scic_sds_remote_device_stopping_state_stop_handler(
  * transition to the SCI_BASE_REMOTE_DEVICE_STATE_STOPPED. enum sci_status
  */
 static enum sci_status scic_sds_remote_device_stopping_state_complete_request_handler(
-       struct sci_base_remote_device *device,
+       struct scic_sds_remote_device *sci_dev,
        struct scic_sds_request *request)
 {
        enum sci_status status = SCI_SUCCESS;
-       struct scic_sds_remote_device *this_device = (struct scic_sds_remote_device *)device;
 
        status = scic_sds_request_complete(request);
-       if (status == SCI_SUCCESS) {
-               status = scic_sds_port_complete_io(
-                       scic_sds_remote_device_get_port(this_device),
-                       this_device, request);
 
-               if (status == SCI_SUCCESS) {
-                       scic_sds_remote_device_decrement_request_count(this_device);
-
-                       if (scic_sds_remote_device_get_request_count(this_device) == 0) {
-                               scic_sds_remote_node_context_destruct(
-                                       this_device->rnc,
-                                       scic_sds_cb_remote_device_rnc_destruct_complete,
-                                       this_device
-                                       );
-                       }
-               }
-       }
+       if (status != SCI_SUCCESS)
+               return status;
 
-       return status;
-}
+       status = scic_sds_port_complete_io(scic_sds_remote_device_get_port(sci_dev),
+                                          sci_dev, request);
+       if (status != SCI_SUCCESS)
+               return status;
 
-/*
- * *****************************************************************************
- * *  RESETTING STATE HANDLERS
- * ***************************************************************************** */
+       scic_sds_remote_device_decrement_request_count(sci_dev);
+
+       if (scic_sds_remote_device_get_request_count(sci_dev) == 0)
+               scic_sds_remote_node_context_destruct(sci_dev->rnc,
+                                                     scic_sds_cb_remote_device_rnc_destruct_complete,
+                                                     sci_dev);
+       return SCI_SUCCESS;
+}
 
 /**
  *
- * @device: The struct sci_base_remote_device which is to be cast into a
+ * @device: The struct scic_sds_remote_device which is to be cast into a
  *    struct scic_sds_remote_device object.
  *
  * This method will complete the reset operation when the device is in the
  * resetting state. enum sci_status
  */
 static enum sci_status scic_sds_remote_device_resetting_state_reset_complete_handler(
-       struct sci_base_remote_device *device)
+       struct scic_sds_remote_device *sci_dev)
 {
-       struct scic_sds_remote_device *this_device = (struct scic_sds_remote_device *)device;
 
        sci_base_state_machine_change_state(
-               &this_device->parent.state_machine,
+               &sci_dev->state_machine,
                SCI_BASE_REMOTE_DEVICE_STATE_READY
                );
 
@@ -1199,19 +1172,17 @@ static enum sci_status scic_sds_remote_device_resetting_state_reset_complete_han
 
 /**
  *
- * @device: The struct sci_base_remote_device which is to be cast into a
+ * @device: The struct scic_sds_remote_device which is to be cast into a
  *    struct scic_sds_remote_device object.
  *
  * This method will stop the remote device while in the resetting state.
  * enum sci_status
  */
 static enum sci_status scic_sds_remote_device_resetting_state_stop_handler(
-       struct sci_base_remote_device *device)
+       struct scic_sds_remote_device *sci_dev)
 {
-       struct scic_sds_remote_device *this_device = (struct scic_sds_remote_device *)device;
-
        sci_base_state_machine_change_state(
-               &this_device->parent.state_machine,
+               &sci_dev->state_machine,
                SCI_BASE_REMOTE_DEVICE_STATE_STOPPING
                );
 
@@ -1226,20 +1197,20 @@ static enum sci_status scic_sds_remote_device_resetting_state_stop_handler(
  * completes the task request. enum sci_status
  */
 static enum sci_status scic_sds_remote_device_resetting_state_complete_request_handler(
-       struct sci_base_remote_device *device,
+       struct scic_sds_remote_device *sci_dev,
        struct scic_sds_request *request)
 {
        enum sci_status status = SCI_SUCCESS;
-       struct scic_sds_remote_device *this_device = (struct scic_sds_remote_device *)device;
 
        status = scic_sds_request_complete(request);
 
        if (status == SCI_SUCCESS) {
                status = scic_sds_port_complete_io(
-                       scic_sds_remote_device_get_port(this_device), this_device, request);
+                               scic_sds_remote_device_get_port(sci_dev),
+                               sci_dev, request);
 
                if (status == SCI_SUCCESS) {
-                       scic_sds_remote_device_decrement_request_count(this_device);
+                       scic_sds_remote_device_decrement_request_count(sci_dev);
                }
        }
 
@@ -1253,7 +1224,7 @@ static enum sci_status scic_sds_remote_device_resetting_state_complete_request_h
 
 /**
  *
- * @device: The struct sci_base_remote_device which is to be cast into a
+ * @device: The struct scic_sds_remote_device which is to be cast into a
  *    struct scic_sds_remote_device object.
  *
  * This method handles the remove request for a failed struct scic_sds_remote_device
@@ -1265,140 +1236,140 @@ static enum sci_status scic_sds_remote_device_resetting_state_complete_request_h
 
 static const struct scic_sds_remote_device_state_handler scic_sds_remote_device_state_handler_table[] = {
        [SCI_BASE_REMOTE_DEVICE_STATE_INITIAL] = {
-               .parent.start_handler           = scic_sds_remote_device_default_start_handler,
-               .parent.stop_handler            = scic_sds_remote_device_default_stop_handler,
-               .parent.fail_handler            = scic_sds_remote_device_default_fail_handler,
-               .parent.destruct_handler        = scic_sds_remote_device_default_destruct_handler,
-               .parent.reset_handler           = scic_sds_remote_device_default_reset_handler,
-               .parent.reset_complete_handler  = scic_sds_remote_device_default_reset_complete_handler,
-               .parent.start_io_handler        = scic_sds_remote_device_default_start_request_handler,
-               .parent.complete_io_handler     = scic_sds_remote_device_default_complete_request_handler,
-               .parent.continue_io_handler     = scic_sds_remote_device_default_continue_request_handler,
-               .parent.start_task_handler      = scic_sds_remote_device_default_start_request_handler,
-               .parent.complete_task_handler   = scic_sds_remote_device_default_complete_request_handler,
-               .suspend_handler                = scic_sds_remote_device_default_suspend_handler,
-               .resume_handler                 = scic_sds_remote_device_default_resume_handler,
-               .event_handler                  = scic_sds_remote_device_default_event_handler,
-               .frame_handler                  = scic_sds_remote_device_default_frame_handler
+               .start_handler          = scic_sds_remote_device_default_start_handler,
+               .stop_handler           = scic_sds_remote_device_default_stop_handler,
+               .fail_handler           = scic_sds_remote_device_default_fail_handler,
+               .destruct_handler       = scic_sds_remote_device_default_destruct_handler,
+               .reset_handler          = scic_sds_remote_device_default_reset_handler,
+               .reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
+               .start_io_handler       = scic_sds_remote_device_default_start_request_handler,
+               .complete_io_handler    = scic_sds_remote_device_default_complete_request_handler,
+               .continue_io_handler    = scic_sds_remote_device_default_continue_request_handler,
+               .start_task_handler     = scic_sds_remote_device_default_start_request_handler,
+               .complete_task_handler  = scic_sds_remote_device_default_complete_request_handler,
+               .suspend_handler        = scic_sds_remote_device_default_suspend_handler,
+               .resume_handler         = scic_sds_remote_device_default_resume_handler,
+               .event_handler          = scic_sds_remote_device_default_event_handler,
+               .frame_handler          = scic_sds_remote_device_default_frame_handler
        },
        [SCI_BASE_REMOTE_DEVICE_STATE_STOPPED] = {
-               .parent.start_handler           = scic_sds_remote_device_stopped_state_start_handler,
-               .parent.stop_handler            = scic_sds_remote_device_stopped_state_stop_handler,
-               .parent.fail_handler            = scic_sds_remote_device_default_fail_handler,
-               .parent.destruct_handler        = scic_sds_remote_device_stopped_state_destruct_handler,
-               .parent.reset_handler           = scic_sds_remote_device_default_reset_handler,
-               .parent.reset_complete_handler  = scic_sds_remote_device_default_reset_complete_handler,
-               .parent.start_io_handler        = scic_sds_remote_device_default_start_request_handler,
-               .parent.complete_io_handler     = scic_sds_remote_device_default_complete_request_handler,
-               .parent.continue_io_handler     = scic_sds_remote_device_default_continue_request_handler,
-               .parent.start_task_handler      = scic_sds_remote_device_default_start_request_handler,
-               .parent.complete_task_handler   = scic_sds_remote_device_default_complete_request_handler,
-               .suspend_handler                = scic_sds_remote_device_default_suspend_handler,
-               .resume_handler                 = scic_sds_remote_device_default_resume_handler,
-               .event_handler                  = scic_sds_remote_device_default_event_handler,
-               .frame_handler                  = scic_sds_remote_device_default_frame_handler
+               .start_handler          = scic_sds_remote_device_stopped_state_start_handler,
+               .stop_handler           = scic_sds_remote_device_stopped_state_stop_handler,
+               .fail_handler           = scic_sds_remote_device_default_fail_handler,
+               .destruct_handler       = scic_sds_remote_device_stopped_state_destruct_handler,
+               .reset_handler          = scic_sds_remote_device_default_reset_handler,
+               .reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
+               .start_io_handler       = scic_sds_remote_device_default_start_request_handler,
+               .complete_io_handler    = scic_sds_remote_device_default_complete_request_handler,
+               .continue_io_handler    = scic_sds_remote_device_default_continue_request_handler,
+               .start_task_handler     = scic_sds_remote_device_default_start_request_handler,
+               .complete_task_handler  = scic_sds_remote_device_default_complete_request_handler,
+               .suspend_handler        = scic_sds_remote_device_default_suspend_handler,
+               .resume_handler         = scic_sds_remote_device_default_resume_handler,
+               .event_handler          = scic_sds_remote_device_default_event_handler,
+               .frame_handler          = scic_sds_remote_device_default_frame_handler
        },
        [SCI_BASE_REMOTE_DEVICE_STATE_STARTING] = {
-               .parent.start_handler           = scic_sds_remote_device_default_start_handler,
-               .parent.stop_handler            = scic_sds_remote_device_starting_state_stop_handler,
-               .parent.fail_handler            = scic_sds_remote_device_default_fail_handler,
-               .parent.destruct_handler        = scic_sds_remote_device_default_destruct_handler,
-               .parent.reset_handler           = scic_sds_remote_device_default_reset_handler,
-               .parent.reset_complete_handler  = scic_sds_remote_device_default_reset_complete_handler,
-               .parent.start_io_handler        = scic_sds_remote_device_default_start_request_handler,
-               .parent.complete_io_handler     = scic_sds_remote_device_default_complete_request_handler,
-               .parent.continue_io_handler     = scic_sds_remote_device_default_continue_request_handler,
-               .parent.start_task_handler      = scic_sds_remote_device_default_start_request_handler,
-               .parent.complete_task_handler   = scic_sds_remote_device_default_complete_request_handler,
-               .suspend_handler                = scic_sds_remote_device_default_suspend_handler,
-               .resume_handler                 = scic_sds_remote_device_default_resume_handler,
-               .event_handler                  = scic_sds_remote_device_general_event_handler,
-               .frame_handler                  = scic_sds_remote_device_default_frame_handler
+               .start_handler          = scic_sds_remote_device_default_start_handler,
+               .stop_handler           = scic_sds_remote_device_starting_state_stop_handler,
+               .fail_handler           = scic_sds_remote_device_default_fail_handler,
+               .destruct_handler       = scic_sds_remote_device_default_destruct_handler,
+               .reset_handler          = scic_sds_remote_device_default_reset_handler,
+               .reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
+               .start_io_handler       = scic_sds_remote_device_default_start_request_handler,
+               .complete_io_handler    = scic_sds_remote_device_default_complete_request_handler,
+               .continue_io_handler    = scic_sds_remote_device_default_continue_request_handler,
+               .start_task_handler     = scic_sds_remote_device_default_start_request_handler,
+               .complete_task_handler  = scic_sds_remote_device_default_complete_request_handler,
+               .suspend_handler        = scic_sds_remote_device_default_suspend_handler,
+               .resume_handler         = scic_sds_remote_device_default_resume_handler,
+               .event_handler          = scic_sds_remote_device_general_event_handler,
+               .frame_handler          = scic_sds_remote_device_default_frame_handler
        },
        [SCI_BASE_REMOTE_DEVICE_STATE_READY] = {
-               .parent.start_handler           = scic_sds_remote_device_default_start_handler,
-               .parent.stop_handler            = scic_sds_remote_device_ready_state_stop_handler,
-               .parent.fail_handler            = scic_sds_remote_device_default_fail_handler,
-               .parent.destruct_handler        = scic_sds_remote_device_default_destruct_handler,
-               .parent.reset_handler           = scic_sds_remote_device_ready_state_reset_handler,
-               .parent.reset_complete_handler  = scic_sds_remote_device_default_reset_complete_handler,
-               .parent.start_io_handler        = scic_sds_remote_device_ready_state_start_io_handler,
-               .parent.complete_io_handler     = scic_sds_remote_device_ready_state_complete_request_handler,
-               .parent.continue_io_handler     = scic_sds_remote_device_default_continue_request_handler,
-               .parent.start_task_handler      = scic_sds_remote_device_ready_state_start_task_handler,
-               .parent.complete_task_handler   = scic_sds_remote_device_ready_state_complete_request_handler,
-               .suspend_handler                = scic_sds_remote_device_default_suspend_handler,
-               .resume_handler                 = scic_sds_remote_device_default_resume_handler,
-               .event_handler                  = scic_sds_remote_device_general_event_handler,
-               .frame_handler                  = scic_sds_remote_device_general_frame_handler,
+               .start_handler          = scic_sds_remote_device_default_start_handler,
+               .stop_handler           = scic_sds_remote_device_ready_state_stop_handler,
+               .fail_handler           = scic_sds_remote_device_default_fail_handler,
+               .destruct_handler       = scic_sds_remote_device_default_destruct_handler,
+               .reset_handler          = scic_sds_remote_device_ready_state_reset_handler,
+               .reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
+               .start_io_handler       = scic_sds_remote_device_ready_state_start_io_handler,
+               .complete_io_handler    = scic_sds_remote_device_ready_state_complete_request_handler,
+               .continue_io_handler    = scic_sds_remote_device_default_continue_request_handler,
+               .start_task_handler     = scic_sds_remote_device_ready_state_start_task_handler,
+               .complete_task_handler  = scic_sds_remote_device_ready_state_complete_request_handler,
+               .suspend_handler        = scic_sds_remote_device_default_suspend_handler,
+               .resume_handler         = scic_sds_remote_device_default_resume_handler,
+               .event_handler          = scic_sds_remote_device_general_event_handler,
+               .frame_handler          = scic_sds_remote_device_general_frame_handler,
        },
        [SCI_BASE_REMOTE_DEVICE_STATE_STOPPING] = {
-               .parent.start_handler           = scic_sds_remote_device_default_start_handler,
-               .parent.stop_handler            = scic_sds_remote_device_stopping_state_stop_handler,
-               .parent.fail_handler            = scic_sds_remote_device_default_fail_handler,
-               .parent.destruct_handler        = scic_sds_remote_device_default_destruct_handler,
-               .parent.reset_handler           = scic_sds_remote_device_default_reset_handler,
-               .parent.reset_complete_handler  = scic_sds_remote_device_default_reset_complete_handler,
-               .parent.start_io_handler        = scic_sds_remote_device_default_start_request_handler,
-               .parent.complete_io_handler     = scic_sds_remote_device_stopping_state_complete_request_handler,
-               .parent.continue_io_handler     = scic_sds_remote_device_default_continue_request_handler,
-               .parent.start_task_handler      = scic_sds_remote_device_default_start_request_handler,
-               .parent.complete_task_handler   = scic_sds_remote_device_stopping_state_complete_request_handler,
-               .suspend_handler                = scic_sds_remote_device_default_suspend_handler,
-               .resume_handler                 = scic_sds_remote_device_default_resume_handler,
-               .event_handler                  = scic_sds_remote_device_general_event_handler,
-               .frame_handler                  = scic_sds_remote_device_general_frame_handler
+               .start_handler          = scic_sds_remote_device_default_start_handler,
+               .stop_handler           = scic_sds_remote_device_stopping_state_stop_handler,
+               .fail_handler           = scic_sds_remote_device_default_fail_handler,
+               .destruct_handler       = scic_sds_remote_device_default_destruct_handler,
+               .reset_handler          = scic_sds_remote_device_default_reset_handler,
+               .reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
+               .start_io_handler       = scic_sds_remote_device_default_start_request_handler,
+               .complete_io_handler    = scic_sds_remote_device_stopping_state_complete_request_handler,
+               .continue_io_handler    = scic_sds_remote_device_default_continue_request_handler,
+               .start_task_handler     = scic_sds_remote_device_default_start_request_handler,
+               .complete_task_handler  = scic_sds_remote_device_stopping_state_complete_request_handler,
+               .suspend_handler        = scic_sds_remote_device_default_suspend_handler,
+               .resume_handler         = scic_sds_remote_device_default_resume_handler,
+               .event_handler          = scic_sds_remote_device_general_event_handler,
+               .frame_handler          = scic_sds_remote_device_general_frame_handler
        },
        [SCI_BASE_REMOTE_DEVICE_STATE_FAILED] = {
-               .parent.start_handler           = scic_sds_remote_device_default_start_handler,
-               .parent.stop_handler            = scic_sds_remote_device_default_stop_handler,
-               .parent.fail_handler            = scic_sds_remote_device_default_fail_handler,
-               .parent.destruct_handler        = scic_sds_remote_device_default_destruct_handler,
-               .parent.reset_handler           = scic_sds_remote_device_default_reset_handler,
-               .parent.reset_complete_handler  = scic_sds_remote_device_default_reset_complete_handler,
-               .parent.start_io_handler        = scic_sds_remote_device_default_start_request_handler,
-               .parent.complete_io_handler     = scic_sds_remote_device_default_complete_request_handler,
-               .parent.continue_io_handler     = scic_sds_remote_device_default_continue_request_handler,
-               .parent.start_task_handler      = scic_sds_remote_device_default_start_request_handler,
-               .parent.complete_task_handler   = scic_sds_remote_device_default_complete_request_handler,
-               .suspend_handler                = scic_sds_remote_device_default_suspend_handler,
-               .resume_handler                 = scic_sds_remote_device_default_resume_handler,
-               .event_handler                  = scic_sds_remote_device_default_event_handler,
-               .frame_handler                  = scic_sds_remote_device_general_frame_handler
+               .start_handler          = scic_sds_remote_device_default_start_handler,
+               .stop_handler           = scic_sds_remote_device_default_stop_handler,
+               .fail_handler           = scic_sds_remote_device_default_fail_handler,
+               .destruct_handler       = scic_sds_remote_device_default_destruct_handler,
+               .reset_handler          = scic_sds_remote_device_default_reset_handler,
+               .reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
+               .start_io_handler       = scic_sds_remote_device_default_start_request_handler,
+               .complete_io_handler    = scic_sds_remote_device_default_complete_request_handler,
+               .continue_io_handler    = scic_sds_remote_device_default_continue_request_handler,
+               .start_task_handler     = scic_sds_remote_device_default_start_request_handler,
+               .complete_task_handler  = scic_sds_remote_device_default_complete_request_handler,
+               .suspend_handler        = scic_sds_remote_device_default_suspend_handler,
+               .resume_handler         = scic_sds_remote_device_default_resume_handler,
+               .event_handler          = scic_sds_remote_device_default_event_handler,
+               .frame_handler          = scic_sds_remote_device_general_frame_handler
        },
        [SCI_BASE_REMOTE_DEVICE_STATE_RESETTING] = {
-               .parent.start_handler           = scic_sds_remote_device_default_start_handler,
-               .parent.stop_handler            = scic_sds_remote_device_resetting_state_stop_handler,
-               .parent.fail_handler            = scic_sds_remote_device_default_fail_handler,
-               .parent.destruct_handler        = scic_sds_remote_device_default_destruct_handler,
-               .parent.reset_handler           = scic_sds_remote_device_default_reset_handler,
-               .parent.reset_complete_handler  = scic_sds_remote_device_resetting_state_reset_complete_handler,
-               .parent.start_io_handler        = scic_sds_remote_device_default_start_request_handler,
-               .parent.complete_io_handler     = scic_sds_remote_device_resetting_state_complete_request_handler,
-               .parent.continue_io_handler     = scic_sds_remote_device_default_continue_request_handler,
-               .parent.start_task_handler      = scic_sds_remote_device_default_start_request_handler,
-               .parent.complete_task_handler   = scic_sds_remote_device_resetting_state_complete_request_handler,
-               .suspend_handler                = scic_sds_remote_device_default_suspend_handler,
-               .resume_handler                 = scic_sds_remote_device_default_resume_handler,
-               .event_handler                  = scic_sds_remote_device_default_event_handler,
-               .frame_handler                  = scic_sds_remote_device_general_frame_handler
+               .start_handler          = scic_sds_remote_device_default_start_handler,
+               .stop_handler           = scic_sds_remote_device_resetting_state_stop_handler,
+               .fail_handler           = scic_sds_remote_device_default_fail_handler,
+               .destruct_handler       = scic_sds_remote_device_default_destruct_handler,
+               .reset_handler          = scic_sds_remote_device_default_reset_handler,
+               .reset_complete_handler = scic_sds_remote_device_resetting_state_reset_complete_handler,
+               .start_io_handler       = scic_sds_remote_device_default_start_request_handler,
+               .complete_io_handler    = scic_sds_remote_device_resetting_state_complete_request_handler,
+               .continue_io_handler    = scic_sds_remote_device_default_continue_request_handler,
+               .start_task_handler     = scic_sds_remote_device_default_start_request_handler,
+               .complete_task_handler  = scic_sds_remote_device_resetting_state_complete_request_handler,
+               .suspend_handler        = scic_sds_remote_device_default_suspend_handler,
+               .resume_handler         = scic_sds_remote_device_default_resume_handler,
+               .event_handler          = scic_sds_remote_device_default_event_handler,
+               .frame_handler          = scic_sds_remote_device_general_frame_handler
        },
        [SCI_BASE_REMOTE_DEVICE_STATE_FINAL] = {
-               .parent.start_handler           = scic_sds_remote_device_default_start_handler,
-               .parent.stop_handler            = scic_sds_remote_device_default_stop_handler,
-               .parent.fail_handler            = scic_sds_remote_device_default_fail_handler,
-               .parent.destruct_handler        = scic_sds_remote_device_default_destruct_handler,
-               .parent.reset_handler           = scic_sds_remote_device_default_reset_handler,
-               .parent.reset_complete_handler  = scic_sds_remote_device_default_reset_complete_handler,
-               .parent.start_io_handler        = scic_sds_remote_device_default_start_request_handler,
-               .parent.complete_io_handler     = scic_sds_remote_device_default_complete_request_handler,
-               .parent.continue_io_handler     = scic_sds_remote_device_default_continue_request_handler,
-               .parent.start_task_handler      = scic_sds_remote_device_default_start_request_handler,
-               .parent.complete_task_handler   = scic_sds_remote_device_default_complete_request_handler,
-               .suspend_handler                = scic_sds_remote_device_default_suspend_handler,
-               .resume_handler                 = scic_sds_remote_device_default_resume_handler,
-               .event_handler                  = scic_sds_remote_device_default_event_handler,
-               .frame_handler                  = scic_sds_remote_device_default_frame_handler
+               .start_handler          = scic_sds_remote_device_default_start_handler,
+               .stop_handler           = scic_sds_remote_device_default_stop_handler,
+               .fail_handler           = scic_sds_remote_device_default_fail_handler,
+               .destruct_handler       = scic_sds_remote_device_default_destruct_handler,
+               .reset_handler          = scic_sds_remote_device_default_reset_handler,
+               .reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
+               .start_io_handler       = scic_sds_remote_device_default_start_request_handler,
+               .complete_io_handler    = scic_sds_remote_device_default_complete_request_handler,
+               .continue_io_handler    = scic_sds_remote_device_default_continue_request_handler,
+               .start_task_handler     = scic_sds_remote_device_default_start_request_handler,
+               .complete_task_handler  = scic_sds_remote_device_default_complete_request_handler,
+               .suspend_handler        = scic_sds_remote_device_default_suspend_handler,
+               .resume_handler         = scic_sds_remote_device_default_resume_handler,
+               .event_handler          = scic_sds_remote_device_default_event_handler,
+               .frame_handler          = scic_sds_remote_device_default_frame_handler
        }
 };
 
@@ -1415,12 +1386,12 @@ static void scic_sds_remote_device_initial_state_enter(
 {
        struct scic_sds_remote_device *sci_dev = (struct scic_sds_remote_device *)object;
 
-       sci_dev = container_of(object, typeof(*sci_dev), parent.parent);
+       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);
 
        /* Initial state is a transitional state to the stopped state */
-       sci_base_state_machine_change_state(&sci_dev->parent.state_machine,
+       sci_base_state_machine_change_state(&sci_dev->state_machine,
                                            SCI_BASE_REMOTE_DEVICE_STATE_STOPPED);
 }
 
@@ -1443,7 +1414,7 @@ static void scic_sds_remote_device_stopped_state_enter(
        struct isci_host *ihost;
        u32 prev_state;
 
-       sci_dev = container_of(object, typeof(*sci_dev), parent.parent);
+       sci_dev = container_of(object, typeof(*sci_dev), parent);
        scic = scic_sds_remote_device_get_controller(sci_dev);
        ihost = sci_object_get_association(scic);
        idev = sci_object_get_association(sci_dev);
@@ -1454,7 +1425,7 @@ static void scic_sds_remote_device_stopped_state_enter(
        /* If we are entering from the stopping state let the SCI User know that
         * the stop operation has completed.
         */
-       prev_state = sci_dev->parent.state_machine.previous_state_id;
+       prev_state = sci_dev->state_machine.previous_state_id;
        if (prev_state == SCI_BASE_REMOTE_DEVICE_STATE_STOPPING)
                isci_remote_device_stop_complete(ihost, idev, SCI_SUCCESS);
 
@@ -1473,7 +1444,7 @@ static void scic_sds_remote_device_stopped_state_enter(
 static void scic_sds_remote_device_starting_state_enter(struct sci_base_object *object)
 {
        struct scic_sds_remote_device *sci_dev = container_of(object, typeof(*sci_dev),
-                                                             parent.parent);
+                                                             parent);
        struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev);
        struct isci_host *ihost = sci_object_get_association(scic);
        struct isci_remote_device *idev = sci_object_get_association(sci_dev);
@@ -1488,7 +1459,7 @@ static void scic_sds_remote_device_starting_state_enter(struct sci_base_object *
 static void scic_sds_remote_device_starting_state_exit(struct sci_base_object *object)
 {
        struct scic_sds_remote_device *sci_dev = container_of(object, typeof(*sci_dev),
-                                                             parent.parent);
+                                                             parent);
        struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev);
        struct isci_host *ihost = sci_object_get_association(scic);
        struct isci_remote_device *idev = sci_object_get_association(sci_dev);
@@ -1511,7 +1482,7 @@ static void scic_sds_remote_device_starting_state_exit(struct sci_base_object *o
 static void scic_sds_remote_device_ready_state_enter(struct sci_base_object *object)
 {
        struct scic_sds_remote_device *sci_dev = container_of(object, typeof(*sci_dev),
-                                                             parent.parent);
+                                                             parent);
        struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev);
        struct isci_host *ihost = sci_object_get_association(scic);
        struct isci_remote_device *idev = sci_object_get_association(sci_dev);
@@ -1540,7 +1511,7 @@ static void scic_sds_remote_device_ready_state_exit(
        struct sci_base_object *object)
 {
        struct scic_sds_remote_device *sci_dev = container_of(object, typeof(*sci_dev),
-                                                             parent.parent);
+                                                             parent);
        if (sci_dev->has_ready_substate_machine)
                sci_base_state_machine_stop(&sci_dev->ready_substate_machine);
        else {
@@ -1691,10 +1662,17 @@ 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->rnc = (struct scic_sds_remote_node_context *) &sci_dev[1];
+       sci_dev->parent.private = NULL;
 
-       sci_base_remote_device_construct(
+       sci_base_state_machine_construct(
+               &sci_dev->state_machine,
                &sci_dev->parent,
-               scic_sds_remote_device_state_table
+               scic_sds_remote_device_state_table,
+               SCI_BASE_REMOTE_DEVICE_STATE_INITIAL
+               );
+
+       sci_base_state_machine_start(
+               &sci_dev->state_machine
                );
 
        scic_sds_remote_node_context_construct(
index 90b2318338725f7deb370919da67c1cbec438f85..0e8bb0f98b1e9532de53b506717752f3764b9103 100644 (file)
 #ifndef _SCIC_SDS_REMOTE_DEVICE_H_
 #define _SCIC_SDS_REMOTE_DEVICE_H_
 
+#include "intel_sas.h"
+#include "scu_remote_node_context.h"
+#include "scic_sds_remote_node_context.h"
+
 /**
- * This file contains the structures, constants, and prototypes for the
- *    struct scic_sds_remote_device object.
+ * enum scic_sds_remote_device_states - This enumeration depicts all the states
+ *    for the common remote device state machine.
  *
  *
  */
+enum scic_sds_remote_device_states {
+       /**
+        * Simply the initial state for the base remote device state machine.
+        */
+       SCI_BASE_REMOTE_DEVICE_STATE_INITIAL,
 
-#include "intel_sas.h"
-#include "sci_base_remote_device.h"
-#include "scu_remote_node_context.h"
-#include "scic_sds_remote_node_context.h"
+       /**
+        * This state indicates that the remote device has successfully been
+        * stopped.  In this state no new IO operations are permitted.
+        * This state is entered from the INITIAL state.
+        * This state is entered from the STOPPING state.
+        */
+       SCI_BASE_REMOTE_DEVICE_STATE_STOPPED,
+
+       /**
+        * This state indicates the the remote device is in the process of
+        * becoming ready (i.e. starting).  In this state no new IO operations
+        * are permitted.
+        * This state is entered from the STOPPED state.
+        */
+       SCI_BASE_REMOTE_DEVICE_STATE_STARTING,
+
+       /**
+        * This state indicates the remote device is now ready.  Thus, the user
+        * is able to perform IO operations on the remote device.
+        * This state is entered from the STARTING state.
+        */
+       SCI_BASE_REMOTE_DEVICE_STATE_READY,
+
+       /**
+        * This state indicates that the remote device is in the process of
+        * stopping.  In this state no new IO operations are permitted, but
+        * existing IO operations are allowed to complete.
+        * This state is entered from the READY state.
+        * This state is entered from the FAILED state.
+        */
+       SCI_BASE_REMOTE_DEVICE_STATE_STOPPING,
+
+       /**
+        * This state indicates that the remote device has failed.
+        * In this state no new IO operations are permitted.
+        * This state is entered from the INITIALIZING state.
+        * This state is entered from the READY state.
+        */
+       SCI_BASE_REMOTE_DEVICE_STATE_FAILED,
 
-struct scic_sds_controller;
-struct scic_sds_port;
-struct scic_sds_request;
-struct scic_sds_remote_device_state_handler;
+       /**
+        * This state indicates the device is being reset.
+        * In this state no new IO operations are permitted.
+        * This state is entered from the READY state.
+        */
+       SCI_BASE_REMOTE_DEVICE_STATE_RESETTING,
+
+       /**
+        * Simply the final state for the base remote device state machine.
+        */
+       SCI_BASE_REMOTE_DEVICE_STATE_FINAL,
+};
 
 /**
  * enum scic_sds_ssp_remote_device_ready_substates -
@@ -186,14 +238,21 @@ enum scic_sds_smp_remote_device_ready_substates {
  */
 struct scic_sds_remote_device {
        /**
-        * This field is the common base for all remote device objects.
+        * 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.
         */
-       struct sci_base_remote_device parent;
+       struct sci_base_state_machine state_machine;
 
        /**
-        * This field is the programmed device port width.  This value is written to
-        * the RCN data structure to tell the SCU how many open connections this
-        * device can have.
+        * This field is the programmed device port width.  This value is
+        * written to the RCN data structure to tell the SCU how many open
+        * connections this device can have.
         */
        u32 device_port_width;
 
@@ -279,6 +338,16 @@ struct scic_sds_remote_device {
        const struct scic_sds_remote_device_state_handler *state_handlers;
 };
 
+typedef enum sci_status (*scic_sds_remote_device_request_handler_t)(
+       struct scic_sds_remote_device *device,
+       struct scic_sds_request *request);
+
+typedef enum sci_status (*scic_sds_remote_device_high_priority_request_complete_handler_t)(
+       struct scic_sds_remote_device *device,
+       struct scic_sds_request *request,
+       void *,
+       enum sci_io_status);
+
 typedef enum sci_status (*scic_sds_remote_device_handler_t)(
        struct scic_sds_remote_device *this_device);
 
@@ -308,7 +377,74 @@ typedef void (*scic_sds_remote_device_ready_not_ready_handler_t)(
  *
  */
 struct scic_sds_remote_device_state_handler {
-       struct sci_base_remote_device_state_handler parent;
+       /**
+        * The start_handler specifies the method invoked when a user
+        * attempts to start a remote device.
+        */
+       scic_sds_remote_device_handler_t start_handler;
+
+       /**
+        * The stop_handler specifies the method invoked when a user attempts to
+        * stop a remote device.
+        */
+       scic_sds_remote_device_handler_t stop_handler;
+
+       /**
+        * The fail_handler specifies the method invoked when a remote device
+        * failure has occurred.  A failure may be due to an inability to
+        * initialize/configure the device.
+        */
+       scic_sds_remote_device_handler_t fail_handler;
+
+       /**
+        * The destruct_handler specifies the method invoked when attempting to
+        * destruct a remote device.
+        */
+       scic_sds_remote_device_handler_t destruct_handler;
+
+       /**
+        * The reset handler specifies the method invloked when requesting to
+        * reset a remote device.
+        */
+       scic_sds_remote_device_handler_t reset_handler;
+
+       /**
+        * The reset complete handler specifies the method invloked when
+        * reporting that a reset has completed to the remote device.
+        */
+       scic_sds_remote_device_handler_t reset_complete_handler;
+
+       /**
+        * The start_io_handler specifies the method invoked when a user
+        * attempts to start an IO request for a remote device.
+        */
+       scic_sds_remote_device_request_handler_t start_io_handler;
+
+       /**
+        * The complete_io_handler specifies the method invoked when a user
+        * attempts to complete an IO request for a remote device.
+        */
+       scic_sds_remote_device_request_handler_t complete_io_handler;
+
+       /**
+        * The continue_io_handler specifies the method invoked when a user
+        * attempts to continue an IO request for a remote device.
+        */
+       scic_sds_remote_device_request_handler_t continue_io_handler;
+
+       /**
+        * The start_task_handler specifies the method invoked when a user
+        * attempts to start a task management request for a remote device.
+        */
+       scic_sds_remote_device_request_handler_t start_task_handler;
+
+       /**
+        * The complete_task_handler specifies the method invoked when a user
+        * attempts to complete a task management request for a remote device.
+        */
+       scic_sds_remote_device_request_handler_t complete_task_handler;
+
+
        scic_sds_remote_device_suspend_handler_t suspend_handler;
        scic_sds_remote_device_resume_handler_t resume_handler;
        scic_sds_remote_device_event_handler_t event_handler;
@@ -490,30 +626,30 @@ void scic_sds_remote_device_start_request(
 void scic_sds_remote_device_continue_request(void *sci_dev);
 
 enum sci_status scic_sds_remote_device_default_start_handler(
-       struct sci_base_remote_device *this_device);
+       struct scic_sds_remote_device *this_device);
 
 enum sci_status scic_sds_remote_device_default_fail_handler(
-       struct sci_base_remote_device *this_device);
+       struct scic_sds_remote_device *this_device);
 
 enum sci_status scic_sds_remote_device_default_destruct_handler(
-       struct sci_base_remote_device *this_device);
+       struct scic_sds_remote_device *this_device);
 
 enum sci_status scic_sds_remote_device_default_reset_handler(
-       struct sci_base_remote_device *device);
+       struct scic_sds_remote_device *device);
 
 enum sci_status scic_sds_remote_device_default_reset_complete_handler(
-       struct sci_base_remote_device *device);
+       struct scic_sds_remote_device *device);
 
 enum sci_status scic_sds_remote_device_default_start_request_handler(
-       struct sci_base_remote_device *device,
+       struct scic_sds_remote_device *device,
        struct scic_sds_request *request);
 
 enum sci_status scic_sds_remote_device_default_complete_request_handler(
-       struct sci_base_remote_device *device,
+       struct scic_sds_remote_device *device,
        struct scic_sds_request *request);
 
 enum sci_status scic_sds_remote_device_default_continue_request_handler(
-       struct sci_base_remote_device *device,
+       struct scic_sds_remote_device *device,
        struct scic_sds_request *request);
 
 enum sci_status scic_sds_remote_device_default_suspend_handler(
@@ -529,10 +665,10 @@ enum sci_status scic_sds_remote_device_default_frame_handler(
        u32 frame_index);
 
 enum sci_status scic_sds_remote_device_ready_state_stop_handler(
-       struct sci_base_remote_device *device);
+       struct scic_sds_remote_device *device);
 
 enum sci_status scic_sds_remote_device_ready_state_reset_handler(
-       struct sci_base_remote_device *device);
+       struct scic_sds_remote_device *device);
 
 enum sci_status scic_sds_remote_device_general_frame_handler(
        struct scic_sds_remote_device *this_device,
index 040a3d8c08b9dc8e0d442bab2e9c5b2fefcd7830..88c359548c1b99672e021c1e40bd6c81a6fef229 100644 (file)
  * the idle state. enum sci_status
  */
 static enum sci_status scic_sds_smp_remote_device_ready_idle_substate_start_io_handler(
-       struct sci_base_remote_device *device,
+       struct scic_sds_remote_device *device,
        struct scic_sds_request *request)
 {
        enum sci_status status;
-       struct scic_sds_remote_device *this_device = (struct scic_sds_remote_device *)device;
 
        /* Will the port allow the io request to start? */
-       status = this_device->owning_port->state_handlers->start_io_handler(
-               this_device->owning_port, this_device, request);
+       status = device->owning_port->state_handlers->start_io_handler(
+                       device->owning_port, device, request);
 
        if (status == SCI_SUCCESS) {
-               status =
-                       scic_sds_remote_node_context_start_io(this_device->rnc, request);
+               status = scic_sds_remote_node_context_start_io(
+                               device->rnc, request);
 
                if (status == SCI_SUCCESS)
                        status = scic_sds_request_start(request);
 
                if (status == SCI_SUCCESS) {
-                       this_device->working_request = request;
+                       device->working_request = request;
 
                        sci_base_state_machine_change_state(
-                               &this_device->ready_substate_machine,
+                               &device->ready_substate_machine,
                                SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_CMD
                                );
                }
 
-               scic_sds_remote_device_start_request(this_device, request, status);
+               scic_sds_remote_device_start_request(device, request, status);
        }
 
        return status;
@@ -123,7 +122,7 @@ static enum sci_status scic_sds_smp_remote_device_ready_idle_substate_start_io_h
  * until this one is complete. enum sci_status
  */
 static enum sci_status scic_sds_smp_remote_device_ready_cmd_substate_start_io_handler(
-       struct sci_base_remote_device *device,
+       struct scic_sds_remote_device *device,
        struct scic_sds_request *request)
 {
        return SCI_FAILURE_INVALID_STATE;
@@ -137,38 +136,37 @@ static enum sci_status scic_sds_smp_remote_device_ready_cmd_substate_start_io_ha
  *
  * enum sci_status
  */
-static enum sci_status scic_sds_smp_remote_device_ready_cmd_substate_complete_io_handler(
-       struct sci_base_remote_device *device,
+static enum sci_status
+scic_sds_smp_remote_device_ready_cmd_substate_complete_io_handler(
+       struct scic_sds_remote_device *device,
        struct scic_sds_request *request)
 {
        enum sci_status status;
-       struct scic_sds_remote_device *this_device;
        struct scic_sds_request *the_request;
 
-       this_device = (struct scic_sds_remote_device *)device;
        the_request = (struct scic_sds_request *)request;
 
        status = scic_sds_io_request_complete(the_request);
 
        if (status == SCI_SUCCESS) {
                status = scic_sds_port_complete_io(
-                       this_device->owning_port, this_device, the_request);
+                       device->owning_port, device, the_request);
 
                if (status == SCI_SUCCESS) {
-                       scic_sds_remote_device_decrement_request_count(this_device);
+                       scic_sds_remote_device_decrement_request_count(device);
                        sci_base_state_machine_change_state(
-                               &this_device->ready_substate_machine,
+                               &device->ready_substate_machine,
                                SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_IDLE
                                );
                } else
-                       dev_err(scirdev_to_dev(this_device),
+                       dev_err(scirdev_to_dev(device),
                                "%s: SCIC SDS Remote Device 0x%p io request "
                                "0x%p could not be completd on the port 0x%p "
                                "failed with status %d.\n",
                                __func__,
-                               this_device,
+                               device,
                                the_request,
-                               this_device->owning_port,
+                               device->owning_port,
                                status);
        }
 
@@ -204,38 +202,38 @@ static enum sci_status scic_sds_smp_remote_device_ready_cmd_substate_frame_handl
 
 static const struct scic_sds_remote_device_state_handler scic_sds_smp_remote_device_ready_substate_handler_table[] = {
        [SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_IDLE] = {
-               .parent.start_handler           = scic_sds_remote_device_default_start_handler,
-               .parent.stop_handler            = scic_sds_remote_device_ready_state_stop_handler,
-               .parent.fail_handler            = scic_sds_remote_device_default_fail_handler,
-               .parent.destruct_handler        = scic_sds_remote_device_default_destruct_handler,
-               .parent.reset_handler           = scic_sds_remote_device_default_reset_handler,
-               .parent.reset_complete_handler  = scic_sds_remote_device_default_reset_complete_handler,
-               .parent.start_io_handler        = scic_sds_smp_remote_device_ready_idle_substate_start_io_handler,
-               .parent.complete_io_handler     = scic_sds_remote_device_default_complete_request_handler,
-               .parent.continue_io_handler     = scic_sds_remote_device_default_continue_request_handler,
-               .parent.start_task_handler      = scic_sds_remote_device_default_start_request_handler,
-               .parent.complete_task_handler   = scic_sds_remote_device_default_complete_request_handler,
-               .suspend_handler                = scic_sds_remote_device_default_suspend_handler,
-               .resume_handler                 = scic_sds_remote_device_default_resume_handler,
-               .event_handler                  = scic_sds_remote_device_general_event_handler,
-               .frame_handler                  = scic_sds_remote_device_default_frame_handler
+               .start_handler          = scic_sds_remote_device_default_start_handler,
+               .stop_handler           = scic_sds_remote_device_ready_state_stop_handler,
+               .fail_handler           = scic_sds_remote_device_default_fail_handler,
+               .destruct_handler       = scic_sds_remote_device_default_destruct_handler,
+               .reset_handler          = scic_sds_remote_device_default_reset_handler,
+               .reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
+               .start_io_handler       = scic_sds_smp_remote_device_ready_idle_substate_start_io_handler,
+               .complete_io_handler    = scic_sds_remote_device_default_complete_request_handler,
+               .continue_io_handler    = scic_sds_remote_device_default_continue_request_handler,
+               .start_task_handler     = scic_sds_remote_device_default_start_request_handler,
+               .complete_task_handler  = scic_sds_remote_device_default_complete_request_handler,
+               .suspend_handler        = scic_sds_remote_device_default_suspend_handler,
+               .resume_handler         = scic_sds_remote_device_default_resume_handler,
+               .event_handler          = scic_sds_remote_device_general_event_handler,
+               .frame_handler          = scic_sds_remote_device_default_frame_handler
        },
        [SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_CMD] = {
-               .parent.start_handler           = scic_sds_remote_device_default_start_handler,
-               .parent.stop_handler            = scic_sds_remote_device_ready_state_stop_handler,
-               .parent.fail_handler            = scic_sds_remote_device_default_fail_handler,
-               .parent.destruct_handler        = scic_sds_remote_device_default_destruct_handler,
-               .parent.reset_handler           = scic_sds_remote_device_default_reset_handler,
-               .parent.reset_complete_handler  = scic_sds_remote_device_default_reset_complete_handler,
-               .parent.start_io_handler        = scic_sds_smp_remote_device_ready_cmd_substate_start_io_handler,
-               .parent.complete_io_handler     = scic_sds_smp_remote_device_ready_cmd_substate_complete_io_handler,
-               .parent.continue_io_handler     = scic_sds_remote_device_default_continue_request_handler,
-               .parent.start_task_handler      = scic_sds_remote_device_default_start_request_handler,
-               .parent.complete_task_handler   = scic_sds_remote_device_default_complete_request_handler,
-               .suspend_handler                = scic_sds_remote_device_default_suspend_handler,
-               .resume_handler                 = scic_sds_remote_device_default_resume_handler,
-               .event_handler                  = scic_sds_remote_device_general_event_handler,
-               .frame_handler                  = scic_sds_smp_remote_device_ready_cmd_substate_frame_handler
+               .start_handler          = scic_sds_remote_device_default_start_handler,
+               .stop_handler           = scic_sds_remote_device_ready_state_stop_handler,
+               .fail_handler           = scic_sds_remote_device_default_fail_handler,
+               .destruct_handler       = scic_sds_remote_device_default_destruct_handler,
+               .reset_handler          = scic_sds_remote_device_default_reset_handler,
+               .reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
+               .start_io_handler       = scic_sds_smp_remote_device_ready_cmd_substate_start_io_handler,
+               .complete_io_handler    = scic_sds_smp_remote_device_ready_cmd_substate_complete_io_handler,
+               .continue_io_handler    = scic_sds_remote_device_default_continue_request_handler,
+               .start_task_handler     = scic_sds_remote_device_default_start_request_handler,
+               .complete_task_handler  = scic_sds_remote_device_default_complete_request_handler,
+               .suspend_handler        = scic_sds_remote_device_default_suspend_handler,
+               .resume_handler         = scic_sds_remote_device_default_resume_handler,
+               .event_handler          = scic_sds_remote_device_general_event_handler,
+               .frame_handler          = scic_sds_smp_remote_device_ready_cmd_substate_frame_handler
        }
 };
 
@@ -251,7 +249,7 @@ 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(struct sci_base_object *object)
 {
        struct scic_sds_remote_device *sci_dev = container_of(object, typeof(*sci_dev),
-                                                             parent.parent);
+                                                             parent);
        struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev);
        struct isci_host *ihost = sci_object_get_association(scic);
        struct isci_remote_device *idev = sci_object_get_association(sci_dev);
@@ -276,7 +274,7 @@ static void scic_sds_smp_remote_device_ready_cmd_substate_enter(
        struct sci_base_object *object)
 {
        struct scic_sds_remote_device *sci_dev = container_of(object, typeof(*sci_dev),
-                                                             parent.parent);
+                                                             parent);
        struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev);
        struct isci_host *ihost = sci_object_get_association(scic);
        struct isci_remote_device *idev = sci_object_get_association(sci_dev);
@@ -301,7 +299,7 @@ static void scic_sds_smp_remote_device_ready_cmd_substate_enter(
 static void scic_sds_smp_remote_device_ready_cmd_substate_exit(struct sci_base_object *object)
 {
        struct scic_sds_remote_device *sci_dev = container_of(object, typeof(*sci_dev),
-                                                             parent.parent);
+                                                             parent);
        sci_dev->working_request = NULL;
 }
 
index bb582497039b22968f231d89a96be681cedfc5cc..a5b1fe3229ceeee1e5b0bcd106ae6a1dab79f260 100644 (file)
  * completed successfully.
  */
 static enum sci_status scic_sds_stp_remote_device_complete_request(
-       struct sci_base_remote_device *device,
+       struct scic_sds_remote_device *device,
        struct scic_sds_request *request)
 {
-       struct scic_sds_remote_device *this_device = (struct scic_sds_remote_device *)device;
        enum sci_status status;
 
        status = scic_sds_io_request_complete(request);
 
        if (status == SCI_SUCCESS) {
                status = scic_sds_port_complete_io(
-                       this_device->owning_port, this_device, request);
+                       device->owning_port, device, request);
 
                if (status == SCI_SUCCESS) {
-                       scic_sds_remote_device_decrement_request_count(this_device);
+                       scic_sds_remote_device_decrement_request_count(device);
                        if (request->sci_status == SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED) {
                                /*
                                 * This request causes hardware error, device needs to be Lun Reset.
@@ -98,12 +97,12 @@ static enum sci_status scic_sds_stp_remote_device_complete_request(
                                 * can reach RNC state handler, these IOs will be completed by RNC with
                                 * status of "DEVICE_RESET_REQUIRED", instead of "INVALID STATE". */
                                sci_base_state_machine_change_state(
-                                       &this_device->ready_substate_machine,
+                                       &device->ready_substate_machine,
                                        SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_AWAIT_RESET
                                        );
-                       } else if (scic_sds_remote_device_get_request_count(this_device) == 0) {
+                       } else if (scic_sds_remote_device_get_request_count(device) == 0) {
                                sci_base_state_machine_change_state(
-                                       &this_device->ready_substate_machine,
+                                       &device->ready_substate_machine,
                                        SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_IDLE
                                        );
                        }
@@ -111,12 +110,12 @@ static enum sci_status scic_sds_stp_remote_device_complete_request(
        }
 
        if (status != SCI_SUCCESS)
-               dev_err(scirdev_to_dev(this_device),
+               dev_err(scirdev_to_dev(device),
                        "%s: Port:0x%p Device:0x%p Request:0x%p Status:0x%x "
                        "could not complete\n",
                        __func__,
-                       this_device->owning_port,
-                       this_device,
+                       device->owning_port,
+                       device,
                        request,
                        status);
 
@@ -140,19 +139,18 @@ static enum sci_status scic_sds_stp_remote_device_complete_request(
  * callback will be called.
  */
 static enum sci_status scic_sds_stp_remote_device_ready_substate_start_request_handler(
-       struct sci_base_remote_device *device,
+       struct scic_sds_remote_device *device,
        struct scic_sds_request *request)
 {
        enum sci_status status;
-       struct scic_sds_remote_device *this_device  = (struct scic_sds_remote_device *)device;
 
        /* Will the port allow the io request to start? */
-       status = this_device->owning_port->state_handlers->start_io_handler(
-               this_device->owning_port, this_device, request);
+       status = device->owning_port->state_handlers->start_io_handler(
+               device->owning_port, device, request);
        if (status != SCI_SUCCESS)
                return status;
 
-       status = scic_sds_remote_node_context_start_task(this_device->rnc, request);
+       status = scic_sds_remote_node_context_start_task(device->rnc, request);
        if (status != SCI_SUCCESS)
                goto out;
 
@@ -164,8 +162,8 @@ static enum sci_status scic_sds_stp_remote_device_ready_substate_start_request_h
         * Note: If the remote device state is not IDLE this will replace
         * the request that probably resulted in the task management request.
         */
-       this_device->working_request = request;
-       sci_base_state_machine_change_state(&this_device->ready_substate_machine,
+       device->working_request = request;
+       sci_base_state_machine_change_state(&device->ready_substate_machine,
                        SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_CMD);
 
        /*
@@ -175,14 +173,14 @@ static enum sci_status scic_sds_stp_remote_device_ready_substate_start_request_h
         * remote node context state machine will take the correct action when
         * the remote node context is suspended and later resumed.
         */
-       scic_sds_remote_node_context_suspend(this_device->rnc,
+       scic_sds_remote_node_context_suspend(device->rnc,
                        SCI_SOFTWARE_SUSPENSION, NULL, NULL);
-       scic_sds_remote_node_context_resume(this_device->rnc,
+       scic_sds_remote_node_context_resume(device->rnc,
                        scic_sds_remote_device_continue_request,
-                       this_device);
+                       device);
 
 out:
-       scic_sds_remote_device_start_request(this_device, request, status);
+       scic_sds_remote_device_start_request(device, request, status);
        /*
         * We need to let the controller start request handler know that it can't
         * post TC yet. We will provide a callback function to post TC when RNC gets
@@ -208,23 +206,21 @@ out:
  * enum sci_status
  */
 static enum sci_status scic_sds_stp_remote_device_ready_idle_substate_start_io_handler(
-       struct sci_base_remote_device *base_device,
+       struct scic_sds_remote_device *sci_dev,
        struct scic_sds_request *request)
 {
        enum sci_status status;
-       struct scic_sds_remote_device *device =
-               (struct scic_sds_remote_device *)&base_device->parent;
        struct isci_request *isci_request =
                (struct isci_request *)sci_object_get_association(request);
 
 
        /* Will the port allow the io request to start? */
-       status = device->owning_port->state_handlers->start_io_handler(
-                       device->owning_port, device, request);
+       status = sci_dev->owning_port->state_handlers->start_io_handler(
+                       sci_dev->owning_port, sci_dev, request);
        if (status != SCI_SUCCESS)
                return status;
 
-       status = scic_sds_remote_node_context_start_io(device->rnc, request);
+       status = scic_sds_remote_node_context_start_io(sci_dev->rnc, request);
        if (status != SCI_SUCCESS)
                goto out;
 
@@ -233,15 +229,15 @@ static enum sci_status scic_sds_stp_remote_device_ready_idle_substate_start_io_h
                goto out;
 
        if (isci_sata_get_sat_protocol(isci_request) == SAT_PROTOCOL_FPDMA) {
-               sci_base_state_machine_change_state(&device->ready_substate_machine,
+               sci_base_state_machine_change_state(&sci_dev->ready_substate_machine,
                                SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ);
        } else {
-               device->working_request = request;
-               sci_base_state_machine_change_state(&device->ready_substate_machine,
+               sci_dev->working_request = request;
+               sci_base_state_machine_change_state(&sci_dev->ready_substate_machine,
                                SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_CMD);
        }
 out:
-       scic_sds_remote_device_start_request(device, request, status);
+       scic_sds_remote_device_start_request(sci_dev, request, status);
        return status;
 }
 
@@ -281,30 +277,28 @@ static enum sci_status scic_sds_stp_remote_device_ready_idle_substate_event_hand
  * ***************************************************************************** */
 
 static enum sci_status scic_sds_stp_remote_device_ready_ncq_substate_start_io_handler(
-       struct sci_base_remote_device *base_device,
+       struct scic_sds_remote_device *sci_dev,
        struct scic_sds_request *request)
 {
        enum sci_status status;
-       struct scic_sds_remote_device *device =
-               (struct scic_sds_remote_device *)&base_device->parent;
        struct isci_request *isci_request =
                (struct isci_request *)sci_object_get_association(request);
 
        if (isci_sata_get_sat_protocol(isci_request) == SAT_PROTOCOL_FPDMA) {
-               status = device->owning_port->state_handlers->start_io_handler(
-                               device->owning_port,
-                               device,
+               status = sci_dev->owning_port->state_handlers->start_io_handler(
+                               sci_dev->owning_port,
+                               sci_dev,
                                request);
 
                if (status == SCI_SUCCESS) {
                        status = scic_sds_remote_node_context_start_io(
-                                       device->rnc,
+                                       sci_dev->rnc,
                                        request);
 
                        if (status == SCI_SUCCESS)
                                status = request->state_handlers->start_handler(request);
 
-                       scic_sds_remote_device_start_request(device,
+                       scic_sds_remote_device_start_request(sci_dev,
                                                             request,
                                                             status);
                }
@@ -392,7 +386,7 @@ static enum sci_status scic_sds_stp_remote_device_ready_ncq_substate_frame_handl
  * enum sci_status
  */
 static enum sci_status scic_sds_stp_remote_device_ready_cmd_substate_start_io_handler(
-       struct sci_base_remote_device *device,
+       struct scic_sds_remote_device *device,
        struct scic_sds_request *request)
 {
        return SCI_FAILURE_INVALID_STATE;
@@ -445,7 +439,7 @@ static enum sci_status scic_sds_stp_remote_device_ready_cmd_substate_frame_handl
  * *  STP REMOTE DEVICE READY AWAIT RESET SUBSTATE HANDLERS
  * ***************************************************************************** */
 static enum sci_status scic_sds_stp_remote_device_ready_await_reset_substate_start_io_handler(
-       struct sci_base_remote_device *device,
+       struct scic_sds_remote_device *device,
        struct scic_sds_request *request)
 {
        return SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED;
@@ -464,10 +458,9 @@ static enum sci_status scic_sds_stp_remote_device_ready_await_reset_substate_sta
  * completed successfully.
  */
 static enum sci_status scic_sds_stp_remote_device_ready_await_reset_substate_complete_request_handler(
-       struct sci_base_remote_device *device,
+       struct scic_sds_remote_device *device,
        struct scic_sds_request *request)
 {
-       struct scic_sds_remote_device *this_device = (struct scic_sds_remote_device *)device;
        struct scic_sds_request *the_request = (struct scic_sds_request *)request;
        enum sci_status status;
 
@@ -475,20 +468,20 @@ static enum sci_status scic_sds_stp_remote_device_ready_await_reset_substate_com
 
        if (status == SCI_SUCCESS) {
                status = scic_sds_port_complete_io(
-                       this_device->owning_port, this_device, the_request
+                       device->owning_port, device, the_request
                        );
 
                if (status == SCI_SUCCESS)
-                       scic_sds_remote_device_decrement_request_count(this_device);
+                       scic_sds_remote_device_decrement_request_count(device);
        }
 
        if (status != SCI_SUCCESS)
-               dev_err(scirdev_to_dev(this_device),
+               dev_err(scirdev_to_dev(device),
                        "%s: Port:0x%p Device:0x%p Request:0x%p Status:0x%x "
                        "could not complete\n",
                        __func__,
-                       this_device->owning_port,
-                       this_device,
+                       device->owning_port,
+                       device,
                        the_request,
                        status);
 
@@ -538,68 +531,68 @@ enum sci_status scic_sds_stp_remote_device_ready_atapi_error_substate_event_hand
 
 static const struct scic_sds_remote_device_state_handler scic_sds_stp_remote_device_ready_substate_handler_table[] = {
        [SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_IDLE] = {
-               .parent.start_handler           = scic_sds_remote_device_default_start_handler,
-               .parent.stop_handler            = scic_sds_remote_device_ready_state_stop_handler,
-               .parent.fail_handler            = scic_sds_remote_device_default_fail_handler,
-               .parent.destruct_handler        = scic_sds_remote_device_default_destruct_handler,
-               .parent.reset_handler           = scic_sds_remote_device_ready_state_reset_handler,
-               .parent.reset_complete_handler  = scic_sds_remote_device_default_reset_complete_handler,
-               .parent.start_io_handler        = scic_sds_stp_remote_device_ready_idle_substate_start_io_handler,
-               .parent.complete_io_handler     = scic_sds_remote_device_default_complete_request_handler,
-               .parent.continue_io_handler     = scic_sds_remote_device_default_continue_request_handler,
-               .parent.start_task_handler      = scic_sds_stp_remote_device_ready_substate_start_request_handler,
-               .parent.complete_task_handler   = scic_sds_remote_device_default_complete_request_handler,
+               .start_handler          = scic_sds_remote_device_default_start_handler,
+               .stop_handler           = scic_sds_remote_device_ready_state_stop_handler,
+               .fail_handler           = scic_sds_remote_device_default_fail_handler,
+               .destruct_handler       = scic_sds_remote_device_default_destruct_handler,
+               .reset_handler          = scic_sds_remote_device_ready_state_reset_handler,
+               .reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
+               .start_io_handler       = scic_sds_stp_remote_device_ready_idle_substate_start_io_handler,
+               .complete_io_handler    = scic_sds_remote_device_default_complete_request_handler,
+               .continue_io_handler    = scic_sds_remote_device_default_continue_request_handler,
+               .start_task_handler     = scic_sds_stp_remote_device_ready_substate_start_request_handler,
+               .complete_task_handler  = scic_sds_remote_device_default_complete_request_handler,
                .suspend_handler                = scic_sds_remote_device_default_suspend_handler,
                .resume_handler                 = scic_sds_remote_device_default_resume_handler,
                .event_handler                  = scic_sds_stp_remote_device_ready_idle_substate_event_handler,
                .frame_handler                  = scic_sds_remote_device_default_frame_handler
        },
        [SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_CMD] = {
-               .parent.start_handler           = scic_sds_remote_device_default_start_handler,
-               .parent.stop_handler            = scic_sds_remote_device_ready_state_stop_handler,
-               .parent.fail_handler            = scic_sds_remote_device_default_fail_handler,
-               .parent.destruct_handler        = scic_sds_remote_device_default_destruct_handler,
-               .parent.reset_handler           = scic_sds_remote_device_ready_state_reset_handler,
-               .parent.reset_complete_handler  = scic_sds_remote_device_default_reset_complete_handler,
-               .parent.start_io_handler        = scic_sds_stp_remote_device_ready_cmd_substate_start_io_handler,
-               .parent.complete_io_handler     = scic_sds_stp_remote_device_complete_request,
-               .parent.continue_io_handler     = scic_sds_remote_device_default_continue_request_handler,
-               .parent.start_task_handler      = scic_sds_stp_remote_device_ready_substate_start_request_handler,
-               .parent.complete_task_handler   = scic_sds_stp_remote_device_complete_request,
+               .start_handler          = scic_sds_remote_device_default_start_handler,
+               .stop_handler           = scic_sds_remote_device_ready_state_stop_handler,
+               .fail_handler           = scic_sds_remote_device_default_fail_handler,
+               .destruct_handler       = scic_sds_remote_device_default_destruct_handler,
+               .reset_handler          = scic_sds_remote_device_ready_state_reset_handler,
+               .reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
+               .start_io_handler       = scic_sds_stp_remote_device_ready_cmd_substate_start_io_handler,
+               .complete_io_handler    = scic_sds_stp_remote_device_complete_request,
+               .continue_io_handler    = scic_sds_remote_device_default_continue_request_handler,
+               .start_task_handler     = scic_sds_stp_remote_device_ready_substate_start_request_handler,
+               .complete_task_handler  = scic_sds_stp_remote_device_complete_request,
                .suspend_handler                = scic_sds_stp_remote_device_ready_cmd_substate_suspend_handler,
                .resume_handler                 = scic_sds_remote_device_default_resume_handler,
                .event_handler                  = scic_sds_remote_device_general_event_handler,
                .frame_handler                  = scic_sds_stp_remote_device_ready_cmd_substate_frame_handler
        },
        [SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ] = {
-               .parent.start_handler           = scic_sds_remote_device_default_start_handler,
-               .parent.stop_handler            = scic_sds_remote_device_ready_state_stop_handler,
-               .parent.fail_handler            = scic_sds_remote_device_default_fail_handler,
-               .parent.destruct_handler        = scic_sds_remote_device_default_destruct_handler,
-               .parent.reset_handler           = scic_sds_remote_device_ready_state_reset_handler,
-               .parent.reset_complete_handler  = scic_sds_remote_device_default_reset_complete_handler,
-               .parent.start_io_handler        = scic_sds_stp_remote_device_ready_ncq_substate_start_io_handler,
-               .parent.complete_io_handler     = scic_sds_stp_remote_device_complete_request,
-               .parent.continue_io_handler     = scic_sds_remote_device_default_continue_request_handler,
-               .parent.start_task_handler      = scic_sds_stp_remote_device_ready_substate_start_request_handler,
-               .parent.complete_task_handler   = scic_sds_stp_remote_device_complete_request,
+               .start_handler          = scic_sds_remote_device_default_start_handler,
+               .stop_handler           = scic_sds_remote_device_ready_state_stop_handler,
+               .fail_handler           = scic_sds_remote_device_default_fail_handler,
+               .destruct_handler       = scic_sds_remote_device_default_destruct_handler,
+               .reset_handler          = scic_sds_remote_device_ready_state_reset_handler,
+               .reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
+               .start_io_handler       = scic_sds_stp_remote_device_ready_ncq_substate_start_io_handler,
+               .complete_io_handler    = scic_sds_stp_remote_device_complete_request,
+               .continue_io_handler    = scic_sds_remote_device_default_continue_request_handler,
+               .start_task_handler     = scic_sds_stp_remote_device_ready_substate_start_request_handler,
+               .complete_task_handler  = scic_sds_stp_remote_device_complete_request,
                .suspend_handler                = scic_sds_remote_device_default_suspend_handler,
                .resume_handler                 = scic_sds_remote_device_default_resume_handler,
                .event_handler                  = scic_sds_remote_device_general_event_handler,
                .frame_handler                  = scic_sds_stp_remote_device_ready_ncq_substate_frame_handler
        },
        [SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ_ERROR] = {
-               .parent.start_handler           = scic_sds_remote_device_default_start_handler,
-               .parent.stop_handler            = scic_sds_remote_device_ready_state_stop_handler,
-               .parent.fail_handler            = scic_sds_remote_device_default_fail_handler,
-               .parent.destruct_handler        = scic_sds_remote_device_default_destruct_handler,
-               .parent.reset_handler           = scic_sds_remote_device_ready_state_reset_handler,
-               .parent.reset_complete_handler  = scic_sds_remote_device_default_reset_complete_handler,
-               .parent.start_io_handler        = scic_sds_remote_device_default_start_request_handler,
-               .parent.complete_io_handler     = scic_sds_stp_remote_device_complete_request,
-               .parent.continue_io_handler     = scic_sds_remote_device_default_continue_request_handler,
-               .parent.start_task_handler      = scic_sds_stp_remote_device_ready_substate_start_request_handler,
-               .parent.complete_task_handler   = scic_sds_stp_remote_device_complete_request,
+               .start_handler          = scic_sds_remote_device_default_start_handler,
+               .stop_handler           = scic_sds_remote_device_ready_state_stop_handler,
+               .fail_handler           = scic_sds_remote_device_default_fail_handler,
+               .destruct_handler       = scic_sds_remote_device_default_destruct_handler,
+               .reset_handler          = scic_sds_remote_device_ready_state_reset_handler,
+               .reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
+               .start_io_handler       = scic_sds_remote_device_default_start_request_handler,
+               .complete_io_handler    = scic_sds_stp_remote_device_complete_request,
+               .continue_io_handler    = scic_sds_remote_device_default_continue_request_handler,
+               .start_task_handler     = scic_sds_stp_remote_device_ready_substate_start_request_handler,
+               .complete_task_handler  = scic_sds_stp_remote_device_complete_request,
                .suspend_handler                = scic_sds_remote_device_default_suspend_handler,
                .resume_handler                 = scic_sds_remote_device_default_resume_handler,
                .event_handler                  = scic_sds_remote_device_general_event_handler,
@@ -607,17 +600,17 @@ static const struct scic_sds_remote_device_state_handler scic_sds_stp_remote_dev
        },
 #if !defined(DISABLE_ATAPI)
        [SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_ATAPI_ERROR] = {
-               .parent.start_handler           = scic_sds_remote_device_default_start_handler,
-               .parent.stop_handler            = scic_sds_remote_device_ready_state_stop_handler,
-               .parent.fail_handler            = scic_sds_remote_device_default_fail_handler,
-               .parent.destruct_handler        = scic_sds_remote_device_default_destruct_handler,
-               .parent.reset_handler           = scic_sds_remote_device_ready_state_reset_handler,
-               .parent.reset_complete_handler  = scic_sds_remote_device_default_reset_complete_handler,
-               .parent.start_io_handler        = scic_sds_remote_device_default_start_request_handler,
-               .parent.complete_io_handler     = scic_sds_stp_remote_device_complete_request,
-               .parent.continue_io_handler     = scic_sds_remote_device_default_continue_request_handler,
-               .parent.start_task_handler      = scic_sds_stp_remote_device_ready_substate_start_request_handler,
-               .parent.complete_task_handler   = scic_sds_stp_remote_device_complete_request,
+               .start_handler          = scic_sds_remote_device_default_start_handler,
+               .stop_handler           = scic_sds_remote_device_ready_state_stop_handler,
+               .fail_handler           = scic_sds_remote_device_default_fail_handler,
+               .destruct_handler       = scic_sds_remote_device_default_destruct_handler,
+               .reset_handler          = scic_sds_remote_device_ready_state_reset_handler,
+               .reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
+               .start_io_handler       = scic_sds_remote_device_default_start_request_handler,
+               .complete_io_handler    = scic_sds_stp_remote_device_complete_request,
+               .continue_io_handler    = scic_sds_remote_device_default_continue_request_handler,
+               .start_task_handler     = scic_sds_stp_remote_device_ready_substate_start_request_handler,
+               .complete_task_handler  = scic_sds_stp_remote_device_complete_request,
                .suspend_handler                = scic_sds_remote_device_default_suspend_handler,
                .resume_handler                 = scic_sds_remote_device_default_resume_handler,
                .event_handler                  = scic_sds_stp_remote_device_ready_atapi_error_substate_event_handler,
@@ -625,17 +618,17 @@ static const struct scic_sds_remote_device_state_handler scic_sds_stp_remote_dev
        },
 #endif
        [SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_AWAIT_RESET] = {
-               .parent.start_handler           = scic_sds_remote_device_default_start_handler,
-               .parent.stop_handler            = scic_sds_remote_device_ready_state_stop_handler,
-               .parent.fail_handler            = scic_sds_remote_device_default_fail_handler,
-               .parent.destruct_handler        = scic_sds_remote_device_default_destruct_handler,
-               .parent.reset_handler           = scic_sds_remote_device_ready_state_reset_handler,
-               .parent.reset_complete_handler  = scic_sds_remote_device_default_reset_complete_handler,
-               .parent.start_io_handler        = scic_sds_stp_remote_device_ready_await_reset_substate_start_io_handler,
-               .parent.complete_io_handler     = scic_sds_stp_remote_device_ready_await_reset_substate_complete_request_handler,
-               .parent.continue_io_handler     = scic_sds_remote_device_default_continue_request_handler,
-               .parent.start_task_handler      = scic_sds_stp_remote_device_ready_substate_start_request_handler,
-               .parent.complete_task_handler   = scic_sds_stp_remote_device_complete_request,
+               .start_handler          = scic_sds_remote_device_default_start_handler,
+               .stop_handler           = scic_sds_remote_device_ready_state_stop_handler,
+               .fail_handler           = scic_sds_remote_device_default_fail_handler,
+               .destruct_handler       = scic_sds_remote_device_default_destruct_handler,
+               .reset_handler          = scic_sds_remote_device_ready_state_reset_handler,
+               .reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
+               .start_io_handler       = scic_sds_stp_remote_device_ready_await_reset_substate_start_io_handler,
+               .complete_io_handler    = scic_sds_stp_remote_device_ready_await_reset_substate_complete_request_handler,
+               .continue_io_handler    = scic_sds_remote_device_default_continue_request_handler,
+               .start_task_handler     = scic_sds_stp_remote_device_ready_substate_start_request_handler,
+               .complete_task_handler  = scic_sds_stp_remote_device_complete_request,
                .suspend_handler                = scic_sds_remote_device_default_suspend_handler,
                .resume_handler                 = scic_sds_remote_device_default_resume_handler,
                .event_handler                  = scic_sds_remote_device_general_event_handler,
@@ -711,7 +704,7 @@ static void scic_sds_stp_remote_device_ready_idle_substate_enter(
 static void scic_sds_stp_remote_device_ready_cmd_substate_enter(struct sci_base_object *object)
 {
        struct scic_sds_remote_device *sci_dev = container_of(object, typeof(*sci_dev),
-                                                             parent.parent);
+                                                             parent);
        struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev);
        struct isci_host *ihost = sci_object_get_association(scic);
        struct isci_remote_device *idev = sci_object_get_association(sci_dev);
@@ -729,7 +722,7 @@ static void scic_sds_stp_remote_device_ready_cmd_substate_enter(struct sci_base_
 static void scic_sds_stp_remote_device_ready_ncq_substate_enter(struct sci_base_object *object)
 {
        struct scic_sds_remote_device *sci_dev = container_of(object, typeof(*sci_dev),
-                                                             parent.parent);
+                                                             parent);
        SET_STATE_HANDLER(sci_dev,
                          scic_sds_stp_remote_device_ready_substate_handler_table,
                          SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ);
@@ -738,7 +731,7 @@ static void scic_sds_stp_remote_device_ready_ncq_substate_enter(struct sci_base_
 static void scic_sds_stp_remote_device_ready_ncq_error_substate_enter(struct sci_base_object *object)
 {
        struct scic_sds_remote_device *sci_dev = container_of(object, typeof(*sci_dev),
-                                                             parent.parent);
+                                                             parent);
        struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev);
        struct isci_host *ihost = sci_object_get_association(scic);
        struct isci_remote_device *idev = sci_object_get_association(sci_dev);