xiaoxiang781216 commented on code in PR #7841:
URL: https://github.com/apache/nuttx/pull/7841#discussion_r1051326765


##########
drivers/note/note_driver.c:
##########
@@ -416,203 +474,346 @@ void sched_note_start(FAR struct tcb_s *tcb)
       return;
     }
 
-  /* Copy the task name (if possible) and get the length of the note */
+  for (driver = g_note_drivers; *driver; driver++)
+    {
+      if (note_start(*driver, tcb))
+        {
+          continue;
+        }
+
+      if (!formatted && (*driver)->ops->add)
+        {
+          formatted = true;
+
+          /* Copy the task name (if possible) and
+           * get the length of the note
+           */
 
 #if CONFIG_TASK_NAME_SIZE > 0
-  namelen = strlen(tcb->name);
+          namelen = strlen(tcb->name);
 
-  DEBUGASSERT(namelen <= CONFIG_TASK_NAME_SIZE);
-  strlcpy(note.nsa_name, tcb->name, sizeof(note.nsa_name));
+          DEBUGASSERT(namelen <= CONFIG_TASK_NAME_SIZE);
+          strlcpy(note.nsa_name, tcb->name, sizeof(note.nsa_name));
 
-  length = SIZEOF_NOTE_START(namelen + 1);
+          length = SIZEOF_NOTE_START(namelen + 1);
 #else
-  length = SIZEOF_NOTE_START(0);
+          length = SIZEOF_NOTE_START(0);
 #endif
 
-  /* Finish formatting the note */
+          /* Finish formatting the note */
 
-  note_common(tcb, &note.nsa_cmn, length, NOTE_START);
+          note_common(tcb, &note.nsa_cmn, length, NOTE_START);
+        }
 
-  /* Add the note to circular buffer */
+      /* Add the note to circular buffer */
 
-  sched_note_add(&note, length);
+      note_add(*driver, &note, length);
+    }
 }
 
 void sched_note_stop(FAR struct tcb_s *tcb)
 {
   struct note_stop_s note;
+  FAR struct note_driver_s **driver;
+  bool formatted = false;
 
   if (!note_isenabled())
     {
       return;
     }
 
-  /* Format the note */
+  for (driver = g_note_drivers; *driver; driver++)
+    {
+      if (note_stop(*driver, tcb))
+        {
+          continue;
+        }
+
+      /* Format the note */
 
-  note_common(tcb, &note.nsp_cmn, sizeof(struct note_stop_s), NOTE_STOP);
+      if (!formatted)

Review Comment:
   you need add all place



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to