[usb_host][usb_cdc_acm][tinyusb] Fix clang-tidy findings (#16836)

This commit is contained in:
Jonathan Swoboda
2026-06-05 11:55:39 -04:00
committed by GitHub
parent 61bb1805b1
commit 80c84d6665
5 changed files with 8 additions and 8 deletions

View File

@@ -6,7 +6,7 @@
namespace esphome::tinyusb {
static const char *TAG = "tinyusb";
static const char *const TAG = "tinyusb";
void TinyUSB::setup() {
// Use the device's MAC address as its serial number if no serial number is defined

View File

@@ -17,7 +17,7 @@ enum USBDStringDescriptor : uint8_t {
SIZE = 6,
};
static const char *DEFAULT_USB_STR = "ESPHome";
static const char *const DEFAULT_USB_STR = "ESPHome";
class TinyUSB : public Component {
public:

View File

@@ -96,9 +96,9 @@ static void tinyusb_cdc_line_coding_changed_callback(int itf, cdcacm_event_t *ev
}
static esp_err_t ringbuf_read_bytes(RingbufHandle_t ring_buf, uint8_t *out_buf, size_t out_buf_sz, size_t *rx_data_size,
TickType_t xTicksToWait) {
TickType_t x_ticks_to_wait) {
size_t read_sz;
uint8_t *buf = static_cast<uint8_t *>(xRingbufferReceiveUpTo(ring_buf, &read_sz, xTicksToWait, out_buf_sz));
uint8_t *buf = static_cast<uint8_t *>(xRingbufferReceiveUpTo(ring_buf, &read_sz, x_ticks_to_wait, out_buf_sz));
if (buf == nullptr) {
return ESP_FAIL;
@@ -186,7 +186,7 @@ void USBCDCACMInstance::usb_tx_task() {
uint8_t data[CONFIG_TINYUSB_CDC_TX_BUFSIZE] = {0};
size_t tx_data_size = 0;
while (1) {
while (true) {
// Wait for a notification from the bridge component
ulTaskNotifyTake(pdTRUE, portMAX_DELAY);

View File

@@ -167,7 +167,7 @@ class USBClient : public Component {
// USB task management
static void usb_task_fn(void *arg);
[[noreturn]] void usb_task_loop() const;
[[noreturn]] void usb_task_loop_() const;
// Members ordered to minimize struct padding on 32-bit platforms
TransferRequest requests_[MAX_REQUESTS]{};

View File

@@ -236,9 +236,9 @@ void USBClient::setup() {
void USBClient::usb_task_fn(void *arg) {
auto *client = static_cast<USBClient *>(arg);
client->usb_task_loop();
client->usb_task_loop_();
}
void USBClient::usb_task_loop() const {
void USBClient::usb_task_loop_() const {
while (true) {
usb_host_client_handle_events(this->handle_, portMAX_DELAY);
}