isci: kill scic_controller_get_port_handle function
authorEdmund Nadolski <edmund.nadolski@intel.com>
Thu, 5 May 2011 01:11:43 +0000 (01:11 +0000)
committerDan Williams <dan.j.williams@intel.com>
Sun, 3 Jul 2011 11:04:46 +0000 (04:04 -0700)
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>
drivers/scsi/isci/core/scic_controller.h
drivers/scsi/isci/core/scic_sds_controller.c
drivers/scsi/isci/core/scic_sds_port_configuration_agent.c
drivers/scsi/isci/port.c

index 23c7b5c..50ba155 100644 (file)
@@ -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,
index ea51041..b595482 100644 (file)
@@ -2154,36 +2154,6 @@ enum sci_task_status scic_controller_start_task(
        return status;
 }
 
-/**
- * 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.
index 6b1f4a0..6b2fb44 100644 (file)
@@ -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)) {
index 8d96a10..6110306 100644 (file)
@@ -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;
 }