hardcoded maximum number of CFI chips - continued
andrzej.mialkowski at inetia.pl
andrzej.mialkowski at inetia.pl
Mon Jul 21 09:04:51 EDT 2003
Due to e-mail configuration problems I'm not able to continue on previous
thread.
Jörn,
You of course right that limit proposed in patch too high. With current
typical stack size (8K) and structure size (36 bytes - on ARM) it is safe to
handle this way about 160 chips. This is much more what can be expected in
resonable designs (and what I need). On the other hand placing kmalloc for
chips structure effectively leeds to solution with realloc. Drawback of this
will be creation of heap fragment, it also still has problem with the constant
limit.
For me attractive are two solutions:
1) Cleaned previous proposal, becuse it is simple and solves problem probably
fits for all designs.
2) Rewrite genprobe_ident_chips to use realloc emulation to allow expansion
structure and handling any number of chips.
Andrzej
diff -Nru --minimal prev/drivers/mtd/chips/Config.in
linux/drivers/mtd/chips/Config.in
--- prev/drivers/mtd/chips/Config.in Fri Mar 14 17:21:15 2003
+++ linux/drivers/mtd/chips/Config.in Mon Jul 21 14:23:49 2003
@@ -40,6 +40,7 @@
bool ' Support 4-chip flash interleave' CONFIG_MTD_CFI_I4
bool ' Support 8-chip flash interleave' CONFIG_MTD_CFI_I8
fi
+ int ' Maximum number of flash chips' CONFIG_MTD_CFI_MAX_CHIPS 8 1 32
fi
fi
dep_tristate ' Support for Intel/Sharp flash chips' CONFIG_MTD_CFI_INTELEXT
$CONFIG_MTD_GEN_PROBE
diff -Nru --minimal prev/include/linux/mtd/cfi.h linux/include/linux/mtd/cfi.h
--- prev/include/linux/mtd/cfi.h Fri Mar 14 17:05:39 2003
+++ linux/include/linux/mtd/cfi.h Mon Jul 21 14:22:38 2003
@@ -306,7 +306,11 @@
struct flchip chips[0]; /* per-chip data structure for each chip */
};
+#ifndef CONFIG_MTD_CFI_MAX_CHIPS
#define MAX_CFI_CHIPS 8 /* Entirely arbitrary to avoid realloc() */
+#else
+#define MAX_CFI_CHIPS CONFIG_MTD_CFI_MAX_CHIPS
+#endif
/*
* Returns the command address according to the given geometry.
More information about the linux-mtd
mailing list