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/08/18 18:42:41 UTC

[GitHub] [incubator-nuttx] pkarashchenko commented on a diff in pull request #6877: rwbuffer: Fix a build error

pkarashchenko commented on code in PR #6877:
URL: https://github.com/apache/incubator-nuttx/pull/6877#discussion_r949481818


##########
drivers/misc/rwbuffer.c:
##########
@@ -1276,7 +1276,10 @@ int rwb_flush(FAR struct rwbuffer_s *rwb)
 {
   int ret;
 
+#if CONFIG_DRVR_WRDELAY != 0
   ret = rwb_forcetake(&rwb->wrsem);

Review Comment:
   Maybe better to apply next change:
   ```
   #if defined(CONFIG_DRVR_WRITEBUFFER) && CONFIG_DRVR_WRDELAY != 0
   static int rwb_forcetake(FAR sem_t *sem)
   {
     int result;
     int ret = OK;
   
     do
       {
         result = rwb_semtake(sem);
   
         /* The only expected failure is if the thread is canceled */
   
         DEBUGASSERT(result == OK || result == -ECANCELED);
         if (ret == OK && result < 0)
           {
             /* Remember the first error */
   
             ret = result;
           }
       }
     while (result < 0);
   
     return ret;
   }
   #else
   #  define rwb_flush(s)
   #endif
   ```
   and
   ```
   #if defined(CONFIG_DRVR_WRITEBUFFER) && CONFIG_DRVR_WRDELAY != 0
   #  define rwb_semgive(s) nxsem_post(s)
   #else
   #  define rwb_semgive(s)
   #endif
   ```
   ?



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