This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 3d37e85b13fb57ae8f1b8f6917e5aaac918d0982
Author: zhongzhijie1 <zhongzhij...@xiaomi.com>
AuthorDate: Tue Dec 10 13:25:37 2024 +0800

    Remove minread para in btuart_read.
    
    In file_read(), asynchronous reading is supported, so partial reads and the 
minread parameter are no longer needed.
    
    Signed-off-by: zhongzhijie1 <zhongzhij...@xiaomi.com>
---
 drivers/wireless/bluetooth/bt_uart.c | 18 +++++-------------
 1 file changed, 5 insertions(+), 13 deletions(-)

diff --git a/drivers/wireless/bluetooth/bt_uart.c 
b/drivers/wireless/bluetooth/bt_uart.c
index 2e659765ae..8324e2e2c1 100644
--- a/drivers/wireless/bluetooth/bt_uart.c
+++ b/drivers/wireless/bluetooth/bt_uart.c
@@ -57,14 +57,13 @@
  ****************************************************************************/
 
 static ssize_t btuart_read(FAR struct btuart_upperhalf_s *upper,
-                           FAR uint8_t *buffer, size_t buflen,
-                           size_t minread)
+                           FAR uint8_t *buffer, size_t buflen)
 {
   FAR const struct btuart_lowerhalf_s *lower;
   ssize_t ntotal = 0;
   ssize_t nread;
 
-  wlinfo("buflen %zu minread %zu\n", buflen, minread);
+  wlinfo("buflen %zu\n", buflen);
 
   DEBUGASSERT(upper != NULL && upper->lower != NULL);
   lower = upper->lower;
@@ -73,17 +72,11 @@ static ssize_t btuart_read(FAR struct btuart_upperhalf_s 
*upper,
   while (buflen > 0)
     {
       nread = lower->read(lower, buffer, buflen);
-      if (nread == 0 || nread == -EINTR)
+      if (nread == -EINTR)
         {
-          wlwarn("Got zero bytes from UART\n");
-          if (ntotal < minread)
-            {
-              continue;
-            }
-
-          break;
+          continue;
         }
-      else if (nread < 0)
+      else if (nread <= 0)
         {
           wlwarn("Returned error %zd\n", nread);
           return ntotal > 0 ? ntotal : nread;
@@ -117,7 +110,6 @@ static void btuart_rxwork(FAR void *arg)
   upper = (FAR struct btuart_upperhalf_s *)arg;
 
   nread = btuart_read(upper, &upper->rxbuf[upper->rxlen],
-                      sizeof(upper->rxbuf) - upper->rxlen,
                       sizeof(upper->rxbuf) - upper->rxlen);
   if (nread <= 0)
     {

Reply via email to