This is an automated email from the ASF dual-hosted git repository.

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

commit cf2538c27707a75b6e9afbb77507cf4c5daee292
Author: Xiang Xiao <xiaoxi...@xiaomi.com>
AuthorDate: Sat Mar 12 03:58:25 2022 +0800

    mm/shm: Initialize shm_info_s at the definition place
    
    Signed-off-by: Xiang Xiao <xiaoxi...@xiaomi.com>
---
 include/nuttx/mm/shm.h  | 16 ----------------
 mm/shm/shm_initialize.c | 26 ++++----------------------
 sched/init/nx_start.c   |  7 -------
 3 files changed, 4 insertions(+), 45 deletions(-)

diff --git a/include/nuttx/mm/shm.h b/include/nuttx/mm/shm.h
index 0045b84..664c6e7 100644
--- a/include/nuttx/mm/shm.h
+++ b/include/nuttx/mm/shm.h
@@ -96,22 +96,6 @@ struct group_shm_s
  ****************************************************************************/
 
 /****************************************************************************
- * Name: shm_initialize
- *
- * Description:
- *   Perform one time, start-up initialization of the shared memory logic.
- *
- * Input Parameters:
- *   None
- *
- * Returned Value:
- *   None
- *
- ****************************************************************************/
-
-void shm_initialize(void);
-
-/****************************************************************************
  * Name: shm_group_initialize
  *
  * Description:
diff --git a/mm/shm/shm_initialize.c b/mm/shm/shm_initialize.c
index 9c5ad98..1e49bcb 100644
--- a/mm/shm/shm_initialize.c
+++ b/mm/shm/shm_initialize.c
@@ -43,34 +43,16 @@
 
 /* State of the all shared memory */
 
-struct shm_info_s g_shminfo;
+struct shm_info_s g_shminfo =
+{
+  SEM_INITIALIZER(1)
+};
 
 /****************************************************************************
  * Public Functions
  ****************************************************************************/
 
 /****************************************************************************
- * Name: shm_initialize
- *
- * Description:
- *   Perform one time, start-up initialization of the shared memory logic.
- *
- * Input Parameters:
- *   None
- *
- * Returned Value:
- *   None
- *
- ****************************************************************************/
-
-void shm_initialize(void)
-{
-  /* Initialize the shared memory region list */
-
-  nxsem_init(&g_shminfo.si_sem, 0, 1);
-}
-
-/****************************************************************************
  * Name: shm_group_initialize
  *
  * Description:
diff --git a/sched/init/nx_start.c b/sched/init/nx_start.c
index c9e7c45..3fb1cba 100644
--- a/sched/init/nx_start.c
+++ b/sched/init/nx_start.c
@@ -37,7 +37,6 @@
 #include <nuttx/net/net.h>
 #include <nuttx/mm/iob.h>
 #include <nuttx/mm/mm.h>
-#include <nuttx/mm/shm.h>
 #include <nuttx/kmalloc.h>
 #include <nuttx/sched_note.h>
 #include <nuttx/syslog/syslog.h>
@@ -706,12 +705,6 @@ void nx_start(void)
 
   /* Setup for Multi-Tasking ************************************************/
 
-#ifdef CONFIG_MM_SHM
-  /* Initialize shared memory support */
-
-  shm_initialize();
-#endif
-
 #ifndef CONFIG_BINFMT_DISABLE
   /* Initialize the binfmt system */
 

Reply via email to