kernel: don't export parse_mtd_partitions_by_type() in 4.9 and 4.14
That function isn't used anywhere out of the mtdpart.c & can be static. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
This commit is contained in:
		| @@ -9,7 +9,18 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org> | ||||
|  | ||||
| --- a/drivers/mtd/mtdpart.c | ||||
| +++ b/drivers/mtd/mtdpart.c | ||||
| @@ -1118,6 +1118,62 @@ void mtd_part_parser_cleanup(struct mtd_ | ||||
| @@ -56,6 +56,10 @@ struct mtd_part { | ||||
|  }; | ||||
|   | ||||
|  static void mtd_partition_split(struct mtd_info *master, struct mtd_part *part); | ||||
| +static int parse_mtd_partitions_by_type(struct mtd_info *master, | ||||
| +					enum mtd_parser_type type, | ||||
| +					const struct mtd_partition **pparts, | ||||
| +					struct mtd_part_parser_data *data); | ||||
|   | ||||
|  /* | ||||
|   * Given a pointer to the MTD object in the mtd_part structure, we can retrieve | ||||
| @@ -1118,6 +1122,61 @@ void mtd_part_parser_cleanup(struct mtd_ | ||||
|  	} | ||||
|  } | ||||
|   | ||||
| @@ -37,10 +48,10 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org> | ||||
| +	return ret; | ||||
| +} | ||||
| + | ||||
| +int parse_mtd_partitions_by_type(struct mtd_info *master, | ||||
| +				 enum mtd_parser_type type, | ||||
| +				 const struct mtd_partition **pparts, | ||||
| +				 struct mtd_part_parser_data *data) | ||||
| +static int parse_mtd_partitions_by_type(struct mtd_info *master, | ||||
| +					enum mtd_parser_type type, | ||||
| +					const struct mtd_partition **pparts, | ||||
| +					struct mtd_part_parser_data *data) | ||||
| +{ | ||||
| +	struct mtd_part_parser *prev = NULL; | ||||
| +	int ret = 0; | ||||
| @@ -67,19 +78,13 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org> | ||||
| + | ||||
| +	return ret; | ||||
| +} | ||||
| +EXPORT_SYMBOL_GPL(parse_mtd_partitions_by_type); | ||||
| + | ||||
|  int mtd_is_partition(const struct mtd_info *mtd) | ||||
|  { | ||||
|  	struct mtd_part *part; | ||||
| --- a/include/linux/mtd/partitions.h | ||||
| +++ b/include/linux/mtd/partitions.h | ||||
| @@ -68,11 +68,14 @@ struct mtd_part_parser_data { | ||||
|  	unsigned long origin; | ||||
|  }; | ||||
|   | ||||
| - | ||||
|  /* | ||||
| @@ -73,6 +73,10 @@ struct mtd_part_parser_data { | ||||
|   * Functions dealing with the various ways of partitioning the space | ||||
|   */ | ||||
|   | ||||
| @@ -90,7 +95,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org> | ||||
|  struct mtd_part_parser { | ||||
|  	struct list_head list; | ||||
|  	struct module *owner; | ||||
| @@ -81,6 +84,7 @@ struct mtd_part_parser { | ||||
| @@ -81,6 +85,7 @@ struct mtd_part_parser { | ||||
|  	int (*parse_fn)(struct mtd_info *, const struct mtd_partition **, | ||||
|  			struct mtd_part_parser_data *); | ||||
|  	void (*cleanup)(const struct mtd_partition *pparts, int nr_parts); | ||||
| @@ -98,13 +103,3 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org> | ||||
|  }; | ||||
|   | ||||
|  /* Container for passing around a set of parsed partitions */ | ||||
| @@ -113,4 +117,9 @@ uint64_t mtd_get_device_size(const struc | ||||
|  extern void __weak arch_split_mtd_part(struct mtd_info *master, | ||||
|  				       const char *name, int offset, int size); | ||||
|   | ||||
| +int parse_mtd_partitions_by_type(struct mtd_info *master, | ||||
| +				 enum mtd_parser_type type, | ||||
| +				 const struct mtd_partition **pparts, | ||||
| +				 struct mtd_part_parser_data *data); | ||||
| + | ||||
|  #endif | ||||
|   | ||||
| @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org> | ||||
|  | ||||
| --- a/drivers/mtd/mtdpart.c | ||||
| +++ b/drivers/mtd/mtdpart.c | ||||
| @@ -741,6 +741,36 @@ int mtd_del_partition(struct mtd_info *m | ||||
| @@ -745,6 +745,36 @@ int mtd_del_partition(struct mtd_info *m | ||||
|  } | ||||
|  EXPORT_SYMBOL_GPL(mtd_del_partition); | ||||
|   | ||||
| @@ -47,7 +47,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org> | ||||
|  #ifdef CONFIG_MTD_SPLIT_FIRMWARE_NAME | ||||
|  #define SPLIT_FIRMWARE_NAME	CONFIG_MTD_SPLIT_FIRMWARE_NAME | ||||
|  #else | ||||
| @@ -749,6 +779,7 @@ EXPORT_SYMBOL_GPL(mtd_del_partition); | ||||
| @@ -753,6 +783,7 @@ EXPORT_SYMBOL_GPL(mtd_del_partition); | ||||
|   | ||||
|  static void split_firmware(struct mtd_info *master, struct mtd_part *part) | ||||
|  { | ||||
| @@ -55,7 +55,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org> | ||||
|  } | ||||
|   | ||||
|  void __weak arch_split_mtd_part(struct mtd_info *master, const char *name, | ||||
| @@ -763,6 +794,12 @@ static void mtd_partition_split(struct m | ||||
| @@ -767,6 +798,12 @@ static void mtd_partition_split(struct m | ||||
|  	if (rootfs_found) | ||||
|  		return; | ||||
|   | ||||
| @@ -70,7 +70,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org> | ||||
|  		split_firmware(master, part); | ||||
| --- a/include/linux/mtd/partitions.h | ||||
| +++ b/include/linux/mtd/partitions.h | ||||
| @@ -74,6 +74,8 @@ struct mtd_part_parser_data { | ||||
| @@ -75,6 +75,8 @@ struct mtd_part_parser_data { | ||||
|   | ||||
|  enum mtd_parser_type { | ||||
|  	MTD_PARSER_TYPE_DEVICE = 0, | ||||
|   | ||||
| @@ -11,7 +11,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org> | ||||
|  | ||||
| --- a/drivers/mtd/mtdpart.c | ||||
| +++ b/drivers/mtd/mtdpart.c | ||||
| @@ -1228,6 +1228,24 @@ int mtd_is_partition(const struct mtd_in | ||||
| @@ -1231,6 +1231,24 @@ int mtd_is_partition(const struct mtd_in | ||||
|  } | ||||
|  EXPORT_SYMBOL_GPL(mtd_is_partition); | ||||
|   | ||||
| @@ -65,7 +65,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org> | ||||
|  	if (mtd->writesize_shift) | ||||
| --- a/include/linux/mtd/partitions.h | ||||
| +++ b/include/linux/mtd/partitions.h | ||||
| @@ -115,6 +115,8 @@ int mtd_is_partition(const struct mtd_in | ||||
| @@ -116,6 +116,8 @@ int mtd_is_partition(const struct mtd_in | ||||
|  int mtd_add_partition(struct mtd_info *master, const char *name, | ||||
|  		      long long offset, long long length); | ||||
|  int mtd_del_partition(struct mtd_info *master, int partno); | ||||
|   | ||||
| @@ -19,7 +19,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> | ||||
|  /* Our partition linked list */ | ||||
|  static LIST_HEAD(mtd_partitions); | ||||
|  static DEFINE_MUTEX(mtd_partitions_mutex); | ||||
| @@ -242,13 +244,61 @@ static int part_erase(struct mtd_info *m | ||||
| @@ -246,13 +248,61 @@ static int part_erase(struct mtd_info *m | ||||
|  	struct mtd_part *part = mtd_to_part(mtd); | ||||
|  	int ret; | ||||
|   | ||||
| @@ -81,7 +81,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> | ||||
|  	return ret; | ||||
|  } | ||||
|   | ||||
| @@ -256,6 +306,25 @@ void mtd_erase_callback(struct erase_inf | ||||
| @@ -260,6 +310,25 @@ void mtd_erase_callback(struct erase_inf | ||||
|  { | ||||
|  	if (instr->mtd->_erase == part_erase) { | ||||
|  		struct mtd_part *part = mtd_to_part(instr->mtd); | ||||
| @@ -107,7 +107,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> | ||||
|   | ||||
|  		if (instr->fail_addr != MTD_FAIL_ADDR_UNKNOWN) | ||||
|  			instr->fail_addr -= part->offset; | ||||
| @@ -570,19 +639,22 @@ static struct mtd_part *allocate_partiti | ||||
| @@ -574,19 +643,22 @@ static struct mtd_part *allocate_partiti | ||||
|  	remainder = do_div(tmp, wr_alignment); | ||||
|  	if ((slave->mtd.flags & MTD_WRITEABLE) && remainder) { | ||||
|  		/* Doesn't start on a boundary of major erase size */ | ||||
|   | ||||
| @@ -20,7 +20,7 @@ Signed-off-by: Tim Harvey <tharvey@gateworks.com> | ||||
|  | ||||
| --- a/drivers/mtd/mtdpart.c | ||||
| +++ b/drivers/mtd/mtdpart.c | ||||
| @@ -344,7 +344,16 @@ static int part_lock(struct mtd_info *mt | ||||
| @@ -348,7 +348,16 @@ static int part_lock(struct mtd_info *mt | ||||
|  static int part_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len) | ||||
|  { | ||||
|  	struct mtd_part *part = mtd_to_part(mtd); | ||||
|   | ||||
| @@ -9,7 +9,18 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org> | ||||
|  | ||||
| --- a/drivers/mtd/mtdpart.c | ||||
| +++ b/drivers/mtd/mtdpart.c | ||||
| @@ -1115,6 +1115,62 @@ void mtd_part_parser_cleanup(struct mtd_ | ||||
| @@ -56,6 +56,10 @@ struct mtd_part { | ||||
|  }; | ||||
|   | ||||
|  static void mtd_partition_split(struct mtd_info *master, struct mtd_part *part); | ||||
| +static int parse_mtd_partitions_by_type(struct mtd_info *master, | ||||
| +					enum mtd_parser_type type, | ||||
| +					const struct mtd_partition **pparts, | ||||
| +					struct mtd_part_parser_data *data); | ||||
|   | ||||
|  /* | ||||
|   * Given a pointer to the MTD object in the mtd_part structure, we can retrieve | ||||
| @@ -1115,6 +1119,61 @@ void mtd_part_parser_cleanup(struct mtd_ | ||||
|  	} | ||||
|  } | ||||
|   | ||||
| @@ -37,10 +48,10 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org> | ||||
| +	return ret; | ||||
| +} | ||||
| + | ||||
| +int parse_mtd_partitions_by_type(struct mtd_info *master, | ||||
| +				 enum mtd_parser_type type, | ||||
| +				 const struct mtd_partition **pparts, | ||||
| +				 struct mtd_part_parser_data *data) | ||||
| +static int parse_mtd_partitions_by_type(struct mtd_info *master, | ||||
| +					enum mtd_parser_type type, | ||||
| +					const struct mtd_partition **pparts, | ||||
| +					struct mtd_part_parser_data *data) | ||||
| +{ | ||||
| +	struct mtd_part_parser *prev = NULL; | ||||
| +	int ret = 0; | ||||
| @@ -67,19 +78,13 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org> | ||||
| + | ||||
| +	return ret; | ||||
| +} | ||||
| +EXPORT_SYMBOL_GPL(parse_mtd_partitions_by_type); | ||||
| + | ||||
|  int mtd_is_partition(const struct mtd_info *mtd) | ||||
|  { | ||||
|  	struct mtd_part *part; | ||||
| --- a/include/linux/mtd/partitions.h | ||||
| +++ b/include/linux/mtd/partitions.h | ||||
| @@ -68,11 +68,14 @@ struct mtd_part_parser_data { | ||||
|  	unsigned long origin; | ||||
|  }; | ||||
|   | ||||
| - | ||||
|  /* | ||||
| @@ -73,6 +73,10 @@ struct mtd_part_parser_data { | ||||
|   * Functions dealing with the various ways of partitioning the space | ||||
|   */ | ||||
|   | ||||
| @@ -90,7 +95,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org> | ||||
|  struct mtd_part_parser { | ||||
|  	struct list_head list; | ||||
|  	struct module *owner; | ||||
| @@ -81,6 +84,7 @@ struct mtd_part_parser { | ||||
| @@ -81,6 +85,7 @@ struct mtd_part_parser { | ||||
|  	int (*parse_fn)(struct mtd_info *, const struct mtd_partition **, | ||||
|  			struct mtd_part_parser_data *); | ||||
|  	void (*cleanup)(const struct mtd_partition *pparts, int nr_parts); | ||||
| @@ -98,13 +103,3 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org> | ||||
|  }; | ||||
|   | ||||
|  /* Container for passing around a set of parsed partitions */ | ||||
| @@ -113,4 +117,9 @@ uint64_t mtd_get_device_size(const struc | ||||
|  extern void __weak arch_split_mtd_part(struct mtd_info *master, | ||||
|  				       const char *name, int offset, int size); | ||||
|   | ||||
| +int parse_mtd_partitions_by_type(struct mtd_info *master, | ||||
| +				 enum mtd_parser_type type, | ||||
| +				 const struct mtd_partition **pparts, | ||||
| +				 struct mtd_part_parser_data *data); | ||||
| + | ||||
|  #endif | ||||
|   | ||||
| @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org> | ||||
|  | ||||
| --- a/drivers/mtd/mtdpart.c | ||||
| +++ b/drivers/mtd/mtdpart.c | ||||
| @@ -733,6 +733,36 @@ int mtd_del_partition(struct mtd_info *m | ||||
| @@ -737,6 +737,36 @@ int mtd_del_partition(struct mtd_info *m | ||||
|  } | ||||
|  EXPORT_SYMBOL_GPL(mtd_del_partition); | ||||
|   | ||||
| @@ -47,7 +47,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org> | ||||
|  #ifdef CONFIG_MTD_SPLIT_FIRMWARE_NAME | ||||
|  #define SPLIT_FIRMWARE_NAME	CONFIG_MTD_SPLIT_FIRMWARE_NAME | ||||
|  #else | ||||
| @@ -741,6 +771,7 @@ EXPORT_SYMBOL_GPL(mtd_del_partition); | ||||
| @@ -745,6 +775,7 @@ EXPORT_SYMBOL_GPL(mtd_del_partition); | ||||
|   | ||||
|  static void split_firmware(struct mtd_info *master, struct mtd_part *part) | ||||
|  { | ||||
| @@ -55,7 +55,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org> | ||||
|  } | ||||
|   | ||||
|  void __weak arch_split_mtd_part(struct mtd_info *master, const char *name, | ||||
| @@ -755,6 +786,12 @@ static void mtd_partition_split(struct m | ||||
| @@ -759,6 +790,12 @@ static void mtd_partition_split(struct m | ||||
|  	if (rootfs_found) | ||||
|  		return; | ||||
|   | ||||
| @@ -70,7 +70,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org> | ||||
|  		split_firmware(master, part); | ||||
| --- a/include/linux/mtd/partitions.h | ||||
| +++ b/include/linux/mtd/partitions.h | ||||
| @@ -74,6 +74,8 @@ struct mtd_part_parser_data { | ||||
| @@ -75,6 +75,8 @@ struct mtd_part_parser_data { | ||||
|   | ||||
|  enum mtd_parser_type { | ||||
|  	MTD_PARSER_TYPE_DEVICE = 0, | ||||
|   | ||||
| @@ -11,7 +11,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org> | ||||
|  | ||||
| --- a/drivers/mtd/mtdpart.c | ||||
| +++ b/drivers/mtd/mtdpart.c | ||||
| @@ -1225,6 +1225,24 @@ int mtd_is_partition(const struct mtd_in | ||||
| @@ -1228,6 +1228,24 @@ int mtd_is_partition(const struct mtd_in | ||||
|  } | ||||
|  EXPORT_SYMBOL_GPL(mtd_is_partition); | ||||
|   | ||||
| @@ -65,7 +65,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org> | ||||
|  	if (mtd->writesize_shift) | ||||
| --- a/include/linux/mtd/partitions.h | ||||
| +++ b/include/linux/mtd/partitions.h | ||||
| @@ -115,6 +115,8 @@ int mtd_is_partition(const struct mtd_in | ||||
| @@ -116,6 +116,8 @@ int mtd_is_partition(const struct mtd_in | ||||
|  int mtd_add_partition(struct mtd_info *master, const char *name, | ||||
|  		      long long offset, long long length); | ||||
|  int mtd_del_partition(struct mtd_info *master, int partno); | ||||
|   | ||||
| @@ -19,7 +19,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> | ||||
|  /* Our partition linked list */ | ||||
|  static LIST_HEAD(mtd_partitions); | ||||
|  static DEFINE_MUTEX(mtd_partitions_mutex); | ||||
| @@ -242,13 +244,61 @@ static int part_erase(struct mtd_info *m | ||||
| @@ -246,13 +248,61 @@ static int part_erase(struct mtd_info *m | ||||
|  	struct mtd_part *part = mtd_to_part(mtd); | ||||
|  	int ret; | ||||
|   | ||||
| @@ -81,7 +81,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> | ||||
|  	return ret; | ||||
|  } | ||||
|   | ||||
| @@ -256,6 +306,25 @@ void mtd_erase_callback(struct erase_inf | ||||
| @@ -260,6 +310,25 @@ void mtd_erase_callback(struct erase_inf | ||||
|  { | ||||
|  	if (instr->mtd->_erase == part_erase) { | ||||
|  		struct mtd_part *part = mtd_to_part(instr->mtd); | ||||
| @@ -107,7 +107,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> | ||||
|   | ||||
|  		if (instr->fail_addr != MTD_FAIL_ADDR_UNKNOWN) | ||||
|  			instr->fail_addr -= part->offset; | ||||
| @@ -562,19 +631,22 @@ static struct mtd_part *allocate_partiti | ||||
| @@ -566,19 +635,22 @@ static struct mtd_part *allocate_partiti | ||||
|  	remainder = do_div(tmp, wr_alignment); | ||||
|  	if ((slave->mtd.flags & MTD_WRITEABLE) && remainder) { | ||||
|  		/* Doesn't start on a boundary of major erase size */ | ||||
|   | ||||
| @@ -20,7 +20,7 @@ Signed-off-by: Tim Harvey <tharvey@gateworks.com> | ||||
|  | ||||
| --- a/drivers/mtd/mtdpart.c | ||||
| +++ b/drivers/mtd/mtdpart.c | ||||
| @@ -344,7 +344,16 @@ static int part_lock(struct mtd_info *mt | ||||
| @@ -348,7 +348,16 @@ static int part_lock(struct mtd_info *mt | ||||
|  static int part_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len) | ||||
|  { | ||||
|  	struct mtd_part *part = mtd_to_part(mtd); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Rafał Miłecki
					Rafał Miłecki