Skip to content

Commit 4d0f627

Browse files
bjdooks-ctbebarino
authored andcommitted
clk: mvebu: armada-37xx-periph: fix __iomem casts in structure init
There are a number of casts to "void __iomem *" in the initialsation of the driver's clk information. Fix this by adding a helper macro for the cast. Silences a number of sparse warnings: drivers/clk/mvebu/armada-37xx-periph.c:254:1: warning: incorrect type in initializer (different address spaces) drivers/clk/mvebu/armada-37xx-periph.c:254:1: expected void [noderef] __iomem *reg drivers/clk/mvebu/armada-37xx-periph.c:254:1: got void * drivers/clk/mvebu/armada-37xx-periph.c:254:1: warning: incorrect type in initializer (different address spaces) drivers/clk/mvebu/armada-37xx-periph.c:254:1: expected void [noderef] __iomem *reg1 drivers/clk/mvebu/armada-37xx-periph.c:254:1: got void * drivers/clk/mvebu/armada-37xx-periph.c:254:1: warning: incorrect type in initializer (different address spaces) drivers/clk/mvebu/armada-37xx-periph.c:254:1: expected void [noderef] __iomem *reg2 drivers/clk/mvebu/armada-37xx-periph.c:254:1: got void * drivers/clk/mvebu/armada-37xx-periph.c:255:1: warning: incorrect type in initializer (different address spaces) drivers/clk/mvebu/armada-37xx-periph.c:255:1: expected void [noderef] __iomem *reg drivers/clk/mvebu/armada-37xx-periph.c:255:1: got void * ... Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk> Reviewed-by: Brian Masney <bmasney@redhat.com> Signed-off-by: Stephen Boyd <sboyd@kernel.org>
1 parent 096abbb commit 4d0f627

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

drivers/clk/mvebu/armada-37xx-periph.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,11 @@ static const struct clk_div_table clk_table2[] = {
126126
static const struct clk_ops clk_double_div_ops;
127127
static const struct clk_ops clk_pm_cpu_ops;
128128

129+
#define __reg(__x) ((void __iomem __force *)(__x))
130+
129131
#define PERIPH_GATE(_name, _bit) \
130132
struct clk_gate gate_##_name = { \
131-
.reg = (void *)CLK_DIS, \
133+
.reg = __reg(CLK_DIS), \
132134
.bit_idx = _bit, \
133135
.hw.init = &(struct clk_init_data){ \
134136
.ops = &clk_gate_ops, \
@@ -137,7 +139,7 @@ struct clk_gate gate_##_name = { \
137139

138140
#define PERIPH_MUX(_name, _shift) \
139141
struct clk_mux mux_##_name = { \
140-
.reg = (void *)TBG_SEL, \
142+
.reg = __reg(TBG_SEL), \
141143
.shift = _shift, \
142144
.mask = 3, \
143145
.hw.init = &(struct clk_init_data){ \
@@ -147,8 +149,8 @@ struct clk_mux mux_##_name = { \
147149

148150
#define PERIPH_DOUBLEDIV(_name, _reg1, _reg2, _shift1, _shift2) \
149151
struct clk_double_div rate_##_name = { \
150-
.reg1 = (void *)_reg1, \
151-
.reg2 = (void *)_reg2, \
152+
.reg1 = __reg(_reg1), \
153+
.reg2 = __reg(_reg2), \
152154
.shift1 = _shift1, \
153155
.shift2 = _shift2, \
154156
.hw.init = &(struct clk_init_data){ \
@@ -158,7 +160,7 @@ struct clk_double_div rate_##_name = { \
158160

159161
#define PERIPH_DIV(_name, _reg, _shift, _table) \
160162
struct clk_divider rate_##_name = { \
161-
.reg = (void *)_reg, \
163+
.reg = __reg(_reg), \
162164
.table = _table, \
163165
.shift = _shift, \
164166
.hw.init = &(struct clk_init_data){ \
@@ -168,10 +170,10 @@ struct clk_divider rate_##_name = { \
168170

169171
#define PERIPH_PM_CPU(_name, _shift1, _reg, _shift2) \
170172
struct clk_pm_cpu muxrate_##_name = { \
171-
.reg_mux = (void *)TBG_SEL, \
173+
.reg_mux = __reg(TBG_SEL), \
172174
.mask_mux = 3, \
173175
.shift_mux = _shift1, \
174-
.reg_div = (void *)_reg, \
176+
.reg_div = __reg(_reg), \
175177
.shift_div = _shift2, \
176178
.hw.init = &(struct clk_init_data){ \
177179
.ops = &clk_pm_cpu_ops, \

0 commit comments

Comments
 (0)