Repository navigation
drivers/serial: make serial line break optional for DEFAULT_SMALL - #22149
Merged
GUIDINGLI merged 1 commit intoNov 23, 2026
Merged
Conversation
Make TCSBRK and TCSBRKP ioctl handling and uart_tcsendbreak() optional via CONFIG_SERIAL_BREAK, defaulting to !DEFAULT_SMALL. When disabled, the break ioctls return -ENOTTY (causing tcsendbreak() to return -1 with errno set to ENOTTY), saving 634 bytes of Flash (text) and 160 bytes of data/bss on small targets. Assisted-by: Claude:claude-opus-4.6 Signed-off-by: Swatantra Yadav <[email protected]>
Swatantra-66
requested review from
GUIDINGLI,
jerpelea and
xiaoxiang781216
as code owners
November 22, 2026 09:40
xiaoxiang781216
approved these changes
Nov 22, 2026
|
GUIDINGLI
approved these changes
Nov 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Make serial line break support (
tcsendbreak,TCSBRK, andTCSBRKP) optional viaCONFIG_SERIAL_BREAK, defaulting to!DEFAULT_SMALL.Many memory-constrained targets (
DEFAULT_SMALL=y) do not require line break signaling over UART. Currently,uart_tcsendbreak()and its associated ioctl handling are unconditionally compiled intodrivers/serial/serial.c. Furthermore, no ARM MCU lower-half serial driver implements a hardware line break routine—it is only forwarded viadev->ops->ioctlpassthrough with BSD-compatibleTIOCSBRK/TIOCCBRK.When
CONFIG_SERIAL_BREAKis disabled (n):uart_tcsendbreak()is omitted from compilation.TCSBRKandTCSBRKPioctl cases fall through to default, returning-ENOTTY.tcsendbreak()receives-ENOTTYfromioctl(), returning-1witherrnoset toENOTTY.text) and 160 bytes of RAM (data+bss) indrivers/serial.o.Addresses Issue #20414.
Impact
CONFIG_SERIAL_BREAK).TCSBRKandTCSBRKPreturn-ENOTTYwhenCONFIG_SERIAL_BREAKis disabled.CONFIG_SERIAL_BREAK=y(default). ForDEFAULT_SMALL=yconfigurations,tcsendbreak()will fail withENOTTY, saving Flash and RAM.Documentation/os/drivers/character/serial.rst.Size Difference (sim:nsh)
Configuration:
sim:nsh(x86_64)drivers/serial.oCONFIG_SERIAL_BREAK=yCONFIG_SERIAL_BREAK=nTesting
Build Verification
CONFIG_SERIAL_BREAK=y: Success.CONFIG_SERIAL_BREAK=n: Success.nxstyleverification ondrivers/serial/serial.c: 0 errors.Runtime Test Log (
sim:nsh,CONFIG_SERIAL_BREAK=n)