vsllink: use register_commands()
authorZachary T Welch <zw@superlucidity.net>
Sat, 21 Nov 2009 05:06:28 +0000 (21:06 -0800)
committerZachary T Welch <zw@superlucidity.net>
Wed, 25 Nov 2009 05:37:33 +0000 (21:37 -0800)
Use register_commands() with command registration array.

src/jtag/vsllink.c

index 3526198..8287e84 100644 (file)
@@ -1856,28 +1856,43 @@ static void vsllink_debug_buffer(uint8_t *buffer, int length)
 }
 #endif // _DEBUG_USB_COMMS_ || _DEBUG_JTAG_IO_
 
+static const struct command_registration vsllink_command_handlers[] = {
+       {
+               .name = "vsllink_usb_vid",
+               .handler = &vsllink_handle_usb_vid_command,
+               .mode = COMMAND_CONFIG,
+       },
+       {
+               .name = "vsllink_usb_pid",
+               .handler = &vsllink_handle_usb_pid_command,
+               .mode = COMMAND_CONFIG,
+       },
+       {
+               .name = "vsllink_usb_bulkin",
+               .handler = &vsllink_handle_usb_bulkin_command,
+               .mode = COMMAND_CONFIG,
+       },
+       {
+               .name = "vsllink_usb_bulkout",
+               .handler = &vsllink_handle_usb_bulkout_command,
+               .mode = COMMAND_CONFIG,
+       },
+       {
+               .name = "vsllink_usb_interface",
+               .handler = &vsllink_handle_usb_interface_command,
+               .mode = COMMAND_CONFIG,
+       },
+       {
+               .name = "vsllink_mode",
+               .handler = &vsllink_handle_mode_command,
+               .mode = COMMAND_CONFIG,
+       },
+       COMMAND_REGISTRATION_DONE
+};
+
 static int vsllink_register_commands(struct command_context *cmd_ctx)
 {
-       COMMAND_REGISTER(cmd_ctx, NULL, "vsllink_usb_vid",
-                       vsllink_handle_usb_vid_command, COMMAND_CONFIG,
-                       NULL);
-       COMMAND_REGISTER(cmd_ctx, NULL, "vsllink_usb_pid",
-                       vsllink_handle_usb_pid_command, COMMAND_CONFIG,
-                       NULL);
-       COMMAND_REGISTER(cmd_ctx, NULL, "vsllink_usb_bulkin",
-                       vsllink_handle_usb_bulkin_command, COMMAND_CONFIG,
-                       NULL);
-       COMMAND_REGISTER(cmd_ctx, NULL, "vsllink_usb_bulkout",
-                       vsllink_handle_usb_bulkout_command, COMMAND_CONFIG,
-                       NULL);
-       COMMAND_REGISTER(cmd_ctx, NULL, "vsllink_usb_interface",
-                       vsllink_handle_usb_interface_command, COMMAND_CONFIG,
-                       NULL);
-       COMMAND_REGISTER(cmd_ctx, NULL, "vsllink_mode",
-                       vsllink_handle_mode_command, COMMAND_CONFIG,
-                       NULL);
-
-       return ERROR_OK;
+       return register_commands(cmd_ctx, NULL, vsllink_command_handlers);
 }
 
 struct jtag_interface vsllink_interface = {