diff options
author | Oliver Neukum <oneukum@suse.de> | 2013-11-18 13:23:05 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-12-03 10:28:39 -0800 |
commit | f848a88d223cafa43cb318839a1171b498cf5ec8 (patch) | |
tree | 9793c122c42fb70c5dc58b46cbb7c64a5bd5ccab /drivers/usb | |
parent | 063635ec3ac6d02cefce06038f2166bbff85d840 (diff) |
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: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/host/fotg210-hcd.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/usb/host/fotg210-hcd.c b/drivers/usb/host/fotg210-hcd.c index 15ee566e46cb..4acb6a451391 100644 --- a/drivers/usb/host/fotg210-hcd.c +++ b/drivers/usb/host/fotg210-hcd.c @@ -254,8 +254,8 @@ dbg_command_buf(char *buf, unsigned len, const char *label, u32 command) ); } -static int -dbg_port_buf(char *buf, unsigned len, const char *label, int port, u32 status) +static char +*dbg_port_buf(char *buf, unsigned len, const char *label, int port, u32 status) { char *sig; @@ -275,7 +275,7 @@ dbg_port_buf(char *buf, unsigned len, const char *label, int port, u32 status) break; } - return scnprintf(buf, len, + scnprintf(buf, len, "%s%sport:%d status %06x %d " "sig=%s%s%s%s%s%s%s%s", label, label[0] ? " " : "", port, 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_CSC) ? " CSC" : "", (status & PORT_CONNECT) ? " CONNECT" : ""); + return buf; } /* 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) #define dbg_port(fotg210, label, port, status) { \ char _buf[80]; \ - dbg_port_buf(_buf, sizeof(_buf), label, port, status); \ - fotg210_dbg(fotg210, "%s\n", _buf); \ + fotg210_dbg(fotg210, "%s\n", dbg_port_buf(_buf, sizeof(_buf), label, port, status) ); \ } /*-------------------------------------------------------------------------*/ |