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:
|
case JTAG_RESET:
|
||||||
LOG_DEBUG_IO("reset trst: %i srst %i", cmd->cmd.reset->trst, cmd->cmd.reset->srst);
|
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 &&
|
(cmd->cmd.reset->srst &&
|
||||||
(jtag_get_reset_config() & RESET_SRST_PULLS_TRST))) {
|
(jtag_get_reset_config() & RESET_SRST_PULLS_TRST)))
|
||||||
tap_set_state(TAP_RESET);
|
tap_set_state(TAP_RESET);
|
||||||
}
|
|
||||||
ft232r_reset(cmd->cmd.reset->trst, cmd->cmd.reset->srst);
|
ft232r_reset(cmd->cmd.reset->trst, cmd->cmd.reset->srst);
|
||||||
break;
|
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)
|
if (kitprog_swd_seq(SEQUENCE_JTAG_TO_SWD) != ERROR_OK)
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
break;
|
break;
|
||||||
} else {
|
}
|
||||||
LOG_DEBUG("JTAG to SWD not supported");
|
LOG_DEBUG("JTAG to SWD not supported");
|
||||||
/* Fall through to fix target reset issue */
|
/* Fall through to fix target reset issue */
|
||||||
}
|
|
||||||
/* fallthrough */
|
/* fallthrough */
|
||||||
case LINE_RESET:
|
case LINE_RESET:
|
||||||
LOG_DEBUG("SWD 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:
|
case DTCLOAD_LOAD:
|
||||||
/* Send the DTC program to ST7 RAM. */
|
/* Send the DTC program to ST7 RAM. */
|
||||||
usb_err = ep1_memory_write(
|
usb_err = ep1_memory_write(hdev_param, DTC_LOAD_BUFFER,
|
||||||
hdev_param,
|
header->length + 1, buffer);
|
||||||
DTC_LOAD_BUFFER,
|
|
||||||
header->length + 1, buffer
|
|
||||||
);
|
|
||||||
if (usb_err < 0)
|
if (usb_err < 0)
|
||||||
return usb_err;
|
return usb_err;
|
||||||
|
|
||||||
/* Load it into the DTC. */
|
/* Load it into the DTC. */
|
||||||
usb_err = ep1_generic_commandl(
|
usb_err = ep1_generic_commandl(hdev_param, 3, EP1_CMD_DTC_LOAD,
|
||||||
hdev_param, 3,
|
(DTC_LOAD_BUFFER >> 8), DTC_LOAD_BUFFER);
|
||||||
EP1_CMD_DTC_LOAD,
|
|
||||||
(DTC_LOAD_BUFFER >> 8),
|
|
||||||
DTC_LOAD_BUFFER
|
|
||||||
);
|
|
||||||
if (usb_err < 0)
|
if (usb_err < 0)
|
||||||
return usb_err;
|
return usb_err;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DTCLOAD_RUN:
|
case DTCLOAD_RUN:
|
||||||
usb_err = ep1_generic_commandl(
|
usb_err = ep1_generic_commandl(hdev_param, 3, EP1_CMD_DTC_CALL,
|
||||||
hdev_param, 3,
|
buffer[0], EP1_CMD_DTC_WAIT);
|
||||||
EP1_CMD_DTC_CALL,
|
|
||||||
buffer[0],
|
|
||||||
EP1_CMD_DTC_WAIT
|
|
||||||
);
|
|
||||||
if (usb_err < 0)
|
if (usb_err < 0)
|
||||||
return usb_err;
|
return usb_err;
|
||||||
|
|
||||||
@@ -369,11 +358,8 @@ static int dtc_load_from_buffer(struct libusb_device_handle *hdev_param, const u
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case DTCLOAD_LUT:
|
case DTCLOAD_LUT:
|
||||||
usb_err = ep1_memory_write(
|
usb_err = ep1_memory_write(hdev_param,
|
||||||
hdev_param,
|
ST7_USB_BUF_EP0OUT + lut_start, header->length + 1, buffer);
|
||||||
ST7_USB_BUF_EP0OUT + lut_start,
|
|
||||||
header->length + 1, buffer
|
|
||||||
);
|
|
||||||
if (usb_err < 0)
|
if (usb_err < 0)
|
||||||
return usb_err;
|
return usb_err;
|
||||||
break;
|
break;
|
||||||
@@ -1300,7 +1286,7 @@ static int rlink_execute_queue(struct jtag_command *cmd_queue)
|
|||||||
LOG_DEBUG_IO("reset trst: %i srst %i",
|
LOG_DEBUG_IO("reset trst: %i srst %i",
|
||||||
cmd->cmd.reset->trst,
|
cmd->cmd.reset->trst,
|
||||||
cmd->cmd.reset->srst);
|
cmd->cmd.reset->srst);
|
||||||
if ((cmd->cmd.reset->trst == 1) ||
|
if (cmd->cmd.reset->trst == 1 ||
|
||||||
(cmd->cmd.reset->srst &&
|
(cmd->cmd.reset->srst &&
|
||||||
(jtag_get_reset_config() & RESET_SRST_PULLS_TRST)))
|
(jtag_get_reset_config() & RESET_SRST_PULLS_TRST)))
|
||||||
tap_set_state(TAP_RESET);
|
tap_set_state(TAP_RESET);
|
||||||
|
|||||||
@@ -528,17 +528,16 @@ static int ulink_allocate_payload(struct ulink_cmd *ulink_cmd, int size,
|
|||||||
LOG_ERROR("BUG: Duplicate payload allocation for OpenULINK command");
|
LOG_ERROR("BUG: Duplicate payload allocation for OpenULINK command");
|
||||||
free(payload);
|
free(payload);
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
} else {
|
}
|
||||||
ulink_cmd->payload_out = payload;
|
ulink_cmd->payload_out = payload;
|
||||||
ulink_cmd->payload_out_size = size;
|
ulink_cmd->payload_out_size = size;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case PAYLOAD_DIRECTION_IN:
|
case PAYLOAD_DIRECTION_IN:
|
||||||
if (ulink_cmd->payload_in_start) {
|
if (ulink_cmd->payload_in_start) {
|
||||||
LOG_ERROR("BUG: Duplicate payload allocation for OpenULINK command");
|
LOG_ERROR("BUG: Duplicate payload allocation for OpenULINK command");
|
||||||
free(payload);
|
free(payload);
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
} else {
|
}
|
||||||
ulink_cmd->payload_in_start = payload;
|
ulink_cmd->payload_in_start = payload;
|
||||||
ulink_cmd->payload_in = payload;
|
ulink_cmd->payload_in = payload;
|
||||||
ulink_cmd->payload_in_size = size;
|
ulink_cmd->payload_in_size = size;
|
||||||
@@ -547,7 +546,6 @@ static int ulink_allocate_payload(struct ulink_cmd *ulink_cmd, int size,
|
|||||||
* that do not want this behavior (e. g. split scans) must turn it off
|
* that do not want this behavior (e. g. split scans) must turn it off
|
||||||
* separately! */
|
* separately! */
|
||||||
ulink_cmd->free_payload_in_start = true;
|
ulink_cmd->free_payload_in_start = true;
|
||||||
}
|
|
||||||
break;
|
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);
|
ret = ulink_allocate_payload(cmd, scan_size_bytes + 5, PAYLOAD_DIRECTION_OUT);
|
||||||
break;
|
break;
|
||||||
default:
|
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;
|
ret = ERROR_FAIL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1832,8 +1830,7 @@ static int ulink_post_process_scan(struct ulink_cmd *ulink_cmd)
|
|||||||
ret = ERROR_OK;
|
ret = ERROR_OK;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
LOG_ERROR("BUG: ulink_post_process_scan() encountered an unknown"
|
LOG_ERROR("BUG: %s() encountered an unknown JTAG scan type", __func__);
|
||||||
" JTAG scan type");
|
|
||||||
ret = ERROR_FAIL;
|
ret = ERROR_FAIL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1877,8 +1874,7 @@ static int ulink_post_process_queue(struct ulink *device)
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ret = ERROR_FAIL;
|
ret = ERROR_FAIL;
|
||||||
LOG_ERROR("BUG: ulink_post_process_queue() encountered unknown JTAG "
|
LOG_ERROR("BUG: %s() encountered unknown JTAG command type", __func__);
|
||||||
"command type");
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user