Skip to content

Commit

Permalink
serial-{get,reset}-counter: Use same spacing as in Linux
Browse files Browse the repository at this point in the history
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
  • Loading branch information
miquelraynal authored and tpetazzoni committed Oct 29, 2021
1 parent 3849a78 commit 1406752
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 35 deletions.
Expand Up @@ -10,26 +10,26 @@

int main(int argc, char *argv[])
{
unsigned int val;
int fd, ret;
unsigned int val;
int fd, ret;

if (argc != 2) {
fprintf(stderr, "Usage: %s /dev/UART\n", argv[0]);
exit (1);
}
if (argc != 2) {
fprintf(stderr, "Usage: %s /dev/UART\n", argv[0]);
exit(1);
}

fd = open(argv[1], O_RDWR);
if (fd < 0) {
fprintf(stderr, "Unable to open %s\n", argv[1]);
exit (1);
}
fd = open(argv[1], O_RDWR);
if (fd < 0) {
fprintf(stderr, "Unable to open %s\n", argv[1]);
exit(1);
}

ret = ioctl(fd, SERIAL_GET_COUNTER, & val);
if (ret < 0) {
fprintf(stderr, "Unable to get counter\n");
exit (1);
}
ret = ioctl(fd, SERIAL_GET_COUNTER, &val);
if (ret < 0) {
fprintf(stderr, "Unable to get counter\n");
exit(1);
}

printf("Counter value: %d\n", val);
return 0;
printf("Counter value: %d\n", val);
return 0;
}
Expand Up @@ -10,25 +10,26 @@

int main(int argc, char *argv[])
{
int fd, ret;
int fd, ret;

if (argc != 2) {
fprintf(stderr, "Usage: %s /dev/UART\n", argv[0]);
exit (1);
}
if (argc != 2) {
fprintf(stderr, "Usage: %s /dev/UART\n", argv[0]);
exit(1);
}

fd = open(argv[1], O_RDWR);
if (fd < 0) {
fprintf(stderr, "Unable to open %s\n", argv[1]);
exit (1);
}
fd = open(argv[1], O_RDWR);
if (fd < 0) {
fprintf(stderr, "Unable to open %s\n", argv[1]);
exit(1);
}

ret = ioctl(fd, SERIAL_RESET_COUNTER);
if (ret < 0) {
fprintf(stderr, "Unable to reset counter\n");
exit (1);
}
ret = ioctl(fd, SERIAL_RESET_COUNTER);
if (ret < 0) {
fprintf(stderr, "Unable to reset counter\n");
exit(1);
}

printf("Counter reset\n");
return 0;

printf("Counter reset\n");
return 0;
}

0 comments on commit 1406752

Please sign in to comment.