[PATCH v2] ACPI: scan: Use async schedule function for acpi_scan_clear_dep_fn
Yicong Yang
yang.yicong at picoheart.com
Tue Jan 27 22:21:52 PST 2026
On 1/28/26 4:56 AM, Rafael J. Wysocki wrote:
> On Mon, Jan 26, 2026 at 8:04 AM Yicong Yang <yang.yicong at picoheart.com> wrote:
>>
[...]
>> static bool acpi_scan_clear_dep_queue(struct acpi_device *adev)
>> {
>> - struct acpi_scan_clear_dep_work *cdw;
>> -
>> if (adev->dep_unmet)
>> return false;
>>
>> - cdw = kmalloc(sizeof(*cdw), GFP_KERNEL);
>> - if (!cdw)
>> - return false;
>> -
>> - cdw->adev = adev;
>> - INIT_WORK(&cdw->work, acpi_scan_clear_dep_fn);
>> /*
>> - * Since the work function may block on the lock until the entire
>> - * initial enumeration of devices is complete, put it into the unbound
>> - * workqueue.
>> + * Async schedule the deferred acpi_scan_clear_dep_fn() since:
>> + * - acpi_bus_attach() needs to hold acpi_scan_lock which cannot
>> + * be acquired under acpi_dep_list_lock (held here)
>> + * - the deferred work at boot stage is ensured to be finished
>> + * before userspace init task by the async_synchronize_full()
>> + * barrier
>> + *
>> + * Use _nocall variant since it'll return on failure instead of
>> + * run the function synchronously.
>> */
>> - queue_work(system_dfl_wq, &cdw->work);
>> + if (!async_schedule_dev_nocall(acpi_scan_clear_dep_fn, &adev->dev))
>> + return false;
>>
>> return true;
>
> What about doing
>
> return !!async_schedule_dev_nocall(acpi_scan_clear_dep_fn, &adev->dev);
>
> here?
>
sure, will update. the '!!' conversion could be dropped as
async_schedule_dev_nocall also returns boolean.
thanks.
More information about the linux-riscv
mailing list