hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I9W022
----------------------------------
Move the hbm power off logic to ACPI. The hotplugable devices can be ejected by receiving Notify 0x3, so there is no need to call acpi_hotplug_schedule in driver.
Signed-off-by: Zhang Zekun zhangzekun11@huawei.com --- drivers/acpi/osl.c | 1 - drivers/soc/hisilicon/hisi_hbmdev.c | 26 ++++++-------------------- 2 files changed, 6 insertions(+), 21 deletions(-)
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index b11c74f229a5..0418febc5cf2 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c @@ -1188,7 +1188,6 @@ acpi_status acpi_hotplug_schedule(struct acpi_device *adev, u32 src) } return AE_OK; } -EXPORT_SYMBOL_GPL(acpi_hotplug_schedule);
bool acpi_queue_hotplug_work(struct work_struct *work) { diff --git a/drivers/soc/hisilicon/hisi_hbmdev.c b/drivers/soc/hisilicon/hisi_hbmdev.c index a9cc78bde81b..1d0364c7f4fc 100644 --- a/drivers/soc/hisilicon/hisi_hbmdev.c +++ b/drivers/soc/hisilicon/hisi_hbmdev.c @@ -264,30 +264,16 @@ static int memdev_power_on(struct acpi_device *adev) return 0; }
-static int eject_device(struct acpi_device *acpi_device, void *not_used) +static int memdev_power_off(struct acpi_device *adev) { - acpi_object_type unused; + acpi_handle handle = adev->handle; acpi_status status;
- status = acpi_get_type(acpi_device->handle, &unused); - if (ACPI_FAILURE(status) || !acpi_device->flags.ejectable) + status = acpi_evaluate_object(handle, "_OFF", NULL, NULL); + if (ACPI_FAILURE(status)) { return -ENODEV; - - get_device(&acpi_device->dev); - status = acpi_hotplug_schedule(acpi_device, ACPI_OST_EC_OSPM_EJECT); - if (ACPI_SUCCESS(status)) - return 0; - - put_device(&acpi_device->dev); - acpi_evaluate_ost(acpi_device->handle, ACPI_OST_EC_OSPM_EJECT, - ACPI_OST_SC_NON_SPECIFIC_FAILURE, NULL); - - return status == AE_NO_MEMORY ? -ENOMEM : -EAGAIN; -} - -static int memdev_power_off(struct acpi_device *adev) -{ - return acpi_dev_for_each_child(adev, eject_device, NULL); + } + return 0; }
static ssize_t state_store(struct device *dev, struct device_attribute *attr,