You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/12/14 19:37:01 UTC
[GitHub] [nuttx] pkarashchenko commented on a diff in pull request #7841: drivers/note: sched_note support mulit-channel
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 = ¬eram_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, ¬e.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, ¬e.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-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org