summaryrefslogtreecommitdiffstats
path: root/drivers/usb/storage/debug.c
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2013-04-16 22:44:07 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-04-17 10:01:22 -0700
commit75b9130e8af64c6878a1aa396a8446f3ce2cfb49 (patch)
tree64337c23d416ce01c1ac2449143c478ad7379704 /drivers/usb/storage/debug.c
parent61ac6ac8d662ac7ac67c864954d39d1b19948354 (diff)
usb: storage: Add usb_stor_dbg, reduce object size
Reduce the size of the objects by consolidating the duplicated USB_STORAGE into a single function. Add function usb_stor_dbg to emit debugging messages. Always validate the format and arguments. Reduce the number of uses of CONFIG_USB_STORAGE_DEBUG. Reduces size of objects ~7KB when CONFIG_USB_STORAGE_DEBUG is set. $ size drivers/usb/storage/built-in.o* text data bss dec hex filename 140133 55296 70312 265741 40e0d drivers/usb/storage/built-in.o.new 147494 55248 70296 273038 42a8e drivers/usb/storage/built-in.o.old Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/storage/debug.c')
-rw-r--r--drivers/usb/storage/debug.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/drivers/usb/storage/debug.c b/drivers/usb/storage/debug.c
index a2b5526c9fa..b428129526c 100644
--- a/drivers/usb/storage/debug.c
+++ b/drivers/usb/storage/debug.c
@@ -150,7 +150,7 @@ void usb_stor_show_command(struct scsi_cmnd *srb)
default: what = "(unknown command)"; break;
}
US_DEBUGP("Command %s (%d bytes)\n", what, srb->cmd_len);
- US_DEBUGP("");
+ US_DEBUGP("bytes: ");
for (i = 0; i < srb->cmd_len && i < 16; i++)
US_DEBUGPX(" %02x", srb->cmnd[i]);
US_DEBUGPX("\n");
@@ -175,3 +175,21 @@ void usb_stor_show_sense(
US_DEBUGPX(what, ascq);
US_DEBUGPX("\n");
}
+
+int usb_stor_dbg(const char *fmt, ...)
+{
+ struct va_format vaf;
+ va_list args;
+ int r;
+
+ va_start(args, fmt);
+
+ vaf.fmt = fmt;
+ vaf.va = &args;
+
+ r = printk(KERN_DEBUG USB_STORAGE "%pV", &vaf);
+
+ va_end(args);
+
+ return r;
+}