You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ma...@apache.org on 2022/02/22 08:33:21 UTC

[incubator-nuttx] branch revert-5577-mine created (now 8781ae5)

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

masayuki pushed a change to branch revert-5577-mine
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git.


      at 8781ae5  Revert "pm: remove unnecessary depends on OSINIT_OS_READY"

This branch includes the following new commits:

     new 1703814  Revert "os init_state: add new state OSINIT_IDLELOOP"
     new 8781ae5  Revert "pm: remove unnecessary depends on OSINIT_OS_READY"

The 2 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.


[incubator-nuttx] 01/02: Revert "os init_state: add new state OSINIT_IDLELOOP"

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

masayuki pushed a commit to branch revert-5577-mine
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 170381496cb17cc4be046da11847884ba8a7fa0d
Author: Masayuki Ishikawa <ma...@gmail.com>
AuthorDate: Tue Feb 22 17:33:14 2022 +0900

    Revert "os init_state: add new state OSINIT_IDLELOOP"
    
    This reverts commit 051bb32010608831f838158848c03f20c1458e93.
---
 include/nuttx/init.h          | 4 +---
 sched/init/nx_start.c         | 4 ----
 sched/semaphore/sem_trywait.c | 4 +---
 sched/semaphore/sem_wait.c    | 4 +---
 4 files changed, 3 insertions(+), 13 deletions(-)

diff --git a/include/nuttx/init.h b/include/nuttx/init.h
index 3bdc67f..1d73ba7 100644
--- a/include/nuttx/init.h
+++ b/include/nuttx/init.h
@@ -41,7 +41,6 @@
 #define OSINIT_MM_READY()        (g_nx_initstate >= OSINIT_MEMORY)
 #define OSINIT_HW_READY()        (g_nx_initstate >= OSINIT_HARDWARE)
 #define OSINIT_OS_READY()        (g_nx_initstate >= OSINIT_OSREADY)
-#define OSINIT_IDLELOOP()        (g_nx_initstate >= OSINIT_IDLELOOP)
 #define OSINIT_OS_INITIALIZING() (g_nx_initstate  < OSINIT_OSREADY)
 
 /****************************************************************************
@@ -66,9 +65,8 @@ enum nx_initstate_e
                           * to support the hardware are also available but
                           * the OS has not yet completed its full
                           * initialization. */
-  OSINIT_OSREADY   = 5,  /* The OS is fully initialized and multi-tasking is
+  OSINIT_OSREADY   = 5   /* The OS is fully initialized and multi-tasking is
                           * active. */
-  OSINIT_IDLELOOP  = 6   /* The OS enter idle loop */
 };
 
 /****************************************************************************
diff --git a/sched/init/nx_start.c b/sched/init/nx_start.c
index 74473e8..d789464 100644
--- a/sched/init/nx_start.c
+++ b/sched/init/nx_start.c
@@ -776,10 +776,6 @@ void nx_start(void)
 
   DEBUGVERIFY(nx_bringup());
 
-  /* Enter to idleloop */
-
-  g_nx_initstate = OSINIT_IDLELOOP;
-
   /* Let other threads have access to the memory manager */
 
   sched_unlock();
diff --git a/sched/semaphore/sem_trywait.c b/sched/semaphore/sem_trywait.c
index 1083dd9..2da2139 100644
--- a/sched/semaphore/sem_trywait.c
+++ b/sched/semaphore/sem_trywait.c
@@ -29,7 +29,6 @@
 #include <assert.h>
 #include <errno.h>
 
-#include <nuttx/init.h>
 #include <nuttx/irq.h>
 #include <nuttx/arch.h>
 
@@ -70,10 +69,9 @@ int nxsem_trywait(FAR sem_t *sem)
   irqstate_t flags;
   int ret;
 
-  /* This API should not be called from interrupt handlers & idleloop */
+  /* This API should not be called from interrupt handlers */
 
   DEBUGASSERT(sem != NULL && up_interrupt_context() == false);
-  DEBUGASSERT(OSINIT_IDLELOOP() && !sched_idletask());
 
   if (sem != NULL)
     {
diff --git a/sched/semaphore/sem_wait.c b/sched/semaphore/sem_wait.c
index 0e1acc4..eec6772 100644
--- a/sched/semaphore/sem_wait.c
+++ b/sched/semaphore/sem_wait.c
@@ -28,7 +28,6 @@
 #include <errno.h>
 #include <assert.h>
 
-#include <nuttx/init.h>
 #include <nuttx/irq.h>
 #include <nuttx/arch.h>
 #include <nuttx/cancelpt.h>
@@ -74,10 +73,9 @@ int nxsem_wait(FAR sem_t *sem)
   irqstate_t flags;
   int ret = -EINVAL;
 
-  /* This API should not be called from interrupt handlers & idleloop */
+  /* This API should not be called from interrupt handlers */
 
   DEBUGASSERT(sem != NULL && up_interrupt_context() == false);
-  DEBUGASSERT(OSINIT_IDLELOOP() && !sched_idletask());
 
   /* The following operations must be performed with interrupts
    * disabled because nxsem_post() may be called from an interrupt

[incubator-nuttx] 02/02: Revert "pm: remove unnecessary depends on OSINIT_OS_READY"

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

masayuki pushed a commit to branch revert-5577-mine
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 8781ae546f4736a5648fc9f509670c93c859bf1d
Author: Masayuki Ishikawa <ma...@gmail.com>
AuthorDate: Tue Feb 22 17:33:14 2022 +0900

    Revert "pm: remove unnecessary depends on OSINIT_OS_READY"
    
    This reverts commit 8785673a7048d83d49327bbc1c9a6a17e6a8b27c.
---
 drivers/power/pm_register.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/power/pm_register.c b/drivers/power/pm_register.c
index fa95b8e..3c68f31 100644
--- a/drivers/power/pm_register.c
+++ b/drivers/power/pm_register.c
@@ -62,11 +62,19 @@ int pm_register(FAR struct pm_callback_s *callbacks)
 
   /* Add the new entry to the end of the list of registered callbacks */
 
-  ret = pm_lock();
-  if (ret == OK)
+  if (OSINIT_OS_READY())
+    {
+      ret = pm_lock();
+      if (ret == OK)
+        {
+          dq_addlast(&callbacks->entry, &g_pmglobals.registry);
+          pm_unlock();
+        }
+    }
+  else
     {
       dq_addlast(&callbacks->entry, &g_pmglobals.registry);
-      pm_unlock();
+      ret = OK;
     }
 
   return ret;