usb: dwc3: don't compile dwc3_trace() unless CONFIG_FTRACE=y
authorFelipe Balbi <felipe.balbi@linux.intel.com>
Fri, 30 Sep 2016 11:12:34 +0000 (14:12 +0300)
committerFelipe Balbi <felipe.balbi@linux.intel.com>
Thu, 3 Nov 2016 08:38:29 +0000 (10:38 +0200)
We don't need dwc3_trace() unless we're building a
kernel with CONFIG_FTRACE. This patch reduces
dwc3.ko text size a bit while also removing overhead
of dwc3_trace() calls.

   text    data     bss     dec     hex filename
  50796     581       0   51377    c8b1 drivers/usb/dwc3/dwc3.o
  43961     581       0   44542    adfe drivers/usb/dwc3/dwc3.o.patched

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
drivers/usb/dwc3/Makefile
drivers/usb/dwc3/debug.h

index 22420e17d68bc5d708655ed164af528f2b8b9100..84de1e4151c48db3e78ccc48c854c42166685b9e 100644 (file)
@@ -3,7 +3,11 @@ CFLAGS_trace.o                         := -I$(src)
 
 obj-$(CONFIG_USB_DWC3)                 += dwc3.o
 
-dwc3-y                                 := core.o debug.o trace.o
+dwc3-y                                 := core.o
+
+ifneq ($(CONFIG_FTRACE),)
+       dwc3-y                          += debug.o trace.o
+endif
 
 ifneq ($(filter y,$(CONFIG_USB_DWC3_HOST) $(CONFIG_USB_DWC3_DUAL_ROLE)),)
        dwc3-y                          += host.o
index b287fc6ab29e25e3b81ee1f75193d09bf1ba29b8..d93780e84f07f76ba919ad469e236400e11ebc7e 100644 (file)
@@ -344,7 +344,13 @@ static inline const char *dwc3_gadget_generic_cmd_status_string(int status)
        }
 }
 
+
+#if IS_ENABLED(CONFIG_FTRACE)
 void dwc3_trace(void (*trace)(struct va_format *), const char *fmt, ...);
+#else
+static inline void dwc3_trace(void (*trace)(struct va_format *), const char *fmt, ...)
+{  }
+#endif
 
 #ifdef CONFIG_DEBUG_FS
 extern void dwc3_debugfs_init(struct dwc3 *);