usb:g_dnl:ums: Conditional compilation for mass storage function (f_mass_storage)
PATCH 1/3 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.
--- drivers/usb/gadget/Makefile | 1 + drivers/usb/gadget/g_dnl.c | 2 +- include/usb_mass_storage.h | 9 +++++++++ 3 files changed, 11 insertions(+), 1 deletion(-)
drivers/usb/gadget/Makefile +1 -0
@@ -23,6 +23,7 @@ COBJS-$(CONFIG_USB_GADGET_S3C_UDC_OTG) += s3c_udc_otg.o COBJS-$(CONFIG_USB_GADGET_FOTG210) += fotg210.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
drivers/usb/gadget/g_dnl.c +1 -1
@@ -15,11 +15,11 @@#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:
include/usb_mass_storage.h +9 -0
@@ -11,6 +11,7 @@#define SECTOR_SIZE 0x200#include <mmc.h> +#include <linux/usb/composite.h> struct ums_device {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 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__ */
Signature · 1 line
1.7.10.4
PATCH 1/3 usb:g_dnl:ums: Conditional compilation for mass storage function (f_mass_storage)
Hi Marek,
Quoted 8 lines
The mass storage composite function is now compiled in only when
CONFIG_USB_GADGET_MASS_STORAGEis defined.
Such change provides binary size reduction for boards which use USB download gadget (likeam335x_evm) with DFU, but don't use UMS.For example at
am335x_evmboard reduction is more than 2KiB for text and around 120B for data.
Any comments on those patches (from patch 1 to 3)?
Quoted 62 lines
Signed-off-by Lukasz Majewski <[email protected]>Cc Marek Vasut <[email protected]>--- drivers/usb/gadget/Makefile | 1 + drivers/usb/gadget/g_dnl.c | 2 +- include/usb_mass_storage.h | 9 +++++++++ 3 files changed, 11 insertions(+), 1 deletion(-)drivers/usb/gadget/Makefile +0
-0@@ -23,6 +23,7 @@ COBJS-$(CONFIG_USB_GADGET_S3C_UDC_OTG) +=s3c_udc_otg.o COBJS-$(CONFIG_USB_GADGET_FOTG210) += fotg210.o
COBJS-$(CONFIG_USBDOWNLOAD_GADGET) += g_dnl.o COBJS-$(CONFIG_DFU_FUNCTION) += f_dfu.odrivers/usb/gadget/Makefile +1
-0+COBJS-$(CONFIG_USB_GADGET_MASS_STORAGE) += f_mass_storage.o endif ifdef CONFIG_USB_ETHER COBJS-y += ether.odrivers/usb/gadget/g_dnl.c +1
-1@@ -15,11 +15,11 @@#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: include/usb_mass_storage.h +1
-0@@ -11,6 +11,7 @@#define SECTOR_SIZE 0x200#include <mmc.h> +#include <linux/usb/composite.h> struct ums_device {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 intfsg_main_thread(void *);include/usb_mass_storage.h +8
-0+#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__ */
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
PATCH 1/3 usb:g_dnl:ums: Conditional compilation for mass storage function (f_mass_storage)
Dear Lukasz Majewski,
Quoted 11 lines
Hi Marek,
Quoted 7 lines
The mass storage composite function is now compiled in only when
CONFIG_USB_GADGET_MASS_STORAGEis defined.
Such change provides binary size reduction for boards which use USB download gadget (likeam335x_evm) with DFU, but don't use UMS.For example at
am335x_evmboard reduction is more than 2KiB for text and around 120B for data.Any comments on those patches (from patch 1 to 3)?
Will push them up in a bit.
Best regards,
Marek Vasut
PATCH 1/3 usb:g_dnl:ums: Conditional compilation for mass storage function (f_mass_storage)
Hi Marek,
Quoted 9 lines
Dear Lukasz Majewski,
Quoted 7 lines
Hi Marek,
Quoted 5 lines
The mass storage composite function is now compiled in only when
CONFIG_USB_GADGET_MASS_STORAGEis defined.
Such change provides binary size reduction for boards which use USB download gadget (likeam335x_evm) with DFU, but don't use UMS.
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
For example at
am335x_evmboard reduction is more than 2KiB for text and around 120B for data.Any comments on those patches (from patch 1 to 3)?
Will push them up in a bit.
Is there any problem with pulling those patches?
Quoted 3 lines
Best regards,
Marek Vasut
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
PATCH 1/3 usb:g_dnl:ums: Conditional compilation for mass storage function (f_mass_storage)
Dear Lukasz Majewski,
Quoted 11 lines
Hi Marek,
Quoted 9 lines
Dear Lukasz Majewski,
Quoted 7 lines
Hi Marek,
Quoted 5 lines
The mass storage composite function is now compiled in only when
CONFIG_USB_GADGET_MASS_STORAGEis defined.
Such change provides binary size reduction for boards which use USB download gadget (likeam335x_evm) with DFU, but don't use UMS.
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
For example at
am335x_evmboard reduction is more than 2KiB for text and around 120B for data.Any comments on those patches (from patch 1 to 3)?
Will push them up in a bit.
Is there any problem with pulling those patches?
PR tonight.
Best regards,
Marek Vasut
PATCH 2/3 usb:gadget:Remove redundant #includes for USB composite gadget and its functions
In reply to Lukasz MajewskiOnly the <linux/usb/gadget.h> requires error.h include. Hence, several includes of error.h at USB gadget functions are not needed.
Moreover unnecessary malloc.h includes were also removed.
--- common/cmd_dfu.c | 3 --- common/cmd_usb_mass_storage.c | 1 - drivers/usb/gadget/g_dnl.c | 1 - include/linux/usb/gadget.h | 1 + 4 files changed, 1 insertion(+), 5 deletions(-)
common/cmd_dfu.c +0 -3
@@ -9,10 +9,7 @@*/ #include <common.h> -#include <command.h> -#include <malloc.h> #include <dfu.h> -#include <asm/errno.h> #include <g_dnl.h> static int do_dfu (cmd_tbl_t *cmdtp,int flag,int argc,char *const argv[])
common/cmd_usb_mass_storage.c +0 -1
@@ -5,7 +5,6 @@* SPDX-License-Identifier: GPL-2.0+ */ -#include <errno.h> #include <common.h> #include <command.h> #include <g_dnl.h>
drivers/usb/gadget/g_dnl.c +0 -1
@@ -7,7 +7,6 @@* SPDX-License-Identifier: GPL-2.0+ */ -#include <errno.h> #include <common.h> #include <malloc.h>
include/linux/usb/gadget.h +1 -0
@@ -18,6 +18,7 @@#ifndef __LINUX_USB_GADGET_H#define __LINUX_USB_GADGET_H +#include <errno.h> #include <linux/list.h> struct usb_ep ;
Signature · 1 line
1.7.10.4
PATCH 3/3 usb:g_dnl:dfu: Download gadget and DFU function code clean up
In reply to Lukasz MajewskiThe download gadget code and DFU function lacks of proper declarations for the case when a target board wants to use only one of available usb functions.
Moreover the relevant declarations have been moved to consistent localization (like <dfu.h>).
--- drivers/usb/gadget/f_dfu.h | 3 --- drivers/usb/gadget/g_dnl.c | 2 +- include/dfu.h | 9 +++++++++ 3 files changed, 10 insertions(+), 4 deletions(-)
drivers/usb/gadget/f_dfu.h +0 -3
@@ -82,7 +82,4 @@ struct dfu_function_descriptor {__le16 wTransferSize; __le16 bcdDFUVersion; } __packed; - -/* configuration-specific linkup */ -int dfu_add (struct usb_configuration *c);#endif /* __F_DFU_H_ */
drivers/usb/gadget/g_dnl.c +1 -1
@@ -15,7 +15,7 @@#include <g_dnl.h> #include <usb_mass_storage.h> -#include "f_dfu.h" +#include <dfu.h> #include "gadget_chips.h" #include "composite.c"
include/dfu.h +9 -0
@@ -14,6 +14,7 @@#include <common.h> #include <linux/list.h> #include <mmc.h> +#include <linux/usb/composite.h> enum dfu_device_type {DFU_DEV_MMC =1 ,
@@ -139,4 +140,12 @@ static inline int dfu_fill_entity_nand(struct dfu_entity *dfu, char *s) }#endif +#ifdef CONFIG_DFU_FUNCTION +int dfu_add (struct usb_configuration *c); +#else +int dfu_add (struct usb_configuration *c) +{ +return 0 ; +} +#endif #endif /* __DFU_ENTITY_H_ */
Signature · 1 line
1.7.10.4