Re: [PATCH 09/20] usb/gadget: push VID/PID/USB BCD module option into gadgets

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 08/24/2012 11:34 PM, Michal Nazarewicz wrote:
diff --git a/drivers/usb/gadget/audio.c b/drivers/usb/gadget/audio.c
index 689d142..a9c687a 100644
--- a/drivers/usb/gadget/audio.c
+++ b/drivers/usb/gadget/audio.c
@@ -13,6 +13,7 @@

  #include<linux/kernel.h>
  #include<linux/utsname.h>
+#include<linux/usb/composite.h>

Why is this needed in this patch?  I think it belongs to one of the
later patches.

The USB_GADGET_COMPOSITE_OPTIONS() is defined there and nobody probably
included this. However we still should have composite.c... I could
recheck if you want.

diff --git a/drivers/usb/gadget/printer.c b/drivers/usb/gadget/printer.c
index 3d3d20d..39279e2 100644
--- a/drivers/usb/gadget/printer.c
+++ b/drivers/usb/gadget/printer.c
@@ -54,6 +54,7 @@
  #include "composite.c"

  /*-------------------------------------------------------------------------*/
+USB_GADGET_COMPOSITE_OPTIONS();

  #define DRIVER_DESC		"Printer Gadget"
  #define DRIVER_VERSION		"2007 OCT 06"
@@ -1263,7 +1264,13 @@ static int printer_unbind(struct usb_composite_dev *cdev)

  static int __init printer_bind(struct usb_composite_dev *cdev)
  {
-	return usb_add_config(cdev,&printer_cfg_driver, printer_bind_config);
+	int ret;
+
+	ret = usb_add_config(cdev,&printer_cfg_driver, printer_bind_config);
+	if (ret)
+		return ret;
+	USB_GADGET_COMPOSITE_OVERWRITE_OPTIONS(device_desc);
+	return 0;

Alternatively you could just add invocation of the
USB_GADGET_COMPOSITE_OVERWRITE_OPTIONS(device_desc) macro before the
usb_add_config() is added, which would add only one additional line,
like so:

  {
+	USB_GADGET_COMPOSITE_OVERWRITE_OPTIONS(device_desc);
  	return usb_add_config(cdev,&printer_cfg_driver, printer_bind_config);
  }

I added it always more or less as the last the thing in the bind
function because this reflects the same behavior before I pushed it
from composite down to the gadget driver.

I add later iSerialNumber and so on. Do you want these was well to be
moved before this usb_add_config()?

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


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux