kunit_remove_action(9)
π kunit_remove_action(9) β Kernel API Manual
okay bestie, welcome to the kunit girlies' corner of the kernel docs β¨ this little function is your "never mind, cancel that" button for deferred test cleanup, and honestly? iconic.
πΈ NAME
kunit_remove_action β cancel a matching deferred action. bye-bye, cleanup call π«Ά
π SYNOPSIS
void kunit_remove_action (struct kunit *test , kunit_action_t *action ,
void *ctx );
literally three things and you're done π
π¦ ARGUMENTS
testβ the test case this action is associated with. it's her test, the action belongs to her πactionβ the deferred function you want to cancel. the one you're ghosting πctxβ the context that gets passed to the deferred function to trigger it. like, the exact vibe that makes the match happen β¨
π DESCRIPTION
so the whole point: you stop an action that was deferred via kunit_add_action from executing when the test terminates. no more surprise cleanup at the end of the test β you said no, and you meant it π
β οΈ real talk though: if that function/context pair was deferred multiple times, only the most recent one gets cancelled. not all of them. just the newest one. the rest are still showing up to the party π so don't come for me when your older registrations still fire β them's the rules, fr fr.
See also: devm_remove_action for the devres equivalent β same energy, different subsystem π§
β SEE ALSO
Kernel file ./include/kunit/resource.h β yes, that's the header, go read it π
and the full resource squad, in formation:
struct kunit_resource(9)kunit_get_resource(9)kunit_put_resource(9)__kunit_add_resource(9)kunit_add_resource(9)kunit_add_named_resource(9)kunit_alloc_and_get_resource(9)kunit_alloc_resource(9)kunit_resource_name_match(9)kunit_find_resource(9)kunit_find_named_resource(9)kunit_destroy_resource(9)kunit_remove_resource(9)KUNIT_DEFINE_ACTION_WRAPPER(9)kunit_add_action(9)kunit_add_action_or_reset(9)kunit_release_action(9)
π that's the whole page, bestie β go forth and cancel your deferred actions responsibly π
sign-off era: this one lives in ./include/kunit, dated October 2026, and it's giving "kernel api manual" realness π mwah π
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms