summaryrefslogtreecommitdiff
path: root/drivers/scsi/mpt3sas/mpt3sas_transport.c
diff options
context:
space:
mode:
authorSuganath Prabu <suganath-prabu.subramani@broadcom.com>2018-10-31 18:53:35 +0530
committerMartin K. Petersen <martin.petersen@oracle.com>2018-11-06 20:16:01 -0500
commitdc730212e8a378763cb182b889f90c8101331332 (patch)
treef14cecb37c6fd07f1e934aa90c5d216d4b3e93d7 /drivers/scsi/mpt3sas/mpt3sas_transport.c
parenta064a6470be32981470c05082d1119da320e1d7e (diff)
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: Suganath Prabu <suganath-prabu.subramani@broadcom.com> Reviewed-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/mpt3sas/mpt3sas_transport.c')
-rw-r--r--drivers/scsi/mpt3sas/mpt3sas_transport.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/scsi/mpt3sas/mpt3sas_transport.c b/drivers/scsi/mpt3sas/mpt3sas_transport.c
index 9685c8700c59..60ae2d0feb2b 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_transport.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_transport.c
@@ -806,10 +806,13 @@ mpt3sas_transport_port_remove(struct MPT3SAS_ADAPTER *ioc, u64 sas_address,
mpt3sas_port->remote_identify.sas_address,
mpt3sas_phy->phy_id);
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);
}
- sas_port_delete(mpt3sas_port->port);
+ if (!ioc->remove_host)
+ sas_port_delete(mpt3sas_port->port);
kfree(mpt3sas_port);
}