Commit dc730212 authored by Suganath Prabu's avatar Suganath Prabu Committed by Martin K. Petersen

scsi: mpt3sas: Call sas_remove_host before removing the target devices

Call sas_remove_host() before removing the target devices in the driver's
.remove() callback function(i.e. during driver unload time).  So that
driver can provide a way to allow SYNC CACHE, START STOP unit commands
etc. (which are issued from SML) to the target drives during driver unload
time.

Once sas_remove_host() is called before removing the target drives then
driver can just clean up the resources allocated for target devices and no
need to call sas_port_delete_phy(), sas_port_delete() API's as these API's
internally called from sas_remove_host().
Signed-off-by: default avatarSuganath Prabu <suganath-prabu.subramani@broadcom.com>
Reviewed-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent a064a647
...@@ -9641,6 +9641,7 @@ static void scsih_remove(struct pci_dev *pdev) ...@@ -9641,6 +9641,7 @@ static void scsih_remove(struct pci_dev *pdev)
/* release all the volumes */ /* release all the volumes */
_scsih_ir_shutdown(ioc); _scsih_ir_shutdown(ioc);
sas_remove_host(shost);
list_for_each_entry_safe(raid_device, next, &ioc->raid_device_list, list_for_each_entry_safe(raid_device, next, &ioc->raid_device_list,
list) { list) {
if (raid_device->starget) { if (raid_device->starget) {
...@@ -9682,7 +9683,6 @@ static void scsih_remove(struct pci_dev *pdev) ...@@ -9682,7 +9683,6 @@ static void scsih_remove(struct pci_dev *pdev)
ioc->sas_hba.num_phys = 0; ioc->sas_hba.num_phys = 0;
} }
sas_remove_host(shost);
mpt3sas_base_detach(ioc); mpt3sas_base_detach(ioc);
spin_lock(&gioc_lock); spin_lock(&gioc_lock);
list_del(&ioc->list); list_del(&ioc->list);
......
...@@ -806,10 +806,13 @@ mpt3sas_transport_port_remove(struct MPT3SAS_ADAPTER *ioc, u64 sas_address, ...@@ -806,10 +806,13 @@ mpt3sas_transport_port_remove(struct MPT3SAS_ADAPTER *ioc, u64 sas_address,
mpt3sas_port->remote_identify.sas_address, mpt3sas_port->remote_identify.sas_address,
mpt3sas_phy->phy_id); mpt3sas_phy->phy_id);
mpt3sas_phy->phy_belongs_to_port = 0; mpt3sas_phy->phy_belongs_to_port = 0;
sas_port_delete_phy(mpt3sas_port->port, mpt3sas_phy->phy); if (!ioc->remove_host)
sas_port_delete_phy(mpt3sas_port->port,
mpt3sas_phy->phy);
list_del(&mpt3sas_phy->port_siblings); list_del(&mpt3sas_phy->port_siblings);
} }
sas_port_delete(mpt3sas_port->port); if (!ioc->remove_host)
sas_port_delete(mpt3sas_port->port);
kfree(mpt3sas_port); kfree(mpt3sas_port);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment