[PATCH v2 21/35] mtd: spi-nor: Introduce spi_nor_set_mtd_info()
Tudor.Ambarus at microchip.com
Tudor.Ambarus at microchip.com
Mon Aug 16 00:25:10 PDT 2021
On 7/27/21 7:52 AM, Tudor Ambarus wrote:
> Used to init all the mtd_info fields. Move the mtd_info init
> the last thing in the spi_nor_scan(), so that we avoid superfluous
> initialization of the mtd_info fields in case of errors.
>
> Signed-off-by: Tudor Ambarus <tudor.ambarus at microchip.com>
> ---
> drivers/mtd/spi-nor/core.c | 55 +++++++++++++++++++++-----------------
> 1 file changed, 31 insertions(+), 24 deletions(-)
>
> diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
> index 5c8cffb5e6f2..26acfc9901db 100644
> --- a/drivers/mtd/spi-nor/core.c
> +++ b/drivers/mtd/spi-nor/core.c
> @@ -3124,6 +3124,36 @@ static const struct flash_info *spi_nor_get_flash_info(struct spi_nor *nor,
> return info;
> }
>
> +static void spi_nor_set_mtd_info(struct spi_nor *nor)
> +{
> + struct mtd_info *mtd = &nor->mtd;
> + struct device *dev = nor->dev;
> +
> + spi_nor_register_locking_ops(nor);
> +
> + /* Configure OTP parameters and ops */
> + spi_nor_otp_init(nor);
> +
> + mtd->dev.parent = dev;
> + if (!mtd->name)
> + mtd->name = dev_name(dev);
> + mtd->priv = nor;
Rasmus sent me a heads up that I have a leftover here, probably from a rebase.
The priv assignment is no longer needed as per previous patch. Will update in v3.
More information about the linux-mtd
mailing list