Skip to content

Commit

Permalink
drivers/nutdrv_qx.c: armac_command(): avoid "-Wdeclaration-after-stat…
Browse files Browse the repository at this point in the history
…ement"

Also minor cleanup with comments markup

Signed-off-by: Jim Klimov <[email protected]>
  • Loading branch information
jimklimov authored Nov 22, 2023
1 parent 4cca5d7 commit 7a490af
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions drivers/nutdrv_qx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1950,10 +1950,6 @@ static int armac_command(const char *cmd, char *buf, size_t buflen)
bool_t use_interrupt = FALSE;
int read_size = ARMAC_READ_SIZE_FOR_CONTROL;

if (!armac_endpoint_cache.initialized) {
load_armac_endpoint_cache();
}

/* UPS ignores (doesn't echo back) unsupported commands which makes
* the initialization long. List commands tested to be unsupported:
*/
Expand All @@ -1966,6 +1962,10 @@ static int armac_command(const char *cmd, char *buf, size_t buflen)
NULL
};

if (!armac_endpoint_cache.initialized) {
load_armac_endpoint_cache();
}

for (i = 0; unsupported[i] != NULL; i++) {
if (strcmp(cmd, unsupported[i]) == 0) {
upsdebugx(2,
Expand All @@ -1977,7 +1977,7 @@ static int armac_command(const char *cmd, char *buf, size_t buflen)
upsdebugx(4, "armac command %.*s", (int)strcspn(cmd, "\r"), cmd);

#if WITH_LIBUSB_1_0
/* Be conservative and do not break old Armac Upses*/
/* Be conservative and do not break old Armac UPSes */
use_interrupt = armac_endpoint_cache.ok
&& armac_endpoint_cache.in_endpoint_address == 0x82
&& armac_endpoint_cache.in_bmAttributes & LIBUSB_TRANSFER_TYPE_INTERRUPT
Expand Down Expand Up @@ -2009,7 +2009,7 @@ static int armac_command(const char *cmd, char *buf, size_t buflen)
}

/* Send command to the UPS in 3-byte chunks. Most fit 1 chunk, except for eg.
* parameterized tests. */
* parameterized tests. */
for (i = 0; i < cmdlen;) {
const size_t bytes_to_send = (cmdlen <= (i + 3)) ? (cmdlen - i) : 3;
memset(tmpbuf, 0, sizeof(tmpbuf));
Expand Down

0 comments on commit 7a490af

Please sign in to comment.