Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit ba0ad6e

Browse files
arndbtorvalds
authored andcommitted
media: nxp: imx8-isi: fix buiding on 32-bit
The #if check is wrong, leading to a build failure: drivers/media/platform/nxp/imx8-isi/imx8-isi-hw.c: In function 'mxc_isi_channel_set_inbuf': drivers/media/platform/nxp/imx8-isi/imx8-isi-hw.c:33:5: error: "CONFIG_ARCH_DMA_ADDR_T_64BIT" is not defined, evaluates to 0 [-Werror=undef] 33 | #if CONFIG_ARCH_DMA_ADDR_T_64BIT | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ This could just be an #ifdef, but it seems nicer to just remove the check entirely. Apparently the only reason for the #ifdef is to avoid another warning: drivers/media/platform/nxp/imx8-isi/imx8-isi-hw.c:55:24: error: right shift count >= width of type [-Werror=shift-count-overflow] But this is best avoided by using the lower_32_bits()/upper_32_bits() helpers. Fixes: cf21f32 ("media: nxp: Add i.MX8 ISI driver") Signed-off-by: Arnd Bergmann <[email protected]> Reviewed-by: Laurent Pinchart <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent ac9a786 commit ba0ad6e

File tree

1 file changed

+21
-20
lines changed

1 file changed

+21
-20
lines changed

drivers/media/platform/nxp/imx8-isi/imx8-isi-hw.c

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,10 @@ static inline void mxc_isi_write(struct mxc_isi_pipe *pipe, u32 reg, u32 val)
2929

3030
void mxc_isi_channel_set_inbuf(struct mxc_isi_pipe *pipe, dma_addr_t dma_addr)
3131
{
32-
mxc_isi_write(pipe, CHNL_IN_BUF_ADDR, dma_addr);
33-
#if CONFIG_ARCH_DMA_ADDR_T_64BIT
32+
mxc_isi_write(pipe, CHNL_IN_BUF_ADDR, lower_32_bits(dma_addr));
3433
if (pipe->isi->pdata->has_36bit_dma)
35-
mxc_isi_write(pipe, CHNL_IN_BUF_XTND_ADDR, dma_addr >> 32);
36-
#endif
34+
mxc_isi_write(pipe, CHNL_IN_BUF_XTND_ADDR,
35+
upper_32_bits(dma_addr));
3736
}
3837

3938
void mxc_isi_channel_set_outbuf(struct mxc_isi_pipe *pipe,
@@ -45,34 +44,36 @@ void mxc_isi_channel_set_outbuf(struct mxc_isi_pipe *pipe,
4544
val = mxc_isi_read(pipe, CHNL_OUT_BUF_CTRL);
4645

4746
if (buf_id == MXC_ISI_BUF1) {
48-
mxc_isi_write(pipe, CHNL_OUT_BUF1_ADDR_Y, dma_addrs[0]);
49-
mxc_isi_write(pipe, CHNL_OUT_BUF1_ADDR_U, dma_addrs[1]);
50-
mxc_isi_write(pipe, CHNL_OUT_BUF1_ADDR_V, dma_addrs[2]);
51-
#if CONFIG_ARCH_DMA_ADDR_T_64BIT
47+
mxc_isi_write(pipe, CHNL_OUT_BUF1_ADDR_Y,
48+
lower_32_bits(dma_addrs[0]));
49+
mxc_isi_write(pipe, CHNL_OUT_BUF1_ADDR_U,
50+
lower_32_bits(dma_addrs[1]));
51+
mxc_isi_write(pipe, CHNL_OUT_BUF1_ADDR_V,
52+
lower_32_bits(dma_addrs[2]));
5253
if (pipe->isi->pdata->has_36bit_dma) {
5354
mxc_isi_write(pipe, CHNL_Y_BUF1_XTND_ADDR,
54-
dma_addrs[0] >> 32);
55+
upper_32_bits(dma_addrs[0]));
5556
mxc_isi_write(pipe, CHNL_U_BUF1_XTND_ADDR,
56-
dma_addrs[1] >> 32);
57+
upper_32_bits(dma_addrs[1]));
5758
mxc_isi_write(pipe, CHNL_V_BUF1_XTND_ADDR,
58-
dma_addrs[2] >> 32);
59+
upper_32_bits(dma_addrs[2]));
5960
}
60-
#endif
6161
val ^= CHNL_OUT_BUF_CTRL_LOAD_BUF1_ADDR;
6262
} else {
63-
mxc_isi_write(pipe, CHNL_OUT_BUF2_ADDR_Y, dma_addrs[0]);
64-
mxc_isi_write(pipe, CHNL_OUT_BUF2_ADDR_U, dma_addrs[1]);
65-
mxc_isi_write(pipe, CHNL_OUT_BUF2_ADDR_V, dma_addrs[2]);
66-
#if CONFIG_ARCH_DMA_ADDR_T_64BIT
63+
mxc_isi_write(pipe, CHNL_OUT_BUF2_ADDR_Y,
64+
lower_32_bits(dma_addrs[0]));
65+
mxc_isi_write(pipe, CHNL_OUT_BUF2_ADDR_U,
66+
lower_32_bits(dma_addrs[1]));
67+
mxc_isi_write(pipe, CHNL_OUT_BUF2_ADDR_V,
68+
lower_32_bits(dma_addrs[2]));
6769
if (pipe->isi->pdata->has_36bit_dma) {
6870
mxc_isi_write(pipe, CHNL_Y_BUF2_XTND_ADDR,
69-
dma_addrs[0] >> 32);
71+
upper_32_bits(dma_addrs[0]));
7072
mxc_isi_write(pipe, CHNL_U_BUF2_XTND_ADDR,
71-
dma_addrs[1] >> 32);
73+
upper_32_bits(dma_addrs[1]));
7274
mxc_isi_write(pipe, CHNL_V_BUF2_XTND_ADDR,
73-
dma_addrs[2] >> 32);
75+
upper_32_bits(dma_addrs[2]));
7476
}
75-
#endif
7677
val ^= CHNL_OUT_BUF_CTRL_LOAD_BUF2_ADDR;
7778
}
7879

0 commit comments

Comments
 (0)