]> git.openfabrics.org - ~emulex/infiniband.git/commit
usb: gadget: composite: introduce usb_gstrings_attach()
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>
Sun, 23 Dec 2012 20:10:22 +0000 (21:10 +0100)
committerFelipe Balbi <balbi@ti.com>
Mon, 21 Jan 2013 18:52:48 +0000 (20:52 +0200)
commit9bb2859f8a8dbc9b42f3100641dd0ae80cfbe86a
treef40927a9dcdc92325a30261f61b034084d3f6010
parent2d5a88990260d226a69acddf22c04f47c267b33a
usb: gadget: composite: introduce usb_gstrings_attach()

The USB strings don't (yet) fully work in multiple configs/gadget
environment. The string id is assigned to the descriptor and the struct
usb_strings. We create a copy of the individual descriptor so we don't
clash if we use a function more than once. However, we have only one
struct usb_string for each string.

Currently each function which is used multiple times checks for
"id != 0" and only assigns string ids if it did not happen yet. This
works well if we use the same function multiple times as long as we do
it within the "one" gadget we have. Trouble starts once we use the same
function in a second gadget.

In order to solve this I introduce usb_gstrings_attach(). This function will
crate a copy all structs except for the strings which are not copied.
After the copy it will assign USB ids and attach it to cdev.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/gadget/composite.c
include/linux/usb/composite.h
include/linux/usb/gadget.h