From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Arnd Bergmann <arnd@kernel.org>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
Shawn Guo <shawnguo@kernel.org>,
Sascha Hauer <s.hauer@pengutronix.de>,
Christian Hemp <c.hemp@phytec.de>,
Dong Aisheng <aisheng.dong@nxp.com>,
Stefan Riedmueller <s.riedmueller@phytec.de>,
Arnd Bergmann <arnd@arndb.de>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Fabio Estevam <festevam@gmail.com>,
NXP Linux Team <linux-imx@nxp.com>,
Jacopo Mondi <jacopo.mondi@ideasonboard.com>,
linux-media@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] media: nxp: imx8-isi: fix buiding on 32-bit
Date: Tue, 18 Apr 2023 06:20:31 +0300 [thread overview]
Message-ID: <20230418032031.GA4703@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20230417223738.1811110-1-arnd@kernel.org>
Hi Arnd,
Thank you for the patch.
On Tue, Apr 18, 2023 at 12:37:27AM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> 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.
I've submitted a patch yesterday that uses #ifdef, but I like this one
better. One could argue that it leads to dead code on 32-bit platforms,
but the ISI is only present in 64-bit SoCs, so that's not an issue.
> Fixes: cf21f328fcaf ("media: nxp: Add i.MX8 ISI driver")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> .../media/platform/nxp/imx8-isi/imx8-isi-hw.c | 41 ++++++++++---------
> 1 file changed, 21 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/media/platform/nxp/imx8-isi/imx8-isi-hw.c b/drivers/media/platform/nxp/imx8-isi/imx8-isi-hw.c
> index db538f3d88ec..f6112b83866a 100644
> --- a/drivers/media/platform/nxp/imx8-isi/imx8-isi-hw.c
> +++ b/drivers/media/platform/nxp/imx8-isi/imx8-isi-hw.c
> @@ -29,11 +29,10 @@ static inline void mxc_isi_write(struct mxc_isi_pipe *pipe, u32 reg, u32 val)
>
> void mxc_isi_channel_set_inbuf(struct mxc_isi_pipe *pipe, dma_addr_t dma_addr)
> {
> - mxc_isi_write(pipe, CHNL_IN_BUF_ADDR, dma_addr);
> -#if CONFIG_ARCH_DMA_ADDR_T_64BIT
> + mxc_isi_write(pipe, CHNL_IN_BUF_ADDR, lower_32_bits(dma_addr));
> if (pipe->isi->pdata->has_36bit_dma)
> - mxc_isi_write(pipe, CHNL_IN_BUF_XTND_ADDR, dma_addr >> 32);
> -#endif
> + mxc_isi_write(pipe, CHNL_IN_BUF_XTND_ADDR,
> + upper_32_bits(dma_addr));
> }
>
> 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,
> val = mxc_isi_read(pipe, CHNL_OUT_BUF_CTRL);
>
> if (buf_id == MXC_ISI_BUF1) {
> - mxc_isi_write(pipe, CHNL_OUT_BUF1_ADDR_Y, dma_addrs[0]);
> - mxc_isi_write(pipe, CHNL_OUT_BUF1_ADDR_U, dma_addrs[1]);
> - mxc_isi_write(pipe, CHNL_OUT_BUF1_ADDR_V, dma_addrs[2]);
> -#if CONFIG_ARCH_DMA_ADDR_T_64BIT
> + mxc_isi_write(pipe, CHNL_OUT_BUF1_ADDR_Y,
> + lower_32_bits(dma_addrs[0]));
Could you please align this with the ( ? I can also do so in my tree,
but I expect Mauro to pick this patch directly from the list, so a v2
would make it easier. You can then add my
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> + mxc_isi_write(pipe, CHNL_OUT_BUF1_ADDR_U,
> + lower_32_bits(dma_addrs[1]));
> + mxc_isi_write(pipe, CHNL_OUT_BUF1_ADDR_V,
> + lower_32_bits(dma_addrs[2]));
> if (pipe->isi->pdata->has_36bit_dma) {
> mxc_isi_write(pipe, CHNL_Y_BUF1_XTND_ADDR,
> - dma_addrs[0] >> 32);
> + upper_32_bits(dma_addrs[0]));
> mxc_isi_write(pipe, CHNL_U_BUF1_XTND_ADDR,
> - dma_addrs[1] >> 32);
> + upper_32_bits(dma_addrs[1]));
> mxc_isi_write(pipe, CHNL_V_BUF1_XTND_ADDR,
> - dma_addrs[2] >> 32);
> + upper_32_bits(dma_addrs[2]));
> }
> -#endif
> val ^= CHNL_OUT_BUF_CTRL_LOAD_BUF1_ADDR;
> } else {
> - mxc_isi_write(pipe, CHNL_OUT_BUF2_ADDR_Y, dma_addrs[0]);
> - mxc_isi_write(pipe, CHNL_OUT_BUF2_ADDR_U, dma_addrs[1]);
> - mxc_isi_write(pipe, CHNL_OUT_BUF2_ADDR_V, dma_addrs[2]);
> -#if CONFIG_ARCH_DMA_ADDR_T_64BIT
> + mxc_isi_write(pipe, CHNL_OUT_BUF2_ADDR_Y,
> + lower_32_bits(dma_addrs[0]));
> + mxc_isi_write(pipe, CHNL_OUT_BUF2_ADDR_U,
> + lower_32_bits(dma_addrs[1]));
> + mxc_isi_write(pipe, CHNL_OUT_BUF2_ADDR_V,
> + lower_32_bits(dma_addrs[2]));
> if (pipe->isi->pdata->has_36bit_dma) {
> mxc_isi_write(pipe, CHNL_Y_BUF2_XTND_ADDR,
> - dma_addrs[0] >> 32);
> + upper_32_bits(dma_addrs[0]));
> mxc_isi_write(pipe, CHNL_U_BUF2_XTND_ADDR,
> - dma_addrs[1] >> 32);
> + upper_32_bits(dma_addrs[1]));
> mxc_isi_write(pipe, CHNL_V_BUF2_XTND_ADDR,
> - dma_addrs[2] >> 32);
> + upper_32_bits(dma_addrs[2]));
> }
> -#endif
> val ^= CHNL_OUT_BUF_CTRL_LOAD_BUF2_ADDR;
> }
>
--
Regards,
Laurent Pinchart
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2023-04-18 3:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-17 22:37 [PATCH] media: nxp: imx8-isi: fix buiding on 32-bit Arnd Bergmann
2023-04-18 3:20 ` Laurent Pinchart [this message]
2023-04-18 6:13 ` Arnd Bergmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230418032031.GA4703@pendragon.ideasonboard.com \
--to=laurent.pinchart@ideasonboard.com \
--cc=aisheng.dong@nxp.com \
--cc=arnd@arndb.de \
--cc=arnd@kernel.org \
--cc=c.hemp@phytec.de \
--cc=festevam@gmail.com \
--cc=jacopo.mondi@ideasonboard.com \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-imx@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=s.riedmueller@phytec.de \
--cc=shawnguo@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).