From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefan Roese Date: Thu, 06 Dec 2012 09:02:36 +0100 Subject: [U-Boot] [PATCH resend 7/7] mtd/st_smi: Add mtd support for smi In-Reply-To: <549a68c6f353eafc3c52098a45257a1403cf5a4b.1354774371.git.vipin.kumar@st.com> References: <549a68c6f353eafc3c52098a45257a1403cf5a4b.1354774371.git.vipin.kumar@st.com> Message-ID: <50C0511C.4030205@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 12/06/2012 07:21 AM, Vipin Kumar wrote: > This patch adds mtd device support for smi devices > > Signed-off-by: Vipin Kumar > --- > 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 > #include > #include > +#include > #include > > #include > @@ -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? Thanks, Stefan