aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2011-04-25 14:48:29 -0400
committerDan Williams <dan.j.williams@intel.com>2011-07-03 07:00:38 -0400
commitb87ee3075b090e1dd0bdf40b295142b606d55e64 (patch)
tree3c1318c4793a43ac7dd9b08522a1ab102b281dcf /drivers
parent88f3b62ac131e2549b6c262cacbd47e8cca42d6e (diff)
isci: cleanup remote device construction and comments
The construction routines scic_remote_device_[de]a_construct both reference the need to call scic_remote_device_construct first. Delete that comment and just have them call it explicitly, also: * move the comments from header to source * delete dead references to scic_[de]a_remote_device_add_phy Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/scsi/isci/remote_device.c101
1 files changed, 42 insertions, 59 deletions
diff --git a/drivers/scsi/isci/remote_device.c b/drivers/scsi/isci/remote_device.c
index 6b9ea9022843..70641818f602 100644
--- a/drivers/scsi/isci/remote_device.c
+++ b/drivers/scsi/isci/remote_device.c
@@ -1438,15 +1438,14 @@ static const struct sci_base_state scic_sds_remote_device_state_table[] = {
1438}; 1438};
1439 1439
1440/** 1440/**
1441 * scic_remote_device_construct() - This method will perform the construction 1441 * scic_remote_device_construct() - common construction
1442 * common to all remote device objects.
1443 * @sci_port: SAS/SATA port through which this device is accessed. 1442 * @sci_port: SAS/SATA port through which this device is accessed.
1444 * @sci_dev: remote device to construct 1443 * @sci_dev: remote device to construct
1445 * 1444 *
1446 * It isn't necessary to call scic_remote_device_destruct() for device objects 1445 * This routine just performs benign initialization and does not
1447 * that have only called this method for construction. Once subsequent 1446 * allocate the remote_node_context which is left to
1448 * construction methods have been invoked (e.g. 1447 * scic_remote_device_[de]a_construct(). scic_remote_device_destruct()
1449 * scic_remote_device_da_construct()), then destruction should occur. none 1448 * frees the remote_node_context(s) for the device.
1450 */ 1449 */
1451static void scic_remote_device_construct(struct scic_sds_port *sci_port, 1450static void scic_remote_device_construct(struct scic_sds_port *sci_port,
1452 struct scic_sds_remote_device *sci_dev) 1451 struct scic_sds_remote_device *sci_dev)
@@ -1473,32 +1472,28 @@ static void scic_remote_device_construct(struct scic_sds_port *sci_port,
1473} 1472}
1474 1473
1475/** 1474/**
1476 * scic_remote_device_da_construct() - This method will construct a 1475 * scic_remote_device_da_construct() - construct direct attached device.
1477 * SCIC_REMOTE_DEVICE object for a direct attached (da) device. The 1476 *
1478 * information (e.g. IAF, Signature FIS, etc.) necessary to build the device 1477 * The information (e.g. IAF, Signature FIS, etc.) necessary to build
1479 * is known to the SCI Core since it is contained in the scic_phy object. 1478 * the device is known to the SCI Core since it is contained in the
1480 * @remote_device: This parameter specifies the remote device to be destructed. 1479 * scic_phy object. Remote node context(s) is/are a global resource
1481 * 1480 * allocated by this routine, freed by scic_remote_device_destruct().
1482 * The user must have previously called scic_remote_device_construct() Remote 1481 *
1483 * device objects are a limited resource. As such, they must be protected. 1482 * Returns:
1484 * Thus calls to construct and destruct are mutually exclusive and 1483 * SCI_FAILURE_DEVICE_EXISTS - device has already been constructed.
1485 * non-reentrant. Indicate if the remote device was successfully constructed. 1484 * SCI_FAILURE_UNSUPPORTED_PROTOCOL - e.g. sas device attached to
1486 * SCI_SUCCESS Returned if the device was successfully constructed. 1485 * sata-only controller instance.
1487 * SCI_FAILURE_DEVICE_EXISTS Returned if the device has already been 1486 * SCI_FAILURE_INSUFFICIENT_RESOURCES - remote node contexts exhausted.
1488 * constructed. If it's an additional phy for the target, then call
1489 * scic_remote_device_da_add_phy(). SCI_FAILURE_UNSUPPORTED_PROTOCOL Returned
1490 * if the supplied parameters necessitate creation of a remote device for which
1491 * the protocol is not supported by the underlying controller hardware.
1492 * SCI_FAILURE_INSUFFICIENT_RESOURCES This value is returned if the core
1493 * controller associated with the supplied parameters is unable to support
1494 * additional remote devices.
1495 */ 1487 */
1496static enum sci_status scic_remote_device_da_construct(struct scic_sds_remote_device *sci_dev) 1488static enum sci_status scic_remote_device_da_construct(struct scic_sds_port *sci_port,
1489 struct scic_sds_remote_device *sci_dev)
1497{ 1490{
1498 enum sci_status status; 1491 enum sci_status status;
1499 u16 remote_node_index; 1492 u16 remote_node_index;
1500 struct sci_sas_identify_address_frame_protocols protocols; 1493 struct sci_sas_identify_address_frame_protocols protocols;
1501 1494
1495 scic_remote_device_construct(sci_port, sci_dev);
1496
1502 /* 1497 /*
1503 * This information is request to determine how many remote node context 1498 * This information is request to determine how many remote node context
1504 * entries will be needed to store the remote node. 1499 * entries will be needed to store the remote node.
@@ -1567,34 +1562,26 @@ static void scic_sds_remote_device_get_info_from_smp_discover_response(
1567} 1562}
1568 1563
1569/** 1564/**
1570 * scic_remote_device_ea_construct() - This method will construct an 1565 * scic_remote_device_ea_construct() - construct expander attached device
1571 * SCIC_REMOTE_DEVICE object for an expander attached (ea) device from an 1566 * @discover_response: data to build remote device
1572 * SMP Discover Response. 1567 *
1573 * @remote_device: This parameter specifies the remote device to be destructed. 1568 * Remote node context(s) is/are a global resource allocated by this
1574 * @discover_response: This parameter specifies the SMP Discovery Response to 1569 * routine, freed by scic_remote_device_destruct().
1575 * be used in device creation. 1570 *
1576 * 1571 * Returns:
1577 * The user must have previously called scic_remote_device_construct() Remote 1572 * SCI_FAILURE_DEVICE_EXISTS - device has already been constructed.
1578 * device objects are a limited resource. As such, they must be protected. 1573 * SCI_FAILURE_UNSUPPORTED_PROTOCOL - e.g. sas device attached to
1579 * Thus calls to construct and destruct are mutually exclusive and 1574 * sata-only controller instance.
1580 * non-reentrant. Indicate if the remote device was successfully constructed. 1575 * SCI_FAILURE_INSUFFICIENT_RESOURCES - remote node contexts exhausted.
1581 * SCI_SUCCESS Returned if the device was successfully constructed.
1582 * SCI_FAILURE_DEVICE_EXISTS Returned if the device has already been
1583 * constructed. If it's an additional phy for the target, then call
1584 * scic_ea_remote_device_add_phy(). SCI_FAILURE_UNSUPPORTED_PROTOCOL Returned
1585 * if the supplied parameters necessitate creation of a remote device for which
1586 * the protocol is not supported by the underlying controller hardware.
1587 * SCI_FAILURE_INSUFFICIENT_RESOURCES This value is returned if the core
1588 * controller associated with the supplied parameters is unable to support
1589 * additional remote devices.
1590 */ 1576 */
1591static enum sci_status scic_remote_device_ea_construct(struct scic_sds_remote_device *sci_dev, 1577static enum sci_status scic_remote_device_ea_construct(struct scic_sds_port *sci_port,
1578 struct scic_sds_remote_device *sci_dev,
1592 struct smp_response_discover *discover_response) 1579 struct smp_response_discover *discover_response)
1593{ 1580{
1581 struct scic_sds_controller *scic = sci_port->owning_controller;
1594 enum sci_status status; 1582 enum sci_status status;
1595 struct scic_sds_controller *scic;
1596 1583
1597 scic = scic_sds_port_get_controller(sci_dev->owning_port); 1584 scic_remote_device_construct(sci_port, sci_dev);
1598 1585
1599 scic_sds_remote_device_get_info_from_smp_discover_response( 1586 scic_sds_remote_device_get_info_from_smp_discover_response(
1600 sci_dev, discover_response); 1587 sci_dev, discover_response);
@@ -1632,9 +1619,8 @@ static enum sci_status scic_remote_device_ea_construct(struct scic_sds_remote_de
1632 * physical. Furthermore, the SAS-2 and SAS-1.1 fields overlay 1619 * physical. Furthermore, the SAS-2 and SAS-1.1 fields overlay
1633 * one another, so this code works for both situations. */ 1620 * one another, so this code works for both situations. */
1634 sci_dev->connection_rate = min_t(u16, 1621 sci_dev->connection_rate = min_t(u16,
1635 scic_sds_port_get_max_allowed_speed(sci_dev->owning_port), 1622 scic_sds_port_get_max_allowed_speed(sci_port),
1636 discover_response->u2.sas1_1.negotiated_physical_link_rate 1623 discover_response->u2.sas1_1.negotiated_physical_link_rate);
1637 );
1638 1624
1639 /* / @todo Should I assign the port width by reading all of the phys on the port? */ 1625 /* / @todo Should I assign the port width by reading all of the phys on the port? */
1640 sci_dev->device_port_width = 1; 1626 sci_dev->device_port_width = 1;
@@ -1678,11 +1664,6 @@ static enum sci_status isci_remote_device_construct(
1678{ 1664{
1679 enum sci_status status = SCI_SUCCESS; 1665 enum sci_status status = SCI_SUCCESS;
1680 1666
1681 /* let the core do it's common constuction. */
1682 scic_remote_device_construct(port->sci_port_handle,
1683 &isci_device->sci);
1684
1685 /* let the core do it's device specific constuction. */
1686 if (isci_device->domain_dev->parent && 1667 if (isci_device->domain_dev->parent &&
1687 (isci_device->domain_dev->parent->dev_type == EDGE_DEV)) { 1668 (isci_device->domain_dev->parent->dev_type == EDGE_DEV)) {
1688 int i; 1669 int i;
@@ -1746,11 +1727,13 @@ static enum sci_status isci_remote_device_construct(
1746 "%s: parent->dev_type = EDGE_DEV\n", 1727 "%s: parent->dev_type = EDGE_DEV\n",
1747 __func__); 1728 __func__);
1748 1729
1749 status = scic_remote_device_ea_construct(&isci_device->sci, 1730 status = scic_remote_device_ea_construct(port->sci_port_handle,
1731 &isci_device->sci,
1750 (struct smp_response_discover *)&discover_response); 1732 (struct smp_response_discover *)&discover_response);
1751 1733
1752 } else 1734 } else
1753 status = scic_remote_device_da_construct(&isci_device->sci); 1735 status = scic_remote_device_da_construct(port->sci_port_handle,
1736 &isci_device->sci);
1754 1737
1755 1738
1756 if (status != SCI_SUCCESS) { 1739 if (status != SCI_SUCCESS) {