linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Suganath Prabu <suganath-prabu.subramani@broadcom.com>
To: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Sathya.Prakash@broadcom.com, sreekanth.reddy@broadcom.com,
	Suganath Prabu <suganath-prabu.subramani@broadcom.com>
Subject: [PATCH v7 4/8] mpt3sas: Call sas_remove_host before removing the target devices
Date: Wed, 31 Oct 2018 18:53:35 +0530	[thread overview]
Message-ID: <1540992219-20291-5-git-send-email-suganath-prabu.subramani@broadcom.com> (raw)
In-Reply-To: <1540992219-20291-1-git-send-email-suganath-prabu.subramani@broadcom.com>

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>
---
 drivers/scsi/mpt3sas/mpt3sas_scsih.c     | 2 +-
 drivers/scsi/mpt3sas/mpt3sas_transport.c | 7 +++++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
index 4d73b5e..12f565c 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
@@ -9641,6 +9641,7 @@ static void scsih_remove(struct pci_dev *pdev)
 
 	/* release all the volumes */
 	_scsih_ir_shutdown(ioc);
+	sas_remove_host(shost);
 	list_for_each_entry_safe(raid_device, next, &ioc->raid_device_list,
 	    list) {
 		if (raid_device->starget) {
@@ -9682,7 +9683,6 @@ static void scsih_remove(struct pci_dev *pdev)
 		ioc->sas_hba.num_phys = 0;
 	}
 
-	sas_remove_host(shost);
 	mpt3sas_base_detach(ioc);
 	spin_lock(&gioc_lock);
 	list_del(&ioc->list);
diff --git a/drivers/scsi/mpt3sas/mpt3sas_transport.c b/drivers/scsi/mpt3sas/mpt3sas_transport.c
index 9685c87..60ae2d0 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);
 }
 
-- 
1.8.3.1


  parent reply	other threads:[~2018-10-31 13:24 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-31 13:23 [PATCH v7 0/8] mpt3sas: some bug fixes patches Suganath Prabu
2018-10-31 13:23 ` [PATCH v7 1/8] mpt3sas: Added new #define variable IOC_OPERATIONAL_WAIT_COUNT Suganath Prabu
2018-10-31 13:23 ` [PATCH v7 2/8] mpt3sas: Separate out mpt3sas_wait_for_ioc Suganath Prabu
2018-10-31 13:23 ` [PATCH v7 3/8] mpt3sas: Refactor mpt3sas_wait_for_ioc function Suganath Prabu
2018-10-31 13:23 ` Suganath Prabu [this message]
2018-10-31 13:23 ` [PATCH v7 5/8] mpt3sas: Fix Sync cache command failure during driver unload Suganath Prabu
2018-10-31 13:23 ` [PATCH v7 6/8] mpt3sas: Don't modify EEDPTagMode field setting on SAS3.5 HBA devices Suganath Prabu
2018-10-31 13:23 ` [PATCH v7 7/8] mpt3sas: Fix driver modifying persistent data in Manufacturing page11 Suganath Prabu
2018-10-31 13:23 ` [PATCH v7 8/8] mpt3sas: Bump driver version to 27.100.00.00 Suganath Prabu
2018-11-02 18:25 ` [PATCH v7 0/8] mpt3sas: some bug fixes patches Bjorn Helgaas
2018-11-02 18:35   ` Andy Shevchenko
2018-11-07  1:45 ` Martin K. Petersen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1540992219-20291-5-git-send-email-suganath-prabu.subramani@broadcom.com \
    --to=suganath-prabu.subramani@broadcom.com \
    --cc=Sathya.Prakash@broadcom.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=sreekanth.reddy@broadcom.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).