public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Vinod Koul <vkoul@kernel.org>
To: Mohan Kumar D <mkumard@nvidia.com>
Cc: thierry.reding@gmail.com, jonathanh@nvidia.com,
	dmaengine@vger.kernel.org, linux-tegra@vger.kernel.org,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org,
	kernel test robot <lkp@intel.com>
Subject: Re: [PATCH v4 1/2] dmaengine: tegra210-adma: Fix build error due to 64-by-32 division
Date: Mon, 10 Feb 2025 16:32:16 +0530	[thread overview]
Message-ID: <Z6ncuLHotCAw61b5@vaman> (raw)
In-Reply-To: <20250205033131.3920801-2-mkumard@nvidia.com>

Hi Mohan,

On 05-02-25, 09:01, Mohan Kumar D wrote:
> Kernel test robot reported the build errors on 32-bit platforms due to
> plain 64-by-32 division. Following build erros were reported.

Patch should describe the change! Please revise subject to describe that
and not fix build error... This can come in changelog and below para is
apt

> 
>    "ERROR: modpost: "__udivdi3" [drivers/dma/tegra210-adma.ko] undefined!
>     ld: drivers/dma/tegra210-adma.o: in function `tegra_adma_probe':
>     tegra210-adma.c:(.text+0x12cf): undefined reference to `__udivdi3'"
> 
> This can be fixed by using div_u64() for the adma address space
> 
> Fixes: 68811c928f88 ("dmaengine: tegra210-adma: Support channel page")
> Cc: stable@vger.kernel.org
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202412250204.GCQhdKe3-lkp@intel.com/
> Signed-off-by: Mohan Kumar D <mkumard@nvidia.com>
> ---
>  drivers/dma/tegra210-adma.c | 15 +++++++++++----
>  1 file changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/dma/tegra210-adma.c b/drivers/dma/tegra210-adma.c
> index 6896da8ac7ef..a0bd4822ed80 100644
> --- a/drivers/dma/tegra210-adma.c
> +++ b/drivers/dma/tegra210-adma.c
> @@ -887,7 +887,8 @@ static int tegra_adma_probe(struct platform_device *pdev)
>  	const struct tegra_adma_chip_data *cdata;
>  	struct tegra_adma *tdma;
>  	struct resource *res_page, *res_base;
> -	int ret, i, page_no;
> +	u64 page_no, page_offset;
> +	int ret, i;
>  
>  	cdata = of_device_get_match_data(&pdev->dev);
>  	if (!cdata) {
> @@ -914,10 +915,16 @@ static int tegra_adma_probe(struct platform_device *pdev)
>  
>  		res_base = platform_get_resource_byname(pdev, IORESOURCE_MEM, "global");
>  		if (res_base) {
> -			page_no = (res_page->start - res_base->start) / cdata->ch_base_offset;
> -			if (page_no <= 0)
> +			if (WARN_ON(res_page->start <= res_base->start))
>  				return -EINVAL;
> -			tdma->ch_page_no = page_no - 1;
> +
> +			page_offset = res_page->start - res_base->start;
> +			page_no = div_u64(page_offset, cdata->ch_base_offset);
> +
> +			if (WARN_ON(page_no == 0))
> +				return -EINVAL;
> +
> +			tdma->ch_page_no = lower_32_bits(page_no) - 1;
>  			tdma->base_addr = devm_ioremap_resource(&pdev->dev, res_base);
>  			if (IS_ERR(tdma->base_addr))
>  				return PTR_ERR(tdma->base_addr);
> -- 
> 2.25.1

-- 
~Vinod

  parent reply	other threads:[~2025-02-10 11:02 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-05  3:31 [PATCH v4 0/2] Tegra ADMA fixes Mohan Kumar D
2025-02-05  3:31 ` [PATCH v4 1/2] dmaengine: tegra210-adma: Fix build error due to 64-by-32 division Mohan Kumar D
2025-02-05 11:27   ` Jon Hunter
2025-02-05 11:28     ` Jon Hunter
2025-02-05 13:25   ` Thierry Reding
2025-02-10 11:02   ` Vinod Koul [this message]
2025-02-10 11:15     ` Mohan Kumar D
2025-02-10 11:23       ` Vinod Koul
2025-02-05  3:31 ` [PATCH v4 2/2] dmaengine: tegra210-adma: check for adma max page Mohan Kumar D
2025-02-05 11:40   ` Jon Hunter
2025-02-05 12:58     ` Mohan Kumar D
2025-02-05 13:24       ` Thierry Reding
2025-02-05 13:25   ` Thierry Reding
2025-02-05 14:03 ` [PATCH v4 0/2] Tegra ADMA fixes Jon Hunter

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=Z6ncuLHotCAw61b5@vaman \
    --to=vkoul@kernel.org \
    --cc=dmaengine@vger.kernel.org \
    --cc=jonathanh@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=mkumard@nvidia.com \
    --cc=stable@vger.kernel.org \
    --cc=thierry.reding@gmail.com \
    /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