summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/flash/nand.c17
-rw-r--r--src/flash/nand.h4
2 files changed, 11 insertions, 10 deletions
diff --git a/src/flash/nand.c b/src/flash/nand.c
index 46ac7286..fba8104a 100644
--- a/src/flash/nand.c
+++ b/src/flash/nand.c
@@ -304,9 +304,10 @@ struct nand_device *get_nand_device_by_num(int num)
return NULL;
}
-int nand_command_get_device_by_num(struct command_context *cmd_ctx,
- const char *str, struct nand_device **nand)
+COMMAND_HELPER(nand_command_get_device_by_num, unsigned name_index,
+ struct nand_device **nand)
{
+ const char *str = args[name_index];
unsigned num;
COMMAND_PARSE_NUMBER(uint, str, num);
*nand = get_nand_device_by_num(num);
@@ -1077,7 +1078,7 @@ COMMAND_HANDLER(handle_nand_info_command)
int last = -1;
struct nand_device *p;
- int retval = nand_command_get_device_by_num(cmd_ctx, args[0], &p);
+ int retval = CALL_COMMAND_HANDLER(nand_command_get_device_by_num, 0, &p);
if (ERROR_OK != retval)
return retval;
@@ -1152,7 +1153,7 @@ COMMAND_HANDLER(handle_nand_probe_command)
}
struct nand_device *p;
- int retval = nand_command_get_device_by_num(cmd_ctx, args[0], &p);
+ int retval = CALL_COMMAND_HANDLER(nand_command_get_device_by_num, 0, &p);
if (ERROR_OK != retval)
return retval;
@@ -1181,7 +1182,7 @@ COMMAND_HANDLER(handle_nand_erase_command)
}
struct nand_device *p;
- int retval = nand_command_get_device_by_num(cmd_ctx, args[0], &p);
+ int retval = CALL_COMMAND_HANDLER(nand_command_get_device_by_num, 0, &p);
if (ERROR_OK != retval)
return retval;
@@ -1240,7 +1241,7 @@ COMMAND_HANDLER(handle_nand_check_bad_blocks_command)
}
struct nand_device *p;
- int retval = nand_command_get_device_by_num(cmd_ctx, args[0], &p);
+ int retval = CALL_COMMAND_HANDLER(nand_command_get_device_by_num, 0, &p);
if (ERROR_OK != retval)
return retval;
@@ -1392,7 +1393,7 @@ static COMMAND_HELPER(nand_fileio_parse_args, struct nand_fileio_state *state,
return ERROR_COMMAND_SYNTAX_ERROR;
struct nand_device *nand;
- int retval = nand_command_get_device_by_num(cmd_ctx, args[0], &nand);
+ int retval = CALL_COMMAND_HANDLER(nand_command_get_device_by_num, 0, &nand);
if (ERROR_OK != retval)
return retval;
@@ -1651,7 +1652,7 @@ COMMAND_HANDLER(handle_nand_raw_access_command)
}
struct nand_device *p;
- int retval = nand_command_get_device_by_num(cmd_ctx, args[0], &p);
+ int retval = CALL_COMMAND_HANDLER(nand_command_get_device_by_num, 0, &p);
if (ERROR_OK != retval)
return retval;
diff --git a/src/flash/nand.h b/src/flash/nand.h
index afec9a77..ddc4520e 100644
--- a/src/flash/nand.h
+++ b/src/flash/nand.h
@@ -230,8 +230,8 @@ int nand_register_commands(struct command_context *cmd_ctx);
int nand_init(struct command_context *cmd_ctx);
/// helper for parsing a nand device command argument string
-int nand_command_get_device_by_num(struct command_context *cmd_ctx,
- const char *str, struct nand_device **nand);
+COMMAND_HELPER(nand_command_get_device_by_num, unsigned name_index,
+ struct nand_device **nand);
#define ERROR_NAND_DEVICE_INVALID (-1100)