generic/3.10: reduce number of ifdefs in the rootfs split code
authorGabor Juhos <juhosg@openwrt.org>
Sat, 14 Sep 2013 10:19:09 +0000 (10:19 +0000)
committerGabor Juhos <juhosg@openwrt.org>
Sat, 14 Sep 2013 10:19:09 +0000 (10:19 +0000)
Use the config_enabled() macro where it is possible.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
SVN-Revision: 37980

target/linux/generic/patches-3.10/400-mtd-add-rootfs-split-support.patch

index 4cacf641d8eb1822ce5826a020410406db68f370..d2330ccf8c2aae6d64c206d83e4ba432618bb5b0 100644 (file)
 +      return len;
 +}
 +
-+#ifdef CONFIG_MTD_ROOTFS_SPLIT
 +#define ROOTFS_SPLIT_NAME "rootfs_data"
 +#define ROOTFS_REMOVED_NAME "<removed>"
 +
 +      __mtd_add_partition(master, ROOTFS_SPLIT_NAME, split_offset,
 +                          split_size, false);
 +}
-+#endif /* CONFIG_MTD_ROOTFS_SPLIT */
 +
-+#ifdef CONFIG_MTD_UIMAGE_SPLIT
 +#define UBOOT_MAGIC   0x27051956
 +
++#ifdef CONFIG_MTD_UIMAGE_SPLIT_NAME
++#define UIMAGE_SPLIT_NAME     CONFIG_MTD_UIMAGE_SPLIT_NAME
++#else
++#define UIMAGE_SPLIT_NAME     "unused"
++#endif
++
 +static void split_uimage(struct mtd_info *master, struct mtd_part *part)
 +{
 +      struct {
 +      } hdr;
 +      size_t len;
 +
-+      if (strcmp(part->mtd.name, CONFIG_MTD_UIMAGE_SPLIT_NAME) != 0)
++      if (strcmp(part->mtd.name, UIMAGE_SPLIT_NAME) != 0)
 +              return;
 +
 +      if (mtd_read(master, part->offset, sizeof(hdr), &len, (void *) &hdr))
 +      __mtd_add_partition(master, "rootfs", part->offset + len,
 +                          part->mtd.size - len, false);
 +}
-+#endif
 +
 +void __weak arch_split_mtd_part(struct mtd_info *master, const char *name,
 +                                int offset, int size)
 +      if (!strcmp(part->mtd.name, "rootfs")) {
 +              rootfs_found = 1;
 +
-+#ifdef CONFIG_MTD_ROOTFS_ROOT_DEV
-+              if (ROOT_DEV == 0) {
++              if (config_enabled(CONFIG_MTD_ROOTFS_ROOT_DEV) &&
++                  ROOT_DEV == 0) {
 +                      printk(KERN_NOTICE "mtd: partition \"rootfs\" "
 +                              "set to be root filesystem\n");
 +                      ROOT_DEV = MKDEV(MTD_BLOCK_MAJOR, part->mtd.index);
 +              }
-+#endif
-+#ifdef CONFIG_MTD_ROOTFS_SPLIT
-+              split_rootfs_data(master, part);
-+#endif
++
++              if (config_enabled(CONFIG_MTD_ROOTFS_SPLIT))
++                      split_rootfs_data(master, part);
 +      }
 +
-+#ifdef CONFIG_MTD_UIMAGE_SPLIT
-+      split_uimage(master, part);
-+#endif
++      if (config_enabled(CONFIG_MTD_UIMAGE_SPLIT))
++              split_uimage(master, part);
 +
 +      arch_split_mtd_part(master, part->mtd.name, part->offset,
 +                          part->mtd.size);