A partition added interactively using addpart was added in
of_partition_fixup() before commit aec676b568 ("cdev: record whether
partition is parsed from OF").

Restore that behaviour. To do that a new flag DEVFS_PARTITION_FOR_FIXUP
is created that behaves very similar what DEVFS_PARTITION_FROM_OF did
before. The only difference is that addpart makes use of it (and that
stat uses a different string to describe it).

Signed-off-by: Uwe Kleine-König <[email protected]>
---
 drivers/of/partition.c | 6 +++---
 fs/fs.c                | 2 ++
 include/driver.h       | 5 +++--
 lib/cmdlinepart.c      | 2 +-
 4 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/of/partition.c b/drivers/of/partition.c
index 7c9f443ee7..abfa99820d 100644
--- a/drivers/of/partition.c
+++ b/drivers/of/partition.c
@@ -74,7 +74,7 @@ struct cdev *of_parse_partition(struct cdev *cdev, struct 
device_node *node)
        }
 
        new->device_node = node;
-       new->flags |= DEVFS_PARTITION_FROM_OF;
+       new->flags |= DEVFS_PARTITION_FROM_OF | DEVFS_PARTITION_FOR_FIXUP;
 
        if (IS_ENABLED(CONFIG_NVMEM) && of_device_is_compatible(node, 
"nvmem-cells")) {
                struct nvmem_device *nvmem = nvmem_partition_register(new);
@@ -178,7 +178,7 @@ int of_fixup_partitions(struct device_node *np, struct cdev 
*cdev)
                return 0;
 
        list_for_each_entry(partcdev, &cdev->partitions, partition_entry) {
-               if (!(partcdev->flags & DEVFS_PARTITION_FROM_OF))
+               if (!(partcdev->flags & DEVFS_PARTITION_FOR_FIXUP))
                        continue;
                n_parts++;
        }
@@ -229,7 +229,7 @@ int of_fixup_partitions(struct device_node *np, struct cdev 
*cdev)
                u8 tmp[16 * 16]; /* Up to 64-bit address + 64-bit size */
                loff_t partoffset;
 
-               if (!(partcdev->flags & DEVFS_PARTITION_FROM_OF))
+               if (!(partcdev->flags & DEVFS_PARTITION_FOR_FIXUP))
                        continue;
 
                if (partcdev->mtd)
diff --git a/fs/fs.c b/fs/fs.c
index 68e7873e9c..9812549b9b 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -92,6 +92,8 @@ void cdev_print(const struct cdev *cdev)
                        printf(" of-partition");
                if (cdev->flags & DEVFS_PARTITION_FROM_TABLE)
                        printf(" table-partition");
+               if (cdev->flags & DEVFS_PARTITION_FOR_FIXUP)
+                       printf(" fixup");
                if (cdev->flags & DEVFS_IS_MCI_MAIN_PART_DEV)
                        printf(" mci-main-partition");
                if (cdev->flags & DEVFS_IS_MBR_PARTITIONED)
diff --git a/include/driver.h b/include/driver.h
index b7c950620b..48b18a0ae6 100644
--- a/include/driver.h
+++ b/include/driver.h
@@ -624,8 +624,9 @@ extern struct list_head cdev_list;
 #define DEVFS_IS_MCI_MAIN_PART_DEV     (1U << 4)
 #define DEVFS_PARTITION_FROM_OF                (1U << 5)
 #define DEVFS_PARTITION_FROM_TABLE     (1U << 6)
-#define DEVFS_IS_MBR_PARTITIONED       (1U << 7)
-#define DEVFS_IS_GPT_PARTITIONED       (1U << 8)
+#define DEVFS_PARTITION_FOR_FIXUP      (1U << 7)
+#define DEVFS_IS_MBR_PARTITIONED       (1U << 8)
+#define DEVFS_IS_GPT_PARTITIONED       (1U << 9)
 
 static inline bool cdev_is_mbr_partitioned(const struct cdev *master)
 {
diff --git a/lib/cmdlinepart.c b/lib/cmdlinepart.c
index 5e95760bae..f1bfda641c 100644
--- a/lib/cmdlinepart.c
+++ b/lib/cmdlinepart.c
@@ -29,7 +29,7 @@ int cmdlinepart_do_parse_one(const char *devname, const char 
*partstr,
        loff_t size;
        char *end;
        char buf[PATH_MAX] = {};
-       unsigned long flags = 0;
+       unsigned long flags = DEVFS_PARTITION_FOR_FIXUP;
        struct cdev *cdev;
 
        memset(buf, 0, PATH_MAX);
-- 
2.39.2


Reply via email to