summaryrefslogtreecommitdiff
path: root/drivers/mtd/mtdpart.c
diff options
context:
space:
mode:
authorDmitry Eremin-Solenikov <dbaryshkov@gmail.com>2011-06-06 18:04:14 +0400
committerArtem Bityutskiy <artem.bityutskiy@intel.com>2011-09-11 15:02:04 +0300
commit1a31368bf92ef2a7da3ba379672c405bd2751df9 (patch)
tree900ad92a1c8af1bf967ec05623438eb54af9cf80 /drivers/mtd/mtdpart.c
parentbf5140817b2d65faac9b32fc9057a097044ac35b (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.c13
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,
(unsigned long long)cur_offset, (unsigned long long)slave->offset);
}
}
+ if (slave->offset == MTDPART_OFS_RETAIN) {
+ slave->offset = cur_offset;
+ if (master->size - slave->offset >= slave->mtd.size) {
+ slave->mtd.size = master->size - slave->offset
+ - slave->mtd.size;
+ } else {
+ printk(KERN_ERR "mtd partition \"%s\" doesn't have enough space: %#llx < %#llx, disabled\n",
+ part->name, master->size - slave->offset,
+ slave->mtd.size);
+ /* register to preserve ordering */
+ goto out_register;
+ }
+ }
if (slave->mtd.size == MTDPART_SIZ_FULL)
slave->mtd.size = master->size - slave->offset;