diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2013-03-07 16:14:16 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2013-03-14 08:42:32 +0100 |
commit | 6c370ee23010a441508ce91619ea0a7040251090 (patch) | |
tree | 4121984bf15db19cee1f32c3742c501af652d26c /drivers/gpio | |
parent | 32f8f583c9e11f85aa01e324b712e1fdd63fe797 (diff) | |
download | barebox-6c370ee23010a441508ce91619ea0a7040251090.tar.gz barebox-6c370ee23010a441508ce91619ea0a7040251090.tar.xz |
gpio: allocate gpio_desc table dynamically
Some systems are runnignfrom a very limited SRAM, but have a huge
malloc space in SDRAM. The bss normally is in SRAM, so we should
avoid having big structures there. The gpio_desc table is 3072 bytes
big, so allocate it dynamically instead.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/gpio')
-rw-r--r-- | drivers/gpio/gpio.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/gpio/gpio.c b/drivers/gpio/gpio.c index d37f5a0db9..9d081c237c 100644 --- a/drivers/gpio/gpio.c +++ b/drivers/gpio/gpio.c @@ -1,3 +1,4 @@ +#include <init.h> #include <common.h> #include <command.h> #include <complete.h> @@ -13,7 +14,15 @@ struct gpio_info { char *label; }; -static struct gpio_info gpio_desc[ARCH_NR_GPIOS]; +static struct gpio_info *gpio_desc; + +static int gpio_desc_alloc(void) +{ + gpio_desc = xzalloc(sizeof(struct gpio_info) * ARCH_NR_GPIOS); + + return 0; +} +pure_initcall(gpio_desc_alloc); static int gpio_ensure_requested(struct gpio_info *gi, int gpio) { |