From d3757c3aeb75259e0b86a872e98841a2ea4cb5e8 Mon Sep 17 00:00:00 2001 From: Maciej Patelczyk Date: Thu, 28 Apr 2011 22:06:06 +0000 Subject: [PATCH] isci: Removed sci_base_object from scic_sds_controller. The 'struct sci_base_object' was removed from the struct scic_sds_controller and was replaced by a pointer to struct isci_host. Signed-off-by: Maciej Patelczyk Signed-off-by: Dan Williams --- drivers/scsi/isci/core/scic_sds_controller.c | 44 +++++++------------ drivers/scsi/isci/core/scic_sds_controller.h | 8 ++-- drivers/scsi/isci/core/scic_sds_phy.c | 6 +-- drivers/scsi/isci/core/scic_sds_port.c | 16 +++---- .../core/scic_sds_port_configuration_agent.c | 2 +- drivers/scsi/isci/core/scic_sds_request.c | 2 +- drivers/scsi/isci/host.c | 2 +- drivers/scsi/isci/port.c | 5 ++- drivers/scsi/isci/remote_device.c | 8 ++-- drivers/scsi/isci/sci_environment.h | 3 +- drivers/scsi/isci/smp_remote_device.c | 4 +- drivers/scsi/isci/stp_remote_device.c | 6 +-- 12 files changed, 49 insertions(+), 57 deletions(-) diff --git a/drivers/scsi/isci/core/scic_sds_controller.c b/drivers/scsi/isci/core/scic_sds_controller.c index 135aa3e5e13..d7c37dc64ac 100644 --- a/drivers/scsi/isci/core/scic_sds_controller.c +++ b/drivers/scsi/isci/core/scic_sds_controller.c @@ -213,7 +213,7 @@ static void scic_sds_controller_power_control_timer_handler( static void scic_sds_controller_initialize_power_control(struct scic_sds_controller *scic) { - struct isci_host *ihost = sci_object_get_association(scic); + struct isci_host *ihost = scic->ihost; scic->power_control.timer = isci_timer_create(ihost, scic, scic_sds_controller_power_control_timer_handler); @@ -584,7 +584,7 @@ static void scic_sds_controller_transition_to_ready( struct scic_sds_controller *scic, enum sci_status status) { - struct isci_host *ihost = sci_object_get_association(scic); + struct isci_host *ihost = scic->ihost; if (scic->state_machine.current_state_id == SCI_BASE_CONTROLLER_STATE_STARTING) { @@ -602,7 +602,7 @@ static void scic_sds_controller_transition_to_ready( static void scic_sds_controller_timeout_handler(void *_scic) { struct scic_sds_controller *scic = _scic; - struct isci_host *ihost = sci_object_get_association(scic); + struct isci_host *ihost = scic->ihost; struct sci_base_state_machine *sm = &scic->state_machine; if (sm->current_state_id == SCI_BASE_CONTROLLER_STATE_STARTING) @@ -770,7 +770,7 @@ static void scic_sds_controller_phy_startup_timeout_handler(void *_scic) static enum sci_status scic_sds_controller_initialize_phy_startup(struct scic_sds_controller *scic) { - struct isci_host *ihost = sci_object_get_association(scic); + struct isci_host *ihost = scic->ihost; scic->phy_startup_timer = isci_timer_create(ihost, scic, @@ -1796,7 +1796,7 @@ void scic_sds_controller_release_frame( */ static void scic_sds_controller_set_default_config_parameters(struct scic_sds_controller *scic) { - struct isci_host *ihost = sci_object_get_association(scic); + struct isci_host *ihost = scic->ihost; u16 index; /* Default to APC mode. */ @@ -2662,7 +2662,7 @@ enum sci_status scic_controller_initialize( } - ihost = sci_object_get_association(scic); + ihost = scic->ihost; sci_base_state_machine_change_state(sm, SCI_BASE_CONTROLLER_STATE_INITIALIZING); @@ -2854,7 +2854,7 @@ enum sci_status scic_controller_start(struct scic_sds_controller *scic, /* Assign all the task entries to scic physical function */ scic_sds_controller_assign_task_entries(scic); - /* Now initialze the completion queue */ + /* Now initialize the completion queue */ scic_sds_controller_initialize_completion_queue(scic); /* Initialize the unsolicited frame queue for use */ @@ -2887,14 +2887,12 @@ enum sci_status scic_controller_start(struct scic_sds_controller *scic, * * This method implements the actions taken by the struct scic_sds_controller on entry * to the SCI_BASE_CONTROLLER_STATE_INITIAL. - Set the state handlers to the - * controllers initial state. none This function should initialze the + * controllers initial state. none This function should initialize the * controller object. */ static void scic_sds_controller_initial_state_enter(void *object) { - struct scic_sds_controller *scic; - - scic = (struct scic_sds_controller *)object; + struct scic_sds_controller *scic = object; sci_base_state_machine_change_state(&scic->state_machine, SCI_BASE_CONTROLLER_STATE_RESET); @@ -2911,7 +2909,7 @@ static void scic_sds_controller_initial_state_enter(void *object) */ static inline void scic_sds_controller_starting_state_exit(void *object) { - struct scic_sds_controller *scic = (struct scic_sds_controller *)object; + struct scic_sds_controller *scic = object; isci_timer_stop(scic->timeout_timer); } @@ -2927,9 +2925,7 @@ static inline void scic_sds_controller_starting_state_exit(void *object) */ static void scic_sds_controller_ready_state_enter(void *object) { - struct scic_sds_controller *scic; - - scic = (struct scic_sds_controller *)object; + struct scic_sds_controller *scic = object; /* set the default interrupt coalescence number and timeout value. */ scic_controller_set_interrupt_coalescence( @@ -2946,9 +2942,7 @@ static void scic_sds_controller_ready_state_enter(void *object) */ static void scic_sds_controller_ready_state_exit(void *object) { - struct scic_sds_controller *scic; - - scic = (struct scic_sds_controller *)object; + struct scic_sds_controller *scic = object; /* disable interrupt coalescence. */ scic_controller_set_interrupt_coalescence(scic, 0, 0); @@ -2966,9 +2960,7 @@ static void scic_sds_controller_ready_state_exit(void *object) */ static void scic_sds_controller_stopping_state_enter(void *object) { - struct scic_sds_controller *scic; - - scic = (struct scic_sds_controller *)object; + struct scic_sds_controller *scic = object; /* Stop all of the components for this controller */ scic_sds_controller_stop_phys(scic); @@ -2981,23 +2973,21 @@ static void scic_sds_controller_stopping_state_enter(void *object) * @object: This is the object which is cast to a struct * scic_sds_controller object. * - * This funciton implements the actions taken by the struct scic_sds_controller + * This function implements the actions taken by the struct scic_sds_controller * on exit from the SCI_BASE_CONTROLLER_STATE_STOPPING. - * This function stops the controller stopping timeout timer. */ static inline void scic_sds_controller_stopping_state_exit(void *object) { - struct scic_sds_controller *scic = - (struct scic_sds_controller *)object; + struct scic_sds_controller *scic = object; isci_timer_stop(scic->timeout_timer); } static void scic_sds_controller_resetting_state_enter(void *object) { - struct scic_sds_controller *scic; + struct scic_sds_controller *scic = object; - scic = container_of(object, typeof(*scic), parent); scic_sds_controller_reset_hardware(scic); sci_base_state_machine_change_state(&scic->state_machine, SCI_BASE_CONTROLLER_STATE_RESET); @@ -3051,7 +3041,7 @@ enum sci_status scic_controller_construct(struct scic_sds_controller *scic, u8 i; sci_base_state_machine_construct(&scic->state_machine, - &scic->parent, scic_sds_controller_state_table, + scic, scic_sds_controller_state_table, SCI_BASE_CONTROLLER_STATE_INITIAL); sci_base_state_machine_start(&scic->state_machine); diff --git a/drivers/scsi/isci/core/scic_sds_controller.h b/drivers/scsi/isci/core/scic_sds_controller.h index ce81286e52f..8e3240de3d9 100644 --- a/drivers/scsi/isci/core/scic_sds_controller.h +++ b/drivers/scsi/isci/core/scic_sds_controller.h @@ -125,17 +125,17 @@ struct scic_power_control { }; +struct isci_host; /** * struct scic_sds_controller - * - * This structure represents the SCU contoller object. + * This structure represents the SCU controller object. */ struct scic_sds_controller { /** - * The field specifies that the parent object for the base controller - * is the base object itself. + * The field specifies that the peer object for the controller. */ - struct sci_base_object parent; + struct isci_host *ihost; /** * This field contains the information for the base controller state diff --git a/drivers/scsi/isci/core/scic_sds_phy.c b/drivers/scsi/isci/core/scic_sds_phy.c index 972b977a7c1..3b53968abb0 100644 --- a/drivers/scsi/isci/core/scic_sds_phy.c +++ b/drivers/scsi/isci/core/scic_sds_phy.c @@ -336,7 +336,7 @@ enum sci_status scic_sds_phy_initialize( struct scu_link_layer_registers __iomem *link_layer_registers) { struct scic_sds_controller *scic = scic_sds_phy_get_controller(sci_phy); - struct isci_host *ihost = sci_object_get_association(scic); + struct isci_host *ihost = scic->ihost; /* Create the SIGNATURE FIS Timeout timer for this phy */ sci_phy->sata_timeout_timer = @@ -1932,7 +1932,7 @@ scic_sds_phy_stopped_state_start_handler(struct scic_sds_phy *sci_phy) struct scic_sds_controller *scic; scic = scic_sds_phy_get_controller(sci_phy), - ihost = sci_object_get_association(scic); + ihost = scic->ihost; /* Create the SIGNATURE FIS Timeout timer for this phy */ sci_phy->sata_timeout_timer = isci_timer_create(ihost, sci_phy, @@ -2220,7 +2220,7 @@ static void scic_sds_phy_stopped_state_enter(void *object) { struct scic_sds_phy *sci_phy = (struct scic_sds_phy *)object; struct scic_sds_controller *scic = scic_sds_phy_get_controller(sci_phy); - struct isci_host *ihost = sci_object_get_association(scic); + struct isci_host *ihost = scic->ihost; sci_phy = (struct scic_sds_phy *)object; diff --git a/drivers/scsi/isci/core/scic_sds_port.c b/drivers/scsi/isci/core/scic_sds_port.c index 1cbf1d6b2f9..857482b27ff 100644 --- a/drivers/scsi/isci/core/scic_sds_port.c +++ b/drivers/scsi/isci/core/scic_sds_port.c @@ -657,7 +657,7 @@ static void scic_sds_port_activate_phy(struct scic_sds_port *sci_port, { struct scic_sds_controller *scic = scic_sds_port_get_controller(sci_port); struct sci_sas_identify_address_frame_protocols protocols; - struct isci_host *ihost = sci_object_get_association(scic); + struct isci_host *ihost = scic->ihost; scic_sds_phy_get_attached_phy_protocols(sci_phy, &protocols); @@ -679,7 +679,7 @@ void scic_sds_port_deactivate_phy(struct scic_sds_port *sci_port, { struct scic_sds_controller *scic = scic_sds_port_get_controller(sci_port); struct isci_port *iport = sci_object_get_association(sci_port); - struct isci_host *ihost = sci_object_get_association(scic); + struct isci_host *ihost = scic->ihost; struct isci_phy *iphy = sci_object_get_association(sci_phy); sci_port->active_phy_mask &= ~(1 << sci_phy->phy_index); @@ -1012,7 +1012,7 @@ void scic_sds_port_broadcast_change_received( struct scic_sds_phy *sci_phy) { struct scic_sds_controller *scic = sci_port->owning_controller; - struct isci_host *ihost = sci_object_get_association(scic); + struct isci_host *ihost = scic->ihost; /* notify the user. */ isci_port_bc_change_received(ihost, sci_port, sci_phy); @@ -1666,7 +1666,7 @@ static void scic_sds_port_ready_substate_operational_enter(void *object) struct scic_sds_port *sci_port = (struct scic_sds_port *)object; struct scic_sds_controller *scic = scic_sds_port_get_controller(sci_port); - struct isci_host *ihost = sci_object_get_association(scic); + struct isci_host *ihost = scic->ihost; struct isci_port *iport = sci_object_get_association(sci_port); scic_sds_port_set_ready_state_handlers( @@ -1707,7 +1707,7 @@ static void scic_sds_port_ready_substate_operational_exit(void *object) struct scic_sds_port *sci_port = (struct scic_sds_port *)object; struct scic_sds_controller *scic = scic_sds_port_get_controller(sci_port); - struct isci_host *ihost = sci_object_get_association(scic); + struct isci_host *ihost = scic->ihost; struct isci_port *iport = sci_object_get_association(sci_port); /* @@ -1738,7 +1738,7 @@ static void scic_sds_port_ready_substate_configuring_enter(void *object) struct scic_sds_port *sci_port = (struct scic_sds_port *)object; struct scic_sds_controller *scic = scic_sds_port_get_controller(sci_port); - struct isci_host *ihost = sci_object_get_association(scic); + struct isci_host *ihost = scic->ihost; struct isci_port *iport = sci_object_get_association(sci_port); scic_sds_port_set_ready_state_handlers( @@ -1825,7 +1825,7 @@ static enum sci_status scic_sds_port_stopped_state_start_handler(struct scic_sds_port *sci_port) { struct scic_sds_controller *scic = sci_port->owning_controller; - struct isci_host *ihost = sci_object_get_association(scic); + struct isci_host *ihost = scic->ihost; enum sci_status status = SCI_SUCCESS; u32 phy_mask; @@ -2312,7 +2312,7 @@ static void scic_sds_port_ready_state_enter(void *object) sci_port = container_of(object, typeof(*sci_port), parent); scic = scic_sds_port_get_controller(sci_port); - ihost = sci_object_get_association(scic); + ihost = scic->ihost; iport = sci_object_get_association(sci_port); /* Put the ready state handlers in place though they will not be there long */ diff --git a/drivers/scsi/isci/core/scic_sds_port_configuration_agent.c b/drivers/scsi/isci/core/scic_sds_port_configuration_agent.c index a7e3833b1d5..df257ffa0f8 100644 --- a/drivers/scsi/isci/core/scic_sds_port_configuration_agent.c +++ b/drivers/scsi/isci/core/scic_sds_port_configuration_agent.c @@ -821,7 +821,7 @@ enum sci_status scic_sds_port_configuration_agent_initialize( { enum sci_status status = SCI_SUCCESS; enum scic_port_configuration_mode mode; - struct isci_host *ihost = sci_object_get_association(scic); + struct isci_host *ihost = scic->ihost; mode = scic->oem_parameters.sds1.controller.mode_type; diff --git a/drivers/scsi/isci/core/scic_sds_request.c b/drivers/scsi/isci/core/scic_sds_request.c index 3ebfb7f8b70..a438ea22315 100644 --- a/drivers/scsi/isci/core/scic_sds_request.c +++ b/drivers/scsi/isci/core/scic_sds_request.c @@ -1612,7 +1612,7 @@ static void scic_sds_request_completed_state_enter(void *object) struct scic_sds_request *sci_req = (struct scic_sds_request *)object; struct scic_sds_controller *scic = scic_sds_request_get_controller(sci_req); - struct isci_host *ihost = sci_object_get_association(scic); + struct isci_host *ihost = scic->ihost; struct isci_request *ireq = sci_object_get_association(sci_req); SET_STATE_HANDLER(sci_req, diff --git a/drivers/scsi/isci/host.c b/drivers/scsi/isci/host.c index 676bcdbfc31..55bfa3dbfb8 100644 --- a/drivers/scsi/isci/host.c +++ b/drivers/scsi/isci/host.c @@ -365,7 +365,7 @@ int isci_host_init(struct isci_host *isci_host) } isci_host->core_controller = controller; - sci_object_set_association(isci_host->core_controller, isci_host); + controller->ihost = isci_host; spin_lock_init(&isci_host->state_lock); spin_lock_init(&isci_host->scic_lock); spin_lock_init(&isci_host->queue_lock); diff --git a/drivers/scsi/isci/port.c b/drivers/scsi/isci/port.c index 430b29ed6c7..c0916b199b7 100644 --- a/drivers/scsi/isci/port.c +++ b/drivers/scsi/isci/port.c @@ -68,6 +68,7 @@ #include "scic_port.h" #include "port.h" #include "request.h" +#include "core/scic_sds_controller.h" static void isci_port_change_state( struct isci_port *isci_port, @@ -472,7 +473,7 @@ void isci_port_invalid_link_up(struct scic_sds_controller *scic, struct scic_sds_port *sci_port, struct scic_sds_phy *phy) { - struct isci_host *ihost = sci_object_get_association(scic); + struct isci_host *ihost = scic->ihost; dev_warn(&ihost->pdev->dev, "Invalid link up!\n"); } @@ -481,7 +482,7 @@ void isci_port_stop_complete(struct scic_sds_controller *scic, struct scic_sds_port *sci_port, enum sci_status completion_status) { - struct isci_host *ihost = sci_object_get_association(scic); + struct isci_host *ihost = scic->ihost; dev_dbg(&ihost->pdev->dev, "Port stop complete\n"); } diff --git a/drivers/scsi/isci/remote_device.c b/drivers/scsi/isci/remote_device.c index b23f9a5a085..bb696cf11f2 100644 --- a/drivers/scsi/isci/remote_device.c +++ b/drivers/scsi/isci/remote_device.c @@ -1211,7 +1211,7 @@ static void scic_sds_remote_device_stopped_state_enter(void *object) sci_dev = container_of(object, typeof(*sci_dev), parent); scic = scic_sds_remote_device_get_controller(sci_dev); - ihost = sci_object_get_association(scic); + ihost = scic->ihost; idev = sci_object_get_association(sci_dev); SET_STATE_HANDLER(sci_dev, scic_sds_remote_device_state_handler_table, @@ -1232,7 +1232,7 @@ 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_controller *scic = scic_sds_remote_device_get_controller(sci_dev); - struct isci_host *ihost = sci_object_get_association(scic); + struct isci_host *ihost = scic->ihost; struct isci_remote_device *idev = sci_object_get_association(sci_dev); SET_STATE_HANDLER(sci_dev, scic_sds_remote_device_state_handler_table, @@ -1247,7 +1247,7 @@ 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_controller *scic = scic_sds_remote_device_get_controller(sci_dev); - struct isci_host *ihost = sci_object_get_association(scic); + struct isci_host *ihost = scic->ihost; struct isci_remote_device *idev = sci_object_get_association(sci_dev); SET_STATE_HANDLER(sci_dev, @@ -1270,7 +1270,7 @@ static void scic_sds_remote_device_ready_state_exit(void *object) 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 = sci_object_get_association(scic); + struct isci_host *ihost = scic->ihost; struct isci_remote_device *idev = sci_object_get_association(sci_dev); isci_remote_device_not_ready(ihost, idev, diff --git a/drivers/scsi/isci/sci_environment.h b/drivers/scsi/isci/sci_environment.h index 8d57f9552e2..6be9274975d 100644 --- a/drivers/scsi/isci/sci_environment.h +++ b/drivers/scsi/isci/sci_environment.h @@ -57,6 +57,7 @@ #define _SCI_ENVIRONMENT_H_ #include "isci.h" +#include "core/scic_sds_controller.h" struct scic_sds_controller; struct scic_sds_phy; @@ -65,7 +66,7 @@ struct scic_sds_remote_device; static inline struct device *scic_to_dev(struct scic_sds_controller *scic) { - struct isci_host *isci_host = sci_object_get_association(scic); + struct isci_host *isci_host = scic->ihost; return &isci_host->pdev->dev; } diff --git a/drivers/scsi/isci/smp_remote_device.c b/drivers/scsi/isci/smp_remote_device.c index a38dc90da94..aae5c80c134 100644 --- a/drivers/scsi/isci/smp_remote_device.c +++ b/drivers/scsi/isci/smp_remote_device.c @@ -249,7 +249,7 @@ 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_controller *scic = scic_sds_remote_device_get_controller(sci_dev); - struct isci_host *ihost = sci_object_get_association(scic); + struct isci_host *ihost = scic->ihost; struct isci_remote_device *idev = sci_object_get_association(sci_dev); SET_STATE_HANDLER(sci_dev, @@ -273,7 +273,7 @@ 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_controller *scic = scic_sds_remote_device_get_controller(sci_dev); - struct isci_host *ihost = sci_object_get_association(scic); + struct isci_host *ihost = scic->ihost; struct isci_remote_device *idev = sci_object_get_association(sci_dev); BUG_ON(sci_dev->working_request == NULL); diff --git a/drivers/scsi/isci/stp_remote_device.c b/drivers/scsi/isci/stp_remote_device.c index 1e6f77331af..c1c2f9b87ca 100644 --- a/drivers/scsi/isci/stp_remote_device.c +++ b/drivers/scsi/isci/stp_remote_device.c @@ -582,7 +582,7 @@ scic_sds_stp_remote_device_ready_idle_substate_resume_complete_handler(void *use struct scic_sds_remote_device *sci_dev = user_cookie; struct isci_remote_device *idev = sci_object_get_association(sci_dev); struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev); - struct isci_host *ihost = sci_object_get_association(scic); + struct isci_host *ihost = scic->ihost; /* * For NCQ operation we do not issue a @@ -639,7 +639,7 @@ 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_controller *scic = scic_sds_remote_device_get_controller(sci_dev); - struct isci_host *ihost = sci_object_get_association(scic); + struct isci_host *ihost = scic->ihost; struct isci_remote_device *idev = sci_object_get_association(sci_dev); BUG_ON(sci_dev->working_request == NULL); @@ -667,7 +667,7 @@ static void scic_sds_stp_remote_device_ready_ncq_error_substate_enter( struct scic_sds_remote_device *sci_dev = container_of(object, typeof(*sci_dev), 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_host *ihost = scic->ihost; struct isci_remote_device *idev = sci_object_get_association(sci_dev); SET_STATE_HANDLER(sci_dev, -- 2.39.5