Later code will make it possible to define a on-disk-described partition
in the DT as well. For this reason, we can't assumed
DEVFS_PARTITION_FROM_TABLE to mean !DT, so let's add a dedicated flag
for that.

Signed-off-by: Ahmad Fatoum <[email protected]>
---
 drivers/of/partition.c | 5 +++--
 fs/fs.c                | 2 ++
 include/driver.h       | 5 +++--
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/of/partition.c b/drivers/of/partition.c
index a70e503cec9e..15943502ce17 100644
--- a/drivers/of/partition.c
+++ b/drivers/of/partition.c
@@ -74,6 +74,7 @@ struct cdev *of_parse_partition(struct cdev *cdev, struct 
device_node *node)
        }
 
        new->device_node = node;
+       new->flags |= DEVFS_PARTITION_FROM_OF;
 
        if (IS_ENABLED(CONFIG_NVMEM) && of_device_is_compatible(node, 
"nvmem-cells")) {
                struct nvmem_device *nvmem = nvmem_partition_register(new);
@@ -162,7 +163,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_TABLE)
+               if (!(partcdev->flags & DEVFS_PARTITION_FROM_OF))
                        continue;
                n_parts++;
        }
@@ -213,7 +214,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_TABLE)
+               if (!(partcdev->flags & DEVFS_PARTITION_FROM_OF))
                        continue;
 
                if (partcdev->mtd)
diff --git a/fs/fs.c b/fs/fs.c
index 1820e48393af..9d8aab268ca4 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -88,6 +88,8 @@ void cdev_print(const struct cdev *cdev)
                        printf(" fixed-partition");
                if (cdev->flags & DEVFS_PARTITION_READONLY)
                        printf(" readonly-partition");
+               if (cdev->flags & DEVFS_PARTITION_FROM_OF)
+                       printf(" of-partition");
                if (cdev->flags & DEVFS_PARTITION_FROM_TABLE)
                        printf(" table-partition");
                if (cdev->flags & DEVFS_IS_MCI_MAIN_PART_DEV)
diff --git a/include/driver.h b/include/driver.h
index 42e513a15603..118d2adb6750 100644
--- a/include/driver.h
+++ b/include/driver.h
@@ -584,8 +584,9 @@ extern struct list_head cdev_list;
 #define DEVFS_PARTITION_FIXED          (1U << 0)
 #define DEVFS_PARTITION_READONLY       (1U << 1)
 #define DEVFS_IS_CHARACTER_DEV         (1U << 3)
-#define DEVFS_PARTITION_FROM_TABLE     (1U << 4)
-#define DEVFS_IS_MCI_MAIN_PART_DEV     (1U << 5)
+#define DEVFS_IS_MCI_MAIN_PART_DEV     (1U << 4)
+#define DEVFS_PARTITION_FROM_OF                (1U << 5)
+#define DEVFS_PARTITION_FROM_TABLE     (1U << 6)
 
 struct cdev *devfs_add_partition(const char *devname, loff_t offset,
                loff_t size, unsigned int flags, const char *name);
-- 
2.39.2


Reply via email to