[PATCH 10/10] gpio: allocate gpio_desc table dynamically

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
---
 drivers/gpio/gpio.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio.c b/drivers/gpio/gpio.c
index d37f5a0..9d081c2 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)
 {
-- 
1.8.2.rc2


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox


[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux