diff options
| author | Colin Ian King <colin.i.king@gmail.com> | 2025-08-07 13:13:49 +0100 | 
|---|---|---|
| committer | Sebastian Reichel <sebastian.reichel@collabora.com> | 2025-09-06 23:24:23 +0200 | 
| commit | cb03556acf83b235dfb2e9f86e14f5e5b8a5f1e7 (patch) | |
| tree | 90859e57497827a1f5cf1e46c3961d1dbbcb982a /tools/docs/lib/parse_data_structs.py | |
| parent | 32f350d58544e2529dc8798275684e97f0a2df6f (diff) | |
power: supply: 88pm860x: make fsm_state array static const, simplify usage
Don't populate the read-only array fsm_state on the stack at run time,
instead make it static const, this reduces the object code size as
the data is placed on the data segment and this removes the need to
have code to set the array up on each call.
Note that making the size of the strings to a more optimal 11 bytes long
does not seem to reduce the overall size. Making the array an array of
pointers to the strings increases the code size due to the dereferencing
overhead.
Simplify the array access with &fsm_state[info->state][0] with the simpler
expression fsm_state[info->state] to clean up the code.
Original:
   text    data     bss     dec     hex filename
  22884    8272      64   31220    79f4 drivers/power/supply/88pm860x_charger.o
Patched:
   text	   data	    bss	    dec	    hex	filename
  22695	   8368	     64	  31127	   7997	drivers/power/supply/88pm860x_charger.o
Difference:
   text	   data	    bss	    dec
  -189     +96        0     -93
Reduction of 93 bytes total.
gcc version 14.2.0 (x86-64)
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Diffstat (limited to 'tools/docs/lib/parse_data_structs.py')
0 files changed, 0 insertions, 0 deletions
