JianyuWang0623 opened a new pull request, #21625:
URL: https://github.com/apache/nuttx/pull/21625

   ## Summary
   
   On the interrupt-context write path, `uart_irqwrite()` always reported
   the full buffer as written, even for an `O_NONBLOCK` writer:
   `uart_putchars()` busy-waited on `txready()` and the `sendbuf()` return
   value was ignored. The caller could not detect a short write, so the
   unsent tail was silently lost.
   
   - Thread `oktoblock` through `uart_putchars()` / `uart_irqwrite()` /
     `uart_irqwritev()`. When `!oktoblock`, stop instead of spinning and
     return the bytes actually sent, or `-EAGAIN` if none.
   - With `CONFIG_SERIAL_TXDMA`, call `uart_dmatxavail()` after an
     irq-context fill so bytes left in `dev->xmit` get sent, as the
     task-context path already does.
   
   ## Impact
   
   `drivers/serial/serial.c` only. Blocking writers are unchanged; only
   `O_NONBLOCK` writers on the interrupt-context path may now see a short
   write or `-EAGAIN`.
   
   ## Testing
   
   Host: Ubuntu 22.04.5 LTS, gcc 13.4.0.
   
   - `sim:nsh`: build passes, NSH console output is normal.
   - `esp32s3-devkit:nsh` + `CONFIG_UART_TXDMA=y`: build passes.
   - `tools/checkpatch.sh -g HEAD~2..HEAD`: all checks pass.
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to