Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

isci: kill ->is_direct_attached

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>

+17 -49
+2 -2
drivers/scsi/isci/host.h
··· 55 55 #ifndef _SCI_HOST_H_ 56 56 #define _SCI_HOST_H_ 57 57 58 + #include <scsi/sas_ata.h> 58 59 #include "remote_device.h" 59 60 #include "phy.h" 60 61 #include "isci.h" ··· 379 378 { 380 379 struct domain_device *dev = idev->domain_dev; 381 380 382 - if ((dev->dev_type == SATA_DEV || (dev->tproto & SAS_PROTOCOL_STP)) && 383 - !idev->is_direct_attached) 381 + if (dev_is_sata(dev) && dev->parent) 384 382 return SCU_STP_REMOTE_NODE_COUNT; 385 383 return SCU_SSP_REMOTE_NODE_COUNT; 386 384 }
+5 -24
drivers/scsi/isci/remote_device.c
··· 1113 1113 { 1114 1114 enum sci_status status; 1115 1115 struct sci_port_properties properties; 1116 - struct domain_device *dev = idev->domain_dev; 1117 1116 1118 1117 sci_remote_device_construct(iport, idev); 1119 - 1120 - /* 1121 - * This information is request to determine how many remote node context 1122 - * entries will be needed to store the remote node. 1123 - */ 1124 - idev->is_direct_attached = true; 1125 1118 1126 1119 sci_port_get_properties(iport, &properties); 1127 1120 /* Get accurate port width from port's phy mask for a DA device. */ 1128 1121 idev->device_port_width = hweight32(properties.phy_mask); 1129 1122 1130 1123 status = sci_controller_allocate_remote_node_context(iport->owning_controller, 1131 - idev, 1132 - &idev->rnc.remote_node_index); 1124 + idev, 1125 + &idev->rnc.remote_node_index); 1133 1126 1134 1127 if (status != SCI_SUCCESS) 1135 1128 return status; 1136 - 1137 - if (dev->dev_type == SAS_END_DEV || dev->dev_type == SATA_DEV || 1138 - (dev->tproto & SAS_PROTOCOL_STP) || dev_is_expander(dev)) 1139 - /* pass */; 1140 - else 1141 - return SCI_FAILURE_UNSUPPORTED_PROTOCOL; 1142 1129 1143 1130 idev->connection_rate = sci_port_get_max_allowed_speed(iport); 1144 1131 ··· 1158 1171 if (status != SCI_SUCCESS) 1159 1172 return status; 1160 1173 1161 - if (dev->dev_type == SAS_END_DEV || dev->dev_type == SATA_DEV || 1162 - (dev->tproto & SAS_PROTOCOL_STP) || dev_is_expander(dev)) 1163 - /* pass */; 1164 - else 1165 - return SCI_FAILURE_UNSUPPORTED_PROTOCOL; 1166 - 1167 - /* 1168 - * For SAS-2 the physical link rate is actually a logical link 1174 + /* For SAS-2 the physical link rate is actually a logical link 1169 1175 * rate that incorporates multiplexing. The SCU doesn't 1170 1176 * incorporate multiplexing and for the purposes of the 1171 1177 * connection the logical link rate is that same as the 1172 1178 * physical. Furthermore, the SAS-2 and SAS-1.1 fields overlay 1173 - * one another, so this code works for both situations. */ 1179 + * one another, so this code works for both situations. 1180 + */ 1174 1181 idev->connection_rate = min_t(u16, sci_port_get_max_allowed_speed(iport), 1175 1182 dev->linkrate); 1176 1183
-1
drivers/scsi/isci/remote_device.h
··· 94 94 struct sci_base_state_machine sm; 95 95 u32 device_port_width; 96 96 enum sas_linkrate connection_rate; 97 - bool is_direct_attached; 98 97 struct isci_port *owning_port; 99 98 struct sci_remote_node_context rnc; 100 99 /* XXX unify with device reference counting and delete */
+8 -19
drivers/scsi/isci/remote_node_context.c
··· 131 131 132 132 rnc->ssp.arbitration_wait_time = 0; 133 133 134 - if (dev->dev_type == SATA_DEV || (dev->tproto & SAS_PROTOCOL_STP)) { 134 + if (dev_is_sata(dev)) { 135 135 rnc->ssp.connection_occupancy_timeout = 136 136 ihost->user_parameters.stp_max_occupancy_timeout; 137 137 rnc->ssp.connection_inactivity_timeout = ··· 219 219 220 220 rnc_buffer->ssp.is_valid = true; 221 221 222 - if (!idev->is_direct_attached && 223 - (dev->dev_type == SATA_DEV || (dev->tproto & SAS_PROTOCOL_STP))) { 222 + if (dev_is_sata(dev) && dev->parent) { 224 223 sci_remote_device_post_request(idev, SCU_CONTEXT_COMMAND_POST_RNC_96); 225 224 } else { 226 225 sci_remote_device_post_request(idev, SCU_CONTEXT_COMMAND_POST_RNC_32); 227 226 228 - if (idev->is_direct_attached) 227 + if (!dev->parent) 229 228 sci_port_setup_transports(idev->owning_port, 230 229 sci_rnc->remote_node_index); 231 230 } ··· 286 287 * resume because of a target reset we also need to update 287 288 * the STPTLDARNI register with the RNi of the device 288 289 */ 289 - if ((dev->dev_type == SATA_DEV || (dev->tproto & SAS_PROTOCOL_STP)) && 290 - idev->is_direct_attached) 291 - sci_port_setup_transports(idev->owning_port, 292 - rnc->remote_node_index); 290 + if (dev_is_sata(dev) && !dev->parent) 291 + sci_port_setup_transports(idev->owning_port, rnc->remote_node_index); 293 292 294 293 sci_remote_device_post_request(idev, SCU_CONTEXT_COMMAND_POST_RNC_RESUME); 295 294 } ··· 550 553 551 554 sci_remote_node_context_setup_to_resume(sci_rnc, cb_fn, cb_p); 552 555 553 - /* TODO: consider adding a resume action of NONE, INVALIDATE, WRITE_TLCR */ 554 - if (dev->dev_type == SAS_END_DEV || dev_is_expander(dev)) 556 + if (dev_is_sata(dev) && dev->parent) 557 + sci_change_state(&sci_rnc->sm, SCI_RNC_INVALIDATING); 558 + else 555 559 sci_change_state(&sci_rnc->sm, SCI_RNC_RESUMING); 556 - else if (dev->dev_type == SATA_DEV || (dev->tproto & SAS_PROTOCOL_STP)) { 557 - if (idev->is_direct_attached) { 558 - /* @todo Fix this since I am being silly in writing to the STPTLDARNI register. */ 559 - sci_change_state(&sci_rnc->sm, SCI_RNC_RESUMING); 560 - } else { 561 - sci_change_state(&sci_rnc->sm, SCI_RNC_INVALIDATING); 562 - } 563 - } else 564 - return SCI_FAILURE; 565 560 return SCI_SUCCESS; 566 561 } 567 562 case SCI_RNC_TX_RX_SUSPENDED:
+2 -3
drivers/scsi/isci/request.c
··· 3193 3193 3194 3194 if (dev->dev_type == SAS_END_DEV) 3195 3195 /* pass */; 3196 - else if (dev->dev_type == SATA_DEV || (dev->tproto & SAS_PROTOCOL_STP)) 3196 + else if (dev_is_sata(dev)) 3197 3197 memset(&ireq->stp.cmd, 0, sizeof(ireq->stp.cmd)); 3198 3198 else if (dev_is_expander(dev)) 3199 3199 /* pass */; ··· 3215 3215 /* Build the common part of the request */ 3216 3216 sci_general_request_construct(ihost, idev, ireq); 3217 3217 3218 - if (dev->dev_type == SAS_END_DEV || 3219 - dev->dev_type == SATA_DEV || (dev->tproto & SAS_PROTOCOL_STP)) { 3218 + if (dev->dev_type == SAS_END_DEV || dev_is_sata(dev)) { 3220 3219 set_bit(IREQ_TMF, &ireq->flags); 3221 3220 memset(ireq->tc, 0, sizeof(struct scu_task_context)); 3222 3221 } else