From 115bd1f9e8ee11744818e6eb5351d05ab6a8402e Mon Sep 17 00:00:00 2001 From: Maciej Patelczyk Date: Thu, 28 Apr 2011 22:06:16 +0000 Subject: [PATCH] isci: Removed sci_base_object from scic_sds_port. The 'struct sci_base_object' was removed from the struct scic_sds_port and was replaced by a pointer to struct isci_port. Signed-off-by: Maciej Patelczyk Signed-off-by: Dan Williams --- drivers/scsi/isci/core/scic_sds_port.c | 55 +++++++++++--------------- drivers/scsi/isci/core/scic_sds_port.h | 8 ++-- drivers/scsi/isci/port.c | 5 +-- drivers/scsi/isci/sci_environment.h | 5 +-- 4 files changed, 29 insertions(+), 44 deletions(-) diff --git a/drivers/scsi/isci/core/scic_sds_port.c b/drivers/scsi/isci/core/scic_sds_port.c index d6339c41c39..3697211e7ca 100644 --- a/drivers/scsi/isci/core/scic_sds_port.c +++ b/drivers/scsi/isci/core/scic_sds_port.c @@ -678,7 +678,7 @@ void scic_sds_port_deactivate_phy(struct scic_sds_port *sci_port, bool do_notify_user) { struct scic_sds_controller *scic = scic_sds_port_get_controller(sci_port); - struct isci_port *iport = sci_object_get_association(sci_port); + struct isci_port *iport = sci_port->iport; struct isci_host *ihost = scic->ihost; struct isci_phy *iphy = sci_phy->iphy; @@ -1632,7 +1632,7 @@ scic_sds_port_resume_port_task_scheduler(struct scic_sds_port *port) */ static void scic_sds_port_ready_substate_waiting_enter(void *object) { - struct scic_sds_port *sci_port = (struct scic_sds_port *)object; + struct scic_sds_port *sci_port = object; scic_sds_port_set_ready_state_handlers( sci_port, SCIC_SDS_PORT_READY_SUBSTATE_WAITING @@ -1663,11 +1663,11 @@ static void scic_sds_port_ready_substate_waiting_enter(void *object) static void scic_sds_port_ready_substate_operational_enter(void *object) { u32 index; - struct scic_sds_port *sci_port = (struct scic_sds_port *)object; + struct scic_sds_port *sci_port = object; struct scic_sds_controller *scic = scic_sds_port_get_controller(sci_port); struct isci_host *ihost = scic->ihost; - struct isci_port *iport = sci_object_get_association(sci_port); + struct isci_port *iport = sci_port->iport; scic_sds_port_set_ready_state_handlers( sci_port, @@ -1704,11 +1704,11 @@ static void scic_sds_port_ready_substate_operational_enter(void *object) */ 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_port *sci_port = object; struct scic_sds_controller *scic = scic_sds_port_get_controller(sci_port); struct isci_host *ihost = scic->ihost; - struct isci_port *iport = sci_object_get_association(sci_port); + struct isci_port *iport = sci_port->iport; /* * Kill the dummy task for this port if it has not yet posted @@ -1735,11 +1735,11 @@ static void scic_sds_port_ready_substate_operational_exit(void *object) */ 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_port *sci_port = object; struct scic_sds_controller *scic = scic_sds_port_get_controller(sci_port); struct isci_host *ihost = scic->ihost; - struct isci_port *iport = sci_object_get_association(sci_port); + struct isci_port *iport = sci_port->iport; scic_sds_port_set_ready_state_handlers( sci_port, @@ -1759,7 +1759,7 @@ static void scic_sds_port_ready_substate_configuring_enter(void *object) static void scic_sds_port_ready_substate_configuring_exit(void *object) { - struct scic_sds_port *sci_port = (struct scic_sds_port *)object; + struct scic_sds_port *sci_port = object; scic_sds_port_suspend_port_task_scheduler(sci_port); } @@ -2255,9 +2255,7 @@ static void scic_sds_port_invalidate_dummy_remote_node(struct scic_sds_port *sci */ static void scic_sds_port_stopped_state_enter(void *object) { - struct scic_sds_port *sci_port; - - sci_port = (struct scic_sds_port *)object; + struct scic_sds_port *sci_port = object; scic_sds_port_set_base_state_handlers( sci_port, SCI_BASE_PORT_STATE_STOPPED @@ -2285,9 +2283,7 @@ static void scic_sds_port_stopped_state_enter(void *object) */ static void scic_sds_port_stopped_state_exit(void *object) { - struct scic_sds_port *sci_port; - - sci_port = (struct scic_sds_port *)object; + struct scic_sds_port *sci_port = object; /* Enable and suspend the port task scheduler */ scic_sds_port_enable_port_task_scheduler(sci_port); @@ -2305,15 +2301,14 @@ static void scic_sds_port_stopped_state_exit(void *object) static void scic_sds_port_ready_state_enter(void *object) { struct scic_sds_controller *scic; - struct scic_sds_port *sci_port; + struct scic_sds_port *sci_port = object; struct isci_port *iport; struct isci_host *ihost; u32 prev_state; - sci_port = container_of(object, typeof(*sci_port), parent); scic = scic_sds_port_get_controller(sci_port); ihost = scic->ihost; - iport = sci_object_get_association(sci_port); + iport = sci_port->iport; /* Put the ready state handlers in place though they will not be there long */ scic_sds_port_set_base_state_handlers(sci_port, SCI_BASE_PORT_STATE_READY); @@ -2333,9 +2328,8 @@ static void scic_sds_port_ready_state_enter(void *object) static void scic_sds_port_ready_state_exit(void *object) { - struct scic_sds_port *sci_port; + struct scic_sds_port *sci_port = object; - sci_port = container_of(object, typeof(*sci_port), parent); sci_base_state_machine_stop(&sci_port->ready_substate_machine); scic_sds_port_invalidate_dummy_remote_node(sci_port); } @@ -2350,9 +2344,7 @@ static void scic_sds_port_ready_state_exit(void *object) */ static void scic_sds_port_resetting_state_enter(void *object) { - struct scic_sds_port *sci_port; - - sci_port = (struct scic_sds_port *)object; + struct scic_sds_port *sci_port = object; scic_sds_port_set_base_state_handlers( sci_port, SCI_BASE_PORT_STATE_RESETTING @@ -2369,7 +2361,7 @@ static void scic_sds_port_resetting_state_enter(void *object) */ static inline void scic_sds_port_resetting_state_exit(void *object) { - struct scic_sds_port *sci_port = (struct scic_sds_port *)object; + struct scic_sds_port *sci_port = object; isci_timer_stop(sci_port->timer_handle); } @@ -2385,9 +2377,7 @@ static inline void scic_sds_port_resetting_state_exit(void *object) */ static void scic_sds_port_stopping_state_enter(void *object) { - struct scic_sds_port *sci_port; - - sci_port = (struct scic_sds_port *)object; + struct scic_sds_port *sci_port = object; scic_sds_port_set_base_state_handlers( sci_port, SCI_BASE_PORT_STATE_STOPPING @@ -2405,7 +2395,7 @@ static void scic_sds_port_stopping_state_enter(void *object) static inline void scic_sds_port_stopping_state_exit(void *object) { - struct scic_sds_port *sci_port = (struct scic_sds_port *)object; + struct scic_sds_port *sci_port = object; isci_timer_stop(sci_port->timer_handle); @@ -2423,8 +2413,8 @@ scic_sds_port_stopping_state_exit(void *object) */ static void scic_sds_port_failed_state_enter(void *object) { - struct scic_sds_port *sci_port = (struct scic_sds_port *)object; - struct isci_port *iport = sci_object_get_association(sci_port); + struct scic_sds_port *sci_port = object; + struct isci_port *iport = sci_port->iport; scic_sds_port_set_base_state_handlers(sci_port, SCI_BASE_PORT_STATE_FAILED); @@ -2461,16 +2451,15 @@ void scic_sds_port_construct(struct scic_sds_port *sci_port, u8 port_index, { u32 index; - sci_port->parent.private = NULL; sci_base_state_machine_construct(&sci_port->state_machine, - &sci_port->parent, + sci_port, scic_sds_port_state_table, SCI_BASE_PORT_STATE_STOPPED); sci_base_state_machine_start(&sci_port->state_machine); sci_base_state_machine_construct(&sci_port->ready_substate_machine, - &sci_port->parent, + sci_port, scic_sds_port_ready_substate_table, SCIC_SDS_PORT_READY_SUBSTATE_WAITING); diff --git a/drivers/scsi/isci/core/scic_sds_port.h b/drivers/scsi/isci/core/scic_sds_port.h index 59c76cd3902..2253a2ced96 100644 --- a/drivers/scsi/isci/core/scic_sds_port.h +++ b/drivers/scsi/isci/core/scic_sds_port.h @@ -151,17 +151,17 @@ enum scic_sds_port_states { }; +struct isci_port; /** - * struct scic_sds_port - + * struct scic_sds_port * * The core port object provides the the abstraction for an SCU port. */ struct scic_sds_port { /** - * The field specifies that the parent object for the base controller - * is the base object itself. + * The field specifies the peer object for the port. */ - struct sci_base_object parent; + struct isci_port *iport; /** * This field contains the information for the base port state machine. diff --git a/drivers/scsi/isci/port.c b/drivers/scsi/isci/port.c index d600b09192e..30d6ad895cc 100644 --- a/drivers/scsi/isci/port.c +++ b/drivers/scsi/isci/port.c @@ -100,8 +100,8 @@ void isci_port_init( isci_port_change_state(isci_port, isci_freed); (void)scic_controller_get_port_handle(controller, index, &scic_port); - sci_object_set_association(scic_port, isci_port); isci_port->sci_port_handle = scic_port; + scic_port->iport = isci_port; } @@ -169,9 +169,8 @@ void isci_port_link_up( { unsigned long flags; struct scic_port_properties properties; - struct isci_port *isci_port - = (struct isci_port *)sci_object_get_association(port); struct isci_phy *isci_phy = phy->iphy; + struct isci_port *isci_port = port->iport; enum sci_status call_status; unsigned long success = true; diff --git a/drivers/scsi/isci/sci_environment.h b/drivers/scsi/isci/sci_environment.h index 744016dffec..3fb54ddaee1 100644 --- a/drivers/scsi/isci/sci_environment.h +++ b/drivers/scsi/isci/sci_environment.h @@ -59,9 +59,6 @@ #include "isci.h" #include "core/scic_sds_controller.h" -struct scic_sds_controller; -struct scic_sds_phy; -struct scic_sds_port; struct scic_sds_remote_device; static inline struct device *scic_to_dev(struct scic_sds_controller *scic) @@ -83,7 +80,7 @@ static inline struct device *sciphy_to_dev(struct scic_sds_phy *sci_phy) static inline struct device *sciport_to_dev(struct scic_sds_port *sci_port) { - struct isci_port *iport = sci_object_get_association(sci_port); + struct isci_port *iport = sci_port->iport; if (!iport || !iport->isci_host) return NULL; -- 2.39.5