On 12/6/2012 1:32 PM, Stefan Roese wrote:
On 12/06/2012 07:21 AM, Vipin Kumar wrote:
This patch adds mtd device support for smi devices

Signed-off-by: Vipin Kumar<vipin.ku...@st.com>
---
  drivers/mtd/st_smi.c | 167 ++++++++++++++++++++++++++++++++++++++++++++++++++-
  1 file changed, 165 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/st_smi.c b/drivers/mtd/st_smi.c
index 0e529a4..4d1a6bd 100644
--- a/drivers/mtd/st_smi.c
+++ b/drivers/mtd/st_smi.c
@@ -24,6 +24,7 @@
  #include<common.h>
  #include<flash.h>
  #include<linux/err.h>
+#include<linux/mtd/mtd.h>
  #include<linux/mtd/st_smi.h>

  #include<asm/io.h>
@@ -37,6 +38,14 @@ static ulong bank_base[CONFIG_SYS_MAX_FLASH_BANKS] =
      CONFIG_SYS_FLASH_ADDR_BASE;
  flash_info_t flash_info[CONFIG_SYS_MAX_FLASH_BANKS];

+#if defined(CONFIG_MTD_DEVICE)
+/* MTD interface for SMI devices */
+static struct mtd_info smi_mtd_info[CONFIG_SYS_MAX_FLASH_BANKS];
+static char smi_mtd_names[CONFIG_SYS_MAX_FLASH_BANKS][16];
+
+static int smi_mtd_init(void);
+#endif
+
  /* data structure to maintain flash ids from different vendors */
  struct flash_device {
        char *name;
@@ -482,7 +491,9 @@ unsigned long flash_init(void)
  {
        unsigned long size = 0;
        int i, j;
-
+#if defined(CONFIG_MTD_DEVICE)
+       int error;
+#endif

Hmm, I don't like all those new #ifdef's. Can't we instead add a dummy
smi_mtd_init() functions for the non-MTD version? Something like:

#if defined(CONFIG_MTD_DEVICE)
/* MTD interface for SMI devices */
static struct mtd_info smi_mtd_info[CONFIG_SYS_MAX_FLASH_BANKS];
static char smi_mtd_names[CONFIG_SYS_MAX_FLASH_BANKS][16];

static int smi_mtd_init(void);
#else
static int smi_mtd_init(void)
{
        return 0;
}
#endif

What do you think?


I agree. That would be more readable. I would send out a v2

Thanks,
Stefan



_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to