Skip to content

Commit 1e82e46

Browse files
Xiang Chenmartinkpetersen
authored andcommitted
scsi: libsas: Resume SAS host for phy reset or enable via sysfs
Currently if a phy reset or enable phy is issued via sysfs when controller is suspended, those operations will be ignored as SAS_HA_REGISTERED is cleared. If RPM is enabled then we may aggressively suspend automatically. In this case it may be difficult to enable or reset a phy via sysfs, so resume the host in these scenarios. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Xiang Chen <[email protected]> Signed-off-by: John Garry <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 7e15334 commit 1e82e46

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/scsi/libsas/sas_init.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,7 @@ static int queue_phy_reset(struct sas_phy *phy, int hard_reset)
531531
if (!d)
532532
return -ENOMEM;
533533

534+
pm_runtime_get_sync(ha->dev);
534535
/* libsas workqueue coordinates ata-eh reset with discovery */
535536
mutex_lock(&d->event_lock);
536537
d->reset_result = 0;
@@ -544,6 +545,7 @@ static int queue_phy_reset(struct sas_phy *phy, int hard_reset)
544545
if (rc == 0)
545546
rc = d->reset_result;
546547
mutex_unlock(&d->event_lock);
548+
pm_runtime_put_sync(ha->dev);
547549

548550
return rc;
549551
}
@@ -558,6 +560,7 @@ static int queue_phy_enable(struct sas_phy *phy, int enable)
558560
if (!d)
559561
return -ENOMEM;
560562

563+
pm_runtime_get_sync(ha->dev);
561564
/* libsas workqueue coordinates ata-eh reset with discovery */
562565
mutex_lock(&d->event_lock);
563566
d->enable_result = 0;
@@ -571,6 +574,7 @@ static int queue_phy_enable(struct sas_phy *phy, int enable)
571574
if (rc == 0)
572575
rc = d->enable_result;
573576
mutex_unlock(&d->event_lock);
577+
pm_runtime_put_sync(ha->dev);
574578

575579
return rc;
576580
}

0 commit comments

Comments
 (0)