]> git.karo-electronics.de Git - linux-beck.git/commitdiff
isci: kill ->is_direct_attached
authorDan Williams <dan.j.williams@intel.com>
Wed, 1 Feb 2012 08:23:10 +0000 (00:23 -0800)
committerDan Williams <dan.j.williams@intel.com>
Thu, 17 May 2012 19:27:11 +0000 (12:27 -0700)
domain_device ->parent conveys the same information.

Occurrences of ->is_direct_attached appear next to incomplete open-coded
versions of dev_is_sata(), clean those up as well.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
drivers/scsi/isci/host.h
drivers/scsi/isci/remote_device.c
drivers/scsi/isci/remote_device.h
drivers/scsi/isci/remote_node_context.c
drivers/scsi/isci/request.c

index adbad69d10695ecafa4e86057feb3b35bc8cb046..a9679ee7084bf250eb1961f0b29687e88a8d4405 100644 (file)
@@ -55,6 +55,7 @@
 #ifndef _SCI_HOST_H_
 #define _SCI_HOST_H_
 
+#include <scsi/sas_ata.h>
 #include "remote_device.h"
 #include "phy.h"
 #include "isci.h"
@@ -378,8 +379,7 @@ static inline int sci_remote_device_node_count(struct isci_remote_device *idev)
 {
        struct domain_device *dev = idev->domain_dev;
 
-       if ((dev->dev_type == SATA_DEV || (dev->tproto & SAS_PROTOCOL_STP)) &&
-           !idev->is_direct_attached)
+       if (dev_is_sata(dev) && dev->parent)
                return SCU_STP_REMOTE_NODE_COUNT;
        return SCU_SSP_REMOTE_NODE_COUNT;
 }
index 8f501b0a81d6e7842a9d9caaaae1d228b996f2ab..71f5090647379e51a85a9aa1b5437f2672ba640e 100644 (file)
@@ -1113,33 +1113,20 @@ static enum sci_status sci_remote_device_da_construct(struct isci_port *iport,
 {
        enum sci_status status;
        struct sci_port_properties properties;
-       struct domain_device *dev = idev->domain_dev;
 
        sci_remote_device_construct(iport, idev);
 
-       /*
-        * This information is request to determine how many remote node context
-        * entries will be needed to store the remote node.
-        */
-       idev->is_direct_attached = true;
-
        sci_port_get_properties(iport, &properties);
        /* Get accurate port width from port's phy mask for a DA device. */
        idev->device_port_width = hweight32(properties.phy_mask);
 
        status = sci_controller_allocate_remote_node_context(iport->owning_controller,
-                                                                 idev,
-                                                                 &idev->rnc.remote_node_index);
+                                                            idev,
+                                                            &idev->rnc.remote_node_index);
 
        if (status != SCI_SUCCESS)
                return status;
 
-       if (dev->dev_type == SAS_END_DEV || dev->dev_type == SATA_DEV ||
-           (dev->tproto & SAS_PROTOCOL_STP) || dev_is_expander(dev))
-               /* pass */;
-       else
-               return SCI_FAILURE_UNSUPPORTED_PROTOCOL;
-
        idev->connection_rate = sci_port_get_max_allowed_speed(iport);
 
        return SCI_SUCCESS;
@@ -1171,19 +1158,13 @@ static enum sci_status sci_remote_device_ea_construct(struct isci_port *iport,
        if (status != SCI_SUCCESS)
                return status;
 
-       if (dev->dev_type == SAS_END_DEV || dev->dev_type == SATA_DEV ||
-           (dev->tproto & SAS_PROTOCOL_STP) || dev_is_expander(dev))
-               /* pass */;
-       else
-               return SCI_FAILURE_UNSUPPORTED_PROTOCOL;
-
-       /*
-        * For SAS-2 the physical link rate is actually a logical link
+       /* For SAS-2 the physical link rate is actually a logical link
         * rate that incorporates multiplexing.  The SCU doesn't
         * incorporate multiplexing and for the purposes of the
         * connection the logical link rate is that same as the
         * physical.  Furthermore, the SAS-2 and SAS-1.1 fields overlay
-        * one another, so this code works for both situations. */
+        * one another, so this code works for both situations.
+        */
        idev->connection_rate = min_t(u16, sci_port_get_max_allowed_speed(iport),
                                         dev->linkrate);
 
index 58637ee08f55a3f9f7efcea54f25566f1a84ba53..4a67ff0eb94ec4da488697950c544b79d03663ff 100644 (file)
@@ -94,7 +94,6 @@ struct isci_remote_device {
        struct sci_base_state_machine sm;
        u32 device_port_width;
        enum sas_linkrate connection_rate;
-       bool is_direct_attached;
        struct isci_port *owning_port;
        struct sci_remote_node_context rnc;
        /* XXX unify with device reference counting and delete */
index 994ec0c25a744b265add2c30a47ba154b7cef07e..8ce5a35891e1536b6d0f45d86e8cfe6870ff379f 100644 (file)
@@ -131,7 +131,7 @@ static void sci_remote_node_context_construct_buffer(struct sci_remote_node_cont
 
        rnc->ssp.arbitration_wait_time = 0;
 
-       if (dev->dev_type == SATA_DEV || (dev->tproto & SAS_PROTOCOL_STP)) {
+       if (dev_is_sata(dev)) {
                rnc->ssp.connection_occupancy_timeout =
                        ihost->user_parameters.stp_max_occupancy_timeout;
                rnc->ssp.connection_inactivity_timeout =
@@ -219,13 +219,12 @@ static void sci_remote_node_context_validate_context_buffer(struct sci_remote_no
 
        rnc_buffer->ssp.is_valid = true;
 
-       if (!idev->is_direct_attached &&
-           (dev->dev_type == SATA_DEV || (dev->tproto & SAS_PROTOCOL_STP))) {
+       if (dev_is_sata(dev) && dev->parent) {
                sci_remote_device_post_request(idev, SCU_CONTEXT_COMMAND_POST_RNC_96);
        } else {
                sci_remote_device_post_request(idev, SCU_CONTEXT_COMMAND_POST_RNC_32);
 
-               if (idev->is_direct_attached)
+               if (!dev->parent)
                        sci_port_setup_transports(idev->owning_port,
                                                  sci_rnc->remote_node_index);
        }
@@ -287,10 +286,8 @@ static void sci_remote_node_context_resuming_state_enter(struct sci_base_state_m
         * resume because of a target reset we also need to update
         * the STPTLDARNI register with the RNi of the device
         */
-       if ((dev->dev_type == SATA_DEV || (dev->tproto & SAS_PROTOCOL_STP)) &&
-           idev->is_direct_attached)
-               sci_port_setup_transports(idev->owning_port,
-                                              rnc->remote_node_index);
+       if (dev_is_sata(dev) && !dev->parent)
+               sci_port_setup_transports(idev->owning_port, rnc->remote_node_index);
 
        sci_remote_device_post_request(idev, SCU_CONTEXT_COMMAND_POST_RNC_RESUME);
 }
@@ -553,18 +550,10 @@ enum sci_status sci_remote_node_context_resume(struct sci_remote_node_context *s
 
                sci_remote_node_context_setup_to_resume(sci_rnc, cb_fn, cb_p);
 
-               /* TODO: consider adding a resume action of NONE, INVALIDATE, WRITE_TLCR */
-               if (dev->dev_type == SAS_END_DEV || dev_is_expander(dev))
+               if (dev_is_sata(dev) && dev->parent)
+                       sci_change_state(&sci_rnc->sm, SCI_RNC_INVALIDATING);
+               else
                        sci_change_state(&sci_rnc->sm, SCI_RNC_RESUMING);
-               else if (dev->dev_type == SATA_DEV || (dev->tproto & SAS_PROTOCOL_STP)) {
-                       if (idev->is_direct_attached) {
-                               /* @todo Fix this since I am being silly in writing to the STPTLDARNI register. */
-                               sci_change_state(&sci_rnc->sm, SCI_RNC_RESUMING);
-                       } else {
-                               sci_change_state(&sci_rnc->sm, SCI_RNC_INVALIDATING);
-                       }
-               } else
-                       return SCI_FAILURE;
                return SCI_SUCCESS;
        }
        case SCI_RNC_TX_RX_SUSPENDED:
index 2def1e3960f66519753b11b39e65f1d124afad30..01844ef196568739e47c9eefb22dc4d100116213 100644 (file)
@@ -3193,7 +3193,7 @@ sci_io_request_construct(struct isci_host *ihost,
 
        if (dev->dev_type == SAS_END_DEV)
                /* pass */;
-       else if (dev->dev_type == SATA_DEV || (dev->tproto & SAS_PROTOCOL_STP))
+       else if (dev_is_sata(dev))
                memset(&ireq->stp.cmd, 0, sizeof(ireq->stp.cmd));
        else if (dev_is_expander(dev))
                /* pass */;
@@ -3215,8 +3215,7 @@ enum sci_status sci_task_request_construct(struct isci_host *ihost,
        /* Build the common part of the request */
        sci_general_request_construct(ihost, idev, ireq);
 
-       if (dev->dev_type == SAS_END_DEV ||
-           dev->dev_type == SATA_DEV || (dev->tproto & SAS_PROTOCOL_STP)) {
+       if (dev->dev_type == SAS_END_DEV || dev_is_sata(dev)) {
                set_bit(IREQ_TMF, &ireq->flags);
                memset(ireq->tc, 0, sizeof(struct scu_task_context));
        } else