Commit f848a88d authored by Oliver Neukum's avatar Oliver Neukum Committed by Greg Kroah-Hartman

fotg210: change dbg_port() to evaluate parameters only if needed

For dynamic debug the overhead for evaluating parameters must
be sacrificed only if the message is actually printed
Signed-off-by: default avatarOliver Neukum <oneukum@suse.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 063635ec
...@@ -254,8 +254,8 @@ dbg_command_buf(char *buf, unsigned len, const char *label, u32 command) ...@@ -254,8 +254,8 @@ dbg_command_buf(char *buf, unsigned len, const char *label, u32 command)
); );
} }
static int static char
dbg_port_buf(char *buf, unsigned len, const char *label, int port, u32 status) *dbg_port_buf(char *buf, unsigned len, const char *label, int port, u32 status)
{ {
char *sig; char *sig;
...@@ -275,7 +275,7 @@ dbg_port_buf(char *buf, unsigned len, const char *label, int port, u32 status) ...@@ -275,7 +275,7 @@ dbg_port_buf(char *buf, unsigned len, const char *label, int port, u32 status)
break; break;
} }
return scnprintf(buf, len, scnprintf(buf, len,
"%s%sport:%d status %06x %d " "%s%sport:%d status %06x %d "
"sig=%s%s%s%s%s%s%s%s", "sig=%s%s%s%s%s%s%s%s",
label, label[0] ? " " : "", port, status, label, label[0] ? " " : "", port, status,
...@@ -288,6 +288,7 @@ dbg_port_buf(char *buf, unsigned len, const char *label, int port, u32 status) ...@@ -288,6 +288,7 @@ dbg_port_buf(char *buf, unsigned len, const char *label, int port, u32 status)
(status & PORT_PE) ? " PE" : "", (status & PORT_PE) ? " PE" : "",
(status & PORT_CSC) ? " CSC" : "", (status & PORT_CSC) ? " CSC" : "",
(status & PORT_CONNECT) ? " CONNECT" : ""); (status & PORT_CONNECT) ? " CONNECT" : "");
return buf;
} }
/* functions have the "wrong" filename when they're output... */ /* functions have the "wrong" filename when they're output... */
...@@ -305,8 +306,7 @@ dbg_port_buf(char *buf, unsigned len, const char *label, int port, u32 status) ...@@ -305,8 +306,7 @@ dbg_port_buf(char *buf, unsigned len, const char *label, int port, u32 status)
#define dbg_port(fotg210, label, port, status) { \ #define dbg_port(fotg210, label, port, status) { \
char _buf[80]; \ char _buf[80]; \
dbg_port_buf(_buf, sizeof(_buf), label, port, status); \ fotg210_dbg(fotg210, "%s\n", dbg_port_buf(_buf, sizeof(_buf), label, port, status) ); \
fotg210_dbg(fotg210, "%s\n", _buf); \
} }
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment