Merge tag 'r8169-20060920-00' of git://electric-eye.fr.zoreil.com/home/romieu/linux...
[sfrench/cifs-2.6.git] / drivers / mtd / mtdcore.c
index 16a952dd486a90277580d0eb30493a7bb5fda458..c4d26de74349e55f9ae32269ff780b0dde50e767 100644 (file)
@@ -6,7 +6,6 @@
  *
  */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
@@ -58,6 +57,16 @@ int add_mtd_device(struct mtd_info *mtd)
                        mtd->index = i;
                        mtd->usecount = 0;
 
+                       /* Some chips always power up locked. Unlock them now */
+                       if ((mtd->flags & MTD_WRITEABLE)
+                           && (mtd->flags & MTD_STUPID_LOCK) && mtd->unlock) {
+                               if (mtd->unlock(mtd, 0, mtd->size))
+                                       printk(KERN_WARNING
+                                              "%s: unlock failed, "
+                                              "writes may not work\n",
+                                              mtd->name);
+                       }
+
                        DEBUG(0, "mtd: Giving out device %d to %s\n",i, mtd->name);
                        /* No need to get a refcount on the module containing
                           the notifier, since we hold the mtd_table_mutex */