Miquel Raynal <miquel.raynal@xxxxxxxxxxx> wrote on Tue, 14 Jan 2020 10:09:52 +0100: > Instead of collecting partitions in a flat list, create a hierarchy > within the mtd_info structure: use a partitions list to keep track of > the partitions of an MTD device (which might be itself a partition of > another MTD device), a pointer to the parent device (NULL when the MTD > device is the root one, not a partition). > > By also saving directly in mtd_info the offset of the partition, we > can get rid of the mtd_part structure. > > While at it, be consistent in the naming of the mtd_info structures to > ease the understanding of the new hierarchy: these structures are > usually called 'mtd', unless there are multiple instances of the same > structure. In this case, there is usually a parent/child bound so we > will call them 'parent' and 'child'. > > Signed-off-by: Miquel Raynal <miquel.raynal@xxxxxxxxxxx> > --- Applied to mtd/next. > > Change in v3: > * Keep the naming for the ->parent field but add more details in the > mtd_master structure kernel documentation and the ->parent field of > struct mtd_info that this parenting is from an MTD partition point > of view, not from the device model perspective. > > Changes in v2: > * Commit name changed "proper partition handling" -> "rework partition > tree". > * Update mtd_get_device_size() to support recursive partitioning. > * Remove part_*() helpers, update the corresponding mtd_*() helpers to > handle the partitions themselves. > * Drop the global partitions lock, add a lock per mtd_info but only use > the root one to protect against partitions updates. > > drivers/mtd/mtdchar.c | 12 +- > drivers/mtd/mtdcore.c | 250 ++++++++---- > drivers/mtd/mtdpart.c | 697 +++++++++------------------------ > include/linux/mtd/mtd.h | 125 +++++- > include/linux/mtd/partitions.h | 1 - > 5 files changed, 479 insertions(+), 606 deletions(-) Thanks, Miquèl ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/