From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vipin Kumar Date: Thu, 6 Dec 2012 14:06:28 +0530 Subject: [U-Boot] [PATCH resend 7/7] mtd/st_smi: Add mtd support for smi In-Reply-To: <50C0511C.4030205@denx.de> References: <549a68c6f353eafc3c52098a45257a1403cf5a4b.1354774371.git.vipin.kumar@st.com> <50C0511C.4030205@denx.de> Message-ID: <50C0590C.6010100@st.com> 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/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 >> --- >> 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? > I agree. That would be more readable. I would send out a v2 > Thanks, > Stefan > >