]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
MTD: Fix problem based on non-working relocation (list head mtd_partitions)
authorStefan Roese <sr@denx.de>
Thu, 27 Nov 2008 13:05:15 +0000 (14:05 +0100)
committerStefan Roese <sr@denx.de>
Tue, 9 Dec 2008 09:07:23 +0000 (10:07 +0100)
Don't use LIST_HEAD() but initialize the struct via INIT_LIST_HEAD() upon
first call of add_mtd_partitions(). Otherwise this won't work on platforms
where the relocation is broken (like MIPS or PPC).

Signed-off-by: Stefan Roese <sr@denx.de>
drivers/mtd/mtdpart.c

index 9a3bf6f39d236107b19afb68bc0c8822aa08aa55..f010f5e3ac5cdf1363093608eab9e61c4e3ccd40 100644 (file)
@@ -20,7 +20,7 @@
 #include <linux/mtd/compat.h>
 
 /* Our partition linked list */
-static LIST_HEAD(mtd_partitions);
+struct list_head mtd_partitions;
 
 /* Our partition node structure */
 struct mtd_part {
@@ -349,6 +349,14 @@ int add_mtd_partitions(struct mtd_info *master,
        u_int32_t cur_offset = 0;
        int i;
 
+       /*
+        * Need to init the list here, since LIST_INIT() does not
+        * work on platforms where relocation has problems (like MIPS
+        * & PPC).
+        */
+       if (mtd_partitions.next == NULL)
+               INIT_LIST_HEAD(&mtd_partitions);
+
        printk (KERN_NOTICE "Creating %d MTD partitions on \"%s\":\n", nbparts, master->name);
 
        for (i = 0; i < nbparts; i++) {