Re: [PATCH v2 4/5] mtd: spi-nor: Move Software Write Protection logic out of the core

From: Michael Walle
Date: Mon Mar 15 2021 - 04:44:59 EST


Am 2021-03-15 07:09, schrieb Tudor.Ambarus@xxxxxxxxxxxxx:
On 3/6/21 1:19 PM, Michael Walle wrote:
EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Am 2021-03-06 10:50, schrieb Tudor Ambarus:
It makes the core file a bit smaller and provides better separation
between the Software Write Protection features and the core logic.
All the next generic software write protection features (e.g.
Individual
Block Protection) will reside in swp.c.

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

[..]

@@ -3554,6 +3152,9 @@ int spi_nor_scan(struct spi_nor *nor, const char
*name,
      if (ret)
              return ret;

+     if (nor->params->locking_ops)

Should this be in spi_nor_register_locking_ops(), too? I.e.

void spi_nor_register_locking_ops() {
    if (!nor->params->locking_ops)
        return;
..
}

Yes, the checking should be done inside spi_nor_register_locking_ops,
will move it.

Btw, what do you find a better name, spi_nor_register_locking_ops or
spi_nor_init_locking_ops? Applies to OTP as well.

probably register_locking_ops(), as long as the function just does
that.

For OTP, I want to provide nvmem support, too. Thus it will not
only register the mtd ops and thus spi_nor_otp_init() will be
better for my case.

-michael