Thread (133 messages) flat view 133 messages, 5 authors, 2021-11-06

Re: [PATCH v2 21/35] mtd: spi-nor: Introduce spi_nor_set_mtd_info()

From: Michael Walle <hidden>
Date: 2021-10-22 11:56:01

Am 2021-07-27 06:52, schrieb Tudor Ambarus:
quoted hunk ↗ jump to hunk
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 <redacted>
---
 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);
This ..
+
+	/* Configure OTP parameters and ops */
+	spi_nor_otp_init(nor);
.. this looks odd here now.

The first could be renamed to express that it only registers
mtd ops.

spi_nor_otp_init() does more - strictly speaking. That is,
it does also check that the otp region length is a power of 2.

At least it should also be renamed. But then I wonder, if in the
future there is more to do in spi_nor_otp_init(), where do we put
that then?

So mhh. I don't know. spi_nor_otp_init() is a more fitting name,
but calling it in spi_nor_set_mtd_info() is odd.

-michael

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help