STRUCT POWERCAP_ZONE_CONSTRAINT_OPS(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… struct powercap_zone_constraint_ops β€” the Kernel API Manual moment πŸŽ€

okay so bestie, you've stumbled into the Kernel API Manual page for struct powe...nstraint_ops(9) and honestly? it's giving "the blueprint for constraint callbacks" and we're gonna get through it together, no cap πŸ’–


✨ NAME ✨

struct powercap_zone_constraint_ops β€” literally the place where you Define constraint callbacks, bestie. that's the whole vibe πŸ¦‹


🌸 SYNOPSIS 🌸

like, here's the whole shape of it, verbatim, don't touch a single character πŸ‘‘

struct powercap_zone_constraint_ops {
    int (*set_power_limit_uw) (struct powercap_zone *, int, u64);
    int (*get_power_limit_uw) (struct powercap_zone *, int, u64 *);
    int (*set_time_window_us) (struct powercap_zone *, int, u64);
    int (*get_time_window_us) (struct powercap_zone *, int, u64 *);
    int (*get_max_power_uw) (struct powercap_zone *, int, u64 *);
    int (*get_min_power_uw) (struct powercap_zone *, int, u64 *);
    int (*get_max_time_window_us) (struct powercap_zone *, int, u64 *);
    int (*get_min_time_window_us) (struct powercap_zone *, int, u64 *);
    const char *(*get_name) (struct powercap_zone *, int);
};

🧚 Members 🧚

okay so every single one of these function pointers, and what it's actually about:

  • set_power_limit_uw β€” Set power limit in micro-watts. πŸ”₯
  • get_power_limit_uw β€” Get power limit in micro-watts. πŸ‘€
  • set_time_window_us β€” Set time window in micro-seconds. ⏱️
  • get_time_window_us β€” Get time window in micro-seconds. ⏱️
  • get_max_power_uw β€” Get max power allowed in micro-watts. ⭐
  • get_min_power_uw β€” Get min power allowed in micro-watts. ⭐
  • get_max_time_window_us β€” Get max time window allowed in micro-seconds. 🌈
  • get_min_time_window_us β€” Get min time window allowed in micro-seconds. 🌈
  • get_name β€” Get the name of constraint. πŸŽ€

Description 🫢

so, the whole point of this structure is that it's used to define the constraint callbacks for the client drivers. main character energy, honestly πŸ’…

here's the part you cannot skip β€” these callbacks are mandatory and can't be NULL:

  • set_power_limit_uw
  • get_power_limit_uw
  • set_time_window_us
  • get_time_window_us
  • get_name
⚠️ bestie listen to me. those five? mandatory. NULL? no. not happening. πŸ™ˆ

and also: client drivers should handle mutual exclusion, if required in callbacks. so like, that's on you, not on the struct, iykyk 😭


πŸ’œ SEE ALSO πŸ’œ

go read these next, fr fr β€” Kernel file ./include/linux/powercap.h:


aaaand that's the page, bestie 🌸 sign-off szn: this lil masterpiece lives in ./include/linux, stamped October 2026, filed under struct powe...nstraint_ops(9) πŸ’– slay, you read the whole thing, so proud of you 🫢✨

πŸ“¦ where this page comes from