mux_state_get(9)
π mux_state_get β from the Kernel API Manual β¨
okay bestie, gather round, because this one is a lookup function and she is lowkey the main character of the mux subsystem. mux_state_get is literally the function that goes "hey, does this device have a mux-state? and if so, can I have it?" π
β¨ NAME β¨
mux_state_get β Get the mux-state for a device. π«Ά that's it, that's the whole vibe.
πΈ SYNOPSIS πΈ
struct mux_state * mux_state_get (struct device *dev , const char
*mux_name , bool optional , struct device_node *np );
no cap, that's the exact signature, don't @ me, I copied it character for character π
π ARGUMENTS π
devβ The device that needs a mux-state. your little guy. the one who's asking. πmux_nameβ The name identifying the mux-state. like a name tag at a party, but for muxes. π·οΈoptionalβ Whether to returnNULLand silence errors when mux doesn't exist. so if it's set and the mux is a no-show, you get a chillNULLinstead of a whole dramatic error situation. πnpβ the device nodes, usedev->of_nodeif it isNULL. that's the fallback, that's the default, that's the move. π¦
β RETURN β
- Pointer to the mux-state on success π β you ate, congrats
- an
ERR_PTRwith a negative errno on error π β check it withIS_ERR()-energy, don't just raw-dog the pointer - or
NULLifoptionalis true and mux doesn't exist π β no drama, no error, just a gentle nothing
like yes queen, three whole outcomes, so please actually check what you got back before you dereference it. fr fr. π
π SEE ALSO π
the source of truth lives in the Kernel file ./drivers/mux/core.c β go read her, she's iconic. and then the whole extended friend group:
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)__devm_mux_state_get(9)devm_mux_state_get_from_np(9)devm_mux_state_get_optional(9)devm_mux_state_get_selected(9)devm_mux_state_get_optional_selected(9)
like, that's a whole group chat and every single one of them is in it. iykyk π
okay that's the page!! sourced straight from ./drivers/mux, dated October 2026, and brought to you by the Kernel API Manual. mwah π slay, go get your mux-state, and remember: check your return values bestie π§β¨
π¦ 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