mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] of: partition: Also add partitions created by addpart to the boot dtb
@ 2024-03-12 10:09 Uwe Kleine-König
  2024-03-13  6:34 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Uwe Kleine-König @ 2024-03-12 10:09 UTC (permalink / raw)
  To: barebox

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 <u.kleine-koenig@pengutronix.de>
---
 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




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] of: partition: Also add partitions created by addpart to the boot dtb
  2024-03-12 10:09 [PATCH] of: partition: Also add partitions created by addpart to the boot dtb Uwe Kleine-König
@ 2024-03-13  6:34 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2024-03-13  6:34 UTC (permalink / raw)
  To: barebox, Uwe Kleine-König


On Tue, 12 Mar 2024 11:09:08 +0100, Uwe Kleine-König wrote:
> 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).
> 
> [...]

Applied, thanks!

[1/1] of: partition: Also add partitions created by addpart to the boot dtb
      https://git.pengutronix.de/cgit/barebox/commit/?id=f6589670eb73 (link may not be stable)

Best regards,
-- 
Sascha Hauer <s.hauer@pengutronix.de>




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-03-13  6:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-12 10:09 [PATCH] of: partition: Also add partitions created by addpart to the boot dtb Uwe Kleine-König
2024-03-13  6:34 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox