Re: [PATCH 2/2] Add S6 support

2017-02-27 Thread Martin K. Petersen
> "Charles" == Charles Chiou  writes:

Charles,

Charles> Hi all, Ping?  Does this patch has any issue need to fix? Thank
Charles> you.

I'm hoping somebody will review it soon.

However, we're in the middle of the 4.11 merge window so people are
mostly focused on regressions. I expect to commence merging code for
4.12 sometime next week.

-- 
Martin K. Petersen  Oracle Linux Engineering


Re: [PATCH 2/2] Add S6 support

2017-02-24 Thread Charles Chiou
From: Charles 

Hi all, Ping?
Does this patch has any issue need to fix? Thank you.


[PATCH 2/2] Add S6 support

2017-02-16 Thread Charles Chiou
From: Charles 

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.Chiou 
Signed-off-by: Paul.Lyu 
---
 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 e177dfe..0751561 100644
--- a/drivers/scsi/stex.c
+++ b/drivers/scsi/stex.c
@@ -26,6 +26,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -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)");
@@ -1673,6 +1680,9 @@ static int stex_probe(struct pci_dev *pdev, const struct 
pci_device_id *id)
 
pci_set_master(pdev);
 
+   S6flag = 0;
+   register_reboot_notifier(_notifier);
+
host = scsi_host_alloc(_template, sizeof(struct st_hba));
 
if (!host) {
@@ -1947,15 +1957,20 @@ static void stex_remove(struct pci_dev *pdev)
scsi_host_put(hba->host);
 
pci_disable_device(pdev);
+
+   unregister_reboot_notifier(_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(_notifier);
+   stex_hba_stop(hba, ST_S6);
+   } else
stex_hba_stop(hba, ST_S5);
 }
 
@@ -1992,6 +2007,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