mirror of
https://github.com/openocd-org/openocd.git
synced 2025-10-14 02:58:23 +08:00
jtag: drivers: prepare for aligning switch and case statements
To prepare for aligning switch and case statements, fix in advance some checkpatch error due to existing code: - remove 'else' after return and break; - use '__func__' in place of hardcoded function name; - remove useless parenthesis; - don't end line with an open parenthesis. Change-Id: I6a9905e5a30c90456de562e727dd2dfe2fda10c4 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/9054 Reviewed-by: zapb <dev@zapb.de> Tested-by: jenkins
This commit is contained in:
@@ -821,11 +821,11 @@ static int syncbb_execute_queue(struct jtag_command *cmd_queue)
|
||||
case JTAG_RESET:
|
||||
LOG_DEBUG_IO("reset trst: %i srst %i", cmd->cmd.reset->trst, cmd->cmd.reset->srst);
|
||||
|
||||
if ((cmd->cmd.reset->trst == 1) ||
|
||||
(cmd->cmd.reset->srst &&
|
||||
(jtag_get_reset_config() & RESET_SRST_PULLS_TRST))) {
|
||||
if (cmd->cmd.reset->trst == 1 ||
|
||||
(cmd->cmd.reset->srst &&
|
||||
(jtag_get_reset_config() & RESET_SRST_PULLS_TRST)))
|
||||
tap_set_state(TAP_RESET);
|
||||
}
|
||||
|
||||
ft232r_reset(cmd->cmd.reset->trst, cmd->cmd.reset->srst);
|
||||
break;
|
||||
|
||||
|
@@ -652,10 +652,9 @@ static int kitprog_swd_switch_seq(enum swd_special_seq seq)
|
||||
if (kitprog_swd_seq(SEQUENCE_JTAG_TO_SWD) != ERROR_OK)
|
||||
return ERROR_FAIL;
|
||||
break;
|
||||
} else {
|
||||
LOG_DEBUG("JTAG to SWD not supported");
|
||||
/* Fall through to fix target reset issue */
|
||||
}
|
||||
LOG_DEBUG("JTAG to SWD not supported");
|
||||
/* Fall through to fix target reset issue */
|
||||
/* fallthrough */
|
||||
case LINE_RESET:
|
||||
LOG_DEBUG("SWD line reset");
|
||||
|
@@ -332,33 +332,22 @@ static int dtc_load_from_buffer(struct libusb_device_handle *hdev_param, const u
|
||||
|
||||
case DTCLOAD_LOAD:
|
||||
/* Send the DTC program to ST7 RAM. */
|
||||
usb_err = ep1_memory_write(
|
||||
hdev_param,
|
||||
DTC_LOAD_BUFFER,
|
||||
header->length + 1, buffer
|
||||
);
|
||||
usb_err = ep1_memory_write(hdev_param, DTC_LOAD_BUFFER,
|
||||
header->length + 1, buffer);
|
||||
if (usb_err < 0)
|
||||
return usb_err;
|
||||
|
||||
/* Load it into the DTC. */
|
||||
usb_err = ep1_generic_commandl(
|
||||
hdev_param, 3,
|
||||
EP1_CMD_DTC_LOAD,
|
||||
(DTC_LOAD_BUFFER >> 8),
|
||||
DTC_LOAD_BUFFER
|
||||
);
|
||||
usb_err = ep1_generic_commandl(hdev_param, 3, EP1_CMD_DTC_LOAD,
|
||||
(DTC_LOAD_BUFFER >> 8), DTC_LOAD_BUFFER);
|
||||
if (usb_err < 0)
|
||||
return usb_err;
|
||||
|
||||
break;
|
||||
|
||||
case DTCLOAD_RUN:
|
||||
usb_err = ep1_generic_commandl(
|
||||
hdev_param, 3,
|
||||
EP1_CMD_DTC_CALL,
|
||||
buffer[0],
|
||||
EP1_CMD_DTC_WAIT
|
||||
);
|
||||
usb_err = ep1_generic_commandl(hdev_param, 3, EP1_CMD_DTC_CALL,
|
||||
buffer[0], EP1_CMD_DTC_WAIT);
|
||||
if (usb_err < 0)
|
||||
return usb_err;
|
||||
|
||||
@@ -369,11 +358,8 @@ static int dtc_load_from_buffer(struct libusb_device_handle *hdev_param, const u
|
||||
break;
|
||||
|
||||
case DTCLOAD_LUT:
|
||||
usb_err = ep1_memory_write(
|
||||
hdev_param,
|
||||
ST7_USB_BUF_EP0OUT + lut_start,
|
||||
header->length + 1, buffer
|
||||
);
|
||||
usb_err = ep1_memory_write(hdev_param,
|
||||
ST7_USB_BUF_EP0OUT + lut_start, header->length + 1, buffer);
|
||||
if (usb_err < 0)
|
||||
return usb_err;
|
||||
break;
|
||||
@@ -1300,7 +1286,7 @@ static int rlink_execute_queue(struct jtag_command *cmd_queue)
|
||||
LOG_DEBUG_IO("reset trst: %i srst %i",
|
||||
cmd->cmd.reset->trst,
|
||||
cmd->cmd.reset->srst);
|
||||
if ((cmd->cmd.reset->trst == 1) ||
|
||||
if (cmd->cmd.reset->trst == 1 ||
|
||||
(cmd->cmd.reset->srst &&
|
||||
(jtag_get_reset_config() & RESET_SRST_PULLS_TRST)))
|
||||
tap_set_state(TAP_RESET);
|
||||
|
@@ -528,26 +528,24 @@ static int ulink_allocate_payload(struct ulink_cmd *ulink_cmd, int size,
|
||||
LOG_ERROR("BUG: Duplicate payload allocation for OpenULINK command");
|
||||
free(payload);
|
||||
return ERROR_FAIL;
|
||||
} else {
|
||||
ulink_cmd->payload_out = payload;
|
||||
ulink_cmd->payload_out_size = size;
|
||||
}
|
||||
ulink_cmd->payload_out = payload;
|
||||
ulink_cmd->payload_out_size = size;
|
||||
break;
|
||||
case PAYLOAD_DIRECTION_IN:
|
||||
if (ulink_cmd->payload_in_start) {
|
||||
LOG_ERROR("BUG: Duplicate payload allocation for OpenULINK command");
|
||||
free(payload);
|
||||
return ERROR_FAIL;
|
||||
} else {
|
||||
ulink_cmd->payload_in_start = payload;
|
||||
ulink_cmd->payload_in = payload;
|
||||
ulink_cmd->payload_in_size = size;
|
||||
|
||||
/* By default, free payload_in_start in ulink_clear_queue(). Commands
|
||||
* that do not want this behavior (e. g. split scans) must turn it off
|
||||
* separately! */
|
||||
ulink_cmd->free_payload_in_start = true;
|
||||
}
|
||||
ulink_cmd->payload_in_start = payload;
|
||||
ulink_cmd->payload_in = payload;
|
||||
ulink_cmd->payload_in_size = size;
|
||||
|
||||
/* By default, free payload_in_start in ulink_clear_queue(). Commands
|
||||
* that do not want this behavior (e. g. split scans) must turn it off
|
||||
* separately! */
|
||||
ulink_cmd->free_payload_in_start = true;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -903,7 +901,7 @@ static int ulink_append_scan_cmd(struct ulink *device, enum scan_type scan_type,
|
||||
ret = ulink_allocate_payload(cmd, scan_size_bytes + 5, PAYLOAD_DIRECTION_OUT);
|
||||
break;
|
||||
default:
|
||||
LOG_ERROR("BUG: ulink_append_scan_cmd() encountered an unknown scan type");
|
||||
LOG_ERROR("BUG: %s() encountered an unknown scan type", __func__);
|
||||
ret = ERROR_FAIL;
|
||||
break;
|
||||
}
|
||||
@@ -1832,8 +1830,7 @@ static int ulink_post_process_scan(struct ulink_cmd *ulink_cmd)
|
||||
ret = ERROR_OK;
|
||||
break;
|
||||
default:
|
||||
LOG_ERROR("BUG: ulink_post_process_scan() encountered an unknown"
|
||||
" JTAG scan type");
|
||||
LOG_ERROR("BUG: %s() encountered an unknown JTAG scan type", __func__);
|
||||
ret = ERROR_FAIL;
|
||||
break;
|
||||
}
|
||||
@@ -1877,8 +1874,7 @@ static int ulink_post_process_queue(struct ulink *device)
|
||||
break;
|
||||
default:
|
||||
ret = ERROR_FAIL;
|
||||
LOG_ERROR("BUG: ulink_post_process_queue() encountered unknown JTAG "
|
||||
"command type");
|
||||
LOG_ERROR("BUG: %s() encountered unknown JTAG command type", __func__);
|
||||
break;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user