On 5/21/21 10:40 PM, Michael Walle wrote:
EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
SPI NOR flashes will just ignore program commands if the OTP region is
locked. Thus, a user might not notice that the intended write didn't end
up in the flash. Return -EROFS to the user in this case. From what I can
tell, chips/cfi_cmdset_0001.c also return this error code.
One could optimize spi_nor_mtd_otp_range_is_locked() to read the status
register only once and not for every OTP region, but for that we would
need some more invasive changes. Given that this is
one-time-programmable memory and the normal access mode is reading, we
just live with the small overhead.
:)
Shouldn't we change
struct spi_nor_otp_ops {
...
int (*lock)(struct spi_nor *nor, unsigned int region);
int (*is_locked)(struct spi_nor *nor, unsigned int region);
};
to:
struct spi_nor_otp_ops {
...
int (*lock)(struct spi_nor *nor, loff_t addr, size_t len);
int (*is_locked)(struct spi_nor *nor, loff_t addr, size_t len);
};
instead?