You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by gu...@apache.org on 2022/03/12 18:06:50 UTC

[incubator-nuttx] branch master updated (8b7d08f -> 4cc2888)

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

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


    from 8b7d08f  net: Reoder the initialize sequence(mac->ip->tcp/udp)
     new dfb9a76  fs: Initialize g_inode_sem at the definition place
     new cf2538c  mm/shm: Initialize shm_info_s at the definition place
     new b078660  sched/wdog: Remove wd_initialize which isn't really used anymore
     new d9a442a  mm/iob: Remove initialized static variable inside iob_initialize
     new 2ce62bb  sched/irq: Remove the code which zero out g_irqvector fields
     new ab872b0  sched/init: Move binfmt_initialize before hardware initialization
     new 4cc2888  sched/init: Don't call sq_init/dq_init on global link list

The 7 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 fs/inode/fs_inode.c        | 13 +++------
 include/nuttx/mm/shm.h     | 16 -----------
 mm/iob/iob_initialize.c    | 66 ++++++++++++++++++----------------------------
 mm/shm/shm_initialize.c    | 26 +++---------------
 sched/init/nx_start.c      | 63 +++++++------------------------------------
 sched/irq/irq_initialize.c | 11 --------
 sched/wdog/wd_initialize.c | 26 ------------------
 sched/wdog/wdog.h          | 21 ---------------
 8 files changed, 43 insertions(+), 199 deletions(-)

[incubator-nuttx] 01/07: fs: Initialize g_inode_sem at the definition place

Posted by gu...@apache.org.
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 dfb9a763a79ea6d60441a23fb88811984449a7f0
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Sat Mar 12 03:56:57 2022 +0800

    fs: Initialize g_inode_sem at the definition place
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 fs/inode/fs_inode.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/fs/inode/fs_inode.c b/fs/inode/fs_inode.c
index 1306734..93a05ad 100644
--- a/fs/inode/fs_inode.c
+++ b/fs/inode/fs_inode.c
@@ -62,7 +62,10 @@ struct inode_sem_s
  * Private Data
  ****************************************************************************/
 
-static struct inode_sem_s g_inode_sem;
+static struct inode_sem_s g_inode_sem =
+{
+  SEM_INITIALIZER(1), NO_HOLDER, 0
+};
 
 /****************************************************************************
  * Public Functions
@@ -79,14 +82,6 @@ static struct inode_sem_s g_inode_sem;
 
 void inode_initialize(void)
 {
-  /* Initialize the semaphore to one (to support one-at-a-time access to the
-   * inode tree).
-   */
-
-  nxsem_init(&g_inode_sem.sem, 0, 1);
-  g_inode_sem.holder = NO_HOLDER;
-  g_inode_sem.count  = 0;
-
   /* Reserve the root node */
 
   inode_root_reserve();

[incubator-nuttx] 02/07: mm/shm: Initialize shm_info_s at the definition place

Posted by gu...@apache.org.
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 <xi...@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 <xi...@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 */
 

[incubator-nuttx] 05/07: sched/irq: Remove the code which zero out g_irqvector fields

Posted by gu...@apache.org.
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 2ce62bb5831122a962c6aa72cebdf45440ff4aca
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Sat Mar 12 04:05:36 2022 +0800

    sched/irq: Remove the code which zero out g_irqvector fields
    
    since the boot up code already do it
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 sched/irq/irq_initialize.c | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/sched/irq/irq_initialize.c b/sched/irq/irq_initialize.c
index ab1bc37..7b5173b 100644
--- a/sched/irq/irq_initialize.c
+++ b/sched/irq/irq_initialize.c
@@ -73,17 +73,6 @@ void irq_initialize(void)
   for (i = 0; i < TAB_SIZE; i++)
     {
       g_irqvector[i].handler = irq_unexpected_isr;
-      g_irqvector[i].arg     = NULL;
-#ifdef CONFIG_SCHED_IRQMONITOR
-      g_irqvector[i].start   = 0;
-#ifdef CONFIG_HAVE_LONG_LONG
-      g_irqvector[i].count   = 0;
-#else
-      g_irqvector[i].mscount = 0;
-      g_irqvector[i].lscount = 0;
-#endif
-      g_irqvector[i].time    = 0;
-#endif
     }
 
 #ifdef CONFIG_IRQCHAIN

[incubator-nuttx] 03/07: sched/wdog: Remove wd_initialize which isn't really used anymore

Posted by gu...@apache.org.
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 b0786606fc5bec29464fb197b9b2c80fa265d44a
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Sat Mar 12 04:01:19 2022 +0800

    sched/wdog: Remove wd_initialize which isn't really used anymore
    
    since g_wdactivelist is already set to zero by the boot code
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 sched/init/nx_start.c      | 14 +-------------
 sched/wdog/wd_initialize.c | 26 --------------------------
 sched/wdog/wdog.h          | 21 ---------------------
 3 files changed, 1 insertion(+), 60 deletions(-)

diff --git a/sched/init/nx_start.c b/sched/init/nx_start.c
index 3fb1cba..aeafd5f 100644
--- a/sched/init/nx_start.c
+++ b/sched/init/nx_start.c
@@ -46,11 +46,8 @@
 
 #include "sched/sched.h"
 #include "signal/signal.h"
-#include "wdog/wdog.h"
 #include "semaphore/semaphore.h"
-#ifndef CONFIG_DISABLE_MQUEUE
-#  include "mqueue/mqueue.h"
-#endif
+#include "mqueue/mqueue.h"
 #include "clock/clock.h"
 #include "timer/timer.h"
 #include "irq/irq.h"
@@ -627,15 +624,6 @@ void nx_start(void)
       irq_initialize();
     }
 
-  /* Initialize the watchdog facility (if included in the link) */
-
-#ifdef CONFIG_HAVE_WEAKFUNCTIONS
-  if (wd_initialize != NULL)
-#endif
-    {
-      wd_initialize();
-    }
-
   /* Initialize the POSIX timer facility (if included in the link) */
 
 #ifdef CONFIG_HAVE_WEAKFUNCTIONS
diff --git a/sched/wdog/wd_initialize.c b/sched/wdog/wd_initialize.c
index 4062802..5b4f624 100644
--- a/sched/wdog/wd_initialize.c
+++ b/sched/wdog/wd_initialize.c
@@ -50,29 +50,3 @@ clock_t g_wdtickbase;
 /****************************************************************************
  * Public Functions
  ****************************************************************************/
-
-/****************************************************************************
- * Name: wd_initialize
- *
- * Description:
- * This function initializes the watchdog data structures
- *
- * Input Parameters:
- *   None
- *
- * Returned Value:
- *   None
- *
- * Assumptions:
- *   This function must be called early in the initialization sequence
- *   before the timer interrupt is attached and before any watchdog
- *   services are used.
- *
- ****************************************************************************/
-
-void wd_initialize(void)
-{
-  /* Initialize watchdog lists */
-
-  sq_init(&g_wdactivelist);
-}
diff --git a/sched/wdog/wdog.h b/sched/wdog/wdog.h
index c527976..76b7144 100644
--- a/sched/wdog/wdog.h
+++ b/sched/wdog/wdog.h
@@ -87,27 +87,6 @@ extern clock_t g_wdtickbase;
  ****************************************************************************/
 
 /****************************************************************************
- * Name: wd_initialize
- *
- * Description:
- * This function initializes the watchdog data structures
- *
- * Input Parameters:
- *   None
- *
- * Returned Value:
- *   None
- *
- * Assumptions:
- *   This function must be called early in the initialization sequence
- *   before the timer interrupt is attached and before any watchdog
- *   services are used.
- *
- ****************************************************************************/
-
-void weak_function wd_initialize(void);
-
-/****************************************************************************
  * Name: wd_timer
  *
  * Description:

[incubator-nuttx] 06/07: sched/init: Move binfmt_initialize before hardware initialization

Posted by gu...@apache.org.
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 ab872b01999e7d13ad1aeaa95c7d2ebf7118d95d
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Sat Mar 12 04:10:24 2022 +0800

    sched/init: Move binfmt_initialize before hardware initialization
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 sched/init/nx_start.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/sched/init/nx_start.c b/sched/init/nx_start.c
index aeafd5f..6fc5a6b 100644
--- a/sched/init/nx_start.c
+++ b/sched/init/nx_start.c
@@ -668,6 +668,12 @@ void nx_start(void)
   net_initialize();
 #endif
 
+#ifndef CONFIG_BINFMT_DISABLE
+  /* Initialize the binfmt system */
+
+  binfmt_initialize();
+#endif
+
   /* Initialize Hardware Facilities *****************************************/
 
   /* The processor specific details of running the operating system
@@ -693,12 +699,6 @@ void nx_start(void)
 
   /* Setup for Multi-Tasking ************************************************/
 
-#ifndef CONFIG_BINFMT_DISABLE
-  /* Initialize the binfmt system */
-
-  binfmt_initialize();
-#endif
-
   /* Announce that the CPU0 IDLE task has started */
 
   sched_note_start(&g_idletcb[0].cmn);

[incubator-nuttx] 04/07: mm/iob: Remove initialized static variable inside iob_initialize

Posted by gu...@apache.org.
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 d9a442a859cfe88bc28729a4f609a8bc9ae61f2b
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Sat Mar 12 04:04:08 2022 +0800

    mm/iob: Remove initialized static variable inside iob_initialize
    
    since it's impossible to call iob_initialize twice
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 mm/iob/iob_initialize.c | 66 +++++++++++++++++++------------------------------
 1 file changed, 26 insertions(+), 40 deletions(-)

diff --git a/mm/iob/iob_initialize.c b/mm/iob/iob_initialize.c
index bb6bae1..ea54a13 100644
--- a/mm/iob/iob_initialize.c
+++ b/mm/iob/iob_initialize.c
@@ -73,12 +73,19 @@ FAR struct iob_qentry_s *g_iob_qcommitted;
 
 /* Counting semaphores that tracks the number of free IOBs/qentries */
 
-sem_t g_iob_sem;            /* Counts free I/O buffers */
+sem_t g_iob_sem = SEM_INITIALIZER(CONFIG_IOB_NBUFFERS);
+
 #if CONFIG_IOB_THROTTLE > 0
-sem_t g_throttle_sem;       /* Counts available I/O buffers when throttled */
+/* Counts available I/O buffers when throttled */
+
+sem_t g_throttle_sem = SEM_INITIALIZER(CONFIG_IOB_NBUFFERS -
+                                       CONFIG_IOB_THROTTLE);
 #endif
+
 #if CONFIG_IOB_NCHAINS > 0
-sem_t g_qentry_sem;         /* Counts free I/O buffer queue containers */
+/* Counts free I/O buffer queue containers */
+
+sem_t g_qentry_sem = SEM_INITIALIZER(CONFIG_IOB_NCHAINS);
 #endif
 
 /****************************************************************************
@@ -95,54 +102,33 @@ sem_t g_qentry_sem;         /* Counts free I/O buffer queue containers */
 
 void iob_initialize(void)
 {
-  static bool initialized = false;
   int i;
 
-  /* Perform one-time initialization */
+  /* Add each I/O buffer to the free list */
 
-  if (!initialized)
+  for (i = 0; i < CONFIG_IOB_NBUFFERS; i++)
     {
-      /* Add each I/O buffer to the free list */
+      FAR struct iob_s *iob = &g_iob_pool[i];
 
-      for (i = 0; i < CONFIG_IOB_NBUFFERS; i++)
-        {
-          FAR struct iob_s *iob = &g_iob_pool[i];
+      /* Add the pre-allocate I/O buffer to the head of the free list */
 
-          /* Add the pre-allocate I/O buffer to the head of the free list */
-
-          iob->io_flink  = g_iob_freelist;
-          g_iob_freelist = iob;
-        }
-
-      g_iob_committed = NULL;
-
-      nxsem_init(&g_iob_sem, 0, CONFIG_IOB_NBUFFERS);
-#if CONFIG_IOB_THROTTLE > 0
-      nxsem_init(&g_throttle_sem,
-                 0,
-                 CONFIG_IOB_NBUFFERS - CONFIG_IOB_THROTTLE);
-#endif
+      iob->io_flink  = g_iob_freelist;
+      g_iob_freelist = iob;
+    }
 
 #if CONFIG_IOB_NCHAINS > 0
       /* Add each I/O buffer chain queue container to the free list */
 
-      for (i = 0; i < CONFIG_IOB_NCHAINS; i++)
-        {
-          FAR struct iob_qentry_s *iobq = &g_iob_qpool[i];
-
-          /* Add the pre-allocate buffer container to the head of the free
-           * list
-           */
-
-          iobq->qe_flink  = g_iob_freeqlist;
-          g_iob_freeqlist = iobq;
-        }
-
-      g_iob_qcommitted = NULL;
+  for (i = 0; i < CONFIG_IOB_NCHAINS; i++)
+    {
+      FAR struct iob_qentry_s *iobq = &g_iob_qpool[i];
 
-      nxsem_init(&g_qentry_sem, 0, CONFIG_IOB_NCHAINS);
-#endif
+      /* Add the pre-allocate buffer container to the head of the free
+       * list
+       */
 
-      initialized = true;
+      iobq->qe_flink  = g_iob_freeqlist;
+      g_iob_freeqlist = iobq;
     }
+#endif
 }

[incubator-nuttx] 07/07: sched/init: Don't call sq_init/dq_init on global link list

Posted by gu...@apache.org.
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 4cc28882f9d847b261f77e8846b935acac71a912
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Sat Mar 12 12:07:33 2022 +0800

    sched/init: Don't call sq_init/dq_init on global link list
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 sched/init/nx_start.c | 30 ++----------------------------
 1 file changed, 2 insertions(+), 28 deletions(-)

diff --git a/sched/init/nx_start.c b/sched/init/nx_start.c
index 6fc5a6b..074cafd 100644
--- a/sched/init/nx_start.c
+++ b/sched/init/nx_start.c
@@ -340,31 +340,6 @@ void nx_start(void)
 
   /* Initialize RTOS Data ***************************************************/
 
-  /* Initialize all task lists */
-
-  dq_init(&g_readytorun);
-  dq_init(&g_pendingtasks);
-  dq_init(&g_waitingforsemaphore);
-  dq_init(&g_waitingforsignal);
-#ifndef CONFIG_DISABLE_MQUEUE
-  dq_init(&g_waitingformqnotfull);
-  dq_init(&g_waitingformqnotempty);
-#endif
-#ifdef CONFIG_PAGING
-  dq_init(&g_waitingforfill);
-#endif
-#ifdef CONFIG_SIG_SIGSTOP_ACTION
-  dq_init(&g_stoppedtasks);
-#endif
-  dq_init(&g_inactivetasks);
-
-#ifdef CONFIG_SMP
-  for (i = 0; i < CONFIG_SMP_NCPUS; i++)
-    {
-      dq_init(&g_assignedtasks[i]);
-    }
-#endif
-
   /* Initialize the IDLE task TCB *******************************************/
 
   for (i = 0; i < CONFIG_SMP_NCPUS; i++)
@@ -443,11 +418,10 @@ void nx_start(void)
        * stack and there is no support that yet.
        */
 
-      g_idleargv[i][0]  = g_idletcb[i].cmn.name;
+      g_idleargv[i][0] = g_idletcb[i].cmn.name;
 #else
-      g_idleargv[i][0]  = (FAR char *)g_idlename;
+      g_idleargv[i][0] = (FAR char *)g_idlename;
 #endif /* CONFIG_TASK_NAME_SIZE */
-      g_idleargv[i][1]  = NULL;
 
       /* Then add the idle task's TCB to the head of the current ready to
        * run list.