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

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Tue Jan 12 15:59:14 PST 2016


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=b9adf469f8abb8a66f5795bbd8fe50fe201a14a1
Commit:     b9adf469f8abb8a66f5795bbd8fe50fe201a14a1
Parent:     c3168d26c8deea4cc0202bb19341ab55247c3941
Author:     Brian Norris <computersforpeace at gmail.com>
AuthorDate: Fri Dec 4 15:25:14 2015 -0800
Committer:  Brian Norris <computersforpeace at gmail.com>
CommitDate: Wed Dec 9 10:21:57 2015 -0800

    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 at gmail.com>
    Reviewed-by: Boris Brezillon <boris.brezillon at free-electrons.com>
---
 drivers/mtd/afs.c              | 2 +-
 drivers/mtd/ar7part.c          | 2 +-
 drivers/mtd/bcm47xxpart.c      | 2 +-
 drivers/mtd/bcm63xxpart.c      | 2 +-
 drivers/mtd/cmdlinepart.c      | 2 +-
 drivers/mtd/ofpart.c           | 4 ++--
 drivers/mtd/redboot.c          | 2 +-
 include/linux/mtd/partitions.h | 2 +-
 8 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/mtd/afs.c b/drivers/mtd/afs.c
index e02dae3..d61b7ed 100644
--- a/drivers/mtd/afs.c
+++ b/drivers/mtd/afs.c
@@ -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,
-				struct mtd_partition **pparts,
+				const struct mtd_partition **pparts,
 				struct mtd_part_parser_data *data)
 {
 	struct mtd_partition *parts;
diff --git a/drivers/mtd/ar7part.c b/drivers/mtd/ar7part.c
index 9203b96..90575de 100644
--- a/drivers/mtd/ar7part.c
+++ b/drivers/mtd/ar7part.c
@@ -43,7 +43,7 @@ struct ar7_bin_rec {
 };
 
 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 ar7_bin_rec header;
diff --git a/drivers/mtd/bcm47xxpart.c b/drivers/mtd/bcm47xxpart.c
index 92a6dd1..8282f47 100644
--- a/drivers/mtd/bcm47xxpart.c
+++ b/drivers/mtd/bcm47xxpart.c
@@ -82,7 +82,7 @@ out_default:
 }
 
 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_partition *parts;
diff --git a/drivers/mtd/bcm63xxpart.c b/drivers/mtd/bcm63xxpart.c
index cf02135..4409369 100644
--- a/drivers/mtd/bcm63xxpart.c
+++ b/drivers/mtd/bcm63xxpart.c
@@ -68,7 +68,7 @@ static int bcm63xx_detect_cfe(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)
 {
 	/* CFE, NVRAM and global Linux are always present */
diff --git a/drivers/mtd/cmdlinepart.c b/drivers/mtd/cmdlinepart.c
index 4204898..fbd5aff 100644
--- a/drivers/mtd/cmdlinepart.c
+++ b/drivers/mtd/cmdlinepart.c
@@ -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.
  */
 static int parse_cmdline_partitions(struct mtd_info *master,
-				    struct mtd_partition **pparts,
+				    const struct mtd_partition **pparts,
 				    struct mtd_part_parser_data *data)
 {
 	unsigned long long offset;
diff --git a/drivers/mtd/ofpart.c b/drivers/mtd/ofpart.c
index c7df2f1..ede407d 100644
--- a/drivers/mtd/ofpart.c
+++ b/drivers/mtd/ofpart.c
@@ -26,7 +26,7 @@ static bool node_has_compatible(struct device_node *pp)
 }
 
 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_partition *parts;
@@ -145,7 +145,7 @@ static struct mtd_part_parser ofpart_parser = {
 };
 
 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_partition *parts;
diff --git a/drivers/mtd/redboot.c b/drivers/mtd/redboot.c
index 11c3447..7623ac5 100644
--- a/drivers/mtd/redboot.c
+++ b/drivers/mtd/redboot.c
@@ -57,7 +57,7 @@ static inline int redboot_checksum(struct fis_image_desc *img)
 }
 
 static int parse_redboot_partitions(struct mtd_info *master,
-				    struct mtd_partition **pparts,
+				    const struct mtd_partition **pparts,
 				    struct mtd_part_parser_data *data)
 {
 	int nrparts = 0;
diff --git a/include/linux/mtd/partitions.h b/include/linux/mtd/partitions.h
index d002d9b..6185536 100644
--- a/include/linux/mtd/partitions.h
+++ b/include/linux/mtd/partitions.h
@@ -69,7 +69,7 @@ struct mtd_part_parser {
 	struct list_head list;
 	struct module *owner;
 	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 *);
 };
 



More information about the linux-mtd-cvs mailing list