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


##########
drivers/note/noteram_driver.c:
##########
@@ -289,22 +281,20 @@ static void noteram_remove(void)
 static ssize_t noteram_get(FAR uint8_t *buffer, size_t buflen)
 {
   FAR struct note_common_s *note;
-  irqstate_t flags;
   unsigned int remaining;
   unsigned int read;
   ssize_t notelen;
   size_t circlen;
 
   DEBUGASSERT(buffer != NULL);
-  flags = enter_critical_section();
 
   /* Verify that the circular buffer is not empty */
 
   circlen = noteram_unread_length();
   if (circlen <= 0)
     {
       notelen = 0;

Review Comment:
   return 0;



##########
drivers/note/noteram_driver.c:
##########
@@ -349,8 +339,7 @@ static ssize_t noteram_get(FAR uint8_t *buffer, size_t 
buflen)
 
   g_noteram_info.ni_read = read;
 
-errout_with_csection:
-  leave_critical_section(flags);
+errout:

Review Comment:
   remove errout label



##########
drivers/note/noteram_driver.c:
##########
@@ -485,6 +471,7 @@ static ssize_t noteram_read(FAR struct file *filep,
 static int noteram_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
 {
   int ret = -ENOSYS;
+  int flags = spin_lock_irqsave_wo_note(&g_noteram_lock);

Review Comment:
   int->irqstate_t



##########
drivers/note/noteram_driver.c:
##########
@@ -400,8 +386,7 @@ static ssize_t noteram_size(void)
   notelen = note->nc_length;
   DEBUGASSERT(notelen <= circlen);
 
-errout_with_csection:
-  leave_critical_section(flags);
+errout:

Review Comment:
   remove errout



##########
drivers/note/noteram_driver.c:
##########
@@ -427,13 +412,14 @@ static ssize_t noteram_read(FAR struct file *filep,
 {
   ssize_t notelen;
   ssize_t retlen ;
+  int flags;

Review Comment:
   irqstate_t flags



##########
drivers/note/noteram_driver.c:
##########
@@ -373,20 +362,17 @@ static ssize_t noteram_get(FAR uint8_t *buffer, size_t 
buflen)
 static ssize_t noteram_size(void)
 {
   FAR struct note_common_s *note;
-  irqstate_t flags;
   unsigned int read;
   ssize_t notelen;
   size_t circlen;
 
-  flags = enter_critical_section();
-
   /* Verify that the circular buffer is not empty */
 
   circlen = noteram_unread_length();
   if (circlen <= 0)
     {
       notelen = 0;

Review Comment:
   return 0;



##########
drivers/note/noteram_driver.c:
##########
@@ -329,7 +319,7 @@ static ssize_t noteram_get(FAR uint8_t *buffer, size_t 
buflen)
       /* and return an error */
 
       notelen = -EFBIG;

Review Comment:
   return -EFBIG;



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