From patchwork Tue Apr 18 06:11:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 84587 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2617465vqo; Mon, 17 Apr 2023 23:21:15 -0700 (PDT) X-Google-Smtp-Source: AKy350Ye2phLUyb7TlN5wxLWWFLGKgO3Wg5CmfCgMaVmbC42xFfkFIqhXo9m6yY13Of4xSARWf43 X-Received: by 2002:a17:902:c745:b0:1a6:a7d4:7474 with SMTP id q5-20020a170902c74500b001a6a7d47474mr831231plq.44.1681798874721; Mon, 17 Apr 2023 23:21:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681798874; cv=none; d=google.com; s=arc-20160816; b=cl7/qPz10enTssrmz/GoGocx31+YT/hVTYSWaHp7kwvZv677rwGC9D45s1CXKGZVBf +C4B1bNlwWcE7YwZHTHJZn+iVVRLbEh9xblo1Pd/fM+WQIDc+Uy9EQUwAwxoRvJdigG6 F5dx4GCuEhk3HvziDkGUSTp4j8KS1LjeMhqY3bKXX68hc5cc7PMFNBoCG0eO4DcV6wEh thjHw66fzQcxsIIEVwkUnSk/RheYM79icsGHMb6y75fpJ5QEz2xNFQOsYgGD04anrE6i cyuE9LWZBPVcYWVd1+1VTZvqYarPDrKesv5VmyIjQKwjo2kVfs+pFP2GaSddFPZzUki0 F5Iw== 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=LCcYgPuHp6CHAzGUUGtM53x+wzt09wEyyAtVOtKnoYk=; b=uugCzwruxKIApo0DGKqNZeriNE00aH8Btf8Nt0Zhrxa/bDSaThNwnBoc0kURvXbk6v z9JxquA7hnfFSm/qMe7ob8r66/BcpadV1WCpM8Os5KncLS3cg8JkK/uufxFyOutA2y58 OybAWVh7KBKqnnfu1JFC3o5cP4yvUdseHN4MbelYXZ+WjY92eSXyQICvru9v9NLhaYx+ jjGTtQ+8BRzfo6hH4BzI2QtdUvozeCa6DsQjZqWkDRp4sgcoM4ukaTuRMKZ+nad2Byqq vFY8PekYtsII+ZFwF91EB/XMYeoS4F+IfwkWt9bp+rQJmFzzd/SlJwj/Kla0Vt64kf13 xDjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QQwFYzkz; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x23-20020a170902821700b0019f33c0d583si11624654pln.315.2023.04.17.23.21.00; Mon, 17 Apr 2023 23:21:14 -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=QQwFYzkz; 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 S229889AbjDRGMF (ORCPT + 99 others); Tue, 18 Apr 2023 02:12:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229518AbjDRGME (ORCPT ); Tue, 18 Apr 2023 02:12:04 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D4472D4C; Mon, 17 Apr 2023 23:12:03 -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 ED05B62BA1; Tue, 18 Apr 2023 06:12:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3EFFBC433D2; Tue, 18 Apr 2023 06:11:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1681798322; bh=gfIXkP7NX6aOSWCtAs3mr4eUk+uPCJUjwRerCetq8ro=; h=From:To:Cc:Subject:Date:From; b=QQwFYzkzNiHP0daAEQPaACLpA1lkB0xUUHj3vQtvWWBsr4s1Mcjo1n20ZdwPTwq6i fz/KZc5IqLJdqkjSS7sE9jeRjoJ+Jq7474lkF7Eqe8bARQW6+fVYKzhjhK4JhHQYk5 4Wps7uGj1BUg/eBNyseCm6MqJHCOcO2uMf+smXvApV1iR4BQSImtW7xbWSmTyer9Pt s9D9lJvTpxl6tNglXDyVUtWh6wi0BOp2GdRHSHkhjP7ySXnwsb+RnqiU/OuNF8MZHM ZXLdy8mthWVjTtMVQlwe3w2SDH2F0ULcgmpdRD87fLKkTL0zeXEbmS7/mVd6RWY2er ijPQu5RDWT7+w== From: Arnd Bergmann To: Laurent Pinchart Cc: Arnd Bergmann , Mauro Carvalho Chehab , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Jacopo Mondi , Dong Aisheng , Guoniu Zhou , Christian Hemp , linux-media@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] [v2] media: nxp: imx8-isi: fix buiding on 32-bit Date: Tue, 18 Apr 2023 08:11:43 +0200 Message-Id: <20230418061155.2923515-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763493936871075072?= X-GMAIL-MSGID: =?utf-8?q?1763493936871075072?= 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 Reviewed-by: Laurent Pinchart --- v2: whitespace fixup --- .../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..19e80b95ffea 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; }