[PATCH 2/2] mtd: spi-nor: Rename spi_nor_spimem_check_op()
Tudor Ambarus
tudor.ambarus at linaro.org
Tue Mar 10 02:54:03 PDT 2026
On 1/8/26 2:14 PM, Miquel Raynal wrote:
> This helper really is just a little helper for internal purposes, and is
> page operation oriented, despite its name. It has already been misused
> in commit 5008c3ec3f89 ("mtd: spi-nor: core: Check read CR support"), so
> rename it to clarify its purpose.
>
> Signed-off-by: Miquel Raynal <miquel.raynal at bootlin.com>
> ---
> drivers/mtd/spi-nor/core.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
> index 1f2e312feec7..8d91052cc21e 100644
> --- a/drivers/mtd/spi-nor/core.c
> +++ b/drivers/mtd/spi-nor/core.c
> @@ -2345,15 +2345,15 @@ int spi_nor_hwcaps_pp2cmd(u32 hwcaps)
> }
>
> /**
> - * spi_nor_spimem_check_op - check if the operation is supported
> - * by controller
> + * spi_nor_spimem_check_page_op - check if a page operation is supported
> + * by controller
> *@nor: pointer to a 'struct spi_nor'
> *@op: pointer to op template to be checked
> *
> * Returns 0 if operation is supported, -EOPNOTSUPP otherwise.
> */
> -static int spi_nor_spimem_check_op(struct spi_nor *nor,
> - struct spi_mem_op *op)
> +static int spi_nor_spimem_check_page_op(struct spi_nor *nor,
> + struct spi_mem_op *op)
page is a bit misleading as it can indicate it's used just for page
programs. We need to focus on operations that need address bytes,
reads, pp, page scrub, erase, write/read any register, etc.
Maybe rename it to spi_nor_spimem_check_mem_op?
Or spi_nor_spimem_check_addr_op?
Cheers,
ta
> {
> /*
> * First test with 4 address bytes. The opcode itself might
> @@ -2396,7 +2396,7 @@ static int spi_nor_spimem_check_readop(struct spi_nor *nor,
> if (spi_nor_protocol_is_dtr(nor->read_proto))
> op.dummy.nbytes *= 2;
>
> - return spi_nor_spimem_check_op(nor, &op);
> + return spi_nor_spimem_check_page_op(nor, &op);
> }
>
> /**
> @@ -2414,7 +2414,7 @@ static int spi_nor_spimem_check_pp(struct spi_nor *nor,
>
> spi_nor_spimem_setup_op(nor, &op, pp->proto);
>
> - return spi_nor_spimem_check_op(nor, &op);
> + return spi_nor_spimem_check_page_op(nor, &op);
> }
>
> /**
More information about the linux-mtd
mailing list