mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: "Ahmad Fatoum" <a.fatoum@pengutronix.de>,
	"Uwe Kleine-König" <uwe@kleine-koenig.org>,
	barebox@lists.infradead.org
Subject: Re: [PATCH 2/2] of: partition: Use mtd partitioning for of_fixup instead of the cdev variant
Date: Fri, 8 Mar 2024 11:51:20 +0100	[thread overview]
Message-ID: <ZertqFHxingnr6kd@pengutronix.de> (raw)
In-Reply-To: <brq6pmetsgbghlfxfqcyxe3dslsjntd22wfme2mg7fjrr7satz@2we7kevot4fc>

On Fri, Mar 08, 2024 at 11:14:28AM +0100, Uwe Kleine-König wrote:
> Hello,
> 
> On Fri, Mar 08, 2024 at 10:27:21AM +0100, Ahmad Fatoum wrote:
> > On 08.03.24 10:15, Uwe Kleine-König wrote:
> > > From: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> > > 
> > > It was already noticed in commit 9d42c77f126e ("devfs: take into account
> > > for the partitions check that mtd is different") that the partitioning
> > > info is stored differently for mtd devices. Instead of only getting the
> > > partion size from the right spot, use the right data completely.
> > 
> > I read both this commit message and that of the referenced commit and I
> > don't quite understand what the issue is. Could you add a short sentence
> > about what particular issue this fix addresses?
> 
> The situation fixed here is:
> 
> After bootup the partitioning information for mtd devices exists in both
> locations (cdev->partitions and cdev->mtd->partitions). An interactive
> addpart only adds the the latter. This patch fixes the of fixup to also
> use the latter.

I don't think this is true. Looking at __devfs_add_partition() we have:

	if (IS_ENABLED(CONFIG_MTD) && cdev->mtd) {
		struct mtd_info *mtd;

		mtd = mtd_add_partition(cdev->mtd, offset, size,
				partinfo->flags, partinfo->name);
		if (IS_ERR(mtd))
			return (void *)mtd;

		list_add_tail(&mtd->cdev.partition_entry, &cdev->partitions);
		return &mtd->cdev;
	}

	...

	list_add_tail(&new->partition_entry, &cdev->partitions);

So all partitions end up in the &cdev->partitions list.

of_fixup_partitions() currently iterates over &cdev->partitions, but it
has:

	if (!(partcdev->flags & DEVFS_PARTITION_FROM_OF))
		continue;

And I think this is your problem. The newly created partition is ignored
during fixup because it doesn't have the DEVFS_PARTITION_FROM_OF flag
set. What you do is a complicated way of ignoring this flag in your
additional iteration over &cdev->partitions.

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



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

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-08  9:15 [PATCH 1/2] of: partition: Move some parts of of_fixup_partitions() into separate function Uwe Kleine-König
2024-03-08  9:15 ` [PATCH 2/2] of: partition: Use mtd partitioning for of_fixup instead of the cdev variant Uwe Kleine-König
2024-03-08  9:27   ` Ahmad Fatoum
2024-03-08 10:14     ` Uwe Kleine-König
2024-03-08 10:51       ` Sascha Hauer [this message]

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=ZertqFHxingnr6kd@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=u.kleine-koenig@pengutronix.de \
    --cc=uwe@kleine-koenig.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