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>
Wed, 14 Dec 2016 04:52:18 +0000 (13:52 +0900)
commit3c6057df88e69b3c3c940f9fa4ef035669f682d6
treeabbb6664ff313e98c274df8d8f4cef5bb4548526
parentc2e682c41250581a178db624712857ecda99db94
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