[PATCH v4 02/13] mtd: spi-nor: Introduce spi_nor_set_mtd_info()

Pratyush Yadav p.yadav at ti.com
Thu Dec 2 01:19:48 PST 2021


On 22/11/21 11:50AM, 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.
> 
> While here use common naming scheme for functions that are setting
> mtd_info fields:
> s/spi_nor_register_locking_ops/spi_nor_set_mtd_locking_ops
> s/spi_nor_otp_init/spi_nor_set_mtd_otp_ops
> The functions names are self explanatory, get rid of the comment
> for the OTP function.
> 
> Signed-off-by: Tudor Ambarus <tudor.ambarus at microchip.com>
> Reviewed-by: Michael Walle <michael at walle.cc>

I am not particularly happy with spi_nor_try_unlock_all() using 
nor->mtd, but I can live with it.

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

One small nitpick below.

>  
> -	/* Configure OTP parameters and ops */
> -	spi_nor_otp_init(nor);
> +	/* No mtd_info fields are used up to this point. */

How about "No mtd_info fields should be used up to this point" so we 
give the programmer a command to not use mtd_info fields rather than 
just stating a fact.

> +	spi_nor_set_mtd_info(nor);
>  
>  	dev_info(dev, "%s (%lld Kbytes)\n", info->name,
>  			(long long)mtd->size >> 10);

-- 
Regards,
Pratyush Yadav
Texas Instruments Inc.



More information about the linux-arm-kernel mailing list