From: Oliver Neukum <oneu...@suse.de>

Rewrite for little overhead so that it can be used
in interrupt handlers for dynamic debugging

Signed-off-by: Oliver Neukum <oneu...@suse.de>
---
 drivers/usb/host/fusbh200-hcd.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/drivers/usb/host/fusbh200-hcd.c b/drivers/usb/host/fusbh200-hcd.c
index 17374a3..70d2b01 100644
--- a/drivers/usb/host/fusbh200-hcd.c
+++ b/drivers/usb/host/fusbh200-hcd.c
@@ -202,10 +202,10 @@ dbg_itd (const char *label, struct fusbh200_hcd 
*fusbh200, struct fusbh200_itd *
                itd->index[6], itd->index[7]);
 }
 
-static int __maybe_unused
-dbg_status_buf (char *buf, unsigned len, const char *label, u32 status)
+static char
+*dbg_status_buf(char *buf, unsigned len, const char *label, u32 status)
 {
-       return scnprintf (buf, len,
+       scnprintf (buf, len,
                "%s%sstatus %04x%s%s%s%s%s%s%s%s%s%s",
                label, label [0] ? " " : "", status,
                (status & STS_ASS) ? " Async" : "",
@@ -219,6 +219,7 @@ dbg_status_buf (char *buf, unsigned len, const char *label, 
u32 status)
                (status & STS_ERR) ? " ERR" : "",
                (status & STS_INT) ? " INT" : ""
                );
+       return buf;
 }
 
 static int __maybe_unused
@@ -289,8 +290,7 @@ dbg_port_buf (char *buf, unsigned len, const char *label, 
int port, u32 status)
 /* functions have the "wrong" filename when they're output... */
 #define dbg_status(fusbh200, label, status) { \
        char _buf [80]; \
-       dbg_status_buf (_buf, sizeof _buf, label, status); \
-       fusbh200_dbg (fusbh200, "%s\n", _buf); \
+       fusbh200_dbg (fusbh200, "%s\n", dbg_status_buf(_buf, sizeof _buf, 
label, status)); \
 }
 
 #define dbg_cmd(fusbh200, label, command) { \
@@ -706,7 +706,7 @@ static ssize_t fill_registers_buffer(struct debug_buffer 
*buf)
        next += temp;
 
        /* Operational Registers */
-       temp = dbg_status_buf (scratch, sizeof scratch, label,
+       dbg_status_buf (scratch, sizeof scratch, label,
                        fusbh200_readl(fusbh200, &fusbh200->regs->status));
        temp = scnprintf (next, size, fmt, temp, scratch);
        size -= temp;
@@ -5326,10 +5326,8 @@ static irqreturn_t fusbh200_irq (struct usb_hcd *hcd)
        cmd = fusbh200_readl(fusbh200, &fusbh200->regs->command);
        bh = 0;
 
-#ifdef VERBOSE_DEBUG
        /* unrequested/ignored: Frame List Rollover */
-       dbg_status (fusbh200, "irq", status);
-#endif
+       dbg_status(fusbh200, "irq", status);
 
        /* INT, ERR, and IAA interrupt rates can be throttled */
 
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to