Re: [PATCH v6 6/9] dmaengine: fsl-edma: use BIT_ULL for 64-bit channel mask

From: Frank Li

Date: Thu Nov 12 2026 - 11:13:47 EST


On Thu, Nov 12, 2026 at 03:53:09PM +0800, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan@xxxxxxx>
>
> chan_masked is a u64 bitmap, but several checks use BIT(), which uses
> unsigned long and overflows on 32-bit architectures for channels >= 32.
> Use BIT_ULL() so the upper channels are tested correctly.
>
> Signed-off-by: Peng Fan <peng.fan@xxxxxxx>
> ---

Reviewed-by: Frank Li <Frank.Li@xxxxxxx>

> drivers/dma/fsl-edma-main.c | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/dma/fsl-edma-main.c b/drivers/dma/fsl-edma-main.c
> index 7f82dcb7831d..818b9b986f13 100644
> --- a/drivers/dma/fsl-edma-main.c
> +++ b/drivers/dma/fsl-edma-main.c
> @@ -123,7 +123,7 @@ static irqreturn_t fsl_edma3_err_handler_shared(int irq, void *dev_id)
> unsigned int ch;
>
> for (ch = 0; ch < fsl_edma->n_chans; ch++) {
> - if (fsl_edma->chan_masked & BIT(ch))
> + if (fsl_edma->chan_masked & BIT_ULL(ch))
> continue;
>
> fsl_edma3_err_check(&fsl_edma->chans[ch]);
> @@ -397,7 +397,7 @@ static int fsl_edma3_irq_init(struct platform_device *pdev, struct fsl_edma_engi
>
> struct fsl_edma_chan *fsl_chan = &fsl_edma->chans[i];
>
> - if (fsl_edma->chan_masked & BIT(i))
> + if (fsl_edma->chan_masked & BIT_ULL(i))
> continue;
>
> /* request channel irq */
> @@ -641,7 +641,7 @@ static void fsl_edma3_detach_pd(struct fsl_edma_engine *fsl_edma)
> int i;
>
> for (i = 0; i < fsl_edma->n_chans; i++) {
> - if (fsl_edma->chan_masked & BIT(i))
> + if (fsl_edma->chan_masked & BIT_ULL(i))
> continue;
> fsl_chan = &fsl_edma->chans[i];
> if (fsl_chan->pd_dev_link)
> @@ -669,7 +669,7 @@ static int fsl_edma3_attach_pd(struct platform_device *pdev, struct fsl_edma_eng
> dev = &pdev->dev;
>
> for (i = 0; i < fsl_edma->n_chans; i++) {
> - if (fsl_edma->chan_masked & BIT(i))
> + if (fsl_edma->chan_masked & BIT_ULL(i))
> continue;
>
> fsl_chan = &fsl_edma->chans[i];
> @@ -797,7 +797,7 @@ static int fsl_edma_probe(struct platform_device *pdev)
> struct fsl_edma_chan *fsl_chan = &fsl_edma->chans[i];
> int len;
>
> - if (fsl_edma->chan_masked & BIT(i))
> + if (fsl_edma->chan_masked & BIT_ULL(i))
> continue;
>
> snprintf(fsl_chan->chan_name, sizeof(fsl_chan->chan_name), "%s-CH%02d",
> @@ -927,7 +927,7 @@ static int fsl_edma_suspend_late(struct device *dev)
>
> for (i = 0; i < fsl_edma->n_chans; i++) {
> fsl_chan = &fsl_edma->chans[i];
> - if (fsl_edma->chan_masked & BIT(i))
> + if (fsl_edma->chan_masked & BIT_ULL(i))
> continue;
> spin_lock_irqsave(&fsl_chan->vchan.lock, flags);
> /* Make sure chan is idle or will force disable. */
> @@ -953,7 +953,7 @@ static int fsl_edma_resume_early(struct device *dev)
>
> for (i = 0; i < fsl_edma->n_chans; i++) {
> fsl_chan = &fsl_edma->chans[i];
> - if (fsl_edma->chan_masked & BIT(i))
> + if (fsl_edma->chan_masked & BIT_ULL(i))
> continue;
> fsl_chan->pm_state = RUNNING;
> edma_write_tcdreg(fsl_chan, 0, csr);
>
> --
> 2.34.1
>