usb:g_dnl:ums: Conditional compilation for mass storage function (f_mass_storage)

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>
This commit is contained in:
Lukasz Majewski 2013-09-17 15:58:21 +02:00 committed by Marek Vasut
parent e473b8b65b
commit ba4e95c9f0
3 changed files with 11 additions and 1 deletions

View File

@ -23,6 +23,7 @@ COBJS-$(CONFIG_USB_GADGET_S3C_UDC_OTG) += s3c_udc_otg.o
COBJS-$(CONFIG_USB_GADGET_FOTG210) += fotg210.o COBJS-$(CONFIG_USB_GADGET_FOTG210) += fotg210.o
COBJS-$(CONFIG_USBDOWNLOAD_GADGET) += g_dnl.o COBJS-$(CONFIG_USBDOWNLOAD_GADGET) += g_dnl.o
COBJS-$(CONFIG_DFU_FUNCTION) += f_dfu.o COBJS-$(CONFIG_DFU_FUNCTION) += f_dfu.o
COBJS-$(CONFIG_USB_GADGET_MASS_STORAGE) += f_mass_storage.o
endif endif
ifdef CONFIG_USB_ETHER ifdef CONFIG_USB_ETHER
COBJS-y += ether.o COBJS-y += ether.o

View File

@ -15,11 +15,11 @@
#include <part.h> #include <part.h>
#include <g_dnl.h> #include <g_dnl.h>
#include <usb_mass_storage.h>
#include "f_dfu.h" #include "f_dfu.h"
#include "gadget_chips.h" #include "gadget_chips.h"
#include "composite.c" #include "composite.c"
#include "f_mass_storage.c"
/* /*
* One needs to define the following: * One needs to define the following:

View File

@ -11,6 +11,7 @@
#define SECTOR_SIZE 0x200 #define SECTOR_SIZE 0x200
#include <mmc.h> #include <mmc.h>
#include <linux/usb/composite.h>
struct ums_device { struct ums_device {
struct mmc *mmc; struct mmc *mmc;
@ -39,4 +40,12 @@ extern struct ums_board_info *board_ums_init(unsigned int,
extern int usb_gadget_handle_interrupts(void); extern int usb_gadget_handle_interrupts(void);
extern int fsg_main_thread(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__ */ #endif /* __USB_MASS_STORAGE_H__ */