nshlib: Move BOARDIOC_FINALINIT into nsh_initscript

1.Avoid the code duplication
2.Call BOARDIOC_FINALINIT onnce and only once
3.Ensure BOARDIOC_FINALINIT get called in all case

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2020-04-17 02:24:04 +08:00 committed by patacongo
parent 6c4dc44e04
commit ac5632fc50
4 changed files with 6 additions and 18 deletions

View File

@ -292,12 +292,6 @@ int nsh_consolemain(int argc, char *argv[])
netinit_bringup();
#endif
#if defined(CONFIG_NSH_ARCHINIT) && defined(CONFIG_BOARDCTL_FINALINIT)
/* Perform architecture-specific final-initialization (if configured) */
boardctl(BOARDIOC_FINALINIT, 0);
#endif
/* First map stderr and stdout to alternative devices */
ret = nsh_clone_console(pstate);

View File

@ -110,12 +110,6 @@ int nsh_consolemain(int argc, char *argv[])
netinit_bringup();
#endif
#if defined(CONFIG_NSH_ARCHINIT) && defined(CONFIG_BOARDCTL_FINALINIT)
/* Perform architecture-specific final-initialization (if configured) */
boardctl(BOARDIOC_FINALINIT, 0);
#endif
/* Execute the session */
ret = nsh_session(pstate);

View File

@ -190,6 +190,12 @@ int nsh_initscript(FAR struct nsh_vtbl_s *vtbl)
if (!already)
{
ret = nsh_script(vtbl, "init", NSH_INITPATH);
#if defined(CONFIG_NSH_ARCHINIT) && defined(CONFIG_BOARDCTL_FINALINIT)
/* Perform architecture-specific final-initialization (if configured) */
boardctl(BOARDIOC_FINALINIT, 0);
#endif
}
return ret;

View File

@ -325,12 +325,6 @@ int nsh_consolemain(int argc, char *argv[])
netinit_bringup();
#endif
#if defined(CONFIG_NSH_ARCHINIT) && defined(CONFIG_BOARDCTL_FINALINIT)
/* Perform architecture-specific final-initialization (if configured) */
boardctl(BOARDIOC_FINALINIT, 0);
#endif
/* Now loop, executing creating a session for each USB connection */
for (;;)