Skip to content

Commit e01e229

Browse files
arndbmartinkpetersen
authored andcommitted
scsi: hisi_sas: Work around build failure in suspend function
The suspend/resume functions in this driver seem to have multiple problems, the latest one just got introduced by a bugfix: drivers/scsi/hisi_sas/hisi_sas_v3_hw.c: In function '_suspend_v3_hw': drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:5142:39: error: 'struct dev_pm_info' has no member named 'usage_count' 5142 | if (atomic_read(&device->power.usage_count)) { drivers/scsi/hisi_sas/hisi_sas_v3_hw.c: In function '_suspend_v3_hw': drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:5142:39: error: 'struct dev_pm_info' has no member named 'usage_count' 5142 | if (atomic_read(&device->power.usage_count)) { As far as I can tell, the 'usage_count' is not meant to be accessed by device drivers at all, though I don't know what the driver is supposed to do instead. Another problem is the use of the deprecated UNIVERSAL_DEV_PM_OPS(), and marking functions as __maybe_unused to avoid warnings about unused functions. This should probably be changed to using DEFINE_RUNTIME_DEV_PM_OPS(). Both changes require actually understanding what the driver needs to do, and being able to test this, so instead here is the simplest patch to make it pass the randconfig builds instead. Fixes: e368d38 ("scsi: hisi_sas: Exit suspend state when usage count is greater than 0") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Link: https://lore.kernel.org/r/20230405083611.3376739-1-arnd@kernel.org Reviewed-by: Xiang Chen <chenxiang66@hisilicon.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 91a0c0c commit e01e229

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/scsi/hisi_sas/hisi_sas_v3_hw.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5139,11 +5139,13 @@ static int _suspend_v3_hw(struct device *device)
51395139
flush_workqueue(hisi_hba->wq);
51405140
interrupt_disable_v3_hw(hisi_hba);
51415141

5142+
#ifdef CONFIG_PM
51425143
if (atomic_read(&device->power.usage_count)) {
51435144
dev_err(dev, "PM suspend: host status cannot be suspended\n");
51445145
rc = -EBUSY;
51455146
goto err_out;
51465147
}
5148+
#endif
51475149

51485150
rc = disable_host_v3_hw(hisi_hba);
51495151
if (rc) {
@@ -5162,7 +5164,9 @@ static int _suspend_v3_hw(struct device *device)
51625164

51635165
err_out_recover_host:
51645166
enable_host_v3_hw(hisi_hba);
5167+
#ifdef CONFIG_PM
51655168
err_out:
5169+
#endif
51665170
interrupt_enable_v3_hw(hisi_hba);
51675171
clear_bit(HISI_SAS_REJECT_CMD_BIT, &hisi_hba->flags);
51685172
clear_bit(HISI_SAS_RESETTING_BIT, &hisi_hba->flags);

0 commit comments

Comments
 (0)