usb: gadget: Allow to build both USB functions and legacy gadgets
authorKrzysztof Opasiak <k.opasiak@samsung.com>
Mon, 6 Jun 2016 19:40:33 +0000 (21:40 +0200)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Tue, 9 Aug 2016 07:30:35 +0000 (16:30 +0900)
commit565ea0aa5a2cc7f78a11ddc42d7103fc88e12daf
treeeaf0dcd08346b52fbc6878bedfa05d673fa82104
parent8a5b316c485652b6909aba8b0f9a3eecf09ea83f
usb: gadget: Allow to build both USB functions and legacy gadgets

Currently it is possible to build in some subset of usb functions
*OR* some gadget module. This is limited only by Kconfig not
any functionality.

This patch removes this limitation. With this patch it is possible
to set up all build combinations:
1) Multiple gadgets build in
2) Part of functions build in, part of functions as a modules
3) Some gadgets build in and some part of functions build in/modules
etc.

As this patch makes Kconfig quite complicated let me clarify how it works:

USB_F_<func name> - used in makefile for compilation
USB_CONFIGFS_F_<func name> - Chosen by user in function menu
USB_G_<gadget name>_REQ_F_<func name> - set up by gadget to mark
      that this particular gadget requires this func to work
USB_F_<func name>_SELECTOR - helper config which is used to determine
    if function should be build in or compiled as a module

The rules are quite simple:
1) If any of USB_CONFIGFS_F_<func name>, USB_G_*_REQ_F_<func name> equals
y, then USB_F_<func name> is set to y and function is build in
2) If none of USB_CONFIGFS_F_<func name>, USB_G_*_REQ_F_<func name> equals
y, but any of them equals m then USB_F_<func name> is set to m and function
is compiled as a module

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
[Backported from commit under review @linux-usb mailing list]
Change-Id: Ic8c2ad723a43536ca4c621ed590e01ba8f0fbf5b
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
drivers/usb/gadget/Kconfig
drivers/usb/gadget/legacy/Kconfig