canutils: Fix minor style issue found in canlib

no functional change

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2024-04-07 13:28:07 +08:00 committed by Alan Carvalho de Assis
parent f633d11b63
commit 9d67f38062
7 changed files with 21 additions and 58 deletions

View File

@ -22,15 +22,10 @@
* Included Files * Included Files
****************************************************************************/ ****************************************************************************/
#include <nuttx/config.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <debug.h> #include <debug.h>
#include <errno.h> #include <errno.h>
#include <nuttx/can/can.h> #include <nuttx/can/can.h>
/**************************************************************************** /****************************************************************************
@ -63,10 +58,9 @@ int canlib_getbaud(int fd, FAR int *bauds)
if (ret != OK) if (ret != OK)
{ {
canerr("CANIOC_GET_BITTIMING failed, errno=%d\n", errno); canerr("CANIOC_GET_BITTIMING failed, errno=%d\n", errno);
return 0; return ret;
} }
*bauds = timings.bt_baud; *bauds = timings.bt_baud;
return ret; return ret;
} }

View File

@ -22,16 +22,10 @@
* Included Files * Included Files
****************************************************************************/ ****************************************************************************/
#include <nuttx/config.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <fcntl.h>
#include <debug.h> #include <debug.h>
#include <errno.h> #include <errno.h>
#include <nuttx/can/can.h> #include <nuttx/can/can.h>
/**************************************************************************** /****************************************************************************
@ -64,10 +58,9 @@ int canlib_getloopback(int fd, FAR bool *loopback)
if (ret != OK) if (ret != OK)
{ {
canerr("CANIOC_GET_CONNMODES failed, errno=%d\n", errno); canerr("CANIOC_GET_CONNMODES failed, errno=%d\n", errno);
return FALSE; return ret;
} }
*loopback = (bool)connmodes.bm_loopback; *loopback = connmodes.bm_loopback;
return ret; return ret;
} }

View File

@ -22,16 +22,10 @@
* Included Files * Included Files
****************************************************************************/ ****************************************************************************/
#include <nuttx/config.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <fcntl.h>
#include <debug.h> #include <debug.h>
#include <errno.h> #include <errno.h>
#include <nuttx/can/can.h> #include <nuttx/can/can.h>
/**************************************************************************** /****************************************************************************
@ -45,8 +39,8 @@
* Wrapper for CANIOC_GET_CONNMODES. * Wrapper for CANIOC_GET_CONNMODES.
* *
* Input Parameter: * Input Parameter:
* fd - file descriptor of an opened can device * fd - file descriptor of an opened can device
* loopback - pointer to a buffer to store the current silent mode state. * silent - pointer to a buffer to store the current silent mode state.
* *
* Returned Value: * Returned Value:
* Zero (OK) is returned on success. Otherwise -1 (ERROR) * Zero (OK) is returned on success. Otherwise -1 (ERROR)
@ -64,10 +58,9 @@ int canlib_getsilent(int fd, FAR bool *silent)
if (ret != OK) if (ret != OK)
{ {
canerr("CANIOC_GET_CONNMODES failed, errno=%d\n", errno); canerr("CANIOC_GET_CONNMODES failed, errno=%d\n", errno);
return FALSE; return ret;
} }
*silent = (bool)connmodes.bm_silent; *silent = connmodes.bm_silent;
return ret; return ret;
} }

View File

@ -22,15 +22,10 @@
* Included Files * Included Files
****************************************************************************/ ****************************************************************************/
#include <nuttx/config.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <debug.h> #include <debug.h>
#include <errno.h> #include <errno.h>
#include <nuttx/can/can.h> #include <nuttx/can/can.h>
/**************************************************************************** /****************************************************************************

View File

@ -22,16 +22,10 @@
* Included Files * Included Files
****************************************************************************/ ****************************************************************************/
#include <nuttx/config.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <fcntl.h>
#include <debug.h> #include <debug.h>
#include <errno.h> #include <errno.h>
#include <nuttx/can/can.h> #include <nuttx/can/can.h>
/**************************************************************************** /****************************************************************************

View File

@ -22,16 +22,10 @@
* Included Files * Included Files
****************************************************************************/ ****************************************************************************/
#include <nuttx/config.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <fcntl.h>
#include <debug.h> #include <debug.h>
#include <errno.h> #include <errno.h>
#include <nuttx/can/can.h> #include <nuttx/can/can.h>
/**************************************************************************** /****************************************************************************
@ -46,8 +40,8 @@
* peripheral never transmits on the bus, but receives all bus traffic. * peripheral never transmits on the bus, but receives all bus traffic.
* *
* Input Parameter: * Input Parameter:
* fd - file descriptor of an opened can device * fd - file descriptor of an opened can device
* loopback - whether to use loopback mode. * silent - whether to use silent mode.
* *
* Returned Value: * Returned Value:
* Zero (OK) is returned on success. Otherwise -1 (ERROR) * Zero (OK) is returned on success. Otherwise -1 (ERROR)

View File

@ -107,6 +107,8 @@ int canlib_getbaud(int fd, FAR int *bauds);
* *
****************************************************************************/ ****************************************************************************/
int canlib_setloopback(int fd, bool loop);
/**************************************************************************** /****************************************************************************
* Name: canlib_getloopback * Name: canlib_getloopback
* *
@ -124,8 +126,6 @@ int canlib_getbaud(int fd, FAR int *bauds);
* *
****************************************************************************/ ****************************************************************************/
int canlib_setloopback(int fd, bool loop);
int canlib_getloopback(int fd, FAR bool *loop); int canlib_getloopback(int fd, FAR bool *loop);
/**************************************************************************** /****************************************************************************
@ -136,8 +136,8 @@ int canlib_getloopback(int fd, FAR bool *loop);
* peripheral never transmits on the bus, but receives all bus traffic. * peripheral never transmits on the bus, but receives all bus traffic.
* *
* Input Parameter: * Input Parameter:
* fd - file descriptor of an opened can device * fd - file descriptor of an opened can device
* loopback - whether to use loopback mode. * silent - whether to use silent mode.
* *
* Returned Value: * Returned Value:
* Zero (OK) is returned on success. Otherwise -1 (ERROR) * Zero (OK) is returned on success. Otherwise -1 (ERROR)
@ -155,8 +155,8 @@ int canlib_setsilent(int fd, bool silent);
* Wrapper for CANIOC_GET_CONNMODES. * Wrapper for CANIOC_GET_CONNMODES.
* *
* Input Parameter: * Input Parameter:
* fd - file descriptor of an opened can device * fd - file descriptor of an opened can device
* loopback - pointer to a buffer to store the current silent mode state. * silent - pointer to a buffer to store the current silent mode state.
* *
* Returned Value: * Returned Value:
* Zero (OK) is returned on success. Otherwise -1 (ERROR) * Zero (OK) is returned on success. Otherwise -1 (ERROR)