diff options
Diffstat (limited to 'drivers/scsi/mpt2sas/mpt2sas_transport.c')
-rw-r--r-- | drivers/scsi/mpt2sas/mpt2sas_transport.c | 46 |
1 files changed, 28 insertions, 18 deletions
diff --git a/drivers/scsi/mpt2sas/mpt2sas_transport.c b/drivers/scsi/mpt2sas/mpt2sas_transport.c index 8b2a3db9ea69..fed8b163afef 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_transport.c +++ b/drivers/scsi/mpt2sas/mpt2sas_transport.c | |||
@@ -163,7 +163,7 @@ _transport_set_identify(struct MPT2SAS_ADAPTER *ioc, u16 handle, | |||
163 | return -EIO; | 163 | return -EIO; |
164 | } | 164 | } |
165 | 165 | ||
166 | memset(identify, 0, sizeof(*identify)); | 166 | memset(identify, 0, sizeof(struct sas_identify)); |
167 | device_info = le32_to_cpu(sas_device_pg0.DeviceInfo); | 167 | device_info = le32_to_cpu(sas_device_pg0.DeviceInfo); |
168 | 168 | ||
169 | /* sas_address */ | 169 | /* sas_address */ |
@@ -484,7 +484,7 @@ _transport_delete_port(struct MPT2SAS_ADAPTER *ioc, | |||
484 | 484 | ||
485 | ioc->logging_level |= MPT_DEBUG_TRANSPORT; | 485 | ioc->logging_level |= MPT_DEBUG_TRANSPORT; |
486 | if (device_type == SAS_END_DEVICE) | 486 | if (device_type == SAS_END_DEVICE) |
487 | mpt2sas_device_remove(ioc, sas_address); | 487 | mpt2sas_device_remove_by_sas_address(ioc, sas_address); |
488 | else if (device_type == SAS_EDGE_EXPANDER_DEVICE || | 488 | else if (device_type == SAS_EDGE_EXPANDER_DEVICE || |
489 | device_type == SAS_FANOUT_EXPANDER_DEVICE) | 489 | device_type == SAS_FANOUT_EXPANDER_DEVICE) |
490 | mpt2sas_expander_remove(ioc, sas_address); | 490 | mpt2sas_expander_remove(ioc, sas_address); |
@@ -792,9 +792,10 @@ mpt2sas_transport_port_remove(struct MPT2SAS_ADAPTER *ioc, u64 sas_address, | |||
792 | spin_lock_irqsave(&ioc->sas_node_lock, flags); | 792 | spin_lock_irqsave(&ioc->sas_node_lock, flags); |
793 | sas_node = _transport_sas_node_find_by_sas_address(ioc, | 793 | sas_node = _transport_sas_node_find_by_sas_address(ioc, |
794 | sas_address_parent); | 794 | sas_address_parent); |
795 | spin_unlock_irqrestore(&ioc->sas_node_lock, flags); | 795 | if (!sas_node) { |
796 | if (!sas_node) | 796 | spin_unlock_irqrestore(&ioc->sas_node_lock, flags); |
797 | return; | 797 | return; |
798 | } | ||
798 | list_for_each_entry_safe(mpt2sas_port, next, &sas_node->sas_port_list, | 799 | list_for_each_entry_safe(mpt2sas_port, next, &sas_node->sas_port_list, |
799 | port_list) { | 800 | port_list) { |
800 | if (mpt2sas_port->remote_identify.sas_address != sas_address) | 801 | if (mpt2sas_port->remote_identify.sas_address != sas_address) |
@@ -804,8 +805,10 @@ mpt2sas_transport_port_remove(struct MPT2SAS_ADAPTER *ioc, u64 sas_address, | |||
804 | goto out; | 805 | goto out; |
805 | } | 806 | } |
806 | out: | 807 | out: |
807 | if (!found) | 808 | if (!found) { |
809 | spin_unlock_irqrestore(&ioc->sas_node_lock, flags); | ||
808 | return; | 810 | return; |
811 | } | ||
809 | 812 | ||
810 | for (i = 0; i < sas_node->num_phys; i++) { | 813 | for (i = 0; i < sas_node->num_phys; i++) { |
811 | if (sas_node->phy[i].remote_identify.sas_address == sas_address) | 814 | if (sas_node->phy[i].remote_identify.sas_address == sas_address) |
@@ -813,6 +816,7 @@ mpt2sas_transport_port_remove(struct MPT2SAS_ADAPTER *ioc, u64 sas_address, | |||
813 | sizeof(struct sas_identify)); | 816 | sizeof(struct sas_identify)); |
814 | } | 817 | } |
815 | 818 | ||
819 | spin_unlock_irqrestore(&ioc->sas_node_lock, flags); | ||
816 | list_for_each_entry_safe(mpt2sas_phy, next_phy, | 820 | list_for_each_entry_safe(mpt2sas_phy, next_phy, |
817 | &mpt2sas_port->phy_list, port_siblings) { | 821 | &mpt2sas_port->phy_list, port_siblings) { |
818 | if ((ioc->logging_level & MPT_DEBUG_TRANSPORT)) | 822 | if ((ioc->logging_level & MPT_DEBUG_TRANSPORT)) |
@@ -986,12 +990,14 @@ mpt2sas_transport_update_links(struct MPT2SAS_ADAPTER *ioc, | |||
986 | 990 | ||
987 | spin_lock_irqsave(&ioc->sas_node_lock, flags); | 991 | spin_lock_irqsave(&ioc->sas_node_lock, flags); |
988 | sas_node = _transport_sas_node_find_by_sas_address(ioc, sas_address); | 992 | sas_node = _transport_sas_node_find_by_sas_address(ioc, sas_address); |
989 | spin_unlock_irqrestore(&ioc->sas_node_lock, flags); | 993 | if (!sas_node) { |
990 | if (!sas_node) | 994 | spin_unlock_irqrestore(&ioc->sas_node_lock, flags); |
991 | return; | 995 | return; |
996 | } | ||
992 | 997 | ||
993 | mpt2sas_phy = &sas_node->phy[phy_number]; | 998 | mpt2sas_phy = &sas_node->phy[phy_number]; |
994 | mpt2sas_phy->attached_handle = handle; | 999 | mpt2sas_phy->attached_handle = handle; |
1000 | spin_unlock_irqrestore(&ioc->sas_node_lock, flags); | ||
995 | if (handle && (link_rate >= MPI2_SAS_NEG_LINK_RATE_1_5)) { | 1001 | if (handle && (link_rate >= MPI2_SAS_NEG_LINK_RATE_1_5)) { |
996 | _transport_set_identify(ioc, handle, | 1002 | _transport_set_identify(ioc, handle, |
997 | &mpt2sas_phy->remote_identify); | 1003 | &mpt2sas_phy->remote_identify); |
@@ -1310,17 +1316,20 @@ _transport_get_enclosure_identifier(struct sas_rphy *rphy, u64 *identifier) | |||
1310 | struct MPT2SAS_ADAPTER *ioc = rphy_to_ioc(rphy); | 1316 | struct MPT2SAS_ADAPTER *ioc = rphy_to_ioc(rphy); |
1311 | struct _sas_device *sas_device; | 1317 | struct _sas_device *sas_device; |
1312 | unsigned long flags; | 1318 | unsigned long flags; |
1319 | int rc; | ||
1313 | 1320 | ||
1314 | spin_lock_irqsave(&ioc->sas_device_lock, flags); | 1321 | spin_lock_irqsave(&ioc->sas_device_lock, flags); |
1315 | sas_device = mpt2sas_scsih_sas_device_find_by_sas_address(ioc, | 1322 | sas_device = mpt2sas_scsih_sas_device_find_by_sas_address(ioc, |
1316 | rphy->identify.sas_address); | 1323 | rphy->identify.sas_address); |
1324 | if (sas_device) { | ||
1325 | *identifier = sas_device->enclosure_logical_id; | ||
1326 | rc = 0; | ||
1327 | } else { | ||
1328 | *identifier = 0; | ||
1329 | rc = -ENXIO; | ||
1330 | } | ||
1317 | spin_unlock_irqrestore(&ioc->sas_device_lock, flags); | 1331 | spin_unlock_irqrestore(&ioc->sas_device_lock, flags); |
1318 | 1332 | return rc; | |
1319 | if (!sas_device) | ||
1320 | return -ENXIO; | ||
1321 | |||
1322 | *identifier = sas_device->enclosure_logical_id; | ||
1323 | return 0; | ||
1324 | } | 1333 | } |
1325 | 1334 | ||
1326 | /** | 1335 | /** |
@@ -1335,16 +1344,17 @@ _transport_get_bay_identifier(struct sas_rphy *rphy) | |||
1335 | struct MPT2SAS_ADAPTER *ioc = rphy_to_ioc(rphy); | 1344 | struct MPT2SAS_ADAPTER *ioc = rphy_to_ioc(rphy); |
1336 | struct _sas_device *sas_device; | 1345 | struct _sas_device *sas_device; |
1337 | unsigned long flags; | 1346 | unsigned long flags; |
1347 | int rc; | ||
1338 | 1348 | ||
1339 | spin_lock_irqsave(&ioc->sas_device_lock, flags); | 1349 | spin_lock_irqsave(&ioc->sas_device_lock, flags); |
1340 | sas_device = mpt2sas_scsih_sas_device_find_by_sas_address(ioc, | 1350 | sas_device = mpt2sas_scsih_sas_device_find_by_sas_address(ioc, |
1341 | rphy->identify.sas_address); | 1351 | rphy->identify.sas_address); |
1352 | if (sas_device) | ||
1353 | rc = sas_device->slot; | ||
1354 | else | ||
1355 | rc = -ENXIO; | ||
1342 | spin_unlock_irqrestore(&ioc->sas_device_lock, flags); | 1356 | spin_unlock_irqrestore(&ioc->sas_device_lock, flags); |
1343 | 1357 | return rc; | |
1344 | if (!sas_device) | ||
1345 | return -ENXIO; | ||
1346 | |||
1347 | return sas_device->slot; | ||
1348 | } | 1358 | } |
1349 | 1359 | ||
1350 | /* phy control request structure */ | 1360 | /* phy control request structure */ |