nuttx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gn...@apache.org
Subject [incubator-nuttx-apps] 02/09: nshlib: Move BOARDIOC_FINALINIT into nsh_initscript
Date Sun, 19 Apr 2020 14:07:16 GMT
This is an automated email from the ASF dual-hosted git repository.

gnutt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git

commit ac5632fc504f4e66b61131047326e78c16210d5c
Author: Xiang Xiao <xiaoxiang@xiaomi.com>
AuthorDate: Fri Apr 17 02:24:04 2020 +0800

    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>
---
 nshlib/nsh_altconsole.c  | 6 ------
 nshlib/nsh_consolemain.c | 6 ------
 nshlib/nsh_script.c      | 6 ++++++
 nshlib/nsh_usbconsole.c  | 6 ------
 4 files changed, 6 insertions(+), 18 deletions(-)

diff --git a/nshlib/nsh_altconsole.c b/nshlib/nsh_altconsole.c
index dd574be..ed2fe82 100644
--- a/nshlib/nsh_altconsole.c
+++ b/nshlib/nsh_altconsole.c
@@ -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);
diff --git a/nshlib/nsh_consolemain.c b/nshlib/nsh_consolemain.c
index 61aabf3..5ff9f0e 100644
--- a/nshlib/nsh_consolemain.c
+++ b/nshlib/nsh_consolemain.c
@@ -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);
diff --git a/nshlib/nsh_script.c b/nshlib/nsh_script.c
index a29994e..cf77ef9 100644
--- a/nshlib/nsh_script.c
+++ b/nshlib/nsh_script.c
@@ -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;
diff --git a/nshlib/nsh_usbconsole.c b/nshlib/nsh_usbconsole.c
index 11c1602..60a8815 100644
--- a/nshlib/nsh_usbconsole.c
+++ b/nshlib/nsh_usbconsole.c
@@ -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 (;;)


Mime
View raw message