Re: [PATCH v2 06/41] mtd: spi-nor: default page_size to 256 bytes

From: Tudor Ambarus
Date: Thu Aug 24 2023 - 04:37:03 EST




On 8/22/23 08:09, Michael Walle wrote:
> The INFO() macro always set the page_size to 256 bytes. Make that an
> optional parameter. This default is a sane one for all older flashes,
> newer ones will set the page size by its SFDP tables anyway.
>
> Signed-off-by: Michael Walle <mwalle@xxxxxxxxxx>
> Reviewed-by: Miquel Raynal <miquel.raynal@xxxxxxxxxxx>
> ---
> drivers/mtd/spi-nor/core.c | 7 +------
> drivers/mtd/spi-nor/core.h | 8 ++++++--
> 2 files changed, 7 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
> index f4cc2eafcc5e..d27ad1295ee0 100644
> --- a/drivers/mtd/spi-nor/core.c
> +++ b/drivers/mtd/spi-nor/core.c
> @@ -2018,11 +2018,6 @@ static const struct spi_nor_manufacturer *manufacturers[] = {
> static const struct flash_info spi_nor_generic_flash = {
> .name = "spi-nor-generic",
> .n_banks = 1,
> - /*
> - * JESD216 rev A doesn't specify the page size, therefore we need a
> - * sane default.
> - */
> - .page_size = 256,
> .parse_sfdp = true,
> };
>
> @@ -3001,7 +2996,7 @@ static void spi_nor_init_default_params(struct spi_nor *nor)
> params->writesize = 1;
> params->size = info->size;
> params->bank_size = params->size;
> - params->page_size = info->page_size;
> + params->page_size = info->page_size ?: SPI_NOR_DEFAULT_PAGE_SIZE;

how about to get rid of info->page_size entirely and directly use the
default?