STRUCT B43_PHY_OPERATIONS(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… struct b43_phy_operations(9) β€” a Kernel API Manual moment ✨

okay so bestie, gather round, because this one is literally the plug-and-play contract for b43 PHY drivers 🫢 it's the big ol' pile of function pointers that says "here's how you talk to my PHY," and it lives in the Kernel API Manual. every single member below is a vibe check the driver has to pass. no cap, some of them are mandatory and the kernel will absolutely not be normal about it if you leave them NULL 😭


✨ NAME ✨

struct b43_phy_operations β€” Function pointers for PHY ops. that's it, that's the whole name. it's giving "interface struct with main character energy" πŸ‘‘


🌸 SYNOPSIS 🌸

struct b43_phy_operations {
    int (*allocate)(struct b43_wldev *dev);
    void (*free)(struct b43_wldev *dev);
    void (*prepare_structs)(struct b43_wldev *dev);
    int (*prepare_hardware)(struct b43_wldev *dev);
    int (*init)(struct b43_wldev *dev);
    void (*exit)(struct b43_wldev *dev);
    u16 (*phy_read)(struct b43_wldev *dev, u16 reg);
    void (*phy_write)(struct b43_wldev *dev, u16 reg, u16 value);
    void (*phy_maskset)(struct b43_wldev *dev, u16 reg, u16 mask, u16 set);
    u16 (*radio_read)(struct b43_wldev *dev, u16 reg);
    void (*radio_write)(struct b43_wldev *dev, u16 reg, u16 value);
    bool (*supports_hwpctl)(struct b43_wldev *dev);
    void (*software_rfkill)(struct b43_wldev *dev, bool blocked);
    void (*switch_analog)(struct b43_wldev *dev, bool on);
    int (*switch_channel)(struct b43_wldev *dev, unsigned int new_channel);
    unsigned int (*get_default_chan)(struct b43_wldev *dev);
    void (*set_rx_antenna)(struct b43_wldev *dev, int antenna);
    int (*interf_mitigation)(struct b43_wldev *dev, enum b43_interference_mitigation new_mode);
    enum b43_txpwr_result (*recalc_txpower)(struct b43_wldev *dev, bool ignore_tssi);
    void (*adjust_txpower)(struct b43_wldev *dev);
    void (*pwork_15sec)(struct b43_wldev *dev);
    void (*pwork_60sec)(struct b43_wldev *dev);
 };

πŸ¦‹ Members πŸ¦‹

listen, every one of these is a slot in the struct. some say "Must not be NULL" and they mean it πŸ’€

  • allocate β€” Allocate and initialise the PHY data structures. Must not be NULL. 🚨
  • free β€” Destroy and free the PHY data structures. Must not be NULL. 🚨 (yes, she's the cleanup girlie, be nice to her)
  • prepare_structs β€” Prepare the PHY data structures. The data structures allocated in allocate are initialized here. Must not be NULL. πŸ”₯
  • prepare_hardware β€” Prepare the PHY. This is called before b43_chip_init to do some early PHY hardware init. Can be NULL, if not required. πŸ™ˆ
  • init β€” Initialize the PHY. Must not be NULL. ⭐
  • exit β€” Shutdown the PHY. Can be NULL, if not required. πŸŽ€ (the graceful goodbye, optional but slay)
  • phy_read β€” Read from a PHY register. Must not be NULL. πŸ’–
  • phy_write β€” Write to a PHY register. Must not be NULL. πŸ’–
  • phy_maskset β€” Maskset a PHY register, taking shortcuts. If it is NULL, a generic algorithm is used. 🧚 (lowkey the optional speedrun version)
  • radio_read β€” Read from a Radio register. Must not be NULL. πŸ“»
  • radio_write β€” Write to a Radio register. Must not be NULL. πŸ“»
  • supports_hwpctl β€” Returns a boolean whether Hardware Power Control is supported or not. If NULL, hwpctl is assumed to be never supported. πŸ™…β€β™€οΈ (no callback = no hardware power control, periodt)
  • software_rfkill β€” Turn the radio ON or OFF. Possible state values are RFKILL_STATE_SOFT_BLOCKED or RFKILL_STATE_UNBLOCKED. Must not be NULL. 🚨
  • switch_analog β€” Turn the Analog on/off. Must not be NULL. πŸ”Œ
  • switch_channel β€” Switch the radio to another channel. Must not be NULL. πŸ“Ά
  • get_default_chan β€” Just returns the default channel number. Must not be NULL. 🎯 (a whole callback whose only job is vibes and a number, iconic)
  • set_rx_antenna β€” Set the antenna used for RX. Can be NULL, if not supported. πŸ¦‹
  • interf_mitigation β€” Switch the Interference Mitigation mode. Can be NULL, if not supported. 🌈
  • recalc_txpower β€” Recalculate the transmission power parameters. This callback has to recalculate the TX power settings, but does not need to write them to the hardware, yet. ✍️ Returns enum b43_txpwr_result to indicate whether the hardware needs to be adjusted. If B43_TXPWR_NEED_ADJUST is returned, adjust_txpower will be called later. If the parameter "ignore_tssi" is true, the TSSI values should be ignored and a recalculation of the power settings should be done even if the TSSI values did not change. This function may sleep, but should not. Must not be NULL. 😴πŸ”₯ ("may sleep, but should not" is such a mood honestly)
  • adjust_txpower β€” Write the previously calculated TX power settings (from recalc_txpower) to the hardware. This function may sleep. Can be NULL, if (and ONLY if) recalc_txpower _always_ returns B43_TXPWR_RES_DONE. ⚠️ like, the capital-letters ONLY if, bestie, don't test her
  • pwork_15sec β€” Periodic work. Called every 15 seconds. Can be NULL, if not required. ⏰
  • pwork_60sec β€” Periodic work. Called every 60 seconds. Can be NULL, if not required. ⏳

πŸ‘‘ SEE ALSO πŸ‘‘

Kernel file ./drivers/net/wireless/broadcom/b43/phy_common.h, plus the whole friend group:


πŸ’€ real talk though: those "Must not be NULL" members are not a suggestion. there is no soft launch here. fill them in or the PHY is not loading, iykyk.

and that's the page, bestie ✨ this one came out of ./drivers/net/wireless/broadco... and it's dated October 2026 β€” so go forth, fill your function pointers in correctly, and remember: Must not be NULL means Must not be NULL πŸŽ€πŸ’…πŸ«Ά

πŸ“¦ where this page comes from