aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEdmund Nadolski <edmund.nadolski@intel.com>2011-05-04 21:11:43 -0400
committerDan Williams <dan.j.williams@intel.com>2011-07-03 07:04:46 -0400
commited30c275dd9fc5c603081144db5df3110f258534 (patch)
tree1442debf4ea5bbb3a14a79c41f81848fb0be3a68
parent9286a1959ce7f3df3c1a8e33eb9b210078318dc8 (diff)
isci: kill scic_controller_get_port_handle function
This function is just overkill and its usage is inconsistent. Replace with inlined code. Signed-off-by: Edmund Nadolski <edmund.nadolski@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
-rw-r--r--drivers/scsi/isci/core/scic_controller.h5
-rw-r--r--drivers/scsi/isci/core/scic_sds_controller.c30
-rw-r--r--drivers/scsi/isci/core/scic_sds_port_configuration_agent.c31
-rw-r--r--drivers/scsi/isci/port.c37
4 files changed, 25 insertions, 78 deletions
diff --git a/drivers/scsi/isci/core/scic_controller.h b/drivers/scsi/isci/core/scic_controller.h
index 23c7b5c004f4..50ba155a6c7c 100644
--- a/drivers/scsi/isci/core/scic_controller.h
+++ b/drivers/scsi/isci/core/scic_controller.h
@@ -120,11 +120,6 @@ enum sci_status scic_controller_complete_io(
120 struct scic_sds_remote_device *remote_device, 120 struct scic_sds_remote_device *remote_device,
121 struct scic_sds_request *io_request); 121 struct scic_sds_request *io_request);
122 122
123enum sci_status scic_controller_get_port_handle(
124 struct scic_sds_controller *controller,
125 u8 port_index,
126 struct scic_sds_port **port_handle);
127
128enum sci_status scic_controller_get_phy_handle( 123enum sci_status scic_controller_get_phy_handle(
129 struct scic_sds_controller *controller, 124 struct scic_sds_controller *controller,
130 u8 phy_index, 125 u8 phy_index,
diff --git a/drivers/scsi/isci/core/scic_sds_controller.c b/drivers/scsi/isci/core/scic_sds_controller.c
index ea510411460c..b59548254e24 100644
--- a/drivers/scsi/isci/core/scic_sds_controller.c
+++ b/drivers/scsi/isci/core/scic_sds_controller.c
@@ -2155,36 +2155,6 @@ enum sci_task_status scic_controller_start_task(
2155} 2155}
2156 2156
2157/** 2157/**
2158 * scic_controller_get_port_handle() - This method simply provides the user
2159 * with a unique handle for a given SAS/SATA core port index.
2160 * @controller: This parameter represents the handle to the controller object
2161 * from which to retrieve a port (SAS or SATA) handle.
2162 * @port_index: This parameter specifies the port index in the controller for
2163 * which to retrieve the port handle. 0 <= port_index < maximum number of
2164 * phys.
2165 * @port_handle: This parameter specifies the retrieved port handle to be
2166 * provided to the caller.
2167 *
2168 * Indicate if the retrieval of the port handle was successful. SCI_SUCCESS
2169 * This value is returned if the retrieval was successful.
2170 * SCI_FAILURE_INVALID_PORT This value is returned if the supplied port id is
2171 * not in the supported range.
2172 */
2173enum sci_status scic_controller_get_port_handle(
2174 struct scic_sds_controller *scic,
2175 u8 port_index,
2176 struct scic_sds_port **port_handle)
2177{
2178 if (port_index < scic->logical_port_entries) {
2179 *port_handle = &scic->port_table[port_index];
2180
2181 return SCI_SUCCESS;
2182 }
2183
2184 return SCI_FAILURE_INVALID_PORT;
2185}
2186
2187/**
2188 * scic_controller_get_phy_handle() - This method simply provides the user with 2158 * scic_controller_get_phy_handle() - This method simply provides the user with
2189 * a unique handle for a given SAS/SATA phy index/identifier. 2159 * a unique handle for a given SAS/SATA phy index/identifier.
2190 * @controller: This parameter represents the handle to the controller object 2160 * @controller: This parameter represents the handle to the controller object
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 6b1f4a0ad990..6b2fb445a8f7 100644
--- a/drivers/scsi/isci/core/scic_sds_port_configuration_agent.c
+++ b/drivers/scsi/isci/core/scic_sds_port_configuration_agent.c
@@ -123,11 +123,10 @@ static s32 sci_sas_address_compare(
123 * NULL if there is no matching port for the phy. 123 * NULL if there is no matching port for the phy.
124 */ 124 */
125static struct scic_sds_port *scic_sds_port_configuration_agent_find_port( 125static struct scic_sds_port *scic_sds_port_configuration_agent_find_port(
126 struct scic_sds_controller *controller, 126 struct scic_sds_controller *scic,
127 struct scic_sds_phy *phy) 127 struct scic_sds_phy *phy)
128{ 128{
129 u8 port_index; 129 u8 i;
130 struct scic_sds_port *port_handle;
131 struct sci_sas_address port_sas_address; 130 struct sci_sas_address port_sas_address;
132 struct sci_sas_address port_attached_device_address; 131 struct sci_sas_address port_attached_device_address;
133 struct sci_sas_address phy_sas_address; 132 struct sci_sas_address phy_sas_address;
@@ -136,24 +135,20 @@ static struct scic_sds_port *scic_sds_port_configuration_agent_find_port(
136 /* 135 /*
137 * Since this phy can be a member of a wide port check to see if one or 136 * Since this phy can be a member of a wide port check to see if one or
138 * more phys match the sent and received SAS address as this phy in which 137 * more phys match the sent and received SAS address as this phy in which
139 * case it should participate in the same port. */ 138 * case it should participate in the same port.
139 */
140 scic_sds_phy_get_sas_address(phy, &phy_sas_address); 140 scic_sds_phy_get_sas_address(phy, &phy_sas_address);
141 scic_sds_phy_get_attached_sas_address(phy, &phy_attached_device_address); 141 scic_sds_phy_get_attached_sas_address(phy, &phy_attached_device_address);
142 142
143 for (port_index = 0; port_index < SCI_MAX_PORTS; port_index++) { 143 for (i = 0; i < scic->logical_port_entries; i++) {
144 if (scic_controller_get_port_handle(controller, port_index, &port_handle) == SCI_SUCCESS) { 144 struct scic_sds_port *port = &scic->port_table[i];
145 struct scic_sds_port *port = (struct scic_sds_port *)port_handle;
146 145
147 scic_sds_port_get_sas_address(port, &port_sas_address); 146 scic_sds_port_get_sas_address(port, &port_sas_address);
148 scic_sds_port_get_attached_sas_address(port, &port_attached_device_address); 147 scic_sds_port_get_attached_sas_address(port, &port_attached_device_address);
149 148
150 if ( 149 if ((sci_sas_address_compare(port_sas_address, phy_sas_address) == 0) &&
151 (sci_sas_address_compare(port_sas_address, phy_sas_address) == 0) 150 (sci_sas_address_compare(port_attached_device_address, phy_attached_device_address) == 0))
152 && (sci_sas_address_compare(port_attached_device_address, phy_attached_device_address) == 0) 151 return port;
153 ) {
154 return port;
155 }
156 }
157 } 152 }
158 153
159 return NULL; 154 return NULL;
@@ -568,7 +563,6 @@ static void scic_sds_apc_agent_configure_ports(
568 u8 port_index; 563 u8 port_index;
569 enum sci_status status; 564 enum sci_status status;
570 struct scic_sds_port *port; 565 struct scic_sds_port *port;
571 struct scic_sds_port *port_handle;
572 enum SCIC_SDS_APC_ACTIVITY apc_activity = SCIC_SDS_APC_SKIP_PHY; 566 enum SCIC_SDS_APC_ACTIVITY apc_activity = SCIC_SDS_APC_SKIP_PHY;
573 567
574 port = scic_sds_port_configuration_agent_find_port(controller, phy); 568 port = scic_sds_port_configuration_agent_find_port(controller, phy);
@@ -590,9 +584,8 @@ static void scic_sds_apc_agent_configure_ports(
590 port_index <= port_agent->phy_valid_port_range[phy->phy_index].max_index; 584 port_index <= port_agent->phy_valid_port_range[phy->phy_index].max_index;
591 port_index++ 585 port_index++
592 ) { 586 ) {
593 scic_controller_get_port_handle(controller, port_index, &port_handle);
594 587
595 port = (struct scic_sds_port *)port_handle; 588 port = &controller->port_table[port_index];
596 589
597 /* First we must make sure that this PHY can be added to this Port. */ 590 /* First we must make sure that this PHY can be added to this Port. */
598 if (scic_sds_port_is_valid_phy_assignment(port, phy->phy_index)) { 591 if (scic_sds_port_is_valid_phy_assignment(port, phy->phy_index)) {
diff --git a/drivers/scsi/isci/port.c b/drivers/scsi/isci/port.c
index 8d96a10341b1..6110306e8e23 100644
--- a/drivers/scsi/isci/port.c
+++ b/drivers/scsi/isci/port.c
@@ -76,31 +76,20 @@ static void isci_port_change_state(
76 76
77 77
78 78
79/** 79void isci_port_init(struct isci_port *iport, struct isci_host *ihost, int index)
80 * isci_port_init() - This function initializes the given isci_port object.
81 * @isci_port: This parameter specifies the port object to be initialized.
82 * @isci_host: This parameter specifies parent controller object for the port.
83 * @index: This parameter specifies which SCU port the isci_port associates
84 * with. Generally, SCU port 0 relates to isci_port 0, etc.
85 *
86 */
87void isci_port_init(
88 struct isci_port *isci_port,
89 struct isci_host *isci_host,
90 int index)
91{ 80{
92 struct scic_sds_port *scic_port; 81 struct scic_sds_port *sci_port;
93 82
94 INIT_LIST_HEAD(&isci_port->remote_dev_list); 83 INIT_LIST_HEAD(&iport->remote_dev_list);
95 INIT_LIST_HEAD(&isci_port->domain_dev_list); 84 INIT_LIST_HEAD(&iport->domain_dev_list);
96 spin_lock_init(&isci_port->state_lock); 85 spin_lock_init(&iport->state_lock);
97 init_completion(&isci_port->start_complete); 86 init_completion(&iport->start_complete);
98 isci_port->isci_host = isci_host; 87 iport->isci_host = ihost;
99 isci_port_change_state(isci_port, isci_freed); 88 isci_port_change_state(iport, isci_freed);
100 89
101 (void)scic_controller_get_port_handle(&isci_host->sci, index, &scic_port); 90 sci_port = &ihost->sci.port_table[index];
102 isci_port->sci_port_handle = scic_port; 91 iport->sci_port_handle = sci_port;
103 scic_port->iport = isci_port; 92 sci_port->iport = iport;
104} 93}
105 94
106 95