usb: gadget: Match gadget and gadget_driver according to usb_core_id
Adding new usb_core_id property which is used to match an instance
of struct usb_gadget to an instance of struct usb_gadget_driver.
This will allow constructing more then one usb periheral stack.
This new property is optional and if not specified in both the gadget
and gadget driver then it will have the default value of zero.
Change-Id: Idbab46ed76267ab4827319f2f9efe67c91b50dbd
Signed-off-by: Ido Shayevitz <idos@codeaurora.org>
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index 1a945e7..2e51781 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -506,6 +506,8 @@
* @name: Identifies the controller hardware type. Used in diagnostics
* and sometimes configuration.
* @dev: Driver model state for this abstract device.
+ * @usb_core_id: Identifies the usb core controlled by this usb_gadget.
+ * Used in case of more then one core operates concurrently.
*
* Gadgets have a mostly-portable "gadget driver" implementing device
* functions, handling all usb configurations and interfaces. Gadget
@@ -542,6 +544,7 @@
unsigned otg_srp_reqd:1;
const char *name;
struct device dev;
+ u8 usb_core_id;
};
static inline void set_gadget_data(struct usb_gadget *gadget, void *data)
@@ -793,6 +796,8 @@
* @suspend: Invoked on USB suspend. May be called in_interrupt.
* @resume: Invoked on USB resume. May be called in_interrupt.
* @driver: Driver model state for this driver.
+ * @usb_core_id: Identifies the usb core controlled by this usb_gadget_driver.
+ * Used in case of more then one core operates concurrently.
*
* Devices are disabled till a gadget driver successfully bind()s, which
* means the driver will handle setup() requests needed to enumerate (and
@@ -850,6 +855,8 @@
/* FIXME support safe rmmod */
struct device_driver driver;
+
+ u8 usb_core_id;
};