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


##########
drivers/note/noteram_driver.c:
##########
@@ -105,10 +108,24 @@ static struct noteram_info_s g_noteram_info =
 static struct noteram_taskname_s g_noteram_taskname;
 #endif
 
+static struct note_driver_ops_s noteram_ops =
+{
+  .write = sched_noteram_write
+};
+
 #ifdef CONFIG_SMP
 static volatile spinlock_t g_noteram_lock;
 #endif
 
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+struct note_driver_s g_noteram_driver =
+{
+  .ops = &noteram_ops,

Review Comment:
   ditto



##########
drivers/note/sched_note.c:
##########
@@ -409,22 +464,35 @@ static void note_spincommon(FAR struct tcb_s *tcb,
                             int type)
 {
   struct note_spinlock_s note;
+  FAR struct note_driver_s **driver = g_note_drivers_list;
+  bool formatted = false;
 
   if (!note_isenabled())
     {
       return;
     }
 
-  /* Format the note */
+  for (; *driver; driver++)
+    {
+      if (note_spinlock(*driver, tcb, spinlock, type))
+        {
+          continue;
+        }
 
-  note_common(tcb, &note.nsp_cmn, sizeof(struct note_spinlock_s), type);
+      /* Format the note */
 
-  sched_note_flatten(note.nsp_spinlock, &spinlock, sizeof(spinlock));
-  note.nsp_value = *(uint8_t *)spinlock;
+      if (!formatted)
+        {
+          note_common(tcb, &note.nsp_cmn, sizeof(struct note_spinlock_s),
+                      type);
+          sched_note_flatten(note.nsp_spinlock, &spinlock, sizeof(spinlock));
+          note.nsp_value = *(uint8_t *)spinlock;

Review Comment:
   ```suggestion
             note.nsp_value = *(FAR uint8_t *)spinlock;
   ```



##########
drivers/note/noteram_driver.c:
##########
@@ -105,10 +108,24 @@ static struct noteram_info_s g_noteram_info =
 static struct noteram_taskname_s g_noteram_taskname;
 #endif
 
+static struct note_driver_ops_s noteram_ops =
+{
+  .write = sched_noteram_write

Review Comment:
   can we avoid designated initializer?



-- 
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