devm_mux_state_get_from_np(9)
π devm_mux_state_get_from_np(9) β like, the managed way to grab a mux-state, bestie
okay so real talk β this is a page from the Kernel API Manual, and it's about one very specific lil function that gets you a mux-state for a device with resource management baked in. no manual cleanup era. we love to see it. π
β¨ SYNOPSIS β¨
struct mux_state * devm_mux_state_get_from_np (struct device *dev ,
const char *mux_name , struct device_node *np );
that's the whole signature, no cap. she takes three args and hands you back a struct mux_state *. π
πΈ ARGUMENTS πΈ
devβ the device that needs a mux-control. like, this is the main character of the call, the one who's gonna use the mux. πmux_nameβ the name identifying the mux-control. this is how you tell it which mux you're on about, iykyk. π¦npβ the device nodes. and listen: if it'sNULL, it just usesdev->of_nodeinstead. convenient fr fr. β¨
π₯ RETURN π₯
you get back a pointer to the mux-state β or an ERR_PTR with a negative errno if things went sideways. π so yeah, always check that thing before you go dereferencing, bestie.
π DESCRIPTION π
the mux-state will automatically be freed on release. that's the whole devm magic, and honestly? it's giving "I don't have time to call free myself" energy. slay. π«Ά
π SEE ALSO π
okay this list is long, so buckle up. she was thorough. π
- the kernel file
./drivers/mux/core.cβ that's the source, go read it, it's iconic struct mux_state(9)struct devm_mux_state_state(9)mux_chip_alloc(9)mux_chip_register(9)mux_chip_unregister(9)mux_chip_free(9)devm_mux_chip_alloc(9)devm_mux_chip_register(9)mux_control_states(9)mux_control_select_delay(9)mux_state_select_delay(9)mux_control_try_select_delay(9)mux_state_try_select_delay(9)mux_control_deselect(9)mux_state_deselect(9)mux_get(9)mux_control_get(9)mux_control_get_optional(9)mux_control_put(9)devm_mux_control_get(9)mux_state_get(9)__devm_mux_state_get(9)devm_mux_state_get_optional(9)devm_mux_state_get_selected(9)devm_mux_state_get_optional_selected(9)
like I said. thorough. main character energy from the whole mux subsystem honestly. π
β tiny vibe check: devm_mux_state_get_from_np gives you the resource-managed version, so the freeing happens for you on release β don't go freeing it yourself, that's not the move. π§
and that's the page! πΈ this one lives under ./drivers/mux, it's from the Kernel API Manual, and it was dated October 2026. go forth and mux responsibly, bestie β mwah ππ
β¨
π¦ 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