summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdmund Nadolski <edmund.nadolski@intel.com>2011-05-05 01:11:43 +0000
committerDan Williams <dan.j.williams@intel.com>2011-07-03 04:04:46 -0700
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(
struct scic_sds_remote_device *remote_device,
struct scic_sds_request *io_request);
-enum sci_status scic_controller_get_port_handle(
- struct scic_sds_controller *controller,
- u8 port_index,
- struct scic_sds_port **port_handle);
-
enum sci_status scic_controller_get_phy_handle(
struct scic_sds_controller *controller,
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(
}
/**
- * scic_controller_get_port_handle() - This method simply provides the user
- * with a unique handle for a given SAS/SATA core port index.
- * @controller: This parameter represents the handle to the controller object
- * from which to retrieve a port (SAS or SATA) handle.
- * @port_index: This parameter specifies the port index in the controller for
- * which to retrieve the port handle. 0 <= port_index < maximum number of
- * phys.
- * @port_handle: This parameter specifies the retrieved port handle to be
- * provided to the caller.
- *
- * Indicate if the retrieval of the port handle was successful. SCI_SUCCESS
- * This value is returned if the retrieval was successful.
- * SCI_FAILURE_INVALID_PORT This value is returned if the supplied port id is
- * not in the supported range.
- */
-enum sci_status scic_controller_get_port_handle(
- struct scic_sds_controller *scic,
- u8 port_index,
- struct scic_sds_port **port_handle)
-{
- if (port_index < scic->logical_port_entries) {
- *port_handle = &scic->port_table[port_index];
-
- return SCI_SUCCESS;
- }
-
- return SCI_FAILURE_INVALID_PORT;
-}
-
-/**
* scic_controller_get_phy_handle() - This method simply provides the user with
* a unique handle for a given SAS/SATA phy index/identifier.
* @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(
* NULL if there is no matching port for the phy.
*/
static struct scic_sds_port *scic_sds_port_configuration_agent_find_port(
- struct scic_sds_controller *controller,
+ struct scic_sds_controller *scic,
struct scic_sds_phy *phy)
{
- u8 port_index;
- struct scic_sds_port *port_handle;
+ u8 i;
struct sci_sas_address port_sas_address;
struct sci_sas_address port_attached_device_address;
struct sci_sas_address phy_sas_address;
@@ -136,24 +135,20 @@ static struct scic_sds_port *scic_sds_port_configuration_agent_find_port(
/*
* Since this phy can be a member of a wide port check to see if one or
* more phys match the sent and received SAS address as this phy in which
- * case it should participate in the same port. */
+ * case it should participate in the same port.
+ */
scic_sds_phy_get_sas_address(phy, &phy_sas_address);
scic_sds_phy_get_attached_sas_address(phy, &phy_attached_device_address);
- for (port_index = 0; port_index < SCI_MAX_PORTS; port_index++) {
- if (scic_controller_get_port_handle(controller, port_index, &port_handle) == SCI_SUCCESS) {
- struct scic_sds_port *port = (struct scic_sds_port *)port_handle;
+ for (i = 0; i < scic->logical_port_entries; i++) {
+ struct scic_sds_port *port = &scic->port_table[i];
- scic_sds_port_get_sas_address(port, &port_sas_address);
- scic_sds_port_get_attached_sas_address(port, &port_attached_device_address);
+ scic_sds_port_get_sas_address(port, &port_sas_address);
+ scic_sds_port_get_attached_sas_address(port, &port_attached_device_address);
- if (
- (sci_sas_address_compare(port_sas_address, phy_sas_address) == 0)
- && (sci_sas_address_compare(port_attached_device_address, phy_attached_device_address) == 0)
- ) {
- return port;
- }
- }
+ if ((sci_sas_address_compare(port_sas_address, phy_sas_address) == 0) &&
+ (sci_sas_address_compare(port_attached_device_address, phy_attached_device_address) == 0))
+ return port;
}
return NULL;
@@ -568,7 +563,6 @@ static void scic_sds_apc_agent_configure_ports(
u8 port_index;
enum sci_status status;
struct scic_sds_port *port;
- struct scic_sds_port *port_handle;
enum SCIC_SDS_APC_ACTIVITY apc_activity = SCIC_SDS_APC_SKIP_PHY;
port = scic_sds_port_configuration_agent_find_port(controller, phy);
@@ -590,9 +584,8 @@ static void scic_sds_apc_agent_configure_ports(
port_index <= port_agent->phy_valid_port_range[phy->phy_index].max_index;
port_index++
) {
- scic_controller_get_port_handle(controller, port_index, &port_handle);
- port = (struct scic_sds_port *)port_handle;
+ port = &controller->port_table[port_index];
/* First we must make sure that this PHY can be added to this Port. */
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(
-/**
- * isci_port_init() - This function initializes the given isci_port object.
- * @isci_port: This parameter specifies the port object to be initialized.
- * @isci_host: This parameter specifies parent controller object for the port.
- * @index: This parameter specifies which SCU port the isci_port associates
- * with. Generally, SCU port 0 relates to isci_port 0, etc.
- *
- */
-void isci_port_init(
- struct isci_port *isci_port,
- struct isci_host *isci_host,
- int index)
+void isci_port_init(struct isci_port *iport, struct isci_host *ihost, int index)
{
- struct scic_sds_port *scic_port;
-
- INIT_LIST_HEAD(&isci_port->remote_dev_list);
- INIT_LIST_HEAD(&isci_port->domain_dev_list);
- spin_lock_init(&isci_port->state_lock);
- init_completion(&isci_port->start_complete);
- isci_port->isci_host = isci_host;
- isci_port_change_state(isci_port, isci_freed);
-
- (void)scic_controller_get_port_handle(&isci_host->sci, index, &scic_port);
- isci_port->sci_port_handle = scic_port;
- scic_port->iport = isci_port;
+ struct scic_sds_port *sci_port;
+
+ INIT_LIST_HEAD(&iport->remote_dev_list);
+ INIT_LIST_HEAD(&iport->domain_dev_list);
+ spin_lock_init(&iport->state_lock);
+ init_completion(&iport->start_complete);
+ iport->isci_host = ihost;
+ isci_port_change_state(iport, isci_freed);
+
+ sci_port = &ihost->sci.port_table[index];
+ iport->sci_port_handle = sci_port;
+ sci_port->iport = iport;
}