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:
parent
6c4dc44e04
commit
ac5632fc50
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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 (;;)
|
||||
|
Loading…
Reference in New Issue
Block a user