kunit_platform_device_add(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… kunit_platform_device_add(9)

okay so bestie, welcome to the Kernel API Manual ✨ this one's kunit_platform_device_add(9) and it's literally the chillest way to hand a platform device over to KUnit and let the test framework clean up after you 🫢


✨ SYNOPSIS ✨

int kunit_platform_device_add (struct kunit *test , struct platform_device *pdev );

🌸 ARGUMENTS 🌸

  • test β€” the test context, aka your main character ✨ it's the struct kunit * that owns the device's whole lifecycle.
  • pdev β€” the platform device to add, the struct platform_device * you're handing over πŸŽ€

πŸ’– DESCRIPTION πŸ’–

So here's the vibe: you call this and it registers a test managed platform device. The way that works is πŸ‘‘ KUnit takes ownership β€” when the test completes, the device gets unregistered for you. No manual teardown, no "oops I forgot to clean up," no cap fr fr πŸ¦‹

Like, you add it, the test runs, the test finishes, and the device is gone. Slay πŸ’…


πŸ”₯ RETURN πŸ”₯

  • 0 on success ✨ ate
  • negative errno on failure 😭 (not me getting a negative back β€” yeah bestie, check it)

πŸŽ€ SEE ALSO πŸŽ€

Kernel file ./lib/kunit/platform.c and the rest of the friend group:


ngl, if you're poking around in ./lib/kunit you're already doing amazing, keep going 🧚

and that's the page bestie 🌈 this one lives in ./lib/kunit, dated October 2026 β€” vintage without even trying πŸ’œ catch you in the next manpage πŸ’–

πŸ“¦ where this page comes from