aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/scripts/Makefile.thinlto
diff options
context:
space:
mode:
authorWaqar Hameed <waqar.hameed@axis.com>2026-09-01 21:35:07 +0200
committerSebastian Reichel <sebastian.reichel@collabora.com>2026-09-10 00:43:05 +0200
commitf170c05e3e08aa2068601db369078bb83dc5e7e7 (patch)
tree02cb62db5cdb7f97d1047f47b5f9f2b03311808e /scripts/Makefile.thinlto
parentpower: supply: fix typos in comments (diff)
power: supply: Pack power_supply_desc to eliminate holes
`pahole` reports that there are two holes in `struct power_supply_desc`: struct power_supply_desc { const char * name; /* 0 4 */ enum power_supply_type type; /* 4 4 */ u8 charge_behaviours; /* 8 1 */ /* XXX 3 bytes hole, try to pack */ u32 charge_types; /* 12 4 */ u32 usb_types; /* 16 4 */ const enum power_supply_property * properties; /* 20 4 */ size_t num_properties; /* 24 4 */ int (*get_property)(...); /* 28 4 */ int (*set_property)(...); /* 32 4 */ int (*property_is_writeable)(...); /* 36 4 */ void (*external_power_changed)(...); /* 40 4 */ int (*init)(struct power_supply *); /* 44 4 */ bool no_thermal; /* 48 1 */ /* XXX 3 bytes hole, try to pack */ int use_for_apm; /* 52 4 */ /* size: 56, cachelines: 1, members: 14 */ /* sum members: 50, holes: 2, sum holes: 6 */ /* last cacheline: 56 bytes */ }; This can be optimized by moving `u8 charge_behaviours` to the end and swapping `int use_for_apm` with `bool no_thermal`: struct power_supply_desc { const char * name; /* 0 4 */ enum power_supply_type type; /* 4 4 */ u32 charge_types; /* 8 4 */ u32 usb_types; /* 12 4 */ const enum power_supply_property * properties; /* 16 4 */ size_t num_properties; /* 20 4 */ int (*get_property)(...); /* 24 4 */ int (*set_property)(...); /* 28 4 */ int (*property_is_writeable)(...); /* 32 4 */ void (*external_power_changed)(...); /* 36 4 */ int (*init)(struct power_supply *); /* 40 4 */ int use_for_apm; /* 44 4 */ bool no_thermal; /* 48 1 */ u8 charge_behaviours; /* 49 1 */ /* size: 52, cachelines: 1, members: 14 */ /* padding: 2 */ /* last cacheline: 52 bytes */ }; Do this in order to save 4 bytes. This will also help when adding new members in the future to this `struct`. Signed-off-by: Waqar Hameed <waqar.hameed@axis.com> Link: https://patch.msgid.link/5b6d1d588c8aaf237c45638c29a2ff23f0a07f34.1788290289.git.waqar.hameed@axis.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Diffstat (limited to 'scripts/Makefile.thinlto')
0 files changed, 0 insertions, 0 deletions