[PATCH 1/9] usb/gadget: start with libcomposite

2012-08-23 Thread Sebastian Andrzej Siewior
This patch aims to be simple. It removes #include usbstribgs.c line from each
gadget and creats libcomposite.ko which has only one member, that is
usbstribgs.c.
To avoid mass select statements in Kconfig I simply group the composite
based gadgets together. The three gadgets which are not part of the group
are:
- EHCI Debug Device Gadget. Could be converted to composite if anyone
  cares
- File-backed Storage Gadget. Replaced by "mass storage", will be
  removed soon.
- Gadget Filesystem. Functionality is provided by "Function Filesystem".
  Unfortunatelly can't be replaced because the user space visible API is
  different.

Signed-off-by: Sebastian Andrzej Siewior 
---
 drivers/staging/ccg/Kconfig |1 +
 drivers/staging/ccg/ccg.c   |1 -
 drivers/usb/gadget/Kconfig  |  116 ---
 drivers/usb/gadget/Makefile |2 +
 drivers/usb/gadget/acm_ms.c |1 -
 drivers/usb/gadget/audio.c  |1 -
 drivers/usb/gadget/cdc2.c   |1 -
 drivers/usb/gadget/ether.c  |1 -
 drivers/usb/gadget/file_storage.c   |1 -
 drivers/usb/gadget/g_ffs.c  |1 -
 drivers/usb/gadget/gmidi.c  |1 -
 drivers/usb/gadget/hid.c|1 -
 drivers/usb/gadget/mass_storage.c   |1 -
 drivers/usb/gadget/multi.c  |1 -
 drivers/usb/gadget/ncm.c|1 -
 drivers/usb/gadget/nokia.c  |1 -
 drivers/usb/gadget/printer.c|1 -
 drivers/usb/gadget/serial.c |1 -
 drivers/usb/gadget/tcm_usb_gadget.c |1 -
 drivers/usb/gadget/usbstring.c  |4 +-
 drivers/usb/gadget/webcam.c |1 -
 drivers/usb/gadget/zero.c   |1 -
 22 files changed, 72 insertions(+), 69 deletions(-)

diff --git a/drivers/staging/ccg/Kconfig b/drivers/staging/ccg/Kconfig
index 187bcdb..ef4f25b 100644
--- a/drivers/staging/ccg/Kconfig
+++ b/drivers/staging/ccg/Kconfig
@@ -3,6 +3,7 @@ if USB_GADGET
 config USB_G_CCG
tristate "Configurable Composite Gadget (STAGING)"
depends on STAGING && BLOCK
+   depends on USB_LIBCOMPOSITE
help
  The Configurable Composite Gadget supports multiple USB
  functions: acm, mass storage, rndis and FunctionFS.
diff --git a/drivers/staging/ccg/ccg.c b/drivers/staging/ccg/ccg.c
index d726a8d..c379b9f 100644
--- a/drivers/staging/ccg/ccg.c
+++ b/drivers/staging/ccg/ccg.c
@@ -44,7 +44,6 @@
  * the runtime footprint, and giving us at least some parts of what
  * a "gcc --combine ... part1.c part2.c part3.c ... " build would.
  */
-#include "../../usb/gadget/usbstring.c"
 #include "../../usb/gadget/config.c"
 #include "../../usb/gadget/epautoconf.c"
 #include "composite.c"
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
index 1494112..c26c26c 100644
--- a/drivers/usb/gadget/Kconfig
+++ b/drivers/usb/gadget/Kconfig
@@ -507,6 +507,16 @@ config USB_GADGET_SUPERSPEED
 #
 # USB Gadget Drivers
 #
+
+# composite based drivers
+config USB_LIBCOMPOSITE
+   tristate "Lib composite based gadgets"
+   depends on USB_GADGET
+   help
+ Most gadgets are using the composite framework. There are only three
+ gadgets left which do not use the composite framework and two of them
+ have been replaced by alternatives.
+
 choice
tristate "USB Gadget Drivers"
default USB_ETH
@@ -526,6 +536,8 @@ choice
  not be able work with that controller, or might need to implement
  a less common variant of a device class protocol.
 
+if USB_LIBCOMPOSITE
+#
 # this first set of drivers all depend on bulk-capable hardware.
 
 config USB_ZERO
@@ -672,22 +684,6 @@ config USB_G_NCM
  Say "y" to link the driver statically, or "m" to build a
  dynamically linked module called "g_ncm".
 
-config USB_GADGETFS
-   tristate "Gadget Filesystem (EXPERIMENTAL)"
-   depends on EXPERIMENTAL
-   help
- This driver provides a filesystem based API that lets user mode
- programs implement a single-configuration USB device, including
- endpoint I/O and control requests that don't relate to enumeration.
- All endpoints, transfer speeds, and transfer types supported by
- the hardware are available, through read() and write() calls.
-
- Currently, this option is still labelled as EXPERIMENTAL because
- of existing race conditions in the underlying in-kernel AIO core.
-
- Say "y" to link the driver statically, or "m" to build a
- dynamically linked module called "gadgetfs".
-
 config USB_FUNCTIONFS
tristate "Function Filesystem (EXPERIMENTAL)"
depends on EXPERIMENTAL
@@ -726,31 +722,6 @@ config USB_FUNCTIONFS_GENERIC
  Include a configuration with the Function Filesystem alone with
  no Ethernet interface.
 
-config USB_FILE_STORAGE
-   tristate "File-backed Storage Gadget (DEPRECATED)"
-   depends on BLOCK
-   help
-   

Re: [PATCH 1/9] usb/gadget: start with libcomposite

2012-08-23 Thread Michal Nazarewicz
Sebastian Andrzej Siewior  writes:
> This patch aims to be simple. It removes #include usbstribgs.c line from each
> gadget and creats libcomposite.ko which has only one member, that is
> usbstribgs.c.
> To avoid mass select statements in Kconfig I simply group the composite
> based gadgets together. The three gadgets which are not part of the group
> are:
> - EHCI Debug Device Gadget. Could be converted to composite if anyone
>   cares
> - File-backed Storage Gadget. Replaced by "mass storage", will be
>   removed soon.
> - Gadget Filesystem. Functionality is provided by "Function Filesystem".
>   Unfortunatelly can't be replaced because the user space visible API is
>   different.
>
> Signed-off-by: Sebastian Andrzej Siewior 

Perhaps also wrap declaration of usb_gadget_get_string() with an #ifdef
in include/linux/usb/gadget.h?  This way, anything trying to use the
function w/o USB_LIBCOMPOSITE selected will fail to compile rather than
failing to load.

Also, I would personally prefer having selects in Kconfig since I don't
see the need for user who compiles the kernel to know about or
understand the distinction between composite and “raw” gadgets.

Other than that:

Acked-by: Michal Nazarewicz 

-- 
Best regards, _ _
.o. | Liege of Serenely Enlightened Majesty of  o' \,=./ `o
..o | Computer Science,  Michał “mina86” Nazarewicz(o o)
ooo +--ooO--(_)--Ooo--

pgpWRmx6lfiYO.pgp
Description: PGP signature


Re: [PATCH 1/9] usb/gadget: start with libcomposite

2012-08-23 Thread Sebastian Andrzej Siewior

On 08/23/2012 03:07 PM, Michal Nazarewicz wrote:

Perhaps also wrap declaration of usb_gadget_get_string() with an #ifdef
in include/linux/usb/gadget.h?  This way, anything trying to use the
function w/o USB_LIBCOMPOSITE selected will fail to compile rather than
failing to load.


Good hint. The file_storage gadget which is leaving is the other user
besides composite.


Also, I would personally prefer having selects in Kconfig since I don't
see the need for user who compiles the kernel to know about or
understand the distinction between composite and “raw” gadgets.


I tried to avoid this but can change. In the end I would like to have
this "traditional" gadget and those which are created on runtime by
configfs.


Other than that:

Acked-by: Michal Nazarewicz



Sebastian
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/9] usb/gadget: start with libcomposite

2012-08-23 Thread Alan Stern
On Thu, 23 Aug 2012, Sebastian Andrzej Siewior wrote:

> This patch aims to be simple. It removes #include usbstribgs.c line from each
> gadget and creats libcomposite.ko which has only one member, that is
> usbstribgs.c.
> To avoid mass select statements in Kconfig I simply group the composite
> based gadgets together. The three gadgets which are not part of the group
> are:
> - EHCI Debug Device Gadget. Could be converted to composite if anyone
>   cares
> - File-backed Storage Gadget. Replaced by "mass storage", will be
>   removed soon.
> - Gadget Filesystem. Functionality is provided by "Function Filesystem".
>   Unfortunatelly can't be replaced because the user space visible API is
>   different.

> --- a/drivers/usb/gadget/Kconfig
> +++ b/drivers/usb/gadget/Kconfig
> @@ -507,6 +507,16 @@ config USB_GADGET_SUPERSPEED
>  #
>  # USB Gadget Drivers
>  #
> +
> +# composite based drivers
> +config USB_LIBCOMPOSITE
> + tristate "Lib composite based gadgets"
> + depends on USB_GADGET

Shouldn't this have "default USB_GADGET"?  There will be very few cases
where anyone wants to configure a system with gadget support but
without libcomposite.

> + help
> +   Most gadgets are using the composite framework. There are only three

s/framework/library/

> +   gadgets left which do not use the composite framework and two of them

Ditto.

> +   have been replaced by alternatives.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/9] usb/gadget: start with libcomposite

2012-08-24 Thread Sebastian Andrzej Siewior
* Alan Stern | 2012-08-23 10:15:16 [-0400]:

>> --- a/drivers/usb/gadget/Kconfig
>> +++ b/drivers/usb/gadget/Kconfig
>> @@ -507,6 +507,16 @@ config USB_GADGET_SUPERSPEED
>>  #
>>  # USB Gadget Drivers
>>  #
>> +
>> +# composite based drivers
>> +config USB_LIBCOMPOSITE
>> +tristate "Lib composite based gadgets"
>> +depends on USB_GADGET
>
>Shouldn't this have "default USB_GADGET"?  There will be very few cases
>where anyone wants to configure a system with gadget support but
>without libcomposite.

I changed this to a hidden symbol which selected by each gadget except
inode.c

>> +help
>> +  Most gadgets are using the composite framework. There are only three
>
>s/framework/library/
>
>> +  gadgets left which do not use the composite framework and two of them
>
>Ditto.

This is gone now.

>> +  have been replaced by alternatives.
>
>Alan Stern

Sebastian
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html