initial_pins: Add check to reduce compile time size when not in use

Add a check to the start of initial_pins_setup() to make it easier for
gcc to optimize the code if it is not in use.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2022-12-16 22:46:47 -05:00
parent 0c43ae1fd4
commit 3c1ed3bb27
1 changed files with 2 additions and 0 deletions

View File

@ -16,6 +16,8 @@ DECL_CTR("DECL_INITIAL_PINS " __stringify(CONFIG_INITIAL_PINS));
void void
initial_pins_setup(void) initial_pins_setup(void)
{ {
if (sizeof(CONFIG_INITIAL_PINS) <= 1)
return;
int i; int i;
for (i=0; i<initial_pins_size; i++) { for (i=0; i<initial_pins_size; i++) {
const struct initial_pin_s *ip = &initial_pins[i]; const struct initial_pin_s *ip = &initial_pins[i];