Commit a84d9e53 authored by Sebastian Andrzej Siewior's avatar Sebastian Andrzej Siewior Committed by Felipe Balbi

usb: gadget: start with libcomposite

This patch aims to be simple. It removes #include usbstribgs.c line from each
gadget and creates libcomposite.ko which has only one member, that is
usbstribgs.c.
Acked-by: default avatarMichal Nazarewicz <mina86@mina86.com>
Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent 4001a7a1
...@@ -494,6 +494,12 @@ endmenu ...@@ -494,6 +494,12 @@ endmenu
# #
# USB Gadget Drivers # USB Gadget Drivers
# #
# composite based drivers
config USB_LIBCOMPOSITE
tristate
depends on USB_GADGET
choice choice
tristate "USB Gadget Drivers" tristate "USB Gadget Drivers"
default USB_ETH default USB_ETH
...@@ -517,6 +523,7 @@ choice ...@@ -517,6 +523,7 @@ choice
config USB_ZERO config USB_ZERO
tristate "Gadget Zero (DEVELOPMENT)" tristate "Gadget Zero (DEVELOPMENT)"
select USB_LIBCOMPOSITE
help help
Gadget Zero is a two-configuration device. It either sinks and Gadget Zero is a two-configuration device. It either sinks and
sources bulk data; or it loops back a configurable number of sources bulk data; or it loops back a configurable number of
...@@ -552,6 +559,7 @@ config USB_ZERO_HNPTEST ...@@ -552,6 +559,7 @@ config USB_ZERO_HNPTEST
config USB_AUDIO config USB_AUDIO
tristate "Audio Gadget (EXPERIMENTAL)" tristate "Audio Gadget (EXPERIMENTAL)"
depends on SND depends on SND
select USB_LIBCOMPOSITE
select SND_PCM select SND_PCM
help help
This Gadget Audio driver is compatible with USB Audio Class This Gadget Audio driver is compatible with USB Audio Class
...@@ -580,6 +588,7 @@ config GADGET_UAC1 ...@@ -580,6 +588,7 @@ config GADGET_UAC1
config USB_ETH config USB_ETH
tristate "Ethernet Gadget (with CDC Ethernet support)" tristate "Ethernet Gadget (with CDC Ethernet support)"
depends on NET depends on NET
select USB_LIBCOMPOSITE
select CRC32 select CRC32
help help
This driver implements Ethernet style communication, in one of This driver implements Ethernet style communication, in one of
...@@ -615,6 +624,7 @@ config USB_ETH ...@@ -615,6 +624,7 @@ config USB_ETH
config USB_ETH_RNDIS config USB_ETH_RNDIS
bool "RNDIS support" bool "RNDIS support"
depends on USB_ETH depends on USB_ETH
select USB_LIBCOMPOSITE
default y default y
help help
Microsoft Windows XP bundles the "Remote NDIS" (RNDIS) protocol, Microsoft Windows XP bundles the "Remote NDIS" (RNDIS) protocol,
...@@ -633,6 +643,7 @@ config USB_ETH_RNDIS ...@@ -633,6 +643,7 @@ config USB_ETH_RNDIS
config USB_ETH_EEM config USB_ETH_EEM
bool "Ethernet Emulation Model (EEM) support" bool "Ethernet Emulation Model (EEM) support"
depends on USB_ETH depends on USB_ETH
select USB_LIBCOMPOSITE
default n default n
help help
CDC EEM is a newer USB standard that is somewhat simpler than CDC ECM CDC EEM is a newer USB standard that is somewhat simpler than CDC ECM
...@@ -649,6 +660,7 @@ config USB_ETH_EEM ...@@ -649,6 +660,7 @@ config USB_ETH_EEM
config USB_G_NCM config USB_G_NCM
tristate "Network Control Model (NCM) support" tristate "Network Control Model (NCM) support"
depends on NET depends on NET
select USB_LIBCOMPOSITE
select CRC32 select CRC32
help help
This driver implements USB CDC NCM subclass standard. NCM is This driver implements USB CDC NCM subclass standard. NCM is
...@@ -678,6 +690,7 @@ config USB_GADGETFS ...@@ -678,6 +690,7 @@ config USB_GADGETFS
config USB_FUNCTIONFS config USB_FUNCTIONFS
tristate "Function Filesystem (EXPERIMENTAL)" tristate "Function Filesystem (EXPERIMENTAL)"
depends on EXPERIMENTAL depends on EXPERIMENTAL
select USB_LIBCOMPOSITE
select USB_FUNCTIONFS_GENERIC if !(USB_FUNCTIONFS_ETH || USB_FUNCTIONFS_RNDIS) select USB_FUNCTIONFS_GENERIC if !(USB_FUNCTIONFS_ETH || USB_FUNCTIONFS_RNDIS)
help help
The Function Filesystem (FunctionFS) lets one create USB The Function Filesystem (FunctionFS) lets one create USB
...@@ -741,6 +754,7 @@ config USB_FILE_STORAGE_TEST ...@@ -741,6 +754,7 @@ config USB_FILE_STORAGE_TEST
config USB_MASS_STORAGE config USB_MASS_STORAGE
tristate "Mass Storage Gadget" tristate "Mass Storage Gadget"
depends on BLOCK depends on BLOCK
select USB_LIBCOMPOSITE
help help
The Mass Storage Gadget acts as a USB Mass Storage disk drive. The Mass Storage Gadget acts as a USB Mass Storage disk drive.
As its storage repository it can use a regular file or a block As its storage repository it can use a regular file or a block
...@@ -756,6 +770,7 @@ config USB_MASS_STORAGE ...@@ -756,6 +770,7 @@ config USB_MASS_STORAGE
config USB_GADGET_TARGET config USB_GADGET_TARGET
tristate "USB Gadget Target Fabric Module" tristate "USB Gadget Target Fabric Module"
depends on TARGET_CORE depends on TARGET_CORE
select USB_LIBCOMPOSITE
help help
This fabric is an USB gadget. Two USB protocols are supported that is This fabric is an USB gadget. Two USB protocols are supported that is
BBB or BOT (Bulk Only Transport) and UAS (USB Attached SCSI). BOT is BBB or BOT (Bulk Only Transport) and UAS (USB Attached SCSI). BOT is
...@@ -765,6 +780,7 @@ config USB_GADGET_TARGET ...@@ -765,6 +780,7 @@ config USB_GADGET_TARGET
config USB_G_SERIAL config USB_G_SERIAL
tristate "Serial Gadget (with CDC ACM and CDC OBEX support)" tristate "Serial Gadget (with CDC ACM and CDC OBEX support)"
select USB_LIBCOMPOSITE
help help
The Serial Gadget talks to the Linux-USB generic serial driver. The Serial Gadget talks to the Linux-USB generic serial driver.
This driver supports a CDC-ACM module option, which can be used This driver supports a CDC-ACM module option, which can be used
...@@ -785,6 +801,7 @@ config USB_G_SERIAL ...@@ -785,6 +801,7 @@ config USB_G_SERIAL
config USB_MIDI_GADGET config USB_MIDI_GADGET
tristate "MIDI Gadget (EXPERIMENTAL)" tristate "MIDI Gadget (EXPERIMENTAL)"
depends on SND && EXPERIMENTAL depends on SND && EXPERIMENTAL
select USB_LIBCOMPOSITE
select SND_RAWMIDI select SND_RAWMIDI
help help
The MIDI Gadget acts as a USB Audio device, with one MIDI The MIDI Gadget acts as a USB Audio device, with one MIDI
...@@ -798,6 +815,7 @@ config USB_MIDI_GADGET ...@@ -798,6 +815,7 @@ config USB_MIDI_GADGET
config USB_G_PRINTER config USB_G_PRINTER
tristate "Printer Gadget" tristate "Printer Gadget"
select USB_LIBCOMPOSITE
help help
The Printer Gadget channels data between the USB host and a The Printer Gadget channels data between the USB host and a
userspace program driving the print engine. The user space userspace program driving the print engine. The user space
...@@ -814,6 +832,7 @@ config USB_G_PRINTER ...@@ -814,6 +832,7 @@ config USB_G_PRINTER
config USB_CDC_COMPOSITE config USB_CDC_COMPOSITE
tristate "CDC Composite Device (Ethernet and ACM)" tristate "CDC Composite Device (Ethernet and ACM)"
depends on NET depends on NET
select USB_LIBCOMPOSITE
help help
This driver provides two functions in one configuration: This driver provides two functions in one configuration:
a CDC Ethernet (ECM) link, and a CDC ACM (serial port) link. a CDC Ethernet (ECM) link, and a CDC ACM (serial port) link.
...@@ -828,6 +847,7 @@ config USB_CDC_COMPOSITE ...@@ -828,6 +847,7 @@ config USB_CDC_COMPOSITE
config USB_G_NOKIA config USB_G_NOKIA
tristate "Nokia composite gadget" tristate "Nokia composite gadget"
depends on PHONET depends on PHONET
select USB_LIBCOMPOSITE
help help
The Nokia composite gadget provides support for acm, obex The Nokia composite gadget provides support for acm, obex
and phonet in only one composite gadget driver. and phonet in only one composite gadget driver.
...@@ -838,6 +858,7 @@ config USB_G_NOKIA ...@@ -838,6 +858,7 @@ config USB_G_NOKIA
config USB_G_ACM_MS config USB_G_ACM_MS
tristate "CDC Composite Device (ACM and mass storage)" tristate "CDC Composite Device (ACM and mass storage)"
depends on BLOCK depends on BLOCK
select USB_LIBCOMPOSITE
help help
This driver provides two functions in one configuration: This driver provides two functions in one configuration:
a mass storage, and a CDC ACM (serial port) link. a mass storage, and a CDC ACM (serial port) link.
...@@ -849,6 +870,7 @@ config USB_G_MULTI ...@@ -849,6 +870,7 @@ config USB_G_MULTI
tristate "Multifunction Composite Gadget (EXPERIMENTAL)" tristate "Multifunction Composite Gadget (EXPERIMENTAL)"
depends on BLOCK && NET depends on BLOCK && NET
select USB_G_MULTI_CDC if !USB_G_MULTI_RNDIS select USB_G_MULTI_CDC if !USB_G_MULTI_RNDIS
select USB_LIBCOMPOSITE
help help
The Multifunction Composite Gadget provides Ethernet (RNDIS The Multifunction Composite Gadget provides Ethernet (RNDIS
and/or CDC Ethernet), mass storage and ACM serial link and/or CDC Ethernet), mass storage and ACM serial link
...@@ -889,6 +911,7 @@ config USB_G_MULTI_CDC ...@@ -889,6 +911,7 @@ config USB_G_MULTI_CDC
config USB_G_HID config USB_G_HID
tristate "HID Gadget" tristate "HID Gadget"
select USB_LIBCOMPOSITE
help help
The HID gadget driver provides generic emulation of USB The HID gadget driver provides generic emulation of USB
Human Interface Devices (HID). Human Interface Devices (HID).
...@@ -899,8 +922,10 @@ config USB_G_HID ...@@ -899,8 +922,10 @@ config USB_G_HID
Say "y" to link the driver statically, or "m" to build a Say "y" to link the driver statically, or "m" to build a
dynamically linked module called "g_hid". dynamically linked module called "g_hid".
# Standalone / single function gadgets
config USB_G_DBGP config USB_G_DBGP
tristate "EHCI Debug Device Gadget" tristate "EHCI Debug Device Gadget"
select USB_LIBCOMPOSITE
help help
This gadget emulates an EHCI Debug device. This is useful when you want This gadget emulates an EHCI Debug device. This is useful when you want
to interact with an EHCI Debug Port. to interact with an EHCI Debug Port.
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
ccflags-$(CONFIG_USB_GADGET_DEBUG) := -DDEBUG ccflags-$(CONFIG_USB_GADGET_DEBUG) := -DDEBUG
obj-$(CONFIG_USB_GADGET) += udc-core.o obj-$(CONFIG_USB_GADGET) += udc-core.o
obj-$(CONFIG_USB_LIBCOMPOSITE) += libcomposite.o
libcomposite-y := usbstring.o
obj-$(CONFIG_USB_DUMMY_HCD) += dummy_hcd.o obj-$(CONFIG_USB_DUMMY_HCD) += dummy_hcd.o
obj-$(CONFIG_USB_NET2272) += net2272.o obj-$(CONFIG_USB_NET2272) += net2272.o
obj-$(CONFIG_USB_NET2280) += net2280.o obj-$(CONFIG_USB_NET2280) += net2280.o
......
...@@ -42,7 +42,6 @@ ...@@ -42,7 +42,6 @@
*/ */
#include "composite.c" #include "composite.c"
#include "usbstring.c"
#include "config.c" #include "config.c"
#include "epautoconf.c" #include "epautoconf.c"
#include "u_serial.c" #include "u_serial.c"
......
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
* a "gcc --combine ... part1.c part2.c part3.c ... " build would. * a "gcc --combine ... part1.c part2.c part3.c ... " build would.
*/ */
#include "composite.c" #include "composite.c"
#include "usbstring.c"
#include "config.c" #include "config.c"
#include "epautoconf.c" #include "epautoconf.c"
......
...@@ -44,7 +44,6 @@ ...@@ -44,7 +44,6 @@
*/ */
#include "composite.c" #include "composite.c"
#include "usbstring.c"
#include "config.c" #include "config.c"
#include "epautoconf.c" #include "epautoconf.c"
#include "u_serial.c" #include "u_serial.c"
......
...@@ -103,7 +103,6 @@ static inline bool has_rndis(void) ...@@ -103,7 +103,6 @@ static inline bool has_rndis(void)
* a "gcc --combine ... part1.c part2.c part3.c ... " build would. * a "gcc --combine ... part1.c part2.c part3.c ... " build would.
*/ */
#include "composite.c" #include "composite.c"
#include "usbstring.c"
#include "config.c" #include "config.c"
#include "epautoconf.c" #include "epautoconf.c"
......
...@@ -265,7 +265,6 @@ ...@@ -265,7 +265,6 @@
* the runtime footprint, and giving us at least some parts of what * the runtime footprint, and giving us at least some parts of what
* a "gcc --combine ... part1.c part2.c part3.c ... " build would. * a "gcc --combine ... part1.c part2.c part3.c ... " build would.
*/ */
#include "usbstring.c"
#include "config.c" #include "config.c"
#include "epautoconf.c" #include "epautoconf.c"
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
*/ */
#include "composite.c" #include "composite.c"
#include "usbstring.c"
#include "config.c" #include "config.c"
#include "epautoconf.c" #include "epautoconf.c"
......
...@@ -38,7 +38,6 @@ ...@@ -38,7 +38,6 @@
#include "gadget_chips.h" #include "gadget_chips.h"
#include "composite.c" #include "composite.c"
#include "usbstring.c"
#include "config.c" #include "config.c"
#include "epautoconf.c" #include "epautoconf.c"
#include "f_midi.c" #include "f_midi.c"
......
...@@ -35,7 +35,6 @@ ...@@ -35,7 +35,6 @@
*/ */
#include "composite.c" #include "composite.c"
#include "usbstring.c"
#include "config.c" #include "config.c"
#include "epautoconf.c" #include "epautoconf.c"
......
...@@ -49,7 +49,6 @@ ...@@ -49,7 +49,6 @@
*/ */
#include "composite.c" #include "composite.c"
#include "usbstring.c"
#include "config.c" #include "config.c"
#include "epautoconf.c" #include "epautoconf.c"
#include "f_mass_storage.c" #include "f_mass_storage.c"
......
...@@ -44,7 +44,6 @@ MODULE_LICENSE("GPL"); ...@@ -44,7 +44,6 @@ MODULE_LICENSE("GPL");
*/ */
#include "composite.c" #include "composite.c"
#include "usbstring.c"
#include "config.c" #include "config.c"
#include "epautoconf.c" #include "epautoconf.c"
......
...@@ -37,7 +37,6 @@ ...@@ -37,7 +37,6 @@
* a "gcc --combine ... part1.c part2.c part3.c ... " build would. * a "gcc --combine ... part1.c part2.c part3.c ... " build would.
*/ */
#include "composite.c" #include "composite.c"
#include "usbstring.c"
#include "config.c" #include "config.c"
#include "epautoconf.c" #include "epautoconf.c"
......
...@@ -39,7 +39,6 @@ ...@@ -39,7 +39,6 @@
* a "gcc --combine ... part1.c part2.c part3.c ... " build would. * a "gcc --combine ... part1.c part2.c part3.c ... " build would.
*/ */
#include "composite.c" #include "composite.c"
#include "usbstring.c"
#include "config.c" #include "config.c"
#include "epautoconf.c" #include "epautoconf.c"
......
...@@ -52,7 +52,6 @@ ...@@ -52,7 +52,6 @@
* a "gcc --combine ... part1.c part2.c part3.c ... " build would. * a "gcc --combine ... part1.c part2.c part3.c ... " build would.
*/ */
#include "composite.c" #include "composite.c"
#include "usbstring.c"
#include "config.c" #include "config.c"
#include "epautoconf.c" #include "epautoconf.c"
......
...@@ -38,7 +38,6 @@ ...@@ -38,7 +38,6 @@
* a "gcc --combine ... part1.c part2.c part3.c ... " build would. * a "gcc --combine ... part1.c part2.c part3.c ... " build would.
*/ */
#include "composite.c" #include "composite.c"
#include "usbstring.c"
#include "config.c" #include "config.c"
#include "epautoconf.c" #include "epautoconf.c"
......
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
#include <target/configfs_macros.h> #include <target/configfs_macros.h>
#include <asm/unaligned.h> #include <asm/unaligned.h>
#include "usbstring.c"
#include "epautoconf.c" #include "epautoconf.c"
#include "config.c" #include "config.c"
#include "composite.c" #include "composite.c"
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h>
#include <linux/list.h> #include <linux/list.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/device.h> #include <linux/device.h>
...@@ -68,4 +69,5 @@ usb_gadget_get_string (struct usb_gadget_strings *table, int id, u8 *buf) ...@@ -68,4 +69,5 @@ usb_gadget_get_string (struct usb_gadget_strings *table, int id, u8 *buf)
buf [1] = USB_DT_STRING; buf [1] = USB_DT_STRING;
return buf [0]; return buf [0];
} }
EXPORT_SYMBOL_GPL(usb_gadget_get_string);
MODULE_LICENSE("GPL");
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
* a "gcc --combine ... part1.c part2.c part3.c ... " build would. * a "gcc --combine ... part1.c part2.c part3.c ... " build would.
*/ */
#include "composite.c" #include "composite.c"
#include "usbstring.c"
#include "config.c" #include "config.c"
#include "epautoconf.c" #include "epautoconf.c"
......
...@@ -59,7 +59,6 @@ ...@@ -59,7 +59,6 @@
* a "gcc --combine ... part1.c part2.c part3.c ... " build would. * a "gcc --combine ... part1.c part2.c part3.c ... " build would.
*/ */
#include "composite.c" #include "composite.c"
#include "usbstring.c"
#include "config.c" #include "config.c"
#include "epautoconf.c" #include "epautoconf.c"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment