1 --- a/drivers/mtd/mtdchar.c
2 +++ b/drivers/mtd/mtdchar.c
4 /* Sanitize user input */
5 p.devname[BLKPG_DEVNAMELTH - 1] = '\0';
7 - return mtd_add_partition(mtd, p.devname, p.start, p.length);
8 + /* No mtd flags masking required */
9 + uint32_t mask_flags = 0;
11 + return mtd_add_partition(mtd, p.devname, p.start, p.length, mask_flags);
13 case BLKPG_DEL_PARTITION:
15 --- a/drivers/mtd/mtdpart.c
16 +++ b/drivers/mtd/mtdpart.c
20 int mtd_add_partition(struct mtd_info *parent, const char *name,
21 - long long offset, long long length)
22 + long long offset, long long length, uint32_t mask_flags)
24 struct mtd_partition part;
30 + part.mask_flags = mask_flags;
32 new = allocate_partition(parent, &part, -1, offset);
35 /* adjust partition offsets */
36 parts[i].offset += slave->offset;
38 + /* adjust partition mask */
39 + parts[i].mask_flags = !(slave->mtd.flags & MTD_WRITEABLE) ? MTD_WRITEABLE : 0;
41 mtd_add_partition(slave->parent,
46 + parts[i].mask_flags);
50 --- a/include/linux/mtd/partitions.h
51 +++ b/include/linux/mtd/partitions.h
54 int mtd_is_partition(const struct mtd_info *mtd);
55 int mtd_add_partition(struct mtd_info *master, const char *name,
56 - long long offset, long long length);
57 + long long offset, long long length, uint32_t mask_flags);
58 int mtd_del_partition(struct mtd_info *master, int partno);
59 struct mtd_info *mtdpart_get_master(const struct mtd_info *mtd);
60 uint64_t mtdpart_get_offset(const struct mtd_info *mtd);