aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/libsas
diff options
context:
space:
mode:
authorJames Bottomley <JBottomley@Parallels.com>2013-05-07 17:44:06 -0400
committerJames Bottomley <JBottomley@Parallels.com>2013-05-10 10:47:52 -0400
commitaa9f8328fc51460e15da129caf622b6560fa8c99 (patch)
tree3ca4c2a29e94538acff4aae04214d5645eaeac02 /drivers/scsi/libsas
parenta6cb3d012b983b350ae3892cff2e692665df0e1e (diff)
[SCSI] sas: unify the pointlessly separated enums sas_dev_type and sas_device_type
These enums have been separate since the dawn of SAS, mainly because the latter is a procotol only enum and the former includes additional state for libsas. The dichotomy causes endless confusion about which one you should use where and leads to pointless warnings like this: drivers/scsi/mvsas/mv_sas.c: In function 'mvs_update_phyinfo': drivers/scsi/mvsas/mv_sas.c:1162:34: warning: comparison between 'enum sas_device_type' and 'enum sas_dev_type' [-Wenum-compare] Fix by eliminating one of them. The one kept is effectively the sas.h one, but call it sas_device_type and make sure the enums are all properly namespaced with the SAS_ prefix. Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/libsas')
-rw-r--r--drivers/scsi/libsas/sas_ata.c18
-rw-r--r--drivers/scsi/libsas/sas_discover.c34
-rw-r--r--drivers/scsi/libsas/sas_expander.c110
-rw-r--r--drivers/scsi/libsas/sas_internal.h10
-rw-r--r--drivers/scsi/libsas/sas_port.c2
5 files changed, 87 insertions, 87 deletions
diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c
index bdb81cda8401..161c98efade9 100644
--- a/drivers/scsi/libsas/sas_ata.c
+++ b/drivers/scsi/libsas/sas_ata.c
@@ -285,14 +285,14 @@ int sas_get_ata_info(struct domain_device *dev, struct ex_phy *phy)
285 if (phy->attached_tproto & SAS_PROTOCOL_STP) 285 if (phy->attached_tproto & SAS_PROTOCOL_STP)
286 dev->tproto = phy->attached_tproto; 286 dev->tproto = phy->attached_tproto;
287 if (phy->attached_sata_dev) 287 if (phy->attached_sata_dev)
288 dev->tproto |= SATA_DEV; 288 dev->tproto |= SAS_SATA_DEV;
289 289
290 if (phy->attached_dev_type == SATA_PENDING) 290 if (phy->attached_dev_type == SAS_SATA_PENDING)
291 dev->dev_type = SATA_PENDING; 291 dev->dev_type = SAS_SATA_PENDING;
292 else { 292 else {
293 int res; 293 int res;
294 294
295 dev->dev_type = SATA_DEV; 295 dev->dev_type = SAS_SATA_DEV;
296 res = sas_get_report_phy_sata(dev->parent, phy->phy_id, 296 res = sas_get_report_phy_sata(dev->parent, phy->phy_id,
297 &dev->sata_dev.rps_resp); 297 &dev->sata_dev.rps_resp);
298 if (res) { 298 if (res) {
@@ -314,7 +314,7 @@ static int sas_ata_clear_pending(struct domain_device *dev, struct ex_phy *phy)
314 int res; 314 int res;
315 315
316 /* we weren't pending, so successfully end the reset sequence now */ 316 /* we weren't pending, so successfully end the reset sequence now */
317 if (dev->dev_type != SATA_PENDING) 317 if (dev->dev_type != SAS_SATA_PENDING)
318 return 1; 318 return 1;
319 319
320 /* hmmm, if this succeeds do we need to repost the domain_device to the 320 /* hmmm, if this succeeds do we need to repost the domain_device to the
@@ -348,9 +348,9 @@ static int smp_ata_check_ready(struct ata_link *link)
348 return 0; 348 return 0;
349 349
350 switch (ex_phy->attached_dev_type) { 350 switch (ex_phy->attached_dev_type) {
351 case SATA_PENDING: 351 case SAS_SATA_PENDING:
352 return 0; 352 return 0;
353 case SAS_END_DEV: 353 case SAS_END_DEVICE:
354 if (ex_phy->attached_sata_dev) 354 if (ex_phy->attached_sata_dev)
355 return sas_ata_clear_pending(dev, ex_phy); 355 return sas_ata_clear_pending(dev, ex_phy);
356 default: 356 default:
@@ -631,7 +631,7 @@ static void sas_get_ata_command_set(struct domain_device *dev)
631 struct dev_to_host_fis *fis = 631 struct dev_to_host_fis *fis =
632 (struct dev_to_host_fis *) dev->frame_rcvd; 632 (struct dev_to_host_fis *) dev->frame_rcvd;
633 633
634 if (dev->dev_type == SATA_PENDING) 634 if (dev->dev_type == SAS_SATA_PENDING)
635 return; 635 return;
636 636
637 if ((fis->sector_count == 1 && /* ATA */ 637 if ((fis->sector_count == 1 && /* ATA */
@@ -797,7 +797,7 @@ int sas_discover_sata(struct domain_device *dev)
797{ 797{
798 int res; 798 int res;
799 799
800 if (dev->dev_type == SATA_PM) 800 if (dev->dev_type == SAS_SATA_PM)
801 return -ENODEV; 801 return -ENODEV;
802 802
803 sas_get_ata_command_set(dev); 803 sas_get_ata_command_set(dev);
diff --git a/drivers/scsi/libsas/sas_discover.c b/drivers/scsi/libsas/sas_discover.c
index a0c3003e0c7d..62b58d38ce2e 100644
--- a/drivers/scsi/libsas/sas_discover.c
+++ b/drivers/scsi/libsas/sas_discover.c
@@ -39,11 +39,11 @@
39void sas_init_dev(struct domain_device *dev) 39void sas_init_dev(struct domain_device *dev)
40{ 40{
41 switch (dev->dev_type) { 41 switch (dev->dev_type) {
42 case SAS_END_DEV: 42 case SAS_END_DEVICE:
43 INIT_LIST_HEAD(&dev->ssp_dev.eh_list_node); 43 INIT_LIST_HEAD(&dev->ssp_dev.eh_list_node);
44 break; 44 break;
45 case EDGE_DEV: 45 case SAS_EDGE_EXPANDER_DEVICE:
46 case FANOUT_DEV: 46 case SAS_FANOUT_EXPANDER_DEVICE:
47 INIT_LIST_HEAD(&dev->ex_dev.children); 47 INIT_LIST_HEAD(&dev->ex_dev.children);
48 mutex_init(&dev->ex_dev.cmd_mutex); 48 mutex_init(&dev->ex_dev.cmd_mutex);
49 break; 49 break;
@@ -93,9 +93,9 @@ static int sas_get_port_device(struct asd_sas_port *port)
93 if (fis->interrupt_reason == 1 && fis->lbal == 1 && 93 if (fis->interrupt_reason == 1 && fis->lbal == 1 &&
94 fis->byte_count_low==0x69 && fis->byte_count_high == 0x96 94 fis->byte_count_low==0x69 && fis->byte_count_high == 0x96
95 && (fis->device & ~0x10) == 0) 95 && (fis->device & ~0x10) == 0)
96 dev->dev_type = SATA_PM; 96 dev->dev_type = SAS_SATA_PM;
97 else 97 else
98 dev->dev_type = SATA_DEV; 98 dev->dev_type = SAS_SATA_DEV;
99 dev->tproto = SAS_PROTOCOL_SATA; 99 dev->tproto = SAS_PROTOCOL_SATA;
100 } else { 100 } else {
101 struct sas_identify_frame *id = 101 struct sas_identify_frame *id =
@@ -109,21 +109,21 @@ static int sas_get_port_device(struct asd_sas_port *port)
109 109
110 dev->port = port; 110 dev->port = port;
111 switch (dev->dev_type) { 111 switch (dev->dev_type) {
112 case SATA_DEV: 112 case SAS_SATA_DEV:
113 rc = sas_ata_init(dev); 113 rc = sas_ata_init(dev);
114 if (rc) { 114 if (rc) {
115 rphy = NULL; 115 rphy = NULL;
116 break; 116 break;
117 } 117 }
118 /* fall through */ 118 /* fall through */
119 case SAS_END_DEV: 119 case SAS_END_DEVICE:
120 rphy = sas_end_device_alloc(port->port); 120 rphy = sas_end_device_alloc(port->port);
121 break; 121 break;
122 case EDGE_DEV: 122 case SAS_EDGE_EXPANDER_DEVICE:
123 rphy = sas_expander_alloc(port->port, 123 rphy = sas_expander_alloc(port->port,
124 SAS_EDGE_EXPANDER_DEVICE); 124 SAS_EDGE_EXPANDER_DEVICE);
125 break; 125 break;
126 case FANOUT_DEV: 126 case SAS_FANOUT_EXPANDER_DEVICE:
127 rphy = sas_expander_alloc(port->port, 127 rphy = sas_expander_alloc(port->port,
128 SAS_FANOUT_EXPANDER_DEVICE); 128 SAS_FANOUT_EXPANDER_DEVICE);
129 break; 129 break;
@@ -156,7 +156,7 @@ static int sas_get_port_device(struct asd_sas_port *port)
156 dev->rphy = rphy; 156 dev->rphy = rphy;
157 get_device(&dev->rphy->dev); 157 get_device(&dev->rphy->dev);
158 158
159 if (dev_is_sata(dev) || dev->dev_type == SAS_END_DEV) 159 if (dev_is_sata(dev) || dev->dev_type == SAS_END_DEVICE)
160 list_add_tail(&dev->disco_list_node, &port->disco_list); 160 list_add_tail(&dev->disco_list_node, &port->disco_list);
161 else { 161 else {
162 spin_lock_irq(&port->dev_list_lock); 162 spin_lock_irq(&port->dev_list_lock);
@@ -315,7 +315,7 @@ void sas_free_device(struct kref *kref)
315 dev->phy = NULL; 315 dev->phy = NULL;
316 316
317 /* remove the phys and ports, everything else should be gone */ 317 /* remove the phys and ports, everything else should be gone */
318 if (dev->dev_type == EDGE_DEV || dev->dev_type == FANOUT_DEV) 318 if (dev->dev_type == SAS_EDGE_EXPANDER_DEVICE || dev->dev_type == SAS_FANOUT_EXPANDER_DEVICE)
319 kfree(dev->ex_dev.ex_phy); 319 kfree(dev->ex_dev.ex_phy);
320 320
321 if (dev_is_sata(dev) && dev->sata_dev.ap) { 321 if (dev_is_sata(dev) && dev->sata_dev.ap) {
@@ -343,7 +343,7 @@ static void sas_unregister_common_dev(struct asd_sas_port *port, struct domain_d
343 spin_unlock_irq(&port->dev_list_lock); 343 spin_unlock_irq(&port->dev_list_lock);
344 344
345 spin_lock_irq(&ha->lock); 345 spin_lock_irq(&ha->lock);
346 if (dev->dev_type == SAS_END_DEV && 346 if (dev->dev_type == SAS_END_DEVICE &&
347 !list_empty(&dev->ssp_dev.eh_list_node)) { 347 !list_empty(&dev->ssp_dev.eh_list_node)) {
348 list_del_init(&dev->ssp_dev.eh_list_node); 348 list_del_init(&dev->ssp_dev.eh_list_node);
349 ha->eh_active--; 349 ha->eh_active--;
@@ -457,15 +457,15 @@ static void sas_discover_domain(struct work_struct *work)
457 task_pid_nr(current)); 457 task_pid_nr(current));
458 458
459 switch (dev->dev_type) { 459 switch (dev->dev_type) {
460 case SAS_END_DEV: 460 case SAS_END_DEVICE:
461 error = sas_discover_end_dev(dev); 461 error = sas_discover_end_dev(dev);
462 break; 462 break;
463 case EDGE_DEV: 463 case SAS_EDGE_EXPANDER_DEVICE:
464 case FANOUT_DEV: 464 case SAS_FANOUT_EXPANDER_DEVICE:
465 error = sas_discover_root_expander(dev); 465 error = sas_discover_root_expander(dev);
466 break; 466 break;
467 case SATA_DEV: 467 case SAS_SATA_DEV:
468 case SATA_PM: 468 case SAS_SATA_PM:
469#ifdef CONFIG_SCSI_SAS_ATA 469#ifdef CONFIG_SCSI_SAS_ATA
470 error = sas_discover_sata(dev); 470 error = sas_discover_sata(dev);
471 break; 471 break;
diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c
index 55cbd0180159..74cc4a02092e 100644
--- a/drivers/scsi/libsas/sas_expander.c
+++ b/drivers/scsi/libsas/sas_expander.c
@@ -183,21 +183,21 @@ static char sas_route_char(struct domain_device *dev, struct ex_phy *phy)
183 } 183 }
184} 184}
185 185
186static enum sas_dev_type to_dev_type(struct discover_resp *dr) 186static enum sas_device_type to_dev_type(struct discover_resp *dr)
187{ 187{
188 /* This is detecting a failure to transmit initial dev to host 188 /* This is detecting a failure to transmit initial dev to host
189 * FIS as described in section J.5 of sas-2 r16 189 * FIS as described in section J.5 of sas-2 r16
190 */ 190 */
191 if (dr->attached_dev_type == NO_DEVICE && dr->attached_sata_dev && 191 if (dr->attached_dev_type == SAS_PHY_UNUSED && dr->attached_sata_dev &&
192 dr->linkrate >= SAS_LINK_RATE_1_5_GBPS) 192 dr->linkrate >= SAS_LINK_RATE_1_5_GBPS)
193 return SATA_PENDING; 193 return SAS_SATA_PENDING;
194 else 194 else
195 return dr->attached_dev_type; 195 return dr->attached_dev_type;
196} 196}
197 197
198static void sas_set_ex_phy(struct domain_device *dev, int phy_id, void *rsp) 198static void sas_set_ex_phy(struct domain_device *dev, int phy_id, void *rsp)
199{ 199{
200 enum sas_dev_type dev_type; 200 enum sas_device_type dev_type;
201 enum sas_linkrate linkrate; 201 enum sas_linkrate linkrate;
202 u8 sas_addr[SAS_ADDR_SIZE]; 202 u8 sas_addr[SAS_ADDR_SIZE];
203 struct smp_resp *resp = rsp; 203 struct smp_resp *resp = rsp;
@@ -238,7 +238,7 @@ static void sas_set_ex_phy(struct domain_device *dev, int phy_id, void *rsp)
238 /* Handle vacant phy - rest of dr data is not valid so skip it */ 238 /* Handle vacant phy - rest of dr data is not valid so skip it */
239 if (phy->phy_state == PHY_VACANT) { 239 if (phy->phy_state == PHY_VACANT) {
240 memset(phy->attached_sas_addr, 0, SAS_ADDR_SIZE); 240 memset(phy->attached_sas_addr, 0, SAS_ADDR_SIZE);
241 phy->attached_dev_type = NO_DEVICE; 241 phy->attached_dev_type = SAS_PHY_UNUSED;
242 if (!test_bit(SAS_HA_ATA_EH_ACTIVE, &ha->state)) { 242 if (!test_bit(SAS_HA_ATA_EH_ACTIVE, &ha->state)) {
243 phy->phy_id = phy_id; 243 phy->phy_id = phy_id;
244 goto skip; 244 goto skip;
@@ -259,7 +259,7 @@ static void sas_set_ex_phy(struct domain_device *dev, int phy_id, void *rsp)
259 /* help some expanders that fail to zero sas_address in the 'no 259 /* help some expanders that fail to zero sas_address in the 'no
260 * device' case 260 * device' case
261 */ 261 */
262 if (phy->attached_dev_type == NO_DEVICE || 262 if (phy->attached_dev_type == SAS_PHY_UNUSED ||
263 phy->linkrate < SAS_LINK_RATE_1_5_GBPS) 263 phy->linkrate < SAS_LINK_RATE_1_5_GBPS)
264 memset(phy->attached_sas_addr, 0, SAS_ADDR_SIZE); 264 memset(phy->attached_sas_addr, 0, SAS_ADDR_SIZE);
265 else 265 else
@@ -292,13 +292,13 @@ static void sas_set_ex_phy(struct domain_device *dev, int phy_id, void *rsp)
292 292
293 out: 293 out:
294 switch (phy->attached_dev_type) { 294 switch (phy->attached_dev_type) {
295 case SATA_PENDING: 295 case SAS_SATA_PENDING:
296 type = "stp pending"; 296 type = "stp pending";
297 break; 297 break;
298 case NO_DEVICE: 298 case SAS_PHY_UNUSED:
299 type = "no device"; 299 type = "no device";
300 break; 300 break;
301 case SAS_END_DEV: 301 case SAS_END_DEVICE:
302 if (phy->attached_iproto) { 302 if (phy->attached_iproto) {
303 if (phy->attached_tproto) 303 if (phy->attached_tproto)
304 type = "host+target"; 304 type = "host+target";
@@ -311,8 +311,8 @@ static void sas_set_ex_phy(struct domain_device *dev, int phy_id, void *rsp)
311 type = "ssp"; 311 type = "ssp";
312 } 312 }
313 break; 313 break;
314 case EDGE_DEV: 314 case SAS_EDGE_EXPANDER_DEVICE:
315 case FANOUT_DEV: 315 case SAS_FANOUT_EXPANDER_DEVICE:
316 type = "smp"; 316 type = "smp";
317 break; 317 break;
318 default: 318 default:
@@ -833,7 +833,7 @@ static struct domain_device *sas_ex_discover_end_dev(
833 } else 833 } else
834#endif 834#endif
835 if (phy->attached_tproto & SAS_PROTOCOL_SSP) { 835 if (phy->attached_tproto & SAS_PROTOCOL_SSP) {
836 child->dev_type = SAS_END_DEV; 836 child->dev_type = SAS_END_DEVICE;
837 rphy = sas_end_device_alloc(phy->port); 837 rphy = sas_end_device_alloc(phy->port);
838 /* FIXME: error handling */ 838 /* FIXME: error handling */
839 if (unlikely(!rphy)) 839 if (unlikely(!rphy))
@@ -932,11 +932,11 @@ static struct domain_device *sas_ex_discover_expander(
932 932
933 933
934 switch (phy->attached_dev_type) { 934 switch (phy->attached_dev_type) {
935 case EDGE_DEV: 935 case SAS_EDGE_EXPANDER_DEVICE:
936 rphy = sas_expander_alloc(phy->port, 936 rphy = sas_expander_alloc(phy->port,
937 SAS_EDGE_EXPANDER_DEVICE); 937 SAS_EDGE_EXPANDER_DEVICE);
938 break; 938 break;
939 case FANOUT_DEV: 939 case SAS_FANOUT_EXPANDER_DEVICE:
940 rphy = sas_expander_alloc(phy->port, 940 rphy = sas_expander_alloc(phy->port,
941 SAS_FANOUT_EXPANDER_DEVICE); 941 SAS_FANOUT_EXPANDER_DEVICE);
942 break; 942 break;
@@ -1013,7 +1013,7 @@ static int sas_ex_discover_dev(struct domain_device *dev, int phy_id)
1013 if (sas_dev_present_in_domain(dev->port, ex_phy->attached_sas_addr)) 1013 if (sas_dev_present_in_domain(dev->port, ex_phy->attached_sas_addr))
1014 sas_ex_disable_port(dev, ex_phy->attached_sas_addr); 1014 sas_ex_disable_port(dev, ex_phy->attached_sas_addr);
1015 1015
1016 if (ex_phy->attached_dev_type == NO_DEVICE) { 1016 if (ex_phy->attached_dev_type == SAS_PHY_UNUSED) {
1017 if (ex_phy->routing_attr == DIRECT_ROUTING) { 1017 if (ex_phy->routing_attr == DIRECT_ROUTING) {
1018 memset(ex_phy->attached_sas_addr, 0, SAS_ADDR_SIZE); 1018 memset(ex_phy->attached_sas_addr, 0, SAS_ADDR_SIZE);
1019 sas_configure_routing(dev, ex_phy->attached_sas_addr); 1019 sas_configure_routing(dev, ex_phy->attached_sas_addr);
@@ -1022,10 +1022,10 @@ static int sas_ex_discover_dev(struct domain_device *dev, int phy_id)
1022 } else if (ex_phy->linkrate == SAS_LINK_RATE_UNKNOWN) 1022 } else if (ex_phy->linkrate == SAS_LINK_RATE_UNKNOWN)
1023 return 0; 1023 return 0;
1024 1024
1025 if (ex_phy->attached_dev_type != SAS_END_DEV && 1025 if (ex_phy->attached_dev_type != SAS_END_DEVICE &&
1026 ex_phy->attached_dev_type != FANOUT_DEV && 1026 ex_phy->attached_dev_type != SAS_FANOUT_EXPANDER_DEVICE &&
1027 ex_phy->attached_dev_type != EDGE_DEV && 1027 ex_phy->attached_dev_type != SAS_EDGE_EXPANDER_DEVICE &&
1028 ex_phy->attached_dev_type != SATA_PENDING) { 1028 ex_phy->attached_dev_type != SAS_SATA_PENDING) {
1029 SAS_DPRINTK("unknown device type(0x%x) attached to ex %016llx " 1029 SAS_DPRINTK("unknown device type(0x%x) attached to ex %016llx "
1030 "phy 0x%x\n", ex_phy->attached_dev_type, 1030 "phy 0x%x\n", ex_phy->attached_dev_type,
1031 SAS_ADDR(dev->sas_addr), 1031 SAS_ADDR(dev->sas_addr),
@@ -1049,11 +1049,11 @@ static int sas_ex_discover_dev(struct domain_device *dev, int phy_id)
1049 } 1049 }
1050 1050
1051 switch (ex_phy->attached_dev_type) { 1051 switch (ex_phy->attached_dev_type) {
1052 case SAS_END_DEV: 1052 case SAS_END_DEVICE:
1053 case SATA_PENDING: 1053 case SAS_SATA_PENDING:
1054 child = sas_ex_discover_end_dev(dev, phy_id); 1054 child = sas_ex_discover_end_dev(dev, phy_id);
1055 break; 1055 break;
1056 case FANOUT_DEV: 1056 case SAS_FANOUT_EXPANDER_DEVICE:
1057 if (SAS_ADDR(dev->port->disc.fanout_sas_addr)) { 1057 if (SAS_ADDR(dev->port->disc.fanout_sas_addr)) {
1058 SAS_DPRINTK("second fanout expander %016llx phy 0x%x " 1058 SAS_DPRINTK("second fanout expander %016llx phy 0x%x "
1059 "attached to ex %016llx phy 0x%x\n", 1059 "attached to ex %016llx phy 0x%x\n",
@@ -1067,7 +1067,7 @@ static int sas_ex_discover_dev(struct domain_device *dev, int phy_id)
1067 memcpy(dev->port->disc.fanout_sas_addr, 1067 memcpy(dev->port->disc.fanout_sas_addr,
1068 ex_phy->attached_sas_addr, SAS_ADDR_SIZE); 1068 ex_phy->attached_sas_addr, SAS_ADDR_SIZE);
1069 /* fallthrough */ 1069 /* fallthrough */
1070 case EDGE_DEV: 1070 case SAS_EDGE_EXPANDER_DEVICE:
1071 child = sas_ex_discover_expander(dev, phy_id); 1071 child = sas_ex_discover_expander(dev, phy_id);
1072 break; 1072 break;
1073 default: 1073 default:
@@ -1111,8 +1111,8 @@ static int sas_find_sub_addr(struct domain_device *dev, u8 *sub_addr)
1111 phy->phy_state == PHY_NOT_PRESENT) 1111 phy->phy_state == PHY_NOT_PRESENT)
1112 continue; 1112 continue;
1113 1113
1114 if ((phy->attached_dev_type == EDGE_DEV || 1114 if ((phy->attached_dev_type == SAS_EDGE_EXPANDER_DEVICE ||
1115 phy->attached_dev_type == FANOUT_DEV) && 1115 phy->attached_dev_type == SAS_FANOUT_EXPANDER_DEVICE) &&
1116 phy->routing_attr == SUBTRACTIVE_ROUTING) { 1116 phy->routing_attr == SUBTRACTIVE_ROUTING) {
1117 1117
1118 memcpy(sub_addr, phy->attached_sas_addr,SAS_ADDR_SIZE); 1118 memcpy(sub_addr, phy->attached_sas_addr,SAS_ADDR_SIZE);
@@ -1130,8 +1130,8 @@ static int sas_check_level_subtractive_boundary(struct domain_device *dev)
1130 u8 sub_addr[8] = {0, }; 1130 u8 sub_addr[8] = {0, };
1131 1131
1132 list_for_each_entry(child, &ex->children, siblings) { 1132 list_for_each_entry(child, &ex->children, siblings) {
1133 if (child->dev_type != EDGE_DEV && 1133 if (child->dev_type != SAS_EDGE_EXPANDER_DEVICE &&
1134 child->dev_type != FANOUT_DEV) 1134 child->dev_type != SAS_FANOUT_EXPANDER_DEVICE)
1135 continue; 1135 continue;
1136 if (sub_addr[0] == 0) { 1136 if (sub_addr[0] == 0) {
1137 sas_find_sub_addr(child, sub_addr); 1137 sas_find_sub_addr(child, sub_addr);
@@ -1208,7 +1208,7 @@ static int sas_check_ex_subtractive_boundary(struct domain_device *dev)
1208 int i; 1208 int i;
1209 u8 *sub_sas_addr = NULL; 1209 u8 *sub_sas_addr = NULL;
1210 1210
1211 if (dev->dev_type != EDGE_DEV) 1211 if (dev->dev_type != SAS_EDGE_EXPANDER_DEVICE)
1212 return 0; 1212 return 0;
1213 1213
1214 for (i = 0; i < ex->num_phys; i++) { 1214 for (i = 0; i < ex->num_phys; i++) {
@@ -1218,8 +1218,8 @@ static int sas_check_ex_subtractive_boundary(struct domain_device *dev)
1218 phy->phy_state == PHY_NOT_PRESENT) 1218 phy->phy_state == PHY_NOT_PRESENT)
1219 continue; 1219 continue;
1220 1220
1221 if ((phy->attached_dev_type == FANOUT_DEV || 1221 if ((phy->attached_dev_type == SAS_FANOUT_EXPANDER_DEVICE ||
1222 phy->attached_dev_type == EDGE_DEV) && 1222 phy->attached_dev_type == SAS_EDGE_EXPANDER_DEVICE) &&
1223 phy->routing_attr == SUBTRACTIVE_ROUTING) { 1223 phy->routing_attr == SUBTRACTIVE_ROUTING) {
1224 1224
1225 if (!sub_sas_addr) 1225 if (!sub_sas_addr)
@@ -1245,8 +1245,8 @@ static void sas_print_parent_topology_bug(struct domain_device *child,
1245 struct ex_phy *child_phy) 1245 struct ex_phy *child_phy)
1246{ 1246{
1247 static const char *ex_type[] = { 1247 static const char *ex_type[] = {
1248 [EDGE_DEV] = "edge", 1248 [SAS_EDGE_EXPANDER_DEVICE] = "edge",
1249 [FANOUT_DEV] = "fanout", 1249 [SAS_FANOUT_EXPANDER_DEVICE] = "fanout",
1250 }; 1250 };
1251 struct domain_device *parent = child->parent; 1251 struct domain_device *parent = child->parent;
1252 1252
@@ -1321,8 +1321,8 @@ static int sas_check_parent_topology(struct domain_device *child)
1321 if (!child->parent) 1321 if (!child->parent)
1322 return 0; 1322 return 0;
1323 1323
1324 if (child->parent->dev_type != EDGE_DEV && 1324 if (child->parent->dev_type != SAS_EDGE_EXPANDER_DEVICE &&
1325 child->parent->dev_type != FANOUT_DEV) 1325 child->parent->dev_type != SAS_FANOUT_EXPANDER_DEVICE)
1326 return 0; 1326 return 0;
1327 1327
1328 parent_ex = &child->parent->ex_dev; 1328 parent_ex = &child->parent->ex_dev;
@@ -1341,8 +1341,8 @@ static int sas_check_parent_topology(struct domain_device *child)
1341 child_phy = &child_ex->ex_phy[parent_phy->attached_phy_id]; 1341 child_phy = &child_ex->ex_phy[parent_phy->attached_phy_id];
1342 1342
1343 switch (child->parent->dev_type) { 1343 switch (child->parent->dev_type) {
1344 case EDGE_DEV: 1344 case SAS_EDGE_EXPANDER_DEVICE:
1345 if (child->dev_type == FANOUT_DEV) { 1345 if (child->dev_type == SAS_FANOUT_EXPANDER_DEVICE) {
1346 if (parent_phy->routing_attr != SUBTRACTIVE_ROUTING || 1346 if (parent_phy->routing_attr != SUBTRACTIVE_ROUTING ||
1347 child_phy->routing_attr != TABLE_ROUTING) { 1347 child_phy->routing_attr != TABLE_ROUTING) {
1348 sas_print_parent_topology_bug(child, parent_phy, child_phy); 1348 sas_print_parent_topology_bug(child, parent_phy, child_phy);
@@ -1366,7 +1366,7 @@ static int sas_check_parent_topology(struct domain_device *child)
1366 } 1366 }
1367 } 1367 }
1368 break; 1368 break;
1369 case FANOUT_DEV: 1369 case SAS_FANOUT_EXPANDER_DEVICE:
1370 if (parent_phy->routing_attr != TABLE_ROUTING || 1370 if (parent_phy->routing_attr != TABLE_ROUTING ||
1371 child_phy->routing_attr != SUBTRACTIVE_ROUTING) { 1371 child_phy->routing_attr != SUBTRACTIVE_ROUTING) {
1372 sas_print_parent_topology_bug(child, parent_phy, child_phy); 1372 sas_print_parent_topology_bug(child, parent_phy, child_phy);
@@ -1619,8 +1619,8 @@ static int sas_ex_level_discovery(struct asd_sas_port *port, const int level)
1619 struct domain_device *dev; 1619 struct domain_device *dev;
1620 1620
1621 list_for_each_entry(dev, &port->dev_list, dev_list_node) { 1621 list_for_each_entry(dev, &port->dev_list, dev_list_node) {
1622 if (dev->dev_type == EDGE_DEV || 1622 if (dev->dev_type == SAS_EDGE_EXPANDER_DEVICE ||
1623 dev->dev_type == FANOUT_DEV) { 1623 dev->dev_type == SAS_FANOUT_EXPANDER_DEVICE) {
1624 struct sas_expander_device *ex = 1624 struct sas_expander_device *ex =
1625 rphy_to_expander_device(dev->rphy); 1625 rphy_to_expander_device(dev->rphy);
1626 1626
@@ -1720,7 +1720,7 @@ static int sas_get_phy_change_count(struct domain_device *dev,
1720} 1720}
1721 1721
1722static int sas_get_phy_attached_dev(struct domain_device *dev, int phy_id, 1722static int sas_get_phy_attached_dev(struct domain_device *dev, int phy_id,
1723 u8 *sas_addr, enum sas_dev_type *type) 1723 u8 *sas_addr, enum sas_device_type *type)
1724{ 1724{
1725 int res; 1725 int res;
1726 struct smp_resp *disc_resp; 1726 struct smp_resp *disc_resp;
@@ -1849,7 +1849,7 @@ static int sas_find_bcast_dev(struct domain_device *dev,
1849 SAS_DPRINTK("Expander phys DID NOT change\n"); 1849 SAS_DPRINTK("Expander phys DID NOT change\n");
1850 } 1850 }
1851 list_for_each_entry(ch, &ex->children, siblings) { 1851 list_for_each_entry(ch, &ex->children, siblings) {
1852 if (ch->dev_type == EDGE_DEV || ch->dev_type == FANOUT_DEV) { 1852 if (ch->dev_type == SAS_EDGE_EXPANDER_DEVICE || ch->dev_type == SAS_FANOUT_EXPANDER_DEVICE) {
1853 res = sas_find_bcast_dev(ch, src_dev); 1853 res = sas_find_bcast_dev(ch, src_dev);
1854 if (*src_dev) 1854 if (*src_dev)
1855 return res; 1855 return res;
@@ -1866,8 +1866,8 @@ static void sas_unregister_ex_tree(struct asd_sas_port *port, struct domain_devi
1866 1866
1867 list_for_each_entry_safe(child, n, &ex->children, siblings) { 1867 list_for_each_entry_safe(child, n, &ex->children, siblings) {
1868 set_bit(SAS_DEV_GONE, &child->state); 1868 set_bit(SAS_DEV_GONE, &child->state);
1869 if (child->dev_type == EDGE_DEV || 1869 if (child->dev_type == SAS_EDGE_EXPANDER_DEVICE ||
1870 child->dev_type == FANOUT_DEV) 1870 child->dev_type == SAS_FANOUT_EXPANDER_DEVICE)
1871 sas_unregister_ex_tree(port, child); 1871 sas_unregister_ex_tree(port, child);
1872 else 1872 else
1873 sas_unregister_dev(port, child); 1873 sas_unregister_dev(port, child);
@@ -1887,8 +1887,8 @@ static void sas_unregister_devs_sas_addr(struct domain_device *parent,
1887 if (SAS_ADDR(child->sas_addr) == 1887 if (SAS_ADDR(child->sas_addr) ==
1888 SAS_ADDR(phy->attached_sas_addr)) { 1888 SAS_ADDR(phy->attached_sas_addr)) {
1889 set_bit(SAS_DEV_GONE, &child->state); 1889 set_bit(SAS_DEV_GONE, &child->state);
1890 if (child->dev_type == EDGE_DEV || 1890 if (child->dev_type == SAS_EDGE_EXPANDER_DEVICE ||
1891 child->dev_type == FANOUT_DEV) 1891 child->dev_type == SAS_FANOUT_EXPANDER_DEVICE)
1892 sas_unregister_ex_tree(parent->port, child); 1892 sas_unregister_ex_tree(parent->port, child);
1893 else 1893 else
1894 sas_unregister_dev(parent->port, child); 1894 sas_unregister_dev(parent->port, child);
@@ -1916,8 +1916,8 @@ static int sas_discover_bfs_by_root_level(struct domain_device *root,
1916 int res = 0; 1916 int res = 0;
1917 1917
1918 list_for_each_entry(child, &ex_root->children, siblings) { 1918 list_for_each_entry(child, &ex_root->children, siblings) {
1919 if (child->dev_type == EDGE_DEV || 1919 if (child->dev_type == SAS_EDGE_EXPANDER_DEVICE ||
1920 child->dev_type == FANOUT_DEV) { 1920 child->dev_type == SAS_FANOUT_EXPANDER_DEVICE) {
1921 struct sas_expander_device *ex = 1921 struct sas_expander_device *ex =
1922 rphy_to_expander_device(child->rphy); 1922 rphy_to_expander_device(child->rphy);
1923 1923
@@ -1970,8 +1970,8 @@ static int sas_discover_new(struct domain_device *dev, int phy_id)
1970 list_for_each_entry(child, &dev->ex_dev.children, siblings) { 1970 list_for_each_entry(child, &dev->ex_dev.children, siblings) {
1971 if (SAS_ADDR(child->sas_addr) == 1971 if (SAS_ADDR(child->sas_addr) ==
1972 SAS_ADDR(ex_phy->attached_sas_addr)) { 1972 SAS_ADDR(ex_phy->attached_sas_addr)) {
1973 if (child->dev_type == EDGE_DEV || 1973 if (child->dev_type == SAS_EDGE_EXPANDER_DEVICE ||
1974 child->dev_type == FANOUT_DEV) 1974 child->dev_type == SAS_FANOUT_EXPANDER_DEVICE)
1975 res = sas_discover_bfs_by_root(child); 1975 res = sas_discover_bfs_by_root(child);
1976 break; 1976 break;
1977 } 1977 }
@@ -1979,16 +1979,16 @@ static int sas_discover_new(struct domain_device *dev, int phy_id)
1979 return res; 1979 return res;
1980} 1980}
1981 1981
1982static bool dev_type_flutter(enum sas_dev_type new, enum sas_dev_type old) 1982static bool dev_type_flutter(enum sas_device_type new, enum sas_device_type old)
1983{ 1983{
1984 if (old == new) 1984 if (old == new)
1985 return true; 1985 return true;
1986 1986
1987 /* treat device directed resets as flutter, if we went 1987 /* treat device directed resets as flutter, if we went
1988 * SAS_END_DEV to SATA_PENDING the link needs recovery 1988 * SAS_END_DEVICE to SAS_SATA_PENDING the link needs recovery
1989 */ 1989 */
1990 if ((old == SATA_PENDING && new == SAS_END_DEV) || 1990 if ((old == SAS_SATA_PENDING && new == SAS_END_DEVICE) ||
1991 (old == SAS_END_DEV && new == SATA_PENDING)) 1991 (old == SAS_END_DEVICE && new == SAS_SATA_PENDING))
1992 return true; 1992 return true;
1993 1993
1994 return false; 1994 return false;
@@ -1998,7 +1998,7 @@ static int sas_rediscover_dev(struct domain_device *dev, int phy_id, bool last)
1998{ 1998{
1999 struct expander_device *ex = &dev->ex_dev; 1999 struct expander_device *ex = &dev->ex_dev;
2000 struct ex_phy *phy = &ex->ex_phy[phy_id]; 2000 struct ex_phy *phy = &ex->ex_phy[phy_id];
2001 enum sas_dev_type type = NO_DEVICE; 2001 enum sas_device_type type = SAS_PHY_UNUSED;
2002 u8 sas_addr[8]; 2002 u8 sas_addr[8];
2003 int res; 2003 int res;
2004 2004
@@ -2032,7 +2032,7 @@ static int sas_rediscover_dev(struct domain_device *dev, int phy_id, bool last)
2032 2032
2033 sas_ex_phy_discover(dev, phy_id); 2033 sas_ex_phy_discover(dev, phy_id);
2034 2034
2035 if (ata_dev && phy->attached_dev_type == SATA_PENDING) 2035 if (ata_dev && phy->attached_dev_type == SAS_SATA_PENDING)
2036 action = ", needs recovery"; 2036 action = ", needs recovery";
2037 SAS_DPRINTK("ex %016llx phy 0x%x broadcast flutter%s\n", 2037 SAS_DPRINTK("ex %016llx phy 0x%x broadcast flutter%s\n",
2038 SAS_ADDR(dev->sas_addr), phy_id, action); 2038 SAS_ADDR(dev->sas_addr), phy_id, action);
diff --git a/drivers/scsi/libsas/sas_internal.h b/drivers/scsi/libsas/sas_internal.h
index 1de67964e5a1..7e7ba83f0a21 100644
--- a/drivers/scsi/libsas/sas_internal.h
+++ b/drivers/scsi/libsas/sas_internal.h
@@ -131,16 +131,16 @@ static inline void sas_fill_in_rphy(struct domain_device *dev,
131 rphy->identify.initiator_port_protocols = dev->iproto; 131 rphy->identify.initiator_port_protocols = dev->iproto;
132 rphy->identify.target_port_protocols = dev->tproto; 132 rphy->identify.target_port_protocols = dev->tproto;
133 switch (dev->dev_type) { 133 switch (dev->dev_type) {
134 case SATA_DEV: 134 case SAS_SATA_DEV:
135 /* FIXME: need sata device type */ 135 /* FIXME: need sata device type */
136 case SAS_END_DEV: 136 case SAS_END_DEVICE:
137 case SATA_PENDING: 137 case SAS_SATA_PENDING:
138 rphy->identify.device_type = SAS_END_DEVICE; 138 rphy->identify.device_type = SAS_END_DEVICE;
139 break; 139 break;
140 case EDGE_DEV: 140 case SAS_EDGE_EXPANDER_DEVICE:
141 rphy->identify.device_type = SAS_EDGE_EXPANDER_DEVICE; 141 rphy->identify.device_type = SAS_EDGE_EXPANDER_DEVICE;
142 break; 142 break;
143 case FANOUT_DEV: 143 case SAS_FANOUT_EXPANDER_DEVICE:
144 rphy->identify.device_type = SAS_FANOUT_EXPANDER_DEVICE; 144 rphy->identify.device_type = SAS_FANOUT_EXPANDER_DEVICE;
145 break; 145 break;
146 default: 146 default:
diff --git a/drivers/scsi/libsas/sas_port.c b/drivers/scsi/libsas/sas_port.c
index 1398b714c018..d3c5297c6c89 100644
--- a/drivers/scsi/libsas/sas_port.c
+++ b/drivers/scsi/libsas/sas_port.c
@@ -69,7 +69,7 @@ static void sas_resume_port(struct asd_sas_phy *phy)
69 continue; 69 continue;
70 } 70 }
71 71
72 if (dev->dev_type == EDGE_DEV || dev->dev_type == FANOUT_DEV) { 72 if (dev->dev_type == SAS_EDGE_EXPANDER_DEVICE || dev->dev_type == SAS_FANOUT_EXPANDER_DEVICE) {
73 dev->ex_dev.ex_change_count = -1; 73 dev->ex_dev.ex_change_count = -1;
74 for (i = 0; i < dev->ex_dev.num_phys; i++) { 74 for (i = 0; i < dev->ex_dev.num_phys; i++) {
75 struct ex_phy *phy = &dev->ex_dev.ex_phy[i]; 75 struct ex_phy *phy = &dev->ex_dev.ex_phy[i];