mdio_mux_mul...er_switch_fn(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

🌸 mdio_mux_mul...er_switch_fn(9) β€” the Kernel API Manual, bestie edition 🌸

okay so real talk, this is a page from the Linux Kernel API manual, and the whole vibe is "callback function that the mdio-mux layer calls when it thinks the mux needs to switch." That's the name up top, mdio_mux_mul...er_switch_fn(9) β€” yes the kernel truncated it, no we're not gonna fix it, it's iconic as-is. πŸ’…


✨ NAME ✨

mdio_mux_multiplexer_switch_fn β€” the function that the mdio-mux layer literally calls up when it thinks the mdio bus multiplexer needs to switch. it's giving "hey bestie, time to flip the switch" πŸ¦‹


✨ SYNOPSIS ✨

int mdio_mux_multiplexer_switch_fn (int current_child , int
       desired_child , void *data );

that's the whole signature, no cap. three args, one int coming back at ya. ✨


✨ ARGUMENTS ✨

  • current_child β€” the current value of the mux register. like, what the mux is currently serving. the before pic. πŸ™ˆ
  • desired_child β€” the value of the 'reg' property of the target child MDIO node. i.e. where we want to be. the glow-up pic. πŸ”₯
  • data β€” private data used by this switch_fn, passed to the mdio_mux_init function via mdio_mux_init(.., .., .., .., data, ..). yep, that's the exact call, dots and all β€” we do not edit the dots, the dots are load-bearing. πŸŽ€

✨ DESCRIPTION ✨

the first time this function gets called, current_child == -1. that's your little "hiii, we just met" moment β€” the mux hasn't been set to anything yet, so -1 is the flag for "brand new, no thoughts, head empty." πŸ‘‘

and if current_child == desired_child? then the mux is already set to the correct bus. nothing to do, no switch needed, she's already slaying in the right lane. ⭐

so basically: compare current_child to desired_child, and remember that the first-ever call shows up as current_child == -1. iykyk. πŸ’œ


✨ SEE ALSO ✨

  • Kernel file ./drivers/net/mdio/mdio-mux-multiplexer.c β€” go read the source bestie, it's all there 🫢

lowkey important: when current_child == desired_child, the mux is already on the correct bus β€” so don't go switching things that are already switched. main character energy is knowing when to do nothing. πŸ’…

and that's the page!! πŸŽ€ manual name mdio_mux_mul...er_switch_fn(9), straight out of ./drivers/net/mdio, dated October 2026 β€” mwah, go forth and multiplex, bestie πŸ’–βœ¨πŸŒˆ

πŸ“¦ where this page comes from