Commit b9adf469 authored by Brian Norris's avatar Brian Norris

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: default avatarBrian Norris <computersforpeace@gmail.com>
Reviewed-by: default avatarBoris Brezillon <boris.brezillon@free-electrons.com>
parent c3168d26
...@@ -162,7 +162,7 @@ afs_read_iis_v1(struct mtd_info *mtd, struct image_info_v1 *iis, u_int ptr) ...@@ -162,7 +162,7 @@ afs_read_iis_v1(struct mtd_info *mtd, struct image_info_v1 *iis, u_int ptr)
} }
static int parse_afs_partitions(struct mtd_info *mtd, static int parse_afs_partitions(struct mtd_info *mtd,
struct mtd_partition **pparts, const struct mtd_partition **pparts,
struct mtd_part_parser_data *data) struct mtd_part_parser_data *data)
{ {
struct mtd_partition *parts; struct mtd_partition *parts;
......
...@@ -43,7 +43,7 @@ struct ar7_bin_rec { ...@@ -43,7 +43,7 @@ struct ar7_bin_rec {
}; };
static int create_mtd_partitions(struct mtd_info *master, static int create_mtd_partitions(struct mtd_info *master,
struct mtd_partition **pparts, const struct mtd_partition **pparts,
struct mtd_part_parser_data *data) struct mtd_part_parser_data *data)
{ {
struct ar7_bin_rec header; struct ar7_bin_rec header;
......
...@@ -82,7 +82,7 @@ static const char *bcm47xxpart_trx_data_part_name(struct mtd_info *master, ...@@ -82,7 +82,7 @@ static const char *bcm47xxpart_trx_data_part_name(struct mtd_info *master,
} }
static int bcm47xxpart_parse(struct mtd_info *master, static int bcm47xxpart_parse(struct mtd_info *master,
struct mtd_partition **pparts, const struct mtd_partition **pparts,
struct mtd_part_parser_data *data) struct mtd_part_parser_data *data)
{ {
struct mtd_partition *parts; struct mtd_partition *parts;
......
...@@ -68,7 +68,7 @@ static int bcm63xx_detect_cfe(struct mtd_info *master) ...@@ -68,7 +68,7 @@ static int bcm63xx_detect_cfe(struct mtd_info *master)
} }
static int bcm63xx_parse_cfe_partitions(struct mtd_info *master, static int bcm63xx_parse_cfe_partitions(struct mtd_info *master,
struct mtd_partition **pparts, const struct mtd_partition **pparts,
struct mtd_part_parser_data *data) struct mtd_part_parser_data *data)
{ {
/* CFE, NVRAM and global Linux are always present */ /* CFE, NVRAM and global Linux are always present */
......
...@@ -304,7 +304,7 @@ static int mtdpart_setup_real(char *s) ...@@ -304,7 +304,7 @@ static int mtdpart_setup_real(char *s)
* the first one in the chain if a NULL mtd_id is passed in. * the first one in the chain if a NULL mtd_id is passed in.
*/ */
static int parse_cmdline_partitions(struct mtd_info *master, static int parse_cmdline_partitions(struct mtd_info *master,
struct mtd_partition **pparts, const struct mtd_partition **pparts,
struct mtd_part_parser_data *data) struct mtd_part_parser_data *data)
{ {
unsigned long long offset; unsigned long long offset;
......
...@@ -26,7 +26,7 @@ static bool node_has_compatible(struct device_node *pp) ...@@ -26,7 +26,7 @@ static bool node_has_compatible(struct device_node *pp)
} }
static int parse_ofpart_partitions(struct mtd_info *master, static int parse_ofpart_partitions(struct mtd_info *master,
struct mtd_partition **pparts, const struct mtd_partition **pparts,
struct mtd_part_parser_data *data) struct mtd_part_parser_data *data)
{ {
struct mtd_partition *parts; struct mtd_partition *parts;
...@@ -145,7 +145,7 @@ static struct mtd_part_parser ofpart_parser = { ...@@ -145,7 +145,7 @@ static struct mtd_part_parser ofpart_parser = {
}; };
static int parse_ofoldpart_partitions(struct mtd_info *master, static int parse_ofoldpart_partitions(struct mtd_info *master,
struct mtd_partition **pparts, const struct mtd_partition **pparts,
struct mtd_part_parser_data *data) struct mtd_part_parser_data *data)
{ {
struct mtd_partition *parts; struct mtd_partition *parts;
......
...@@ -57,7 +57,7 @@ static inline int redboot_checksum(struct fis_image_desc *img) ...@@ -57,7 +57,7 @@ static inline int redboot_checksum(struct fis_image_desc *img)
} }
static int parse_redboot_partitions(struct mtd_info *master, static int parse_redboot_partitions(struct mtd_info *master,
struct mtd_partition **pparts, const struct mtd_partition **pparts,
struct mtd_part_parser_data *data) struct mtd_part_parser_data *data)
{ {
int nrparts = 0; int nrparts = 0;
......
...@@ -69,7 +69,7 @@ struct mtd_part_parser { ...@@ -69,7 +69,7 @@ struct mtd_part_parser {
struct list_head list; struct list_head list;
struct module *owner; struct module *owner;
const char *name; const char *name;
int (*parse_fn)(struct mtd_info *, struct mtd_partition **, int (*parse_fn)(struct mtd_info *, const struct mtd_partition **,
struct mtd_part_parser_data *); struct mtd_part_parser_data *);
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment