Skip to content

Commit 99224c1

Browse files
ConchuODLinus Walleij
authored andcommitted
pinctrl: mpfs-iomux0: fix compile-time constant warning for LLVM prior to 17
With LLVM prior to 17.0.0: drivers/pinctrl/pinctrl-mpfs-iomux0.c:89:2: error: initializer element is not a compile-time constant MPFS_IOMUX0_GROUP(spi0), ^~~~~~~~~~~~~~~~~~~~~~~ drivers/pinctrl/pinctrl-mpfs-iomux0.c:79:10: note: expanded from macro 'MPFS_IOMUX0_GROUP' .mask = BIT(mpfs_iomux0_##_name##_pins[0]), \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/vdso/bits.h:7:19: note: expanded from macro 'BIT' \#define BIT(nr) (UL(1) << (nr)) ^~~~~~~~~~~~~~~ This is a constant, but LLVM prior to a change from Nick to match the gcc behaviour did not allow this. The macro isn't really all that much of an idiot-proofing, just change it to the same sort that's in the gpio2 driver, where a second argument provides the mask/setting. Reported-by: Nathan Chancellor <nathan@kernel.org> Link: ClangBuiltLinux#2140 Fixes: 4639727 ("pinctrl: add polarfire soc iomux0 pinmux driver") Signed-off-by: Conor Dooley <conor.dooley@microchip.com> Reviewed-by: Nathan Chancellor <nathan@kernel.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
1 parent 002679f commit 99224c1

1 file changed

Lines changed: 18 additions & 18 deletions

File tree

drivers/pinctrl/pinctrl-mpfs-iomux0.c

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -73,33 +73,33 @@ static const unsigned int mpfs_iomux0_uart4_pins[] = { 11 };
7373
static const unsigned int mpfs_iomux0_mdio0_pins[] = { 12 };
7474
static const unsigned int mpfs_iomux0_mdio1_pins[] = { 13 };
7575

76-
#define MPFS_IOMUX0_GROUP(_name) { \
76+
#define MPFS_IOMUX0_GROUP(_name, _mask) { \
7777
.name = #_name "_mssio", \
7878
.pins = mpfs_iomux0_##_name##_pins, \
79-
.mask = BIT(mpfs_iomux0_##_name##_pins[0]), \
79+
.mask = _mask, \
8080
.setting = 0x0, \
8181
}, { \
8282
.name = #_name "_fabric", \
8383
.pins = mpfs_iomux0_##_name##_pins, \
84-
.mask = BIT(mpfs_iomux0_##_name##_pins[0]), \
85-
.setting = BIT(mpfs_iomux0_##_name##_pins[0]), \
84+
.mask = _mask, \
85+
.setting = _mask, \
8686
}
8787

8888
static const struct mpfs_iomux0_pin_group mpfs_iomux0_pin_groups[] = {
89-
MPFS_IOMUX0_GROUP(spi0),
90-
MPFS_IOMUX0_GROUP(spi1),
91-
MPFS_IOMUX0_GROUP(i2c0),
92-
MPFS_IOMUX0_GROUP(i2c1),
93-
MPFS_IOMUX0_GROUP(can0),
94-
MPFS_IOMUX0_GROUP(can1),
95-
MPFS_IOMUX0_GROUP(qspi),
96-
MPFS_IOMUX0_GROUP(uart0),
97-
MPFS_IOMUX0_GROUP(uart1),
98-
MPFS_IOMUX0_GROUP(uart2),
99-
MPFS_IOMUX0_GROUP(uart3),
100-
MPFS_IOMUX0_GROUP(uart4),
101-
MPFS_IOMUX0_GROUP(mdio0),
102-
MPFS_IOMUX0_GROUP(mdio1),
89+
MPFS_IOMUX0_GROUP(spi0, BIT(0)),
90+
MPFS_IOMUX0_GROUP(spi1, BIT(1)),
91+
MPFS_IOMUX0_GROUP(i2c0, BIT(2)),
92+
MPFS_IOMUX0_GROUP(i2c1, BIT(3)),
93+
MPFS_IOMUX0_GROUP(can0, BIT(4)),
94+
MPFS_IOMUX0_GROUP(can1, BIT(5)),
95+
MPFS_IOMUX0_GROUP(qspi, BIT(6)),
96+
MPFS_IOMUX0_GROUP(uart0, BIT(7)),
97+
MPFS_IOMUX0_GROUP(uart1, BIT(8)),
98+
MPFS_IOMUX0_GROUP(uart2, BIT(9)),
99+
MPFS_IOMUX0_GROUP(uart3, BIT(10)),
100+
MPFS_IOMUX0_GROUP(uart4, BIT(11)),
101+
MPFS_IOMUX0_GROUP(mdio0, BIT(12)),
102+
MPFS_IOMUX0_GROUP(mdio1, BIT(13)),
103103
};
104104

105105
static const char * const mpfs_iomux0_spi0_groups[] = { "spi0_mssio", "spi0_fabric" };

0 commit comments

Comments
 (0)