[PATCH] mci: only count partitions from partition table

Ahmad Fatoum a.fatoum at pengutronix.de
Wed Apr 30 05:25:26 PDT 2025


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




More information about the barebox mailing list