Re: [PATCH v2 14/35] mtd: spi-nor: spansion: Use manufacturer late_init()

Pratyush Yadav
2021-08-16T19:23:28Z

On 27/07/21 07:52AM, Tudor Ambarus wrote:
> spansion_post_sfdp_fixups() was called regardless if the flash defined
> SFDP tables or not. A better place for this kind of parameters init is
> in manufacturer's late_init() hook. post_sfdp() should be called only
> when SFDP is defined. No functional change in this patch.
>
> Instead of doing the 4b opcodes settings at manufacturer level, thus
> also for every flash that will be introduced, this should be done
> just where it is needed, per flash. I'll let this for other patch.

Yes, agreed.

>
> Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>

Reviewed-by: Pratyush Yadav <p.yadav@ti.com>

> ---
> drivers/mtd/spi-nor/spansion.c | 8 ++------
> 1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/mtd/spi-nor/spansion.c b/drivers/mtd/spi-nor/spansion.c
> index ee82dcd75310..aad7170768b4 100644
> --- a/drivers/mtd/spi-nor/spansion.c
> +++ b/drivers/mtd/spi-nor/spansion.c
> @@ -276,7 +276,7 @@ static const struct flash_info spansion_parts[] = {
> },
> };
>
> -static void spansion_post_sfdp_fixups(struct spi_nor *nor)
> +static void spansion_late_init(struct spi_nor *nor)
> {
> if (nor->params->size <= SZ_16M)
> return;
> @@ -287,13 +287,9 @@ static void spansion_post_sfdp_fixups(struct spi_nor *nor)
> nor->mtd.erasesize = nor->info->sector_size;
> }
>
> -static const struct spi_nor_fixups spansion_fixups = {
> - .post_sfdp = spansion_post_sfdp_fixups,
> -};
> -
> const struct spi_nor_manufacturer spi_nor_spansion = {
> .name = "spansion",
> .parts = spansion_parts,
> .nparts = ARRAY_SIZE(spansion_parts),
> - .fixups = &spansion_fixups,
> + .late_init = spansion_late_init,
> };
> --
> 2.25.1
>

--
Regards,
Pratyush Yadav
Texas Instruments Inc.