Commit 9c0bbeee authored by Zhang Zekun's avatar Zhang Zekun
Browse files

soc: hisilicon: hisi_hbmdev: Notify the device in the ACPI

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: default avatarZhang Zekun <zhangzekun11@huawei.com>
parent 9e1339f3
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -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)
{
+6 −20
Original line number Diff line number Diff line
@@ -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,