scsi: hisi_sas: Add check for methods _PS0 and _PR0
authorXiang Chen <chenxiang66@hisilicon.com>
Fri, 2 Oct 2020 14:30:35 +0000 (22:30 +0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 7 Oct 2020 00:47:06 +0000 (20:47 -0400)
To support system suspend/resume or runtime suspend/resume, need to use the
function pci_set_power_state() to change the power state which requires at
least method _PS0 or _PR0 be filled by platform for v3 hw. So check whether
the method is supported, if not, print a warning.

A Kconfig dependency is added as there is no stub for
acpi_device_power_manageable().

Link: https://lore.kernel.org/r/1601649038-25534-5-git-send-email-john.garry@huawei.com
Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/hisi_sas/Kconfig
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c

index 13ed9073fc72fab3cdcb677924609cccc0c30056..b8148b1733f85755c576f98d272a12dc35f8ea7c 100644 (file)
@@ -15,5 +15,6 @@ config SCSI_HISI_SAS_PCI
        tristate "HiSilicon SAS on PCI bus"
        depends on SCSI_HISI_SAS
        depends on PCI
+       depends on ACPI
        help
                This driver supports HiSilicon's SAS HBA based on PCI device
index 9b0e2aac75a6701c71035471ea091de706c9ee6d..da2c42999c803921af372f431118e66f8f0bef90 100644 (file)
@@ -903,6 +903,7 @@ static int reset_hw_v3_hw(struct hisi_hba *hisi_hba)
 static int hw_init_v3_hw(struct hisi_hba *hisi_hba)
 {
        struct device *dev = hisi_hba->dev;
+       struct acpi_device *acpi_dev;
        union acpi_object *obj;
        guid_t guid;
        int rc;
@@ -933,6 +934,9 @@ static int hw_init_v3_hw(struct hisi_hba *hisi_hba)
        else
                ACPI_FREE(obj);
 
+       acpi_dev = ACPI_COMPANION(dev);
+       if (!acpi_device_power_manageable(acpi_dev))
+               dev_notice(dev, "neither _PS0 nor _PR0 is defined\n");
        return 0;
 }