@@ -551,7 +551,7 @@ int mtd_add_partition(struct mtd_info *master, const char *name,
long long offset, long long length)
{
struct mtd_partition part;
- struct mtd_part *p, *new;
+ struct mtd_part *new;
uint64_t start, end;
int ret = 0;
@@ -586,27 +586,12 @@ int mtd_add_partition(struct mtd_info *master, const char *name,
end = offset + length;
mutex_lock(&mtd_partitions_mutex);
- list_for_each_entry(p, &mtd_partitions, list)
- if (p->master == master) {
- if ((start >= p->offset) &&
- (start < (p->offset + p->mtd.size)))
- goto err_inv;
-
- if ((end >= p->offset) &&
- (end < (p->offset + p->mtd.size)))
- goto err_inv;
- }
-
list_add(&new->list, &mtd_partitions);
mutex_unlock(&mtd_partitions_mutex);
add_mtd_device(&new->mtd);
return ret;
-err_inv:
- mutex_unlock(&mtd_partitions_mutex);
- free_partition(new);
- return -EINVAL;
}
EXPORT_SYMBOL_GPL(mtd_add_partition);
This patch makes MTD dynamic partitioning more flexible by removing overlap checks for dynamic partitions. I don't see any particular reason why overlapping dynamic partitions should be prohibited while static partitions are allowed to overlap freely, and this is useful for users who want one additional partition to span over the whole device. Signed-off-by: Dan Ehrenberg <dehrenberg@chromium.org> --- drivers/mtd/mtdpart.c | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-)