powercap_reg...control_type(9)
๐ 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 isNULL, 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 thiscontrol_type. It's what gets shown in thesysfsinterface, 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: theopsargument is optional, but the unique-name thing is not. Duplicate name =NULL= sad times. ๐ฅฒ
๐ฆ SEE ALSO ๐ฆ
- Kernel file
./include/linux/powercap.h struct powercap_control_type_ops(9)struct powercap_control_type(9)struct powercap_zone_ops(9)struct powercap_zone(9)struct powercap_zone_constraint_ops(9)struct powercap_zone_constraint(9)powercap_set_zone_data(9)powercap_get_zone_data(9)powercap_unregister_control_type(9)powercap_register_zone(9)powercap_unregister_zone(9)
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
- 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