nsphinx.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]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}(hhhhhNhNubah}(h]h ]kah"]h$]h&]uh1hhhhhhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chK)ubhdesc_sig_space)}(h h]h }(hjhhhNhNubah}(h]h ]wah"]h$]h&]uh1j hhhhhj hK)ubh)}(hhh]h desc_sig_name)}(hplatform_deviceh]hplatform_device}(hj#hhhNhNubah}(h]h ]nah"]h$]h&]uh1j!hjubah}(h]h ]h"]h$]h&] refdomaincreftype identifier reftargetj%modnameN classnameN c:parent_keysphinx.domains.c LookupKey)}data]j@ ASTIdentifier)}j;kunit_platform_device_allocsbc.kunit_platform_device_allocasbuh1hhhhhhj hK)ubj)}(h h]h }(hjNhhhNhNubah}(h]h ]jah"]h$]h&]uh1j hhhhhj hK)ubhdesc_sig_punctuation)}(h*h]h*}(hj^hhhNhNubah}(h]h ]pah"]h$]h&]uh1j\hhhhhj hK)ubh desc_name)}(hkunit_platform_device_alloch]j")}(hjKh]hkunit_platform_device_alloc}(hjshhhNhNubah}(h]h ]j.ah"]h$]h&]uh1j!hjoubah}(h]h ](sig-namedescnameeh"]h$]h&]hhuh1jmhhhhhj hK)ubhdesc_parameterlist)}(h.(struct kunit *test, const char *name, int id)h](hdesc_parameter)}(hstruct kunit *testh](h)}(hhh]hstruct}(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1hhjubj)}(h h]h }(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1j hjubh)}(hhh]j")}(hkunith]hkunit}(hjhhhNhNubah}(h]h ]j.ah"]h$]h&]uh1j!hjubah}(h]h ]h"]h$]h&] refdomainj9reftypej; reftargetjmodnameN classnameNj?jB)}jE]jIc.kunit_platform_device_allocasbuh1hhjubj)}(h h]h }(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1j hjubj])}(hj`h]h*}(hjhhhNhNubah}(h]h ]jiah"]h$]h&]uh1j\hjubj")}(htesth]htest}(hjhhhNhNubah}(h]h ]j.ah"]h$]h&]uh1j!hjubeh}(h]h ]h"]h$]h&]noemphhhuh1jhjubj)}(hconst char *nameh](h)}(hconsth]hconst}(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1hhjubj)}(h h]h }(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1j hjubhdesc_sig_keyword_type)}(hcharh]hchar}(hj"hhhNhNubah}(h]h ]ktah"]h$]h&]uh1j hjubj)}(h h]h }(hj1hhhNhNubah}(h]h ]jah"]h$]h&]uh1j hjubj])}(hj`h]h*}(hj?hhhNhNubah}(h]h ]jiah"]h$]h&]uh1j\hjubj")}(hnameh]hname}(hjLhhhNhNubah}(h]h ]j.ah"]h$]h&]uh1j!hjubeh}(h]h ]h"]h$]h&]noemphhhuh1jhjubj)}(hint idh](j!)}(hinth]hint}(hjehhhNhNubah}(h]h ]j-ah"]h$]h&]uh1j hjaubj)}(h h]h }(hjshhhNhNubah}(h]h ]jah"]h$]h&]uh1j hjaubj")}(hidh]hid}(hjhhhNhNubah}(h]h ]j.ah"]h$]h&]uh1j!hjaubeh}(h]h ]h"]h$]h&]noemphhhuh1jhjubeh}(h]h ]h"]h$]h&]hhuh1jhhhhhj hK)ubeh}(h]h ]h"]h$]h&]hh add_permalinkuh1hsphinx_line_type declaratorhhhhhj hK)ubah}(h]hah ](sig sig-objecteh"]h$]h&] is_multiline _toc_parts) _toc_namehuh1hhj hK)hhhhubh 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&]uh1jhhhhhj hK)ubeh}(h]h ](j9functioneh"]h$]h&]domainj9objtypejdesctypejnoindex 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}(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.chK*hjubh definition)}(hhh]h)}(h test contexth]h test context}(hj#hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhK*hj ubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhjhK*hjubj)}(h=``const char *name`` device name of platform device to alloc h](j)}(h``const char *name``h]j )}(hjCh]hconst char *name}(hjEhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjAubah}(h]h ]h"]h$]h&]uh1jhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chK+hj=ubj)}(hhh]h)}(h'device name of platform device to alloch]h'device name of platform device to alloc}(hj\hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjXhK+hjYubah}(h]h ]h"]h$]h&]uh1jhj=ubeh}(h]h ]h"]h$]h&]uh1jhjXhK+hjubj)}(h3``int id`` identifier of platform device to alloc. h](j)}(h ``int id``h]j )}(hj|h]hint id}(hj~hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjzubah}(h]h ]h"]h$]h&]uh1jhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chK,hjvubj)}(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&]uh1jhjvubeh}(h]h ]h"]h$]h&]uh1jhjhK,hjubeh}(h]h ]h"]h$]h&]uh1jhjubh)}(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.chK0hjubeh}(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](h)}(hPint kunit_platform_device_add (struct kunit *test, struct platform_device *pdev)h]h)}(hOint kunit_platform_device_add(struct kunit *test, struct platform_device *pdev)h](j!)}(hinth]hint}(hj#hhhNhNubah}(h]h ]j-ah"]h$]h&]uh1j hjhhhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chKTubj)}(h h]h }(hj2hhhNhNubah}(h]h ]jah"]h$]h&]uh1j hjhhhj1hKTubjn)}(hkunit_platform_device_addh]j")}(hkunit_platform_device_addh]hkunit_platform_device_add}(hjDhhhNhNubah}(h]h ]j.ah"]h$]h&]uh1j!hj@ubah}(h]h ](jjeh"]h$]h&]hhuh1jmhjhhhj1hKTubj)}(h2(struct kunit *test, struct platform_device *pdev)h](j)}(hstruct kunit *testh](h)}(hhh]hstruct}(hj`hhhNhNubah}(h]h ]jah"]h$]h&]uh1hhj\ubj)}(h h]h }(hjmhhhNhNubah}(h]h ]jah"]h$]h&]uh1j hj\ubh)}(hhh]j")}(hkunith]hkunit}(hj~hhhNhNubah}(h]h ]j.ah"]h$]h&]uh1j!hj{ubah}(h]h ]h"]h$]h&] refdomainj9reftypej; reftargetjmodnameN classnameNj?jB)}jE]jH)}j;jFsbc.kunit_platform_device_addasbuh1hhj\ubj)}(h h]h }(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1j hj\ubj])}(hj`h]h*}(hjhhhNhNubah}(h]h ]jiah"]h$]h&]uh1j\hj\ubj")}(htesth]htest}(hjhhhNhNubah}(h]h ]j.ah"]h$]h&]uh1j!hj\ubeh}(h]h ]h"]h$]h&]noemphhhuh1jhjXubj)}(hstruct platform_device *pdevh](h)}(hhh]hstruct}(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1hhjubj)}(h h]h }(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1j hjubh)}(hhh]j")}(hplatform_deviceh]hplatform_device}(hjhhhNhNubah}(h]h ]j.ah"]h$]h&]uh1j!hjubah}(h]h ]h"]h$]h&] refdomainj9reftypej; reftargetjmodnameN classnameNj?jB)}jE]jc.kunit_platform_device_addasbuh1hhjubj)}(h h]h }(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1j hjubj])}(hj`h]h*}(hjhhhNhNubah}(h]h ]jiah"]h$]h&]uh1j\hjubj")}(hpdevh]hpdev}(hj)hhhNhNubah}(h]h ]j.ah"]h$]h&]uh1j!hjubeh}(h]h ]h"]h$]h&]noemphhhuh1jhjXubeh}(h]h ]h"]h$]h&]hhuh1jhjhhhj1hKTubeh}(h]h ]h"]h$]h&]hhjuh1hjjhjhhhj1hKTubah}(h]jah ](jjeh"]h$]h&]jj)jhuh1hhj1hKThjhhubj)}(hhh]h)}(h-Register a KUnit test managed platform deviceh]h-Register a KUnit test managed platform device}(hjShhhNhNubah}(h]h ]h"]h$]h&]uh1hhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chKThjPhhubah}(h]h ]h"]h$]h&]uh1jhjhhhj1hKTubeh}(h]h ](j9functioneh"]h$]h&]jj9jjkjjkjjjuh1hhhhhhNhNubj)}(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)}(hjuh]h Parameters}(hjwhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjsubah}(h]h ]h"]h$]h&]uh1hhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chKXhjoubj)}(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.chKUhjubj)}(hhh]h)}(h test contexth]h test context}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhKUhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhjhKUhjubj)}(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.chKVhjubj)}(hhh]h)}(hplatform device to addh]hplatform device to add}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhKVhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhjhKVhjubeh}(h]h ]h"]h$]h&]uh1jhjoubh)}(h**Description**h]j)}(hjh]h Description}(hj hhhNhNubah}(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.chKXhjoubh)}(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.chKXhjoubh)}(h **Return**h]j)}(hj/h]hReturn}(hj1hhhNhNubah}(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.chK[hjoubh)}(h(0 on success, negative errno on failure.h]h(0 on success, negative errno on failure.}(hjEhhhNhNubah}(h]h ]h"]h$]h&]uh1hhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chK[hjoubeh}(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](h)}(hyint kunit_platform_device_prepare_wait_for_probe (struct kunit *test, struct platform_device *pdev, struct completion *x)h]h)}(hxint kunit_platform_device_prepare_wait_for_probe(struct kunit *test, struct platform_device *pdev, struct completion *x)h](j!)}(hinth]hint}(hjthhhNhNubah}(h]h ]j-ah"]h$]h&]uh1j hjphhhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chKubj)}(h h]h }(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1j hjphhhjhKubjn)}(h,kunit_platform_device_prepare_wait_for_probeh]j")}(h,kunit_platform_device_prepare_wait_for_probeh]h,kunit_platform_device_prepare_wait_for_probe}(hjhhhNhNubah}(h]h ]j.ah"]h$]h&]uh1j!hjubah}(h]h ](jjeh"]h$]h&]hhuh1jmhjphhhjhKubj)}(hH(struct kunit *test, struct platform_device *pdev, struct completion *x)h](j)}(hstruct kunit *testh](h)}(hhh]hstruct}(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1hhjubj)}(h h]h }(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1j hjubh)}(hhh]j")}(hkunith]hkunit}(hjhhhNhNubah}(h]h ]j.ah"]h$]h&]uh1j!hjubah}(h]h ]h"]h$]h&] refdomainj9reftypej; reftargetjmodnameN classnameNj?jB)}jE]jH)}j;jsb.c.kunit_platform_device_prepare_wait_for_probeasbuh1hhjubj)}(h h]h }(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1j hjubj])}(hj`h]h*}(hjhhhNhNubah}(h]h ]jiah"]h$]h&]uh1j\hjubj")}(htesth]htest}(hj hhhNhNubah}(h]h ]j.ah"]h$]h&]uh1j!hjubeh}(h]h ]h"]h$]h&]noemphhhuh1jhjubj)}(hstruct platform_device *pdevh](h)}(hhh]hstruct}(hj#hhhNhNubah}(h]h ]jah"]h$]h&]uh1hhjubj)}(h h]h }(hj0hhhNhNubah}(h]h ]jah"]h$]h&]uh1j hjubh)}(hhh]j")}(hplatform_deviceh]hplatform_device}(hjAhhhNhNubah}(h]h ]j.ah"]h$]h&]uh1j!hj>ubah}(h]h ]h"]h$]h&] refdomainj9reftypej; reftargetjCmodnameN classnameNj?jB)}jE]j.c.kunit_platform_device_prepare_wait_for_probeasbuh1hhjubj)}(h h]h }(hj_hhhNhNubah}(h]h ]jah"]h$]h&]uh1j hjubj])}(hj`h]h*}(hjmhhhNhNubah}(h]h ]jiah"]h$]h&]uh1j\hjubj")}(hpdevh]hpdev}(hjzhhhNhNubah}(h]h ]j.ah"]h$]h&]uh1j!hjubeh}(h]h ]h"]h$]h&]noemphhhuh1jhjubj)}(hstruct completion *xh](h)}(hhh]hstruct}(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1hhjubj)}(h h]h }(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1j hjubh)}(hhh]j")}(h completionh]h completion}(hjhhhNhNubah}(h]h ]j.ah"]h$]h&]uh1j!hjubah}(h]h ]h"]h$]h&] refdomainj9reftypej; reftargetjmodnameN classnameNj?jB)}jE]j.c.kunit_platform_device_prepare_wait_for_probeasbuh1hhjubj)}(h h]h }(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1j hjubj])}(hj`h]h*}(hjhhhNhNubah}(h]h ]jiah"]h$]h&]uh1j\hjubj")}(hxh]hx}(hjhhhNhNubah}(h]h ]j.ah"]h$]h&]uh1j!hjubeh}(h]h ]h"]h$]h&]noemphhhuh1jhjubeh}(h]h ]h"]h$]h&]hhuh1jhjphhhjhKubeh}(h]h ]h"]h$]h&]hhjuh1hjjhjlhhhjhKubah}(h]jgah ](jjeh"]h$]h&]jj)jhuh1hhjhKhjihhubj)}(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}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chKhjhhubah}(h]h ]h"]h$]h&]uh1jhjihhhjhKubeh}(h]h ](j9functioneh"]h$]h&]jj9jj,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)}(hj6h]h Parameters}(hj8hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj4ubah}(h]h ]h"]h$]h&]uh1hhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chKhj0ubj)}(hhh](j)}(h$``struct kunit *test`` test context h](j)}(h``struct kunit *test``h]j )}(hjUh]hstruct kunit *test}(hjWhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjSubah}(h]h ]h"]h$]h&]uh1jhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chKhjOubj)}(hhh]h)}(h test contexth]h test context}(hjnhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjjhKhjkubah}(h]h ]h"]h$]h&]uh1jhjOubeh}(h]h ]h"]h$]h&]uh1jhjjhKhjLubj)}(hQ``struct platform_device *pdev`` platform device to prepare to wait for probe of 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.chKhjubj)}(hhh]h)}(h/platform device to prepare to wait for probe ofh]h/platform device to prepare to wait for probe of}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhKhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhjhKhjLubj)}(hO``struct completion *x`` completion variable completed when **dev** has probed h](j)}(h``struct completion *x``h]j )}(hjh]hstruct completion *x}(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.chKhjubj)}(hhh]h)}(h5completion variable completed when **dev** has probedh](h#completion variable completed when }(hjhhhNhNubj)}(h**dev**h]hdev}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh has probed}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhjhKhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhjhKhjLubeh}(h]h ]h"]h$]h&]uh1jhj0ubh)}(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.chKhj0ubh)}(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 }(hj* hhhNhNubj)}(h**x**h]hx}(hj2 hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj* ubh to wait for }(hj* hhhNhNubj)}(h**pdev**h]hpdev}(hjD hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj* ubh` to probe. Waiting on the completion forces a preemption, allowing the platform driver to probe.}(hj* hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chKhj0ubh)}(hExampleh]hExample}(hj] hhhNhNubah}(h]h ]h"]h$]h&]uh1hhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chKhj0ubh 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)); }}hjn sbah}(h]h ]h"]h$]h&]hhforcelanguagej9highlight_args}uh1jl hf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chKhj0ubh)}(h **Return**h]j)}(hj h]hReturn}(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.chKhj0ubh)}(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.chKhj0ubeh}(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](h)}(hTint kunit_platform_driver_register (struct kunit *test, struct platform_driver *drv)h]h)}(hSint kunit_platform_driver_register(struct kunit *test, struct platform_driver *drv)h](j!)}(hinth]hint}(hj hhhNhNubah}(h]h ]j-ah"]h$]h&]uh1j hj hhhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chKubj)}(h h]h }(hj hhhNhNubah}(h]h ]jah"]h$]h&]uh1j hj hhhj hKubjn)}(hkunit_platform_driver_registerh]j")}(hkunit_platform_driver_registerh]hkunit_platform_driver_register}(hj hhhNhNubah}(h]h ]j.ah"]h$]h&]uh1j!hj ubah}(h]h ](jjeh"]h$]h&]hhuh1jmhj hhhj hKubj)}(h1(struct kunit *test, struct platform_driver *drv)h](j)}(hstruct kunit *testh](h)}(hhh]hstruct}(hj hhhNhNubah}(h]h ]jah"]h$]h&]uh1hhj ubj)}(h h]h }(hj hhhNhNubah}(h]h ]jah"]h$]h&]uh1j hj ubh)}(hhh]j")}(hkunith]hkunit}(hj# hhhNhNubah}(h]h ]j.ah"]h$]h&]uh1j!hj ubah}(h]h ]h"]h$]h&] refdomainj9reftypej; reftargetj% modnameN classnameNj?jB)}jE]jH)}j;j sb c.kunit_platform_driver_registerasbuh1hhj ubj)}(h h]h }(hjC hhhNhNubah}(h]h ]jah"]h$]h&]uh1j hj ubj])}(hj`h]h*}(hjQ hhhNhNubah}(h]h ]jiah"]h$]h&]uh1j\hj ubj")}(htesth]htest}(hj^ hhhNhNubah}(h]h ]j.ah"]h$]h&]uh1j!hj ubeh}(h]h ]h"]h$]h&]noemphhhuh1jhj ubj)}(hstruct platform_driver *drvh](h)}(hhh]hstruct}(hjw hhhNhNubah}(h]h ]jah"]h$]h&]uh1hhjs ubj)}(h h]h }(hj hhhNhNubah}(h]h ]jah"]h$]h&]uh1j hjs ubh)}(hhh]j")}(hplatform_driverh]hplatform_driver}(hj hhhNhNubah}(h]h ]j.ah"]h$]h&]uh1j!hj ubah}(h]h ]h"]h$]h&] refdomainj9reftypej; reftargetj modnameN classnameNj?jB)}jE]j? c.kunit_platform_driver_registerasbuh1hhjs ubj)}(h h]h }(hj hhhNhNubah}(h]h ]jah"]h$]h&]uh1j hjs ubj])}(hj`h]h*}(hj hhhNhNubah}(h]h ]jiah"]h$]h&]uh1j\hjs ubj")}(hdrvh]hdrv}(hj hhhNhNubah}(h]h ]j.ah"]h$]h&]uh1j!hjs ubeh}(h]h ]h"]h$]h&]noemphhhuh1jhj ubeh}(h]h ]h"]h$]h&]hhuh1jhj hhhj hKubeh}(h]h ]h"]h$]h&]hhjuh1hjjhj hhhj hKubah}(h]j ah ](jjeh"]h$]h&]jj)jhuh1hhj hKhj hhubj)}(hhh]h)}(h-Register a KUnit test managed platform driverh]h-Register a KUnit test managed platform driver}(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 ](j9functioneh"]h$]h&]jj9jj jj jjjuh1hhhhhhNhNubj)}(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)}(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 )}(hj9 h]hstruct kunit *test}(hj; hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj7 ubah}(h]h ]h"]h$]h&]uh1jhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chKhj3 ubj)}(hhh]h)}(h test contexth]h test context}(hjR hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjN hKhjO ubah}(h]h ]h"]h$]h&]uh1jhj3 ubeh}(h]h ]h"]h$]h&]uh1jhjN hKhj0 ubj)}(h<``struct platform_driver *drv`` platform driver to register h](j)}(h``struct platform_driver *drv``h]j )}(hjr h]hstruct platform_driver *drv}(hjt hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjp ubah}(h]h ]h"]h$]h&]uh1jhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chKhjl ubj)}(hhh]h)}(hplatform driver to registerh]hplatform driver to register}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hKhj ubah}(h]h ]h"]h$]h&]uh1jhjl ubeh}(h]h ]h"]h$]h&]uh1jhj hKhj0 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&]uh1hhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chKhj ubh)}(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 }(hj hhhNhNubj)}(h**drv**h]hdrv}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubhj in a container structure and use container_of() in the probe function to pass information to KUnit tests.}(hj hhhNhNubeh}(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}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chKhj ubjm )}(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"); }}hj sbah}(h]h ]h"]h$]h&]hhj| j} j9j~ }uh1jl hf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chKhj ubh)}(h **Return**h]j)}(hj h]hReturn}(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.chM!hj 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&]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_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}j6 j3 s nametypes}j6 sh}(j3 hhhjjjgjlj 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.