summaryrefslogtreecommitdiff
path: root/chip/lm4/gpio.c
diff options
context:
space:
mode:
authorVincent Palatin <vpalatin@chromium.org>2012-01-23 23:07:58 +0000
committerVincent Palatin <vpalatin@chromium.org>2012-01-24 00:50:08 +0000
commitc21f07e58e48144a97a844668aae68644f8e8dec (patch)
tree12a0b7f04e085a0d2035e9bfbe05013530f99501 /chip/lm4/gpio.c
parenta2a85365d600b93ecd10d44d1a5a2115ce0252f1 (diff)
downloadchrome-ec-c21f07e58e48144a97a844668aae68644f8e8dec.tar.gz
register console commands at compile-time
Instead of using a runtime callback to register the console commands, put them in a special linker section. So we can do a macro to "register" them during the build. It saves 684 bytes and a few microseconds at startup. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BUG=None TEST=run a few commands from the BDS command line. Change-Id: Id33ea210b9035bf76ed720373c74c5dd24ccd1b1
Diffstat (limited to 'chip/lm4/gpio.c')
-rw-r--r--chip/lm4/gpio.c20
1 files changed, 2 insertions, 18 deletions
diff --git a/chip/lm4/gpio.c b/chip/lm4/gpio.c
index 7836cb776e..0c84f1d1cb 100644
--- a/chip/lm4/gpio.c
+++ b/chip/lm4/gpio.c
@@ -308,6 +308,7 @@ static int command_gpio_get(int argc, char **argv)
}
return EC_SUCCESS;
}
+DECLARE_CONSOLE_COMMAND(gpioget, command_gpio_get);
static int command_gpio_set(int argc, char **argv)
@@ -345,21 +346,4 @@ static int command_gpio_set(int argc, char **argv)
return gpio_set_level(i, v);
}
-
-
-static const struct console_command console_commands[] = {
- {"gpioget", command_gpio_get},
- {"gpioset", command_gpio_set},
-};
-static const struct console_group command_group = {
- "GPIO", console_commands, ARRAY_SIZE(console_commands)
-};
-
-/*****************************************************************************/
-/* Initialization */
-
-int gpio_init(void)
-{
- console_register_commands(&command_group);
- return EC_SUCCESS;
-}
+DECLARE_CONSOLE_COMMAND(gpioset, command_gpio_set);