Sebastian Andrzej Siewior <bige...@linutronix.de> writes: > This patch moves the module options idVendor, idProduct and bcdDevice > from composite.c into each gadgets. This ensures compatibility with > current gadgets and removes the global variable which brings me step > closer towards composite.c in libcomposite > > Signed-off-by: Sebastian Andrzej Siewior <bige...@linutronix.de>
Acked-by: Michal Nazarewicz <min...@mina86.com> > diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h > index e970fba..7651e5b 100644 > --- a/include/linux/usb/composite.h > +++ b/include/linux/usb/composite.h > @@ -381,6 +381,30 @@ extern int usb_string_ids_tab(struct usb_composite_dev > *c, > struct usb_string *str); > extern int usb_string_ids_n(struct usb_composite_dev *c, unsigned n); > > +/* > + * Some systems will need runtime overrides for the product identifiers > + * published in the device descriptor, either numbers or strings or both. > + * String parameters are in UTF-8 (superset of ASCII's 7 bit characters). > + */ > +struct usb_composite_overwrite { > + u16 idVendor; > + u16 idProduct; > + u16 bcdDevice; > +}; > +#define USB_GADGET_COMPOSITE_OPTIONS() > \ > + static struct usb_composite_overwrite coverwrite; \ I would probably use something longer for the variable name, but that's just me. :) > + \ > + module_param_named(idVendor, coverwrite.idVendor, ushort, S_IRUGO); \ > + MODULE_PARM_DESC(idVendor, "USB Vendor ID"); \ > + \ > + module_param_named(idProduct, coverwrite.idProduct, ushort, S_IRUGO); \ > + MODULE_PARM_DESC(idProduct, "USB Product ID"); \ > + \ > + module_param_named(bcdDevice, coverwrite.bcdDevice, ushort, S_IRUGO); \ > + MODULE_PARM_DESC(bcdDevice, "USB Device version (BCD)") > + > +void usb_composite_overwrite_options(struct usb_composite_dev *cdev, > + struct usb_composite_overwrite *covr); > > /* messaging utils */ > #define DBG(d, fmt, args...) \ -- Best regards, _ _ .o. | Liege of Serenely Enlightened Majesty of o' \,=./ `o ..o | Computer Science, Michał “mina86” Nazarewicz (o o) ooo +----<email/xmpp: m...@google.com>--------------ooO--(_)--Ooo--
pgpN6M9KfHEO1.pgp
Description: PGP signature