powercap_reg...control_type(9)

๐Ÿ“ฆ version 7.3.1, in nixpkgs unstable

๐Ÿ’… powercap_reg...control_type(9) โ€” the Kernel API Manual, bestie edition

okay so bestie, you're looking at a page from the Linux Kernel API Manual. It lives in ./include/linux. Yes it does. Let's get into it โœจ


๐ŸŒธ NAME ๐ŸŒธ

powercap_register_control_type โ€” the function that registers a control_type with the framework. That's literally the whole job. She registers. She slays. Periodt. ๐Ÿ’…


๐ŸŽ€ SYNOPSIS ๐ŸŽ€

struct powercap_control_type * powercap_register_control_type (struct
powercap_control_type *control_type , const char *name , const struct
powercap_control_type_ops *ops );

that's the signature, bestie โ€” <purple>struct powercap_control_type *</purple> comes back out, and you hand her three things on the way in. ๐Ÿฆ‹


โœจ ARGUMENTS โœจ

  • control_type โ€” Pointer to memory you (the client) allocated for the control type structure storage. ๐Ÿซถ But here's the plot twist: if this is NULL, the powercap framework will allocate the memory and own it. The absolute glow-up reason you'd pass it in yourself is that your client can embed this data inside its own data structures and allocate it all in a single call, which prevents multiple allocations. efficiency icon behavior, ngl. ๐Ÿ‘‘
  • name โ€” The name of this control_type. It's what gets shown in the sysfs interface, so pick something cute โ€” or at least something legible. ๐ŸŒˆ
  • ops โ€” Callbacks for the control type. This parameter is optional, so like... no pressure. ๐Ÿ™ˆ

๐Ÿ’– DESCRIPTION ๐Ÿ’–

So what does she actually do? She's used to create a control_type with the power capping class. A control_type can represent a type of technology, and that technology can control a whole range of power zones. ๐Ÿ’€

For example, a control_type can be RAPL โ€” that's Running Average Power Limit โ€” for Intelยฎ 64 and IA-32 Processor Architectures. iconic.

The name can be any string, but it must be unique โ€” no cap, if it's not unique, this function returns NULL. ๐Ÿ˜ญ

On success, you get a pointer to the control_type instance back. slay. โœจ

โš ๏ธ lowkey important: the ops argument is optional, but the unique-name thing is not. Duplicate name = NULL = sad times. ๐Ÿฅฒ

๐Ÿฆ‹ SEE ALSO ๐Ÿฆ‹


and that's the page, bestie ๐Ÿงš๐Ÿ’œ she ships from ./include/linux, the version is stamped October 2026, and she goes by the handle powercap_reg...control_type(9). go forth and register your control types responsibly โœจ๐ŸŽ€๐Ÿ“

๐Ÿ“ฆ where this page comes from