BasedOnStyle: LLVM

# Indentation (Linux kernel style)
UseTab: Always
IndentWidth: 8
TabWidth: 8

# Keep parameters on one line as much as possible
BinPackParameters: true
BinPackArguments: true

# Allow long lines (important!)
ColumnLimit: 0   # or set to something large like 120

# Prevent breaking after return type / before function name
AlwaysBreakAfterReturnType: None
AlwaysBreakAfterDefinitionReturnType: None

# Keep function declarations/definitions on one line if possible
PenaltyBreakBeforeFirstCallParameter: 1000000
PenaltyReturnTypeOnItsOwnLine: 1000000

# Braces: K&R style everywhere, INCLUDING functions (your modification)
BreakBeforeBraces: Attach

# Control specific brace wrapping behavior
BraceWrapping:
  AfterFunction: false   # <-- key change (same line for functions)
  AfterControlStatement: false
  AfterStruct: false
  AfterEnum: false
  AfterUnion: false
  AfterClass: false
  BeforeElse: false

# Spaces
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false

# Pointer alignment (kernel prefers this style)
PointerAlignment: Right

# Keep simple statements compact
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None

# For-loop style similar to kernel
AllowShortBlocksOnASingleLine: Never

# Don't align weirdly
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false

# Include handling (kernel is manual about includes)
SortIncludes: false