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.chK/hjubh)}(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](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.chKTubj")}(h h]h }(hjFhhhNhNubah}(h]h ]j.ah"]h$]h&]uh1j!hj3hhhjEhKTubj)}(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&]hhuh1jhj3hhhjEhKTubj)}(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&]hhuh1jhj3hhhjEhKTubeh}(h]h ]h"]h$]h&]hhjuh1j jjhj/hhhjEhKTubah}(h]j*ah ](jjeh"]h$]h&]jj)jhuh1jhjEhKThj,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.chKThjdhhubah}(h]h ]h"]h$]h&]uh1jhj,hhhjEhKTubeh}(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.chKXhjubj )}(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.chKUhjubj3)}(hhh]h)}(h test contexth]h test context}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhKUhjubah}(h]h ]h"]h$]h&]uh1j2hjubeh}(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.chKVhjubj3)}(hhh]h)}(hplatform device to addh]hplatform device to add}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhKVhjubah}(h]h ]h"]h$]h&]uh1j2hjubeh}(h]h ]h"]h$]h&]uh1jhjhKVhjubeh}(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.chKXhjubh)}(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.chKWhjubh)}(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.chKZhjubh)}(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](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}(hjhhhNhNubah}(h]h ]jAah"]h$]h&]uh1j4hjhhhf/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!hjhhhjhKubj)}(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}(hjhhhNhNubah}(h]h ]jBah"]h$]h&]uh1j5hjubah}(h]h ](jjeh"]h$]h&]hhuh1jhjhhhjhKubj)}(hH(struct kunit *test, struct platform_device *pdev, struct completion *x)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 reftargetjmodnameN classnameNjSjV)}jY]j\)}jOjsb.c.kunit_platform_device_prepare_wait_for_probeasbuh1hhjubj")}(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)}(hstruct platform_device *pdevh](j)}(hjh]hstruct}(hj7hhhNhNubah}(h]h ]jah"]h$]h&]uh1jhj3ubj")}(h h]h }(hjDhhhNhNubah}(h]h ]j.ah"]h$]h&]uh1j!hj3ubh)}(hhh]j6)}(hplatform_deviceh]hplatform_device}(hjUhhhNhNubah}(h]h ]jBah"]h$]h&]uh1j5hjRubah}(h]h ]h"]h$]h&] refdomainjMreftypejO reftargetjWmodnameN classnameNjSjV)}jY]j.c.kunit_platform_device_prepare_wait_for_probeasbuh1hhj3ubj")}(h h]h }(hjshhhNhNubah}(h]h ]j.ah"]h$]h&]uh1j!hj3ubjq)}(hjth]h*}(hjhhhNhNubah}(h]h ]j}ah"]h$]h&]uh1jphj3ubj6)}(hpdevh]hpdev}(hjhhhNhNubah}(h]h ]jBah"]h$]h&]uh1j5hj3ubeh}(h]h ]h"]h$]h&]noemphhhuh1jhjubj)}(hstruct completion *xh](j)}(hjh]hstruct}(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjubj")}(h h]h }(hjhhhNhNubah}(h]h ]j.ah"]h$]h&]uh1j!hjubh)}(hhh]j6)}(h completionh]h completion}(hjhhhNhNubah}(h]h ]jBah"]h$]h&]uh1j5hjubah}(h]h ]h"]h$]h&] refdomainjMreftypejO reftargetjmodnameN classnameNjSjV)}jY]j.c.kunit_platform_device_prepare_wait_for_probeasbuh1hhjubj")}(h h]h }(hjhhhNhNubah}(h]h ]j.ah"]h$]h&]uh1j!hjubjq)}(hjth]h*}(hjhhhNhNubah}(h]h ]j}ah"]h$]h&]uh1jphjubj6)}(hxh]hx}(hjhhhNhNubah}(h]h ]jBah"]h$]h&]uh1j5hjubeh}(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)}(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&]uh1jhj}hhhjhKubeh}(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)}(hjJh]h Parameters}(hjLhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjHubah}(h]h ]h"]h$]h&]uh1hhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chKhjDubj )}(hhh](j)}(h$``struct kunit *test`` test context h](j)}(h``struct kunit *test``h]j)}(hjih]hstruct kunit *test}(hjkhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjgubah}(h]h ]h"]h$]h&]uh1jhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chKhjcubj3)}(hhh]h)}(h test contexth]h test context}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhj~hKhjubah}(h]h ]h"]h$]h&]uh1j2hjcubeh}(h]h ]h"]h$]h&]uh1jhj~hKhj`ubj)}(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.chKhjubj3)}(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&]uh1j2hjubeh}(h]h ]h"]h$]h&]uh1jhjhKhj`ubj)}(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.chKhjubj3)}(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&]uh1j2hjubeh}(h]h ]h"]h$]h&]uh1jhjhKhj`ubeh}(h]h ]h"]h$]h&]uh1j hjDubh)}(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.chKhjDubh)}(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}(hjF hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj> ubh to wait for }(hj> hhhNhNubj)}(h**pdev**h]hpdev}(hjX 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.chKhjDubh)}(hExampleh]hExample}(hjq hhhNhNubah}(h]h ]h"]h$]h&]uh1hhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chKhjDubh 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)); }}hj sbah}(h]h ]h"]h$]h&]hhƌforcelanguagejMhighlight_args}uh1j hf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chKhjDubh)}(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.chKhjDubh)}(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.chKhjDubeh}(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}(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)}(hkunit_platform_driver_registerh]j6)}(hkunit_platform_driver_registerh]hkunit_platform_driver_register}(hj hhhNhNubah}(h]h ]jBah"]h$]h&]uh1j5hj ubah}(h]h ](jjeh"]h$]h&]hhuh1jhj hhhj hKubj)}(h1(struct kunit *test, struct platform_driver *drv)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}(hj7 hhhNhNubah}(h]h ]jBah"]h$]h&]uh1j5hj4 ubah}(h]h ]h"]h$]h&] refdomainjMreftypejO reftargetj9 modnameN classnameNjSjV)}jY]j\)}jOj sb c.kunit_platform_driver_registerasbuh1hhj ubj")}(h h]h }(hjW hhhNhNubah}(h]h ]j.ah"]h$]h&]uh1j!hj ubjq)}(hjth]h*}(hje hhhNhNubah}(h]h ]j}ah"]h$]h&]uh1jphj ubj6)}(htesth]htest}(hjr hhhNhNubah}(h]h ]jBah"]h$]h&]uh1j5hj ubeh}(h]h ]h"]h$]h&]noemphhhuh1jhj ubj)}(hstruct platform_driver *drvh](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_driverh]hplatform_driver}(hj hhhNhNubah}(h]h ]jBah"]h$]h&]uh1j5hj ubah}(h]h ]h"]h$]h&] refdomainjMreftypejO reftargetj modnameN classnameNjSjV)}jY]jS c.kunit_platform_driver_registerasbuh1hhj 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)}(hdrvh]hdrv}(hj hhhNhNubah}(h]h ]jBah"]h$]h&]uh1j5hj ubeh}(h]h ]h"]h$]h&]noemphhhuh1jhj 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-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 ](jMfunctioneh"]h$]h&]jjMjj$ 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}(hj0 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)}(hjM h]hstruct kunit *test}(hjO hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjK ubah}(h]h ]h"]h$]h&]uh1jhf/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/api/platformdevice:9: ./lib/kunit/platform.chKhjG ubj3)}(hhh]h)}(h test contexth]h test context}(hjf hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjb hKhjc ubah}(h]h ]h"]h$]h&]uh1j2hjG ubeh}(h]h ]h"]h$]h&]uh1jhjb hKhjD ubj)}(h<``struct platform_driver *drv`` platform driver to register h](j)}(h``struct platform_driver *drv``h]j)}(hj h]hstruct platform_driver *drv}(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 driver to registerh]hplatform driver to register}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hKhj ubah}(h]h ]h"]h$]h&]uh1j2hj ubeh}(h]h ]h"]h$]h&]uh1jhj hKhjD 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)}(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( ubj )}(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 jMj }uh1j 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_handlerjp error_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}jJ jG s nametypes}jJ sh}(jG hhjj*j/j{jj 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.