Skip to contentSkip to conversation

pm80xx: Fix for direct attached device.

PATCH Superseded Anand 2 participants 2 messages Nov 11, 2013 – Nov 13, 2013

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Anand

author
#0 lore raw

PATCH 1/3 pm80xx: Fix for direct attached device.

Quoted 1 line

From cf6a06ddf571464571f826109bb1e5a0667c7751 Mon Sep 17 00:00:00 2001

From: Nikith Ganigarakoppal <[email protected]>
Date: Wed, 30 Oct 2013 16:13:22 +0530
Subject: [PATCH V1 1/3] pm80xx: Fix for direct attached device.

In case of direct attached SATA device delay is not enough. It will give crash for set device state command response and wait_for_completion is the best solution for this.

Updation of module author.

Signed-off-by [email protected]
Signed-off-by [email protected]
---
 drivers/scsi/pm8001/pm8001_init.c |    1 +
 drivers/scsi/pm8001/pm8001_sas.c  |    4 +++-
 2 files changed, 4 insertions(+), 1 deletions(-)
drivers/scsi/pm8001/pm8001_init.c +1 -0
index 7b57fcd..17daaa4 100644
@@ -1170,6 +1170,7 @@ module_exit(pm8001_exit);
 MODULE_AUTHOR("Jack Wang <[email protected]>");
 MODULE_AUTHOR("Anand Kumar Santhanam <[email protected]>");
 MODULE_AUTHOR("Sangeetha Gnanasekaran <[email protected]>");
+MODULE_AUTHOR("Nikith Ganigarakoppal <[email protected]>");
 MODULE_DESCRIPTION(
 		"PMC-Sierra PM8001/8081/8088/8089/8074/8076/8077 "
 		"SAS/SATA controller driver");
drivers/scsi/pm8001/pm8001_sas.c +3 -1
index f4eb18e..f50ac44 100644
@@ -1098,15 +1098,17 @@ int pm8001_lu_reset(struct domain_device *dev, u8 *lun)
 	struct pm8001_tmf_task tmf_task;
 	struct pm8001_device *pm8001_dev = dev->lldd_dev;
 	struct pm8001_hba_info *pm8001_ha = pm8001_find_ha_by_dev(dev);
+	DECLARE_COMPLETION_ONSTACK(completion_setstate);
 	if (dev_is_sata(dev)) {
 		struct sas_phy *phy = sas_get_local_phy(dev);
 		rc = pm8001_exec_internal_task_abort(pm8001_ha, pm8001_dev ,
 			dev, 1, 0);
 		rc = sas_phy_reset(phy, 1);
 		sas_put_local_phy(phy);
+		pm8001_dev->setds_completion = &completion_setstate;
 		rc = PM8001_CHIP_DISP->set_dev_state_req(pm8001_ha,
 			pm8001_dev, 0x01);
-		msleep(2000);
+		wait_for_completion(&completion_setstate);
 	} else {
 		tmf_task.tmf = TMF_LU_RESET;
 		rc = pm8001_issue_ssp_tmf(dev, lun, &tmf_task);
Signature · 1 line
1.7.1
Reviewed-by on v1 1/3
#1 lore raw
Quoted 9 lines · Anand

From cf6a06ddf571464571f826109bb1e5a0667c7751 Mon Sep 17 00:00:00 2001
From: Nikith Ganigarakoppal <[email protected]>
Date: Wed, 30 Oct 2013 16:13:22 +0530
Subject: [PATCH V1 1/3] pm80xx: Fix for direct attached device.

In case of direct attached SATA device delay is not enough. It will give crash for set device state command response and wait_for_completion is the best solution for this.

Nice catch,

PS: the signed-off chain is not right, From author should come first here Nikith. And please do not mix fix with update module author, you can do it with another patch.

Quoted 45 lines

Updation of module author.

Signed-off-by [email protected]
Signed-off-by [email protected]
---
 drivers/scsi/pm8001/pm8001_init.c |    1 +
 drivers/scsi/pm8001/pm8001_sas.c  |    4 +++-
 2 files changed, 4 insertions(+), 1 deletions(-)
drivers/scsi/pm8001/pm8001_init.c +1 -0
index 7b57fcd..17daaa4 100644
@@ -1170,6 +1170,7 @@ module_exit(pm8001_exit);
 MODULE_AUTHOR("Jack Wang <[email protected]>");
 MODULE_AUTHOR("Anand Kumar Santhanam <[email protected]>");
 MODULE_AUTHOR("Sangeetha Gnanasekaran <[email protected]>");
+MODULE_AUTHOR("Nikith Ganigarakoppal <[email protected]>");
 MODULE_DESCRIPTION(
 		"PMC-Sierra PM8001/8081/8088/8089/8074/8076/8077 "
 		"SAS/SATA controller driver");
drivers/scsi/pm8001/pm8001_sas.c +3 -1
index f4eb18e..f50ac44 100644
@@ -1098,15 +1098,17 @@ int pm8001_lu_reset(struct domain_device *dev, u8 *lun)
 	struct pm8001_tmf_task tmf_task;
 	struct pm8001_device *pm8001_dev = dev->lldd_dev;
 	struct pm8001_hba_info *pm8001_ha = pm8001_find_ha_by_dev(dev);
+	DECLARE_COMPLETION_ONSTACK(completion_setstate);
 	if (dev_is_sata(dev)) {
 		struct sas_phy *phy = sas_get_local_phy(dev);
 		rc = pm8001_exec_internal_task_abort(pm8001_ha, pm8001_dev ,
 			dev, 1, 0);
 		rc = sas_phy_reset(phy, 1);
 		sas_put_local_phy(phy);
+		pm8001_dev->setds_completion = &completion_setstate;
 		rc = PM8001_CHIP_DISP->set_dev_state_req(pm8001_ha,
 			pm8001_dev, 0x01);
-		msleep(2000);
+		wait_for_completion(&completion_setstate);
 	} else {
 		tmf_task.tmf = TMF_LU_RESET;
 		rc = pm8001_issue_ssp_tmf(dev, lun, &tmf_task);