From: Maciej Patelczyk Date: Thu, 28 Apr 2011 22:06:21 +0000 (+0000) Subject: isci: Removed sci_base_object from scic_sds_remote_device. X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=5d937e966d383c4012c19b0e47dc196ba505eb19;p=GitHub%2Fmt8127%2Fandroid_kernel_alcatel_ttab.git isci: Removed sci_base_object from scic_sds_remote_device. The 'struct sci_base_object' was removed from the struct scic_sds_remote_device. Signed-off-by: Maciej Patelczyk [cleaned up sci_dev_to_idev] Signed-off-by: Dan Williams --- diff --git a/drivers/scsi/isci/remote_device.c b/drivers/scsi/isci/remote_device.c index bb696cf11f2c..3fc66b2a5992 100644 --- a/drivers/scsi/isci/remote_device.c +++ b/drivers/scsi/isci/remote_device.c @@ -1101,9 +1101,8 @@ static const struct scic_sds_remote_device_state_handler scic_sds_remote_device_ static void scic_sds_remote_device_initial_state_enter(void *object) { - struct scic_sds_remote_device *sci_dev = (struct scic_sds_remote_device *)object; + struct scic_sds_remote_device *sci_dev = object; - sci_dev = container_of(object, typeof(*sci_dev), parent); SET_STATE_HANDLER(sci_dev, scic_sds_remote_device_state_handler_table, SCI_BASE_REMOTE_DEVICE_STATE_INITIAL); @@ -1203,16 +1202,15 @@ static void isci_remote_device_stop_complete(struct isci_host *ihost, static void scic_sds_remote_device_stopped_state_enter(void *object) { - struct scic_sds_remote_device *sci_dev; + struct scic_sds_remote_device *sci_dev = object; struct scic_sds_controller *scic; struct isci_remote_device *idev; struct isci_host *ihost; u32 prev_state; - sci_dev = container_of(object, typeof(*sci_dev), parent); scic = scic_sds_remote_device_get_controller(sci_dev); ihost = scic->ihost; - idev = sci_object_get_association(sci_dev); + idev = sci_dev_to_idev(sci_dev); SET_STATE_HANDLER(sci_dev, scic_sds_remote_device_state_handler_table, SCI_BASE_REMOTE_DEVICE_STATE_STOPPED); @@ -1229,11 +1227,10 @@ static void scic_sds_remote_device_stopped_state_enter(void *object) static void scic_sds_remote_device_starting_state_enter(void *object) { - struct scic_sds_remote_device *sci_dev = container_of(object, typeof(*sci_dev), - parent); + struct scic_sds_remote_device *sci_dev = object; struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev); struct isci_host *ihost = scic->ihost; - struct isci_remote_device *idev = sci_object_get_association(sci_dev); + struct isci_remote_device *idev = sci_dev_to_idev(sci_dev); SET_STATE_HANDLER(sci_dev, scic_sds_remote_device_state_handler_table, SCI_BASE_REMOTE_DEVICE_STATE_STARTING); @@ -1244,11 +1241,10 @@ static void scic_sds_remote_device_starting_state_enter(void *object) static void scic_sds_remote_device_ready_state_enter(void *object) { - struct scic_sds_remote_device *sci_dev = container_of(object, typeof(*sci_dev), - parent); + struct scic_sds_remote_device *sci_dev = object; struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev); struct isci_host *ihost = scic->ihost; - struct isci_remote_device *idev = sci_object_get_association(sci_dev); + struct isci_remote_device *idev = sci_dev_to_idev(sci_dev); SET_STATE_HANDLER(sci_dev, scic_sds_remote_device_state_handler_table, @@ -1264,14 +1260,13 @@ static void scic_sds_remote_device_ready_state_enter(void *object) static void scic_sds_remote_device_ready_state_exit(void *object) { - struct scic_sds_remote_device *sci_dev = container_of(object, typeof(*sci_dev), - parent); + struct scic_sds_remote_device *sci_dev = object; if (sci_dev->has_ready_substate_machine) sci_base_state_machine_stop(&sci_dev->ready_substate_machine); else { struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev); struct isci_host *ihost = scic->ihost; - struct isci_remote_device *idev = sci_object_get_association(sci_dev); + struct isci_remote_device *idev = sci_dev_to_idev(sci_dev); isci_remote_device_not_ready(ihost, idev, SCIC_REMOTE_DEVICE_NOT_READY_STOP_REQUESTED); @@ -1280,7 +1275,7 @@ static void scic_sds_remote_device_ready_state_exit(void *object) static void scic_sds_remote_device_stopping_state_enter(void *object) { - struct scic_sds_remote_device *sci_dev = (struct scic_sds_remote_device *)object; + struct scic_sds_remote_device *sci_dev = object; SET_STATE_HANDLER( sci_dev, @@ -1291,7 +1286,7 @@ static void scic_sds_remote_device_stopping_state_enter(void *object) static void scic_sds_remote_device_failed_state_enter(void *object) { - struct scic_sds_remote_device *sci_dev = (struct scic_sds_remote_device *)object; + struct scic_sds_remote_device *sci_dev = object; SET_STATE_HANDLER( sci_dev, @@ -1302,7 +1297,7 @@ static void scic_sds_remote_device_failed_state_enter(void *object) static void scic_sds_remote_device_resetting_state_enter(void *object) { - struct scic_sds_remote_device *sci_dev = (struct scic_sds_remote_device *)object; + struct scic_sds_remote_device *sci_dev = object; SET_STATE_HANDLER( sci_dev, @@ -1316,14 +1311,14 @@ static void scic_sds_remote_device_resetting_state_enter(void *object) static void scic_sds_remote_device_resetting_state_exit(void *object) { - struct scic_sds_remote_device *sci_dev = (struct scic_sds_remote_device *)object; + struct scic_sds_remote_device *sci_dev = object; scic_sds_remote_node_context_resume(&sci_dev->rnc, NULL, NULL); } static void scic_sds_remote_device_final_state_enter(void *object) { - struct scic_sds_remote_device *sci_dev = (struct scic_sds_remote_device *)object; + struct scic_sds_remote_device *sci_dev = object; SET_STATE_HANDLER( sci_dev, @@ -1377,11 +1372,10 @@ static void scic_remote_device_construct(struct scic_sds_port *sci_port, { sci_dev->owning_port = sci_port; sci_dev->started_request_count = 0; - sci_dev->parent.private = NULL; sci_base_state_machine_construct( &sci_dev->state_machine, - &sci_dev->parent, + sci_dev, scic_sds_remote_device_state_table, SCI_BASE_REMOTE_DEVICE_STATE_INITIAL ); @@ -1440,7 +1434,7 @@ static enum sci_status scic_remote_device_da_construct(struct scic_sds_port *sci sci_base_state_machine_construct( &sci_dev->ready_substate_machine, - &sci_dev->parent, + sci_dev, scic_sds_stp_remote_device_ready_substate_table, SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_IDLE); } else if (dev_is_expander(dev)) { @@ -1449,7 +1443,7 @@ static enum sci_status scic_remote_device_da_construct(struct scic_sds_port *sci /* add the SMP ready substate machine construction here */ sci_base_state_machine_construct( &sci_dev->ready_substate_machine, - &sci_dev->parent, + sci_dev, scic_sds_smp_remote_device_ready_substate_table, SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_IDLE); } else @@ -1497,7 +1491,7 @@ static enum sci_status scic_remote_device_ea_construct(struct scic_sds_port *sci /* add the SMP ready substate machine construction here */ sci_base_state_machine_construct( &sci_dev->ready_substate_machine, - &sci_dev->parent, + sci_dev, scic_sds_smp_remote_device_ready_substate_table, SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_IDLE); } else if (dev->dev_type == SATA_DEV || (dev->tproto & SAS_PROTOCOL_STP)) { @@ -1505,7 +1499,7 @@ static enum sci_status scic_remote_device_ea_construct(struct scic_sds_port *sci sci_base_state_machine_construct( &sci_dev->ready_substate_machine, - &sci_dev->parent, + sci_dev, scic_sds_stp_remote_device_ready_substate_table, SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_IDLE); } @@ -1565,9 +1559,6 @@ static enum sci_status isci_remote_device_construct(struct isci_port *iport, return status; } - /* XXX will be killed with sci_base_object removal */ - sci_object_set_association(&idev->sci, idev); - /* start the device. */ status = scic_remote_device_start(&idev->sci, ISCI_REMOTE_DEVICE_START_TIMEOUT); diff --git a/drivers/scsi/isci/remote_device.h b/drivers/scsi/isci/remote_device.h index 5cceb6c5dc1d..62623c766388 100644 --- a/drivers/scsi/isci/remote_device.h +++ b/drivers/scsi/isci/remote_device.h @@ -74,12 +74,6 @@ enum scic_remote_device_not_ready_reason_code { }; struct scic_sds_remote_device { - /** - * The field specifies that the parent object for the base remote - * device is the base object itself. - */ - struct sci_base_object parent; - /** * This field contains the information for the base remote device state * machine. @@ -417,11 +411,16 @@ static inline struct scic_sds_remote_device *rnc_to_dev(struct scic_sds_remote_n return sci_dev; } -static inline struct domain_device *sci_dev_to_domain(struct scic_sds_remote_device *sci_dev) +static inline struct isci_remote_device *sci_dev_to_idev(struct scic_sds_remote_device *sci_dev) { struct isci_remote_device *idev = container_of(sci_dev, typeof(*idev), sci); - return idev->domain_dev; + return idev; +} + +static inline struct domain_device *sci_dev_to_domain(struct scic_sds_remote_device *sci_dev) +{ + return sci_dev_to_idev(sci_dev)->domain_dev; } static inline bool dev_is_expander(struct domain_device *dev) diff --git a/drivers/scsi/isci/sci_environment.h b/drivers/scsi/isci/sci_environment.h index 3fb54ddaee1a..41636c34da9e 100644 --- a/drivers/scsi/isci/sci_environment.h +++ b/drivers/scsi/isci/sci_environment.h @@ -59,7 +59,6 @@ #include "isci.h" #include "core/scic_sds_controller.h" -struct scic_sds_remote_device; static inline struct device *scic_to_dev(struct scic_sds_controller *scic) { @@ -88,9 +87,11 @@ static inline struct device *sciport_to_dev(struct scic_sds_port *sci_port) return &iport->isci_host->pdev->dev; } -static inline struct device *scirdev_to_dev(struct scic_sds_remote_device *sci_dev) +static inline struct device *scirdev_to_dev( + struct scic_sds_remote_device *sci_dev) { - struct isci_remote_device *idev = sci_object_get_association(sci_dev); + struct isci_remote_device *idev = + container_of(sci_dev, typeof(*idev), sci); if (!idev || !idev->isci_port || !idev->isci_port->isci_host) return NULL; diff --git a/drivers/scsi/isci/smp_remote_device.c b/drivers/scsi/isci/smp_remote_device.c index aae5c80c1341..45340a5c99c7 100644 --- a/drivers/scsi/isci/smp_remote_device.c +++ b/drivers/scsi/isci/smp_remote_device.c @@ -246,11 +246,10 @@ static const struct scic_sds_remote_device_state_handler scic_sds_smp_remote_dev */ static void scic_sds_smp_remote_device_ready_idle_substate_enter(void *object) { - struct scic_sds_remote_device *sci_dev = container_of(object, typeof(*sci_dev), - parent); + struct scic_sds_remote_device *sci_dev = object; struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev); struct isci_host *ihost = scic->ihost; - struct isci_remote_device *idev = sci_object_get_association(sci_dev); + struct isci_remote_device *idev = sci_dev_to_idev(sci_dev); SET_STATE_HANDLER(sci_dev, scic_sds_smp_remote_device_ready_substate_handler_table, @@ -270,11 +269,10 @@ static void scic_sds_smp_remote_device_ready_idle_substate_enter(void *object) */ static void scic_sds_smp_remote_device_ready_cmd_substate_enter(void *object) { - struct scic_sds_remote_device *sci_dev = container_of(object, typeof(*sci_dev), - parent); + struct scic_sds_remote_device *sci_dev = object; struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev); struct isci_host *ihost = scic->ihost; - struct isci_remote_device *idev = sci_object_get_association(sci_dev); + struct isci_remote_device *idev = sci_dev_to_idev(sci_dev); BUG_ON(sci_dev->working_request == NULL); @@ -295,8 +293,7 @@ static void scic_sds_smp_remote_device_ready_cmd_substate_enter(void *object) */ static void scic_sds_smp_remote_device_ready_cmd_substate_exit(void *object) { - struct scic_sds_remote_device *sci_dev = container_of(object, typeof(*sci_dev), - parent); + struct scic_sds_remote_device *sci_dev = object; sci_dev->working_request = NULL; } diff --git a/drivers/scsi/isci/stp_remote_device.c b/drivers/scsi/isci/stp_remote_device.c index c1c2f9b87cac..d86976469428 100644 --- a/drivers/scsi/isci/stp_remote_device.c +++ b/drivers/scsi/isci/stp_remote_device.c @@ -580,7 +580,7 @@ static void scic_sds_stp_remote_device_ready_idle_substate_resume_complete_handler(void *user_cookie) { struct scic_sds_remote_device *sci_dev = user_cookie; - struct isci_remote_device *idev = sci_object_get_association(sci_dev); + struct isci_remote_device *idev = sci_dev_to_idev(sci_dev); struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev); struct isci_host *ihost = scic->ihost; @@ -607,9 +607,7 @@ scic_sds_stp_remote_device_ready_idle_substate_resume_complete_handler(void *use */ static void scic_sds_stp_remote_device_ready_idle_substate_enter(void *device) { - struct scic_sds_remote_device *sci_dev; - - sci_dev = (struct scic_sds_remote_device *)device; + struct scic_sds_remote_device *sci_dev = device; SET_STATE_HANDLER( sci_dev, @@ -636,11 +634,10 @@ static void scic_sds_stp_remote_device_ready_idle_substate_enter(void *device) static void scic_sds_stp_remote_device_ready_cmd_substate_enter(void *object) { - struct scic_sds_remote_device *sci_dev = container_of(object, typeof(*sci_dev), - parent); + struct scic_sds_remote_device *sci_dev = object; struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev); struct isci_host *ihost = scic->ihost; - struct isci_remote_device *idev = sci_object_get_association(sci_dev); + struct isci_remote_device *idev = sci_dev_to_idev(sci_dev); BUG_ON(sci_dev->working_request == NULL); @@ -654,8 +651,7 @@ static void scic_sds_stp_remote_device_ready_cmd_substate_enter(void *object) static void scic_sds_stp_remote_device_ready_ncq_substate_enter(void *object) { - struct scic_sds_remote_device *sci_dev = container_of(object, typeof(*sci_dev), - parent); + struct scic_sds_remote_device *sci_dev = object; SET_STATE_HANDLER(sci_dev, scic_sds_stp_remote_device_ready_substate_handler_table, SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ); @@ -664,11 +660,10 @@ static void scic_sds_stp_remote_device_ready_ncq_substate_enter(void *object) static void scic_sds_stp_remote_device_ready_ncq_error_substate_enter( void *object) { - struct scic_sds_remote_device *sci_dev = container_of(object, typeof(*sci_dev), - parent); + struct scic_sds_remote_device *sci_dev = object; struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev); struct isci_host *ihost = scic->ihost; - struct isci_remote_device *idev = sci_object_get_association(sci_dev); + struct isci_remote_device *idev = sci_dev_to_idev(sci_dev); SET_STATE_HANDLER(sci_dev, scic_sds_stp_remote_device_ready_substate_handler_table,