mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] mci: only count partitions from partition table
@ 2025-04-30 12:10 Michael Tretter
  2025-04-30 12:25 ` Ahmad Fatoum
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Tretter @ 2025-04-30 12:10 UTC (permalink / raw)
  To: barebox; +Cc: Michael Tretter

Linux is only aware of partitions in the partition table, but the list
of partitions in barebox may contain additional partitions, e.g., for
state or the environment.

Ignore partitions that are not in the partition table when calculating
the index of the partition in Linux.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
---
 drivers/mci/mci-core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
index c4830a47a5f4..592543faa7b8 100644
--- a/drivers/mci/mci-core.c
+++ b/drivers/mci/mci-core.c
@@ -2550,7 +2550,8 @@ static char *mci_get_linux_mmcblkdev(struct block_device *blk,
 		 */
 		if (cdev_partname_equal(partcdev, cdev))
 			return basprintf("root=/dev/mmcblk%dp%d", id, partnum);
-		partnum++;
+		if (cdev->flags & DEVFS_PARTITION_FROM_TABLE)
+			partnum++;
 	}
 
 	return NULL;
-- 
2.39.5




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

* Re: [PATCH] mci: only count partitions from partition table
  2025-04-30 12:10 [PATCH] mci: only count partitions from partition table Michael Tretter
@ 2025-04-30 12:25 ` Ahmad Fatoum
  0 siblings, 0 replies; 2+ messages in thread
From: Ahmad Fatoum @ 2025-04-30 12:25 UTC (permalink / raw)
  To: Michael Tretter, barebox

Hello Michael.

On 4/30/25 14:10, Michael Tretter wrote:
> Linux is only aware of partitions in the partition table, but the list
> of partitions in barebox may contain additional partitions, e.g., for
> state or the environment.
> 
> Ignore partitions that are not in the partition table when calculating
> the index of the partition in Linux.

Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>

I have patches to store partition table index directly into the cdev,
but your patch is more suitable for backporting to master.

Thanks,
Ahmad

> 
> Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
> ---
>  drivers/mci/mci-core.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
> index c4830a47a5f4..592543faa7b8 100644
> --- a/drivers/mci/mci-core.c
> +++ b/drivers/mci/mci-core.c
> @@ -2550,7 +2550,8 @@ static char *mci_get_linux_mmcblkdev(struct block_device *blk,
>  		 */
>  		if (cdev_partname_equal(partcdev, cdev))
>  			return basprintf("root=/dev/mmcblk%dp%d", id, partnum);
> -		partnum++;
> +		if (cdev->flags & DEVFS_PARTITION_FROM_TABLE)
> +			partnum++;
>  	}
>  
>  	return NULL;

-- 
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 |




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

end of thread, other threads:[~2025-04-30 12:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-30 12:10 [PATCH] mci: only count partitions from partition table Michael Tretter
2025-04-30 12:25 ` Ahmad Fatoum

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