kernel: backport upstream mtdpart.c cleanups
Except for renames and line changes the only conflict was in allocate_partition in handling MTD_WRITEABLE. Hopefully it was handled correctly. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
This commit is contained in:
@@ -39,7 +39,7 @@
|
||||
|
||||
/* Our partition linked list */
|
||||
static LIST_HEAD(mtd_partitions);
|
||||
@@ -46,6 +48,8 @@ struct mtd_part {
|
||||
@@ -52,6 +54,8 @@ struct mtd_part {
|
||||
struct list_head list;
|
||||
};
|
||||
|
||||
@@ -48,15 +48,15 @@
|
||||
/*
|
||||
* Given a pointer to the MTD object in the mtd_part structure, we can retrieve
|
||||
* the pointer to that structure.
|
||||
@@ -650,6 +654,7 @@ int mtd_add_partition(struct mtd_info *m
|
||||
@@ -649,6 +653,7 @@ int mtd_add_partition(struct mtd_info *p
|
||||
mutex_unlock(&mtd_partitions_mutex);
|
||||
|
||||
add_mtd_device(&new->mtd);
|
||||
+ mtd_partition_split(master, new);
|
||||
+ mtd_partition_split(parent, new);
|
||||
|
||||
mtd_add_partition_attrs(new);
|
||||
|
||||
@@ -682,6 +687,35 @@ int mtd_del_partition(struct mtd_info *m
|
||||
@@ -718,6 +723,35 @@ int mtd_del_partition(struct mtd_info *m
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mtd_del_partition);
|
||||
|
||||
@@ -92,7 +92,7 @@
|
||||
/*
|
||||
* This function, given a master MTD object and a partition table, creates
|
||||
* and registers slave MTD objects which are bound to the master according to
|
||||
@@ -713,6 +747,7 @@ int add_mtd_partitions(struct mtd_info *
|
||||
@@ -749,6 +783,7 @@ int add_mtd_partitions(struct mtd_info *
|
||||
mutex_unlock(&mtd_partitions_mutex);
|
||||
|
||||
add_mtd_device(&slave->mtd);
|
||||
@@ -102,7 +102,7 @@
|
||||
cur_offset = slave->offset + slave->mtd.size;
|
||||
--- a/include/linux/mtd/partitions.h
|
||||
+++ b/include/linux/mtd/partitions.h
|
||||
@@ -101,5 +101,7 @@ int mtd_add_partition(struct mtd_info *m
|
||||
@@ -102,5 +102,7 @@ int mtd_add_partition(struct mtd_info *m
|
||||
long long offset, long long length);
|
||||
int mtd_del_partition(struct mtd_info *master, int partno);
|
||||
uint64_t mtd_get_device_size(const struct mtd_info *mtd);
|
||||
|
||||
Reference in New Issue
Block a user