summaryrefslogtreecommitdiff
path: root/recipes/linux/linux-2.6.18/usb-serial-align-all-descriptors-on-a-word-boundary.patch
blob: f78063c9fb0ad37bcde10e7b1615363d8db41fe9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
From nobody Mon Sep 17 00:00:00 2001
From: Håvard Skinnemoen <hskinnemoen@atmel.com>
Date: Tue Feb 28 08:51:18 2006 +0100
Subject: [PATCH] USB Serial: Align all descriptors on a word boundary

Seems like gcc has problems with packed structs, so we'll just align
them explicitly.

---

 drivers/usb/gadget/serial.c |   28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

Index: linux-2.6.18-avr32/drivers/usb/gadget/serial.c
===================================================================
--- linux-2.6.18-avr32.orig/drivers/usb/gadget/serial.c	2006-09-11 14:36:02.000000000 +0200
+++ linux-2.6.18-avr32/drivers/usb/gadget/serial.c	2006-09-12 10:17:52.000000000 +0200
@@ -333,7 +333,7 @@ static struct usb_gadget_strings gs_stri
 	.strings =		gs_strings,
 };
 
-static struct usb_device_descriptor gs_device_desc = {
+static struct usb_device_descriptor __attribute__((aligned(2))) gs_device_desc = {
 	.bLength =		USB_DT_DEVICE_SIZE,
 	.bDescriptorType =	USB_DT_DEVICE,
 	.bcdUSB =		__constant_cpu_to_le16(0x0200),
@@ -353,7 +353,7 @@ static struct usb_otg_descriptor gs_otg_
 	.bmAttributes =		USB_OTG_SRP,
 };
 
-static struct usb_config_descriptor gs_bulk_config_desc = {
+static struct usb_config_descriptor __attribute__((aligned(2))) gs_bulk_config_desc = {
 	.bLength =		USB_DT_CONFIG_SIZE,
 	.bDescriptorType =	USB_DT_CONFIG,
 	/* .wTotalLength computed dynamically */
@@ -364,7 +364,7 @@ static struct usb_config_descriptor gs_b
 	.bMaxPower =		1,
 };
 
-static struct usb_config_descriptor gs_acm_config_desc = {
+static struct usb_config_descriptor __attribute__((aligned(2))) gs_acm_config_desc = {
 	.bLength =		USB_DT_CONFIG_SIZE,
 	.bDescriptorType =	USB_DT_CONFIG,
 	/* .wTotalLength computed dynamically */
@@ -375,7 +375,7 @@ static struct usb_config_descriptor gs_a
 	.bMaxPower =		1,
 };
 
-static const struct usb_interface_descriptor gs_bulk_interface_desc = {
+static const struct usb_interface_descriptor __attribute__((aligned(2))) gs_bulk_interface_desc = {
 	.bLength =		USB_DT_INTERFACE_SIZE,
 	.bDescriptorType =	USB_DT_INTERFACE,
 	.bInterfaceNumber =	GS_BULK_INTERFACE_ID,
@@ -386,7 +386,7 @@ static const struct usb_interface_descri
 	.iInterface =		GS_DATA_STR_ID,
 };
 
-static const struct usb_interface_descriptor gs_control_interface_desc = {
+static const struct usb_interface_descriptor __attribute__((aligned(2))) gs_control_interface_desc = {
 	.bLength =		USB_DT_INTERFACE_SIZE,
 	.bDescriptorType =	USB_DT_INTERFACE,
 	.bInterfaceNumber =	GS_CONTROL_INTERFACE_ID,
@@ -397,7 +397,7 @@ static const struct usb_interface_descri
 	.iInterface =		GS_CONTROL_STR_ID,
 };
 
-static const struct usb_interface_descriptor gs_data_interface_desc = {
+static const struct usb_interface_descriptor __attribute__((aligned(2))) gs_data_interface_desc = {
 	.bLength =		USB_DT_INTERFACE_SIZE,
 	.bDescriptorType =	USB_DT_INTERFACE,
 	.bInterfaceNumber =	GS_DATA_INTERFACE_ID,
@@ -408,7 +408,7 @@ static const struct usb_interface_descri
 	.iInterface =		GS_DATA_STR_ID,
 };
 
-static const struct usb_cdc_header_desc gs_header_desc = {
+static const struct usb_cdc_header_desc __attribute__((aligned(2))) gs_header_desc = {
 	.bLength =		sizeof(gs_header_desc),
 	.bDescriptorType =	USB_DT_CS_INTERFACE,
 	.bDescriptorSubType =	USB_CDC_HEADER_TYPE,
@@ -438,7 +438,7 @@ static const struct usb_cdc_union_desc g
 	.bSlaveInterface0 =	1,	/* index of data interface */
 };
  
-static struct usb_endpoint_descriptor gs_fullspeed_notify_desc = {
+static struct usb_endpoint_descriptor __attribute__((aligned(2))) gs_fullspeed_notify_desc = {
 	.bLength =		USB_DT_ENDPOINT_SIZE,
 	.bDescriptorType =	USB_DT_ENDPOINT,
 	.bEndpointAddress =	USB_DIR_IN,
@@ -447,14 +447,14 @@ static struct usb_endpoint_descriptor gs
 	.bInterval =		1 << GS_LOG2_NOTIFY_INTERVAL,
 };
 
-static struct usb_endpoint_descriptor gs_fullspeed_in_desc = {
+static struct usb_endpoint_descriptor __attribute__((aligned(2))) gs_fullspeed_in_desc = {
 	.bLength =		USB_DT_ENDPOINT_SIZE,
 	.bDescriptorType =	USB_DT_ENDPOINT,
 	.bEndpointAddress =	USB_DIR_IN,
 	.bmAttributes =		USB_ENDPOINT_XFER_BULK,
 };
 
-static struct usb_endpoint_descriptor gs_fullspeed_out_desc = {
+static struct usb_endpoint_descriptor __attribute__((aligned(2))) gs_fullspeed_out_desc = {
 	.bLength =		USB_DT_ENDPOINT_SIZE,
 	.bDescriptorType =	USB_DT_ENDPOINT,
 	.bEndpointAddress =	USB_DIR_OUT,
@@ -484,7 +484,7 @@ static const struct usb_descriptor_heade
 };
 
 #ifdef CONFIG_USB_GADGET_DUALSPEED
-static struct usb_endpoint_descriptor gs_highspeed_notify_desc = {
+static struct usb_endpoint_descriptor __attribute__((aligned(2))) gs_highspeed_notify_desc = {
 	.bLength =		USB_DT_ENDPOINT_SIZE,
 	.bDescriptorType =	USB_DT_ENDPOINT,
 	.bEndpointAddress =	USB_DIR_IN,
@@ -493,21 +493,21 @@ static struct usb_endpoint_descriptor gs
 	.bInterval =		GS_LOG2_NOTIFY_INTERVAL+4,
 };
 
-static struct usb_endpoint_descriptor gs_highspeed_in_desc = {
+static struct usb_endpoint_descriptor __attribute__((aligned(2))) gs_highspeed_in_desc = {
 	.bLength =		USB_DT_ENDPOINT_SIZE,
 	.bDescriptorType =	USB_DT_ENDPOINT,
 	.bmAttributes =		USB_ENDPOINT_XFER_BULK,
 	.wMaxPacketSize =	__constant_cpu_to_le16(512),
 };
 
-static struct usb_endpoint_descriptor gs_highspeed_out_desc = {
+static struct usb_endpoint_descriptor __attribute__((aligned(2))) gs_highspeed_out_desc = {
 	.bLength =		USB_DT_ENDPOINT_SIZE,
 	.bDescriptorType =	USB_DT_ENDPOINT,
 	.bmAttributes =		USB_ENDPOINT_XFER_BULK,
 	.wMaxPacketSize =	__constant_cpu_to_le16(512),
 };
 
-static struct usb_qualifier_descriptor gs_qualifier_desc = {
+static struct usb_qualifier_descriptor __attribute__((aligned(2))) gs_qualifier_desc = {
 	.bLength =		sizeof(struct usb_qualifier_descriptor),
 	.bDescriptorType =	USB_DT_DEVICE_QUALIFIER,
 	.bcdUSB =		__constant_cpu_to_le16 (0x0200),