summaryrefslogtreecommitdiff
path: root/src/flash/flash.c
diff options
context:
space:
mode:
authorZachary T Welch <zw@superlucidity.net>2009-11-22 06:12:04 -0800
committerZachary T Welch <zw@superlucidity.net>2009-11-24 21:37:35 -0800
commitad090413a8dfacccc993ff15b8376e0f2bd56712 (patch)
tree361fbbe3c90adaa54cb1c894ad108647224cdd3f /src/flash/flash.c
parent6b9bb584a5edec4889b12ed3f99a1e2eeab1ada2 (diff)
downloadopenocd+libswd-ad090413a8dfacccc993ff15b8376e0f2bd56712.tar.gz
openocd+libswd-ad090413a8dfacccc993ff15b8376e0f2bd56712.tar.bz2
openocd+libswd-ad090413a8dfacccc993ff15b8376e0f2bd56712.tar.xz
openocd+libswd-ad090413a8dfacccc993ff15b8376e0f2bd56712.zip
remove flash_driver->register_callbacks
Replace flash_driver callback with pointer to command_registration. Eliminates all related routines and allows drivers to omit commands.
Diffstat (limited to 'src/flash/flash.c')
-rw-r--r--src/flash/flash.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/flash/flash.c b/src/flash/flash.c
index de95b62f..4584c5d0 100644
--- a/src/flash/flash.c
+++ b/src/flash/flash.c
@@ -263,15 +263,20 @@ COMMAND_HANDLER(handle_flash_bank_command)
if (strcmp(driver_name, flash_drivers[i]->name) != 0)
continue;
- struct flash_bank *p, *c;
-
/* register flash specific commands */
- if (flash_drivers[i]->register_commands(CMD_CTX) != ERROR_OK)
+ if (NULL != flash_drivers[i]->commands)
{
- LOG_ERROR("couldn't register '%s' commands", driver_name);
- return ERROR_FAIL;
+ int retval = register_commands(CMD_CTX, NULL,
+ flash_drivers[i]->commands);
+ if (ERROR_OK != retval)
+ {
+ LOG_ERROR("couldn't register '%s' commands",
+ driver_name);
+ return ERROR_FAIL;
+ }
}
+ struct flash_bank *p, *c;
c = malloc(sizeof(struct flash_bank));
c->name = strdup(bank_name);
c->target = target;