
From: z00652016 <zhangzekun11@huawei.com> hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/IAO4WG -------------------------------------- Switch PS* ACPI interfaces to _ON and _OFF which can simplify the code logic a lot. Signed-off-by: Zhang Zekun <zhangzekun11@huawei.com> --- drivers/soc/hisilicon/hisi_hbmcache.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/soc/hisilicon/hisi_hbmcache.c b/drivers/soc/hisilicon/hisi_hbmcache.c index c3295a7919d1..dc403aa55b68 100644 --- a/drivers/soc/hisilicon/hisi_hbmcache.c +++ b/drivers/soc/hisilicon/hisi_hbmcache.c @@ -20,21 +20,22 @@ static ssize_t state_store(struct device *d, struct device_attribute *attr, { struct acpi_device *adev = ACPI_COMPANION(d); const int type = online_type_from_str(buf); - int ret = -EINVAL; + acpi_handle handle = adev->handle; + acpi_status status = AE_OK; switch (type) { case STATE_ONLINE: - ret = acpi_device_set_power(adev, ACPI_STATE_D0); + status = acpi_evaluate_object(handle, "_ON", NULL, NULL); break; case STATE_OFFLINE: - ret = acpi_device_set_power(adev, ACPI_STATE_D3); + status = acpi_evaluate_object(handle, "_OFF", NULL, NULL); break; default: break; } - if (ret) - return ret; + if (ACPI_FAILURE(status)) + return -ENODEV; return count; } @@ -90,8 +91,8 @@ static int cache_remove(struct platform_device *pdev) } static const struct acpi_device_id cache_acpi_ids[] = { - {"HISI04A1"}, - {}, + {"HISI04A1", 0}, + {"", 0}, }; static struct platform_driver hbm_cache_driver = { -- 2.17.1