From: Charles Chiou <ch1102chiou@gmail.com>
To: jejb@linux.vnet.ibm.com, martin.petersen@oracle.com,
linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
linus.chen@tw.promise.com, grace.chang@tw.promise.com,
victor.p@promise.com, eva.cheng@tw.promise.com,
charles.chiou@tw.promise.com, julian.calaby@gmail.com
Cc: Paul <paul.lyu@tw.promise.com>
Subject: [v3 PATCH 2/2] scsi:stex.c Add S6 support
Date: Tue, 14 Jun 2016 16:33:40 +0800 [thread overview]
Message-ID: <1465893220-10968-1-git-send-email-ch1102chiou@gmail.com> (raw)
From: Charles <charles.chiou@tw.promise.com>
1.Add reboot notifier and register it in stex_probe for all supported device.
2.For all supported device in restart flow, we get a callback from notifier and set S6flag for stex_shutdown & stex_hba_stop to send restart command to FW.
Signed-off-by: Charles <charles.chiou@tw.promise.com>
Signed-off-by: Paul <paul.lyu@tw.promise.com>
---
drivers/scsi/stex.c | 25 +++++++++++++++++++++++--
1 file changed, 23 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/stex.c b/drivers/scsi/stex.c
index cad53b5..7b29a00 100644
--- a/drivers/scsi/stex.c
+++ b/drivers/scsi/stex.c
@@ -26,6 +26,7 @@
#include <linux/module.h>
#include <linux/spinlock.h>
#include <linux/ktime.h>
+#include <linux/reboot.h>
#include <asm/io.h>
#include <asm/irq.h>
#include <asm/byteorder.h>
@@ -362,6 +363,12 @@ struct st_card_info {
u16 sts_count;
};
+int S6flag;
+static int stex_halt(struct notifier_block *nb, ulong event, void *buf);
+static struct notifier_block stex_notifier = {
+ stex_halt, NULL, 0
+};
+
static int msi;
module_param(msi, int, 0);
MODULE_PARM_DESC(msi, "Enable Message Signaled Interrupts(0=off, 1=on)");
@@ -1655,6 +1662,9 @@ static int stex_probe(struct pci_dev *pdev, const struct pci_device_id *id)
pci_set_master(pdev);
+ S6flag = 0;
+ register_reboot_notifier(&stex_notifier);
+
host = scsi_host_alloc(&driver_template, sizeof(struct st_hba));
if (!host) {
@@ -1929,15 +1939,20 @@ static void stex_remove(struct pci_dev *pdev)
scsi_host_put(hba->host);
pci_disable_device(pdev);
+
+ unregister_reboot_notifier(&stex_notifier);
}
static void stex_shutdown(struct pci_dev *pdev)
{
struct st_hba *hba = pci_get_drvdata(pdev);
- if (hba->supports_pm == 0)
+ if (hba->supports_pm == 0) {
stex_hba_stop(hba, ST_IGNORED);
- else
+ } else if (hba->supports_pm == 1 && S6flag) {
+ unregister_reboot_notifier(&stex_notifier);
+ stex_hba_stop(hba, ST_S6);
+ } else
stex_hba_stop(hba, ST_S5);
}
@@ -1974,6 +1989,12 @@ static int stex_resume(struct pci_dev *pdev)
stex_handshake(hba);
return 0;
}
+
+static int stex_halt(struct notifier_block *nb, unsigned long event, void *buf)
+{
+ S6flag = 1;
+ return NOTIFY_OK;
+}
MODULE_DEVICE_TABLE(pci, stex_pci_tbl);
static struct pci_driver stex_pci_driver = {
--
1.9.1
reply other threads:[~2016-06-14 8:33 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1465893220-10968-1-git-send-email-ch1102chiou@gmail.com \
--to=ch1102chiou@gmail.com \
--cc=charles.chiou@tw.promise.com \
--cc=eva.cheng@tw.promise.com \
--cc=grace.chang@tw.promise.com \
--cc=jejb@linux.vnet.ibm.com \
--cc=julian.calaby@gmail.com \
--cc=linus.chen@tw.promise.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=paul.lyu@tw.promise.com \
--cc=victor.p@promise.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).