ofw_bus_status_okay(9)

✨ ofw_bus_status_okay(9) ✨

okay bestie, welcome to the Kernel Developer's Manual πŸ’– this one's a lil cutie from section 9, all about peeking at the device tree and asking the node like... "are u actually enabled rn or are u just sitting there" πŸ¦‹


πŸŽ€ NAME πŸŽ€

ofw_bus_get_status, ofw_bus_status_okay, ofw_bus_node_status_okay β€” check status of the device tree node


🌸 SYNOPSIS 🌸

#include <dev/ofw/openfirm.h>
#include <dev/ofw/ofw_bus.h>
#include <dev/ofw/ofw_bus_subr.h>

const char *
ofw_bus_get_status(device_t dev);

int
ofw_bus_status_okay(device_t dev);

int
ofw_bus_node_status_okay(phandle_t node);

πŸ’… DESCRIPTION πŸ’…

so the "status" property of a device tree node is literally the little "am I on or off" tag β€” it tells you whether the device is enabled or not. no cap. πŸ”₯

here's the tea tho: sometimes you got multiple hardware versions all built off the same base System-on-Chip but with a totally different set of blocks enabled. super common. so the move is to use the SoC device tree and just enable/disable the device nodes for the derivative boards. very main character energy. πŸ‘‘

and a device tree node is considered enabled only if it has a "status" property whose value is set to either "ok" or "okay". those are the only two vibes that pass the vibe check. if it's anything else, or the property's not even there... it's not enabled, bestie. periodt. ✨

  • ofw_bus_get_status() β€” returns the value of the "status" property of the device tree node associated with the device dev. if the node doesn't have a "status" property, or there's no node associated with the device at all, this function returns NULL. 😭
  • ofw_bus_status_okay() β€” returns 1 if the device tree node associated with the device dev has a "status" property and its value is either "ok" or "okay". 🫢
  • ofw_bus_node_status_okay() β€” returns 1 if the device tree node node has a "status" property and its value is either "ok" or "okay". same energy, just takes the node directly instead of the device. 🌈

πŸ‘‘ AUTHORS πŸ‘‘

This manual page was written by Oleksandr Tymoshenko.


Debian Β· April 8, 2018 Β· ofw_bus_status_okay(9)

and that's the whole page bestie, ily, go check ur node status and slay πŸ’…πŸ’–βœ¨

πŸ“¦ where this page comes from