* [PATCH] cdev: fix mtd partition handling
@ 2025-08-05 7:25 Sascha Hauer
2025-08-05 13:14 ` Stefano Manni
2025-08-06 4:56 ` Sascha Hauer
0 siblings, 2 replies; 3+ messages in thread
From: Sascha Hauer @ 2025-08-05 7:25 UTC (permalink / raw)
To: Barebox List; +Cc: Ahmad Fatoum, Stefano Manni
devfs-core.c implements the partition handling only for devices that are
not MTD devices. MTD devices have their own partition handling in
drivers/mtd/partition.c, see the special case in __devfs_add_partition()
for MTD devices. This means for MTD devices we have to pass the original
cdev to the ops, not the master cdev.
Fixes: 6d2b6f399c07 ("cdev: pass master cdev to cdev ops")
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
fs/devfs-core.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/fs/devfs-core.c b/fs/devfs-core.c
index 52490576b7..9c2dae5545 100644
--- a/fs/devfs-core.c
+++ b/fs/devfs-core.c
@@ -226,6 +226,10 @@ int cdev_find_free_index(const char *basename)
static struct cdev *cdev_get_master(struct cdev *cdev)
{
+ /* mtd devices handle partitions themselves */
+ if (cdev->mtd)
+ return cdev;
+
while (cdev && cdev_is_partition(cdev))
cdev = cdev->master;
--
2.39.5
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] cdev: fix mtd partition handling
2025-08-05 7:25 [PATCH] cdev: fix mtd partition handling Sascha Hauer
@ 2025-08-05 13:14 ` Stefano Manni
2025-08-06 4:56 ` Sascha Hauer
1 sibling, 0 replies; 3+ messages in thread
From: Stefano Manni @ 2025-08-05 13:14 UTC (permalink / raw)
To: Sascha Hauer; +Cc: Barebox List, Ahmad Fatoum
On mar, ago 5 2025 at 09:25:37 +02:00:00, Sascha Hauer
<s.hauer@pengutronix.de> wrote:
> devfs-core.c implements the partition handling only for devices that
> are
> not MTD devices. MTD devices have their own partition handling in
> drivers/mtd/partition.c, see the special case in
> __devfs_add_partition()
> for MTD devices. This means for MTD devices we have to pass the
> original
> cdev to the ops, not the master cdev.
>
> Fixes: 6d2b6f399c07 ("cdev: pass master cdev to cdev ops")
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
> fs/devfs-core.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/fs/devfs-core.c b/fs/devfs-core.c
> index 52490576b7..9c2dae5545 100644
> --- a/fs/devfs-core.c
> +++ b/fs/devfs-core.c
> @@ -226,6 +226,10 @@ int cdev_find_free_index(const char *basename)
>
> static struct cdev *cdev_get_master(struct cdev *cdev)
> {
> + /* mtd devices handle partitions themselves */
> + if (cdev->mtd)
> + return cdev;
> +
> while (cdev && cdev_is_partition(cdev))
> cdev = cdev->master;
>
> --
> 2.39.5
>
Tested-by: Stefano Manni <stefano.manni@gmail.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] cdev: fix mtd partition handling
2025-08-05 7:25 [PATCH] cdev: fix mtd partition handling Sascha Hauer
2025-08-05 13:14 ` Stefano Manni
@ 2025-08-06 4:56 ` Sascha Hauer
1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2025-08-06 4:56 UTC (permalink / raw)
To: Barebox List, Sascha Hauer; +Cc: Ahmad Fatoum, Stefano Manni
On Tue, 05 Aug 2025 09:25:37 +0200, Sascha Hauer wrote:
> devfs-core.c implements the partition handling only for devices that are
> not MTD devices. MTD devices have their own partition handling in
> drivers/mtd/partition.c, see the special case in __devfs_add_partition()
> for MTD devices. This means for MTD devices we have to pass the original
> cdev to the ops, not the master cdev.
>
>
> [...]
Applied, thanks!
[1/1] cdev: fix mtd partition handling
https://git.pengutronix.de/cgit/barebox/commit/?id=52aa463c0662 (link may not be stable)
Best regards,
--
Sascha Hauer <s.hauer@pengutronix.de>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-08-06 4:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-08-05 7:25 [PATCH] cdev: fix mtd partition handling Sascha Hauer
2025-08-05 13:14 ` Stefano Manni
2025-08-06 4:56 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox