RE: [PATCH v7 01/12] mtd: core: always create master device
From: Usyskin, Alexander
Date: Mon Apr 07 2025 - 08:48:03 EST
> On 26/03/2025 at 17:26:12 +02, Alexander Usyskin
> <alexander.usyskin@xxxxxxxxx> wrote:
>
> > Create master device without partition when
> > CONFIG_MTD_PARTITIONED_MASTER flag is unset.
> >
> > This streamlines device tree and allows to anchor
> > runtime power management on master device in all cases.
> >
> > Signed-off-by: Alexander Usyskin <alexander.usyskin@xxxxxxxxx>
>
> I successfully tested it, this patch will be applied at -rc1 to the
> mtd/next tree.
>
> I was wondering, do you think it would be possible to keep the creation
> of mtd_master and make it a symbolic link to mtdx when
> MTD_PARTITIONED_MASTER=y or when there is no partition? In short, always
> having mtd_masterx, because I fear at some point we'll have problems
> otherwise :-)
>
> Right now we have:
>
> - Without partition:
> mtd0 (mtd0ro mtdblock0)
> - With partition and MTD_PARTITIONED_MASTER=n
> mtd0 (mtd0ro mtdblock0)
> mtd_master0
> - With partition and MTD_PARTITIONED_MASTER=y
> mtd0 (mtd0ro mtdblock0) [this is the master]
> mtd1 (mtd1ro mtdblock1)
>
> I am suggesting:
> - Without partition:
> mtd0 (mtd0ro mtdblock0)
> mtd_master0 -> link to mtd0
> - With partition and MTD_PARTITIONED_MASTER=n
> mtd0 (mtd0ro mtdblock0)
> mtd_master0
> - With partition and MTD_PARTITIONED_MASTER=y
> mtd0 (mtd0ro mtdblock0) [this is the master]
> mtd1 (mtd1ro mtdblock1)
> mtd_master0 -> link to mtd0
>
> What do you think? Or maybe even always mtd_master in the first place.
>
> Richard, your point of view on this?
>
> Thanks,
> Miquèl
The mtd_master is completely different class to avoid mtd tree disturbances.
It is real kernel device object, I'm not sure how we can do 'link to' magic here.
About MTD_PARTITIONED_MASTER - we can treat it as another partition and
create master device plus whole device partition as it's child with all other
partitions as children of master device.
For unpartitioned device this mean that we create master device and partition
regardless of MTD_PARTITIONED_MASTER flag.
We also can always add master device and add whole device partition as it's child,
while adding real partition as children of this whole device.
This will create three layers of devices and sounds too complicated.
- -
Thanks,
Sasha