sphinx.addnodesdocument)}( rawsourcechildren]( translations LanguagesNode)}(hhh](h pending_xref)}(hhh]docutils.nodesTextChinese (Simplified)}parenthsba attributes}(ids]classes]names]dupnames]backrefs] refdomainstdreftypedoc reftarget6/translations/zh_CN/dev-tools/kunit/api/platformdevicemodnameN classnameN refexplicitutagnamehhh ubh)}(hhh]hChinese (Traditional)}hh2sbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget6/translations/zh_TW/dev-tools/kunit/api/platformdevicemodnameN classnameN refexplicituh1hhh ubh)}(hhh]hItalian}hhFsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget6/translations/it_IT/dev-tools/kunit/api/platformdevicemodnameN classnameN refexplicituh1hhh ubh)}(hhh]hJapanese}hhZsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget6/translations/ja_JP/dev-tools/kunit/api/platformdevicemodnameN classnameN refexplicituh1hhh ubh)}(hhh]hKorean}hhnsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget6/translations/ko_KR/dev-tools/kunit/api/platformdevicemodnameN classnameN refexplicituh1hhh ubh)}(hhh]hPortuguese (Brazilian)}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget6/translations/pt_BR/dev-tools/kunit/api/platformdevicemodnameN classnameN refexplicituh1hhh ubh)}(hhh]hSpanish}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget6/translations/sp_SP/dev-tools/kunit/api/platformdevicemodnameN 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:spacepreserveuh1hhhhhhP/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice.rsthKubhsection)}(hhh](htitle)}(hPlatform Device APIh]hPlatform Device API}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhKubh paragraph)}(h?The KUnit platform device API is used to test platform devices.h]h?The KUnit platform device API is used to test platform devices.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubhindex)}(hhh]h}(h]h ]h"]h$]h&]entries](single(kunit_platform_device_alloc (C function)c.kunit_platform_device_allochNtauh1hhhhhhNhNubhdesc)}(hhh](hdesc_signature)}(hcstruct platform_device * kunit_platform_device_alloc (struct kunit *test, const char *name, int id)h]hdesc_signature_line)}(hastruct platform_device *kunit_platform_device_alloc(struct kunit *test, const char *name, int id)h](hdesc_sig_keyword)}(hstructh]hstruct}(hjhhhNhNubah}(h]h ]kah"]h$]h&]uh1jhj hhhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chK*ubhdesc_sig_space)}(h h]h }(hj#hhhNhNubah}(h]h ]wah"]h$]h&]uh1j!hj hhhj hK*ubh)}(hhh]h desc_sig_name)}(hplatform_deviceh]hplatform_device}(hj7hhhNhNubah}(h]h ]nah"]h$]h&]uh1j5hj2ubah}(h]h ]h"]h$]h&] refdomaincreftype identifier reftargetj9modnameN classnameN c:parent_keysphinx.domains.c LookupKey)}data]jT ASTIdentifier)}jOkunit_platform_device_allocsbc.kunit_platform_device_allocasbuh1hhj hhhj hK*ubj")}(h h]h }(hjbhhhNhNubah}(h]h ]j.ah"]h$]h&]uh1j!hj hhhj hK*ubhdesc_sig_punctuation)}(h*h]h*}(hjrhhhNhNubah}(h]h ]pah"]h$]h&]uh1jphj hhhj hK*ubh desc_name)}(hkunit_platform_device_alloch]j6)}(hj_h]hkunit_platform_device_alloc}(hjhhhNhNubah}(h]h ]jBah"]h$]h&]uh1j5hjubah}(h]h ](sig-namedescnameeh"]h$]h&]hhuh1jhj hhhj hK*ubhdesc_parameterlist)}(h.(struct kunit *test, const char *name, int id)h](hdesc_parameter)}(hstruct kunit *testh](j)}(hjh]hstruct}(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjubj")}(h h]h }(hjhhhNhNubah}(h]h ]j.ah"]h$]h&]uh1j!hjubh)}(hhh]j6)}(hkunith]hkunit}(hjhhhNhNubah}(h]h ]jBah"]h$]h&]uh1j5hjubah}(h]h ]h"]h$]h&] refdomainjMreftypejO reftargetjmodnameN classnameNjSjV)}jY]j]c.kunit_platform_device_allocasbuh1hhjubj")}(h h]h }(hjhhhNhNubah}(h]h ]j.ah"]h$]h&]uh1j!hjubjq)}(hjth]h*}(hjhhhNhNubah}(h]h ]j}ah"]h$]h&]uh1jphjubj6)}(htesth]htest}(hjhhhNhNubah}(h]h ]jBah"]h$]h&]uh1j5hjubeh}(h]h ]h"]h$]h&]noemphhhuh1jhjubj)}(hconst char *nameh](j)}(hconsth]hconst}(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjubj")}(h h]h }(hj&hhhNhNubah}(h]h ]j.ah"]h$]h&]uh1j!hjubhdesc_sig_keyword_type)}(hcharh]hchar}(hj6hhhNhNubah}(h]h ]ktah"]h$]h&]uh1j4hjubj")}(h h]h }(hjEhhhNhNubah}(h]h ]j.ah"]h$]h&]uh1j!hjubjq)}(hjth]h*}(hjShhhNhNubah}(h]h ]j}ah"]h$]h&]uh1jphjubj6)}(hnameh]hname}(hj`hhhNhNubah}(h]h ]jBah"]h$]h&]uh1j5hjubeh}(h]h ]h"]h$]h&]noemphhhuh1jhjubj)}(hint idh](j5)}(hinth]hint}(hjyhhhNhNubah}(h]h ]jAah"]h$]h&]uh1j4hjuubj")}(h h]h }(hjhhhNhNubah}(h]h ]j.ah"]h$]h&]uh1j!hjuubj6)}(hidh]hid}(hjhhhNhNubah}(h]h ]jBah"]h$]h&]uh1j5hjuubeh}(h]h ]h"]h$]h&]noemphhhuh1jhjubeh}(h]h ]h"]h$]h&]hhuh1jhj hhhj hK*ubeh}(h]h ]h"]h$]h&]hhƌ add_permalinkuh1j sphinx_line_type declaratorhjhhhj hK*ubah}(h]hah ](sig sig-objecteh"]h$]h&] is_multiline _toc_parts) _toc_namehuh1jhj hK*hjhhubh desc_content)}(hhh]h)}(h-Allocate a KUnit test managed platform deviceh]h-Allocate a KUnit test managed platform device}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chK*hjhhubah}(h]h ]h"]h$]h&]uh1jhjhhhj hK*ubeh}(h]h ](jMfunctioneh"]h$]h&]domainjMobjtypejdesctypejnoindex noindexentrynocontentsentryuh1hhhhhhNhNubh container)}(hXU**Parameters** ``struct kunit *test`` test context ``const char *name`` device name of platform device to alloc ``int id`` identifier of platform device to alloc. **Description** Allocate a test managed platform device. The device is put when the test completes. **Return** Allocated platform device on success, NULL on failure.h](h)}(h**Parameters**h]hstrong)}(hjh]h Parameters}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1hhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chK.hjubhdefinition_list)}(hhh](hdefinition_list_item)}(h$``struct kunit *test`` test context h](hterm)}(h``struct kunit *test``h]hliteral)}(hjh]hstruct kunit *test}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1jhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chK+hjubh definition)}(hhh]h)}(h test contexth]h test context}(hj7hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj1hK+hj4ubah}(h]h ]h"]h$]h&]uh1j2hjubeh}(h]h ]h"]h$]h&]uh1jhj1hK+hj ubj)}(h=``const char *name`` device name of platform device to alloc h](j)}(h``const char *name``h]j)}(hjWh]hconst char *name}(hjYhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjUubah}(h]h ]h"]h$]h&]uh1jhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chK,hjQubj3)}(hhh]h)}(h'device name of platform device to alloch]h'device name of platform device to alloc}(hjphhhNhNubah}(h]h ]h"]h$]h&]uh1hhjlhK,hjmubah}(h]h ]h"]h$]h&]uh1j2hjQubeh}(h]h ]h"]h$]h&]uh1jhjlhK,hj ubj)}(h3``int id`` identifier of platform device to alloc. h](j)}(h ``int id``h]j)}(hjh]hint id}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1jhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chK-hjubj3)}(hhh]h)}(h'identifier of platform device to alloc.h]h'identifier of platform device to alloc.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhK-hjubah}(h]h ]h"]h$]h&]uh1j2hjubeh}(h]h ]h"]h$]h&]uh1jhjhK-hj ubeh}(h]h ]h"]h$]h&]uh1j hjubh)}(h**Description**h]j)}(hjh]h Description}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1hhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chK/hjubh)}(hSAllocate a test managed platform device. The device is put when the test completes.h]hSAllocate a test managed platform device. The device is put when the test completes.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chK.hjubh)}(h **Return**h]j)}(hjh]hReturn}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1hhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chK0hjubh)}(h6Allocated platform device on success, NULL on failure.h]h6Allocated platform device on success, NULL on failure.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chK1hjubeh}(h]h ] kernelindentah"]h$]h&]uh1jhhhhhNhNubh)}(hhh]h}(h]h ]h"]h$]h&]entries](h&kunit_platform_device_add (C function)c.kunit_platform_device_addhNtauh1hhhhhhNhNubh)}(hhh](j)}(hPint kunit_platform_device_add (struct kunit *test, struct platform_device *pdev)h]j )}(hOint kunit_platform_device_add(struct kunit *test, struct platform_device *pdev)h](j5)}(hinth]hint}(hj7hhhNhNubah}(h]h ]jAah"]h$]h&]uh1j4hj3hhhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chKUubj")}(h h]h }(hjFhhhNhNubah}(h]h ]j.ah"]h$]h&]uh1j!hj3hhhjEhKUubj)}(hkunit_platform_device_addh]j6)}(hkunit_platform_device_addh]hkunit_platform_device_add}(hjXhhhNhNubah}(h]h ]jBah"]h$]h&]uh1j5hjTubah}(h]h ](jjeh"]h$]h&]hhuh1jhj3hhhjEhKUubj)}(h2(struct kunit *test, struct platform_device *pdev)h](j)}(hstruct kunit *testh](j)}(hjh]hstruct}(hjthhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjpubj")}(h h]h }(hjhhhNhNubah}(h]h ]j.ah"]h$]h&]uh1j!hjpubh)}(hhh]j6)}(hkunith]hkunit}(hjhhhNhNubah}(h]h ]jBah"]h$]h&]uh1j5hjubah}(h]h ]h"]h$]h&] refdomainjMreftypejO reftargetjmodnameN classnameNjSjV)}jY]j\)}jOjZsbc.kunit_platform_device_addasbuh1hhjpubj")}(h h]h }(hjhhhNhNubah}(h]h ]j.ah"]h$]h&]uh1j!hjpubjq)}(hjth]h*}(hjhhhNhNubah}(h]h ]j}ah"]h$]h&]uh1jphjpubj6)}(htesth]htest}(hjhhhNhNubah}(h]h ]jBah"]h$]h&]uh1j5hjpubeh}(h]h ]h"]h$]h&]noemphhhuh1jhjlubj)}(hstruct platform_device *pdevh](j)}(hjh]hstruct}(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjubj")}(h h]h }(hjhhhNhNubah}(h]h ]j.ah"]h$]h&]uh1j!hjubh)}(hhh]j6)}(hplatform_deviceh]hplatform_device}(hjhhhNhNubah}(h]h ]jBah"]h$]h&]uh1j5hjubah}(h]h ]h"]h$]h&] refdomainjMreftypejO reftargetjmodnameN classnameNjSjV)}jY]jc.kunit_platform_device_addasbuh1hhjubj")}(h h]h }(hj"hhhNhNubah}(h]h ]j.ah"]h$]h&]uh1j!hjubjq)}(hjth]h*}(hj0hhhNhNubah}(h]h ]j}ah"]h$]h&]uh1jphjubj6)}(hpdevh]hpdev}(hj=hhhNhNubah}(h]h ]jBah"]h$]h&]uh1j5hjubeh}(h]h ]h"]h$]h&]noemphhhuh1jhjlubeh}(h]h ]h"]h$]h&]hhuh1jhj3hhhjEhKUubeh}(h]h ]h"]h$]h&]hhjuh1j jjhj/hhhjEhKUubah}(h]j*ah ](jjeh"]h$]h&]jj)jhuh1jhjEhKUhj,hhubj)}(hhh]h)}(h-Register a KUnit test managed platform deviceh]h-Register a KUnit test managed platform device}(hjghhhNhNubah}(h]h ]h"]h$]h&]uh1hhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chKUhjdhhubah}(h]h ]h"]h$]h&]uh1jhj,hhhjEhKUubeh}(h]h ](jMfunctioneh"]h$]h&]jjMjjjjjjjuh1hhhhhhNhNubj)}(hX**Parameters** ``struct kunit *test`` test context ``struct platform_device *pdev`` platform device to add **Description** Register a test managed platform device. The device is unregistered when the test completes. **Return** 0 on success, negative errno on failure.h](h)}(h**Parameters**h]j)}(hjh]h Parameters}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1hhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chKYhjubj )}(hhh](j)}(h$``struct kunit *test`` test context h](j)}(h``struct kunit *test``h]j)}(hjh]hstruct kunit *test}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1jhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chKVhjubj3)}(hhh]h)}(h test contexth]h test context}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhKVhjubah}(h]h ]h"]h$]h&]uh1j2hjubeh}(h]h ]h"]h$]h&]uh1jhjhKVhjubj)}(h8``struct platform_device *pdev`` platform device to add h](j)}(h ``struct platform_device *pdev``h]j)}(hjh]hstruct platform_device *pdev}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1jhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chKWhjubj3)}(hhh]h)}(hplatform device to addh]hplatform device to add}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhKWhjubah}(h]h ]h"]h$]h&]uh1j2hjubeh}(h]h ]h"]h$]h&]uh1jhjhKWhjubeh}(h]h ]h"]h$]h&]uh1j hjubh)}(h**Description**h]j)}(hjh]h Description}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1hhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chKYhjubh)}(h\Register a test managed platform device. The device is unregistered when the test completes.h]h\Register a test managed platform device. The device is unregistered when the test completes.}(hj2hhhNhNubah}(h]h ]h"]h$]h&]uh1hhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chKXhjubh)}(h **Return**h]j)}(hjCh]hReturn}(hjEhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjAubah}(h]h ]h"]h$]h&]uh1hhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chK[hjubh)}(h(0 on success, negative errno on failure.h]h(0 on success, negative errno on failure.}(hjYhhhNhNubah}(h]h ]h"]h$]h&]uh1hhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chK\hjubeh}(h]h ] kernelindentah"]h$]h&]uh1jhhhhhNhNubh)}(hhh]h}(h]h ]h"]h$]h&]entries](h0kunit_platform_device_register_full (C function)%c.kunit_platform_device_register_fullhNtauh1hhhhhhNhNubh)}(hhh](j)}(h~struct platform_device * kunit_platform_device_register_full (struct kunit *test, const struct platform_device_info *pdevinfo)h]j )}(h|struct platform_device *kunit_platform_device_register_full(struct kunit *test, const struct platform_device_info *pdevinfo)h](j)}(hjh]hstruct}(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjhhhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chKubj")}(h h]h }(hjhhhNhNubah}(h]h ]j.ah"]h$]h&]uh1j!hjhhhjhKubh)}(hhh]j6)}(hplatform_deviceh]hplatform_device}(hjhhhNhNubah}(h]h ]jBah"]h$]h&]uh1j5hjubah}(h]h ]h"]h$]h&] refdomainjMreftypejO reftargetjmodnameN classnameNjSjV)}jY]j\)}jO#kunit_platform_device_register_fullsb%c.kunit_platform_device_register_fullasbuh1hhjhhhjhKubj")}(h h]h }(hjhhhNhNubah}(h]h ]j.ah"]h$]h&]uh1j!hjhhhjhKubjq)}(hjth]h*}(hjhhhNhNubah}(h]h ]j}ah"]h$]h&]uh1jphjhhhjhKubj)}(h#kunit_platform_device_register_fullh]j6)}(hjh]h#kunit_platform_device_register_full}(hjhhhNhNubah}(h]h ]jBah"]h$]h&]uh1j5hjubah}(h]h ](jjeh"]h$]h&]hhuh1jhjhhhjhKubj)}(hA(struct kunit *test, const struct platform_device_info *pdevinfo)h](j)}(hstruct kunit *testh](j)}(hjh]hstruct}(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjubj")}(h h]h }(hjhhhNhNubah}(h]h ]j.ah"]h$]h&]uh1j!hjubh)}(hhh]j6)}(hkunith]hkunit}(hj hhhNhNubah}(h]h ]jBah"]h$]h&]uh1j5hjubah}(h]h ]h"]h$]h&] refdomainjMreftypejO reftargetj"modnameN classnameNjSjV)}jY]j%c.kunit_platform_device_register_fullasbuh1hhjubj")}(h h]h }(hj>hhhNhNubah}(h]h ]j.ah"]h$]h&]uh1j!hjubjq)}(hjth]h*}(hjLhhhNhNubah}(h]h ]j}ah"]h$]h&]uh1jphjubj6)}(htesth]htest}(hjYhhhNhNubah}(h]h ]jBah"]h$]h&]uh1j5hjubeh}(h]h ]h"]h$]h&]noemphhhuh1jhjubj)}(h+const struct platform_device_info *pdevinfoh](j)}(hjh]hconst}(hjrhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjnubj")}(h h]h }(hjhhhNhNubah}(h]h ]j.ah"]h$]h&]uh1j!hjnubj)}(hjh]hstruct}(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjnubj")}(h h]h }(hjhhhNhNubah}(h]h ]j.ah"]h$]h&]uh1j!hjnubh)}(hhh]j6)}(hplatform_device_infoh]hplatform_device_info}(hjhhhNhNubah}(h]h ]jBah"]h$]h&]uh1j5hjubah}(h]h ]h"]h$]h&] refdomainjMreftypejO reftargetjmodnameN classnameNjSjV)}jY]j%c.kunit_platform_device_register_fullasbuh1hhjnubj")}(h h]h }(hjhhhNhNubah}(h]h ]j.ah"]h$]h&]uh1j!hjnubjq)}(hjth]h*}(hjhhhNhNubah}(h]h ]j}ah"]h$]h&]uh1jphjnubj6)}(hpdevinfoh]hpdevinfo}(hjhhhNhNubah}(h]h ]jBah"]h$]h&]uh1j5hjnubeh}(h]h ]h"]h$]h&]noemphhhuh1jhjubeh}(h]h ]h"]h$]h&]hhuh1jhjhhhjhKubeh}(h]h ]h"]h$]h&]hhjuh1j jjhjhhhjhKubah}(h]j{ah ](jjeh"]h$]h&]jj)jhuh1jhjhKhj}hhubj)}(hhh]h)}(hORegister a KUnit test-managed platform device described by platform device infoh]hORegister a KUnit test-managed platform device described by platform device info}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chKhj hhubah}(h]h ]h"]h$]h&]uh1jhj}hhhjhKubeh}(h]h ](jMfunctioneh"]h$]h&]jjMjj&jj&jjjuh1hhhhhhNhNubj)}(hXM**Parameters** ``struct kunit *test`` test context ``const struct platform_device_info *pdevinfo`` platform device information describing the new device **Description** Register a test-managed platform device. The device is unregistered when the test completes. **Return** New platform device on success, IS_ERR() on error.h](h)}(h**Parameters**h]j)}(hj0h]h Parameters}(hj2hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj.ubah}(h]h ]h"]h$]h&]uh1hhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chKhj*ubj )}(hhh](j)}(h$``struct kunit *test`` test context h](j)}(h``struct kunit *test``h]j)}(hjOh]hstruct kunit *test}(hjQhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjMubah}(h]h ]h"]h$]h&]uh1jhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chKhjIubj3)}(hhh]h)}(h test contexth]h test context}(hjhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjdhKhjeubah}(h]h ]h"]h$]h&]uh1j2hjIubeh}(h]h ]h"]h$]h&]uh1jhjdhKhjFubj)}(hf``const struct platform_device_info *pdevinfo`` platform device information describing the new device h](j)}(h/``const struct platform_device_info *pdevinfo``h]j)}(hjh]h+const struct platform_device_info *pdevinfo}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1jhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chKhjubj3)}(hhh]h)}(h5platform device information describing the new deviceh]h5platform device information describing the new device}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhKhjubah}(h]h ]h"]h$]h&]uh1j2hjubeh}(h]h ]h"]h$]h&]uh1jhjhKhjFubeh}(h]h ]h"]h$]h&]uh1j hj*ubh)}(h**Description**h]j)}(hjh]h Description}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1hhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chKhj*ubh)}(h\Register a test-managed platform device. The device is unregistered when the test completes.h]h\Register a test-managed platform device. The device is unregistered when the test completes.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chKhj*ubh)}(h **Return**h]j)}(hjh]hReturn}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1hhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chKhj*ubh)}(h2New platform device on success, IS_ERR() on error.h]h2New platform device on success, IS_ERR() on error.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chKhj*ubeh}(h]h ] kernelindentah"]h$]h&]uh1jhhhhhNhNubh)}(hhh]h}(h]h ]h"]h$]h&]entries](h-kunit_platform_device_unregister (C function)"c.kunit_platform_device_unregisterhNtauh1hhhhhhNhNubh)}(hhh](j)}(hXvoid kunit_platform_device_unregister (struct kunit *test, struct platform_device *pdev)h]j )}(hWvoid kunit_platform_device_unregister(struct kunit *test, struct platform_device *pdev)h](j5)}(hvoidh]hvoid}(hj/ hhhNhNubah}(h]h ]jAah"]h$]h&]uh1j4hj+ hhhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chKubj")}(h h]h }(hj> hhhNhNubah}(h]h ]j.ah"]h$]h&]uh1j!hj+ hhhj= hKubj)}(h kunit_platform_device_unregisterh]j6)}(h kunit_platform_device_unregisterh]h kunit_platform_device_unregister}(hjP hhhNhNubah}(h]h ]jBah"]h$]h&]uh1j5hjL ubah}(h]h ](jjeh"]h$]h&]hhuh1jhj+ hhhj= hKubj)}(h2(struct kunit *test, struct platform_device *pdev)h](j)}(hstruct kunit *testh](j)}(hjh]hstruct}(hjl hhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjh ubj")}(h h]h }(hjy hhhNhNubah}(h]h ]j.ah"]h$]h&]uh1j!hjh ubh)}(hhh]j6)}(hkunith]hkunit}(hj hhhNhNubah}(h]h ]jBah"]h$]h&]uh1j5hj ubah}(h]h ]h"]h$]h&] refdomainjMreftypejO reftargetj modnameN classnameNjSjV)}jY]j\)}jOjR sb"c.kunit_platform_device_unregisterasbuh1hhjh ubj")}(h h]h }(hj hhhNhNubah}(h]h ]j.ah"]h$]h&]uh1j!hjh ubjq)}(hjth]h*}(hj hhhNhNubah}(h]h ]j}ah"]h$]h&]uh1jphjh ubj6)}(htesth]htest}(hj hhhNhNubah}(h]h ]jBah"]h$]h&]uh1j5hjh ubeh}(h]h ]h"]h$]h&]noemphhhuh1jhjd ubj)}(hstruct platform_device *pdevh](j)}(hjh]hstruct}(hj hhhNhNubah}(h]h ]jah"]h$]h&]uh1jhj ubj")}(h h]h }(hj hhhNhNubah}(h]h ]j.ah"]h$]h&]uh1j!hj ubh)}(hhh]j6)}(hplatform_deviceh]hplatform_device}(hj hhhNhNubah}(h]h ]jBah"]h$]h&]uh1j5hj ubah}(h]h ]h"]h$]h&] refdomainjMreftypejO reftargetj modnameN classnameNjSjV)}jY]j "c.kunit_platform_device_unregisterasbuh1hhj ubj")}(h h]h }(hj hhhNhNubah}(h]h ]j.ah"]h$]h&]uh1j!hj ubjq)}(hjth]h*}(hj( hhhNhNubah}(h]h ]j}ah"]h$]h&]uh1jphj ubj6)}(hpdevh]hpdev}(hj5 hhhNhNubah}(h]h ]jBah"]h$]h&]uh1j5hj ubeh}(h]h ]h"]h$]h&]noemphhhuh1jhjd ubeh}(h]h ]h"]h$]h&]hhuh1jhj+ hhhj= hKubeh}(h]h ]h"]h$]h&]hhjuh1j jjhj' hhhj= hKubah}(h]j" ah ](jjeh"]h$]h&]jj)jhuh1jhj= hKhj$ hhubj)}(hhh]h)}(h*Unregister a KUnit-managed platform deviceh]h*Unregister a KUnit-managed platform device}(hj_ hhhNhNubah}(h]h ]h"]h$]h&]uh1hhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chKhj\ hhubah}(h]h ]h"]h$]h&]uh1jhj$ hhhj= hKubeh}(h]h ](jMfunctioneh"]h$]h&]jjMjjw jjw jjjuh1hhhhhhNhNubj)}(h**Parameters** ``struct kunit *test`` test context ``struct platform_device *pdev`` platform device to unregister **Description** Unregister a test-managed platform device and cancel its release action.h](h)}(h**Parameters**h]j)}(hj h]h Parameters}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]uh1hhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chKhj{ ubj )}(hhh](j)}(h$``struct kunit *test`` test context 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&]uh1jhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chKhj ubj3)}(hhh]h)}(h test contexth]h test context}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hKhj ubah}(h]h ]h"]h$]h&]uh1j2hj ubeh}(h]h ]h"]h$]h&]uh1jhj hKhj ubj)}(h?``struct platform_device *pdev`` platform device to unregister h](j)}(h ``struct platform_device *pdev``h]j)}(hj h]hstruct platform_device *pdev}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]uh1jhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chKhj ubj3)}(hhh]h)}(hplatform device to unregisterh]hplatform device to unregister}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hKhj ubah}(h]h ]h"]h$]h&]uh1j2hj ubeh}(h]h ]h"]h$]h&]uh1jhj hKhj ubeh}(h]h ]h"]h$]h&]uh1j hj{ ubh)}(h**Description**h]j)}(hj h]h Description}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]uh1hhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chKhj{ ubh)}(hHUnregister a test-managed platform device and cancel its release action.h]hHUnregister a test-managed platform device and cancel its release action.}(hj* hhhNhNubah}(h]h ]h"]h$]h&]uh1hhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chKhj{ ubeh}(h]h ] kernelindentah"]h$]h&]uh1jhhhhhNhNubh)}(hhh]h}(h]h ]h"]h$]h&]entries](h9kunit_platform_device_prepare_wait_for_probe (C function).c.kunit_platform_device_prepare_wait_for_probehNtauh1hhhhhhNhNubh)}(hhh](j)}(hyint kunit_platform_device_prepare_wait_for_probe (struct kunit *test, struct platform_device *pdev, struct completion *x)h]j )}(hxint kunit_platform_device_prepare_wait_for_probe(struct kunit *test, struct platform_device *pdev, struct completion *x)h](j5)}(hinth]hint}(hjY hhhNhNubah}(h]h ]jAah"]h$]h&]uh1j4hjU hhhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chKubj")}(h h]h }(hjh hhhNhNubah}(h]h ]j.ah"]h$]h&]uh1j!hjU hhhjg hKubj)}(h,kunit_platform_device_prepare_wait_for_probeh]j6)}(h,kunit_platform_device_prepare_wait_for_probeh]h,kunit_platform_device_prepare_wait_for_probe}(hjz hhhNhNubah}(h]h ]jBah"]h$]h&]uh1j5hjv ubah}(h]h ](jjeh"]h$]h&]hhuh1jhjU hhhjg hKubj)}(hH(struct kunit *test, struct platform_device *pdev, struct completion *x)h](j)}(hstruct kunit *testh](j)}(hjh]hstruct}(hj hhhNhNubah}(h]h ]jah"]h$]h&]uh1jhj ubj")}(h h]h }(hj hhhNhNubah}(h]h ]j.ah"]h$]h&]uh1j!hj ubh)}(hhh]j6)}(hkunith]hkunit}(hj hhhNhNubah}(h]h ]jBah"]h$]h&]uh1j5hj ubah}(h]h ]h"]h$]h&] refdomainjMreftypejO reftargetj modnameN classnameNjSjV)}jY]j\)}jOj| sb.c.kunit_platform_device_prepare_wait_for_probeasbuh1hhj ubj")}(h h]h }(hj hhhNhNubah}(h]h ]j.ah"]h$]h&]uh1j!hj ubjq)}(hjth]h*}(hj hhhNhNubah}(h]h ]j}ah"]h$]h&]uh1jphj ubj6)}(htesth]htest}(hj hhhNhNubah}(h]h ]jBah"]h$]h&]uh1j5hj ubeh}(h]h ]h"]h$]h&]noemphhhuh1jhj ubj)}(hstruct platform_device *pdevh](j)}(hjh]hstruct}(hj hhhNhNubah}(h]h ]jah"]h$]h&]uh1jhj ubj")}(h h]h }(hj hhhNhNubah}(h]h ]j.ah"]h$]h&]uh1j!hj ubh)}(hhh]j6)}(hplatform_deviceh]hplatform_device}(hj& hhhNhNubah}(h]h ]jBah"]h$]h&]uh1j5hj# ubah}(h]h ]h"]h$]h&] refdomainjMreftypejO reftargetj( modnameN classnameNjSjV)}jY]j .c.kunit_platform_device_prepare_wait_for_probeasbuh1hhj ubj")}(h h]h }(hjD hhhNhNubah}(h]h ]j.ah"]h$]h&]uh1j!hj ubjq)}(hjth]h*}(hjR hhhNhNubah}(h]h ]j}ah"]h$]h&]uh1jphj ubj6)}(hpdevh]hpdev}(hj_ hhhNhNubah}(h]h ]jBah"]h$]h&]uh1j5hj ubeh}(h]h ]h"]h$]h&]noemphhhuh1jhj ubj)}(hstruct completion *xh](j)}(hjh]hstruct}(hjx hhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjt ubj")}(h h]h }(hj hhhNhNubah}(h]h ]j.ah"]h$]h&]uh1j!hjt ubh)}(hhh]j6)}(h completionh]h completion}(hj hhhNhNubah}(h]h ]jBah"]h$]h&]uh1j5hj ubah}(h]h ]h"]h$]h&] refdomainjMreftypejO reftargetj modnameN classnameNjSjV)}jY]j .c.kunit_platform_device_prepare_wait_for_probeasbuh1hhjt ubj")}(h h]h }(hj hhhNhNubah}(h]h ]j.ah"]h$]h&]uh1j!hjt ubjq)}(hjth]h*}(hj hhhNhNubah}(h]h ]j}ah"]h$]h&]uh1jphjt ubj6)}(hxh]hx}(hj hhhNhNubah}(h]h ]jBah"]h$]h&]uh1j5hjt ubeh}(h]h ]h"]h$]h&]noemphhhuh1jhj ubeh}(h]h ]h"]h$]h&]hhuh1jhjU hhhjg hKubeh}(h]h ]h"]h$]h&]hhjuh1j jjhjQ hhhjg hKubah}(h]jL ah ](jjeh"]h$]h&]jj)jhuh1jhjg hKhjN hhubj)}(hhh]h)}(hDPrepare a completion variable to wait for a platform device to probeh]hDPrepare a completion variable to wait for a platform device to probe}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chKhj hhubah}(h]h ]h"]h$]h&]uh1jhjN hhhjg hKubeh}(h]h ](jMfunctioneh"]h$]h&]jjMjj jj jjjuh1hhhhhhNhNubj)}(hX**Parameters** ``struct kunit *test`` test context ``struct platform_device *pdev`` platform device to prepare to wait for probe of ``struct completion *x`` completion variable completed when **dev** has probed **Description** Prepare a completion variable **x** to wait for **pdev** to probe. Waiting on the completion forces a preemption, allowing the platform driver to probe. Example .. code-block:: c static int kunit_platform_driver_probe(struct platform_device *pdev) { return 0; } static void kunit_platform_driver_test(struct kunit *test) { struct platform_device *pdev; struct platform_driver *pdrv; DECLARE_COMPLETION_ONSTACK(comp); pdev = kunit_platform_device_alloc(test, "kunit-platform", -1); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, pdev); KUNIT_ASSERT_EQ(test, 0, kunit_platform_device_add(test, pdev)); pdrv = kunit_kzalloc(test, sizeof(*pdrv), GFP_KERNEL); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, pdrv); pdrv->probe = kunit_platform_driver_probe; pdrv->driver.name = "kunit-platform"; pdrv->driver.owner = THIS_MODULE; KUNIT_ASSERT_EQ(test, 0, kunit_platform_device_prepare_wait_for_probe(test, pdev, &comp)); KUNIT_ASSERT_EQ(test, 0, kunit_platform_driver_register(test, pdrv)); KUNIT_EXPECT_NE(test, 0, wait_for_completion_timeout(&comp, 3 * HZ)); } **Return** 0 on success, negative errno on failure.h](h)}(h**Parameters**h]j)}(hj h]h Parameters}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]uh1hhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chKhj ubj )}(hhh](j)}(h$``struct kunit *test`` test context h](j)}(h``struct kunit *test``h]j)}(hj: h]hstruct kunit *test}(hj< hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj8 ubah}(h]h ]h"]h$]h&]uh1jhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chKhj4 ubj3)}(hhh]h)}(h test contexth]h test context}(hjS hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjO hKhjP ubah}(h]h ]h"]h$]h&]uh1j2hj4 ubeh}(h]h ]h"]h$]h&]uh1jhjO hKhj1 ubj)}(hQ``struct platform_device *pdev`` platform device to prepare to wait for probe of h](j)}(h ``struct platform_device *pdev``h]j)}(hjs h]hstruct platform_device *pdev}(hju hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjq ubah}(h]h ]h"]h$]h&]uh1jhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chKhjm ubj3)}(hhh]h)}(h/platform device to prepare to wait for probe ofh]h/platform device to prepare to wait for probe of}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hKhj ubah}(h]h ]h"]h$]h&]uh1j2hjm ubeh}(h]h ]h"]h$]h&]uh1jhj hKhj1 ubj)}(hO``struct completion *x`` completion variable completed when **dev** has probed h](j)}(h``struct completion *x``h]j)}(hj h]hstruct completion *x}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]uh1jhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chKhj ubj3)}(hhh]h)}(h5completion variable completed when **dev** has probedh](h#completion variable completed when }(hj hhhNhNubj)}(h**dev**h]hdev}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubh has probed}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhj hKhj ubah}(h]h ]h"]h$]h&]uh1j2hj ubeh}(h]h ]h"]h$]h&]uh1jhj hKhj1 ubeh}(h]h ]h"]h$]h&]uh1j hj ubh)}(h**Description**h]j)}(hj h]h Description}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]uh1hhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chKhj ubh)}(hPrepare a completion variable **x** to wait for **pdev** to probe. Waiting on the completion forces a preemption, allowing the platform driver to probe.h](hPrepare a completion variable }(hjhhhNhNubj)}(h**x**h]hx}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh to wait for }(hjhhhNhNubj)}(h**pdev**h]hpdev}(hj)hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh` to probe. Waiting on the completion forces a preemption, allowing the platform driver to probe.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chKhj ubh)}(hExampleh]hExample}(hjBhhhNhNubah}(h]h ]h"]h$]h&]uh1hhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chKhj ubh literal_block)}(hXstatic int kunit_platform_driver_probe(struct platform_device *pdev) { return 0; } static void kunit_platform_driver_test(struct kunit *test) { struct platform_device *pdev; struct platform_driver *pdrv; DECLARE_COMPLETION_ONSTACK(comp); pdev = kunit_platform_device_alloc(test, "kunit-platform", -1); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, pdev); KUNIT_ASSERT_EQ(test, 0, kunit_platform_device_add(test, pdev)); pdrv = kunit_kzalloc(test, sizeof(*pdrv), GFP_KERNEL); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, pdrv); pdrv->probe = kunit_platform_driver_probe; pdrv->driver.name = "kunit-platform"; pdrv->driver.owner = THIS_MODULE; KUNIT_ASSERT_EQ(test, 0, kunit_platform_device_prepare_wait_for_probe(test, pdev, &comp)); KUNIT_ASSERT_EQ(test, 0, kunit_platform_driver_register(test, pdrv)); KUNIT_EXPECT_NE(test, 0, wait_for_completion_timeout(&comp, 3 * HZ)); }h]hXstatic int kunit_platform_driver_probe(struct platform_device *pdev) { return 0; } static void kunit_platform_driver_test(struct kunit *test) { struct platform_device *pdev; struct platform_driver *pdrv; DECLARE_COMPLETION_ONSTACK(comp); pdev = kunit_platform_device_alloc(test, "kunit-platform", -1); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, pdev); KUNIT_ASSERT_EQ(test, 0, kunit_platform_device_add(test, pdev)); pdrv = kunit_kzalloc(test, sizeof(*pdrv), GFP_KERNEL); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, pdrv); pdrv->probe = kunit_platform_driver_probe; pdrv->driver.name = "kunit-platform"; pdrv->driver.owner = THIS_MODULE; KUNIT_ASSERT_EQ(test, 0, kunit_platform_device_prepare_wait_for_probe(test, pdev, &comp)); KUNIT_ASSERT_EQ(test, 0, kunit_platform_driver_register(test, pdrv)); KUNIT_EXPECT_NE(test, 0, wait_for_completion_timeout(&comp, 3 * HZ)); }}hjSsbah}(h]h ]h"]h$]h&]hhƌforcelanguagejMhighlight_args}uh1jQhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chKhj ubh)}(h **Return**h]j)}(hjhh]hReturn}(hjjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjfubah}(h]h ]h"]h$]h&]uh1hhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chMhj ubh)}(h(0 on success, negative errno on failure.h]h(0 on success, negative errno on failure.}(hj~hhhNhNubah}(h]h ]h"]h$]h&]uh1hhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chM hj ubeh}(h]h ] kernelindentah"]h$]h&]uh1jhhhhhNhNubh)}(hhh]h}(h]h ]h"]h$]h&]entries](h+kunit_platform_driver_register (C function) c.kunit_platform_driver_registerhNtauh1hhhhhhNhNubh)}(hhh](j)}(hTint kunit_platform_driver_register (struct kunit *test, struct platform_driver *drv)h]j )}(hSint kunit_platform_driver_register(struct kunit *test, struct platform_driver *drv)h](j5)}(hinth]hint}(hjhhhNhNubah}(h]h ]jAah"]h$]h&]uh1j4hjhhhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chM.ubj")}(h h]h }(hjhhhNhNubah}(h]h ]j.ah"]h$]h&]uh1j!hjhhhjhM.ubj)}(hkunit_platform_driver_registerh]j6)}(hkunit_platform_driver_registerh]hkunit_platform_driver_register}(hjhhhNhNubah}(h]h ]jBah"]h$]h&]uh1j5hjubah}(h]h ](jjeh"]h$]h&]hhuh1jhjhhhjhM.ubj)}(h1(struct kunit *test, struct platform_driver *drv)h](j)}(hstruct kunit *testh](j)}(hjh]hstruct}(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjubj")}(h h]h }(hjhhhNhNubah}(h]h ]j.ah"]h$]h&]uh1j!hjubh)}(hhh]j6)}(hkunith]hkunit}(hjhhhNhNubah}(h]h ]jBah"]h$]h&]uh1j5hjubah}(h]h ]h"]h$]h&] refdomainjMreftypejO reftargetj modnameN classnameNjSjV)}jY]j\)}jOjsb c.kunit_platform_driver_registerasbuh1hhjubj")}(h h]h }(hj(hhhNhNubah}(h]h ]j.ah"]h$]h&]uh1j!hjubjq)}(hjth]h*}(hj6hhhNhNubah}(h]h ]j}ah"]h$]h&]uh1jphjubj6)}(htesth]htest}(hjChhhNhNubah}(h]h ]jBah"]h$]h&]uh1j5hjubeh}(h]h ]h"]h$]h&]noemphhhuh1jhjubj)}(hstruct platform_driver *drvh](j)}(hjh]hstruct}(hj\hhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjXubj")}(h h]h }(hjihhhNhNubah}(h]h ]j.ah"]h$]h&]uh1j!hjXubh)}(hhh]j6)}(hplatform_driverh]hplatform_driver}(hjzhhhNhNubah}(h]h ]jBah"]h$]h&]uh1j5hjwubah}(h]h ]h"]h$]h&] refdomainjMreftypejO reftargetj|modnameN classnameNjSjV)}jY]j$ c.kunit_platform_driver_registerasbuh1hhjXubj")}(h h]h }(hjhhhNhNubah}(h]h ]j.ah"]h$]h&]uh1j!hjXubjq)}(hjth]h*}(hjhhhNhNubah}(h]h ]j}ah"]h$]h&]uh1jphjXubj6)}(hdrvh]hdrv}(hjhhhNhNubah}(h]h ]jBah"]h$]h&]uh1j5hjXubeh}(h]h ]h"]h$]h&]noemphhhuh1jhjubeh}(h]h ]h"]h$]h&]hhuh1jhjhhhjhM.ubeh}(h]h ]h"]h$]h&]hhjuh1j jjhjhhhjhM.ubah}(h]jah ](jjeh"]h$]h&]jj)jhuh1jhjhM.hjhhubj)}(hhh]h)}(h-Register a KUnit test managed platform driverh]h-Register a KUnit test managed platform driver}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chM.hjhhubah}(h]h ]h"]h$]h&]uh1jhjhhhjhM.ubeh}(h]h ](jMfunctioneh"]h$]h&]jjMjjjjjjjuh1hhhhhhNhNubj)}(hXw**Parameters** ``struct kunit *test`` test context ``struct platform_driver *drv`` platform driver to register **Description** Register a test managed platform driver. This allows callers to embed the **drv** in a container structure and use container_of() in the probe function to pass information to KUnit tests. Example .. code-block:: c struct kunit_test_context { struct platform_driver pdrv; const char *data; }; static inline struct kunit_test_context * to_test_context(struct platform_device *pdev) { return container_of(to_platform_driver(pdev->dev.driver), struct kunit_test_context, pdrv); } static int kunit_platform_driver_probe(struct platform_device *pdev) { struct kunit_test_context *ctx; ctx = to_test_context(pdev); ctx->data = "test data"; return 0; } static void kunit_platform_driver_test(struct kunit *test) { struct kunit_test_context *ctx; ctx = kunit_kzalloc(test, sizeof(*ctx), GFP_KERNEL); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx); ctx->pdrv.probe = kunit_platform_driver_probe; ctx->pdrv.driver.name = "kunit-platform"; ctx->pdrv.driver.owner = THIS_MODULE; KUNIT_EXPECT_EQ(test, 0, kunit_platform_driver_register(test, &ctx->pdrv)); <... wait for driver to probe ...> KUNIT_EXPECT_STREQ(test, ctx->data, "test data"); } **Return** 0 on success, negative errno on failure.h](h)}(h**Parameters**h]j)}(hjh]h Parameters}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1hhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chM2hjubj )}(hhh](j)}(h$``struct kunit *test`` test context h](j)}(h``struct kunit *test``h]j)}(hjh]hstruct kunit *test}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1jhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chM/hjubj3)}(hhh]h)}(h test contexth]h test context}(hj7hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj3hM/hj4ubah}(h]h ]h"]h$]h&]uh1j2hjubeh}(h]h ]h"]h$]h&]uh1jhj3hM/hjubj)}(h<``struct platform_driver *drv`` platform driver to register h](j)}(h``struct platform_driver *drv``h]j)}(hjWh]hstruct platform_driver *drv}(hjYhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjUubah}(h]h ]h"]h$]h&]uh1jhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chM0hjQubj3)}(hhh]h)}(hplatform driver to registerh]hplatform driver to register}(hjphhhNhNubah}(h]h ]h"]h$]h&]uh1hhjlhM0hjmubah}(h]h ]h"]h$]h&]uh1j2hjQubeh}(h]h ]h"]h$]h&]uh1jhjlhM0hjubeh}(h]h ]h"]h$]h&]uh1j hjubh)}(h**Description**h]j)}(hjh]h Description}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1hhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chM2hjubh)}(hRegister a test managed platform driver. This allows callers to embed the **drv** in a container structure and use container_of() in the probe function to pass information to KUnit tests.h](hJRegister a test managed platform driver. This allows callers to embed the }(hjhhhNhNubj)}(h**drv**h]hdrv}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubhj in a container structure and use container_of() in the probe function to pass information to KUnit tests.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chM1hjubh)}(hExampleh]hExample}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chM5hjubjR)}(hXKstruct kunit_test_context { struct platform_driver pdrv; const char *data; }; static inline struct kunit_test_context * to_test_context(struct platform_device *pdev) { return container_of(to_platform_driver(pdev->dev.driver), struct kunit_test_context, pdrv); } static int kunit_platform_driver_probe(struct platform_device *pdev) { struct kunit_test_context *ctx; ctx = to_test_context(pdev); ctx->data = "test data"; return 0; } static void kunit_platform_driver_test(struct kunit *test) { struct kunit_test_context *ctx; ctx = kunit_kzalloc(test, sizeof(*ctx), GFP_KERNEL); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx); ctx->pdrv.probe = kunit_platform_driver_probe; ctx->pdrv.driver.name = "kunit-platform"; ctx->pdrv.driver.owner = THIS_MODULE; KUNIT_EXPECT_EQ(test, 0, kunit_platform_driver_register(test, &ctx->pdrv)); <... wait for driver to probe ...> KUNIT_EXPECT_STREQ(test, ctx->data, "test data"); }h]hXKstruct kunit_test_context { struct platform_driver pdrv; const char *data; }; static inline struct kunit_test_context * to_test_context(struct platform_device *pdev) { return container_of(to_platform_driver(pdev->dev.driver), struct kunit_test_context, pdrv); } static int kunit_platform_driver_probe(struct platform_device *pdev) { struct kunit_test_context *ctx; ctx = to_test_context(pdev); ctx->data = "test data"; return 0; } static void kunit_platform_driver_test(struct kunit *test) { struct kunit_test_context *ctx; ctx = kunit_kzalloc(test, sizeof(*ctx), GFP_KERNEL); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx); ctx->pdrv.probe = kunit_platform_driver_probe; ctx->pdrv.driver.name = "kunit-platform"; ctx->pdrv.driver.owner = THIS_MODULE; KUNIT_EXPECT_EQ(test, 0, kunit_platform_driver_register(test, &ctx->pdrv)); <... wait for driver to probe ...> KUNIT_EXPECT_STREQ(test, ctx->data, "test data"); }}hjsbah}(h]h ]h"]h$]h&]hhjajbjMjc}uh1jQhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chM7hjubh)}(h **Return**h]j)}(hjh]hReturn}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1hhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chM`hjubh)}(h(0 on success, negative errno on failure.h]h(0 on success, negative errno on failure.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chMahjubeh}(h]h ] kernelindentah"]h$]h&]uh1jhhhhhNhNubeh}(h]platform-device-apiah ]h"]platform device 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_handlerjAerror_encodingutf-8error_encoding_error_handlerbackslashreplace language_codeenrecord_dependenciesNconfigN id_prefixhauto_id_prefixid dump_settingsNdump_internalsNdump_transformsNdump_pseudo_xmlNexpose_internalsNstrict_visitorN_disable_configN_sourcehnj _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}jjs nametypes}jsh}(jhhjj*j/j{jj" j' jL jQ jju 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.