mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH] of: partition: Also add partitions created by addpart to the boot dtb
Date: Tue, 12 Mar 2024 11:09:08 +0100	[thread overview]
Message-ID: <20240312100918.604105-1-u.kleine-koenig@pengutronix.de> (raw)

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




             reply	other threads:[~2024-03-12 10:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-12 10:09 Uwe Kleine-König [this message]
2024-03-13  6:34 ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240312100918.604105-1-u.kleine-koenig@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox