Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mtd: partitions: make parsers return 'const' partition arrays

We only want to modify these arrays inside the parser "drivers", so the
drivers should construct them however they like, then return them as
immutable arrays.

This will make other refactorings easier.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>

+9 -9
+1 -1
drivers/mtd/afs.c
··· 162 162 } 163 163 164 164 static int parse_afs_partitions(struct mtd_info *mtd, 165 - struct mtd_partition **pparts, 165 + const struct mtd_partition **pparts, 166 166 struct mtd_part_parser_data *data) 167 167 { 168 168 struct mtd_partition *parts;
+1 -1
drivers/mtd/ar7part.c
··· 43 43 }; 44 44 45 45 static int create_mtd_partitions(struct mtd_info *master, 46 - struct mtd_partition **pparts, 46 + const struct mtd_partition **pparts, 47 47 struct mtd_part_parser_data *data) 48 48 { 49 49 struct ar7_bin_rec header;
+1 -1
drivers/mtd/bcm47xxpart.c
··· 82 82 } 83 83 84 84 static int bcm47xxpart_parse(struct mtd_info *master, 85 - struct mtd_partition **pparts, 85 + const struct mtd_partition **pparts, 86 86 struct mtd_part_parser_data *data) 87 87 { 88 88 struct mtd_partition *parts;
+1 -1
drivers/mtd/bcm63xxpart.c
··· 68 68 } 69 69 70 70 static int bcm63xx_parse_cfe_partitions(struct mtd_info *master, 71 - struct mtd_partition **pparts, 71 + const struct mtd_partition **pparts, 72 72 struct mtd_part_parser_data *data) 73 73 { 74 74 /* CFE, NVRAM and global Linux are always present */
+1 -1
drivers/mtd/cmdlinepart.c
··· 304 304 * the first one in the chain if a NULL mtd_id is passed in. 305 305 */ 306 306 static int parse_cmdline_partitions(struct mtd_info *master, 307 - struct mtd_partition **pparts, 307 + const struct mtd_partition **pparts, 308 308 struct mtd_part_parser_data *data) 309 309 { 310 310 unsigned long long offset;
+2 -2
drivers/mtd/ofpart.c
··· 26 26 } 27 27 28 28 static int parse_ofpart_partitions(struct mtd_info *master, 29 - struct mtd_partition **pparts, 29 + const struct mtd_partition **pparts, 30 30 struct mtd_part_parser_data *data) 31 31 { 32 32 struct mtd_partition *parts; ··· 145 145 }; 146 146 147 147 static int parse_ofoldpart_partitions(struct mtd_info *master, 148 - struct mtd_partition **pparts, 148 + const struct mtd_partition **pparts, 149 149 struct mtd_part_parser_data *data) 150 150 { 151 151 struct mtd_partition *parts;
+1 -1
drivers/mtd/redboot.c
··· 57 57 } 58 58 59 59 static int parse_redboot_partitions(struct mtd_info *master, 60 - struct mtd_partition **pparts, 60 + const struct mtd_partition **pparts, 61 61 struct mtd_part_parser_data *data) 62 62 { 63 63 int nrparts = 0;
+1 -1
include/linux/mtd/partitions.h
··· 69 69 struct list_head list; 70 70 struct module *owner; 71 71 const char *name; 72 - int (*parse_fn)(struct mtd_info *, struct mtd_partition **, 72 + int (*parse_fn)(struct mtd_info *, const struct mtd_partition **, 73 73 struct mtd_part_parser_data *); 74 74 }; 75 75