usb:g_dnl:ums: Conditional compilation for mass storage function (f_mass_storage)
authorLukasz Majewski <l.majewski@samsung.com>
Tue, 17 Sep 2013 13:58:21 +0000 (15:58 +0200)
committerChanho Park <chanho61.park@samsung.com>
Wed, 22 Jul 2015 12:00:43 +0000 (21:00 +0900)
The mass storage composite function is now compiled in only when
CONFIG_USB_GADGET_MASS_STORAGE is defined.
Such change provides binary size reduction for boards which use USB
download gadget (like am335x_evm) with DFU, but don't use UMS.

For example at am335x_evm board reduction is more than 2KiB for
text and around 120B for data.

Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
Cc: Marek Vasut <marex@denx.de>
drivers/usb/gadget/Makefile
drivers/usb/gadget/g_dnl.c
include/usb_mass_storage.h

index 1f920300e9ae1fe29b1f025ee825af7f35e001b9..d31e33698954ea1d6ee10192325d914d0beb9e59 100644 (file)
@@ -31,6 +31,7 @@ COBJS-y += epautoconf.o config.o usbstring.o
 COBJS-$(CONFIG_USB_GADGET_S3C_UDC_OTG) += s3c_udc_otg.o
 COBJS-$(CONFIG_USBDOWNLOAD_GADGET) += g_dnl.o
 COBJS-$(CONFIG_DFU_FUNCTION) += f_dfu.o
+COBJS-$(CONFIG_USB_GADGET_MASS_STORAGE) += f_mass_storage.o
 endif
 ifdef CONFIG_USB_ETHER
 COBJS-y += ether.o epautoconf.o config.o usbstring.o
index 61ee0691e17b6dab2efc279f198d95cd5e655d92..5acb0b815dc03997f077721f167cf1dc1e7071ef 100644 (file)
 #include <part.h>
 
 #include <g_dnl.h>
+#include <usb_mass_storage.h>
 #include "f_dfu.h"
 
 #include "gadget_chips.h"
 #include "composite.c"
-#include "f_mass_storage.c"
 
 /*
  * One needs to define the following:
index ffc3a13c298eee730ac85c9e5d24bc3a5149c80f..d48241c63de0e9bae386494e4d29709955b42b3e 100644 (file)
@@ -24,6 +24,7 @@
 #define SECTOR_SIZE            0x200
 
 #include <mmc.h>
+#include <linux/usb/composite.h>
 
 struct ums_device {
        struct mmc *mmc;
@@ -52,4 +53,12 @@ extern struct ums_board_info *board_ums_init(unsigned int,
 extern int usb_gadget_handle_interrupts(void);
 extern int fsg_main_thread(void *);
 
+#ifdef CONFIG_USB_GADGET_MASS_STORAGE
+int fsg_add(struct usb_configuration *c);
+#else
+int fsg_add(struct usb_configuration *c)
+{
+       return 0;
+}
+#endif
 #endif /* __USB_MASS_STORAGE_H__ */