Commit effe6fe8 authored by Zhang Zekun's avatar Zhang Zekun
Browse files

hisilicon/hisi_hbmcache: Use mutex_trylock to prevent hung task

hulk inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/IB0X12



--------------------------------------------------

Use mutex_trylock() to prevent hung task when concurrent
power on/off is triggered.

Fixes: 8d7c8662 ("hisilicon/hisi_hbmcache: Add a lock to protect pcc operation region")
Signed-off-by: default avatarZhang Zekun <zhangzekun11@huawei.com>
parent c67d418d
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -24,7 +24,9 @@ static ssize_t state_store(struct device *d, struct device_attribute *attr,
	acpi_handle handle = adev->handle;
	acpi_status status = AE_OK;

	mutex_lock(&cache_lock);
	if (!mutex_trylock(&cache_lock))
		return -EBUSY;

	switch (type) {
	case STATE_ONLINE:
		status = acpi_evaluate_object(handle, "_ON", NULL, NULL);