Vsphinx.addnodesdocument)}( rawsourcechildren]( translations LanguagesNode)}(hhh](h pending_xref)}(hhh]docutils.nodesTextChinese (Simplified)}parenthsba attributes}(ids]classes]names]dupnames]backrefs] refdomainstdreftypedoc reftarget0/translations/zh_CN/dev-tools/kunit/api/resourcemodnameN classnameN refexplicitutagnamehhh ubh)}(hhh]hChinese (Traditional)}hh2sbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget0/translations/zh_TW/dev-tools/kunit/api/resourcemodnameN classnameN refexplicituh1hhh ubh)}(hhh]hItalian}hhFsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget0/translations/it_IT/dev-tools/kunit/api/resourcemodnameN classnameN refexplicituh1hhh ubh)}(hhh]hJapanese}hhZsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget0/translations/ja_JP/dev-tools/kunit/api/resourcemodnameN classnameN refexplicituh1hhh ubh)}(hhh]hKorean}hhnsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget0/translations/ko_KR/dev-tools/kunit/api/resourcemodnameN classnameN refexplicituh1hhh ubh)}(hhh]hSpanish}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget0/translations/sp_SP/dev-tools/kunit/api/resourcemodnameN classnameN refexplicituh1hhh ubeh}(h]h ]h"]h$]h&]current_languageEnglishuh1h hh _documenthsourceNlineNubhcomment)}(h SPDX-License-Identifier: GPL-2.0h]h SPDX-License-Identifier: GPL-2.0}hhsbah}(h]h ]h"]h$]h&] xml:spacepreserveuh1hhhhhhJ/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource.rsthKubhsection)}(hhh](htitle)}(h Resource APIh]h Resource API}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhKubh paragraph)}(h+This file documents the KUnit resource API.h]h+This file documents the KUnit resource API.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hMost users won't need to use this API directly, power users can use it to store state on a per-test basis, register custom cleanup actions, and more.h]hMost users won’t need to use this API directly, power users can use it to store state on a per-test basis, register custom cleanup actions, and more.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK hhhhubhindex)}(hhh]h}(h]h ]h"]h$]h&]entries](singlekunit_resource (C struct)c.kunit_resourcehNtauh1hhhhhhNhNubhdesc)}(hhh](hdesc_signature)}(hkunit_resourceh]hdesc_signature_line)}(hstruct kunit_resourceh](hdesc_sig_keyword)}(hstructh]hstruct}(hj hhhNhNubah}(h]h ]kah"]h$]h&]uh1j hjhhhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhKubhdesc_sig_space)}(h h]h }(hjhhhNhNubah}(h]h ]wah"]h$]h&]uh1jhjhhhjhKubh desc_name)}(hkunit_resourceh]h desc_sig_name)}(hjh]hkunit_resource}(hj4hhhNhNubah}(h]h ]nah"]h$]h&]uh1j2hj.ubah}(h]h ](sig-namedescnameeh"]h$]h&]hhuh1j,hjhhhjhKubeh}(h]h ]h"]h$]h&]hh add_permalinkuh1jsphinx_line_type declaratorhhhhhjhKubah}(h]hah ](sig sig-objecteh"]h$]h&] is_multiline _toc_parts) _toc_namehuh1hhjhKhhhhubh desc_content)}(hhh]h)}(h$represents a *test managed resource*h](h represents a }(hjchhhNhNubhemphasis)}(h*test managed resource*h]htest managed resource}(hjmhhhNhNubah}(h]h ]h"]h$]h&]uh1jkhjcubeh}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhKhj`hhubah}(h]h ]h"]h$]h&]uh1j^hhhhhjhKubeh}(h]h ](cstructeh"]h$]h&]domainjobjtypejdesctypejnoindex noindexentrynocontentsentryuh1hhhhhhNhNubh container)}(hX**Definition**:: struct kunit_resource { void *data; const char *name; kunit_resource_free_t free; }; **Members** ``data`` for the user to store arbitrary data. ``name`` optional name ``free`` a user supplied function to free the resource.h](h)}(h**Definition**::h](hstrong)}(h**Definition**h]h Definition}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh:}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhKhjubh literal_block)}(h`struct kunit_resource { void *data; const char *name; kunit_resource_free_t free; };h]h`struct kunit_resource { void *data; const char *name; kunit_resource_free_t free; };}hjsbah}(h]h ]h"]h$]h&]hhuh1jhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhKhjubh)}(h **Members**h]j)}(hjh]hMembers}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhK%hjubhdefinition_list)}(hhh](hdefinition_list_item)}(h/``data`` for the user to store arbitrary data. h](hterm)}(h``data``h]hliteral)}(hjh]hdata}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1jhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhKhjubh definition)}(hhh]h)}(h%for the user to store arbitrary data.h]h%for the user to store arbitrary data.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hKhj ubah}(h]h ]h"]h$]h&]uh1j hjubeh}(h]h ]h"]h$]h&]uh1jhj hKhjubj)}(h``name`` optional name h](j)}(h``name``h]j)}(hj0h]hname}(hj2hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj.ubah}(h]h ]h"]h$]h&]uh1jhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhKhj*ubj )}(hhh]h)}(h optional nameh]h optional name}(hjIhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjEhKhjFubah}(h]h ]h"]h$]h&]uh1j hj*ubeh}(h]h ]h"]h$]h&]uh1jhjEhKhjubj)}(h7``free`` a user supplied function to free the resource.h](j)}(h``free``h]j)}(hjih]hfree}(hjkhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjgubah}(h]h ]h"]h$]h&]uh1jhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhKhjcubj )}(hhh]h)}(h.a user supplied function to free the resource.h]h.a user supplied function to free the resource.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhKhjubah}(h]h ]h"]h$]h&]uh1j hjcubeh}(h]h ]h"]h$]h&]uh1jhj~hKhjubeh}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ] kernelindentah"]h$]h&]uh1jhhhhhNhNubh)}(h**Description**h]j)}(hjh]h Description}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhK hhhhubh)}(hXRRepresents a *test managed resource*, a resource which will automatically be cleaned up at the end of a test case. This cleanup is performed by the 'free' function. The struct kunit_resource itself is freed automatically with kfree() if it was allocated by KUnit (e.g., by kunit_alloc_resource()), but must be freed by the user otherwise.h](h Represents a }(hjhhhNhNubjl)}(h*test managed resource*h]htest managed resource}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jkhjubhX2, a resource which will automatically be cleaned up at the end of a test case. This cleanup is performed by the ‘free’ function. The struct kunit_resource itself is freed automatically with kfree() if it was allocated by KUnit (e.g., by kunit_alloc_resource()), but must be freed by the user otherwise.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhKhhhhubh)}(hXYResources are reference counted so if a resource is retrieved via kunit_alloc_and_get_resource() or kunit_find_resource(), we need to call kunit_put_resource() to reduce the resource reference count when finished with it. Note that kunit_alloc_resource() does not require a kunit_resource_put() because it does not retrieve the resource itself.h]hXYResources are reference counted so if a resource is retrieved via kunit_alloc_and_get_resource() or kunit_find_resource(), we need to call kunit_put_resource() to reduce the resource reference count when finished with it. Note that kunit_alloc_resource() does not require a kunit_resource_put() because it does not retrieve the resource itself.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhK$hhhhubj)}(hXstruct kunit_kmalloc_params { size_t size; gfp_t gfp; }; static int kunit_kmalloc_init(struct kunit_resource *res, void *context) { struct kunit_kmalloc_params *params = context; res->data = kmalloc(params->size, params->gfp); if (!res->data) return -ENOMEM; return 0; } static void kunit_kmalloc_free(struct kunit_resource *res) { kfree(res->data); } void *kunit_kmalloc(struct kunit *test, size_t size, gfp_t gfp) { struct kunit_kmalloc_params params; params.size = size; params.gfp = gfp; return kunit_alloc_resource(test, kunit_kmalloc_init, kunit_kmalloc_free, gfp, ¶ms); }h]hXstruct kunit_kmalloc_params { size_t size; gfp_t gfp; }; static int kunit_kmalloc_init(struct kunit_resource *res, void *context) { struct kunit_kmalloc_params *params = context; res->data = kmalloc(params->size, params->gfp); if (!res->data) return -ENOMEM; return 0; } static void kunit_kmalloc_free(struct kunit_resource *res) { kfree(res->data); } void *kunit_kmalloc(struct kunit *test, size_t size, gfp_t gfp) { struct kunit_kmalloc_params params; params.size = size; params.gfp = gfp; return kunit_alloc_resource(test, kunit_kmalloc_init, kunit_kmalloc_free, gfp, ¶ms); }}hjsbah}(h]h ]h"]h$]h&]hhforcelanguagejhighlight_args}uh1jhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhK*hhhhubh)}(hResources can also be named, with lookup/removal done on a name basis also. kunit_add_named_resource(), kunit_find_named_resource() and kunit_destroy_named_resource(). Resource names must be unique within the test instance.h]hResources can also be named, with lookup/removal done on a name basis also. kunit_add_named_resource(), kunit_find_named_resource() and kunit_destroy_named_resource(). Resource names must be unique within the test instance.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhKLhhhhubh)}(h **Example**h]j)}(hjh]hExample}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhKQhhhhubh)}(hhh]h}(h]h ]h"]h$]h&]entries](hkunit_get_resource (C function)c.kunit_get_resourcehNtauh1hhhhhhNhNubh)}(hhh](h)}(h4void kunit_get_resource (struct kunit_resource *res)h]j)}(h3void kunit_get_resource(struct kunit_resource *res)h](hdesc_sig_keyword_type)}(hvoidh]hvoid}(hjGhhhNhNubah}(h]h ]ktah"]h$]h&]uh1jEhjAhhhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhK_ubj)}(h h]h }(hjWhhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhjAhhhjVhK_ubj-)}(hkunit_get_resourceh]j3)}(hkunit_get_resourceh]hkunit_get_resource}(hjihhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hjeubah}(h]h ](jEjFeh"]h$]h&]hhuh1j,hjAhhhjVhK_ubhdesc_parameterlist)}(h(struct kunit_resource *res)h]hdesc_parameter)}(hstruct kunit_resource *resh](j )}(hj h]hstruct}(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1j hjubj)}(h h]h }(hjhhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhjubh)}(hhh]j3)}(hkunit_resourceh]hkunit_resource}(hjhhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hjubah}(h]h ]h"]h$]h&] refdomainjreftype identifier reftargetjmodnameN classnameN c:parent_keysphinx.domains.c LookupKey)}data]j ASTIdentifier)}jjksbc.kunit_get_resourceasbuh1hhjubj)}(h h]h }(hjhhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhjubhdesc_sig_punctuation)}(h*h]h*}(hjhhhNhNubah}(h]h ]pah"]h$]h&]uh1jhjubj3)}(hresh]hres}(hjhhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hjubeh}(h]h ]h"]h$]h&]noemphhhuh1jhjubah}(h]h ]h"]h$]h&]hhuh1j}hjAhhhjVhK_ubeh}(h]h ]h"]h$]h&]hhjPuh1jjQjRhj=hhhjVhK_ubah}(h]j8ah ](jVjWeh"]h$]h&]j[j\)j]huh1hhjVhK_hj:hhubj_)}(hhh]h)}(hHold resource for use. Should not need to be used by most users as we automatically get resources retrieved by kunit_find_resource*().h]hHold resource for use. Should not need to be used by most users as we automatically get resources retrieved by kunit_find_resource*().}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhK_hjhhubah}(h]h ]h"]h$]h&]uh1j^hj:hhhjVhK_ubeh}(h]h ](jfunctioneh"]h$]h&]jjjj0jj0jjjuh1hhhhhhNhNubj)}(h9**Parameters** ``struct kunit_resource *res`` resourceh](h)}(h**Parameters**h]j)}(hj:h]h Parameters}(hj<hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj8ubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhKchj4ubj)}(hhh]j)}(h'``struct kunit_resource *res`` resourceh](j)}(h``struct kunit_resource *res``h]j)}(hjYh]hstruct kunit_resource *res}(hj[hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjWubah}(h]h ]h"]h$]h&]uh1jhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhKehjSubj )}(hhh]h)}(hresourceh]hresource}(hjrhhhNhNubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhKbhjoubah}(h]h ]h"]h$]h&]uh1j hjSubeh}(h]h ]h"]h$]h&]uh1jhjnhKehjPubah}(h]h ]h"]h$]h&]uh1jhj4ubeh}(h]h ] kernelindentah"]h$]h&]uh1jhhhhhNhNubh)}(hhh]h}(h]h ]h"]h$]h&]entries](hkunit_put_resource (C function)c.kunit_put_resourcehNtauh1hhhhhhNhNubh)}(hhh](h)}(h4void kunit_put_resource (struct kunit_resource *res)h]j)}(h3void kunit_put_resource(struct kunit_resource *res)h](jF)}(hvoidh]hvoid}(hjhhhNhNubah}(h]h ]jRah"]h$]h&]uh1jEhjhhhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhK}ubj)}(h h]h }(hjhhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhjhhhjhK}ubj-)}(hkunit_put_resourceh]j3)}(hkunit_put_resourceh]hkunit_put_resource}(hjhhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hjubah}(h]h ](jEjFeh"]h$]h&]hhuh1j,hjhhhjhK}ubj~)}(h(struct kunit_resource *res)h]j)}(hstruct kunit_resource *resh](j )}(hj h]hstruct}(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1j hjubj)}(h h]h }(hjhhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhjubh)}(hhh]j3)}(hkunit_resourceh]hkunit_resource}(hjhhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj ubah}(h]h ]h"]h$]h&] refdomainjreftypej reftargetjmodnameN classnameNjj)}j]j)}jjsbc.kunit_put_resourceasbuh1hhjubj)}(h h]h }(hj.hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhjubj)}(hjh]h*}(hj<hhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjubj3)}(hresh]hres}(hjIhhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hjubeh}(h]h ]h"]h$]h&]noemphhhuh1jhjubah}(h]h ]h"]h$]h&]hhuh1j}hjhhhjhK}ubeh}(h]h ]h"]h$]h&]hhjPuh1jjQjRhjhhhjhK}ubah}(h]jah ](jVjWeh"]h$]h&]j[j\)j]huh1hhjhK}hjhhubj_)}(hhh]h)}(hXuWhen caller is done with retrieved resource, kunit_put_resource() should be called to drop reference count. The resource list maintains a reference count on resources, so if no users are utilizing a resource and it is removed from the resource list, it will be freed via the associated free function (if any). Only needs to be used if we alloc_and_get() or find() resource.h]hXuWhen caller is done with retrieved resource, kunit_put_resource() should be called to drop reference count. The resource list maintains a reference count on resources, so if no users are utilizing a resource and it is removed from the resource list, it will be freed via the associated free function (if any). Only needs to be used if we alloc_and_get() or find() resource.}(hjshhhNhNubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhK}hjphhubah}(h]h ]h"]h$]h&]uh1j^hjhhhjhK}ubeh}(h]h ](jfunctioneh"]h$]h&]jjjjjjjjjuh1hhhhhhNhNubj)}(h9**Parameters** ``struct kunit_resource *res`` resourceh](h)}(h**Parameters**h]j)}(hjh]h Parameters}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhKhjubj)}(hhh]j)}(h'``struct kunit_resource *res`` resourceh](j)}(h``struct kunit_resource *res``h]j)}(hjh]hstruct kunit_resource *res}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1jhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhKhjubj )}(hhh]h)}(hresourceh]hresource}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhKhjubah}(h]h ]h"]h$]h&]uh1j hjubeh}(h]h ]h"]h$]h&]uh1jhjhKhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ] kernelindentah"]h$]h&]uh1jhhhhhNhNubh)}(hhh]h}(h]h ]h"]h$]h&]entries](h!__kunit_add_resource (C function)c.__kunit_add_resourcehNtauh1hhhhhhNhNubh)}(hhh](h)}(hint __kunit_add_resource (struct kunit *test, kunit_resource_init_t init, kunit_resource_free_t free, struct kunit_resource *res, void *data)h]j)}(hint __kunit_add_resource(struct kunit *test, kunit_resource_init_t init, kunit_resource_free_t free, struct kunit_resource *res, void *data)h](jF)}(hinth]hint}(hjhhhNhNubah}(h]h ]jRah"]h$]h&]uh1jEhj hhhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhKubj)}(h h]h }(hjhhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj hhhjhKubj-)}(h__kunit_add_resourceh]j3)}(h__kunit_add_resourceh]h__kunit_add_resource}(hj/hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj+ubah}(h]h ](jEjFeh"]h$]h&]hhuh1j,hj hhhjhKubj~)}(ht(struct kunit *test, kunit_resource_init_t init, kunit_resource_free_t free, struct kunit_resource *res, void *data)h](j)}(hstruct kunit *testh](j )}(hj h]hstruct}(hjKhhhNhNubah}(h]h ]jah"]h$]h&]uh1j hjGubj)}(h h]h }(hjXhhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhjGubh)}(hhh]j3)}(hkunith]hkunit}(hjihhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hjfubah}(h]h ]h"]h$]h&] refdomainjreftypej reftargetjkmodnameN classnameNjj)}j]j)}jj1sbc.__kunit_add_resourceasbuh1hhjGubj)}(h h]h }(hjhhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhjGubj)}(hjh]h*}(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjGubj3)}(htesth]htest}(hjhhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hjGubeh}(h]h ]h"]h$]h&]noemphhhuh1jhjCubj)}(hkunit_resource_init_t inith](h)}(hhh]j3)}(hkunit_resource_init_th]hkunit_resource_init_t}(hjhhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hjubah}(h]h ]h"]h$]h&] refdomainjreftypej reftargetjmodnameN classnameNjj)}j]jc.__kunit_add_resourceasbuh1hhjubj)}(h h]h }(hjhhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhjubj3)}(hinith]hinit}(hjhhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hjubeh}(h]h ]h"]h$]h&]noemphhhuh1jhjCubj)}(hkunit_resource_free_t freeh](h)}(hhh]j3)}(hkunit_resource_free_th]hkunit_resource_free_t}(hjhhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hjubah}(h]h ]h"]h$]h&] refdomainjreftypej reftargetj modnameN classnameNjj)}j]jc.__kunit_add_resourceasbuh1hhjubj)}(h h]h }(hj&hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhjubj3)}(hfreeh]hfree}(hj4hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hjubeh}(h]h ]h"]h$]h&]noemphhhuh1jhjCubj)}(hstruct kunit_resource *resh](j )}(hj h]hstruct}(hjMhhhNhNubah}(h]h ]jah"]h$]h&]uh1j hjIubj)}(h h]h }(hjZhhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhjIubh)}(hhh]j3)}(hkunit_resourceh]hkunit_resource}(hjkhhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hjhubah}(h]h ]h"]h$]h&] refdomainjreftypej reftargetjmmodnameN classnameNjj)}j]jc.__kunit_add_resourceasbuh1hhjIubj)}(h h]h }(hjhhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhjIubj)}(hjh]h*}(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjIubj3)}(hresh]hres}(hjhhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hjIubeh}(h]h ]h"]h$]h&]noemphhhuh1jhjCubj)}(h void *datah](jF)}(hvoidh]hvoid}(hjhhhNhNubah}(h]h ]jRah"]h$]h&]uh1jEhjubj)}(h h]h }(hjhhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhjubj)}(hjh]h*}(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjubj3)}(hdatah]hdata}(hjhhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hjubeh}(h]h ]h"]h$]h&]noemphhhuh1jhjCubeh}(h]h ]h"]h$]h&]hhuh1j}hj hhhjhKubeh}(h]h ]h"]h$]h&]hhjPuh1jjQjRhjhhhjhKubah}(h]jah ](jVjWeh"]h$]h&]j[j\)j]huh1hhjhKhjhhubj_)}(hhh]h)}(h"Internal helper to add a resource.h]h"Internal helper to add a resource.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhKhj hhubah}(h]h ]h"]h$]h&]uh1j^hjhhhjhKubeh}(h]h ](jfunctioneh"]h$]h&]jjjj(jj(jjjuh1hhhhhhNhNubj)}(hXG**Parameters** ``struct kunit *test`` The test context object. ``kunit_resource_init_t init`` a user-supplied function to initialize the result (if needed). If none is supplied, the resource data value is simply set to **data**. If an init function is supplied, **data** is passed to it instead. ``kunit_resource_free_t free`` a user-supplied function to free the resource (if needed). ``struct kunit_resource *res`` The resource. ``void *data`` value to pass to init function or set in resource data field. **Description** res->should_kfree is not initialised.h](h)}(h**Parameters**h]j)}(hj2h]h Parameters}(hj4hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj0ubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhKhj,ubj)}(hhh](j)}(h0``struct kunit *test`` The test context object. h](j)}(h``struct kunit *test``h]j)}(hjQh]hstruct kunit *test}(hjShhhNhNubah}(h]h ]h"]h$]h&]uh1jhjOubah}(h]h ]h"]h$]h&]uh1jhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhKhjKubj )}(hhh]h)}(hThe test context object.h]hThe test context object.}(hjjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjfhKhjgubah}(h]h ]h"]h$]h&]uh1j hjKubeh}(h]h ]h"]h$]h&]uh1jhjfhKhjHubj)}(h``kunit_resource_init_t init`` a user-supplied function to initialize the result (if needed). If none is supplied, the resource data value is simply set to **data**. If an init function is supplied, **data** is passed to it instead. h](j)}(h``kunit_resource_init_t init``h]j)}(hjh]hkunit_resource_init_t init}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1jhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhKhjubj )}(hhh]h)}(ha user-supplied function to initialize the result (if needed). If none is supplied, the resource data value is simply set to **data**. If an init function is supplied, **data** is passed to it instead.h](h~a user-supplied function to initialize the result (if needed). If none is supplied, the resource data value is simply set to }(hjhhhNhNubj)}(h**data**h]hdata}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh#. If an init function is supplied, }(hjhhhNhNubj)}(h**data**h]hdata}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh is passed to it instead.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhKhjubah}(h]h ]h"]h$]h&]uh1j hjubeh}(h]h ]h"]h$]h&]uh1jhjhKhjHubj)}(hZ``kunit_resource_free_t free`` a user-supplied function to free the resource (if needed). h](j)}(h``kunit_resource_free_t free``h]j)}(hjh]hkunit_resource_free_t free}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1jhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhKhjubj )}(hhh]h)}(h:a user-supplied function to free the resource (if needed).h]h:a user-supplied function to free the resource (if needed).}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhKhjubah}(h]h ]h"]h$]h&]uh1j hjubeh}(h]h ]h"]h$]h&]uh1jhjhKhjHubj)}(h-``struct kunit_resource *res`` The resource. h](j)}(h``struct kunit_resource *res``h]j)}(hj! h]hstruct kunit_resource *res}(hj# hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]uh1jhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhKhj ubj )}(hhh]h)}(h The resource.h]h The resource.}(hj: hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj6 hKhj7 ubah}(h]h ]h"]h$]h&]uh1j hj ubeh}(h]h ]h"]h$]h&]uh1jhj6 hKhjHubj)}(hM``void *data`` value to pass to init function or set in resource data field. h](j)}(h``void *data``h]j)}(hjZ h]h void *data}(hj\ hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjX ubah}(h]h ]h"]h$]h&]uh1jhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhKhjT ubj )}(hhh]h)}(h=value to pass to init function or set in resource data field.h]h=value to pass to init function or set in resource data field.}(hjs hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjo hKhjp ubah}(h]h ]h"]h$]h&]uh1j hjT ubeh}(h]h ]h"]h$]h&]uh1jhjo hKhjHubeh}(h]h ]h"]h$]h&]uh1jhj,ubh)}(h**Description**h]j)}(hj h]h Description}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhKhj,ubh)}(h%res->should_kfree is not initialised.h]h%res->should_kfree is not initialised.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhKhj,ubeh}(h]h ] kernelindentah"]h$]h&]uh1jhhhhhNhNubh)}(hhh]h}(h]h ]h"]h$]h&]entries](hkunit_add_resource (C function)c.kunit_add_resourcehNtauh1hhhhhhNhNubh)}(hhh](h)}(hint kunit_add_resource (struct kunit *test, kunit_resource_init_t init, kunit_resource_free_t free, struct kunit_resource *res, void *data)h]j)}(hint kunit_add_resource(struct kunit *test, kunit_resource_init_t init, kunit_resource_free_t free, struct kunit_resource *res, void *data)h](jF)}(hinth]hint}(hj hhhNhNubah}(h]h ]jRah"]h$]h&]uh1jEhj hhhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhKubj)}(h h]h }(hj hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj hhhj hKubj-)}(hkunit_add_resourceh]j3)}(hkunit_add_resourceh]hkunit_add_resource}(hj hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj ubah}(h]h ](jEjFeh"]h$]h&]hhuh1j,hj hhhj hKubj~)}(ht(struct kunit *test, kunit_resource_init_t init, kunit_resource_free_t free, struct kunit_resource *res, void *data)h](j)}(hstruct kunit *testh](j )}(hj h]hstruct}(hj hhhNhNubah}(h]h ]jah"]h$]h&]uh1j hj ubj)}(h h]h }(hj$ hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj ubh)}(hhh]j3)}(hkunith]hkunit}(hj5 hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj2 ubah}(h]h ]h"]h$]h&] refdomainjreftypej reftargetj7 modnameN classnameNjj)}j]j)}jj sbc.kunit_add_resourceasbuh1hhj ubj)}(h h]h }(hjU hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj ubj)}(hjh]h*}(hjc hhhNhNubah}(h]h ]jah"]h$]h&]uh1jhj ubj3)}(htesth]htest}(hjp hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj ubeh}(h]h ]h"]h$]h&]noemphhhuh1jhj ubj)}(hkunit_resource_init_t inith](h)}(hhh]j3)}(hkunit_resource_init_th]hkunit_resource_init_t}(hj hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj ubah}(h]h ]h"]h$]h&] refdomainjreftypej reftargetj modnameN classnameNjj)}j]jQ c.kunit_add_resourceasbuh1hhj ubj)}(h h]h }(hj hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj ubj3)}(hinith]hinit}(hj hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj ubeh}(h]h ]h"]h$]h&]noemphhhuh1jhj ubj)}(hkunit_resource_free_t freeh](h)}(hhh]j3)}(hkunit_resource_free_th]hkunit_resource_free_t}(hj hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj ubah}(h]h ]h"]h$]h&] refdomainjreftypej reftargetj modnameN classnameNjj)}j]jQ c.kunit_add_resourceasbuh1hhj ubj)}(h h]h }(hj hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj ubj3)}(hfreeh]hfree}(hj hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj ubeh}(h]h ]h"]h$]h&]noemphhhuh1jhj ubj)}(hstruct kunit_resource *resh](j )}(hj h]hstruct}(hj hhhNhNubah}(h]h ]jah"]h$]h&]uh1j hj ubj)}(h h]h }(hj& hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj ubh)}(hhh]j3)}(hkunit_resourceh]hkunit_resource}(hj7 hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj4 ubah}(h]h ]h"]h$]h&] refdomainjreftypej reftargetj9 modnameN classnameNjj)}j]jQ c.kunit_add_resourceasbuh1hhj ubj)}(h h]h }(hjU hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj ubj)}(hjh]h*}(hjc hhhNhNubah}(h]h ]jah"]h$]h&]uh1jhj ubj3)}(hresh]hres}(hjp hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj ubeh}(h]h ]h"]h$]h&]noemphhhuh1jhj ubj)}(h void *datah](jF)}(hvoidh]hvoid}(hj hhhNhNubah}(h]h ]jRah"]h$]h&]uh1jEhj ubj)}(h h]h }(hj hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj ubj)}(hjh]h*}(hj hhhNhNubah}(h]h ]jah"]h$]h&]uh1jhj ubj3)}(hdatah]hdata}(hj hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj ubeh}(h]h ]h"]h$]h&]noemphhhuh1jhj ubeh}(h]h ]h"]h$]h&]hhuh1j}hj hhhj hKubeh}(h]h ]h"]h$]h&]hhjPuh1jjQjRhj hhhj hKubah}(h]j ah ](jVjWeh"]h$]h&]j[j\)j]huh1hhj hKhj hhubj_)}(hhh]h)}(hAdd a *test managed resource*.h](hAdd a }(hj hhhNhNubjl)}(h*test managed resource*h]htest managed resource}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jkhj ubh.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhKhj hhubah}(h]h ]h"]h$]h&]uh1j^hj hhhj hKubeh}(h]h ](jfunctioneh"]h$]h&]jjjj jj jjjuh1hhhhhhNhNubj)}(hX**Parameters** ``struct kunit *test`` The test context object. ``kunit_resource_init_t init`` a user-supplied function to initialize the result (if needed). If none is supplied, the resource data value is simply set to **data**. If an init function is supplied, **data** is passed to it instead. ``kunit_resource_free_t free`` a user-supplied function to free the resource (if needed). ``struct kunit_resource *res`` The resource. ``void *data`` value to pass to init function or set in resource data field.h](h)}(h**Parameters**h]j)}(hj h]h Parameters}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhKhj ubj)}(hhh](j)}(h0``struct kunit *test`` The test context object. h](j)}(h``struct kunit *test``h]j)}(hj/ h]hstruct kunit *test}(hj1 hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj- ubah}(h]h ]h"]h$]h&]uh1jhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhKhj) ubj )}(hhh]h)}(hThe test context object.h]hThe test context object.}(hjH hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjD hKhjE ubah}(h]h ]h"]h$]h&]uh1j hj) ubeh}(h]h ]h"]h$]h&]uh1jhjD hKhj& ubj)}(h``kunit_resource_init_t init`` a user-supplied function to initialize the result (if needed). If none is supplied, the resource data value is simply set to **data**. If an init function is supplied, **data** is passed to it instead. h](j)}(h``kunit_resource_init_t init``h]j)}(hjh h]hkunit_resource_init_t init}(hjj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjf ubah}(h]h ]h"]h$]h&]uh1jhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhKhjb ubj )}(hhh]h)}(ha user-supplied function to initialize the result (if needed). If none is supplied, the resource data value is simply set to **data**. If an init function is supplied, **data** is passed to it instead.h](h~a user-supplied function to initialize the result (if needed). If none is supplied, the resource data value is simply set to }(hj hhhNhNubj)}(h**data**h]hdata}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubh#. If an init function is supplied, }(hj hhhNhNubj)}(h**data**h]hdata}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubh is passed to it instead.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhKhj~ ubah}(h]h ]h"]h$]h&]uh1j hjb ubeh}(h]h ]h"]h$]h&]uh1jhj} hKhj& ubj)}(hZ``kunit_resource_free_t free`` a user-supplied function to free the resource (if needed). h](j)}(h``kunit_resource_free_t free``h]j)}(hj h]hkunit_resource_free_t free}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]uh1jhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhKhj ubj )}(hhh]h)}(h:a user-supplied function to free the resource (if needed).h]h:a user-supplied function to free the resource (if needed).}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hKhj ubah}(h]h ]h"]h$]h&]uh1j hj ubeh}(h]h ]h"]h$]h&]uh1jhj hKhj& ubj)}(h-``struct kunit_resource *res`` The resource. h](j)}(h``struct kunit_resource *res``h]j)}(hj h]hstruct kunit_resource *res}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]uh1jhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhKhj ubj )}(hhh]h)}(h The resource.h]h The resource.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hKhj ubah}(h]h ]h"]h$]h&]uh1j hj ubeh}(h]h ]h"]h$]h&]uh1jhj hKhj& ubj)}(hL``void *data`` value to pass to init function or set in resource data field.h](j)}(h``void *data``h]j)}(hj8 h]h void *data}(hj: hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj6 ubah}(h]h ]h"]h$]h&]uh1jhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhKhj2 ubj )}(hhh]h)}(h=value to pass to init function or set in resource data field.h]h=value to pass to init function or set in resource data field.}(hjQ hhhNhNubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhKhjN ubah}(h]h ]h"]h$]h&]uh1j hj2 ubeh}(h]h ]h"]h$]h&]uh1jhjM hKhj& ubeh}(h]h ]h"]h$]h&]uh1jhj ubeh}(h]h ] kernelindentah"]h$]h&]uh1jhhhhhNhNubh)}(hhh]h}(h]h ]h"]h$]h&]entries](h%kunit_add_named_resource (C function)c.kunit_add_named_resourcehNtauh1hhhhhhNhNubh)}(hhh](h)}(hint kunit_add_named_resource (struct kunit *test, kunit_resource_init_t init, kunit_resource_free_t free, struct kunit_resource *res, const char *name, void *data)h]j)}(hint kunit_add_named_resource(struct kunit *test, kunit_resource_init_t init, kunit_resource_free_t free, struct kunit_resource *res, const char *name, void *data)h](jF)}(hinth]hint}(hj hhhNhNubah}(h]h ]jRah"]h$]h&]uh1jEhj hhhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhKubj)}(h h]h }(hj hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj hhhj hKubj-)}(hkunit_add_named_resourceh]j3)}(hkunit_add_named_resourceh]hkunit_add_named_resource}(hj hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj ubah}(h]h ](jEjFeh"]h$]h&]hhuh1j,hj hhhj hKubj~)}(h(struct kunit *test, kunit_resource_init_t init, kunit_resource_free_t free, struct kunit_resource *res, const char *name, void *data)h](j)}(hstruct kunit *testh](j )}(hj h]hstruct}(hj hhhNhNubah}(h]h ]jah"]h$]h&]uh1j hj ubj)}(h h]h }(hj hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj ubh)}(hhh]j3)}(hkunith]hkunit}(hj hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj ubah}(h]h ]h"]h$]h&] refdomainjreftypej reftargetj modnameN classnameNjj)}j]j)}jj sbc.kunit_add_named_resourceasbuh1hhj ubj)}(h h]h }(hj hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj ubj)}(hjh]h*}(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhj ubj3)}(htesth]htest}(hj(hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj ubeh}(h]h ]h"]h$]h&]noemphhhuh1jhj ubj)}(hkunit_resource_init_t inith](h)}(hhh]j3)}(hkunit_resource_init_th]hkunit_resource_init_t}(hjDhhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hjAubah}(h]h ]h"]h$]h&] refdomainjreftypej reftargetjFmodnameN classnameNjj)}j]j c.kunit_add_named_resourceasbuh1hhj=ubj)}(h h]h }(hjbhhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj=ubj3)}(hinith]hinit}(hjphhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj=ubeh}(h]h ]h"]h$]h&]noemphhhuh1jhj ubj)}(hkunit_resource_free_t freeh](h)}(hhh]j3)}(hkunit_resource_free_th]hkunit_resource_free_t}(hjhhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hjubah}(h]h ]h"]h$]h&] refdomainjreftypej reftargetjmodnameN classnameNjj)}j]j c.kunit_add_named_resourceasbuh1hhjubj)}(h h]h }(hjhhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhjubj3)}(hfreeh]hfree}(hjhhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hjubeh}(h]h ]h"]h$]h&]noemphhhuh1jhj ubj)}(hstruct kunit_resource *resh](j )}(hj h]hstruct}(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1j hjubj)}(h h]h }(hjhhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhjubh)}(hhh]j3)}(hkunit_resourceh]hkunit_resource}(hjhhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hjubah}(h]h ]h"]h$]h&] refdomainjreftypej reftargetjmodnameN classnameNjj)}j]j c.kunit_add_named_resourceasbuh1hhjubj)}(h h]h }(hj hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhjubj)}(hjh]h*}(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjubj3)}(hresh]hres}(hj(hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hjubeh}(h]h ]h"]h$]h&]noemphhhuh1jhj ubj)}(hconst char *nameh](j )}(hconsth]hconst}(hjAhhhNhNubah}(h]h ]jah"]h$]h&]uh1j hj=ubj)}(h h]h }(hjOhhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj=ubjF)}(hcharh]hchar}(hj]hhhNhNubah}(h]h ]jRah"]h$]h&]uh1jEhj=ubj)}(h h]h }(hjkhhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj=ubj)}(hjh]h*}(hjyhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhj=ubj3)}(hnameh]hname}(hjhhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj=ubeh}(h]h ]h"]h$]h&]noemphhhuh1jhj ubj)}(h void *datah](jF)}(hvoidh]hvoid}(hjhhhNhNubah}(h]h ]jRah"]h$]h&]uh1jEhjubj)}(h h]h }(hjhhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhjubj)}(hjh]h*}(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjubj3)}(hdatah]hdata}(hjhhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hjubeh}(h]h ]h"]h$]h&]noemphhhuh1jhj ubeh}(h]h ]h"]h$]h&]hhuh1j}hj hhhj hKubeh}(h]h ]h"]h$]h&]hhjPuh1jjQjRhj hhhj hKubah}(h]j ah ](jVjWeh"]h$]h&]j[j\)j]huh1hhj hKhj hhubj_)}(hhh]h)}(h$Add a named *test managed resource*.h](h Add a named }(hjhhhNhNubjl)}(h*test managed resource*h]htest managed resource}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jkhjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhKhjhhubah}(h]h ]h"]h$]h&]uh1j^hj hhhj hKubeh}(h]h ](jfunctioneh"]h$]h&]jjjjjjjjjuh1hhhhhhNhNubj)}(hX**Parameters** ``struct kunit *test`` The test context object. ``kunit_resource_init_t init`` a user-supplied function to initialize the resource data, if needed. ``kunit_resource_free_t free`` a user-supplied function to free the resource data, if needed. ``struct kunit_resource *res`` The resource. ``const char *name`` name to be set for resource. ``void *data`` value to pass to init function or set in resource data field.h](h)}(h**Parameters**h]j)}(hj&h]h Parameters}(hj(hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj$ubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhKhj ubj)}(hhh](j)}(h0``struct kunit *test`` The test context object. h](j)}(h``struct kunit *test``h]j)}(hjEh]hstruct kunit *test}(hjGhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjCubah}(h]h ]h"]h$]h&]uh1jhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhKhj?ubj )}(hhh]h)}(hThe test context object.h]hThe test context object.}(hj^hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjZhKhj[ubah}(h]h ]h"]h$]h&]uh1j hj?ubeh}(h]h ]h"]h$]h&]uh1jhjZhKhj<ubj)}(hd``kunit_resource_init_t init`` a user-supplied function to initialize the resource data, if needed. h](j)}(h``kunit_resource_init_t init``h]j)}(hj~h]hkunit_resource_init_t init}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhj|ubah}(h]h ]h"]h$]h&]uh1jhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhKhjxubj )}(hhh]h)}(hDa user-supplied function to initialize the resource data, if needed.h]hDa user-supplied function to initialize the resource data, if needed.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhKhjubah}(h]h ]h"]h$]h&]uh1j hjxubeh}(h]h ]h"]h$]h&]uh1jhjhKhj<ubj)}(h^``kunit_resource_free_t free`` a user-supplied function to free the resource data, if needed. h](j)}(h``kunit_resource_free_t free``h]j)}(hjh]hkunit_resource_free_t free}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1jhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhKhjubj )}(hhh]h)}(h>a user-supplied function to free the resource data, if needed.h]h>a user-supplied function to free the resource data, if needed.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhKhjubah}(h]h ]h"]h$]h&]uh1j hjubeh}(h]h ]h"]h$]h&]uh1jhjhKhj<ubj)}(h-``struct kunit_resource *res`` The resource. h](j)}(h``struct kunit_resource *res``h]j)}(hjh]hstruct kunit_resource *res}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1jhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhKhjubj )}(hhh]h)}(h The resource.h]h The resource.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhKhjubah}(h]h ]h"]h$]h&]uh1j hjubeh}(h]h ]h"]h$]h&]uh1jhjhKhj<ubj)}(h2``const char *name`` name to be set for resource. h](j)}(h``const char *name``h]j)}(hj)h]hconst char *name}(hj+hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj'ubah}(h]h ]h"]h$]h&]uh1jhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhKhj#ubj )}(hhh]h)}(hname to be set for resource.h]hname to be set for resource.}(hjBhhhNhNubah}(h]h ]h"]h$]h&]uh1hhj>hKhj?ubah}(h]h ]h"]h$]h&]uh1j hj#ubeh}(h]h ]h"]h$]h&]uh1jhj>hKhj<ubj)}(hL``void *data`` value to pass to init function or set in resource data field.h](j)}(h``void *data``h]j)}(hjbh]h void *data}(hjdhhhNhNubah}(h]h ]h"]h$]h&]uh1jhj`ubah}(h]h ]h"]h$]h&]uh1jhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhKhj\ubj )}(hhh]h)}(h=value to pass to init function or set in resource data field.h]h=value to pass to init function or set in resource data field.}(hj{hhhNhNubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhKhjxubah}(h]h ]h"]h$]h&]uh1j hj\ubeh}(h]h ]h"]h$]h&]uh1jhjwhKhj<ubeh}(h]h ]h"]h$]h&]uh1jhj ubeh}(h]h ] kernelindentah"]h$]h&]uh1jhhhhhNhNubh)}(hhh]h}(h]h ]h"]h$]h&]entries](h)kunit_alloc_and_get_resource (C function)c.kunit_alloc_and_get_resourcehNtauh1hhhhhhNhNubh)}(hhh](h)}(hstruct kunit_resource * kunit_alloc_and_get_resource (struct kunit *test, kunit_resource_init_t init, kunit_resource_free_t free, gfp_t internal_gfp, void *context)h]j)}(hstruct kunit_resource *kunit_alloc_and_get_resource(struct kunit *test, kunit_resource_init_t init, kunit_resource_free_t free, gfp_t internal_gfp, void *context)h](j )}(hj h]hstruct}(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1j hjhhhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhKubj)}(h h]h }(hjhhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhjhhhjhKubh)}(hhh]j3)}(hkunit_resourceh]hkunit_resource}(hjhhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hjubah}(h]h ]h"]h$]h&] refdomainjreftypej reftargetjmodnameN classnameNjj)}j]j)}jkunit_alloc_and_get_resourcesbc.kunit_alloc_and_get_resourceasbuh1hhjhhhjhKubj)}(h h]h }(hjhhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhjhhhjhKubj)}(hjh]h*}(hj hhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjhhhjhKubj-)}(hkunit_alloc_and_get_resourceh]j3)}(hjh]hkunit_alloc_and_get_resource}(hjhhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hjubah}(h]h ](jEjFeh"]h$]h&]hhuh1j,hjhhhjhKubj~)}(ho(struct kunit *test, kunit_resource_init_t init, kunit_resource_free_t free, gfp_t internal_gfp, void *context)h](j)}(hstruct kunit *testh](j )}(hj h]hstruct}(hj6hhhNhNubah}(h]h ]jah"]h$]h&]uh1j hj2ubj)}(h h]h }(hjChhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj2ubh)}(hhh]j3)}(hkunith]hkunit}(hjThhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hjQubah}(h]h ]h"]h$]h&] refdomainjreftypej reftargetjVmodnameN classnameNjj)}j]jc.kunit_alloc_and_get_resourceasbuh1hhj2ubj)}(h h]h }(hjrhhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj2ubj)}(hjh]h*}(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhj2ubj3)}(htesth]htest}(hjhhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj2ubeh}(h]h ]h"]h$]h&]noemphhhuh1jhj.ubj)}(hkunit_resource_init_t inith](h)}(hhh]j3)}(hkunit_resource_init_th]hkunit_resource_init_t}(hjhhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hjubah}(h]h ]h"]h$]h&] refdomainjreftypej reftargetjmodnameN classnameNjj)}j]jc.kunit_alloc_and_get_resourceasbuh1hhjubj)}(h h]h }(hjhhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhjubj3)}(hinith]hinit}(hjhhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hjubeh}(h]h ]h"]h$]h&]noemphhhuh1jhj.ubj)}(hkunit_resource_free_t freeh](h)}(hhh]j3)}(hkunit_resource_free_th]hkunit_resource_free_t}(hjhhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hjubah}(h]h ]h"]h$]h&] refdomainjreftypej reftargetjmodnameN classnameNjj)}j]jc.kunit_alloc_and_get_resourceasbuh1hhjubj)}(h h]h }(hjhhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhjubj3)}(hfreeh]hfree}(hjhhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hjubeh}(h]h ]h"]h$]h&]noemphhhuh1jhj.ubj)}(hgfp_t internal_gfph](h)}(hhh]j3)}(hgfp_th]hgfp_t}(hj9hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj6ubah}(h]h ]h"]h$]h&] refdomainjreftypej reftargetj;modnameN classnameNjj)}j]jc.kunit_alloc_and_get_resourceasbuh1hhj2ubj)}(h h]h }(hjWhhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj2ubj3)}(h internal_gfph]h internal_gfp}(hjehhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj2ubeh}(h]h ]h"]h$]h&]noemphhhuh1jhj.ubj)}(h void *contexth](jF)}(hvoidh]hvoid}(hj~hhhNhNubah}(h]h ]jRah"]h$]h&]uh1jEhjzubj)}(h h]h }(hjhhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhjzubj)}(hjh]h*}(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjzubj3)}(hcontexth]hcontext}(hjhhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hjzubeh}(h]h ]h"]h$]h&]noemphhhuh1jhj.ubeh}(h]h ]h"]h$]h&]hhuh1j}hjhhhjhKubeh}(h]h ]h"]h$]h&]hhjPuh1jjQjRhjhhhjhKubah}(h]jah ](jVjWeh"]h$]h&]j[j\)j]huh1hhjhKhjhhubj_)}(hhh]h)}(h0Allocates and returns a *test managed resource*.h](hAllocates and returns a }(hjhhhNhNubjl)}(h*test managed resource*h]htest managed resource}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jkhjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhKhjhhubah}(h]h ]h"]h$]h&]uh1j^hjhhhjhKubeh}(h]h ](jfunctioneh"]h$]h&]jjjjjjjjjuh1hhhhhhNhNubj)}(hX**Parameters** ``struct kunit *test`` The test context object. ``kunit_resource_init_t init`` a user supplied function to initialize the resource. ``kunit_resource_free_t free`` a user supplied function to free the resource (if needed). ``gfp_t internal_gfp`` gfp to use for internal allocations, if unsure, use GFP_KERNEL ``void *context`` for the user to pass in arbitrary data to the init function. **Description** Allocates a *test managed resource*, a resource which will automatically be cleaned up at the end of a test case. See :c:type:`struct kunit_resource ` for an example. This is effectively identical to kunit_alloc_resource, but returns the struct kunit_resource pointer, not just the 'data' pointer. It therefore also increments the resource's refcount, so kunit_put_resource() should be called when you've finished with it. **Note** KUnit needs to allocate memory for a kunit_resource object. You must specify an **internal_gfp** that is compatible with the use context of your resource.h](h)}(h**Parameters**h]j)}(hjh]h Parameters}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhKhjubj)}(hhh](j)}(h0``struct kunit *test`` The test context object. h](j)}(h``struct kunit *test``h]j)}(hj$h]hstruct kunit *test}(hj&hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj"ubah}(h]h ]h"]h$]h&]uh1jhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhKhjubj )}(hhh]h)}(hThe test context object.h]hThe test context object.}(hj=hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj9hKhj:ubah}(h]h ]h"]h$]h&]uh1j hjubeh}(h]h ]h"]h$]h&]uh1jhj9hKhjubj)}(hT``kunit_resource_init_t init`` a user supplied function to initialize the resource. h](j)}(h``kunit_resource_init_t init``h]j)}(hj]h]hkunit_resource_init_t init}(hj_hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj[ubah}(h]h ]h"]h$]h&]uh1jhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhKhjWubj )}(hhh]h)}(h4a user supplied function to initialize the resource.h]h4a user supplied function to initialize the resource.}(hjvhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjrhKhjsubah}(h]h ]h"]h$]h&]uh1j hjWubeh}(h]h ]h"]h$]h&]uh1jhjrhKhjubj)}(hZ``kunit_resource_free_t free`` a user supplied function to free the resource (if needed). h](j)}(h``kunit_resource_free_t free``h]j)}(hjh]hkunit_resource_free_t free}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1jhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhKhjubj )}(hhh]h)}(h:a user supplied function to free the resource (if needed).h]h:a user supplied function to free the resource (if needed).}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhKhjubah}(h]h ]h"]h$]h&]uh1j hjubeh}(h]h ]h"]h$]h&]uh1jhjhKhjubj)}(hV``gfp_t internal_gfp`` gfp to use for internal allocations, if unsure, use GFP_KERNEL h](j)}(h``gfp_t internal_gfp``h]j)}(hjh]hgfp_t internal_gfp}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1jhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhKhjubj )}(hhh]h)}(h>gfp to use for internal allocations, if unsure, use GFP_KERNELh]h>gfp to use for internal allocations, if unsure, use GFP_KERNEL}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhKhjubah}(h]h ]h"]h$]h&]uh1j hjubeh}(h]h ]h"]h$]h&]uh1jhjhKhjubj)}(hO``void *context`` for the user to pass in arbitrary data to the init function. h](j)}(h``void *context``h]j)}(hjh]h void *context}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1jhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhKhjubj )}(hhh]h)}(h` for an example.h](h Allocates a }(hjYhhhNhNubjl)}(h*test managed resource*h]htest managed resource}(hjahhhNhNubah}(h]h ]h"]h$]h&]uh1jkhjYubhS, a resource which will automatically be cleaned up at the end of a test case. See }(hjYhhhNhNubh)}(h0:c:type:`struct kunit_resource `h]j)}(hjuh]hstruct kunit_resource}(hjwhhhNhNubah}(h]h ](xrefjc-typeeh"]h$]h&]uh1jhjsubah}(h]h ]h"]h$]h&]refdocdev-tools/kunit/api/resource refdomainjreftypetype refexplicitrefwarnjj)}j]sb reftargetkunit_resourceuh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhKhjYubh for an example.}(hjYhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhjhKhjubh)}(hThis is effectively identical to kunit_alloc_resource, but returns the struct kunit_resource pointer, not just the 'data' pointer. It therefore also increments the resource's refcount, so kunit_put_resource() should be called when you've finished with it.h]hXThis is effectively identical to kunit_alloc_resource, but returns the struct kunit_resource pointer, not just the ‘data’ pointer. It therefore also increments the resource’s refcount, so kunit_put_resource() should be called when you’ve finished with it.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhKhjubh)}(h**Note**h]j)}(hjh]hNote}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhKhjubh)}(hKUnit needs to allocate memory for a kunit_resource object. You must specify an **internal_gfp** that is compatible with the use context of your resource.h](hPKUnit needs to allocate memory for a kunit_resource object. You must specify an }(hjhhhNhNubj)}(h**internal_gfp**h]h internal_gfp}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh: that is compatible with the use context of your resource.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhKhjubeh}(h]h ] kernelindentah"]h$]h&]uh1jhhhhhNhNubh)}(hhh]h}(h]h ]h"]h$]h&]entries](h!kunit_alloc_resource (C function)c.kunit_alloc_resourcehNtauh1hhhhhhNhNubh)}(hhh](h)}(hvoid * kunit_alloc_resource (struct kunit *test, kunit_resource_init_t init, kunit_resource_free_t free, gfp_t internal_gfp, void *context)h]j)}(hvoid *kunit_alloc_resource(struct kunit *test, kunit_resource_init_t init, kunit_resource_free_t free, gfp_t internal_gfp, void *context)h](jF)}(hvoidh]hvoid}(hj hhhNhNubah}(h]h ]jRah"]h$]h&]uh1jEhjhhhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhM ubj)}(h h]h }(hjhhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhjhhhjhM ubj)}(hjh]h*}(hj(hhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjhhhjhM ubj-)}(hkunit_alloc_resourceh]j3)}(hkunit_alloc_resourceh]hkunit_alloc_resource}(hj9hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj5ubah}(h]h ](jEjFeh"]h$]h&]hhuh1j,hjhhhjhM ubj~)}(ho(struct kunit *test, kunit_resource_init_t init, kunit_resource_free_t free, gfp_t internal_gfp, void *context)h](j)}(hstruct kunit *testh](j )}(hj h]hstruct}(hjUhhhNhNubah}(h]h ]jah"]h$]h&]uh1j hjQubj)}(h h]h }(hjbhhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhjQubh)}(hhh]j3)}(hkunith]hkunit}(hjshhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hjpubah}(h]h ]h"]h$]h&] refdomainjreftypej reftargetjumodnameN classnameNjj)}j]j)}jj;sbc.kunit_alloc_resourceasbuh1hhjQubj)}(h h]h }(hjhhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhjQubj)}(hjh]h*}(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjQubj3)}(htesth]htest}(hjhhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hjQubeh}(h]h ]h"]h$]h&]noemphhhuh1jhjMubj)}(hkunit_resource_init_t inith](h)}(hhh]j3)}(hkunit_resource_init_th]hkunit_resource_init_t}(hjhhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hjubah}(h]h ]h"]h$]h&] refdomainjreftypej reftargetjmodnameN classnameNjj)}j]jc.kunit_alloc_resourceasbuh1hhjubj)}(h h]h }(hjhhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhjubj3)}(hinith]hinit}(hjhhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hjubeh}(h]h ]h"]h$]h&]noemphhhuh1jhjMubj)}(hkunit_resource_free_t freeh](h)}(hhh]j3)}(hkunit_resource_free_th]hkunit_resource_free_t}(hjhhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hjubah}(h]h ]h"]h$]h&] refdomainjreftypej reftargetjmodnameN classnameNjj)}j]jc.kunit_alloc_resourceasbuh1hhj ubj)}(h h]h }(hj0hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj ubj3)}(hfreeh]hfree}(hj>hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj ubeh}(h]h ]h"]h$]h&]noemphhhuh1jhjMubj)}(hgfp_t internal_gfph](h)}(hhh]j3)}(hgfp_th]hgfp_t}(hjZhhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hjWubah}(h]h ]h"]h$]h&] refdomainjreftypej reftargetj\modnameN classnameNjj)}j]jc.kunit_alloc_resourceasbuh1hhjSubj)}(h h]h }(hjxhhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhjSubj3)}(h internal_gfph]h internal_gfp}(hjhhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hjSubeh}(h]h ]h"]h$]h&]noemphhhuh1jhjMubj)}(h void *contexth](jF)}(hvoidh]hvoid}(hjhhhNhNubah}(h]h ]jRah"]h$]h&]uh1jEhjubj)}(h h]h }(hjhhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhjubj)}(hjh]h*}(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjubj3)}(hcontexth]hcontext}(hjhhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hjubeh}(h]h ]h"]h$]h&]noemphhhuh1jhjMubeh}(h]h ]h"]h$]h&]hhuh1j}hjhhhjhM ubeh}(h]h ]h"]h$]h&]hhjPuh1jjQjRhjhhhjhM ubah}(h]jah ](jVjWeh"]h$]h&]j[j\)j]huh1hhjhM hjhhubj_)}(hhh]h)}(h$Allocates a *test managed resource*.h](h Allocates a }(hjhhhNhNubjl)}(h*test managed resource*h]htest managed resource}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jkhjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhM hjhhubah}(h]h ]h"]h$]h&]uh1j^hjhhhjhM ubeh}(h]h ](jfunctioneh"]h$]h&]jjjjjjjjjuh1hhhhhhNhNubj)}(hX**Parameters** ``struct kunit *test`` The test context object. ``kunit_resource_init_t init`` a user supplied function to initialize the resource. ``kunit_resource_free_t free`` a user supplied function to free the resource (if needed). ``gfp_t internal_gfp`` gfp to use for internal allocations, if unsure, use GFP_KERNEL ``void *context`` for the user to pass in arbitrary data to the init function. **Description** Allocates a *test managed resource*, a resource which will automatically be cleaned up at the end of a test case. See :c:type:`struct kunit_resource ` for an example. **Note** KUnit needs to allocate memory for a kunit_resource object. You must specify an **internal_gfp** that is compatible with the use context of your resource.h](h)}(h**Parameters**h]j)}(hj&h]h Parameters}(hj(hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj$ubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhM hj ubj)}(hhh](j)}(h0``struct kunit *test`` The test context object. h](j)}(h``struct kunit *test``h]j)}(hjEh]hstruct kunit *test}(hjGhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjCubah}(h]h ]h"]h$]h&]uh1jhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhM hj?ubj )}(hhh]h)}(hThe test context object.h]hThe test context object.}(hj^hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjZhM hj[ubah}(h]h ]h"]h$]h&]uh1j hj?ubeh}(h]h ]h"]h$]h&]uh1jhjZhM hj<ubj)}(hT``kunit_resource_init_t init`` a user supplied function to initialize the resource. h](j)}(h``kunit_resource_init_t init``h]j)}(hj~h]hkunit_resource_init_t init}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhj|ubah}(h]h ]h"]h$]h&]uh1jhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhM hjxubj )}(hhh]h)}(h4a user supplied function to initialize the resource.h]h4a user supplied function to initialize the resource.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhM hjubah}(h]h ]h"]h$]h&]uh1j hjxubeh}(h]h ]h"]h$]h&]uh1jhjhM hj<ubj)}(hZ``kunit_resource_free_t free`` a user supplied function to free the resource (if needed). h](j)}(h``kunit_resource_free_t free``h]j)}(hjh]hkunit_resource_free_t free}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1jhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhM hjubj )}(hhh]h)}(h:a user supplied function to free the resource (if needed).h]h:a user supplied function to free the resource (if needed).}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhM hjubah}(h]h ]h"]h$]h&]uh1j hjubeh}(h]h ]h"]h$]h&]uh1jhjhM hj<ubj)}(hV``gfp_t internal_gfp`` gfp to use for internal allocations, if unsure, use GFP_KERNEL h](j)}(h``gfp_t internal_gfp``h]j)}(hjh]hgfp_t internal_gfp}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1jhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhM hjubj )}(hhh]h)}(h>gfp to use for internal allocations, if unsure, use GFP_KERNELh]h>gfp to use for internal allocations, if unsure, use GFP_KERNEL}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhM hjubah}(h]h ]h"]h$]h&]uh1j hjubeh}(h]h ]h"]h$]h&]uh1jhjhM hj<ubj)}(hO``void *context`` for the user to pass in arbitrary data to the init function. h](j)}(h``void *context``h]j)}(hj)h]h void *context}(hj+hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj'ubah}(h]h ]h"]h$]h&]uh1jhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMhj#ubj )}(hhh]h)}(hhMhj?ubah}(h]h ]h"]h$]h&]uh1j hj#ubeh}(h]h ]h"]h$]h&]uh1jhj>hMhj<ubeh}(h]h ]h"]h$]h&]uh1jhj ubh)}(h**Description**h]j)}(hjdh]h Description}(hjfhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjbubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMhj ubh)}(hAllocates a *test managed resource*, a resource which will automatically be cleaned up at the end of a test case. See :c:type:`struct kunit_resource ` for an example.h](h Allocates a }(hjzhhhNhNubjl)}(h*test managed resource*h]htest managed resource}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jkhjzubhS, a resource which will automatically be cleaned up at the end of a test case. See }(hjzhhhNhNubh)}(h0:c:type:`struct kunit_resource `h]j)}(hjh]hstruct kunit_resource}(hjhhhNhNubah}(h]h ](jjc-typeeh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypetype refexplicitrefwarnjjjkunit_resourceuh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMhjzubh for an example.}(hjzhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhjhMhj ubh)}(h**Note**h]j)}(hjh]hNote}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMhj ubh)}(hKUnit needs to allocate memory for a kunit_resource object. You must specify an **internal_gfp** that is compatible with the use context of your resource.h](hPKUnit needs to allocate memory for a kunit_resource object. You must specify an }(hjhhhNhNubj)}(h**internal_gfp**h]h internal_gfp}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh: that is compatible with the use context of your resource.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMhj ubeh}(h]h ] kernelindentah"]h$]h&]uh1jhhhhhNhNubh)}(hhh]h}(h]h ]h"]h$]h&]entries](h&kunit_resource_name_match (C function)c.kunit_resource_name_matchhNtauh1hhhhhhNhNubh)}(hhh](h)}(habool kunit_resource_name_match (struct kunit *test, struct kunit_resource *res, void *match_name)h]j)}(h`bool kunit_resource_name_match(struct kunit *test, struct kunit_resource *res, void *match_name)h](jF)}(hboolh]hbool}(hjhhhNhNubah}(h]h ]jRah"]h$]h&]uh1jEhjhhhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhM0ubj)}(h h]h }(hj&hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhjhhhj%hM0ubj-)}(hkunit_resource_name_matchh]j3)}(hkunit_resource_name_matchh]hkunit_resource_name_match}(hj8hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj4ubah}(h]h ](jEjFeh"]h$]h&]hhuh1j,hjhhhj%hM0ubj~)}(hB(struct kunit *test, struct kunit_resource *res, void *match_name)h](j)}(hstruct kunit *testh](j )}(hj h]hstruct}(hjThhhNhNubah}(h]h ]jah"]h$]h&]uh1j hjPubj)}(h h]h }(hjahhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhjPubh)}(hhh]j3)}(hkunith]hkunit}(hjrhhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hjoubah}(h]h ]h"]h$]h&] refdomainjreftypej reftargetjtmodnameN classnameNjj)}j]j)}jj:sbc.kunit_resource_name_matchasbuh1hhjPubj)}(h h]h }(hjhhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhjPubj)}(hjh]h*}(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjPubj3)}(htesth]htest}(hjhhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hjPubeh}(h]h ]h"]h$]h&]noemphhhuh1jhjLubj)}(hstruct kunit_resource *resh](j )}(hj h]hstruct}(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1j hjubj)}(h h]h }(hjhhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhjubh)}(hhh]j3)}(hkunit_resourceh]hkunit_resource}(hjhhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hjubah}(h]h ]h"]h$]h&] refdomainjreftypej reftargetjmodnameN classnameNjj)}j]jc.kunit_resource_name_matchasbuh1hhjubj)}(h h]h }(hjhhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhjubj)}(hjh]h*}(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjubj3)}(hresh]hres}(hjhhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hjubeh}(h]h ]h"]h$]h&]noemphhhuh1jhjLubj)}(hvoid *match_nameh](jF)}(hvoidh]hvoid}(hj6hhhNhNubah}(h]h ]jRah"]h$]h&]uh1jEhj2ubj)}(h h]h }(hjDhhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj2ubj)}(hjh]h*}(hjRhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhj2ubj3)}(h match_nameh]h match_name}(hj_hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj2ubeh}(h]h ]h"]h$]h&]noemphhhuh1jhjLubeh}(h]h ]h"]h$]h&]hhuh1j}hjhhhj%hM0ubeh}(h]h ]h"]h$]h&]hhjPuh1jjQjRhjhhhj%hM0ubah}(h]j ah ](jVjWeh"]h$]h&]j[j\)j]huh1hhj%hM0hj hhubj_)}(hhh]h)}(h$Match a resource with the same name.h]h$Match a resource with the same name.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhM0hjhhubah}(h]h ]h"]h$]h&]uh1j^hj hhhj%hM0ubeh}(h]h ](jfunctioneh"]h$]h&]jjjjjjjjjuh1hhhhhhNhNubj)}(h**Parameters** ``struct kunit *test`` Test case to which the resource belongs. ``struct kunit_resource *res`` The resource. ``void *match_name`` The name to match against.h](h)}(h**Parameters**h]j)}(hjh]h Parameters}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhM4hjubj)}(hhh](j)}(h@``struct kunit *test`` Test case to which the resource belongs. h](j)}(h``struct kunit *test``h]j)}(hjh]hstruct kunit *test}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1jhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhM1hjubj )}(hhh]h)}(h(Test case to which the resource belongs.h]h(Test case to which the resource belongs.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhM1hjubah}(h]h ]h"]h$]h&]uh1j hjubeh}(h]h ]h"]h$]h&]uh1jhjhM1hjubj)}(h-``struct kunit_resource *res`` The resource. h](j)}(h``struct kunit_resource *res``h]j)}(hjh]hstruct kunit_resource *res}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1jhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhM2hjubj )}(hhh]h)}(h The resource.h]h The resource.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhM2hjubah}(h]h ]h"]h$]h&]uh1j hjubeh}(h]h ]h"]h$]h&]uh1jhjhM2hjubj)}(h/``void *match_name`` The name to match against.h](j)}(h``void *match_name``h]j)}(hj<h]hvoid *match_name}(hj>hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj:ubah}(h]h ]h"]h$]h&]uh1jhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhM4hj6ubj )}(hhh]h)}(hThe name to match against.h]hThe name to match against.}(hjUhhhNhNubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhM3hjRubah}(h]h ]h"]h$]h&]uh1j hj6ubeh}(h]h ]h"]h$]h&]uh1jhjQhM4hjubeh}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ] kernelindentah"]h$]h&]uh1jhhhhhNhNubh)}(hhh]h}(h]h ]h"]h$]h&]entries](h kunit_find_resource (C function)c.kunit_find_resourcehNtauh1hhhhhhNhNubh)}(hhh](h)}(hpstruct kunit_resource * kunit_find_resource (struct kunit *test, kunit_resource_match_t match, void *match_data)h]j)}(hnstruct kunit_resource *kunit_find_resource(struct kunit *test, kunit_resource_match_t match, void *match_data)h](j )}(hj h]hstruct}(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1j hjhhhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhM=ubj)}(h h]h }(hjhhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhjhhhjhM=ubh)}(hhh]j3)}(hkunit_resourceh]hkunit_resource}(hjhhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hjubah}(h]h ]h"]h$]h&] refdomainjreftypej reftargetjmodnameN classnameNjj)}j]j)}jkunit_find_resourcesbc.kunit_find_resourceasbuh1hhjhhhjhM=ubj)}(h h]h }(hjhhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhjhhhjhM=ubj)}(hjh]h*}(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjhhhjhM=ubj-)}(hkunit_find_resourceh]j3)}(hjh]hkunit_find_resource}(hjhhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hjubah}(h]h ](jEjFeh"]h$]h&]hhuh1j,hjhhhjhM=ubj~)}(hD(struct kunit *test, kunit_resource_match_t match, void *match_data)h](j)}(hstruct kunit *testh](j )}(hj h]hstruct}(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1j hj ubj)}(h h]h }(hjhhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj ubh)}(hhh]j3)}(hkunith]hkunit}(hj.hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj+ubah}(h]h ]h"]h$]h&] refdomainjreftypej reftargetj0modnameN classnameNjj)}j]jc.kunit_find_resourceasbuh1hhj ubj)}(h h]h }(hjLhhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj ubj)}(hjh]h*}(hjZhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhj ubj3)}(htesth]htest}(hjghhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj ubeh}(h]h ]h"]h$]h&]noemphhhuh1jhjubj)}(hkunit_resource_match_t matchh](h)}(hhh]j3)}(hkunit_resource_match_th]hkunit_resource_match_t}(hjhhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hjubah}(h]h ]h"]h$]h&] refdomainjreftypej reftargetjmodnameN classnameNjj)}j]jc.kunit_find_resourceasbuh1hhj|ubj)}(h h]h }(hjhhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj|ubj3)}(hmatchh]hmatch}(hjhhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj|ubeh}(h]h ]h"]h$]h&]noemphhhuh1jhjubj)}(hvoid *match_datah](jF)}(hvoidh]hvoid}(hjhhhNhNubah}(h]h ]jRah"]h$]h&]uh1jEhjubj)}(h h]h }(hjhhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhjubj)}(hjh]h*}(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjubj3)}(h match_datah]h match_data}(hjhhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hjubeh}(h]h ]h"]h$]h&]noemphhhuh1jhjubeh}(h]h ]h"]h$]h&]hhuh1j}hjhhhjhM=ubeh}(h]h ]h"]h$]h&]hhjPuh1jjQjRhjhhhjhM=ubah}(h]jah ](jVjWeh"]h$]h&]j[j\)j]huh1hhjhM=hjhhubj_)}(hhh]h)}(h*Find a resource using match function/data.h]h*Find a resource using match function/data.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhM=hjhhubah}(h]h ]h"]h$]h&]uh1j^hjhhhjhM=ubeh}(h]h ](jfunctioneh"]h$]h&]jjjj3jj3jjjuh1hhhhhhNhNubj)}(h**Parameters** ``struct kunit *test`` Test case to which the resource belongs. ``kunit_resource_match_t match`` match function to be applied to resources/match data. ``void *match_data`` data to be used in matching.h](h)}(h**Parameters**h]j)}(hj=h]h Parameters}(hj?hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj;ubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMAhj7ubj)}(hhh](j)}(h@``struct kunit *test`` Test case to which the resource belongs. h](j)}(h``struct kunit *test``h]j)}(hj\h]hstruct kunit *test}(hj^hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjZubah}(h]h ]h"]h$]h&]uh1jhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhM>hjVubj )}(hhh]h)}(h(Test case to which the resource belongs.h]h(Test case to which the resource belongs.}(hjuhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjqhM>hjrubah}(h]h ]h"]h$]h&]uh1j hjVubeh}(h]h ]h"]h$]h&]uh1jhjqhM>hjSubj)}(hW``kunit_resource_match_t match`` match function to be applied to resources/match data. h](j)}(h ``kunit_resource_match_t match``h]j)}(hjh]hkunit_resource_match_t match}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1jhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhM?hjubj )}(hhh]h)}(h5match function to be applied to resources/match data.h]h5match function to be applied to resources/match data.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhM?hjubah}(h]h ]h"]h$]h&]uh1j hjubeh}(h]h ]h"]h$]h&]uh1jhjhM?hjSubj)}(h1``void *match_data`` data to be used in matching.h](j)}(h``void *match_data``h]j)}(hjh]hvoid *match_data}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1jhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMAhjubj )}(hhh]h)}(hdata to be used in matching.h]hdata to be used in matching.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhM@hjubah}(h]h ]h"]h$]h&]uh1j hjubeh}(h]h ]h"]h$]h&]uh1jhjhMAhjSubeh}(h]h ]h"]h$]h&]uh1jhj7ubeh}(h]h ] kernelindentah"]h$]h&]uh1jhhhhhNhNubh)}(hhh]h}(h]h ]h"]h$]h&]entries](h&kunit_find_named_resource (C function)c.kunit_find_named_resourcehNtauh1hhhhhhNhNubh)}(hhh](h)}(hXstruct kunit_resource * kunit_find_named_resource (struct kunit *test, const char *name)h]j)}(hVstruct kunit_resource *kunit_find_named_resource(struct kunit *test, const char *name)h](j )}(hj h]hstruct}(hj(hhhNhNubah}(h]h ]jah"]h$]h&]uh1j hj$hhhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMZubj)}(h h]h }(hj6hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj$hhhj5hMZubh)}(hhh]j3)}(hkunit_resourceh]hkunit_resource}(hjGhhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hjDubah}(h]h ]h"]h$]h&] refdomainjreftypej reftargetjImodnameN classnameNjj)}j]j)}jkunit_find_named_resourcesbc.kunit_find_named_resourceasbuh1hhj$hhhj5hMZubj)}(h h]h }(hjhhhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj$hhhj5hMZubj)}(hjh]h*}(hjvhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhj$hhhj5hMZubj-)}(hkunit_find_named_resourceh]j3)}(hjeh]hkunit_find_named_resource}(hjhhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hjubah}(h]h ](jEjFeh"]h$]h&]hhuh1j,hj$hhhj5hMZubj~)}(h&(struct kunit *test, const char *name)h](j)}(hstruct kunit *testh](j )}(hj h]hstruct}(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1j hjubj)}(h h]h }(hjhhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhjubh)}(hhh]j3)}(hkunith]hkunit}(hjhhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hjubah}(h]h ]h"]h$]h&] refdomainjreftypej reftargetjmodnameN classnameNjj)}j]jcc.kunit_find_named_resourceasbuh1hhjubj)}(h h]h }(hjhhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhjubj)}(hjh]h*}(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjubj3)}(htesth]htest}(hjhhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hjubeh}(h]h ]h"]h$]h&]noemphhhuh1jhjubj)}(hconst char *nameh](j )}(hjCh]hconst}(hj hhhNhNubah}(h]h ]jah"]h$]h&]uh1j hj ubj)}(h h]h }(hj hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj ubjF)}(hcharh]hchar}(hj- hhhNhNubah}(h]h ]jRah"]h$]h&]uh1jEhj ubj)}(h h]h }(hj; hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj ubj)}(hjh]h*}(hjI hhhNhNubah}(h]h ]jah"]h$]h&]uh1jhj ubj3)}(hnameh]hname}(hjV hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj ubeh}(h]h ]h"]h$]h&]noemphhhuh1jhjubeh}(h]h ]h"]h$]h&]hhuh1j}hj$hhhj5hMZubeh}(h]h ]h"]h$]h&]hhjPuh1jjQjRhj hhhj5hMZubah}(h]jah ](jVjWeh"]h$]h&]j[j\)j]huh1hhj5hMZhjhhubj_)}(hhh]h)}(h!Find a resource using match name.h]h!Find a resource using match name.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMZhj} hhubah}(h]h ]h"]h$]h&]uh1j^hjhhhj5hMZubeh}(h]h ](jfunctioneh"]h$]h&]jjjj jj jjjuh1hhhhhhNhNubj)}(hu**Parameters** ``struct kunit *test`` Test case to which the resource belongs. ``const char *name`` match name.h](h)}(h**Parameters**h]j)}(hj h]h Parameters}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhM^hj ubj)}(hhh](j)}(h@``struct kunit *test`` Test case to which the resource belongs. h](j)}(h``struct kunit *test``h]j)}(hj h]hstruct kunit *test}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]uh1jhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhM[hj ubj )}(hhh]h)}(h(Test case to which the resource belongs.h]h(Test case to which the resource belongs.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hM[hj ubah}(h]h ]h"]h$]h&]uh1j hj ubeh}(h]h ]h"]h$]h&]uh1jhj hM[hj ubj)}(h ``const char *name`` match name.h](j)}(h``const char *name``h]j)}(hj h]hconst char *name}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]uh1jhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhM]hj ubj )}(hhh]h)}(h match name.h]h match name.}(hj!hhhNhNubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhM\hj!ubah}(h]h ]h"]h$]h&]uh1j hj ubeh}(h]h ]h"]h$]h&]uh1jhj!hM]hj ubeh}(h]h ]h"]h$]h&]uh1jhj ubeh}(h]h ] kernelindentah"]h$]h&]uh1jhhhhhNhNubh)}(hhh]h}(h]h ]h"]h$]h&]entries](h#kunit_destroy_resource (C function)c.kunit_destroy_resourcehNtauh1hhhhhhNhNubh)}(hhh](h)}(h_int kunit_destroy_resource (struct kunit *test, kunit_resource_match_t match, void *match_data)h]j)}(h^int kunit_destroy_resource(struct kunit *test, kunit_resource_match_t match, void *match_data)h](jF)}(hinth]hint}(hjT!hhhNhNubah}(h]h ]jRah"]h$]h&]uh1jEhjP!hhhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMgubj)}(h h]h }(hjc!hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhjP!hhhjb!hMgubj-)}(hkunit_destroy_resourceh]j3)}(hkunit_destroy_resourceh]hkunit_destroy_resource}(hju!hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hjq!ubah}(h]h ](jEjFeh"]h$]h&]hhuh1j,hjP!hhhjb!hMgubj~)}(hD(struct kunit *test, kunit_resource_match_t match, void *match_data)h](j)}(hstruct kunit *testh](j )}(hj h]hstruct}(hj!hhhNhNubah}(h]h ]jah"]h$]h&]uh1j hj!ubj)}(h h]h }(hj!hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj!ubh)}(hhh]j3)}(hkunith]hkunit}(hj!hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj!ubah}(h]h ]h"]h$]h&] refdomainjreftypej reftargetj!modnameN classnameNjj)}j]j)}jjw!sbc.kunit_destroy_resourceasbuh1hhj!ubj)}(h h]h }(hj!hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj!ubj)}(hjh]h*}(hj!hhhNhNubah}(h]h ]jah"]h$]h&]uh1jhj!ubj3)}(htesth]htest}(hj!hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj!ubeh}(h]h ]h"]h$]h&]noemphhhuh1jhj!ubj)}(hkunit_resource_match_t matchh](h)}(hhh]j3)}(hkunit_resource_match_th]hkunit_resource_match_t}(hj"hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj"ubah}(h]h ]h"]h$]h&] refdomainjreftypej reftargetj"modnameN classnameNjj)}j]j!c.kunit_destroy_resourceasbuh1hhj!ubj)}(h h]h }(hj$"hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj!ubj3)}(hmatchh]hmatch}(hj2"hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj!ubeh}(h]h ]h"]h$]h&]noemphhhuh1jhj!ubj)}(hvoid *match_datah](jF)}(hvoidh]hvoid}(hjK"hhhNhNubah}(h]h ]jRah"]h$]h&]uh1jEhjG"ubj)}(h h]h }(hjY"hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhjG"ubj)}(hjh]h*}(hjg"hhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjG"ubj3)}(h match_datah]h match_data}(hjt"hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hjG"ubeh}(h]h ]h"]h$]h&]noemphhhuh1jhj!ubeh}(h]h ]h"]h$]h&]hhuh1j}hjP!hhhjb!hMgubeh}(h]h ]h"]h$]h&]hhjPuh1jjQjRhjL!hhhjb!hMgubah}(h]jG!ah ](jVjWeh"]h$]h&]j[j\)j]huh1hhjb!hMghjI!hhubj_)}(hhh]h)}(h%Find a kunit_resource and destroy it.h]h%Find a kunit_resource and destroy it.}(hj"hhhNhNubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMghj"hhubah}(h]h ]h"]h$]h&]uh1j^hjI!hhhjb!hMgubeh}(h]h ](jfunctioneh"]h$]h&]jjjj"jj"jjjuh1hhhhhhNhNubj)}(hX=**Parameters** ``struct kunit *test`` Test case to which the resource belongs. ``kunit_resource_match_t match`` Match function. Returns whether a given resource matches **match_data**. ``void *match_data`` Data passed into **match**. **Return** 0 if kunit_resource is found and freed, -ENOENT if not found.h](h)}(h**Parameters**h]j)}(hj"h]h Parameters}(hj"hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj"ubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMkhj"ubj)}(hhh](j)}(h@``struct kunit *test`` Test case to which the resource belongs. h](j)}(h``struct kunit *test``h]j)}(hj"h]hstruct kunit *test}(hj"hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj"ubah}(h]h ]h"]h$]h&]uh1jhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMhhj"ubj )}(hhh]h)}(h(Test case to which the resource belongs.h]h(Test case to which the resource belongs.}(hj"hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj"hMhhj"ubah}(h]h ]h"]h$]h&]uh1j hj"ubeh}(h]h ]h"]h$]h&]uh1jhj"hMhhj"ubj)}(hj``kunit_resource_match_t match`` Match function. Returns whether a given resource matches **match_data**. h](j)}(h ``kunit_resource_match_t match``h]j)}(hj#h]hkunit_resource_match_t match}(hj#hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj#ubah}(h]h ]h"]h$]h&]uh1jhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMihj#ubj )}(hhh]h)}(hHMatch function. Returns whether a given resource matches **match_data**.h](h9Match function. Returns whether a given resource matches }(hj1#hhhNhNubj)}(h**match_data**h]h match_data}(hj9#hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj1#ubh.}(hj1#hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhj-#hMihj.#ubah}(h]h ]h"]h$]h&]uh1j hj#ubeh}(h]h ]h"]h$]h&]uh1jhj-#hMihj"ubj)}(h1``void *match_data`` Data passed into **match**. h](j)}(h``void *match_data``h]j)}(hjc#h]hvoid *match_data}(hje#hhhNhNubah}(h]h ]h"]h$]h&]uh1jhja#ubah}(h]h ]h"]h$]h&]uh1jhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMjhj]#ubj )}(hhh]h)}(hData passed into **match**.h](hData passed into }(hj|#hhhNhNubj)}(h **match**h]hmatch}(hj#hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj|#ubh.}(hj|#hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhjx#hMjhjy#ubah}(h]h ]h"]h$]h&]uh1j hj]#ubeh}(h]h ]h"]h$]h&]uh1jhjx#hMjhj"ubeh}(h]h ]h"]h$]h&]uh1jhj"ubh)}(h **Return**h]j)}(hj#h]hReturn}(hj#hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj#ubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMlhj"ubh)}(h=0 if kunit_resource is found and freed, -ENOENT if not found.h]h=0 if kunit_resource is found and freed, -ENOENT if not found.}(hj#hhhNhNubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMlhj"ubeh}(h]h ] kernelindentah"]h$]h&]uh1jhhhhhNhNubh)}(hhh]h}(h]h ]h"]h$]h&]entries](h"kunit_remove_resource (C function)c.kunit_remove_resourcehNtauh1hhhhhhNhNubh)}(hhh](h)}(hKvoid kunit_remove_resource (struct kunit *test, struct kunit_resource *res)h]j)}(hJvoid kunit_remove_resource(struct kunit *test, struct kunit_resource *res)h](jF)}(hvoidh]hvoid}(hj#hhhNhNubah}(h]h ]jRah"]h$]h&]uh1jEhj#hhhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhM{ubj)}(h h]h }(hj$hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj#hhhj$hM{ubj-)}(hkunit_remove_resourceh]j3)}(hkunit_remove_resourceh]hkunit_remove_resource}(hj$hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj$ubah}(h]h ](jEjFeh"]h$]h&]hhuh1j,hj#hhhj$hM{ubj~)}(h0(struct kunit *test, struct kunit_resource *res)h](j)}(hstruct kunit *testh](j )}(hj h]hstruct}(hj2$hhhNhNubah}(h]h ]jah"]h$]h&]uh1j hj.$ubj)}(h h]h }(hj?$hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj.$ubh)}(hhh]j3)}(hkunith]hkunit}(hjP$hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hjM$ubah}(h]h ]h"]h$]h&] refdomainjreftypej reftargetjR$modnameN classnameNjj)}j]j)}jj$sbc.kunit_remove_resourceasbuh1hhj.$ubj)}(h h]h }(hjp$hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj.$ubj)}(hjh]h*}(hj~$hhhNhNubah}(h]h ]jah"]h$]h&]uh1jhj.$ubj3)}(htesth]htest}(hj$hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj.$ubeh}(h]h ]h"]h$]h&]noemphhhuh1jhj*$ubj)}(hstruct kunit_resource *resh](j )}(hj h]hstruct}(hj$hhhNhNubah}(h]h ]jah"]h$]h&]uh1j hj$ubj)}(h h]h }(hj$hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj$ubh)}(hhh]j3)}(hkunit_resourceh]hkunit_resource}(hj$hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj$ubah}(h]h ]h"]h$]h&] refdomainjreftypej reftargetj$modnameN classnameNjj)}j]jl$c.kunit_remove_resourceasbuh1hhj$ubj)}(h h]h }(hj$hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj$ubj)}(hjh]h*}(hj$hhhNhNubah}(h]h ]jah"]h$]h&]uh1jhj$ubj3)}(hresh]hres}(hj$hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj$ubeh}(h]h ]h"]h$]h&]noemphhhuh1jhj*$ubeh}(h]h ]h"]h$]h&]hhuh1j}hj#hhhj$hM{ubeh}(h]h ]h"]h$]h&]hhjPuh1jjQjRhj#hhhj$hM{ubah}(h]j#ah ](jVjWeh"]h$]h&]j[j\)j]huh1hhj$hM{hj#hhubj_)}(hhh]h)}(h8remove resource from resource list associated with test.h]h8remove resource from resource list associated with test.}(hj%%hhhNhNubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhM{hj"%hhubah}(h]h ]h"]h$]h&]uh1j^hj#hhhj$hM{ubeh}(h]h ](jfunctioneh"]h$]h&]jjjj=%jj=%jjjuh1hhhhhhNhNubj)}(hXX**Parameters** ``struct kunit *test`` The test context object. ``struct kunit_resource *res`` The resource to be removed. **Description** Note that the resource will not be immediately freed since it is likely the caller has a reference to it via alloc_and_get() or find(); in this case a final call to kunit_put_resource() is required.h](h)}(h**Parameters**h]j)}(hjG%h]h Parameters}(hjI%hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjE%ubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMhjA%ubj)}(hhh](j)}(h0``struct kunit *test`` The test context object. h](j)}(h``struct kunit *test``h]j)}(hjf%h]hstruct kunit *test}(hjh%hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjd%ubah}(h]h ]h"]h$]h&]uh1jhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhM}hj`%ubj )}(hhh]h)}(hThe test context object.h]hThe test context object.}(hj%hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj{%hM}hj|%ubah}(h]h ]h"]h$]h&]uh1j hj`%ubeh}(h]h ]h"]h$]h&]uh1jhj{%hM}hj]%ubj)}(h;``struct kunit_resource *res`` The resource to be removed. h](j)}(h``struct kunit_resource *res``h]j)}(hj%h]hstruct kunit_resource *res}(hj%hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj%ubah}(h]h ]h"]h$]h&]uh1jhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhM~hj%ubj )}(hhh]h)}(hThe resource to be removed.h]hThe resource to be removed.}(hj%hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj%hM~hj%ubah}(h]h ]h"]h$]h&]uh1j hj%ubeh}(h]h ]h"]h$]h&]uh1jhj%hM~hj]%ubeh}(h]h ]h"]h$]h&]uh1jhjA%ubh)}(h**Description**h]j)}(hj%h]h Description}(hj%hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj%ubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMhjA%ubh)}(hNote that the resource will not be immediately freed since it is likely the caller has a reference to it via alloc_and_get() or find(); in this case a final call to kunit_put_resource() is required.h]hNote that the resource will not be immediately freed since it is likely the caller has a reference to it via alloc_and_get() or find(); in this case a final call to kunit_put_resource() is required.}(hj%hhhNhNubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMhjA%ubeh}(h]h ] kernelindentah"]h$]h&]uh1jhhhhhNhNubh)}(hhh]h}(h]h ]h"]h$]h&]entries](h%KUNIT_DEFINE_ACTION_WRAPPER (C macro)c.KUNIT_DEFINE_ACTION_WRAPPERhNtauh1hhhhhhNhNubh)}(hhh](h)}(hKUNIT_DEFINE_ACTION_WRAPPERh]j)}(hKUNIT_DEFINE_ACTION_WRAPPERh]j-)}(hKUNIT_DEFINE_ACTION_WRAPPERh]j3)}(hj&h]hKUNIT_DEFINE_ACTION_WRAPPER}(hj#&hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj&ubah}(h]h ](jEjFeh"]h$]h&]hhuh1j,hj&hhhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMubah}(h]h ]h"]h$]h&]hhjPuh1jjQjRhj&hhhj6&hMubah}(h]j&ah ](jVjWeh"]h$]h&]j[j\)j]huh1hhj6&hMhj&hhubj_)}(hhh]h}(h]h ]h"]h$]h&]uh1j^hj&hhhj6&hMubeh}(h]h ](jmacroeh"]h$]h&]jjjjO&jjO&jjjuh1hhhhhhNhNubh)}(h9``KUNIT_DEFINE_ACTION_WRAPPER (wrapper, orig, arg_type)``h]j)}(hjU&h]h5KUNIT_DEFINE_ACTION_WRAPPER (wrapper, orig, arg_type)}(hjW&hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjS&ubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMhhhhubh block_quote)}(h.Wrap a function for use as a deferred action. h]h)}(h-Wrap a function for use as a deferred action.h]h-Wrap a function for use as a deferred action.}(hjq&hhhNhNubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMhjm&ubah}(h]h ]h"]h$]h&]uh1jk&hj&hMhhhhubj)}(hX**Parameters** ``wrapper`` The name of the new wrapper function define. ``orig`` The original function to wrap. ``arg_type`` The type of the argument accepted by **orig**. **Description** Defines a wrapper for a function which accepts a single, pointer-sized argument. This wrapper can then be passed to kunit_add_action() and similar. This should be used in preference to casting a function directly to kunit_action_t, as casting function pointers will break control flow integrity (CFI), leading to crashes.h](h)}(h**Parameters**h]j)}(hj&h]h Parameters}(hj&hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj&ubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMhj&ubj)}(hhh](j)}(h9``wrapper`` The name of the new wrapper function define. h](j)}(h ``wrapper``h]j)}(hj&h]hwrapper}(hj&hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj&ubah}(h]h ]h"]h$]h&]uh1jhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMhj&ubj )}(hhh]h)}(h,The name of the new wrapper function define.h]h,The name of the new wrapper function define.}(hj&hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj&hMhj&ubah}(h]h ]h"]h$]h&]uh1j hj&ubeh}(h]h ]h"]h$]h&]uh1jhj&hMhj&ubj)}(h(``orig`` The original function to wrap. h](j)}(h``orig``h]j)}(hj&h]horig}(hj&hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj&ubah}(h]h ]h"]h$]h&]uh1jhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMhj&ubj )}(hhh]h)}(hThe original function to wrap.h]hThe original function to wrap.}(hj&hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj&hMhj&ubah}(h]h ]h"]h$]h&]uh1j hj&ubeh}(h]h ]h"]h$]h&]uh1jhj&hMhj&ubj)}(h<``arg_type`` The type of the argument accepted by **orig**. h](j)}(h ``arg_type``h]j)}(hj'h]harg_type}(hj'hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj'ubah}(h]h ]h"]h$]h&]uh1jhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMhj'ubj )}(hhh]h)}(h.The type of the argument accepted by **orig**.h](h%The type of the argument accepted by }(hj6'hhhNhNubj)}(h**orig**h]horig}(hj>'hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj6'ubh.}(hj6'hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhj2'hMhj3'ubah}(h]h ]h"]h$]h&]uh1j hj'ubeh}(h]h ]h"]h$]h&]uh1jhj2'hMhj&ubeh}(h]h ]h"]h$]h&]uh1jhj&ubh)}(h**Description**h]j)}(hjj'h]h Description}(hjl'hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjh'ubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMhj&ubh)}(hXADefines a wrapper for a function which accepts a single, pointer-sized argument. This wrapper can then be passed to kunit_add_action() and similar. This should be used in preference to casting a function directly to kunit_action_t, as casting function pointers will break control flow integrity (CFI), leading to crashes.h]hXADefines a wrapper for a function which accepts a single, pointer-sized argument. This wrapper can then be passed to kunit_add_action() and similar. This should be used in preference to casting a function directly to kunit_action_t, as casting function pointers will break control flow integrity (CFI), leading to crashes.}(hj'hhhNhNubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMhj&ubeh}(h]h ] kernelindentah"]h$]h&]uh1jhhhhhNhNubh)}(hhh]h}(h]h ]h"]h$]h&]entries](hkunit_add_action (C function)c.kunit_add_actionhNtauh1hhhhhhNhNubh)}(hhh](h)}(hLint kunit_add_action (struct kunit *test, kunit_action_t *action, void *ctx)h]j)}(hKint kunit_add_action(struct kunit *test, kunit_action_t *action, void *ctx)h](jF)}(hinth]hint}(hj'hhhNhNubah}(h]h ]jRah"]h$]h&]uh1jEhj'hhhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMubj)}(h h]h }(hj'hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj'hhhj'hMubj-)}(hkunit_add_actionh]j3)}(hkunit_add_actionh]hkunit_add_action}(hj'hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj'ubah}(h]h ](jEjFeh"]h$]h&]hhuh1j,hj'hhhj'hMubj~)}(h7(struct kunit *test, kunit_action_t *action, void *ctx)h](j)}(hstruct kunit *testh](j )}(hj h]hstruct}(hj'hhhNhNubah}(h]h ]jah"]h$]h&]uh1j hj'ubj)}(h h]h }(hj'hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj'ubh)}(hhh]j3)}(hkunith]hkunit}(hj (hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj(ubah}(h]h ]h"]h$]h&] refdomainjreftypej reftargetj (modnameN classnameNjj)}j]j)}jj'sbc.kunit_add_actionasbuh1hhj'ubj)}(h h]h }(hj*(hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj'ubj)}(hjh]h*}(hj8(hhhNhNubah}(h]h ]jah"]h$]h&]uh1jhj'ubj3)}(htesth]htest}(hjE(hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj'ubeh}(h]h ]h"]h$]h&]noemphhhuh1jhj'ubj)}(hkunit_action_t *actionh](h)}(hhh]j3)}(hkunit_action_th]hkunit_action_t}(hja(hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj^(ubah}(h]h ]h"]h$]h&] refdomainjreftypej reftargetjc(modnameN classnameNjj)}j]j&(c.kunit_add_actionasbuh1hhjZ(ubj)}(h h]h }(hj(hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhjZ(ubj)}(hjh]h*}(hj(hhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjZ(ubj3)}(hactionh]haction}(hj(hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hjZ(ubeh}(h]h ]h"]h$]h&]noemphhhuh1jhj'ubj)}(h void *ctxh](jF)}(hvoidh]hvoid}(hj(hhhNhNubah}(h]h ]jRah"]h$]h&]uh1jEhj(ubj)}(h h]h }(hj(hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj(ubj)}(hjh]h*}(hj(hhhNhNubah}(h]h ]jah"]h$]h&]uh1jhj(ubj3)}(hctxh]hctx}(hj(hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj(ubeh}(h]h ]h"]h$]h&]noemphhhuh1jhj'ubeh}(h]h ]h"]h$]h&]hhuh1j}hj'hhhj'hMubeh}(h]h ]h"]h$]h&]hhjPuh1jjQjRhj'hhhj'hMubah}(h]j'ah ](jVjWeh"]h$]h&]j[j\)j]huh1hhj'hMhj'hhubj_)}(hhh]h)}(h#Call a function when the test ends.h]h#Call a function when the test ends.}(hj)hhhNhNubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMhj)hhubah}(h]h ]h"]h$]h&]uh1j^hj'hhhj'hMubeh}(h]h ](jfunctioneh"]h$]h&]jjjj)jj)jjjuh1hhhhhhNhNubj)}(hX**Parameters** ``struct kunit *test`` Test case to associate the action with. ``kunit_action_t *action`` The function to run on test exit ``void *ctx`` Data passed into **func** **Description** Defer the execution of a function until the test exits, either normally or due to a failure. **ctx** is passed as additional context. All functions registered with kunit_add_action() will execute in the opposite order to that they were registered in. This is useful for cleaning up allocated memory and resources, as these functions are called even if the test aborts early due to, e.g., a failed assertion. See also: devm_add_action() for the devres equivalent. **Return** 0 on success, an error if the action could not be deferred.h](h)}(h**Parameters**h]j)}(hj()h]h Parameters}(hj*)hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj&)ubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMhj")ubj)}(hhh](j)}(h?``struct kunit *test`` Test case to associate the action with. h](j)}(h``struct kunit *test``h]j)}(hjG)h]hstruct kunit *test}(hjI)hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjE)ubah}(h]h ]h"]h$]h&]uh1jhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMhjA)ubj )}(hhh]h)}(h'Test case to associate the action with.h]h'Test case to associate the action with.}(hj`)hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj\)hMhj])ubah}(h]h ]h"]h$]h&]uh1j hjA)ubeh}(h]h ]h"]h$]h&]uh1jhj\)hMhj>)ubj)}(h<``kunit_action_t *action`` The function to run on test exit h](j)}(h``kunit_action_t *action``h]j)}(hj)h]hkunit_action_t *action}(hj)hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj~)ubah}(h]h ]h"]h$]h&]uh1jhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMhjz)ubj )}(hhh]h)}(h The function to run on test exith]h The function to run on test exit}(hj)hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj)hMhj)ubah}(h]h ]h"]h$]h&]uh1j hjz)ubeh}(h]h ]h"]h$]h&]uh1jhj)hMhj>)ubj)}(h(``void *ctx`` Data passed into **func** h](j)}(h ``void *ctx``h]j)}(hj)h]h void *ctx}(hj)hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj)ubah}(h]h ]h"]h$]h&]uh1jhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMhj)ubj )}(hhh]h)}(hData passed into **func**h](hData passed into }(hj)hhhNhNubj)}(h**func**h]hfunc}(hj)hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj)ubeh}(h]h ]h"]h$]h&]uh1hhj)hMhj)ubah}(h]h ]h"]h$]h&]uh1j hj)ubeh}(h]h ]h"]h$]h&]uh1jhj)hMhj>)ubeh}(h]h ]h"]h$]h&]uh1jhj")ubh)}(h**Description**h]j)}(hj*h]h Description}(hj*hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj*ubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMhj")ubh)}(hDefer the execution of a function until the test exits, either normally or due to a failure. **ctx** is passed as additional context. All functions registered with kunit_add_action() will execute in the opposite order to that they were registered in.h](h^Defer the execution of a function until the test exits, either normally or due to a failure. }(hj*hhhNhNubj)}(h**ctx**h]hctx}(hj *hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj*ubh is passed as additional context. All functions registered with kunit_add_action() will execute in the opposite order to that they were registered in.}(hj*hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMhj")ubh)}(hThis is useful for cleaning up allocated memory and resources, as these functions are called even if the test aborts early due to, e.g., a failed assertion.h]hThis is useful for cleaning up allocated memory and resources, as these functions are called even if the test aborts early due to, e.g., a failed assertion.}(hj9*hhhNhNubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMhj")ubh)}(h6See also: devm_add_action() for the devres equivalent.h]h6See also: devm_add_action() for the devres equivalent.}(hjH*hhhNhNubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMhj")ubh)}(h **Return**h]j)}(hjY*h]hReturn}(hj[*hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjW*ubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMhj")ubjl&)}(h;0 on success, an error if the action could not be deferred.h]h)}(hjq*h]h;0 on success, an error if the action could not be deferred.}(hjs*hhhNhNubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMhjo*ubah}(h]h ]h"]h$]h&]uh1jk&hj*hMhj")ubeh}(h]h ] kernelindentah"]h$]h&]uh1jhhhhhNhNubh)}(hhh]h}(h]h ]h"]h$]h&]entries](h&kunit_add_action_or_reset (C function)c.kunit_add_action_or_resethNtauh1hhhhhhNhNubh)}(hhh](h)}(hUint kunit_add_action_or_reset (struct kunit *test, kunit_action_t *action, void *ctx)h]j)}(hTint kunit_add_action_or_reset(struct kunit *test, kunit_action_t *action, void *ctx)h](jF)}(hinth]hint}(hj*hhhNhNubah}(h]h ]jRah"]h$]h&]uh1jEhj*hhhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMubj)}(h h]h }(hj*hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj*hhhj*hMubj-)}(hkunit_add_action_or_reseth]j3)}(hkunit_add_action_or_reseth]hkunit_add_action_or_reset}(hj*hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj*ubah}(h]h ](jEjFeh"]h$]h&]hhuh1j,hj*hhhj*hMubj~)}(h7(struct kunit *test, kunit_action_t *action, void *ctx)h](j)}(hstruct kunit *testh](j )}(hj h]hstruct}(hj*hhhNhNubah}(h]h ]jah"]h$]h&]uh1j hj*ubj)}(h h]h }(hj*hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj*ubh)}(hhh]j3)}(hkunith]hkunit}(hj+hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj*ubah}(h]h ]h"]h$]h&] refdomainjreftypej reftargetj+modnameN classnameNjj)}j]j)}jj*sbc.kunit_add_action_or_resetasbuh1hhj*ubj)}(h h]h }(hj"+hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj*ubj)}(hjh]h*}(hj0+hhhNhNubah}(h]h ]jah"]h$]h&]uh1jhj*ubj3)}(htesth]htest}(hj=+hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj*ubeh}(h]h ]h"]h$]h&]noemphhhuh1jhj*ubj)}(hkunit_action_t *actionh](h)}(hhh]j3)}(hkunit_action_th]hkunit_action_t}(hjY+hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hjV+ubah}(h]h ]h"]h$]h&] refdomainjreftypej reftargetj[+modnameN classnameNjj)}j]j+c.kunit_add_action_or_resetasbuh1hhjR+ubj)}(h h]h }(hjw+hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhjR+ubj)}(hjh]h*}(hj+hhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjR+ubj3)}(hactionh]haction}(hj+hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hjR+ubeh}(h]h ]h"]h$]h&]noemphhhuh1jhj*ubj)}(h void *ctxh](jF)}(hvoidh]hvoid}(hj+hhhNhNubah}(h]h ]jRah"]h$]h&]uh1jEhj+ubj)}(h h]h }(hj+hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj+ubj)}(hjh]h*}(hj+hhhNhNubah}(h]h ]jah"]h$]h&]uh1jhj+ubj3)}(hctxh]hctx}(hj+hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj+ubeh}(h]h ]h"]h$]h&]noemphhhuh1jhj*ubeh}(h]h ]h"]h$]h&]hhuh1j}hj*hhhj*hMubeh}(h]h ]h"]h$]h&]hhjPuh1jjQjRhj*hhhj*hMubah}(h]j*ah ](jVjWeh"]h$]h&]j[j\)j]huh1hhj*hMhj*hhubj_)}(hhh]h)}(h#Call a function when the test ends.h]h#Call a function when the test ends.}(hj+hhhNhNubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMhj+hhubah}(h]h ]h"]h$]h&]uh1j^hj*hhhj*hMubeh}(h]h ](jfunctioneh"]h$]h&]jjjj,jj,jjjuh1hhhhhhNhNubj)}(hX**Parameters** ``struct kunit *test`` Test case to associate the action with. ``kunit_action_t *action`` The function to run on test exit ``void *ctx`` Data passed into **func** **Description** Defer the execution of a function until the test exits, either normally or due to a failure. **ctx** is passed as additional context. All functions registered with kunit_add_action() will execute in the opposite order to that they were registered in. This is useful for cleaning up allocated memory and resources, as these functions are called even if the test aborts early due to, e.g., a failed assertion. If the action cannot be created (e.g., due to the system being out of memory), then action(ctx) will be called immediately, and an error will be returned. See also: devm_add_action_or_reset() for the devres equivalent. **Return** 0 on success, an error if the action could not be deferred.h](h)}(h**Parameters**h]j)}(hj ,h]h Parameters}(hj",hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj,ubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMhj,ubj)}(hhh](j)}(h?``struct kunit *test`` Test case to associate the action with. h](j)}(h``struct kunit *test``h]j)}(hj?,h]hstruct kunit *test}(hjA,hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj=,ubah}(h]h ]h"]h$]h&]uh1jhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMhj9,ubj )}(hhh]h)}(h'Test case to associate the action with.h]h'Test case to associate the action with.}(hjX,hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjT,hMhjU,ubah}(h]h ]h"]h$]h&]uh1j hj9,ubeh}(h]h ]h"]h$]h&]uh1jhjT,hMhj6,ubj)}(h<``kunit_action_t *action`` The function to run on test exit h](j)}(h``kunit_action_t *action``h]j)}(hjx,h]hkunit_action_t *action}(hjz,hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjv,ubah}(h]h ]h"]h$]h&]uh1jhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMhjr,ubj )}(hhh]h)}(h The function to run on test exith]h The function to run on test exit}(hj,hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj,hMhj,ubah}(h]h ]h"]h$]h&]uh1j hjr,ubeh}(h]h ]h"]h$]h&]uh1jhj,hMhj6,ubj)}(h(``void *ctx`` Data passed into **func** h](j)}(h ``void *ctx``h]j)}(hj,h]h void *ctx}(hj,hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj,ubah}(h]h ]h"]h$]h&]uh1jhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMhj,ubj )}(hhh]h)}(hData passed into **func**h](hData passed into }(hj,hhhNhNubj)}(h**func**h]hfunc}(hj,hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj,ubeh}(h]h ]h"]h$]h&]uh1hhj,hMhj,ubah}(h]h ]h"]h$]h&]uh1j hj,ubeh}(h]h ]h"]h$]h&]uh1jhj,hMhj6,ubeh}(h]h ]h"]h$]h&]uh1jhj,ubh)}(h**Description**h]j)}(hj,h]h Description}(hj,hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj,ubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMhj,ubh)}(hDefer the execution of a function until the test exits, either normally or due to a failure. **ctx** is passed as additional context. All functions registered with kunit_add_action() will execute in the opposite order to that they were registered in.h](h^Defer the execution of a function until the test exits, either normally or due to a failure. }(hj-hhhNhNubj)}(h**ctx**h]hctx}(hj-hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj-ubh is passed as additional context. All functions registered with kunit_add_action() will execute in the opposite order to that they were registered in.}(hj-hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMhj,ubh)}(hThis is useful for cleaning up allocated memory and resources, as these functions are called even if the test aborts early due to, e.g., a failed assertion.h]hThis is useful for cleaning up allocated memory and resources, as these functions are called even if the test aborts early due to, e.g., a failed assertion.}(hj1-hhhNhNubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMhj,ubh)}(hIf the action cannot be created (e.g., due to the system being out of memory), then action(ctx) will be called immediately, and an error will be returned.h]hIf the action cannot be created (e.g., due to the system being out of memory), then action(ctx) will be called immediately, and an error will be returned.}(hj@-hhhNhNubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMhj,ubh)}(h?See also: devm_add_action_or_reset() for the devres equivalent.h]h?See also: devm_add_action_or_reset() for the devres equivalent.}(hjO-hhhNhNubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMhj,ubh)}(h **Return**h]j)}(hj`-h]hReturn}(hjb-hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj^-ubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMhj,ubjl&)}(h;0 on success, an error if the action could not be deferred.h]h)}(hjx-h]h;0 on success, an error if the action could not be deferred.}(hjz-hhhNhNubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMhjv-ubah}(h]h ]h"]h$]h&]uh1jk&hj-hMhj,ubeh}(h]h ] kernelindentah"]h$]h&]uh1jhhhhhNhNubh)}(hhh]h}(h]h ]h"]h$]h&]entries](h kunit_remove_action (C function)c.kunit_remove_actionhNtauh1hhhhhhNhNubh)}(hhh](h)}(hPvoid kunit_remove_action (struct kunit *test, kunit_action_t *action, void *ctx)h]j)}(hOvoid kunit_remove_action(struct kunit *test, kunit_action_t *action, void *ctx)h](jF)}(hvoidh]hvoid}(hj-hhhNhNubah}(h]h ]jRah"]h$]h&]uh1jEhj-hhhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMubj)}(h h]h }(hj-hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj-hhhj-hMubj-)}(hkunit_remove_actionh]j3)}(hkunit_remove_actionh]hkunit_remove_action}(hj-hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj-ubah}(h]h ](jEjFeh"]h$]h&]hhuh1j,hj-hhhj-hMubj~)}(h7(struct kunit *test, kunit_action_t *action, void *ctx)h](j)}(hstruct kunit *testh](j )}(hj h]hstruct}(hj-hhhNhNubah}(h]h ]jah"]h$]h&]uh1j hj-ubj)}(h h]h }(hj-hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj-ubh)}(hhh]j3)}(hkunith]hkunit}(hj .hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj.ubah}(h]h ]h"]h$]h&] refdomainjreftypej reftargetj .modnameN classnameNjj)}j]j)}jj-sbc.kunit_remove_actionasbuh1hhj-ubj)}(h h]h }(hj).hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj-ubj)}(hjh]h*}(hj7.hhhNhNubah}(h]h ]jah"]h$]h&]uh1jhj-ubj3)}(htesth]htest}(hjD.hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj-ubeh}(h]h ]h"]h$]h&]noemphhhuh1jhj-ubj)}(hkunit_action_t *actionh](h)}(hhh]j3)}(hkunit_action_th]hkunit_action_t}(hj`.hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj].ubah}(h]h ]h"]h$]h&] refdomainjreftypej reftargetjb.modnameN classnameNjj)}j]j%.c.kunit_remove_actionasbuh1hhjY.ubj)}(h h]h }(hj~.hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhjY.ubj)}(hjh]h*}(hj.hhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjY.ubj3)}(hactionh]haction}(hj.hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hjY.ubeh}(h]h ]h"]h$]h&]noemphhhuh1jhj-ubj)}(h void *ctxh](jF)}(hvoidh]hvoid}(hj.hhhNhNubah}(h]h ]jRah"]h$]h&]uh1jEhj.ubj)}(h h]h }(hj.hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj.ubj)}(hjh]h*}(hj.hhhNhNubah}(h]h ]jah"]h$]h&]uh1jhj.ubj3)}(hctxh]hctx}(hj.hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj.ubeh}(h]h ]h"]h$]h&]noemphhhuh1jhj-ubeh}(h]h ]h"]h$]h&]hhuh1j}hj-hhhj-hMubeh}(h]h ]h"]h$]h&]hhjPuh1jjQjRhj-hhhj-hMubah}(h]j-ah ](jVjWeh"]h$]h&]j[j\)j]huh1hhj-hMhj-hhubj_)}(hhh]h)}(h"Cancel a matching deferred action.h]h"Cancel a matching deferred action.}(hj/hhhNhNubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMhj/hhubah}(h]h ]h"]h$]h&]uh1j^hj-hhhj-hMubeh}(h]h ](jfunctioneh"]h$]h&]jjjj/jj/jjjuh1hhhhhhNhNubj)}(hX**Parameters** ``struct kunit *test`` Test case the action is associated with. ``kunit_action_t *action`` The deferred function to cancel. ``void *ctx`` The context passed to the deferred function to trigger. **Description** Prevent an action deferred via kunit_add_action() from executing when the test terminates. If the function/context pair was deferred multiple times, only the most recent one will be cancelled. See also: devm_remove_action() for the devres equivalent.h](h)}(h**Parameters**h]j)}(hj'/h]h Parameters}(hj)/hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj%/ubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMhj!/ubj)}(hhh](j)}(h@``struct kunit *test`` Test case the action is associated with. h](j)}(h``struct kunit *test``h]j)}(hjF/h]hstruct kunit *test}(hjH/hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjD/ubah}(h]h ]h"]h$]h&]uh1jhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMhj@/ubj )}(hhh]h)}(h(Test case the action is associated with.h]h(Test case the action is associated with.}(hj_/hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj[/hMhj\/ubah}(h]h ]h"]h$]h&]uh1j hj@/ubeh}(h]h ]h"]h$]h&]uh1jhj[/hMhj=/ubj)}(h<``kunit_action_t *action`` The deferred function to cancel. h](j)}(h``kunit_action_t *action``h]j)}(hj/h]hkunit_action_t *action}(hj/hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj}/ubah}(h]h ]h"]h$]h&]uh1jhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMhjy/ubj )}(hhh]h)}(h The deferred function to cancel.h]h The deferred function to cancel.}(hj/hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj/hMhj/ubah}(h]h ]h"]h$]h&]uh1j hjy/ubeh}(h]h ]h"]h$]h&]uh1jhj/hMhj=/ubj)}(hF``void *ctx`` The context passed to the deferred function to trigger. h](j)}(h ``void *ctx``h]j)}(hj/h]h void *ctx}(hj/hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj/ubah}(h]h ]h"]h$]h&]uh1jhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMhj/ubj )}(hhh]h)}(h7The context passed to the deferred function to trigger.h]h7The context passed to the deferred function to trigger.}(hj/hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj/hMhj/ubah}(h]h ]h"]h$]h&]uh1j hj/ubeh}(h]h ]h"]h$]h&]uh1jhj/hMhj=/ubeh}(h]h ]h"]h$]h&]uh1jhj!/ubh)}(h**Description**h]j)}(hj/h]h Description}(hj/hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj/ubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMhj!/ubh)}(hZPrevent an action deferred via kunit_add_action() from executing when the test terminates.h]hZPrevent an action deferred via kunit_add_action() from executing when the test terminates.}(hj 0hhhNhNubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMhj!/ubh)}(heIf the function/context pair was deferred multiple times, only the most recent one will be cancelled.h]heIf the function/context pair was deferred multiple times, only the most recent one will be cancelled.}(hj0hhhNhNubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMhj!/ubh)}(h9See also: devm_remove_action() for the devres equivalent.h]h9See also: devm_remove_action() for the devres equivalent.}(hj'0hhhNhNubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMhj!/ubeh}(h]h ] kernelindentah"]h$]h&]uh1jhhhhhNhNubh)}(hhh]h}(h]h ]h"]h$]h&]entries](h!kunit_release_action (C function)c.kunit_release_actionhNtauh1hhhhhhNhNubh)}(hhh](h)}(hQvoid kunit_release_action (struct kunit *test, kunit_action_t *action, void *ctx)h]j)}(hPvoid kunit_release_action(struct kunit *test, kunit_action_t *action, void *ctx)h](jF)}(hvoidh]hvoid}(hjV0hhhNhNubah}(h]h ]jRah"]h$]h&]uh1jEhjR0hhhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMubj)}(h h]h }(hje0hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhjR0hhhjd0hMubj-)}(hkunit_release_actionh]j3)}(hkunit_release_actionh]hkunit_release_action}(hjw0hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hjs0ubah}(h]h ](jEjFeh"]h$]h&]hhuh1j,hjR0hhhjd0hMubj~)}(h7(struct kunit *test, kunit_action_t *action, void *ctx)h](j)}(hstruct kunit *testh](j )}(hj h]hstruct}(hj0hhhNhNubah}(h]h ]jah"]h$]h&]uh1j hj0ubj)}(h h]h }(hj0hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj0ubh)}(hhh]j3)}(hkunith]hkunit}(hj0hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj0ubah}(h]h ]h"]h$]h&] refdomainjreftypej reftargetj0modnameN classnameNjj)}j]j)}jjy0sbc.kunit_release_actionasbuh1hhj0ubj)}(h h]h }(hj0hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj0ubj)}(hjh]h*}(hj0hhhNhNubah}(h]h ]jah"]h$]h&]uh1jhj0ubj3)}(htesth]htest}(hj0hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj0ubeh}(h]h ]h"]h$]h&]noemphhhuh1jhj0ubj)}(hkunit_action_t *actionh](h)}(hhh]j3)}(hkunit_action_th]hkunit_action_t}(hj1hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj1ubah}(h]h ]h"]h$]h&] refdomainjreftypej reftargetj 1modnameN classnameNjj)}j]j0c.kunit_release_actionasbuh1hhj1ubj)}(h h]h }(hj&1hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj1ubj)}(hjh]h*}(hj41hhhNhNubah}(h]h ]jah"]h$]h&]uh1jhj1ubj3)}(hactionh]haction}(hjA1hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj1ubeh}(h]h ]h"]h$]h&]noemphhhuh1jhj0ubj)}(h void *ctxh](jF)}(hvoidh]hvoid}(hjZ1hhhNhNubah}(h]h ]jRah"]h$]h&]uh1jEhjV1ubj)}(h h]h }(hjh1hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhjV1ubj)}(hjh]h*}(hjv1hhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjV1ubj3)}(hctxh]hctx}(hj1hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hjV1ubeh}(h]h ]h"]h$]h&]noemphhhuh1jhj0ubeh}(h]h ]h"]h$]h&]hhuh1j}hjR0hhhjd0hMubeh}(h]h ]h"]h$]h&]hhjPuh1jjQjRhjN0hhhjd0hMubah}(h]jI0ah ](jVjWeh"]h$]h&]j[j\)j]huh1hhjd0hMhjK0hhubj_)}(hhh]h)}(h'Run a matching action call immediately.h]h'Run a matching action call immediately.}(hj1hhhNhNubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMhj1hhubah}(h]h ]h"]h$]h&]uh1j^hjK0hhhjd0hMubeh}(h]h ](jfunctioneh"]h$]h&]jjjj1jj1jjjuh1hhhhhhNhNubj)}(hX**Parameters** ``struct kunit *test`` Test case the action is associated with. ``kunit_action_t *action`` The deferred function to trigger. ``void *ctx`` The context passed to the deferred function to trigger. **Description** Execute a function deferred via kunit_add_action()) immediately, rather than when the test ends. If the function/context pair was deferred multiple times, it will only be executed once here. The most recent deferral will no longer execute when the test ends. kunit_release_action(test, func, ctx); is equivalent to func(ctx); kunit_remove_action(test, func, ctx); See also: devm_release_action() for the devres equivalent.h](h)}(h**Parameters**h]j)}(hj1h]h Parameters}(hj1hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj1ubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMhj1ubj)}(hhh](j)}(h@``struct kunit *test`` Test case the action is associated with. h](j)}(h``struct kunit *test``h]j)}(hj1h]hstruct kunit *test}(hj1hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj1ubah}(h]h ]h"]h$]h&]uh1jhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMhj1ubj )}(hhh]h)}(h(Test case the action is associated with.h]h(Test case the action is associated with.}(hj2hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj2hMhj2ubah}(h]h ]h"]h$]h&]uh1j hj1ubeh}(h]h ]h"]h$]h&]uh1jhj2hMhj1ubj)}(h=``kunit_action_t *action`` The deferred function to trigger. h](j)}(h``kunit_action_t *action``h]j)}(hj'2h]hkunit_action_t *action}(hj)2hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj%2ubah}(h]h ]h"]h$]h&]uh1jhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMhj!2ubj )}(hhh]h)}(h!The deferred function to trigger.h]h!The deferred function to trigger.}(hj@2hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj<2hMhj=2ubah}(h]h ]h"]h$]h&]uh1j hj!2ubeh}(h]h ]h"]h$]h&]uh1jhj<2hMhj1ubj)}(hF``void *ctx`` The context passed to the deferred function to trigger. h](j)}(h ``void *ctx``h]j)}(hj`2h]h void *ctx}(hjb2hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj^2ubah}(h]h ]h"]h$]h&]uh1jhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMhjZ2ubj )}(hhh]h)}(h7The context passed to the deferred function to trigger.h]h7The context passed to the deferred function to trigger.}(hjy2hhhNhNubah}(h]h ]h"]h$]h&]uh1hhju2hMhjv2ubah}(h]h ]h"]h$]h&]uh1j hjZ2ubeh}(h]h ]h"]h$]h&]uh1jhju2hMhj1ubeh}(h]h ]h"]h$]h&]uh1jhj1ubh)}(h**Description**h]j)}(hj2h]h Description}(hj2hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj2ubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMhj1ubh)}(h`Execute a function deferred via kunit_add_action()) immediately, rather than when the test ends.h]h`Execute a function deferred via kunit_add_action()) immediately, rather than when the test ends.}(hj2hhhNhNubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMhj1ubh)}(hIf the function/context pair was deferred multiple times, it will only be executed once here. The most recent deferral will no longer execute when the test ends.h]hIf the function/context pair was deferred multiple times, it will only be executed once here. The most recent deferral will no longer execute when the test ends.}(hj2hhhNhNubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMhj1ubh)}(hhkunit_release_action(test, func, ctx); is equivalent to func(ctx); kunit_remove_action(test, func, ctx);h]hhkunit_release_action(test, func, ctx); is equivalent to func(ctx); kunit_remove_action(test, func, ctx);}(hj2hhhNhNubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMhj1ubh)}(h:See also: devm_release_action() for the devres equivalent.h]h:See also: devm_release_action() for the devres equivalent.}(hj2hhhNhNubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:12: ./include/kunit/resource.hhMhj1ubeh}(h]h ] kernelindentah"]h$]h&]uh1jhhhhhNhNubh)}(hhh](h)}(hManaged Devicesh]hManaged Devices}(hj2hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj2hhhhhKubh)}(hrFunctions for using KUnit-managed struct device and struct device_driver. Include ``kunit/device.h`` to use these.h](hRFunctions for using KUnit-managed struct device and struct device_driver. Include }(hj3hhhNhNubj)}(h``kunit/device.h``h]hkunit/device.h}(hj 3hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj3ubh to use these.}(hj3hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj2hhubh)}(hhh]h}(h]h ]h"]h$]h&]entries](h kunit_driver_create (C function)c.kunit_driver_createhNtauh1hhj2hhhNhNubh)}(hhh](h)}(hQstruct device_driver * kunit_driver_create (struct kunit *test, const char *name)h]j)}(hOstruct device_driver *kunit_driver_create(struct kunit *test, const char *name)h](j )}(hj h]hstruct}(hj>3hhhNhNubah}(h]h ]jah"]h$]h&]uh1j hj:3hhhc/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:21: ./include/kunit/device.hhKubj)}(h h]h }(hjL3hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj:3hhhjK3hKubh)}(hhh]j3)}(h device_driverh]h device_driver}(hj]3hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hjZ3ubah}(h]h ]h"]h$]h&] refdomainjreftypej reftargetj_3modnameN classnameNjj)}j]j)}jkunit_driver_createsbc.kunit_driver_createasbuh1hhj:3hhhjK3hKubj)}(h h]h }(hj~3hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj:3hhhjK3hKubj)}(hjh]h*}(hj3hhhNhNubah}(h]h ]jah"]h$]h&]uh1jhj:3hhhjK3hKubj-)}(hkunit_driver_createh]j3)}(hj{3h]hkunit_driver_create}(hj3hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj3ubah}(h]h ](jEjFeh"]h$]h&]hhuh1j,hj:3hhhjK3hKubj~)}(h&(struct kunit *test, const char *name)h](j)}(hstruct kunit *testh](j )}(hj h]hstruct}(hj3hhhNhNubah}(h]h ]jah"]h$]h&]uh1j hj3ubj)}(h h]h }(hj3hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj3ubh)}(hhh]j3)}(hkunith]hkunit}(hj3hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj3ubah}(h]h ]h"]h$]h&] refdomainjreftypej reftargetj3modnameN classnameNjj)}j]jy3c.kunit_driver_createasbuh1hhj3ubj)}(h h]h }(hj3hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj3ubj)}(hjh]h*}(hj4hhhNhNubah}(h]h ]jah"]h$]h&]uh1jhj3ubj3)}(htesth]htest}(hj4hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj3ubeh}(h]h ]h"]h$]h&]noemphhhuh1jhj3ubj)}(hconst char *nameh](j )}(hjCh]hconst}(hj(4hhhNhNubah}(h]h ]jah"]h$]h&]uh1j hj$4ubj)}(h h]h }(hj54hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj$4ubjF)}(hcharh]hchar}(hjC4hhhNhNubah}(h]h ]jRah"]h$]h&]uh1jEhj$4ubj)}(h h]h }(hjQ4hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj$4ubj)}(hjh]h*}(hj_4hhhNhNubah}(h]h ]jah"]h$]h&]uh1jhj$4ubj3)}(hnameh]hname}(hjl4hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj$4ubeh}(h]h ]h"]h$]h&]noemphhhuh1jhj3ubeh}(h]h ]h"]h$]h&]hhuh1j}hj:3hhhjK3hKubeh}(h]h ]h"]h$]h&]hhjPuh1jjQjRhj63hhhjK3hKubah}(h]j13ah ](jVjWeh"]h$]h&]j[j\)j]huh1hhjK3hKhj33hhubj_)}(hhh]h)}(h7Create a struct device_driver attached to the kunit_bush]h7Create a struct device_driver attached to the kunit_bus}(hj4hhhNhNubah}(h]h ]h"]h$]h&]uh1hhc/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:21: ./include/kunit/device.hhKhj4hhubah}(h]h ]h"]h$]h&]uh1j^hj33hhhjK3hKubeh}(h]h ](jfunctioneh"]h$]h&]jjjj4jj4jjjuh1hhhhj2hNhNubj)}(hXq**Parameters** ``struct kunit *test`` The test context object. ``const char *name`` The name to give the created driver. **Description** Creates a struct device_driver attached to the kunit_bus, with the name **name**. This driver will automatically be cleaned up on test exit. **Return** a stub struct device_driver, managed by KUnit, with the name **name**.h](h)}(h**Parameters**h]j)}(hj4h]h Parameters}(hj4hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj4ubah}(h]h ]h"]h$]h&]uh1hhc/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:21: ./include/kunit/device.hhKhj4ubj)}(hhh](j)}(h0``struct kunit *test`` The test context object. h](j)}(h``struct kunit *test``h]j)}(hj4h]hstruct kunit *test}(hj4hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj4ubah}(h]h ]h"]h$]h&]uh1jhc/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:21: ./include/kunit/device.hhKhj4ubj )}(hhh]h)}(hThe test context object.h]hThe test context object.}(hj4hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj4hKhj4ubah}(h]h ]h"]h$]h&]uh1j hj4ubeh}(h]h ]h"]h$]h&]uh1jhj4hKhj4ubj)}(h:``const char *name`` The name to give the created driver. h](j)}(h``const char *name``h]j)}(hj5h]hconst char *name}(hj5hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj5ubah}(h]h ]h"]h$]h&]uh1jhc/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:21: ./include/kunit/device.hhKhj 5ubj )}(hhh]h)}(h$The name to give the created driver.h]h$The name to give the created driver.}(hj)5hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj%5hKhj&5ubah}(h]h ]h"]h$]h&]uh1j hj 5ubeh}(h]h ]h"]h$]h&]uh1jhj%5hKhj4ubeh}(h]h ]h"]h$]h&]uh1jhj4ubh)}(h**Description**h]j)}(hjK5h]h Description}(hjM5hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjI5ubah}(h]h ]h"]h$]h&]uh1hhc/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:21: ./include/kunit/device.hhKhj4ubh)}(hCreates a struct device_driver attached to the kunit_bus, with the name **name**. This driver will automatically be cleaned up on test exit.h](hHCreates a struct device_driver attached to the kunit_bus, with the name }(hja5hhhNhNubj)}(h**name**h]hname}(hji5hhhNhNubah}(h]h ]h"]h$]h&]uh1jhja5ubh<. This driver will automatically be cleaned up on test exit.}(hja5hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhc/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:21: ./include/kunit/device.hhKhj4ubh)}(h **Return**h]j)}(hj5h]hReturn}(hj5hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj5ubah}(h]h ]h"]h$]h&]uh1hhc/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:21: ./include/kunit/device.hhKhj4ubh)}(hFa stub struct device_driver, managed by KUnit, with the name **name**.h](h=a stub struct device_driver, managed by KUnit, with the name }(hj5hhhNhNubj)}(h**name**h]hname}(hj5hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj5ubh.}(hj5hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhc/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:21: ./include/kunit/device.hhKhj4ubeh}(h]h ] kernelindentah"]h$]h&]uh1jhj2hhhNhNubh)}(hhh]h}(h]h ]h"]h$]h&]entries](h"kunit_device_register (C function)c.kunit_device_registerhNtauh1hhj2hhhNhNubh)}(hhh](h)}(hLstruct device * kunit_device_register (struct kunit *test, const char *name)h]j)}(hJstruct device *kunit_device_register(struct kunit *test, const char *name)h](j )}(hj h]hstruct}(hj5hhhNhNubah}(h]h ]jah"]h$]h&]uh1j hj5hhhc/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:21: ./include/kunit/device.hhK"ubj)}(h h]h }(hj5hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj5hhhj5hK"ubh)}(hhh]j3)}(hdeviceh]hdevice}(hj5hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj5ubah}(h]h ]h"]h$]h&] refdomainjreftypej reftargetj5modnameN classnameNjj)}j]j)}jkunit_device_registersbc.kunit_device_registerasbuh1hhj5hhhj5hK"ubj)}(h h]h }(hj6hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj5hhhj5hK"ubj)}(hjh]h*}(hj)6hhhNhNubah}(h]h ]jah"]h$]h&]uh1jhj5hhhj5hK"ubj-)}(hkunit_device_registerh]j3)}(hj6h]hkunit_device_register}(hj:6hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj66ubah}(h]h ](jEjFeh"]h$]h&]hhuh1j,hj5hhhj5hK"ubj~)}(h&(struct kunit *test, const char *name)h](j)}(hstruct kunit *testh](j )}(hj h]hstruct}(hjU6hhhNhNubah}(h]h ]jah"]h$]h&]uh1j hjQ6ubj)}(h h]h }(hjb6hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhjQ6ubh)}(hhh]j3)}(hkunith]hkunit}(hjs6hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hjp6ubah}(h]h ]h"]h$]h&] refdomainjreftypej reftargetju6modnameN classnameNjj)}j]j6c.kunit_device_registerasbuh1hhjQ6ubj)}(h h]h }(hj6hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhjQ6ubj)}(hjh]h*}(hj6hhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjQ6ubj3)}(htesth]htest}(hj6hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hjQ6ubeh}(h]h ]h"]h$]h&]noemphhhuh1jhjM6ubj)}(hconst char *nameh](j )}(hjCh]hconst}(hj6hhhNhNubah}(h]h ]jah"]h$]h&]uh1j hj6ubj)}(h h]h }(hj6hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj6ubjF)}(hcharh]hchar}(hj6hhhNhNubah}(h]h ]jRah"]h$]h&]uh1jEhj6ubj)}(h h]h }(hj6hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj6ubj)}(hjh]h*}(hj6hhhNhNubah}(h]h ]jah"]h$]h&]uh1jhj6ubj3)}(hnameh]hname}(hj 7hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj6ubeh}(h]h ]h"]h$]h&]noemphhhuh1jhjM6ubeh}(h]h ]h"]h$]h&]hhuh1j}hj5hhhj5hK"ubeh}(h]h ]h"]h$]h&]hhjPuh1jjQjRhj5hhhj5hK"ubah}(h]j5ah ](jVjWeh"]h$]h&]j[j\)j]huh1hhj5hK"hj5hhubj_)}(hhh]h)}(h-Create a struct device for use in KUnit testsh]h-Create a struct device for use in KUnit tests}(hj37hhhNhNubah}(h]h ]h"]h$]h&]uh1hhc/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:21: ./include/kunit/device.hhK"hj07hhubah}(h]h ]h"]h$]h&]uh1j^hj5hhhj5hK"ubeh}(h]h ](jfunctioneh"]h$]h&]jjjjK7jjK7jjjuh1hhhhj2hNhNubj)}(hX^**Parameters** ``struct kunit *test`` The test context object. ``const char *name`` The name to give the created device. **Description** Creates a struct kunit_device (which is a struct device) with the given name, and a corresponding driver. The device and driver will be cleaned up on test exit, or when kunit_device_unregister is called. See also kunit_device_register_with_driver, if you wish to provide your own struct device_driver. **Return** a pointer to a struct device which will be cleaned up when the test exits, or an error pointer if the device could not be allocated or registered.h](h)}(h**Parameters**h]j)}(hjU7h]h Parameters}(hjW7hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjS7ubah}(h]h ]h"]h$]h&]uh1hhc/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:21: ./include/kunit/device.hhK&hjO7ubj)}(hhh](j)}(h0``struct kunit *test`` The test context object. h](j)}(h``struct kunit *test``h]j)}(hjt7h]hstruct kunit *test}(hjv7hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjr7ubah}(h]h ]h"]h$]h&]uh1jhc/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:21: ./include/kunit/device.hhK#hjn7ubj )}(hhh]h)}(hThe test context object.h]hThe test context object.}(hj7hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj7hK#hj7ubah}(h]h ]h"]h$]h&]uh1j hjn7ubeh}(h]h ]h"]h$]h&]uh1jhj7hK#hjk7ubj)}(h:``const char *name`` The name to give the created device. h](j)}(h``const char *name``h]j)}(hj7h]hconst char *name}(hj7hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj7ubah}(h]h ]h"]h$]h&]uh1jhc/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:21: ./include/kunit/device.hhK$hj7ubj )}(hhh]h)}(h$The name to give the created device.h]h$The name to give the created device.}(hj7hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj7hK$hj7ubah}(h]h ]h"]h$]h&]uh1j hj7ubeh}(h]h ]h"]h$]h&]uh1jhj7hK$hjk7ubeh}(h]h ]h"]h$]h&]uh1jhjO7ubh)}(h**Description**h]j)}(hj7h]h Description}(hj7hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj7ubah}(h]h ]h"]h$]h&]uh1hhc/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:21: ./include/kunit/device.hhK&hjO7ubh)}(hX-Creates a struct kunit_device (which is a struct device) with the given name, and a corresponding driver. The device and driver will be cleaned up on test exit, or when kunit_device_unregister is called. See also kunit_device_register_with_driver, if you wish to provide your own struct device_driver.h]hX-Creates a struct kunit_device (which is a struct device) with the given name, and a corresponding driver. The device and driver will be cleaned up on test exit, or when kunit_device_unregister is called. See also kunit_device_register_with_driver, if you wish to provide your own struct device_driver.}(hj7hhhNhNubah}(h]h ]h"]h$]h&]uh1hhc/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:21: ./include/kunit/device.hhK&hjO7ubh)}(h **Return**h]j)}(hj8h]hReturn}(hj8hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj 8ubah}(h]h ]h"]h$]h&]uh1hhc/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:21: ./include/kunit/device.hhK,hjO7ubh)}(ha pointer to a struct device which will be cleaned up when the test exits, or an error pointer if the device could not be allocated or registered.h]ha pointer to a struct device which will be cleaned up when the test exits, or an error pointer if the device could not be allocated or registered.}(hj%8hhhNhNubah}(h]h ]h"]h$]h&]uh1hhc/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:21: ./include/kunit/device.hhK,hjO7ubeh}(h]h ] kernelindentah"]h$]h&]uh1jhj2hhhNhNubh)}(hhh]h}(h]h ]h"]h$]h&]entries](h.kunit_device_register_with_driver (C function)#c.kunit_device_register_with_driverhNtauh1hhj2hhhNhNubh)}(hhh](h)}(hystruct device * kunit_device_register_with_driver (struct kunit *test, const char *name, const struct device_driver *drv)h]j)}(hwstruct device *kunit_device_register_with_driver(struct kunit *test, const char *name, const struct device_driver *drv)h](j )}(hj h]hstruct}(hjT8hhhNhNubah}(h]h ]jah"]h$]h&]uh1j hjP8hhhc/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:21: ./include/kunit/device.hhK2ubj)}(h h]h }(hjb8hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhjP8hhhja8hK2ubh)}(hhh]j3)}(hdeviceh]hdevice}(hjs8hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hjp8ubah}(h]h ]h"]h$]h&] refdomainjreftypej reftargetju8modnameN classnameNjj)}j]j)}j!kunit_device_register_with_driversb#c.kunit_device_register_with_driverasbuh1hhjP8hhhja8hK2ubj)}(h h]h }(hj8hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhjP8hhhja8hK2ubj)}(hjh]h*}(hj8hhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjP8hhhja8hK2ubj-)}(h!kunit_device_register_with_driverh]j3)}(hj8h]h!kunit_device_register_with_driver}(hj8hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj8ubah}(h]h ](jEjFeh"]h$]h&]hhuh1j,hjP8hhhja8hK2ubj~)}(hG(struct kunit *test, const char *name, const struct device_driver *drv)h](j)}(hstruct kunit *testh](j )}(hj h]hstruct}(hj8hhhNhNubah}(h]h ]jah"]h$]h&]uh1j hj8ubj)}(h h]h }(hj8hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj8ubh)}(hhh]j3)}(hkunith]hkunit}(hj8hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj8ubah}(h]h ]h"]h$]h&] refdomainjreftypej reftargetj8modnameN classnameNjj)}j]j8#c.kunit_device_register_with_driverasbuh1hhj8ubj)}(h h]h }(hj 9hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj8ubj)}(hjh]h*}(hj9hhhNhNubah}(h]h ]jah"]h$]h&]uh1jhj8ubj3)}(htesth]htest}(hj%9hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj8ubeh}(h]h ]h"]h$]h&]noemphhhuh1jhj8ubj)}(hconst char *nameh](j )}(hjCh]hconst}(hj>9hhhNhNubah}(h]h ]jah"]h$]h&]uh1j hj:9ubj)}(h h]h }(hjK9hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj:9ubjF)}(hcharh]hchar}(hjY9hhhNhNubah}(h]h ]jRah"]h$]h&]uh1jEhj:9ubj)}(h h]h }(hjg9hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj:9ubj)}(hjh]h*}(hju9hhhNhNubah}(h]h ]jah"]h$]h&]uh1jhj:9ubj3)}(hnameh]hname}(hj9hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj:9ubeh}(h]h ]h"]h$]h&]noemphhhuh1jhj8ubj)}(hconst struct device_driver *drvh](j )}(hjCh]hconst}(hj9hhhNhNubah}(h]h ]jah"]h$]h&]uh1j hj9ubj)}(h h]h }(hj9hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj9ubj )}(hj h]hstruct}(hj9hhhNhNubah}(h]h ]jah"]h$]h&]uh1j hj9ubj)}(h h]h }(hj9hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj9ubh)}(hhh]j3)}(h device_driverh]h device_driver}(hj9hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj9ubah}(h]h ]h"]h$]h&] refdomainjreftypej reftargetj9modnameN classnameNjj)}j]j8#c.kunit_device_register_with_driverasbuh1hhj9ubj)}(h h]h }(hj9hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj9ubj)}(hjh]h*}(hj:hhhNhNubah}(h]h ]jah"]h$]h&]uh1jhj9ubj3)}(hdrvh]hdrv}(hj :hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj9ubeh}(h]h ]h"]h$]h&]noemphhhuh1jhj8ubeh}(h]h ]h"]h$]h&]hhuh1j}hjP8hhhja8hK2ubeh}(h]h ]h"]h$]h&]hhjPuh1jjQjRhjL8hhhja8hK2ubah}(h]jG8ah ](jVjWeh"]h$]h&]j[j\)j]huh1hhja8hK2hjI8hhubj_)}(hhh]h)}(h-Create a struct device for use in KUnit testsh]h-Create a struct device for use in KUnit tests}(hj7:hhhNhNubah}(h]h ]h"]h$]h&]uh1hhc/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:21: ./include/kunit/device.hhK2hj4:hhubah}(h]h ]h"]h$]h&]uh1j^hjI8hhhja8hK2ubeh}(h]h ](jfunctioneh"]h$]h&]jjjjO:jjO:jjjuh1hhhhj2hNhNubj)}(hX**Parameters** ``struct kunit *test`` The test context object. ``const char *name`` The name to give the created device. ``const struct device_driver *drv`` The struct device_driver to associate with the device. **Description** Creates a struct kunit_device (which is a struct device) with the given name, and driver. The device will be cleaned up on test exit, or when kunit_device_unregister is called. See also kunit_device_register, if you wish KUnit to create and manage a driver for you. **Return** a pointer to a struct device which will be cleaned up when the test exits, or an error pointer if the device could not be allocated or registered.h](h)}(h**Parameters**h]j)}(hjY:h]h Parameters}(hj[:hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjW:ubah}(h]h ]h"]h$]h&]uh1hhc/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:21: ./include/kunit/device.hhK6hjS:ubj)}(hhh](j)}(h0``struct kunit *test`` The test context object. h](j)}(h``struct kunit *test``h]j)}(hjx:h]hstruct kunit *test}(hjz:hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjv:ubah}(h]h ]h"]h$]h&]uh1jhc/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:21: ./include/kunit/device.hhK3hjr:ubj )}(hhh]h)}(hThe test context object.h]hThe test context object.}(hj:hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj:hK3hj:ubah}(h]h ]h"]h$]h&]uh1j hjr:ubeh}(h]h ]h"]h$]h&]uh1jhj:hK3hjo:ubj)}(h:``const char *name`` The name to give the created device. h](j)}(h``const char *name``h]j)}(hj:h]hconst char *name}(hj:hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj:ubah}(h]h ]h"]h$]h&]uh1jhc/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:21: ./include/kunit/device.hhK4hj:ubj )}(hhh]h)}(h$The name to give the created device.h]h$The name to give the created device.}(hj:hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj:hK4hj:ubah}(h]h ]h"]h$]h&]uh1j hj:ubeh}(h]h ]h"]h$]h&]uh1jhj:hK4hjo:ubj)}(h[``const struct device_driver *drv`` The struct device_driver to associate with the device. h](j)}(h#``const struct device_driver *drv``h]j)}(hj:h]hconst struct device_driver *drv}(hj:hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj:ubah}(h]h ]h"]h$]h&]uh1jhc/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:21: ./include/kunit/device.hhK5hj:ubj )}(hhh]h)}(h6The struct device_driver to associate with the device.h]h6The struct device_driver to associate with the device.}(hj;hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj:hK5hj;ubah}(h]h ]h"]h$]h&]uh1j hj:ubeh}(h]h ]h"]h$]h&]uh1jhj:hK5hjo:ubeh}(h]h ]h"]h$]h&]uh1jhjS:ubh)}(h**Description**h]j)}(hj%;h]h Description}(hj';hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj#;ubah}(h]h ]h"]h$]h&]uh1hhc/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:21: ./include/kunit/device.hhK7hjS:ubh)}(hX Creates a struct kunit_device (which is a struct device) with the given name, and driver. The device will be cleaned up on test exit, or when kunit_device_unregister is called. See also kunit_device_register, if you wish KUnit to create and manage a driver for you.h]hX Creates a struct kunit_device (which is a struct device) with the given name, and driver. The device will be cleaned up on test exit, or when kunit_device_unregister is called. See also kunit_device_register, if you wish KUnit to create and manage a driver for you.}(hj;;hhhNhNubah}(h]h ]h"]h$]h&]uh1hhc/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:21: ./include/kunit/device.hhK7hjS:ubh)}(h **Return**h]j)}(hjL;h]hReturn}(hjN;hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjJ;ubah}(h]h ]h"]h$]h&]uh1hhc/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:21: ./include/kunit/device.hhKah"]h$]h&]uh1j2hj;ubah}(h]h ](jEjFeh"]h$]h&]hhuh1j,hj;hhhj;hKDubj~)}(h((struct kunit *test, struct device *dev)h](j)}(hstruct kunit *testh](j )}(hj h]hstruct}(hj;hhhNhNubah}(h]h ]jah"]h$]h&]uh1j hj;ubj)}(h h]h }(hj;hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj;ubh)}(hhh]j3)}(hkunith]hkunit}(hj;hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj;ubah}(h]h ]h"]h$]h&] refdomainjreftypej reftargetj;modnameN classnameNjj)}j]j)}jj;sbc.kunit_device_unregisterasbuh1hhj;ubj)}(h h]h }(hj <hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj;ubj)}(hjh]h*}(hj<hhhNhNubah}(h]h ]jah"]h$]h&]uh1jhj;ubj3)}(htesth]htest}(hj'<hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj;ubeh}(h]h ]h"]h$]h&]noemphhhuh1jhj;ubj)}(hstruct device *devh](j )}(hj h]hstruct}(hj@<hhhNhNubah}(h]h ]jah"]h$]h&]uh1j hj<<ubj)}(h h]h }(hjM<hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj<<ubh)}(hhh]j3)}(hdeviceh]hdevice}(hj^<hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj[<ubah}(h]h ]h"]h$]h&] refdomainjreftypej reftargetj`<modnameN classnameNjj)}j]j<c.kunit_device_unregisterasbuh1hhj<<ubj)}(h h]h }(hj|<hhhNhNubah}(h]h ]j(ah"]h$]h&]uh1jhj<<ubj)}(hjh]h*}(hj<hhhNhNubah}(h]h ]jah"]h$]h&]uh1jhj<<ubj3)}(hdevh]hdev}(hj<hhhNhNubah}(h]h ]j>ah"]h$]h&]uh1j2hj<<ubeh}(h]h ]h"]h$]h&]noemphhhuh1jhj;ubeh}(h]h ]h"]h$]h&]hhuh1j}hj;hhhj;hKDubeh}(h]h ]h"]h$]h&]hhjPuh1jjQjRhj;hhhj;hKDubah}(h]j;ah ](jVjWeh"]h$]h&]j[j\)j]huh1hhj;hKDhj;hhubj_)}(hhh]h)}(h!Unregister a KUnit-managed deviceh]h!Unregister a KUnit-managed device}(hj<hhhNhNubah}(h]h ]h"]h$]h&]uh1hhc/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:21: ./include/kunit/device.hhKDhj<hhubah}(h]h ]h"]h$]h&]uh1j^hj;hhhj;hKDubeh}(h]h ](jfunctioneh"]h$]h&]jjjj<jj<jjjuh1hhhhj2hNhNubj)}(hX>**Parameters** ``struct kunit *test`` The test context object which created the device ``struct device *dev`` The device. **Description** Unregisters and destroys a struct device which was created with kunit_device_register or kunit_device_register_with_driver. If KUnit created a driver, cleans it up as well.h](h)}(h**Parameters**h]j)}(hj<h]h Parameters}(hj<hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj<ubah}(h]h ]h"]h$]h&]uh1hhc/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:21: ./include/kunit/device.hhKHhj<ubj)}(hhh](j)}(hH``struct kunit *test`` The test context object which created the device h](j)}(h``struct kunit *test``h]j)}(hj=h]hstruct kunit *test}(hj=hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj=ubah}(h]h ]h"]h$]h&]uh1jhc/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:21: ./include/kunit/device.hhKEhj<ubj )}(hhh]h)}(h0The test context object which created the deviceh]h0The test context object which created the device}(hj=hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj=hKEhj=ubah}(h]h ]h"]h$]h&]uh1j hj<ubeh}(h]h ]h"]h$]h&]uh1jhj=hKEhj<ubj)}(h#``struct device *dev`` The device. h](j)}(h``struct device *dev``h]j)}(hj;=h]hstruct device *dev}(hj==hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj9=ubah}(h]h ]h"]h$]h&]uh1jhc/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:21: ./include/kunit/device.hhKFhj5=ubj )}(hhh]h)}(h The device.h]h The device.}(hjT=hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjP=hKFhjQ=ubah}(h]h ]h"]h$]h&]uh1j hj5=ubeh}(h]h ]h"]h$]h&]uh1jhjP=hKFhj<ubeh}(h]h ]h"]h$]h&]uh1jhj<ubh)}(h**Description**h]j)}(hjv=h]h Description}(hjx=hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjt=ubah}(h]h ]h"]h$]h&]uh1hhc/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:21: ./include/kunit/device.hhKHhj<ubh)}(hUnregisters and destroys a struct device which was created with kunit_device_register or kunit_device_register_with_driver. If KUnit created a driver, cleans it up as well.h]hUnregisters and destroys a struct device which was created with kunit_device_register or kunit_device_register_with_driver. If KUnit created a driver, cleans it up as well.}(hj=hhhNhNubah}(h]h ]h"]h$]h&]uh1hhc/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/resource:21: ./include/kunit/device.hhKHhj<ubeh}(h]h ] kernelindentah"]h$]h&]uh1jhj2hhhNhNubeh}(h]managed-devicesah ]h"]managed devicesah$]h&]uh1hhhhhhhhKubeh}(h] resource-apiah ]h"] resource apiah$]h&]uh1hhhhhhhhKubeh}(h]h ]h"]h$]h&]sourcehuh1hcurrent_sourceN current_lineNsettingsdocutils.frontendValues)}(hN generatorN datestampN source_linkN source_urlN toc_backlinksentryfootnote_backlinksK sectnum_xformKstrip_commentsNstrip_elements_with_classesN strip_classesN report_levelK halt_levelKexit_status_levelKdebugNwarning_streamN tracebackinput_encoding utf-8-siginput_encoding_error_handlerstrictoutput_encodingutf-8output_encoding_error_handlerj=error_encodingutf-8error_encoding_error_handlerbackslashreplace language_codeenrecord_dependenciesNconfigN id_prefixhauto_id_prefixid dump_settingsNdump_internalsNdump_transformsNdump_pseudo_xmlNexpose_internalsNstrict_visitorN_disable_configN_sourceh _destinationN _config_files]7/var/lib/git/docbuild/linux/Documentation/docutils.confafile_insertion_enabled raw_enabledKline_length_limitM'pep_referencesN pep_base_urlhttps://peps.python.org/pep_file_url_templatepep-%04drfc_referencesN rfc_base_url&https://datatracker.ietf.org/doc/html/ tab_widthKtrim_footnote_reference_spacesyntax_highlightlong smart_quotessmartquotes_locales]character_level_inline_markupdoctitle_xform docinfo_xformKsectsubtitle_xform image_loadinglinkembed_stylesheetcloak_email_addressessection_self_linkenvNubreporterNindirect_targets]substitution_defs}substitution_names}refnames}refids}nameids}(j=j=j=j=u nametypes}(j=j=uh}(j=hhhj8j=jjjjj j j j jjjjj jjjjj jG!jL!j#j#j&j&j'j'j*j*j-j-jI0jN0j=j2j13j63j5j5jG8jL8j;j;u footnote_refs} citation_refs} autofootnotes]autofootnote_refs]symbol_footnotes]symbol_footnote_refs] footnotes] citations]autofootnote_startKsymbol_footnote_startK id_counter collectionsCounter}Rparse_messages]transform_messages] transformerN include_log] decorationNhhub.