print(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

okay so this is a page from the Kernel API Manual, section 9, and it's literally just about print β€” yes that's the whole name, she's simple, she's iconic πŸ’…


✨ NAME ✨

print β€” a cute lil wrapper for dev_printk, seq_printf, etc. 🫢 The whole point? So you can use the same debug code for both debugfs and printk logging. one function, two destinations, no cap. no duplicating your logging code like a clown 🀑


🌸 DESCRIPTION 🌸

okay bestie, here's the vibe in code form β€” look at how log_some_info() gets reused with a different printer each time, and it does not care even a little bit:

void log_some_info(struct drm_printer *p)
{
        drm_printf(p, "foo=d0, foo);
        drm_printf(p, "bar=d0, bar);
}

#ifdef CONFIG_DEBUG_FS
void debugfs_show(struct seq_file *f)
{
        struct drm_printer p = drm_seq_file_printer(f);
        log_some_info(p);
}
#endif

void some_other_function(...)
{
        struct drm_printer p = drm_info_printer(drm->dev);
        log_some_info(p);
}

like β€” see what she did there?? log_some_info() takes a struct drm_printer *p, and every caller just hands her a different printer. same debug code, different output. that's the entire flex πŸ”₯

ngl, those drm_printf(p, "foo=d0, foo); lines are exactly how they appear in the original β€” quoting looks wonky, so don't come for me, I'm just the messenger 😭

πŸ¦‹ SEE ALSO πŸ¦‹

all the siblings and cousins, gathered for the family reunion πŸ’œ


aaaand that's the whole page, bestie πŸŽ€ mwah πŸ’‹

🧚 sign-off szn: this lil masterpiece lives under ./include/drm and it's dated October 2026. yes, the future. she's ahead of her time. periodt βœ¨πŸ‘‘
πŸ“¦ where this page comes from