Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp4607599rwe; Mon, 17 Apr 2023 15:44:12 -0700 (PDT) X-Google-Smtp-Source: AKy350ako/1spsAwfmcA0JDdk0JYGdvsY8HPhjBEt0a8C8B+A4PmVws6INr+Rwa4GMa+Ok9lu600 X-Received: by 2002:a17:902:ce87:b0:1a6:6bd4:cd8c with SMTP id f7-20020a170902ce8700b001a66bd4cd8cmr40553plg.25.1681771452612; Mon, 17 Apr 2023 15:44:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681771452; cv=none; d=google.com; s=arc-20160816; b=w95EM/lZSXOpP4Lvn8rCxSglOwf2nVUJ4fvJplFt42eH9MhsaA2uHEQNHdQA5bekbp 7/S/5DliWzX3y0n0uFSzuPMTNZX1EJCyLmDowk78KMmvHr0EgGiLiEe3PkXW/fmYv6gQ QZ045FRfiM2ZmTRR7ZsWQ6/YbHE3PYDUWpw0zfc9oZ9sa7/J5sgbE8ajDKGKq5wElfjn MysI+8xUebNWS2zW0KOj+XIxDf+OB7+JLsF67tjfe9q1BLBt+nWxO+ehjjQg+EszDxig vODsrULSMgg5PFMlC9WUsUTddl4UsyvzzsF/gH4BfNmWj1UPFS6Pa3u3JLB1Dkr9MkML eHfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=gm1bVqW/yNereBzZ/Ev/KXEwJUyqK/wAFEsQlioQv1s=; b=Tj8K7dO02KpCQb7JAex7tQuLJlm/yqF4koE4FvZqslM401dwrxMCxBImGEuXw/rnbS pF6oZQFj1+896RIY5kHle/t2rkBxfdrjjLsot3J0rjWeHQvEtp8bu/O6At5uUYgFPDzn lnmONAi+gJKGH8cFeHSPbJpCer6NNSTwCo+C1snj4MkQqSr2DGBnsR7TqfgxsW6d2aRF x7wflG+KM5p/BP4gD28gLuZbHHYqja0bdFTLtAFNrtVOaCnlCPv9iM6xtH1Yf/k0z6jY +wGIcYlNUWcv579rMCLyeD4eE+GTK96bv/fJXi/ZEWeFw+u7lzhiiXiLe7DVKG+AUQ7q FA6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="hb/S2y/r"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jf14-20020a170903268e00b001a229e52c19si12953284plb.91.2023.04.17.15.44.01; Mon, 17 Apr 2023 15:44:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="hb/S2y/r"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229602AbjDQWhs (ORCPT + 99 others); Mon, 17 Apr 2023 18:37:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229479AbjDQWhr (ORCPT ); Mon, 17 Apr 2023 18:37:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 065C14211; Mon, 17 Apr 2023 15:37:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 95401622A0; Mon, 17 Apr 2023 22:37:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B68D1C433D2; Mon, 17 Apr 2023 22:37:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1681771064; bh=4chkLext4acUulDFIohP7fhi352aObb1FKu9YKPstuE=; h=From:To:Cc:Subject:Date:From; b=hb/S2y/rigkJ/WkHNx0ib5MgI+9jzdccld4y2a7WmRgQJTQxWBrKxMP7/1migDa+l mpaq8omKobu5mJmldMLps29p1NJnyNs9tF06dbKH50Gf/FWwxCNxCIZC9Wb2i4Aacc Hffx1HHVTZmFhpypOzI0iUqXs2HyHvycFwhhVMz5NxqyGcm2k3IsYslMRfLclnOnHS W5tCxT5Sn5+0XBEmLmszFqMLEMG/odozdGjLAhawRNwFc5T66v4nnxd9kxCRYIx0mR 5Va296OoFxxavFwIfnj8iln4VasY8gtLAKkmXCSCyrSGOdvr7nulYgpfX4ffysEdj8 NY0G9CU4mBtiQ== From: Arnd Bergmann To: Laurent Pinchart , Mauro Carvalho Chehab , Shawn Guo , Sascha Hauer , Christian Hemp , Dong Aisheng , Stefan Riedmueller Cc: Arnd Bergmann , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Jacopo Mondi , linux-media@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] media: nxp: imx8-isi: fix buiding on 32-bit Date: Tue, 18 Apr 2023 00:37:27 +0200 Message-Id: <20230417223738.1811110-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnd Bergmann 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: cf21f328fcaf ("media: nxp: Add i.MX8 ISI driver") Signed-off-by: Arnd Bergmann --- .../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])); + 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; } -- 2.39.2