Re: [PATCH] mtd: spi-nor: add support to non-uniform SFDP SPI NOR flash memories

From: Boris Brezillon
Date: Sun Jun 24 2018 - 16:00:10 EST


Hi Tudor,

Just one minor comment, I'll let Marek review the patch in more details.

On Fri, 8 Jun 2018 16:48:18 +0300
Tudor Ambarus <tudor.ambarus@xxxxxxxxxxxxx> wrote:

> /*
> * Erase an address range on the nor chip. The address range may extend
> * one or more erase sectors. Return an error is there is a problem erasing.
> @@ -511,9 +721,11 @@ static int spi_nor_erase(struct mtd_info *mtd, struct erase_info *instr)
> dev_dbg(nor->dev, "at 0x%llx, len %lld\n", (long long)instr->addr,
> (long long)instr->len);
>
> - div_u64_rem(instr->len, mtd->erasesize, &rem);
> - if (rem)
> - return -EINVAL;
> + if (likely(spi_nor_has_uniform_erase(nor))) {

To be honest, I don't think the likely() makes any difference here,
given the time it takes to actually erase the block. Can we just drop
it?

> + div_u64_rem(instr->len, mtd->erasesize, &rem);
> + if (rem)
> + return -EINVAL;
> + }

Regards,

Boris