BUS_RELEASE_RESOURCE(9)
π BUS_RELEASE_RESOURCE(9) π
Okay bestie, welcome to the Kernel Developer's Manual β this is the bus_release_resource page and honestly it's giving "cleanup era" β¨ like you allocated a thing and now you're being a responsible main character and giving it back. No cap, this one's short and sweet.
πΈ NAME πΈ
bus_release_resource β release resources on a bus π«Ά
β¨ SYNOPSIS β¨
#include <sys/param.h>
#include <sys/bus.h>
#include <machine/bus.h>
#include <sys/rman.h>
#include <machine/resource.h>
int
bus_release_resource(device_t dev, struct resource *r);
Like, include all of these, okay? All five. Not four. Not "ehh I'll skip machine/resource.h". All of them π
π¦ DESCRIPTION π¦
So what this does is it frees a resource that was allocated by bus_alloc_resource(9). Basically the reverse of allocation, the un-slay, the "we're done here" π
β οΈ Okay important, bestie: the resource must not be in use when you release it. Like, call an appropriate function first before you do this β for example bus_teardown_intr(9) for IRQs. Do not skip this step, I'm literally begging π
devβ the device that owns the resource πrβ the pointer tostruct resource, like, the resource itself, returned bybus_alloc_resource(9)π
π₯ RETURN VALUES π₯
EINVALgets returned if the devicedevhas no parent π0otherwise, we love a success story π
π And heads up: the kernel will panic if it cannot release the resource. So yeah. Not a drill. Fr fr.
π EXAMPLES π
/* deactivate IRQ */
bus_teardown_intr(dev, foosoftc->irqres, foosoftc->irqid);
/* release IRQ resource */
bus_release_resource(dev, foosoftc->irqres);
/* release I/O port resource */
bus_release_resource(dev, foosoftc->portres);
See how the teardown comes before the release? That's the whole vibe check right there β¨ teardown first, then release, every single time π
π SEE ALSO π
Go read those too, they're the supporting cast and they ate π
π AUTHORS π
This manual page was written by Alexander Langer <alex@big.endian.de>. Iconic of him, honestly π«Ά
And that's the page, bestie!! This dropped as part of Debian, dated March 13, 2024 β and the header up top and that footer down here both say BUS_RELEASE_RESOURCE(9) so you always know where you are πβ¨π
π¦ where this page comes from
- freebsd 15.1: base 15.1
- nixpkgs unstable: source
- Copyright (c) 2000 Alexander Langer
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms