]> git.hungrycats.org Git - linux/commit
firmware_loader: Add cancel helper for async requests
authorCássio Gabriel <cassiogabrielcontato@gmail.com>
Tue, 5 May 2026 11:18:16 +0000 (08:18 -0300)
committerTakashi Iwai <tiwai@suse.de>
Wed, 6 May 2026 14:37:48 +0000 (16:37 +0200)
commitb9bdd68b8b979c7e9de58b2e7d21e1d7d932c755
treed9939d42c24fad549851f710be0212745be4ea95
parent86dc52c5c96e91f86b6e86dfe621ccc581d72b1d
firmware_loader: Add cancel helper for async requests

request_firmware_nowait() keeps the callback module pinned and holds
a device reference until the firmware work completes.

Callers still have no way to cancel or synchronize the queued callback
before tearing down their driver-private state.

Track scheduled async firmware work in an internal list and add
request_firmware_nowait_cancel(). The helper cancels work matching the
device, callback context and callback function. It cancels work that has
not started yet and waits for an already-running callback to return. If
the request has already completed, it is a no-op.

Keep the existing request_firmware_nowait() lifetime model manual. A
devres-managed variant can be layered on top separately if needed.

Signed-off-by: Cássio Gabriel <cassiogabrielcontato@gmail.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Acked-by: Danilo Krummrich <dakr@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20260505-alsa-hda-tas2781-fw-callback-teardown-v4-1-e7c4bf930dc8@gmail.com
drivers/base/firmware_loader/main.c
include/linux/firmware.h