Skip to content

Commit 95d67cf

Browse files
committed
Update to clang-format 17
Signed-off-by: Hector Martin <marcan@marcan.st>
1 parent ebec2d3 commit 95d67cf

File tree

5 files changed

+32
-25
lines changed

5 files changed

+32
-25
lines changed

.github/workflows/main.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
name: format-check
44

5-
# Controls when the action will run.
5+
# Controls when the action will run.
66
on:
77
# Triggers the workflow on push or pull request events but only for the main branch
88
push:
@@ -27,7 +27,14 @@ jobs:
2727
rm -f ~/.cargo/bin/cargo-fmt
2828
rustup toolchain install nightly --component rustfmt --component clippy --allow-downgrade
2929
30+
- name: install clang-format-17
31+
run: |
32+
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
33+
sudo add-apt-repository 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main'
34+
sudo apt update
35+
sudo apt install clang-format-17
36+
3037
- name: Run format-check
3138
run: |
32-
make format-check
39+
make format-check CLANG_FORMAT=clang-format-17
3340
make rustfmt-check

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ CC := $(TOOLCHAIN)clang --target=$(ARCH)
2222
AS := $(TOOLCHAIN)clang --target=$(ARCH)
2323
LD := $(TOOLCHAIN)ld.lld
2424
OBJCOPY := $(TOOLCHAIN)llvm-objcopy
25-
CLANG_FORMAT := $(TOOLCHAIN)clang-format
25+
CLANG_FORMAT ?= $(TOOLCHAIN)clang-format
2626
EXTRA_CFLAGS ?=
2727
else
2828
CC := $(TOOLCHAIN)$(ARCH)gcc
2929
AS := $(TOOLCHAIN)$(ARCH)gcc
3030
LD := $(TOOLCHAIN)$(ARCH)ld
3131
OBJCOPY := $(TOOLCHAIN)$(ARCH)objcopy
32-
CLANG_FORMAT := clang-format
32+
CLANG_FORMAT ?= clang-format
3333
EXTRA_CFLAGS ?= -Wstack-usage=2048
3434
endif
3535

src/aic.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#include "utils.h"
88

99
#define MASK_REG(x) (4 * ((x) >> 5))
10-
#define MASK_BIT(x) BIT((x)&GENMASK(4, 0))
10+
#define MASK_BIT(x) BIT((x) & GENMASK(4, 0))
1111

1212
static struct aic aic1 = {
1313
.version = 1,

src/usb_dwc3_regs.h

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@
156156
/* Global Configuration Register */
157157
#define DWC3_GCTL_PWRDNSCALE(n) ((n) << 19)
158158
#define DWC3_GCTL_U2RSTECN (1 << 16)
159-
#define DWC3_GCTL_RAMCLKSEL(x) (((x)&DWC3_GCTL_CLK_MASK) << 6)
159+
#define DWC3_GCTL_RAMCLKSEL(x) (((x) & DWC3_GCTL_CLK_MASK) << 6)
160160
#define DWC3_GCTL_CLK_BUS (0)
161161
#define DWC3_GCTL_CLK_PIPE (1)
162162
#define DWC3_GCTL_CLK_PIPEHALF (2)
@@ -184,8 +184,8 @@
184184
#define DWC3_GUSB3PIPECTL_SUSPHY (1 << 17)
185185

186186
/* Global TX Fifo Size Register */
187-
#define DWC3_GTXFIFOSIZ_TXFDEF(n) ((n)&0xffff)
188-
#define DWC3_GTXFIFOSIZ_TXFSTADDR(n) ((n)&0xffff0000)
187+
#define DWC3_GTXFIFOSIZ_TXFDEF(n) ((n) & 0xffff)
188+
#define DWC3_GTXFIFOSIZ_TXFSTADDR(n) ((n) & 0xffff0000)
189189

190190
/* Global HWPARAMS1 Register */
191191
#define DWC3_GHWPARAMS1_EN_PWROPT(n) (((n) & (3 << 24)) >> 24)
@@ -283,12 +283,12 @@
283283
#define DWC3_DSTS_DEVCTRLHLT (1 << 22)
284284

285285
#define DWC3_DSTS_USBLNKST_MASK (0x0f << 18)
286-
#define DWC3_DSTS_USBLNKST(n) (((n)&DWC3_DSTS_USBLNKST_MASK) >> 18)
286+
#define DWC3_DSTS_USBLNKST(n) (((n) & DWC3_DSTS_USBLNKST_MASK) >> 18)
287287

288288
#define DWC3_DSTS_RXFIFOEMPTY (1 << 17)
289289

290290
#define DWC3_DSTS_SOFFN_MASK (0x3fff << 3)
291-
#define DWC3_DSTS_SOFFN(n) (((n)&DWC3_DSTS_SOFFN_MASK) >> 3)
291+
#define DWC3_DSTS_SOFFN(n) (((n) & DWC3_DSTS_SOFFN_MASK) >> 3)
292292

293293
#define DWC3_DSTS_CONNECTSPD (7 << 0)
294294

@@ -396,8 +396,8 @@ enum dwc3_link_state {
396396

397397
/* TRB Length, PCM and Status */
398398
#define DWC3_TRB_SIZE_MASK (0x00ffffff)
399-
#define DWC3_TRB_SIZE_LENGTH(n) ((n)&DWC3_TRB_SIZE_MASK)
400-
#define DWC3_TRB_SIZE_PCM1(n) (((n)&0x03) << 24)
399+
#define DWC3_TRB_SIZE_LENGTH(n) ((n) & DWC3_TRB_SIZE_MASK)
400+
#define DWC3_TRB_SIZE_PCM1(n) (((n) & 0x03) << 24)
401401
#define DWC3_TRB_SIZE_TRBSTS(n) (((n) & (0x0f << 28)) >> 28)
402402

403403
#define DWC3_TRBSTS_OK 0
@@ -410,10 +410,10 @@ enum dwc3_link_state {
410410
#define DWC3_TRB_CTRL_LST (1 << 1)
411411
#define DWC3_TRB_CTRL_CHN (1 << 2)
412412
#define DWC3_TRB_CTRL_CSP (1 << 3)
413-
#define DWC3_TRB_CTRL_TRBCTL(n) (((n)&0x3f) << 4)
413+
#define DWC3_TRB_CTRL_TRBCTL(n) (((n) & 0x3f) << 4)
414414
#define DWC3_TRB_CTRL_ISP_IMI (1 << 10)
415415
#define DWC3_TRB_CTRL_IOC (1 << 11)
416-
#define DWC3_TRB_CTRL_SID_SOFN(n) (((n)&0xffff) << 14)
416+
#define DWC3_TRB_CTRL_SID_SOFN(n) (((n) & 0xffff) << 14)
417417

418418
#define DWC3_TRBCTL_NORMAL DWC3_TRB_CTRL_TRBCTL(1)
419419
#define DWC3_TRBCTL_CONTROL_SETUP DWC3_TRB_CTRL_TRBCTL(2)
@@ -439,14 +439,14 @@ struct dwc3_trb {
439439
} PACKED;
440440

441441
/* HWPARAMS0 */
442-
#define DWC3_MODE(n) ((n)&0x7)
442+
#define DWC3_MODE(n) ((n) & 0x7)
443443

444444
#define DWC3_MODE_DEVICE 0
445445
#define DWC3_MODE_HOST 1
446446
#define DWC3_MODE_DRD 2
447447
#define DWC3_MODE_HUB 3
448448

449-
#define DWC3_MDWIDTH(n) (((n)&0xff00) >> 8)
449+
#define DWC3_MDWIDTH(n) (((n) & 0xff00) >> 8)
450450

451451
/* HWPARAMS1 */
452452
#define DWC3_NUM_INT(n) (((n) & (0x3f << 15)) >> 15)
@@ -458,7 +458,7 @@ struct dwc3_trb {
458458
#define DWC3_NUM_IN_EPS(p) (((p)->hwparams3 & (DWC3_NUM_IN_EPS_MASK)) >> 18)
459459

460460
/* HWPARAMS7 */
461-
#define DWC3_RAM1_DEPTH(n) ((n)&0xffff)
461+
#define DWC3_RAM1_DEPTH(n) ((n) & 0xffff)
462462

463463
#define DWC3_REVISION_173A 0x5533173a
464464
#define DWC3_REVISION_175A 0x5533175a
@@ -605,20 +605,20 @@ union dwc3_event {
605605
struct dwc3_event_gevt gevt;
606606
};
607607

608-
#define DWC3_DEPCFG_EP_TYPE(n) (((n)&0x3) << 1)
609-
#define DWC3_DEPCFG_EP_NUMBER(n) (((n)&0x1f) << 25)
610-
#define DWC3_DEPCFG_FIFO_NUMBER(n) (((n)&0xf) << 17)
611-
#define DWC3_DEPCFG_MAX_PACKET_SIZE(n) (((n)&0x7ff) << 3)
608+
#define DWC3_DEPCFG_EP_TYPE(n) (((n) & 0x3) << 1)
609+
#define DWC3_DEPCFG_EP_NUMBER(n) (((n) & 0x1f) << 25)
610+
#define DWC3_DEPCFG_FIFO_NUMBER(n) (((n) & 0xf) << 17)
611+
#define DWC3_DEPCFG_MAX_PACKET_SIZE(n) (((n) & 0x7ff) << 3)
612612

613-
#define DWC3_DEPCFG_INT_NUM(n) (((n)&0x1f) << 0)
613+
#define DWC3_DEPCFG_INT_NUM(n) (((n) & 0x1f) << 0)
614614
#define DWC3_DEPCFG_XFER_COMPLETE_EN BIT(8)
615615
#define DWC3_DEPCFG_XFER_IN_PROGRESS_EN BIT(9)
616616
#define DWC3_DEPCFG_XFER_NOT_READY_EN BIT(10)
617617
#define DWC3_DEPCFG_FIFO_ERROR_EN BIT(11)
618618
#define DWC3_DEPCFG_STREAM_EVENT_EN BIT(13)
619-
#define DWC3_DEPCFG_BINTERVAL_M1(n) (((n)&0xff) << 16)
619+
#define DWC3_DEPCFG_BINTERVAL_M1(n) (((n) & 0xff) << 16)
620620
#define DWC3_DEPCFG_STREAM_CAPABLE BIT(24)
621-
#define DWC3_DEPCFG_EP_NUMBER(n) (((n)&0x1f) << 25)
621+
#define DWC3_DEPCFG_EP_NUMBER(n) (((n) & 0x1f) << 25)
622622
#define DWC3_DEPCFG_BULK_BASED BIT(30)
623623
#define DWC3_DEPCFG_FIFO_BASED BIT(31)
624624

src/utils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ void spin_init(spinlock_t *lock);
400400
void spin_lock(spinlock_t *lock);
401401
void spin_unlock(spinlock_t *lock);
402402

403-
#define mdelay(m) udelay((m)*1000)
403+
#define mdelay(m) udelay((m) * 1000)
404404

405405
#define panic(fmt, ...) \
406406
do { \

0 commit comments

Comments
 (0)