kunit_device_register(9)
π kunit_device_register(9) π
ok so welcome to the Kernel API Manual, bestie β today's main character is kunit_device_register, and honestly? she's a little icon. β¨
πΈ NAME πΈ
kunit_device_register β literally just creates a struct device for you to use in KUnit tests π
π¦ SYNOPSIS π¦
struct device * kunit_device_register (struct kunit *test , const char
*name );
β¨ ARGUMENTS β¨
testβ the test context object. yes, that one. the whole vibe check of your test lives here π«Άnameβ the name you wanna give the created device. pick something cute, it's yours π
π DESCRIPTION π
okay so here's the tea: this bad boy creates a struct kunit_device (which, plot twist, is a struct device) with the name you passed in, plus a corresponding driver. matching set, no cap. π
the device and the driver both get cleaned up on test exit, or whenever kunit_device_unregister is called β so you don't have to stress about the mess, she handles it. π§Ήβ¨
also seekunit_device_register_with_driverif you're feeling brave and wanna provide your ownstruct device_driver. main character energy only. π₯
β RETURN β
you get back a pointer to a struct device which will be cleaned up when the test exits π β or, if the device could not be allocated or registered, an error pointer instead. so likeβ¦ check it, bestie. π
π SEE ALSO π
- Kernel file
./include/kunit/device.h kunit_driver_create(9)kunit_device_register_with_driver(9)kunit_device_unregister(9)
all linked, all iconic, go read them π¦
and that's the whole page! π big slay to ./include/kunit, dated October 2026 β mwah, periodt. πβ¨
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms