Patchwork [1/4] mtd_is_partition: struct mtd_info should be const

login
register
mail settings
Submitter Richard Genoud
Date July 10, 2012, 4:23 p.m.
Message ID <1341937423-16516-2-git-send-email-richard.genoud@gmail.com>
Download mbox | patch
Permalink /patch/170243/
State New
Headers show

Comments

Richard Genoud - July 10, 2012, 4:23 p.m.
struct mtd_info is not modified by mtd_is_partition so it should be a
const.

Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
---
 drivers/mtd/mtdpart.c          |    2 +-
 include/linux/mtd/partitions.h |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Artem Bityutskiy - Aug. 15, 2012, 2:02 p.m.
On Tue, 2012-07-10 at 18:23 +0200, Richard Genoud wrote:
> struct mtd_info is not modified by mtd_is_partition so it should be a
> const.
> 
> Signed-off-by: Richard Genoud <richard.genoud@gmail.com>

I've pushed this and the next MTD patches to linux-ubi, thank you! I
hope David does not mind if it goes in via the MTD, or if he could take
them to the mtd tree, then I cold merge the mtd tree to the UBI tree.
But this is not your pain.

Patch

diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
index d518e4d..8500584 100644
--- a/drivers/mtd/mtdpart.c
+++ b/drivers/mtd/mtdpart.c
@@ -744,7 +744,7 @@  int parse_mtd_partitions(struct mtd_info *master, const char **types,
 	return ret;
 }
 
-int mtd_is_partition(struct mtd_info *mtd)
+int mtd_is_partition(const struct mtd_info *mtd)
 {
 	struct mtd_part *part;
 	int ispart = 0;
diff --git a/include/linux/mtd/partitions.h b/include/linux/mtd/partitions.h
index 2475228..02a5115 100644
--- a/include/linux/mtd/partitions.h
+++ b/include/linux/mtd/partitions.h
@@ -79,7 +79,7 @@  struct mtd_part_parser {
 extern int register_mtd_parser(struct mtd_part_parser *parser);
 extern int deregister_mtd_parser(struct mtd_part_parser *parser);
 
-int mtd_is_partition(struct mtd_info *mtd);
+int mtd_is_partition(const struct mtd_info *mtd);
 int mtd_add_partition(struct mtd_info *master, char *name,
 		      long long offset, long long length);
 int mtd_del_partition(struct mtd_info *master, int partno);