mirror of
https://github.com/linux-can/can-utils.git
synced 2026-09-22 08:06:34 +02:00
lib: add pr_debug() macro
Add the pr_debug() macro so that:
#ifdef DEBUG
printf("foo");
#endif
can be replaced by:
pr_debug("foo");
Apply the pr_debug() macro wherever relevant.
Currently, there is no consensus whether debug messages should be
printed on stdout or stderr. Most of the modules: canbusload.c,
candump.c and canlogserver.c use stdout but
mcp251xfd/mcp251xfd-dev-coredump.c uses stderr. Harmonize the behavior
by following the major trend and make
mcp251xfd/mcp251xfd-dev-coredump.c also output to stdout.
slcanpty.c does a #define DEBUG, meaning that debug is always turned
on for this file. Remove this and make debug an option like every
other files.
Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>
Link: https://lore.kernel.org/all/20221114163848.3398-5-mailhol.vincent@wanadoo.fr
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
This commit is contained in:
committed by
Marc Kleine-Budde
parent
21fb43532e
commit
0cfd56d613
+3
-7
@@ -49,8 +49,6 @@
|
||||
#define SLC_MTU (sizeof("T1111222281122334455667788EA5F\r")+1)
|
||||
#define DEVICE_NAME_PTMX "/dev/ptmx"
|
||||
|
||||
#define DEBUG
|
||||
|
||||
/* read data from pty, send CAN frames to CAN socket and answer commands */
|
||||
int pty2can(int pty, int socket, struct can_filter *fi,
|
||||
int *is_open, int *tstamp)
|
||||
@@ -106,14 +104,12 @@ rx_restart:
|
||||
cmd = buf[0];
|
||||
buf[nbytes] = 0;
|
||||
|
||||
#ifdef DEBUG
|
||||
for (tmp = 0; tmp < nbytes; tmp++)
|
||||
if (buf[tmp] == '\r')
|
||||
putchar('@');
|
||||
pr_debug("@");
|
||||
else
|
||||
putchar(buf[tmp]);
|
||||
printf("\n");
|
||||
#endif
|
||||
pr_debug("%c", buf[tmp]);
|
||||
pr_debug("\n");
|
||||
|
||||
/* check for filter configuration commands */
|
||||
if (cmd == 'm' || cmd == 'M') {
|
||||
|
||||
Reference in New Issue
Block a user