global: Migrate CONFIG_SYS_FSL* symbols to the CFG_SYS namespace
[platform/kernel/u-boot.git] / cmd / mtdparts.c
index b40c2af..bab75a2 100644 (file)
@@ -73,7 +73,9 @@
 #include <common.h>
 #include <command.h>
 #include <env.h>
+#include <log.h>
 #include <malloc.h>
+#include <asm/global_data.h>
 #include <jffs2/load_kernel.h>
 #include <linux/list.h>
 #include <linux/ctype.h>
@@ -168,7 +170,7 @@ static int device_del(struct mtd_device *dev);
  *
  * @param ptr where parse begins
  * @param retptr output pointer to next char after parse completes (output)
- * @return resulting unsigned int
+ * Return: resulting unsigned int
  */
 static u64 memsize_parse (const char *const ptr, const char **retptr)
 {
@@ -300,7 +302,7 @@ static void current_save(void)
  * @param type mtd type
  * @param num mtd number
  * @param mtd a pointer to an mtd_info instance (output)
- * @return 0 if device is valid, 1 otherwise
+ * Return: 0 if device is valid, 1 otherwise
  */
 static int get_mtd_info(u8 type, u8 num, struct mtd_info **mtd)
 {
@@ -324,7 +326,7 @@ static int get_mtd_info(u8 type, u8 num, struct mtd_info **mtd)
  *
  * @param id of the parent device
  * @param part partition to validate
- * @return 0 if partition is valid, 1 otherwise
+ * Return: 0 if partition is valid, 1 otherwise
  */
 static int part_validate_eraseblock(struct mtdids *id, struct part_info *part)
 {
@@ -411,7 +413,7 @@ static int part_validate_eraseblock(struct mtdids *id, struct part_info *part)
  *
  * @param id of the parent device
  * @param part partition to validate
- * @return 0 if partition is valid, 1 otherwise
+ * Return: 0 if partition is valid, 1 otherwise
  */
 static int part_validate(struct mtdids *id, struct part_info *part)
 {
@@ -447,7 +449,7 @@ static int part_validate(struct mtdids *id, struct part_info *part)
  *
  * @param dev device to delete partition from
  * @param part partition to delete
- * @return 0 on success, 1 otherwise
+ * Return: 0 on success, 1 otherwise
  */
 static int part_del(struct mtd_device *dev, struct part_info *part)
 {
@@ -575,7 +577,7 @@ static int part_sort_add(struct mtd_device *dev, struct part_info *part)
  *
  * @param dev device to which partition is added
  * @param part partition to be added
- * @return 0 on success, 1 otherwise
+ * Return: 0 on success, 1 otherwise
  */
 static int part_add(struct mtd_device *dev, struct part_info *part)
 {
@@ -597,7 +599,7 @@ static int part_add(struct mtd_device *dev, struct part_info *part)
  * @param partdef pointer to the partition definition string i.e. <part-def>
  * @param ret output pointer to next char after parse completes (output)
  * @param retpart pointer to the allocated partition (output)
- * @return 0 on success, 1 otherwise
+ * Return: 0 on success, 1 otherwise
  */
 static int part_parse(const char *const partdef, const char **ret, struct part_info **retpart)
 {
@@ -715,7 +717,7 @@ static int part_parse(const char *const partdef, const char **ret, struct part_i
  * @param type mtd type
  * @param num mtd number
  * @param size a pointer to the size of the mtd device (output)
- * @return 0 if device is valid, 1 otherwise
+ * Return: 0 if device is valid, 1 otherwise
  */
 static int mtd_device_validate(u8 type, u8 num, u64 *size)
 {
@@ -733,7 +735,7 @@ static int mtd_device_validate(u8 type, u8 num, u64 *size)
  * Delete all mtd devices from a supplied devices list, free memory allocated for
  * each device and delete all device partitions.
  *
- * @return 0 on success, 1 otherwise
+ * Return: 0 on success, 1 otherwise
  */
 static int device_delall(struct list_head *head)
 {
@@ -757,7 +759,7 @@ static int device_delall(struct list_head *head)
  * from device list and device memory is freed.
  *
  * @param dev device to be deleted
- * @return 0 on success, 1 otherwise
+ * Return: 0 on success, 1 otherwise
  */
 static int device_del(struct mtd_device *dev)
 {
@@ -789,7 +791,7 @@ static int device_del(struct mtd_device *dev)
  *
  * @param type device type
  * @param num device number
- * @return NULL if requested device does not exist
+ * Return: NULL if requested device does not exist
  */
 struct mtd_device *device_find(u8 type, u8 num)
 {
@@ -836,7 +838,7 @@ static void device_add(struct mtd_device *dev)
  * @param mtd_dev pointer to the device definition string i.e. <mtd-dev>
  * @param ret output pointer to next char after parse completes (output)
  * @param retdev pointer to the allocated device (output)
- * @return 0 on success, 1 otherwise
+ * Return: 0 on success, 1 otherwise
  */
 static int device_parse(const char *const mtd_dev, const char **ret, struct mtd_device **retdev)
 {
@@ -967,7 +969,7 @@ static int device_parse(const char *const mtd_dev, const char **ret, struct mtd_
 /**
  * Initialize global device list.
  *
- * @return 0 on success, 1 otherwise
+ * Return: 0 on success, 1 otherwise
  */
 static int mtd_devices_init(void)
 {
@@ -981,7 +983,7 @@ static int mtd_devices_init(void)
 /*
  * Search global mtdids list and find id of requested type and number.
  *
- * @return pointer to the id if it exists, NULL otherwise
+ * Return: pointer to the id if it exists, NULL otherwise
  */
 static struct mtdids* id_find(u8 type, u8 num)
 {
@@ -1005,7 +1007,7 @@ static struct mtdids* id_find(u8 type, u8 num)
  *
  * @param mtd_id string containing requested mtd_id
  * @param mtd_id_len length of supplied mtd_id
- * @return pointer to the id if it exists, NULL otherwise
+ * Return: pointer to the id if it exists, NULL otherwise
  */
 static struct mtdids* id_find_by_mtd_id(const char *mtd_id, unsigned int mtd_id_len)
 {
@@ -1038,7 +1040,7 @@ static struct mtdids* id_find_by_mtd_id(const char *mtd_id, unsigned int mtd_id_
  * @param ret_id output pointer to next char after parse completes (output)
  * @param dev_type parsed device type (output)
  * @param dev_num parsed device number (output)
- * @return 0 on success, 1 otherwise
+ * Return: 0 on success, 1 otherwise
  */
 int mtd_id_parse(const char *id, const char **ret_id, u8 *dev_type,
                 u8 *dev_num)
@@ -1080,7 +1082,7 @@ int mtd_id_parse(const char *id, const char **ret_id, u8 *dev_type,
  *
  * @param buf output buffer holding generated mtdparts string (output)
  * @param buflen buffer size
- * @return 0 on success, 1 otherwise
+ * Return: 0 on success, 1 otherwise
  */
 static int generate_mtdparts(char *buf, u32 buflen)
 {
@@ -1205,7 +1207,7 @@ cleanup:
  *
  * @param buf output buffer holding generated mtdparts string (output)
  * @param buflen buffer size
- * @return 0 on success, 1 otherwise
+ * Return: 0 on success, 1 otherwise
  */
 static int generate_mtdparts_save(char *buf, u32 buflen)
 {
@@ -1227,7 +1229,7 @@ static int generate_mtdparts_save(char *buf, u32 buflen)
  *
  * @param mtd the mtd info
  * @param part the partition
- * @return the calculated net size of this partition
+ * Return: the calculated net size of this partition
  */
 static uint64_t net_part_size(struct mtd_info *mtd, struct part_info *part)
 {
@@ -1343,7 +1345,7 @@ static void list_partitions(void)
  * @param dev pointer to the requested device (output)
  * @param part_num verified partition number (output)
  * @param part pointer to requested partition (output)
- * @return 0 on success, 1 otherwise
+ * Return: 0 on success, 1 otherwise
  */
 int find_dev_and_part(const char *id, struct mtd_device **dev,
                u8 *part_num, struct part_info **part)
@@ -1403,7 +1405,7 @@ int find_dev_and_part(const char *id, struct mtd_device **dev,
  * Find and delete partition. For partition id format see find_dev_and_part().
  *
  * @param id string describing device and partition
- * @return 0 on success, 1 otherwise
+ * Return: 0 on success, 1 otherwise
  */
 static int delete_partition(const char *id)
 {
@@ -1479,7 +1481,7 @@ static void spread_partition(struct mtd_info *mtd, struct part_info *part,
  * as big as their mtdparts environment variable sizes and they each start
  * on a good block.
  *
- * @return 0 on success, 1 otherwise
+ * Return: 0 on success, 1 otherwise
  */
 static int spread_partitions(void)
 {
@@ -1532,7 +1534,7 @@ static int spread_partitions(void)
  * buffer.  gd->env_buf will be too small.
  *
  * @param buf temporary buffer pointer MTDPARTS_MAXLEN long
- * @return mtdparts variable string, NULL if not found
+ * Return: mtdparts variable string, NULL if not found
  */
 static const char *env_get_mtdparts(char *buf)
 {
@@ -1548,7 +1550,7 @@ static const char *env_get_mtdparts(char *buf)
  * for each entry. Add created devices to the global devices list.
  *
  * @param mtdparts string specifing mtd partitions
- * @return 0 on success, 1 otherwise
+ * Return: 0 on success, 1 otherwise
  */
 static int parse_mtdparts(const char *const mtdparts)
 {
@@ -1606,7 +1608,7 @@ static int parse_mtdparts(const char *const mtdparts)
  * to the global mtdids list.
  *
  * @param ids mapping string
- * @return 0 on success, 1 otherwise
+ * Return: 0 on success, 1 otherwise
  */
 static int parse_mtdids(const char *const ids)
 {
@@ -1716,7 +1718,7 @@ static int parse_mtdids(const char *const ids)
  * Parse and initialize global mtdids mapping and create global
  * device/partition list.
  *
- * @return 0 on success, 1 otherwise
+ * Return: 0 on success, 1 otherwise
  */
 int mtdparts_init(void)
 {
@@ -1866,7 +1868,7 @@ int mtdparts_init(void)
  *
  * @param dev device that is to be searched for a partition
  * @param part_num requested partition number
- * @return pointer to the part_info, NULL otherwise
+ * Return: pointer to the part_info, NULL otherwise
  */
 static struct part_info* mtd_part_info(struct mtd_device *dev, unsigned int part_num)
 {
@@ -1913,9 +1915,10 @@ static struct part_info* mtd_part_info(struct mtd_device *dev, unsigned int part
  * @param flag command flag
  * @param argc number of arguments supplied to the command
  * @param argv arguments list
- * @return 0 on success, 1 otherwise
+ * Return: 0 on success, 1 otherwise
  */
-static int do_chpart(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_chpart(struct cmd_tbl *cmdtp, int flag, int argc,
+                    char *const argv[])
 {
 /* command line only */
        struct mtd_device *dev;
@@ -1951,10 +1954,10 @@ static int do_chpart(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
  * @param flag command flag
  * @param argc number of arguments supplied to the command
  * @param argv arguments list
- * @return 0 on success, 1 otherwise
+ * Return: 0 on success, 1 otherwise
  */
-static int do_mtdparts(cmd_tbl_t *cmdtp, int flag, int argc,
-                      char * const argv[])
+static int do_mtdparts(struct cmd_tbl *cmdtp, int flag, int argc,
+                      char *const argv[])
 {
        if (argc == 2) {
                if (strcmp(argv[1], "default") == 0) {
@@ -2074,9 +2077,9 @@ static int do_mtdparts(cmd_tbl_t *cmdtp, int flag, int argc,
 /***************************************************/
 U_BOOT_CMD(
        chpart, 2,      0,      do_chpart,
-       "change active partition",
+       "change active partition of a MTD device",
        "part-id\n"
-       "    - change active partition (e.g. part-id = nand0,1)"
+       "    - change active partition (e.g. part-id = nand0,1) of a MTD device"
 );
 
 #ifdef CONFIG_SYS_LONGHELP