]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
mtd: spinand: make spinand_{read,write}_page global
authorMartin Kurbanov <mmkurbanov@salutedevices.com>
Mon, 10 Feb 2025 14:34:13 +0000 (17:34 +0300)
committerMiquel Raynal <miquel.raynal@bootlin.com>
Mon, 10 Feb 2025 14:52:59 +0000 (15:52 +0100)
Change these functions from static to global so that to use them later
in OTP operations. Since reading OTP pages is no different from reading
pages from the main area.

Signed-off-by: Martin Kurbanov <mmkurbanov@salutedevices.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
drivers/mtd/nand/spi/core.c
include/linux/mtd/spinand.h

index da4713692674147c24503bd6a89d5bc0d1fb7f4b..2b6ffd6fc90dad9c6515fdd92eb8ed51ec941dc4 100644 (file)
@@ -604,8 +604,16 @@ static int spinand_lock_block(struct spinand_device *spinand, u8 lock)
        return spinand_write_reg_op(spinand, REG_BLOCK_LOCK, lock);
 }
 
-static int spinand_read_page(struct spinand_device *spinand,
-                            const struct nand_page_io_req *req)
+/**
+ * spinand_read_page() - Read a page
+ * @spinand: the spinand device
+ * @req: the I/O request
+ *
+ * Return: 0 or a positive number of bitflips corrected on success.
+ * A negative error code otherwise.
+ */
+int spinand_read_page(struct spinand_device *spinand,
+                     const struct nand_page_io_req *req)
 {
        struct nand_device *nand = spinand_to_nand(spinand);
        u8 status;
@@ -635,8 +643,16 @@ static int spinand_read_page(struct spinand_device *spinand,
        return nand_ecc_finish_io_req(nand, (struct nand_page_io_req *)req);
 }
 
-static int spinand_write_page(struct spinand_device *spinand,
-                             const struct nand_page_io_req *req)
+/**
+ * spinand_write_page() - Write a page
+ * @spinand: the spinand device
+ * @req: the I/O request
+ *
+ * Return: 0 or a positive number of bitflips corrected on success.
+ * A negative error code otherwise.
+ */
+int spinand_write_page(struct spinand_device *spinand,
+                      const struct nand_page_io_req *req)
 {
        struct nand_device *nand = spinand_to_nand(spinand);
        u8 status;
index 0da8a1c7740ef5cbbdb2a74858465136638224f4..34ddd2441fc9795551b9523497e34649910dffca 100644 (file)
@@ -588,4 +588,10 @@ int spinand_upd_cfg(struct spinand_device *spinand, u8 mask, u8 val);
 int spinand_write_reg_op(struct spinand_device *spinand, u8 reg, u8 val);
 int spinand_select_target(struct spinand_device *spinand, unsigned int target);
 
+int spinand_read_page(struct spinand_device *spinand,
+                     const struct nand_page_io_req *req);
+
+int spinand_write_page(struct spinand_device *spinand,
+                      const struct nand_page_io_req *req);
+
 #endif /* __LINUX_MTD_SPINAND_H */