Skip to contentSkip to conversation

usb:udc: Remove duplicated USB definitions from include/linux/usb/ch9.h file

PATCH New Lukasz Majewski 2 participants 4 messages Apr 12, 2012 – Apr 14, 2012 USB

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb:udc: Remove duplicated USB definitions from include/linux/usb/ch9.h file

Remove the repeated USB descriptor code and use usbdescriptors.h file. ch9.h file has been copied from linux and is needed for USB gadget related work.
Now usbdescriptors.h and ch9.h shall be used together.

---
 drivers/usb/gadget/config.c      |    1 +
 drivers/usb/gadget/epautoconf.c  |    1 +
 drivers/usb/gadget/ether.c       |    1 +
 drivers/usb/gadget/s3c_udc_otg.c |    1 +
 drivers/usb/gadget/usbstring.c   |    1 +
 include/linux/usb/ch9.h          |   67 --------------------------------------
 include/usb/s3c_udc.h            |    1 +
 7 files changed, 6 insertions(+), 67 deletions(-)
drivers/usb/gadget/config.c +1 -0
index f9163a8..f88d0c1 100644
@@ -27,6 +27,7 @@
 #include <linux/string.h>
 
 #include <linux/usb/ch9.h>
+#include <usbdescriptors.h>
 #include <linux/usb/gadget.h>
 
 
drivers/usb/gadget/epautoconf.c +1 -0
index 5b8776e..b656c8b 100644
@@ -23,6 +23,7 @@
 
 #include <common.h>
 #include <linux/usb/ch9.h>
+#include <usbdescriptors.h>
 #include <asm/errno.h>
 #include <linux/usb/gadget.h>
 #include <asm/unaligned.h>
drivers/usb/gadget/ether.c +1 -0
index 9fb0e80..f693fea 100644
@@ -24,6 +24,7 @@
 #include <asm/errno.h>
 #include <linux/netdevice.h>
 #include <linux/usb/ch9.h>
+#include <usbdescriptors.h>
 #include <linux/usb/cdc.h>
 #include <linux/usb/gadget.h>
 #include <net.h>
drivers/usb/gadget/s3c_udc_otg.c +1 -0
index 1050a98..f7f7b54 100644
@@ -37,6 +37,7 @@
 #include <malloc.h>
 
 #include <linux/usb/ch9.h>
+#include <usbdescriptors.h>
 #include <linux/usb/gadget.h>
 
 #include <asm/byteorder.h>
drivers/usb/gadget/usbstring.c +1 -0
index 95555cf..4dbe060 100644
@@ -13,6 +13,7 @@
 #include <common.h>
 #include <asm/errno.h>
 #include <linux/usb/ch9.h>
+#include <usbdescriptors.h>
 #include <linux/usb/gadget.h>
 
 #include <asm/unaligned.h>
include/linux/usb/ch9.h +0 -67

84 lines not on this page · raw message

include/usb/s3c_udc.h +1 -0
index 6c973b6..3e6135a 100644
@@ -24,6 +24,7 @@
 
 #include <asm/errno.h>
 #include <linux/usb/ch9.h>
+#include <usbdescriptors.h>
 #include <linux/usb/gadget.h>
 #include <linux/list.h>
 #include <usb/lin_gadget_compat.h>
Signature · 1 line
1.7.2.3
#1 lore raw

PATCH 1/1 usb:udc: Remove duplicated USB definitions from include/linux/usb/ch9.h file

Dear Lukasz Majewski,

Quoted 4 lines

Remove the repeated USB descriptor code and use usbdescriptors.h file. ch9.h file has been copied from linux and is needed for USB gadget related work.
Now usbdescriptors.h and ch9.h shall be used together.

Please don't expect my response on these patches earlier than in 2 days time -- I have a slow build-test machine. Also, I'll be eventually scheduling these for next release, ok?

Though I'll likely review these today.

btw. this patch looks reasonable, but I'll need to build-test it .

Quoted 109 lines
---
 drivers/usb/gadget/config.c      |    1 +
 drivers/usb/gadget/epautoconf.c  |    1 +
 drivers/usb/gadget/ether.c       |    1 +
 drivers/usb/gadget/s3c_udc_otg.c |    1 +
 drivers/usb/gadget/usbstring.c   |    1 +
 include/linux/usb/ch9.h          |   67
-------------------------------------- include/usb/s3c_udc.h            | 
  1 +
 7 files changed, 6 insertions(+), 67 deletions(-)
drivers/usb/gadget/config.c +1 -0
index f9163a8..f88d0c1 100644
@@ -27,6 +27,7 @@
 #include <linux/string.h>
 
 #include <linux/usb/ch9.h>
+#include <usbdescriptors.h>
 #include <linux/usb/gadget.h>
 
 
(quoted diff) +0 -0

b/drivers/usb/gadget/epautoconf.c index 5b8776e..b656c8b 100644

drivers/usb/gadget/epautoconf.c +1 -0
@@ -23,6 +23,7 @@
 
 #include <common.h>
 #include <linux/usb/ch9.h>
+#include <usbdescriptors.h>
 #include <asm/errno.h>
 #include <linux/usb/gadget.h>
 #include <asm/unaligned.h>
drivers/usb/gadget/ether.c +1 -0
index 9fb0e80..f693fea 100644
@@ -24,6 +24,7 @@
 #include <asm/errno.h>
 #include <linux/netdevice.h>
 #include <linux/usb/ch9.h>
+#include <usbdescriptors.h>
 #include <linux/usb/cdc.h>
 #include <linux/usb/gadget.h>
 #include <net.h>
(quoted diff) +0 -0

b/drivers/usb/gadget/s3c_udc_otg.c index 1050a98..f7f7b54 100644

drivers/usb/gadget/s3c_udc_otg.c +1 -0
@@ -37,6 +37,7 @@
 #include <malloc.h>
 
 #include <linux/usb/ch9.h>
+#include <usbdescriptors.h>
 #include <linux/usb/gadget.h>
 
 #include <asm/byteorder.h>
(quoted diff) +0 -0

b/drivers/usb/gadget/usbstring.c index 95555cf..4dbe060 100644

drivers/usb/gadget/usbstring.c +1 -0
@@ -13,6 +13,7 @@
 #include <common.h>
 #include <asm/errno.h>
 #include <linux/usb/ch9.h>
+#include <usbdescriptors.h>
 #include <linux/usb/gadget.h>
 
 #include <asm/unaligned.h>
include/linux/usb/ch9.h +0 -22
index 49b7483..ce1d1e1 100644
@@ -204,28 +204,6 @@ struct usb_descriptor_header {
 	__u8  bDescriptorType;
 } __attribute__ ((packed));
 
-
-/*------------------------------------------------------------------------
-*/ -
-/* USB_DT_DEVICE: Device descriptor */
-struct usb_device_descriptor {
-	__u8  bLength;
-	__u8  bDescriptorType;
-
-	__le16 bcdUSB;
-	__u8  bDeviceClass;
-	__u8  bDeviceSubClass;
-	__u8  bDeviceProtocol;
-	__u8  bMaxPacketSize0;
-	__le16 idVendor;
-	__le16 idProduct;
-	__le16 bcdDevice;
-	__u8  iManufacturer;
-	__u8  iProduct;
-	__u8  iSerialNumber;
-	__u8  bNumConfigurations;
-} __attribute__ ((packed));
-
 #define USB_DT_DEVICE_SIZE		18
 
 

include/linux/usb/ch9.h struct usb_config_descriptor { · line 261

Quoted 2 lines
include/linux/usb/ch9.h +0 -0
@@ -282,56 +260,11 @@ struct usb_config_descriptor {
 #define USB_CONFIG_ATT_WAKEUP		(1 << 5)	/* can wakeup */
 #define USB_CONFIG_ATT_BATTERY		(1 << 4)	/* battery 

powered */

Quoted 66 lines
include/linux/usb/ch9.h +0 -45
-/*------------------------------------------------------------------------
-*/ -
-/* USB_DT_STRING: String descriptor */
-struct usb_string_descriptor {
-	__u8  bLength;
-	__u8  bDescriptorType;
-
-	__le16 wData[1];		/* UTF-16LE encoded */
-} __attribute__ ((packed));
-
 /* note that "string" zero is special, it holds language codes that
  * the device supports, not Unicode characters.
  */
 
-/*------------------------------------------------------------------------
-*/ -
-/* USB_DT_INTERFACE: Interface descriptor */
-struct usb_interface_descriptor {
-	__u8  bLength;
-	__u8  bDescriptorType;
-
-	__u8  bInterfaceNumber;
-	__u8  bAlternateSetting;
-	__u8  bNumEndpoints;
-	__u8  bInterfaceClass;
-	__u8  bInterfaceSubClass;
-	__u8  bInterfaceProtocol;
-	__u8  iInterface;
-} __attribute__ ((packed));
-
 #define USB_DT_INTERFACE_SIZE		9
-
-/*------------------------------------------------------------------------
-*/ -
-/* USB_DT_ENDPOINT: Endpoint descriptor */
-struct usb_endpoint_descriptor {
-	__u8  bLength;
-	__u8  bDescriptorType;
-
-	__u8  bEndpointAddress;
-	__u8  bmAttributes;
-	__le16 wMaxPacketSize;
-	__u8  bInterval;
-
-	/* NOTE:  these two are _only_ in audio endpoints. */
-	/* use USB_DT_ENDPOINT*_SIZE in bLength, not sizeof. */
-	__u8  bRefresh;
-	__u8  bSynchAddress;
-} __attribute__ ((packed));
-
 #define USB_DT_ENDPOINT_SIZE		7
 #define USB_DT_ENDPOINT_AUDIO_SIZE	9	/* Audio extension */
 
include/usb/s3c_udc.h +1 -0
index 6c973b6..3e6135a 100644
@@ -24,6 +24,7 @@
 
 #include <asm/errno.h>
 #include <linux/usb/ch9.h>
+#include <usbdescriptors.h>
 #include <linux/usb/gadget.h>
 #include <linux/list.h>
 #include <usb/lin_gadget_compat.h>
#2 lore raw

PATCH 1/1 usb:udc: Remove duplicated USB definitions from include/linux/usb/ch9.h file

Hi Marek,

Quoted 9 lines

Dear Lukasz Majewski,

Quoted 4 lines

Remove the repeated USB descriptor code and use usbdescriptors.h file. ch9.h file has been copied from linux and is needed for USB gadget related work.
Now usbdescriptors.h and ch9.h shall be used together.

Quoted 3 lines

Please don't expect my response on these patches earlier than in 2 days time -- I have a slow build-test machine. Also, I'll be eventually scheduling these for next release, ok?

I think that good testing is welcome, since <usbstrings.h> and <ch9.h> are used widely (up to now separately) in USB. It can be submitted for -rc or next release. It depends if we manage to test it thoroughly.

BTW: Can you share information how could I get toolchains for mips, powerPC to test more architectures from MAKEALL script?

Do you use ELDK 5.1 or any "customized" toolchain? I'm planning to setup some build server.

Quoted 2 lines

Though I'll likely review these today.

Great.

Quoted 3 lines

btw. this patch looks reasonable, but I'll need to build-test it .

Signature · 6 lines
Best regards,

Lukasz Majewski

Samsung Poland R&D Center
Platform Group
#3 lore raw

PATCH 1/1 usb:udc: Remove duplicated USB definitions from include/linux/usb/ch9.h file

In reply to Lukasz Majewski

Dear Lukasz Majewski,

Quoted 8 lines

Remove the repeated USB descriptor code and use usbdescriptors.h file. ch9.h file has been copied from linux and is needed for USB gadget related work.
Now usbdescriptors.h and ch9.h shall be used together.

Quoted 105 lines
---
 drivers/usb/gadget/config.c      |    1 +
 drivers/usb/gadget/epautoconf.c  |    1 +
 drivers/usb/gadget/ether.c       |    1 +
 drivers/usb/gadget/s3c_udc_otg.c |    1 +
 drivers/usb/gadget/usbstring.c   |    1 +
 include/linux/usb/ch9.h          |   67
-------------------------------------- include/usb/s3c_udc.h            | 
  1 +
 7 files changed, 6 insertions(+), 67 deletions(-)
drivers/usb/gadget/config.c +1 -0
index f9163a8..f88d0c1 100644
@@ -27,6 +27,7 @@
 #include <linux/string.h>
 
 #include <linux/usb/ch9.h>
+#include <usbdescriptors.h>
 #include <linux/usb/gadget.h>
 
 
(quoted diff) +0 -0

b/drivers/usb/gadget/epautoconf.c index 5b8776e..b656c8b 100644

drivers/usb/gadget/epautoconf.c +1 -0
@@ -23,6 +23,7 @@
 
 #include <common.h>
 #include <linux/usb/ch9.h>
+#include <usbdescriptors.h>
 #include <asm/errno.h>
 #include <linux/usb/gadget.h>
 #include <asm/unaligned.h>
drivers/usb/gadget/ether.c +1 -0
index 9fb0e80..f693fea 100644
@@ -24,6 +24,7 @@
 #include <asm/errno.h>
 #include <linux/netdevice.h>
 #include <linux/usb/ch9.h>
+#include <usbdescriptors.h>
 #include <linux/usb/cdc.h>
 #include <linux/usb/gadget.h>
 #include <net.h>
(quoted diff) +0 -0

b/drivers/usb/gadget/s3c_udc_otg.c index 1050a98..f7f7b54 100644

drivers/usb/gadget/s3c_udc_otg.c +1 -0
@@ -37,6 +37,7 @@
 #include <malloc.h>
 
 #include <linux/usb/ch9.h>
+#include <usbdescriptors.h>
 #include <linux/usb/gadget.h>
 
 #include <asm/byteorder.h>
(quoted diff) +0 -0

b/drivers/usb/gadget/usbstring.c index 95555cf..4dbe060 100644

drivers/usb/gadget/usbstring.c +1 -0
@@ -13,6 +13,7 @@
 #include <common.h>
 #include <asm/errno.h>
 #include <linux/usb/ch9.h>
+#include <usbdescriptors.h>
 #include <linux/usb/gadget.h>
 
 #include <asm/unaligned.h>
include/linux/usb/ch9.h +0 -22
index 49b7483..ce1d1e1 100644
@@ -204,28 +204,6 @@ struct usb_descriptor_header {
 	__u8  bDescriptorType;
 } __attribute__ ((packed));
 
-
-/*------------------------------------------------------------------------
-*/ -
-/* USB_DT_DEVICE: Device descriptor */
-struct usb_device_descriptor {
-	__u8  bLength;
-	__u8  bDescriptorType;
-
-	__le16 bcdUSB;
-	__u8  bDeviceClass;
-	__u8  bDeviceSubClass;
-	__u8  bDeviceProtocol;
-	__u8  bMaxPacketSize0;
-	__le16 idVendor;
-	__le16 idProduct;
-	__le16 bcdDevice;
-	__u8  iManufacturer;
-	__u8  iProduct;
-	__u8  iSerialNumber;
-	__u8  bNumConfigurations;
-} __attribute__ ((packed));
-
 #define USB_DT_DEVICE_SIZE		18
 
 

include/linux/usb/ch9.h struct usb_config_descriptor { · line 261

Quoted 2 lines
include/linux/usb/ch9.h +0 -0
@@ -282,56 +260,11 @@ struct usb_config_descriptor {
 #define USB_CONFIG_ATT_WAKEUP		(1 << 5)	/* can wakeup */
 #define USB_CONFIG_ATT_BATTERY		(1 << 4)	/* battery 

powered */

Quoted 66 lines
include/linux/usb/ch9.h +0 -45
-/*------------------------------------------------------------------------
-*/ -
-/* USB_DT_STRING: String descriptor */
-struct usb_string_descriptor {
-	__u8  bLength;
-	__u8  bDescriptorType;
-
-	__le16 wData[1];		/* UTF-16LE encoded */
-} __attribute__ ((packed));
-
 /* note that "string" zero is special, it holds language codes that
  * the device supports, not Unicode characters.
  */
 
-/*------------------------------------------------------------------------
-*/ -
-/* USB_DT_INTERFACE: Interface descriptor */
-struct usb_interface_descriptor {
-	__u8  bLength;
-	__u8  bDescriptorType;
-
-	__u8  bInterfaceNumber;
-	__u8  bAlternateSetting;
-	__u8  bNumEndpoints;
-	__u8  bInterfaceClass;
-	__u8  bInterfaceSubClass;
-	__u8  bInterfaceProtocol;
-	__u8  iInterface;
-} __attribute__ ((packed));
-
 #define USB_DT_INTERFACE_SIZE		9
-
-/*------------------------------------------------------------------------
-*/ -
-/* USB_DT_ENDPOINT: Endpoint descriptor */
-struct usb_endpoint_descriptor {
-	__u8  bLength;
-	__u8  bDescriptorType;
-
-	__u8  bEndpointAddress;
-	__u8  bmAttributes;
-	__le16 wMaxPacketSize;
-	__u8  bInterval;
-
-	/* NOTE:  these two are _only_ in audio endpoints. */
-	/* use USB_DT_ENDPOINT*_SIZE in bLength, not sizeof. */
-	__u8  bRefresh;
-	__u8  bSynchAddress;
-} __attribute__ ((packed));
-
 #define USB_DT_ENDPOINT_SIZE		7
 #define USB_DT_ENDPOINT_AUDIO_SIZE	9	/* Audio extension */
 
include/usb/s3c_udc.h +1 -0
index 6c973b6..3e6135a 100644
@@ -24,6 +24,7 @@
 
 #include <asm/errno.h>
 #include <linux/usb/ch9.h>
+#include <usbdescriptors.h>
 #include <linux/usb/gadget.h>
 #include <linux/list.h>
 #include <usb/lin_gadget_compat.h>