diff options
author | Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> | 2011-06-06 10:04:14 -0400 |
---|---|---|
committer | Artem Bityutskiy <artem.bityutskiy@intel.com> | 2011-09-11 08:02:04 -0400 |
commit | 1a31368bf92ef2a7da3ba379672c405bd2751df9 (patch) | |
tree | 900ad92a1c8af1bf967ec05623438eb54af9cf80 /drivers/mtd/mtdpart.c | |
parent | bf5140817b2d65faac9b32fc9057a097044ac35b (diff) |
mtd: add a flags for partitions which should just leave smth. after them
Add support for MTDPART_OFS_RETAIN: such partitions start at the current
offset, take as much space as possible, but rain part->size bytes after
the end of the partitions for other parts. Primarily this is intended
for ts72xx arm platforms cleanup.
Artem: tweaked the patch a bit
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'drivers/mtd/mtdpart.c')
-rw-r--r-- | drivers/mtd/mtdpart.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c index 3477e16be1c8..b73720502433 100644 --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c | |||
@@ -479,6 +479,19 @@ static struct mtd_part *allocate_partition(struct mtd_info *master, | |||
479 | (unsigned long long)cur_offset, (unsigned long long)slave->offset); | 479 | (unsigned long long)cur_offset, (unsigned long long)slave->offset); |
480 | } | 480 | } |
481 | } | 481 | } |
482 | if (slave->offset == MTDPART_OFS_RETAIN) { | ||
483 | slave->offset = cur_offset; | ||
484 | if (master->size - slave->offset >= slave->mtd.size) { | ||
485 | slave->mtd.size = master->size - slave->offset | ||
486 | - slave->mtd.size; | ||
487 | } else { | ||
488 | printk(KERN_ERR "mtd partition \"%s\" doesn't have enough space: %#llx < %#llx, disabled\n", | ||
489 | part->name, master->size - slave->offset, | ||
490 | slave->mtd.size); | ||
491 | /* register to preserve ordering */ | ||
492 | goto out_register; | ||
493 | } | ||
494 | } | ||
482 | if (slave->mtd.size == MTDPART_SIZ_FULL) | 495 | if (slave->mtd.size == MTDPART_SIZ_FULL) |
483 | slave->mtd.size = master->size - slave->offset; | 496 | slave->mtd.size = master->size - slave->offset; |
484 | 497 | ||