]> git.sur5r.net Git - u-boot/blobdiff - fs/yaffs2/yaffs_uboot_glue.c
treewide: replace with error() with pr_err()
[u-boot] / fs / yaffs2 / yaffs_uboot_glue.c
index 50000a135b54f229e4aa914939ab6c554bdab0c4..2a70e4a543e0b9e8608c6e6fd803988ac3af3a3e 100644 (file)
@@ -141,8 +141,6 @@ static const char *yaffs_error_str(void)
        }
 }
 
-extern nand_info_t nand_info[];
-
 void cmd_yaffs_tracemask(unsigned set, unsigned mask)
 {
        if (set)
@@ -168,11 +166,15 @@ void cmd_yaffs_devconfig(char *_mp, int flash_dev,
        char *mp = NULL;
        struct nand_chip *chip;
 
+       mtd = get_nand_dev_by_index(flash_dev);
+       if (!mtd) {
+               pr_err("\nno NAND devices available\n");
+               return;
+       }
+
        dev = calloc(1, sizeof(*dev));
        mp = strdup(_mp);
 
-       mtd = &nand_info[flash_dev];
-
        if (!dev || !mp) {
                /* Alloc error */
                printf("Failed to allocate memory\n");
@@ -192,7 +194,7 @@ void cmd_yaffs_devconfig(char *_mp, int flash_dev,
                goto err;
        }
 
-       chip =  mtd->priv;
+       chip =  mtd_to_nand(mtd);
 
        /* Check for any conflicts */
        yaffs_dev_rewind();
@@ -260,9 +262,7 @@ void cmd_yaffs_dev_ls(void)
                dev = yaffs_next_dev();
                if (!dev)
                        return;
-               flash_dev =
-                       ((unsigned) dev->driver_context - (unsigned) nand_info)/
-                               sizeof(nand_info[0]);
+               flash_dev = nand_mtd_to_devnum(dev->driver_context);
                printf("%-10s %5d 0x%05x 0x%05x %s",
                        dev->param.name, flash_dev,
                        dev->param.start_block, dev->param.end_block,
@@ -324,7 +324,7 @@ void read_a_file(char *fn)
                i++;
                if (i > 32) {
                        printf("\n");
-                       i = 0;;
+                       i = 0;
                }
        }
        printf("\n");