]> Pileus Git - ~andy/linux/blobdiff - drivers/mtd/inftlmount.c
mtd: introduce mtd_unpoint interface
[~andy/linux] / drivers / mtd / inftlmount.c
index d969c2d5d62b121d3c9108dd27b52b6c25371e05..0d946f10a682f1b9123c8b25e9834bd9251b638d 100644 (file)
@@ -139,24 +139,20 @@ static int find_boot_record(struct INFTLrecord *inftl)
                mh->FormatFlags = le32_to_cpu(mh->FormatFlags);
                mh->PercentUsed = le32_to_cpu(mh->PercentUsed);
 
-#ifdef CONFIG_MTD_DEBUG_VERBOSE
-               if (CONFIG_MTD_DEBUG_VERBOSE >= 2) {
-                       printk("INFTL: Media Header ->\n"
-                               "    bootRecordID          = %s\n"
-                               "    NoOfBootImageBlocks   = %d\n"
-                               "    NoOfBinaryPartitions  = %d\n"
-                               "    NoOfBDTLPartitions    = %d\n"
-                               "    BlockMultiplerBits    = %d\n"
-                               "    FormatFlgs            = %d\n"
-                               "    OsakVersion           = 0x%x\n"
-                               "    PercentUsed           = %d\n",
-                               mh->bootRecordID, mh->NoOfBootImageBlocks,
-                               mh->NoOfBinaryPartitions,
-                               mh->NoOfBDTLPartitions,
-                               mh->BlockMultiplierBits, mh->FormatFlags,
-                               mh->OsakVersion, mh->PercentUsed);
-               }
-#endif
+               pr_debug("INFTL: Media Header ->\n"
+                        "    bootRecordID          = %s\n"
+                        "    NoOfBootImageBlocks   = %d\n"
+                        "    NoOfBinaryPartitions  = %d\n"
+                        "    NoOfBDTLPartitions    = %d\n"
+                        "    BlockMultiplerBits    = %d\n"
+                        "    FormatFlgs            = %d\n"
+                        "    OsakVersion           = 0x%x\n"
+                        "    PercentUsed           = %d\n",
+                        mh->bootRecordID, mh->NoOfBootImageBlocks,
+                        mh->NoOfBinaryPartitions,
+                        mh->NoOfBDTLPartitions,
+                        mh->BlockMultiplierBits, mh->FormatFlags,
+                        mh->OsakVersion, mh->PercentUsed);
 
                if (mh->NoOfBDTLPartitions == 0) {
                        printk(KERN_WARNING "INFTL: Media Header sanity check "
@@ -200,19 +196,15 @@ static int find_boot_record(struct INFTLrecord *inftl)
                        ip->spareUnits = le32_to_cpu(ip->spareUnits);
                        ip->Reserved0 = le32_to_cpu(ip->Reserved0);
 
-#ifdef CONFIG_MTD_DEBUG_VERBOSE
-                       if (CONFIG_MTD_DEBUG_VERBOSE >= 2) {
-                               printk("    PARTITION[%d] ->\n"
-                                       "        virtualUnits    = %d\n"
-                                       "        firstUnit       = %d\n"
-                                       "        lastUnit        = %d\n"
-                                       "        flags           = 0x%x\n"
-                                       "        spareUnits      = %d\n",
-                                       i, ip->virtualUnits, ip->firstUnit,
-                                       ip->lastUnit, ip->flags,
-                                       ip->spareUnits);
-                       }
-#endif
+                       pr_debug("    PARTITION[%d] ->\n"
+                                "        virtualUnits    = %d\n"
+                                "        firstUnit       = %d\n"
+                                "        lastUnit        = %d\n"
+                                "        flags           = 0x%x\n"
+                                "        spareUnits      = %d\n",
+                                i, ip->virtualUnits, ip->firstUnit,
+                                ip->lastUnit, ip->flags,
+                                ip->spareUnits);
 
                        if (ip->Reserved0 != ip->firstUnit) {
                                struct erase_info *instr = &inftl->instr;
@@ -228,7 +220,7 @@ static int find_boot_record(struct INFTLrecord *inftl)
                                 */
                                instr->addr = ip->Reserved0 * inftl->EraseSize;
                                instr->len = inftl->EraseSize;
-                               mtd->erase(mtd, instr);
+                               mtd_erase(mtd, instr);
                        }
                        if ((ip->lastUnit - ip->firstUnit + 1) < ip->virtualUnits) {
                                printk(KERN_WARNING "INFTL: Media Header "
@@ -375,7 +367,7 @@ static int check_free_sectors(struct INFTLrecord *inftl, unsigned int address,
  *
  * Return: 0 when succeed, -1 on error.
  *
- * ToDo: 1. Is it neceressary to check_free_sector after erasing ??
+ * ToDo: 1. Is it necessary to check_free_sector after erasing ??
  */
 int INFTL_formatblock(struct INFTLrecord *inftl, int block)
 {
@@ -385,8 +377,7 @@ int INFTL_formatblock(struct INFTLrecord *inftl, int block)
        struct mtd_info *mtd = inftl->mbd.mtd;
        int physblock;
 
-       pr_debug("INFTL: INFTL_formatblock(inftl=%p,"
-               "block=%d)\n", inftl, block);
+       pr_debug("INFTL: INFTL_formatblock(inftl=%p,block=%d)\n", inftl, block);
 
        memset(instr, 0, sizeof(struct erase_info));
 
@@ -402,7 +393,7 @@ int INFTL_formatblock(struct INFTLrecord *inftl, int block)
           mark only the failed block in the bbt. */
        for (physblock = 0; physblock < inftl->EraseSize;
             physblock += instr->len, instr->addr += instr->len) {
-               mtd->erase(inftl->mbd.mtd, instr);
+               mtd_erase(inftl->mbd.mtd, instr);
 
                if (instr->state == MTD_ERASE_FAILED) {
                        printk(KERN_WARNING "INFTL: error while formatting block %d\n",
@@ -476,30 +467,30 @@ void INFTL_dumptables(struct INFTLrecord *s)
 {
        int i;
 
-       printk("-------------------------------------------"
+       pr_debug("-------------------------------------------"
                "----------------------------------\n");
 
-       printk("VUtable[%d] ->", s->nb_blocks);
+       pr_debug("VUtable[%d] ->", s->nb_blocks);
        for (i = 0; i < s->nb_blocks; i++) {
                if ((i % 8) == 0)
-                       printk("\n%04x: ", i);
-               printk("%04x ", s->VUtable[i]);
+                       pr_debug("\n%04x: ", i);
+               pr_debug("%04x ", s->VUtable[i]);
        }
 
-       printk("\n-------------------------------------------"
+       pr_debug("\n-------------------------------------------"
                "----------------------------------\n");
 
-       printk("PUtable[%d-%d=%d] ->", s->firstEUN, s->lastEUN, s->nb_blocks);
+       pr_debug("PUtable[%d-%d=%d] ->", s->firstEUN, s->lastEUN, s->nb_blocks);
        for (i = 0; i <= s->lastEUN; i++) {
                if ((i % 8) == 0)
-                       printk("\n%04x: ", i);
-               printk("%04x ", s->PUtable[i]);
+                       pr_debug("\n%04x: ", i);
+               pr_debug("%04x ", s->PUtable[i]);
        }
 
-       printk("\n-------------------------------------------"
+       pr_debug("\n-------------------------------------------"
                "----------------------------------\n");
 
-       printk("INFTL ->\n"
+       pr_debug("INFTL ->\n"
                "  EraseSize       = %d\n"
                "  h/s/c           = %d/%d/%d\n"
                "  numvunits       = %d\n"
@@ -513,7 +504,7 @@ void INFTL_dumptables(struct INFTLrecord *s)
                s->numvunits, s->firstEUN, s->lastEUN, s->numfreeEUNs,
                s->LastFreeEUN, s->nb_blocks, s->nb_boot_blocks);
 
-       printk("\n-------------------------------------------"
+       pr_debug("\n-------------------------------------------"
                "----------------------------------\n");
 }
 
@@ -521,25 +512,25 @@ void INFTL_dumpVUchains(struct INFTLrecord *s)
 {
        int logical, block, i;
 
-       printk("-------------------------------------------"
+       pr_debug("-------------------------------------------"
                "----------------------------------\n");
 
-       printk("INFTL Virtual Unit Chains:\n");
+       pr_debug("INFTL Virtual Unit Chains:\n");
        for (logical = 0; logical < s->nb_blocks; logical++) {
                block = s->VUtable[logical];
                if (block > s->nb_blocks)
                        continue;
-               printk("  LOGICAL %d --> %d ", logical, block);
+               pr_debug("  LOGICAL %d --> %d ", logical, block);
                for (i = 0; i < s->nb_blocks; i++) {
                        if (s->PUtable[block] == BLOCK_NIL)
                                break;
                        block = s->PUtable[block];
-                       printk("%d ", block);
+                       pr_debug("%d ", block);
                }
-               printk("\n");
+               pr_debug("\n");
        }
 
-       printk("-------------------------------------------"
+       pr_debug("-------------------------------------------"
                "----------------------------------\n");
 }
 
@@ -717,10 +708,7 @@ int INFTL_mount(struct INFTLrecord *s)
                logical_block = BLOCK_NIL;
        }
 
-#ifdef CONFIG_MTD_DEBUG_VERBOSE
-       if (CONFIG_MTD_DEBUG_VERBOSE >= 2)
-               INFTL_dumptables(s);
-#endif
+       INFTL_dumptables(s);
 
        /*
         * Second pass, check for infinite loops in chains. These are
@@ -772,12 +760,8 @@ int INFTL_mount(struct INFTLrecord *s)
                }
        }
 
-#ifdef CONFIG_MTD_DEBUG_VERBOSE
-       if (CONFIG_MTD_DEBUG_VERBOSE >= 2)
-               INFTL_dumptables(s);
-       if (CONFIG_MTD_DEBUG_VERBOSE >= 2)
-               INFTL_dumpVUchains(s);
-#endif
+       INFTL_dumptables(s);
+       INFTL_dumpVUchains(s);
 
        /*
         * Third pass, format unreferenced blocks and init free block count.