]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
mtd: spinand: Make use of spinand_to_[mtd/nand]() helpers
authorMikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Tue, 30 Sep 2025 00:20:51 +0000 (03:20 +0300)
committerMichael Trimarchi <michael@amarulasolutions.com>
Sun, 5 Oct 2025 18:25:54 +0000 (20:25 +0200)
Use spinand_to_nand() and spinand_to_mtd() helpers instead of
nanddev_to_mtd() and direct access to spinand structure fields.

Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
drivers/mtd/nand/spi/core.c

index 3b612bec274532c4200943cfdb7ef380a5a21275..4e8d7444bd687007f36585f23ac95b830971e4e1 100644 (file)
@@ -236,7 +236,7 @@ static int spinand_read_from_cache_op(struct spinand_device *spinand,
                                      const struct nand_page_io_req *req)
 {
        struct nand_device *nand = spinand_to_nand(spinand);
-       struct mtd_info *mtd = nanddev_to_mtd(nand);
+       struct mtd_info *mtd = spinand_to_mtd(spinand);
        struct spi_mem_dirmap_desc *rdesc;
        unsigned int nbytes = 0;
        void *buf = NULL;
@@ -294,7 +294,7 @@ static int spinand_write_to_cache_op(struct spinand_device *spinand,
                                     const struct nand_page_io_req *req)
 {
        struct nand_device *nand = spinand_to_nand(spinand);
-       struct mtd_info *mtd = nanddev_to_mtd(nand);
+       struct mtd_info *mtd = spinand_to_mtd(spinand);
        struct spi_mem_dirmap_desc *wdesc;
        unsigned int nbytes, column = 0;
        void *buf = spinand->databuf;
@@ -356,7 +356,7 @@ static int spinand_program_op(struct spinand_device *spinand,
 static int spinand_erase_op(struct spinand_device *spinand,
                            const struct nand_pos *pos)
 {
-       struct nand_device *nand = &spinand->base;
+       struct nand_device *nand = spinand_to_nand(spinand);
        unsigned int row = nanddev_pos_to_row(nand, pos);
        struct spi_mem_op op = SPINAND_BLK_ERASE_OP(row);