[PATCH v4 3/3] mtd: rawnand: r852: declare NAND_USES_DMA
sashiko-bot at kernel.org
sashiko-bot at kernel.org
Wed Nov 25 04:10:29 PST 2026
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] mtd: rawnand: r852: unconditional NAND_USES_DMA in
r852_register_nand_device()
--
commit bcc683752c018cf038ec971c8ed1a1fbca49d325
Author: Ping Li <leeonion.muyu at gmail.com>
mtd: rawnand: r852: declare NAND_USES_DMA
This commit sets NAND_USES_DMA and chip->buf_align = R852_DMA_LEN in
r852_register_nand_device() so nand_base bounces non-linear and misaligned
buffers before r852_do_dma() maps them with dma_map_single().
> diff --git a/drivers/mtd/nand/raw/r852.c b/drivers/mtd/nand/raw/r852.c
> index 92c47d351c278..a68f58c81d6c0 100644
> --- a/drivers/mtd/nand/raw/r852.c
> +++ b/drivers/mtd/nand/raw/r852.c
> @@ -640,6 +640,9 @@ static int r852_register_nand_device(struct r852_device *dev)
> if (dev->readonly)
> dev->chip->options |= NAND_ROM;
>
> + dev->chip->options |= NAND_USES_DMA;
> + dev->chip->buf_align = R852_DMA_LEN;
[Severity: Low]
Should NAND_USES_DMA and chip->buf_align be gated on dev->dma_usable?
r852_dma_test() sets dev->dma_usable = 0 when the controller lacks DMA
support or the r852_enable_dma module parameter is disabled, and
r852_read_buf() and r852_write_buf() only call r852_do_dma() when
len == R852_DMA_LEN && dev->dma_usable. Setting these unconditionally
forces nand_base to bounce non-linear and non-512-byte-aligned buffers
through chip->data_buf even when the driver operates purely in PIO mode.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261125115108.4147741-1-leeonion.muyu@gmail.com?part=3
More information about the linux-mtd
mailing list