kunit_device_register(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 see kunit_device_register_with_driver if you're feeling brave and wanna provide your own struct 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 🌈

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