Annotation of /trunk/kernel-magellan/patches-3.6/0100-3.6.1-all-fixes.patch
Parent Directory | Revision Log
Revision 1921 -
(hide annotations)
(download)
Fri Oct 26 08:33:00 2012 UTC (11 years, 11 months ago) by niro
File size: 75168 byte(s)
Fri Oct 26 08:33:00 2012 UTC (11 years, 11 months ago) by niro
File size: 75168 byte(s)
-3.6.3-magellan-r1
1 | niro | 1921 | diff --git a/arch/arm/plat-omap/include/plat/omap-serial.h b/arch/arm/plat-omap/include/plat/omap-serial.h |
2 | index 1a52725..3a57644 100644 | ||
3 | --- a/arch/arm/plat-omap/include/plat/omap-serial.h | ||
4 | +++ b/arch/arm/plat-omap/include/plat/omap-serial.h | ||
5 | @@ -42,10 +42,10 @@ | ||
6 | #define OMAP_UART_WER_MOD_WKUP 0X7F | ||
7 | |||
8 | /* Enable XON/XOFF flow control on output */ | ||
9 | -#define OMAP_UART_SW_TX 0x04 | ||
10 | +#define OMAP_UART_SW_TX 0x8 | ||
11 | |||
12 | /* Enable XON/XOFF flow control on input */ | ||
13 | -#define OMAP_UART_SW_RX 0x04 | ||
14 | +#define OMAP_UART_SW_RX 0x2 | ||
15 | |||
16 | #define OMAP_UART_SYSC_RESET 0X07 | ||
17 | #define OMAP_UART_TCR_TRIG 0X0F | ||
18 | diff --git a/drivers/char/ttyprintk.c b/drivers/char/ttyprintk.c | ||
19 | index 46b77ed..a7c6d6a 100644 | ||
20 | --- a/drivers/char/ttyprintk.c | ||
21 | +++ b/drivers/char/ttyprintk.c | ||
22 | @@ -67,7 +67,7 @@ static int tpk_printk(const unsigned char *buf, int count) | ||
23 | tmp[tpk_curr + 1] = '\0'; | ||
24 | printk(KERN_INFO "%s%s", tpk_tag, tmp); | ||
25 | tpk_curr = 0; | ||
26 | - if (buf[i + 1] == '\n') | ||
27 | + if ((i + 1) < count && buf[i + 1] == '\n') | ||
28 | i++; | ||
29 | break; | ||
30 | case '\n': | ||
31 | diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c | ||
32 | index 47408e8..d10c987 100644 | ||
33 | --- a/drivers/firmware/efivars.c | ||
34 | +++ b/drivers/firmware/efivars.c | ||
35 | @@ -435,12 +435,23 @@ efivar_attr_read(struct efivar_entry *entry, char *buf) | ||
36 | if (status != EFI_SUCCESS) | ||
37 | return -EIO; | ||
38 | |||
39 | - if (var->Attributes & 0x1) | ||
40 | + if (var->Attributes & EFI_VARIABLE_NON_VOLATILE) | ||
41 | str += sprintf(str, "EFI_VARIABLE_NON_VOLATILE\n"); | ||
42 | - if (var->Attributes & 0x2) | ||
43 | + if (var->Attributes & EFI_VARIABLE_BOOTSERVICE_ACCESS) | ||
44 | str += sprintf(str, "EFI_VARIABLE_BOOTSERVICE_ACCESS\n"); | ||
45 | - if (var->Attributes & 0x4) | ||
46 | + if (var->Attributes & EFI_VARIABLE_RUNTIME_ACCESS) | ||
47 | str += sprintf(str, "EFI_VARIABLE_RUNTIME_ACCESS\n"); | ||
48 | + if (var->Attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD) | ||
49 | + str += sprintf(str, "EFI_VARIABLE_HARDWARE_ERROR_RECORD\n"); | ||
50 | + if (var->Attributes & EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS) | ||
51 | + str += sprintf(str, | ||
52 | + "EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS\n"); | ||
53 | + if (var->Attributes & | ||
54 | + EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS) | ||
55 | + str += sprintf(str, | ||
56 | + "EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS\n"); | ||
57 | + if (var->Attributes & EFI_VARIABLE_APPEND_WRITE) | ||
58 | + str += sprintf(str, "EFI_VARIABLE_APPEND_WRITE\n"); | ||
59 | return str - buf; | ||
60 | } | ||
61 | |||
62 | diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c | ||
63 | index 8bcd168..5de3bb3 100644 | ||
64 | --- a/drivers/hid/hid-core.c | ||
65 | +++ b/drivers/hid/hid-core.c | ||
66 | @@ -757,6 +757,7 @@ int hid_open_report(struct hid_device *device) | ||
67 | struct hid_item item; | ||
68 | unsigned int size; | ||
69 | __u8 *start; | ||
70 | + __u8 *buf; | ||
71 | __u8 *end; | ||
72 | int ret; | ||
73 | static int (*dispatch_type[])(struct hid_parser *parser, | ||
74 | @@ -775,12 +776,21 @@ int hid_open_report(struct hid_device *device) | ||
75 | return -ENODEV; | ||
76 | size = device->dev_rsize; | ||
77 | |||
78 | + buf = kmemdup(start, size, GFP_KERNEL); | ||
79 | + if (buf == NULL) | ||
80 | + return -ENOMEM; | ||
81 | + | ||
82 | if (device->driver->report_fixup) | ||
83 | - start = device->driver->report_fixup(device, start, &size); | ||
84 | + start = device->driver->report_fixup(device, buf, &size); | ||
85 | + else | ||
86 | + start = buf; | ||
87 | |||
88 | - device->rdesc = kmemdup(start, size, GFP_KERNEL); | ||
89 | - if (device->rdesc == NULL) | ||
90 | + start = kmemdup(start, size, GFP_KERNEL); | ||
91 | + kfree(buf); | ||
92 | + if (start == NULL) | ||
93 | return -ENOMEM; | ||
94 | + | ||
95 | + device->rdesc = start; | ||
96 | device->rsize = size; | ||
97 | |||
98 | parser = vzalloc(sizeof(struct hid_parser)); | ||
99 | diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c | ||
100 | index dedd8e4..8e0c4bf94 100644 | ||
101 | --- a/drivers/hid/usbhid/hid-core.c | ||
102 | +++ b/drivers/hid/usbhid/hid-core.c | ||
103 | @@ -1415,20 +1415,20 @@ static int hid_post_reset(struct usb_interface *intf) | ||
104 | * configuration descriptors passed, we already know that | ||
105 | * the size of the HID report descriptor has not changed. | ||
106 | */ | ||
107 | - rdesc = kmalloc(hid->rsize, GFP_KERNEL); | ||
108 | + rdesc = kmalloc(hid->dev_rsize, GFP_KERNEL); | ||
109 | if (!rdesc) { | ||
110 | dbg_hid("couldn't allocate rdesc memory (post_reset)\n"); | ||
111 | return 1; | ||
112 | } | ||
113 | status = hid_get_class_descriptor(dev, | ||
114 | interface->desc.bInterfaceNumber, | ||
115 | - HID_DT_REPORT, rdesc, hid->rsize); | ||
116 | + HID_DT_REPORT, rdesc, hid->dev_rsize); | ||
117 | if (status < 0) { | ||
118 | dbg_hid("reading report descriptor failed (post_reset)\n"); | ||
119 | kfree(rdesc); | ||
120 | return 1; | ||
121 | } | ||
122 | - status = memcmp(rdesc, hid->rdesc, hid->rsize); | ||
123 | + status = memcmp(rdesc, hid->dev_rdesc, hid->dev_rsize); | ||
124 | kfree(rdesc); | ||
125 | if (status != 0) { | ||
126 | dbg_hid("report descriptor changed\n"); | ||
127 | diff --git a/drivers/infiniband/hw/qib/qib_keys.c b/drivers/infiniband/hw/qib/qib_keys.c | ||
128 | index e9486c7..81c7b73 100644 | ||
129 | --- a/drivers/infiniband/hw/qib/qib_keys.c | ||
130 | +++ b/drivers/infiniband/hw/qib/qib_keys.c | ||
131 | @@ -186,8 +186,9 @@ int qib_lkey_ok(struct qib_lkey_table *rkt, struct qib_pd *pd, | ||
132 | goto bail; | ||
133 | |||
134 | off = sge->addr - mr->user_base; | ||
135 | - if (unlikely(sge->addr < mr->iova || off + sge->length > mr->length || | ||
136 | - (mr->access_flags & acc) == 0)) | ||
137 | + if (unlikely(sge->addr < mr->user_base || | ||
138 | + off + sge->length > mr->length || | ||
139 | + (mr->access_flags & acc) != acc)) | ||
140 | goto bail; | ||
141 | if (unlikely(!atomic_inc_not_zero(&mr->refcount))) | ||
142 | goto bail; | ||
143 | diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c | ||
144 | index 1e19b5a..ea0dfc7 100644 | ||
145 | --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c | ||
146 | +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c | ||
147 | @@ -150,7 +150,7 @@ static int ipoib_stop(struct net_device *dev) | ||
148 | |||
149 | netif_stop_queue(dev); | ||
150 | |||
151 | - ipoib_ib_dev_down(dev, 0); | ||
152 | + ipoib_ib_dev_down(dev, 1); | ||
153 | ipoib_ib_dev_stop(dev, 0); | ||
154 | |||
155 | if (!test_bit(IPOIB_FLAG_SUBINTERFACE, &priv->flags)) { | ||
156 | diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c | ||
157 | index 7536724..cecb98a 100644 | ||
158 | --- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c | ||
159 | +++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c | ||
160 | @@ -175,7 +175,9 @@ static int ipoib_mcast_join_finish(struct ipoib_mcast *mcast, | ||
161 | |||
162 | mcast->mcmember = *mcmember; | ||
163 | |||
164 | - /* Set the cached Q_Key before we attach if it's the broadcast group */ | ||
165 | + /* Set the multicast MTU and cached Q_Key before we attach if it's | ||
166 | + * the broadcast group. | ||
167 | + */ | ||
168 | if (!memcmp(mcast->mcmember.mgid.raw, priv->dev->broadcast + 4, | ||
169 | sizeof (union ib_gid))) { | ||
170 | spin_lock_irq(&priv->lock); | ||
171 | @@ -183,10 +185,17 @@ static int ipoib_mcast_join_finish(struct ipoib_mcast *mcast, | ||
172 | spin_unlock_irq(&priv->lock); | ||
173 | return -EAGAIN; | ||
174 | } | ||
175 | + priv->mcast_mtu = IPOIB_UD_MTU(ib_mtu_enum_to_int(priv->broadcast->mcmember.mtu)); | ||
176 | priv->qkey = be32_to_cpu(priv->broadcast->mcmember.qkey); | ||
177 | spin_unlock_irq(&priv->lock); | ||
178 | priv->tx_wr.wr.ud.remote_qkey = priv->qkey; | ||
179 | set_qkey = 1; | ||
180 | + | ||
181 | + if (!ipoib_cm_admin_enabled(dev)) { | ||
182 | + rtnl_lock(); | ||
183 | + dev_set_mtu(dev, min(priv->mcast_mtu, priv->admin_mtu)); | ||
184 | + rtnl_unlock(); | ||
185 | + } | ||
186 | } | ||
187 | |||
188 | if (!test_bit(IPOIB_MCAST_FLAG_SENDONLY, &mcast->flags)) { | ||
189 | @@ -574,14 +583,6 @@ void ipoib_mcast_join_task(struct work_struct *work) | ||
190 | return; | ||
191 | } | ||
192 | |||
193 | - priv->mcast_mtu = IPOIB_UD_MTU(ib_mtu_enum_to_int(priv->broadcast->mcmember.mtu)); | ||
194 | - | ||
195 | - if (!ipoib_cm_admin_enabled(dev)) { | ||
196 | - rtnl_lock(); | ||
197 | - dev_set_mtu(dev, min(priv->mcast_mtu, priv->admin_mtu)); | ||
198 | - rtnl_unlock(); | ||
199 | - } | ||
200 | - | ||
201 | ipoib_dbg_mcast(priv, "successfully joined all multicast groups\n"); | ||
202 | |||
203 | clear_bit(IPOIB_MCAST_RUN, &priv->flags); | ||
204 | diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c | ||
205 | index 1b5b0c7..922d845 100644 | ||
206 | --- a/drivers/infiniband/ulp/srp/ib_srp.c | ||
207 | +++ b/drivers/infiniband/ulp/srp/ib_srp.c | ||
208 | @@ -638,9 +638,9 @@ static void srp_reset_req(struct srp_target_port *target, struct srp_request *re | ||
209 | struct scsi_cmnd *scmnd = srp_claim_req(target, req, NULL); | ||
210 | |||
211 | if (scmnd) { | ||
212 | + srp_free_req(target, req, scmnd, 0); | ||
213 | scmnd->result = DID_RESET << 16; | ||
214 | scmnd->scsi_done(scmnd); | ||
215 | - srp_free_req(target, req, scmnd, 0); | ||
216 | } | ||
217 | } | ||
218 | |||
219 | @@ -1687,6 +1687,7 @@ static int srp_abort(struct scsi_cmnd *scmnd) | ||
220 | SRP_TSK_ABORT_TASK); | ||
221 | srp_free_req(target, req, scmnd, 0); | ||
222 | scmnd->result = DID_ABORT << 16; | ||
223 | + scmnd->scsi_done(scmnd); | ||
224 | |||
225 | return SUCCESS; | ||
226 | } | ||
227 | diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c | ||
228 | index 14eaece..0786919 100644 | ||
229 | --- a/drivers/input/mouse/synaptics.c | ||
230 | +++ b/drivers/input/mouse/synaptics.c | ||
231 | @@ -53,14 +53,19 @@ | ||
232 | #define ABS_POS_BITS 13 | ||
233 | |||
234 | /* | ||
235 | - * Any position values from the hardware above the following limits are | ||
236 | - * treated as "wrapped around negative" values that have been truncated to | ||
237 | - * the 13-bit reporting range of the hardware. These are just reasonable | ||
238 | - * guesses and can be adjusted if hardware is found that operates outside | ||
239 | - * of these parameters. | ||
240 | + * These values should represent the absolute maximum value that will | ||
241 | + * be reported for a positive position value. Some Synaptics firmware | ||
242 | + * uses this value to indicate a finger near the edge of the touchpad | ||
243 | + * whose precise position cannot be determined. | ||
244 | + * | ||
245 | + * At least one touchpad is known to report positions in excess of this | ||
246 | + * value which are actually negative values truncated to the 13-bit | ||
247 | + * reporting range. These values have never been observed to be lower | ||
248 | + * than 8184 (i.e. -8), so we treat all values greater than 8176 as | ||
249 | + * negative and any other value as positive. | ||
250 | */ | ||
251 | -#define X_MAX_POSITIVE (((1 << ABS_POS_BITS) + XMAX) / 2) | ||
252 | -#define Y_MAX_POSITIVE (((1 << ABS_POS_BITS) + YMAX) / 2) | ||
253 | +#define X_MAX_POSITIVE 8176 | ||
254 | +#define Y_MAX_POSITIVE 8176 | ||
255 | |||
256 | /***************************************************************************** | ||
257 | * Stuff we need even when we do not want native Synaptics support | ||
258 | @@ -604,11 +609,21 @@ static int synaptics_parse_hw_state(const unsigned char buf[], | ||
259 | hw->right = (buf[0] & 0x02) ? 1 : 0; | ||
260 | } | ||
261 | |||
262 | - /* Convert wrap-around values to negative */ | ||
263 | + /* | ||
264 | + * Convert wrap-around values to negative. (X|Y)_MAX_POSITIVE | ||
265 | + * is used by some firmware to indicate a finger at the edge of | ||
266 | + * the touchpad whose precise position cannot be determined, so | ||
267 | + * convert these values to the maximum axis value. | ||
268 | + */ | ||
269 | if (hw->x > X_MAX_POSITIVE) | ||
270 | hw->x -= 1 << ABS_POS_BITS; | ||
271 | + else if (hw->x == X_MAX_POSITIVE) | ||
272 | + hw->x = XMAX; | ||
273 | + | ||
274 | if (hw->y > Y_MAX_POSITIVE) | ||
275 | hw->y -= 1 << ABS_POS_BITS; | ||
276 | + else if (hw->y == Y_MAX_POSITIVE) | ||
277 | + hw->y = YMAX; | ||
278 | |||
279 | return 0; | ||
280 | } | ||
281 | diff --git a/drivers/mtd/ubi/attach.c b/drivers/mtd/ubi/attach.c | ||
282 | index bd27cbb..68d4d1f 100644 | ||
283 | --- a/drivers/mtd/ubi/attach.c | ||
284 | +++ b/drivers/mtd/ubi/attach.c | ||
285 | @@ -975,7 +975,7 @@ static int scan_peb(struct ubi_device *ubi, struct ubi_attach_info *ai, | ||
286 | return err; | ||
287 | goto adjust_mean_ec; | ||
288 | case UBI_IO_FF: | ||
289 | - if (ec_err) | ||
290 | + if (ec_err || bitflips) | ||
291 | err = add_to_list(ai, pnum, UBI_UNKNOWN, | ||
292 | UBI_UNKNOWN, ec, 1, &ai->erase); | ||
293 | else | ||
294 | diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c | ||
295 | index 2c5ed5c..da052ed 100644 | ||
296 | --- a/drivers/mtd/ubi/build.c | ||
297 | +++ b/drivers/mtd/ubi/build.c | ||
298 | @@ -759,6 +759,11 @@ static int autoresize(struct ubi_device *ubi, int vol_id) | ||
299 | struct ubi_volume *vol = ubi->volumes[vol_id]; | ||
300 | int err, old_reserved_pebs = vol->reserved_pebs; | ||
301 | |||
302 | + if (ubi->ro_mode) { | ||
303 | + ubi_warn("skip auto-resize because of R/O mode"); | ||
304 | + return 0; | ||
305 | + } | ||
306 | + | ||
307 | /* | ||
308 | * Clear the auto-resize flag in the volume in-memory copy of the | ||
309 | * volume table, and 'ubi_resize_volume()' will propagate this change | ||
310 | diff --git a/drivers/net/can/mscan/mpc5xxx_can.c b/drivers/net/can/mscan/mpc5xxx_can.c | ||
311 | index 06adf88..524ef96 100644 | ||
312 | --- a/drivers/net/can/mscan/mpc5xxx_can.c | ||
313 | +++ b/drivers/net/can/mscan/mpc5xxx_can.c | ||
314 | @@ -181,7 +181,7 @@ static u32 __devinit mpc512x_can_get_clock(struct platform_device *ofdev, | ||
315 | |||
316 | if (!clock_name || !strcmp(clock_name, "sys")) { | ||
317 | sys_clk = clk_get(&ofdev->dev, "sys_clk"); | ||
318 | - if (!sys_clk) { | ||
319 | + if (IS_ERR(sys_clk)) { | ||
320 | dev_err(&ofdev->dev, "couldn't get sys_clk\n"); | ||
321 | goto exit_unmap; | ||
322 | } | ||
323 | @@ -204,7 +204,7 @@ static u32 __devinit mpc512x_can_get_clock(struct platform_device *ofdev, | ||
324 | |||
325 | if (clocksrc < 0) { | ||
326 | ref_clk = clk_get(&ofdev->dev, "ref_clk"); | ||
327 | - if (!ref_clk) { | ||
328 | + if (IS_ERR(ref_clk)) { | ||
329 | dev_err(&ofdev->dev, "couldn't get ref_clk\n"); | ||
330 | goto exit_unmap; | ||
331 | } | ||
332 | diff --git a/drivers/net/wireless/ath/ath9k/pci.c b/drivers/net/wireless/ath/ath9k/pci.c | ||
333 | index a978984..0c43e7f 100644 | ||
334 | --- a/drivers/net/wireless/ath/ath9k/pci.c | ||
335 | +++ b/drivers/net/wireless/ath/ath9k/pci.c | ||
336 | @@ -127,8 +127,9 @@ static void ath_pci_aspm_init(struct ath_common *common) | ||
337 | if (!parent) | ||
338 | return; | ||
339 | |||
340 | - if (ath9k_hw_get_btcoex_scheme(ah) != ATH_BTCOEX_CFG_NONE) { | ||
341 | - /* Bluetooth coexistance requires disabling ASPM. */ | ||
342 | + if ((ath9k_hw_get_btcoex_scheme(ah) != ATH_BTCOEX_CFG_NONE) && | ||
343 | + (AR_SREV_9285(ah))) { | ||
344 | + /* Bluetooth coexistance requires disabling ASPM for AR9285. */ | ||
345 | pci_read_config_byte(pdev, pos + PCI_EXP_LNKCTL, &aspm); | ||
346 | aspm &= ~(PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1); | ||
347 | pci_write_config_byte(pdev, pos + PCI_EXP_LNKCTL, aspm); | ||
348 | diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c | ||
349 | index 8156135..0ef08e0 100644 | ||
350 | --- a/drivers/net/wireless/b43legacy/main.c | ||
351 | +++ b/drivers/net/wireless/b43legacy/main.c | ||
352 | @@ -3894,6 +3894,8 @@ static void b43legacy_remove(struct ssb_device *dev) | ||
353 | cancel_work_sync(&wl->firmware_load); | ||
354 | |||
355 | B43legacy_WARN_ON(!wl); | ||
356 | + if (!wldev->fw.ucode) | ||
357 | + return; /* NULL if fw never loaded */ | ||
358 | if (wl->current_dev == wldev) | ||
359 | ieee80211_unregister_hw(wl->hw); | ||
360 | |||
361 | diff --git a/drivers/remoteproc/Kconfig b/drivers/remoteproc/Kconfig | ||
362 | index f8d818a..811ff72 100644 | ||
363 | --- a/drivers/remoteproc/Kconfig | ||
364 | +++ b/drivers/remoteproc/Kconfig | ||
365 | @@ -5,6 +5,7 @@ config REMOTEPROC | ||
366 | tristate | ||
367 | depends on EXPERIMENTAL | ||
368 | select FW_CONFIG | ||
369 | + select VIRTIO | ||
370 | |||
371 | config OMAP_REMOTEPROC | ||
372 | tristate "OMAP remoteproc support" | ||
373 | diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c | ||
374 | index d5c2dbf..70b296f 100644 | ||
375 | --- a/drivers/remoteproc/remoteproc_core.c | ||
376 | +++ b/drivers/remoteproc/remoteproc_core.c | ||
377 | @@ -545,17 +545,10 @@ static int rproc_handle_carveout(struct rproc *rproc, | ||
378 | dev_dbg(dev, "carveout rsc: da %x, pa %x, len %x, flags %x\n", | ||
379 | rsc->da, rsc->pa, rsc->len, rsc->flags); | ||
380 | |||
381 | - mapping = kzalloc(sizeof(*mapping), GFP_KERNEL); | ||
382 | - if (!mapping) { | ||
383 | - dev_err(dev, "kzalloc mapping failed\n"); | ||
384 | - return -ENOMEM; | ||
385 | - } | ||
386 | - | ||
387 | carveout = kzalloc(sizeof(*carveout), GFP_KERNEL); | ||
388 | if (!carveout) { | ||
389 | dev_err(dev, "kzalloc carveout failed\n"); | ||
390 | - ret = -ENOMEM; | ||
391 | - goto free_mapping; | ||
392 | + return -ENOMEM; | ||
393 | } | ||
394 | |||
395 | va = dma_alloc_coherent(dev->parent, rsc->len, &dma, GFP_KERNEL); | ||
396 | @@ -585,11 +578,18 @@ static int rproc_handle_carveout(struct rproc *rproc, | ||
397 | * physical address in this case. | ||
398 | */ | ||
399 | if (rproc->domain) { | ||
400 | + mapping = kzalloc(sizeof(*mapping), GFP_KERNEL); | ||
401 | + if (!mapping) { | ||
402 | + dev_err(dev, "kzalloc mapping failed\n"); | ||
403 | + ret = -ENOMEM; | ||
404 | + goto dma_free; | ||
405 | + } | ||
406 | + | ||
407 | ret = iommu_map(rproc->domain, rsc->da, dma, rsc->len, | ||
408 | rsc->flags); | ||
409 | if (ret) { | ||
410 | dev_err(dev, "iommu_map failed: %d\n", ret); | ||
411 | - goto dma_free; | ||
412 | + goto free_mapping; | ||
413 | } | ||
414 | |||
415 | /* | ||
416 | @@ -634,12 +634,12 @@ static int rproc_handle_carveout(struct rproc *rproc, | ||
417 | |||
418 | return 0; | ||
419 | |||
420 | +free_mapping: | ||
421 | + kfree(mapping); | ||
422 | dma_free: | ||
423 | dma_free_coherent(dev->parent, rsc->len, va, dma); | ||
424 | free_carv: | ||
425 | kfree(carveout); | ||
426 | -free_mapping: | ||
427 | - kfree(mapping); | ||
428 | return ret; | ||
429 | } | ||
430 | |||
431 | diff --git a/drivers/scsi/device_handler/scsi_dh_alua.c b/drivers/scsi/device_handler/scsi_dh_alua.c | ||
432 | index 08d80a6..6f4d8e6 100644 | ||
433 | --- a/drivers/scsi/device_handler/scsi_dh_alua.c | ||
434 | +++ b/drivers/scsi/device_handler/scsi_dh_alua.c | ||
435 | @@ -641,8 +641,7 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_dh_data *h) | ||
436 | h->state = TPGS_STATE_STANDBY; | ||
437 | break; | ||
438 | case TPGS_STATE_OFFLINE: | ||
439 | - case TPGS_STATE_UNAVAILABLE: | ||
440 | - /* Path unusable for unavailable/offline */ | ||
441 | + /* Path unusable */ | ||
442 | err = SCSI_DH_DEV_OFFLINED; | ||
443 | break; | ||
444 | default: | ||
445 | diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c | ||
446 | index 2b4261c..f9823f2 100644 | ||
447 | --- a/drivers/scsi/hpsa.c | ||
448 | +++ b/drivers/scsi/hpsa.c | ||
449 | @@ -3266,7 +3266,7 @@ static void fill_cmd(struct CommandList *c, u8 cmd, struct ctlr_info *h, | ||
450 | c->Request.Timeout = 0; /* Don't time out */ | ||
451 | memset(&c->Request.CDB[0], 0, sizeof(c->Request.CDB)); | ||
452 | c->Request.CDB[0] = cmd; | ||
453 | - c->Request.CDB[1] = 0x03; /* Reset target above */ | ||
454 | + c->Request.CDB[1] = HPSA_RESET_TYPE_LUN; | ||
455 | /* If bytes 4-7 are zero, it means reset the */ | ||
456 | /* LunID device */ | ||
457 | c->Request.CDB[4] = 0x00; | ||
458 | diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c | ||
459 | index 3a6c474..337e8b3 100644 | ||
460 | --- a/drivers/scsi/ibmvscsi/ibmvscsi.c | ||
461 | +++ b/drivers/scsi/ibmvscsi/ibmvscsi.c | ||
462 | @@ -1541,6 +1541,9 @@ static int ibmvscsi_do_host_config(struct ibmvscsi_host_data *hostdata, | ||
463 | |||
464 | host_config = &evt_struct->iu.mad.host_config; | ||
465 | |||
466 | + /* The transport length field is only 16-bit */ | ||
467 | + length = min(0xffff, length); | ||
468 | + | ||
469 | /* Set up a lun reset SRP command */ | ||
470 | memset(host_config, 0x00, sizeof(*host_config)); | ||
471 | host_config->common.type = VIOSRP_HOST_CONFIG_TYPE; | ||
472 | diff --git a/drivers/scsi/isci/init.c b/drivers/scsi/isci/init.c | ||
473 | index 92c1d86..1286a8a 100644 | ||
474 | --- a/drivers/scsi/isci/init.c | ||
475 | +++ b/drivers/scsi/isci/init.c | ||
476 | @@ -644,7 +644,6 @@ static int __devinit isci_pci_probe(struct pci_dev *pdev, const struct pci_devic | ||
477 | orom->hdr.version)) { | ||
478 | dev_warn(&pdev->dev, | ||
479 | "[%d]: invalid oem parameters detected, falling back to firmware\n", i); | ||
480 | - devm_kfree(&pdev->dev, orom); | ||
481 | orom = NULL; | ||
482 | break; | ||
483 | } | ||
484 | diff --git a/drivers/scsi/isci/probe_roms.c b/drivers/scsi/isci/probe_roms.c | ||
485 | index 4d95654..8ac646e 100644 | ||
486 | --- a/drivers/scsi/isci/probe_roms.c | ||
487 | +++ b/drivers/scsi/isci/probe_roms.c | ||
488 | @@ -104,7 +104,6 @@ struct isci_orom *isci_request_oprom(struct pci_dev *pdev) | ||
489 | |||
490 | if (i >= len) { | ||
491 | dev_err(&pdev->dev, "oprom parse error\n"); | ||
492 | - devm_kfree(&pdev->dev, rom); | ||
493 | rom = NULL; | ||
494 | } | ||
495 | pci_unmap_biosrom(oprom); | ||
496 | diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c | ||
497 | index 093d4f6..ce5224c 100644 | ||
498 | --- a/drivers/scsi/scsi_sysfs.c | ||
499 | +++ b/drivers/scsi/scsi_sysfs.c | ||
500 | @@ -1031,33 +1031,31 @@ static void __scsi_remove_target(struct scsi_target *starget) | ||
501 | void scsi_remove_target(struct device *dev) | ||
502 | { | ||
503 | struct Scsi_Host *shost = dev_to_shost(dev->parent); | ||
504 | - struct scsi_target *starget, *found; | ||
505 | + struct scsi_target *starget, *last = NULL; | ||
506 | unsigned long flags; | ||
507 | |||
508 | - restart: | ||
509 | - found = NULL; | ||
510 | + /* remove targets being careful to lookup next entry before | ||
511 | + * deleting the last | ||
512 | + */ | ||
513 | spin_lock_irqsave(shost->host_lock, flags); | ||
514 | list_for_each_entry(starget, &shost->__targets, siblings) { | ||
515 | if (starget->state == STARGET_DEL) | ||
516 | continue; | ||
517 | if (starget->dev.parent == dev || &starget->dev == dev) { | ||
518 | - found = starget; | ||
519 | - found->reap_ref++; | ||
520 | - break; | ||
521 | + /* assuming new targets arrive at the end */ | ||
522 | + starget->reap_ref++; | ||
523 | + spin_unlock_irqrestore(shost->host_lock, flags); | ||
524 | + if (last) | ||
525 | + scsi_target_reap(last); | ||
526 | + last = starget; | ||
527 | + __scsi_remove_target(starget); | ||
528 | + spin_lock_irqsave(shost->host_lock, flags); | ||
529 | } | ||
530 | } | ||
531 | spin_unlock_irqrestore(shost->host_lock, flags); | ||
532 | |||
533 | - if (found) { | ||
534 | - __scsi_remove_target(found); | ||
535 | - scsi_target_reap(found); | ||
536 | - /* in the case where @dev has multiple starget children, | ||
537 | - * continue removing. | ||
538 | - * | ||
539 | - * FIXME: does such a case exist? | ||
540 | - */ | ||
541 | - goto restart; | ||
542 | - } | ||
543 | + if (last) | ||
544 | + scsi_target_reap(last); | ||
545 | } | ||
546 | EXPORT_SYMBOL(scsi_remove_target); | ||
547 | |||
548 | diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c | ||
549 | index e821264..41dea18 100644 | ||
550 | --- a/drivers/staging/comedi/comedi_fops.c | ||
551 | +++ b/drivers/staging/comedi/comedi_fops.c | ||
552 | @@ -951,7 +951,7 @@ static int parse_insn(struct comedi_device *dev, struct comedi_insn *insn, | ||
553 | ret = -EAGAIN; | ||
554 | break; | ||
555 | } | ||
556 | - ret = s->async->inttrig(dev, s, insn->data[0]); | ||
557 | + ret = s->async->inttrig(dev, s, data[0]); | ||
558 | if (ret >= 0) | ||
559 | ret = 1; | ||
560 | break; | ||
561 | @@ -1196,7 +1196,6 @@ static int do_cmd_ioctl(struct comedi_device *dev, | ||
562 | goto cleanup; | ||
563 | } | ||
564 | |||
565 | - kfree(async->cmd.chanlist); | ||
566 | async->cmd = user_cmd; | ||
567 | async->cmd.data = NULL; | ||
568 | /* load channel/gain list */ | ||
569 | @@ -2033,6 +2032,8 @@ void do_become_nonbusy(struct comedi_device *dev, struct comedi_subdevice *s) | ||
570 | if (async) { | ||
571 | comedi_reset_async_buf(async); | ||
572 | async->inttrig = NULL; | ||
573 | + kfree(async->cmd.chanlist); | ||
574 | + async->cmd.chanlist = NULL; | ||
575 | } else { | ||
576 | printk(KERN_ERR | ||
577 | "BUG: (?) do_become_nonbusy called with async=0\n"); | ||
578 | diff --git a/drivers/staging/comedi/drivers/jr3_pci.c b/drivers/staging/comedi/drivers/jr3_pci.c | ||
579 | index 93f94cd..9c133a0 100644 | ||
580 | --- a/drivers/staging/comedi/drivers/jr3_pci.c | ||
581 | +++ b/drivers/staging/comedi/drivers/jr3_pci.c | ||
582 | @@ -884,7 +884,7 @@ static int jr3_pci_attach(struct comedi_device *dev, | ||
583 | } | ||
584 | |||
585 | /* Reset DSP card */ | ||
586 | - devpriv->iobase->channel[0].reset = 0; | ||
587 | + writel(0, &devpriv->iobase->channel[0].reset); | ||
588 | |||
589 | result = comedi_load_firmware(dev, "jr3pci.idm", jr3_download_firmware); | ||
590 | dev_dbg(dev->class_dev, "Firmare load %d\n", result); | ||
591 | diff --git a/drivers/staging/comedi/drivers/s626.c b/drivers/staging/comedi/drivers/s626.c | ||
592 | index f90578e..2b03b68 100644 | ||
593 | --- a/drivers/staging/comedi/drivers/s626.c | ||
594 | +++ b/drivers/staging/comedi/drivers/s626.c | ||
595 | @@ -1868,7 +1868,7 @@ static int s626_enc_insn_config(struct comedi_device *dev, | ||
596 | /* (data==NULL) ? (Preloadvalue=0) : (Preloadvalue=data[0]); */ | ||
597 | |||
598 | k->SetMode(dev, k, Setup, TRUE); | ||
599 | - Preload(dev, k, *(insn->data)); | ||
600 | + Preload(dev, k, data[0]); | ||
601 | k->PulseIndex(dev, k); | ||
602 | SetLatchSource(dev, k, valueSrclatch); | ||
603 | k->SetEnable(dev, k, (uint16_t) (enab != 0)); | ||
604 | diff --git a/drivers/staging/rtl8712/rtl8712_recv.c b/drivers/staging/rtl8712/rtl8712_recv.c | ||
605 | index 8e82ce2..88e3ca6 100644 | ||
606 | --- a/drivers/staging/rtl8712/rtl8712_recv.c | ||
607 | +++ b/drivers/staging/rtl8712/rtl8712_recv.c | ||
608 | @@ -1127,6 +1127,9 @@ static void recv_tasklet(void *priv) | ||
609 | recvbuf2recvframe(padapter, pskb); | ||
610 | skb_reset_tail_pointer(pskb); | ||
611 | pskb->len = 0; | ||
612 | - skb_queue_tail(&precvpriv->free_recv_skb_queue, pskb); | ||
613 | + if (!skb_cloned(pskb)) | ||
614 | + skb_queue_tail(&precvpriv->free_recv_skb_queue, pskb); | ||
615 | + else | ||
616 | + consume_skb(pskb); | ||
617 | } | ||
618 | } | ||
619 | diff --git a/drivers/staging/speakup/speakup_soft.c b/drivers/staging/speakup/speakup_soft.c | ||
620 | index 42cdafe..b5130c8 100644 | ||
621 | --- a/drivers/staging/speakup/speakup_soft.c | ||
622 | +++ b/drivers/staging/speakup/speakup_soft.c | ||
623 | @@ -40,7 +40,7 @@ static int softsynth_is_alive(struct spk_synth *synth); | ||
624 | static unsigned char get_index(void); | ||
625 | |||
626 | static struct miscdevice synth_device; | ||
627 | -static int initialized; | ||
628 | +static int init_pos; | ||
629 | static int misc_registered; | ||
630 | |||
631 | static struct var_t vars[] = { | ||
632 | @@ -194,7 +194,7 @@ static int softsynth_close(struct inode *inode, struct file *fp) | ||
633 | unsigned long flags; | ||
634 | spk_lock(flags); | ||
635 | synth_soft.alive = 0; | ||
636 | - initialized = 0; | ||
637 | + init_pos = 0; | ||
638 | spk_unlock(flags); | ||
639 | /* Make sure we let applications go before leaving */ | ||
640 | speakup_start_ttys(); | ||
641 | @@ -239,13 +239,8 @@ static ssize_t softsynth_read(struct file *fp, char *buf, size_t count, | ||
642 | ch = '\x18'; | ||
643 | } else if (synth_buffer_empty()) { | ||
644 | break; | ||
645 | - } else if (!initialized) { | ||
646 | - if (*init) { | ||
647 | - ch = *init; | ||
648 | - init++; | ||
649 | - } else { | ||
650 | - initialized = 1; | ||
651 | - } | ||
652 | + } else if (init[init_pos]) { | ||
653 | + ch = init[init_pos++]; | ||
654 | } else { | ||
655 | ch = synth_buffer_getc(); | ||
656 | } | ||
657 | diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c | ||
658 | index c43b683..90dff82 100644 | ||
659 | --- a/drivers/tty/n_gsm.c | ||
660 | +++ b/drivers/tty/n_gsm.c | ||
661 | @@ -875,7 +875,7 @@ static int gsm_dlci_data_output_framed(struct gsm_mux *gsm, | ||
662 | |||
663 | /* dlci->skb is locked by tx_lock */ | ||
664 | if (dlci->skb == NULL) { | ||
665 | - dlci->skb = skb_dequeue(&dlci->skb_list); | ||
666 | + dlci->skb = skb_dequeue_tail(&dlci->skb_list); | ||
667 | if (dlci->skb == NULL) | ||
668 | return 0; | ||
669 | first = 1; | ||
670 | @@ -899,8 +899,11 @@ static int gsm_dlci_data_output_framed(struct gsm_mux *gsm, | ||
671 | |||
672 | /* FIXME: need a timer or something to kick this so it can't | ||
673 | get stuck with no work outstanding and no buffer free */ | ||
674 | - if (msg == NULL) | ||
675 | + if (msg == NULL) { | ||
676 | + skb_queue_tail(&dlci->skb_list, dlci->skb); | ||
677 | + dlci->skb = NULL; | ||
678 | return -ENOMEM; | ||
679 | + } | ||
680 | dp = msg->data; | ||
681 | |||
682 | if (dlci->adaption == 4) { /* Interruptible framed (Packetised Data) */ | ||
683 | @@ -971,16 +974,19 @@ static void gsm_dlci_data_sweep(struct gsm_mux *gsm) | ||
684 | static void gsm_dlci_data_kick(struct gsm_dlci *dlci) | ||
685 | { | ||
686 | unsigned long flags; | ||
687 | + int sweep; | ||
688 | |||
689 | spin_lock_irqsave(&dlci->gsm->tx_lock, flags); | ||
690 | /* If we have nothing running then we need to fire up */ | ||
691 | + sweep = (dlci->gsm->tx_bytes < TX_THRESH_LO); | ||
692 | if (dlci->gsm->tx_bytes == 0) { | ||
693 | if (dlci->net) | ||
694 | gsm_dlci_data_output_framed(dlci->gsm, dlci); | ||
695 | else | ||
696 | gsm_dlci_data_output(dlci->gsm, dlci); | ||
697 | - } else if (dlci->gsm->tx_bytes < TX_THRESH_LO) | ||
698 | - gsm_dlci_data_sweep(dlci->gsm); | ||
699 | + } | ||
700 | + if (sweep) | ||
701 | + gsm_dlci_data_sweep(dlci->gsm); | ||
702 | spin_unlock_irqrestore(&dlci->gsm->tx_lock, flags); | ||
703 | } | ||
704 | |||
705 | @@ -1190,6 +1196,8 @@ static void gsm_control_message(struct gsm_mux *gsm, unsigned int command, | ||
706 | u8 *data, int clen) | ||
707 | { | ||
708 | u8 buf[1]; | ||
709 | + unsigned long flags; | ||
710 | + | ||
711 | switch (command) { | ||
712 | case CMD_CLD: { | ||
713 | struct gsm_dlci *dlci = gsm->dlci[0]; | ||
714 | @@ -1215,7 +1223,9 @@ static void gsm_control_message(struct gsm_mux *gsm, unsigned int command, | ||
715 | gsm->constipated = 0; | ||
716 | gsm_control_reply(gsm, CMD_FCOFF, NULL, 0); | ||
717 | /* Kick the link in case it is idling */ | ||
718 | + spin_lock_irqsave(&gsm->tx_lock, flags); | ||
719 | gsm_data_kick(gsm); | ||
720 | + spin_unlock_irqrestore(&gsm->tx_lock, flags); | ||
721 | break; | ||
722 | case CMD_MSC: | ||
723 | /* Out of band modem line change indicator for a DLCI */ | ||
724 | @@ -2377,12 +2387,12 @@ static void gsmld_write_wakeup(struct tty_struct *tty) | ||
725 | |||
726 | /* Queue poll */ | ||
727 | clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); | ||
728 | + spin_lock_irqsave(&gsm->tx_lock, flags); | ||
729 | gsm_data_kick(gsm); | ||
730 | if (gsm->tx_bytes < TX_THRESH_LO) { | ||
731 | - spin_lock_irqsave(&gsm->tx_lock, flags); | ||
732 | gsm_dlci_data_sweep(gsm); | ||
733 | - spin_unlock_irqrestore(&gsm->tx_lock, flags); | ||
734 | } | ||
735 | + spin_unlock_irqrestore(&gsm->tx_lock, flags); | ||
736 | } | ||
737 | |||
738 | /** | ||
739 | @@ -2889,6 +2899,10 @@ static int gsmtty_open(struct tty_struct *tty, struct file *filp) | ||
740 | gsm = gsm_mux[mux]; | ||
741 | if (gsm->dead) | ||
742 | return -EL2HLT; | ||
743 | + /* If DLCI 0 is not yet fully open return an error. This is ok from a locking | ||
744 | + perspective as we don't have to worry about this if DLCI0 is lost */ | ||
745 | + if (gsm->dlci[0] && gsm->dlci[0]->state != DLCI_OPEN) | ||
746 | + return -EL2NSYNC; | ||
747 | dlci = gsm->dlci[line]; | ||
748 | if (dlci == NULL) | ||
749 | dlci = gsm_dlci_alloc(gsm, line); | ||
750 | diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c | ||
751 | index ee1c268..26f0d0e 100644 | ||
752 | --- a/drivers/tty/n_tty.c | ||
753 | +++ b/drivers/tty/n_tty.c | ||
754 | @@ -1728,7 +1728,8 @@ static ssize_t n_tty_read(struct tty_struct *tty, struct file *file, | ||
755 | |||
756 | do_it_again: | ||
757 | |||
758 | - BUG_ON(!tty->read_buf); | ||
759 | + if (WARN_ON(!tty->read_buf)) | ||
760 | + return -EAGAIN; | ||
761 | |||
762 | c = job_control(tty, file); | ||
763 | if (c < 0) | ||
764 | diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c | ||
765 | index 28e7c7c..6b8fcb4 100644 | ||
766 | --- a/drivers/tty/serial/8250/8250_pci.c | ||
767 | +++ b/drivers/tty/serial/8250/8250_pci.c | ||
768 | @@ -1164,6 +1164,8 @@ pci_xr17c154_setup(struct serial_private *priv, | ||
769 | #define PCI_SUBDEVICE_ID_OCTPRO422 0x0208 | ||
770 | #define PCI_SUBDEVICE_ID_POCTAL232 0x0308 | ||
771 | #define PCI_SUBDEVICE_ID_POCTAL422 0x0408 | ||
772 | +#define PCI_SUBDEVICE_ID_SIIG_DUAL_00 0x2500 | ||
773 | +#define PCI_SUBDEVICE_ID_SIIG_DUAL_30 0x2530 | ||
774 | #define PCI_VENDOR_ID_ADVANTECH 0x13fe | ||
775 | #define PCI_DEVICE_ID_INTEL_CE4100_UART 0x2e66 | ||
776 | #define PCI_DEVICE_ID_ADVANTECH_PCI3620 0x3620 | ||
777 | @@ -3232,8 +3234,11 @@ static struct pci_device_id serial_pci_tbl[] = { | ||
778 | * For now just used the hex ID 0x950a. | ||
779 | */ | ||
780 | { PCI_VENDOR_ID_OXSEMI, 0x950a, | ||
781 | - PCI_SUBVENDOR_ID_SIIG, PCI_SUBDEVICE_ID_SIIG_DUAL_SERIAL, 0, 0, | ||
782 | - pbn_b0_2_115200 }, | ||
783 | + PCI_SUBVENDOR_ID_SIIG, PCI_SUBDEVICE_ID_SIIG_DUAL_00, | ||
784 | + 0, 0, pbn_b0_2_115200 }, | ||
785 | + { PCI_VENDOR_ID_OXSEMI, 0x950a, | ||
786 | + PCI_SUBVENDOR_ID_SIIG, PCI_SUBDEVICE_ID_SIIG_DUAL_30, | ||
787 | + 0, 0, pbn_b0_2_115200 }, | ||
788 | { PCI_VENDOR_ID_OXSEMI, 0x950a, | ||
789 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, | ||
790 | pbn_b0_2_1130000 }, | ||
791 | diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c | ||
792 | index d3553b5..762f5fd 100644 | ||
793 | --- a/drivers/tty/serial/amba-pl011.c | ||
794 | +++ b/drivers/tty/serial/amba-pl011.c | ||
795 | @@ -1603,13 +1603,26 @@ pl011_set_termios(struct uart_port *port, struct ktermios *termios, | ||
796 | old_cr &= ~ST_UART011_CR_OVSFACT; | ||
797 | } | ||
798 | |||
799 | + /* | ||
800 | + * Workaround for the ST Micro oversampling variants to | ||
801 | + * increase the bitrate slightly, by lowering the divisor, | ||
802 | + * to avoid delayed sampling of start bit at high speeds, | ||
803 | + * else we see data corruption. | ||
804 | + */ | ||
805 | + if (uap->vendor->oversampling) { | ||
806 | + if ((baud >= 3000000) && (baud < 3250000) && (quot > 1)) | ||
807 | + quot -= 1; | ||
808 | + else if ((baud > 3250000) && (quot > 2)) | ||
809 | + quot -= 2; | ||
810 | + } | ||
811 | /* Set baud rate */ | ||
812 | writew(quot & 0x3f, port->membase + UART011_FBRD); | ||
813 | writew(quot >> 6, port->membase + UART011_IBRD); | ||
814 | |||
815 | /* | ||
816 | * ----------v----------v----------v----------v----- | ||
817 | - * NOTE: MUST BE WRITTEN AFTER UARTLCR_M & UARTLCR_L | ||
818 | + * NOTE: lcrh_tx and lcrh_rx MUST BE WRITTEN AFTER | ||
819 | + * UART011_FBRD & UART011_IBRD. | ||
820 | * ----------^----------^----------^----------^----- | ||
821 | */ | ||
822 | writew(lcr_h, port->membase + uap->lcrh_rx); | ||
823 | diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c | ||
824 | index d3cda0c..22992cd 100644 | ||
825 | --- a/drivers/tty/serial/omap-serial.c | ||
826 | +++ b/drivers/tty/serial/omap-serial.c | ||
827 | @@ -667,19 +667,19 @@ serial_omap_configure_xonxoff | ||
828 | |||
829 | /* | ||
830 | * IXON Flag: | ||
831 | - * Enable XON/XOFF flow control on output. | ||
832 | - * Transmit XON1, XOFF1 | ||
833 | + * Flow control for OMAP.TX | ||
834 | + * OMAP.RX should listen for XON/XOFF | ||
835 | */ | ||
836 | if (termios->c_iflag & IXON) | ||
837 | - up->efr |= OMAP_UART_SW_TX; | ||
838 | + up->efr |= OMAP_UART_SW_RX; | ||
839 | |||
840 | /* | ||
841 | * IXOFF Flag: | ||
842 | - * Enable XON/XOFF flow control on input. | ||
843 | - * Receiver compares XON1, XOFF1. | ||
844 | + * Flow control for OMAP.RX | ||
845 | + * OMAP.TX should send XON/XOFF | ||
846 | */ | ||
847 | if (termios->c_iflag & IXOFF) | ||
848 | - up->efr |= OMAP_UART_SW_RX; | ||
849 | + up->efr |= OMAP_UART_SW_TX; | ||
850 | |||
851 | serial_out(up, UART_EFR, up->efr | UART_EFR_ECB); | ||
852 | serial_out(up, UART_LCR, UART_LCR_CONF_MODE_A); | ||
853 | diff --git a/drivers/tty/vt/keyboard.c b/drivers/tty/vt/keyboard.c | ||
854 | index 48cc6f2..770a854 100644 | ||
855 | --- a/drivers/tty/vt/keyboard.c | ||
856 | +++ b/drivers/tty/vt/keyboard.c | ||
857 | @@ -1049,13 +1049,10 @@ static int kbd_update_leds_helper(struct input_handle *handle, void *data) | ||
858 | */ | ||
859 | int vt_get_leds(int console, int flag) | ||
860 | { | ||
861 | - unsigned long flags; | ||
862 | struct kbd_struct * kbd = kbd_table + console; | ||
863 | int ret; | ||
864 | |||
865 | - spin_lock_irqsave(&kbd_event_lock, flags); | ||
866 | ret = vc_kbd_led(kbd, flag); | ||
867 | - spin_unlock_irqrestore(&kbd_event_lock, flags); | ||
868 | |||
869 | return ret; | ||
870 | } | ||
871 | diff --git a/drivers/usb/gadget/printer.c b/drivers/usb/gadget/printer.c | ||
872 | index f1f9290..7587615 100644 | ||
873 | --- a/drivers/usb/gadget/printer.c | ||
874 | +++ b/drivers/usb/gadget/printer.c | ||
875 | @@ -141,18 +141,14 @@ module_param(qlen, uint, S_IRUGO|S_IWUSR); | ||
876 | * descriptors are built on demand. | ||
877 | */ | ||
878 | |||
879 | -#define STRING_MANUFACTURER 1 | ||
880 | -#define STRING_PRODUCT 2 | ||
881 | -#define STRING_SERIALNUM 3 | ||
882 | +#define STRING_MANUFACTURER 0 | ||
883 | +#define STRING_PRODUCT 1 | ||
884 | +#define STRING_SERIALNUM 2 | ||
885 | |||
886 | /* holds our biggest descriptor */ | ||
887 | #define USB_DESC_BUFSIZE 256 | ||
888 | #define USB_BUFSIZE 8192 | ||
889 | |||
890 | -/* This device advertises one configuration. */ | ||
891 | -#define DEV_CONFIG_VALUE 1 | ||
892 | -#define PRINTER_INTERFACE 0 | ||
893 | - | ||
894 | static struct usb_device_descriptor device_desc = { | ||
895 | .bLength = sizeof device_desc, | ||
896 | .bDescriptorType = USB_DT_DEVICE, | ||
897 | @@ -162,16 +158,12 @@ static struct usb_device_descriptor device_desc = { | ||
898 | .bDeviceProtocol = 0, | ||
899 | .idVendor = cpu_to_le16(PRINTER_VENDOR_NUM), | ||
900 | .idProduct = cpu_to_le16(PRINTER_PRODUCT_NUM), | ||
901 | - .iManufacturer = STRING_MANUFACTURER, | ||
902 | - .iProduct = STRING_PRODUCT, | ||
903 | - .iSerialNumber = STRING_SERIALNUM, | ||
904 | .bNumConfigurations = 1 | ||
905 | }; | ||
906 | |||
907 | static struct usb_interface_descriptor intf_desc = { | ||
908 | .bLength = sizeof intf_desc, | ||
909 | .bDescriptorType = USB_DT_INTERFACE, | ||
910 | - .bInterfaceNumber = PRINTER_INTERFACE, | ||
911 | .bNumEndpoints = 2, | ||
912 | .bInterfaceClass = USB_CLASS_PRINTER, | ||
913 | .bInterfaceSubClass = 1, /* Printer Sub-Class */ | ||
914 | @@ -260,9 +252,9 @@ static char pnp_string [1024] = | ||
915 | |||
916 | /* static strings, in UTF-8 */ | ||
917 | static struct usb_string strings [] = { | ||
918 | - { STRING_MANUFACTURER, manufacturer, }, | ||
919 | - { STRING_PRODUCT, product_desc, }, | ||
920 | - { STRING_SERIALNUM, serial_num, }, | ||
921 | + [STRING_MANUFACTURER].s = manufacturer, | ||
922 | + [STRING_PRODUCT].s = product_desc, | ||
923 | + [STRING_SERIALNUM].s = serial_num, | ||
924 | { } /* end of list */ | ||
925 | }; | ||
926 | |||
927 | @@ -871,25 +863,13 @@ static int set_interface(struct printer_dev *dev, unsigned number) | ||
928 | int result = 0; | ||
929 | |||
930 | /* Free the current interface */ | ||
931 | - switch (dev->interface) { | ||
932 | - case PRINTER_INTERFACE: | ||
933 | - printer_reset_interface(dev); | ||
934 | - break; | ||
935 | - } | ||
936 | + printer_reset_interface(dev); | ||
937 | |||
938 | - switch (number) { | ||
939 | - case PRINTER_INTERFACE: | ||
940 | - result = set_printer_interface(dev); | ||
941 | - if (result) { | ||
942 | - printer_reset_interface(dev); | ||
943 | - } else { | ||
944 | - dev->interface = PRINTER_INTERFACE; | ||
945 | - } | ||
946 | - break; | ||
947 | - default: | ||
948 | - result = -EINVAL; | ||
949 | - /* FALL THROUGH */ | ||
950 | - } | ||
951 | + result = set_printer_interface(dev); | ||
952 | + if (result) | ||
953 | + printer_reset_interface(dev); | ||
954 | + else | ||
955 | + dev->interface = number; | ||
956 | |||
957 | if (!result) | ||
958 | INFO(dev, "Using interface %x\n", number); | ||
959 | @@ -972,7 +952,7 @@ static int printer_func_setup(struct usb_function *f, | ||
960 | switch (ctrl->bRequest) { | ||
961 | case 0: /* Get the IEEE-1284 PNP String */ | ||
962 | /* Only one printer interface is supported. */ | ||
963 | - if ((wIndex>>8) != PRINTER_INTERFACE) | ||
964 | + if ((wIndex>>8) != dev->interface) | ||
965 | break; | ||
966 | |||
967 | value = (pnp_string[0]<<8)|pnp_string[1]; | ||
968 | @@ -983,7 +963,7 @@ static int printer_func_setup(struct usb_function *f, | ||
969 | |||
970 | case 1: /* Get Port Status */ | ||
971 | /* Only one printer interface is supported. */ | ||
972 | - if (wIndex != PRINTER_INTERFACE) | ||
973 | + if (wIndex != dev->interface) | ||
974 | break; | ||
975 | |||
976 | *(u8 *)req->buf = dev->printer_status; | ||
977 | @@ -992,7 +972,7 @@ static int printer_func_setup(struct usb_function *f, | ||
978 | |||
979 | case 2: /* Soft Reset */ | ||
980 | /* Only one printer interface is supported. */ | ||
981 | - if (wIndex != PRINTER_INTERFACE) | ||
982 | + if (wIndex != dev->interface) | ||
983 | break; | ||
984 | |||
985 | printer_soft_reset(dev); | ||
986 | @@ -1020,6 +1000,37 @@ unknown: | ||
987 | static int __init printer_func_bind(struct usb_configuration *c, | ||
988 | struct usb_function *f) | ||
989 | { | ||
990 | + struct printer_dev *dev = container_of(f, struct printer_dev, function); | ||
991 | + struct usb_composite_dev *cdev = c->cdev; | ||
992 | + struct usb_ep *in_ep, *out_ep; | ||
993 | + int id; | ||
994 | + | ||
995 | + id = usb_interface_id(c, f); | ||
996 | + if (id < 0) | ||
997 | + return id; | ||
998 | + intf_desc.bInterfaceNumber = id; | ||
999 | + | ||
1000 | + /* all we really need is bulk IN/OUT */ | ||
1001 | + in_ep = usb_ep_autoconfig(cdev->gadget, &fs_ep_in_desc); | ||
1002 | + if (!in_ep) { | ||
1003 | +autoconf_fail: | ||
1004 | + dev_err(&cdev->gadget->dev, "can't autoconfigure on %s\n", | ||
1005 | + cdev->gadget->name); | ||
1006 | + return -ENODEV; | ||
1007 | + } | ||
1008 | + in_ep->driver_data = in_ep; /* claim */ | ||
1009 | + | ||
1010 | + out_ep = usb_ep_autoconfig(cdev->gadget, &fs_ep_out_desc); | ||
1011 | + if (!out_ep) | ||
1012 | + goto autoconf_fail; | ||
1013 | + out_ep->driver_data = out_ep; /* claim */ | ||
1014 | + | ||
1015 | + /* assumes that all endpoints are dual-speed */ | ||
1016 | + hs_ep_in_desc.bEndpointAddress = fs_ep_in_desc.bEndpointAddress; | ||
1017 | + hs_ep_out_desc.bEndpointAddress = fs_ep_out_desc.bEndpointAddress; | ||
1018 | + | ||
1019 | + dev->in_ep = in_ep; | ||
1020 | + dev->out_ep = out_ep; | ||
1021 | return 0; | ||
1022 | } | ||
1023 | |||
1024 | @@ -1035,7 +1046,8 @@ static int printer_func_set_alt(struct usb_function *f, | ||
1025 | int ret = -ENOTSUPP; | ||
1026 | |||
1027 | if (!alt) | ||
1028 | - ret = set_interface(dev, PRINTER_INTERFACE); | ||
1029 | + ret = set_interface(dev, intf); | ||
1030 | + | ||
1031 | return ret; | ||
1032 | } | ||
1033 | |||
1034 | @@ -1107,13 +1119,14 @@ static int __init printer_bind_config(struct usb_configuration *c) | ||
1035 | { | ||
1036 | struct usb_gadget *gadget = c->cdev->gadget; | ||
1037 | struct printer_dev *dev; | ||
1038 | - struct usb_ep *in_ep, *out_ep; | ||
1039 | int status = -ENOMEM; | ||
1040 | int gcnum; | ||
1041 | size_t len; | ||
1042 | u32 i; | ||
1043 | struct usb_request *req; | ||
1044 | |||
1045 | + usb_ep_autoconfig_reset(gadget); | ||
1046 | + | ||
1047 | dev = &usb_printer_gadget; | ||
1048 | |||
1049 | dev->function.name = shortname; | ||
1050 | @@ -1125,6 +1138,10 @@ static int __init printer_bind_config(struct usb_configuration *c) | ||
1051 | dev->function.set_alt = printer_func_set_alt; | ||
1052 | dev->function.disable = printer_func_disable; | ||
1053 | |||
1054 | + status = usb_add_function(c, &dev->function); | ||
1055 | + if (status) | ||
1056 | + return status; | ||
1057 | + | ||
1058 | /* Setup the sysfs files for the printer gadget. */ | ||
1059 | dev->pdev = device_create(usb_gadget_class, NULL, g_printer_devno, | ||
1060 | NULL, "g_printer"); | ||
1061 | @@ -1169,26 +1186,6 @@ static int __init printer_bind_config(struct usb_configuration *c) | ||
1062 | pnp_string[0] = (len >> 8) & 0xFF; | ||
1063 | pnp_string[1] = len & 0xFF; | ||
1064 | |||
1065 | - /* all we really need is bulk IN/OUT */ | ||
1066 | - usb_ep_autoconfig_reset(gadget); | ||
1067 | - in_ep = usb_ep_autoconfig(gadget, &fs_ep_in_desc); | ||
1068 | - if (!in_ep) { | ||
1069 | -autoconf_fail: | ||
1070 | - dev_err(&gadget->dev, "can't autoconfigure on %s\n", | ||
1071 | - gadget->name); | ||
1072 | - return -ENODEV; | ||
1073 | - } | ||
1074 | - in_ep->driver_data = in_ep; /* claim */ | ||
1075 | - | ||
1076 | - out_ep = usb_ep_autoconfig(gadget, &fs_ep_out_desc); | ||
1077 | - if (!out_ep) | ||
1078 | - goto autoconf_fail; | ||
1079 | - out_ep->driver_data = out_ep; /* claim */ | ||
1080 | - | ||
1081 | - /* assumes that all endpoints are dual-speed */ | ||
1082 | - hs_ep_in_desc.bEndpointAddress = fs_ep_in_desc.bEndpointAddress; | ||
1083 | - hs_ep_out_desc.bEndpointAddress = fs_ep_out_desc.bEndpointAddress; | ||
1084 | - | ||
1085 | usb_gadget_set_selfpowered(gadget); | ||
1086 | |||
1087 | if (gadget->is_otg) { | ||
1088 | @@ -1215,9 +1212,6 @@ autoconf_fail: | ||
1089 | dev->current_rx_bytes = 0; | ||
1090 | dev->current_rx_buf = NULL; | ||
1091 | |||
1092 | - dev->in_ep = in_ep; | ||
1093 | - dev->out_ep = out_ep; | ||
1094 | - | ||
1095 | for (i = 0; i < QLEN; i++) { | ||
1096 | req = printer_req_alloc(dev->in_ep, USB_BUFSIZE, GFP_KERNEL); | ||
1097 | if (!req) { | ||
1098 | @@ -1250,8 +1244,6 @@ autoconf_fail: | ||
1099 | dev->gadget = gadget; | ||
1100 | |||
1101 | INFO(dev, "%s, version: " DRIVER_VERSION "\n", driver_desc); | ||
1102 | - INFO(dev, "using %s, OUT %s IN %s\n", gadget->name, out_ep->name, | ||
1103 | - in_ep->name); | ||
1104 | return 0; | ||
1105 | |||
1106 | fail: | ||
1107 | @@ -1266,7 +1258,17 @@ static int printer_unbind(struct usb_composite_dev *cdev) | ||
1108 | |||
1109 | static int __init printer_bind(struct usb_composite_dev *cdev) | ||
1110 | { | ||
1111 | - return usb_add_config(cdev, &printer_cfg_driver, printer_bind_config); | ||
1112 | + int ret; | ||
1113 | + | ||
1114 | + ret = usb_string_ids_tab(cdev, strings); | ||
1115 | + if (ret < 0) | ||
1116 | + return ret; | ||
1117 | + device_desc.iManufacturer = strings[STRING_MANUFACTURER].id; | ||
1118 | + device_desc.iProduct = strings[STRING_PRODUCT].id; | ||
1119 | + device_desc.iSerialNumber = strings[STRING_SERIALNUM].id; | ||
1120 | + | ||
1121 | + ret = usb_add_config(cdev, &printer_cfg_driver, printer_bind_config); | ||
1122 | + return ret; | ||
1123 | } | ||
1124 | |||
1125 | static struct usb_composite_driver printer_driver = { | ||
1126 | diff --git a/drivers/usb/gadget/tcm_usb_gadget.c b/drivers/usb/gadget/tcm_usb_gadget.c | ||
1127 | index 5444866..d37334c 100644 | ||
1128 | --- a/drivers/usb/gadget/tcm_usb_gadget.c | ||
1129 | +++ b/drivers/usb/gadget/tcm_usb_gadget.c | ||
1130 | @@ -1977,7 +1977,6 @@ static struct usb_interface_descriptor bot_intf_desc = { | ||
1131 | .bInterfaceClass = USB_CLASS_MASS_STORAGE, | ||
1132 | .bInterfaceSubClass = USB_SC_SCSI, | ||
1133 | .bInterfaceProtocol = USB_PR_BULK, | ||
1134 | - .iInterface = USB_G_STR_INT_UAS, | ||
1135 | }; | ||
1136 | |||
1137 | static struct usb_interface_descriptor uasp_intf_desc = { | ||
1138 | @@ -1988,7 +1987,6 @@ static struct usb_interface_descriptor uasp_intf_desc = { | ||
1139 | .bInterfaceClass = USB_CLASS_MASS_STORAGE, | ||
1140 | .bInterfaceSubClass = USB_SC_SCSI, | ||
1141 | .bInterfaceProtocol = USB_PR_UAS, | ||
1142 | - .iInterface = USB_G_STR_INT_BBB, | ||
1143 | }; | ||
1144 | |||
1145 | static struct usb_endpoint_descriptor uasp_bi_desc = { | ||
1146 | @@ -2209,20 +2207,16 @@ static struct usb_device_descriptor usbg_device_desc = { | ||
1147 | .bDeviceClass = USB_CLASS_PER_INTERFACE, | ||
1148 | .idVendor = cpu_to_le16(UAS_VENDOR_ID), | ||
1149 | .idProduct = cpu_to_le16(UAS_PRODUCT_ID), | ||
1150 | - .iManufacturer = USB_G_STR_MANUFACTOR, | ||
1151 | - .iProduct = USB_G_STR_PRODUCT, | ||
1152 | - .iSerialNumber = USB_G_STR_SERIAL, | ||
1153 | - | ||
1154 | .bNumConfigurations = 1, | ||
1155 | }; | ||
1156 | |||
1157 | static struct usb_string usbg_us_strings[] = { | ||
1158 | - { USB_G_STR_MANUFACTOR, "Target Manufactor"}, | ||
1159 | - { USB_G_STR_PRODUCT, "Target Product"}, | ||
1160 | - { USB_G_STR_SERIAL, "000000000001"}, | ||
1161 | - { USB_G_STR_CONFIG, "default config"}, | ||
1162 | - { USB_G_STR_INT_UAS, "USB Attached SCSI"}, | ||
1163 | - { USB_G_STR_INT_BBB, "Bulk Only Transport"}, | ||
1164 | + [USB_G_STR_MANUFACTOR].s = "Target Manufactor", | ||
1165 | + [USB_G_STR_PRODUCT].s = "Target Product", | ||
1166 | + [USB_G_STR_SERIAL].s = "000000000001", | ||
1167 | + [USB_G_STR_CONFIG].s = "default config", | ||
1168 | + [USB_G_STR_INT_UAS].s = "USB Attached SCSI", | ||
1169 | + [USB_G_STR_INT_BBB].s = "Bulk Only Transport", | ||
1170 | { }, | ||
1171 | }; | ||
1172 | |||
1173 | @@ -2244,7 +2238,6 @@ static int guas_unbind(struct usb_composite_dev *cdev) | ||
1174 | static struct usb_configuration usbg_config_driver = { | ||
1175 | .label = "Linux Target", | ||
1176 | .bConfigurationValue = 1, | ||
1177 | - .iConfiguration = USB_G_STR_CONFIG, | ||
1178 | .bmAttributes = USB_CONFIG_ATT_SELFPOWER, | ||
1179 | }; | ||
1180 | |||
1181 | @@ -2417,6 +2410,9 @@ static int usbg_cfg_bind(struct usb_configuration *c) | ||
1182 | fu->function.disable = usbg_disable; | ||
1183 | fu->tpg = the_only_tpg_I_currently_have; | ||
1184 | |||
1185 | + bot_intf_desc.iInterface = usbg_us_strings[USB_G_STR_INT_BBB].id; | ||
1186 | + uasp_intf_desc.iInterface = usbg_us_strings[USB_G_STR_INT_UAS].id; | ||
1187 | + | ||
1188 | ret = usb_add_function(c, &fu->function); | ||
1189 | if (ret) | ||
1190 | goto err; | ||
1191 | @@ -2431,6 +2427,17 @@ static int usb_target_bind(struct usb_composite_dev *cdev) | ||
1192 | { | ||
1193 | int ret; | ||
1194 | |||
1195 | + ret = usb_string_ids_tab(cdev, usbg_us_strings); | ||
1196 | + if (ret) | ||
1197 | + return ret; | ||
1198 | + | ||
1199 | + usbg_device_desc.iManufacturer = | ||
1200 | + usbg_us_strings[USB_G_STR_MANUFACTOR].id; | ||
1201 | + usbg_device_desc.iProduct = usbg_us_strings[USB_G_STR_PRODUCT].id; | ||
1202 | + usbg_device_desc.iSerialNumber = usbg_us_strings[USB_G_STR_SERIAL].id; | ||
1203 | + usbg_config_driver.iConfiguration = | ||
1204 | + usbg_us_strings[USB_G_STR_CONFIG].id; | ||
1205 | + | ||
1206 | ret = usb_add_config(cdev, &usbg_config_driver, | ||
1207 | usbg_cfg_bind); | ||
1208 | return 0; | ||
1209 | diff --git a/drivers/usb/gadget/tcm_usb_gadget.h b/drivers/usb/gadget/tcm_usb_gadget.h | ||
1210 | index bb18999..9d32ec3 100644 | ||
1211 | --- a/drivers/usb/gadget/tcm_usb_gadget.h | ||
1212 | +++ b/drivers/usb/gadget/tcm_usb_gadget.h | ||
1213 | @@ -16,12 +16,14 @@ | ||
1214 | #define UASP_SS_EP_COMP_LOG_STREAMS 4 | ||
1215 | #define UASP_SS_EP_COMP_NUM_STREAMS (1 << UASP_SS_EP_COMP_LOG_STREAMS) | ||
1216 | |||
1217 | -#define USB_G_STR_MANUFACTOR 1 | ||
1218 | -#define USB_G_STR_PRODUCT 2 | ||
1219 | -#define USB_G_STR_SERIAL 3 | ||
1220 | -#define USB_G_STR_CONFIG 4 | ||
1221 | -#define USB_G_STR_INT_UAS 5 | ||
1222 | -#define USB_G_STR_INT_BBB 6 | ||
1223 | +enum { | ||
1224 | + USB_G_STR_MANUFACTOR, | ||
1225 | + USB_G_STR_PRODUCT, | ||
1226 | + USB_G_STR_SERIAL, | ||
1227 | + USB_G_STR_CONFIG, | ||
1228 | + USB_G_STR_INT_UAS, | ||
1229 | + USB_G_STR_INT_BBB, | ||
1230 | +}; | ||
1231 | |||
1232 | #define USB_G_ALT_INT_BBB 0 | ||
1233 | #define USB_G_ALT_INT_UAS 1 | ||
1234 | diff --git a/drivers/usb/host/ehci-timer.c b/drivers/usb/host/ehci-timer.c | ||
1235 | index eb896a2..20dbdcb 100644 | ||
1236 | --- a/drivers/usb/host/ehci-timer.c | ||
1237 | +++ b/drivers/usb/host/ehci-timer.c | ||
1238 | @@ -118,7 +118,8 @@ static void ehci_poll_ASS(struct ehci_hcd *ehci) | ||
1239 | ehci_enable_event(ehci, EHCI_HRTIMER_POLL_ASS, true); | ||
1240 | return; | ||
1241 | } | ||
1242 | - ehci_warn(ehci, "Waited too long for the async schedule status, giving up\n"); | ||
1243 | + ehci_dbg(ehci, "Waited too long for the async schedule status (%x/%x), giving up\n", | ||
1244 | + want, actual); | ||
1245 | } | ||
1246 | ehci->ASS_poll_count = 0; | ||
1247 | |||
1248 | @@ -163,7 +164,8 @@ static void ehci_poll_PSS(struct ehci_hcd *ehci) | ||
1249 | ehci_enable_event(ehci, EHCI_HRTIMER_POLL_PSS, true); | ||
1250 | return; | ||
1251 | } | ||
1252 | - ehci_warn(ehci, "Waited too long for the periodic schedule status, giving up\n"); | ||
1253 | + ehci_dbg(ehci, "Waited too long for the periodic schedule status (%x/%x), giving up\n", | ||
1254 | + want, actual); | ||
1255 | } | ||
1256 | ehci->PSS_poll_count = 0; | ||
1257 | |||
1258 | diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c | ||
1259 | index 77689bd..487bc08 100644 | ||
1260 | --- a/drivers/usb/host/xhci-mem.c | ||
1261 | +++ b/drivers/usb/host/xhci-mem.c | ||
1262 | @@ -1772,6 +1772,7 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci) | ||
1263 | { | ||
1264 | struct pci_dev *pdev = to_pci_dev(xhci_to_hcd(xhci)->self.controller); | ||
1265 | struct dev_info *dev_info, *next; | ||
1266 | + struct xhci_cd *cur_cd, *next_cd; | ||
1267 | unsigned long flags; | ||
1268 | int size; | ||
1269 | int i, j, num_ports; | ||
1270 | @@ -1795,6 +1796,11 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci) | ||
1271 | xhci_ring_free(xhci, xhci->cmd_ring); | ||
1272 | xhci->cmd_ring = NULL; | ||
1273 | xhci_dbg(xhci, "Freed command ring\n"); | ||
1274 | + list_for_each_entry_safe(cur_cd, next_cd, | ||
1275 | + &xhci->cancel_cmd_list, cancel_cmd_list) { | ||
1276 | + list_del(&cur_cd->cancel_cmd_list); | ||
1277 | + kfree(cur_cd); | ||
1278 | + } | ||
1279 | |||
1280 | for (i = 1; i < MAX_HC_SLOTS; ++i) | ||
1281 | xhci_free_virt_device(xhci, i); | ||
1282 | @@ -2340,6 +2346,7 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) | ||
1283 | xhci->cmd_ring = xhci_ring_alloc(xhci, 1, 1, TYPE_COMMAND, flags); | ||
1284 | if (!xhci->cmd_ring) | ||
1285 | goto fail; | ||
1286 | + INIT_LIST_HEAD(&xhci->cancel_cmd_list); | ||
1287 | xhci_dbg(xhci, "Allocated command ring at %p\n", xhci->cmd_ring); | ||
1288 | xhci_dbg(xhci, "First segment DMA is 0x%llx\n", | ||
1289 | (unsigned long long)xhci->cmd_ring->first_seg->dma); | ||
1290 | diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c | ||
1291 | index 9bfd4ca11..8345d7c 100644 | ||
1292 | --- a/drivers/usb/host/xhci-pci.c | ||
1293 | +++ b/drivers/usb/host/xhci-pci.c | ||
1294 | @@ -103,6 +103,7 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) | ||
1295 | * PPT chipsets. | ||
1296 | */ | ||
1297 | xhci->quirks |= XHCI_SPURIOUS_REBOOT; | ||
1298 | + xhci->quirks |= XHCI_AVOID_BEI; | ||
1299 | } | ||
1300 | if (pdev->vendor == PCI_VENDOR_ID_ETRON && | ||
1301 | pdev->device == PCI_DEVICE_ID_ASROCK_P67) { | ||
1302 | diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c | ||
1303 | index 643c2f3..a6e18b9 100644 | ||
1304 | --- a/drivers/usb/host/xhci-ring.c | ||
1305 | +++ b/drivers/usb/host/xhci-ring.c | ||
1306 | @@ -280,12 +280,123 @@ static inline int room_on_ring(struct xhci_hcd *xhci, struct xhci_ring *ring, | ||
1307 | /* Ring the host controller doorbell after placing a command on the ring */ | ||
1308 | void xhci_ring_cmd_db(struct xhci_hcd *xhci) | ||
1309 | { | ||
1310 | + if (!(xhci->cmd_ring_state & CMD_RING_STATE_RUNNING)) | ||
1311 | + return; | ||
1312 | + | ||
1313 | xhci_dbg(xhci, "// Ding dong!\n"); | ||
1314 | xhci_writel(xhci, DB_VALUE_HOST, &xhci->dba->doorbell[0]); | ||
1315 | /* Flush PCI posted writes */ | ||
1316 | xhci_readl(xhci, &xhci->dba->doorbell[0]); | ||
1317 | } | ||
1318 | |||
1319 | +static int xhci_abort_cmd_ring(struct xhci_hcd *xhci) | ||
1320 | +{ | ||
1321 | + u64 temp_64; | ||
1322 | + int ret; | ||
1323 | + | ||
1324 | + xhci_dbg(xhci, "Abort command ring\n"); | ||
1325 | + | ||
1326 | + if (!(xhci->cmd_ring_state & CMD_RING_STATE_RUNNING)) { | ||
1327 | + xhci_dbg(xhci, "The command ring isn't running, " | ||
1328 | + "Have the command ring been stopped?\n"); | ||
1329 | + return 0; | ||
1330 | + } | ||
1331 | + | ||
1332 | + temp_64 = xhci_read_64(xhci, &xhci->op_regs->cmd_ring); | ||
1333 | + if (!(temp_64 & CMD_RING_RUNNING)) { | ||
1334 | + xhci_dbg(xhci, "Command ring had been stopped\n"); | ||
1335 | + return 0; | ||
1336 | + } | ||
1337 | + xhci->cmd_ring_state = CMD_RING_STATE_ABORTED; | ||
1338 | + xhci_write_64(xhci, temp_64 | CMD_RING_ABORT, | ||
1339 | + &xhci->op_regs->cmd_ring); | ||
1340 | + | ||
1341 | + /* Section 4.6.1.2 of xHCI 1.0 spec says software should | ||
1342 | + * time the completion od all xHCI commands, including | ||
1343 | + * the Command Abort operation. If software doesn't see | ||
1344 | + * CRR negated in a timely manner (e.g. longer than 5 | ||
1345 | + * seconds), then it should assume that the there are | ||
1346 | + * larger problems with the xHC and assert HCRST. | ||
1347 | + */ | ||
1348 | + ret = handshake(xhci, &xhci->op_regs->cmd_ring, | ||
1349 | + CMD_RING_RUNNING, 0, 5 * 1000 * 1000); | ||
1350 | + if (ret < 0) { | ||
1351 | + xhci_err(xhci, "Stopped the command ring failed, " | ||
1352 | + "maybe the host is dead\n"); | ||
1353 | + xhci->xhc_state |= XHCI_STATE_DYING; | ||
1354 | + xhci_quiesce(xhci); | ||
1355 | + xhci_halt(xhci); | ||
1356 | + return -ESHUTDOWN; | ||
1357 | + } | ||
1358 | + | ||
1359 | + return 0; | ||
1360 | +} | ||
1361 | + | ||
1362 | +static int xhci_queue_cd(struct xhci_hcd *xhci, | ||
1363 | + struct xhci_command *command, | ||
1364 | + union xhci_trb *cmd_trb) | ||
1365 | +{ | ||
1366 | + struct xhci_cd *cd; | ||
1367 | + cd = kzalloc(sizeof(struct xhci_cd), GFP_ATOMIC); | ||
1368 | + if (!cd) | ||
1369 | + return -ENOMEM; | ||
1370 | + INIT_LIST_HEAD(&cd->cancel_cmd_list); | ||
1371 | + | ||
1372 | + cd->command = command; | ||
1373 | + cd->cmd_trb = cmd_trb; | ||
1374 | + list_add_tail(&cd->cancel_cmd_list, &xhci->cancel_cmd_list); | ||
1375 | + | ||
1376 | + return 0; | ||
1377 | +} | ||
1378 | + | ||
1379 | +/* | ||
1380 | + * Cancel the command which has issue. | ||
1381 | + * | ||
1382 | + * Some commands may hang due to waiting for acknowledgement from | ||
1383 | + * usb device. It is outside of the xHC's ability to control and | ||
1384 | + * will cause the command ring is blocked. When it occurs software | ||
1385 | + * should intervene to recover the command ring. | ||
1386 | + * See Section 4.6.1.1 and 4.6.1.2 | ||
1387 | + */ | ||
1388 | +int xhci_cancel_cmd(struct xhci_hcd *xhci, struct xhci_command *command, | ||
1389 | + union xhci_trb *cmd_trb) | ||
1390 | +{ | ||
1391 | + int retval = 0; | ||
1392 | + unsigned long flags; | ||
1393 | + | ||
1394 | + spin_lock_irqsave(&xhci->lock, flags); | ||
1395 | + | ||
1396 | + if (xhci->xhc_state & XHCI_STATE_DYING) { | ||
1397 | + xhci_warn(xhci, "Abort the command ring," | ||
1398 | + " but the xHCI is dead.\n"); | ||
1399 | + retval = -ESHUTDOWN; | ||
1400 | + goto fail; | ||
1401 | + } | ||
1402 | + | ||
1403 | + /* queue the cmd desriptor to cancel_cmd_list */ | ||
1404 | + retval = xhci_queue_cd(xhci, command, cmd_trb); | ||
1405 | + if (retval) { | ||
1406 | + xhci_warn(xhci, "Queuing command descriptor failed.\n"); | ||
1407 | + goto fail; | ||
1408 | + } | ||
1409 | + | ||
1410 | + /* abort command ring */ | ||
1411 | + retval = xhci_abort_cmd_ring(xhci); | ||
1412 | + if (retval) { | ||
1413 | + xhci_err(xhci, "Abort command ring failed\n"); | ||
1414 | + if (unlikely(retval == -ESHUTDOWN)) { | ||
1415 | + spin_unlock_irqrestore(&xhci->lock, flags); | ||
1416 | + usb_hc_died(xhci_to_hcd(xhci)->primary_hcd); | ||
1417 | + xhci_dbg(xhci, "xHCI host controller is dead.\n"); | ||
1418 | + return retval; | ||
1419 | + } | ||
1420 | + } | ||
1421 | + | ||
1422 | +fail: | ||
1423 | + spin_unlock_irqrestore(&xhci->lock, flags); | ||
1424 | + return retval; | ||
1425 | +} | ||
1426 | + | ||
1427 | void xhci_ring_ep_doorbell(struct xhci_hcd *xhci, | ||
1428 | unsigned int slot_id, | ||
1429 | unsigned int ep_index, | ||
1430 | @@ -1059,6 +1170,20 @@ static void handle_reset_ep_completion(struct xhci_hcd *xhci, | ||
1431 | } | ||
1432 | } | ||
1433 | |||
1434 | +/* Complete the command and detele it from the devcie's command queue. | ||
1435 | + */ | ||
1436 | +static void xhci_complete_cmd_in_cmd_wait_list(struct xhci_hcd *xhci, | ||
1437 | + struct xhci_command *command, u32 status) | ||
1438 | +{ | ||
1439 | + command->status = status; | ||
1440 | + list_del(&command->cmd_list); | ||
1441 | + if (command->completion) | ||
1442 | + complete(command->completion); | ||
1443 | + else | ||
1444 | + xhci_free_command(xhci, command); | ||
1445 | +} | ||
1446 | + | ||
1447 | + | ||
1448 | /* Check to see if a command in the device's command queue matches this one. | ||
1449 | * Signal the completion or free the command, and return 1. Return 0 if the | ||
1450 | * completed command isn't at the head of the command list. | ||
1451 | @@ -1077,15 +1202,144 @@ static int handle_cmd_in_cmd_wait_list(struct xhci_hcd *xhci, | ||
1452 | if (xhci->cmd_ring->dequeue != command->command_trb) | ||
1453 | return 0; | ||
1454 | |||
1455 | - command->status = GET_COMP_CODE(le32_to_cpu(event->status)); | ||
1456 | - list_del(&command->cmd_list); | ||
1457 | - if (command->completion) | ||
1458 | - complete(command->completion); | ||
1459 | - else | ||
1460 | - xhci_free_command(xhci, command); | ||
1461 | + xhci_complete_cmd_in_cmd_wait_list(xhci, command, | ||
1462 | + GET_COMP_CODE(le32_to_cpu(event->status))); | ||
1463 | return 1; | ||
1464 | } | ||
1465 | |||
1466 | +/* | ||
1467 | + * Finding the command trb need to be cancelled and modifying it to | ||
1468 | + * NO OP command. And if the command is in device's command wait | ||
1469 | + * list, finishing and freeing it. | ||
1470 | + * | ||
1471 | + * If we can't find the command trb, we think it had already been | ||
1472 | + * executed. | ||
1473 | + */ | ||
1474 | +static void xhci_cmd_to_noop(struct xhci_hcd *xhci, struct xhci_cd *cur_cd) | ||
1475 | +{ | ||
1476 | + struct xhci_segment *cur_seg; | ||
1477 | + union xhci_trb *cmd_trb; | ||
1478 | + u32 cycle_state; | ||
1479 | + | ||
1480 | + if (xhci->cmd_ring->dequeue == xhci->cmd_ring->enqueue) | ||
1481 | + return; | ||
1482 | + | ||
1483 | + /* find the current segment of command ring */ | ||
1484 | + cur_seg = find_trb_seg(xhci->cmd_ring->first_seg, | ||
1485 | + xhci->cmd_ring->dequeue, &cycle_state); | ||
1486 | + | ||
1487 | + /* find the command trb matched by cd from command ring */ | ||
1488 | + for (cmd_trb = xhci->cmd_ring->dequeue; | ||
1489 | + cmd_trb != xhci->cmd_ring->enqueue; | ||
1490 | + next_trb(xhci, xhci->cmd_ring, &cur_seg, &cmd_trb)) { | ||
1491 | + /* If the trb is link trb, continue */ | ||
1492 | + if (TRB_TYPE_LINK_LE32(cmd_trb->generic.field[3])) | ||
1493 | + continue; | ||
1494 | + | ||
1495 | + if (cur_cd->cmd_trb == cmd_trb) { | ||
1496 | + | ||
1497 | + /* If the command in device's command list, we should | ||
1498 | + * finish it and free the command structure. | ||
1499 | + */ | ||
1500 | + if (cur_cd->command) | ||
1501 | + xhci_complete_cmd_in_cmd_wait_list(xhci, | ||
1502 | + cur_cd->command, COMP_CMD_STOP); | ||
1503 | + | ||
1504 | + /* get cycle state from the origin command trb */ | ||
1505 | + cycle_state = le32_to_cpu(cmd_trb->generic.field[3]) | ||
1506 | + & TRB_CYCLE; | ||
1507 | + | ||
1508 | + /* modify the command trb to NO OP command */ | ||
1509 | + cmd_trb->generic.field[0] = 0; | ||
1510 | + cmd_trb->generic.field[1] = 0; | ||
1511 | + cmd_trb->generic.field[2] = 0; | ||
1512 | + cmd_trb->generic.field[3] = cpu_to_le32( | ||
1513 | + TRB_TYPE(TRB_CMD_NOOP) | cycle_state); | ||
1514 | + break; | ||
1515 | + } | ||
1516 | + } | ||
1517 | +} | ||
1518 | + | ||
1519 | +static void xhci_cancel_cmd_in_cd_list(struct xhci_hcd *xhci) | ||
1520 | +{ | ||
1521 | + struct xhci_cd *cur_cd, *next_cd; | ||
1522 | + | ||
1523 | + if (list_empty(&xhci->cancel_cmd_list)) | ||
1524 | + return; | ||
1525 | + | ||
1526 | + list_for_each_entry_safe(cur_cd, next_cd, | ||
1527 | + &xhci->cancel_cmd_list, cancel_cmd_list) { | ||
1528 | + xhci_cmd_to_noop(xhci, cur_cd); | ||
1529 | + list_del(&cur_cd->cancel_cmd_list); | ||
1530 | + kfree(cur_cd); | ||
1531 | + } | ||
1532 | +} | ||
1533 | + | ||
1534 | +/* | ||
1535 | + * traversing the cancel_cmd_list. If the command descriptor according | ||
1536 | + * to cmd_trb is found, the function free it and return 1, otherwise | ||
1537 | + * return 0. | ||
1538 | + */ | ||
1539 | +static int xhci_search_cmd_trb_in_cd_list(struct xhci_hcd *xhci, | ||
1540 | + union xhci_trb *cmd_trb) | ||
1541 | +{ | ||
1542 | + struct xhci_cd *cur_cd, *next_cd; | ||
1543 | + | ||
1544 | + if (list_empty(&xhci->cancel_cmd_list)) | ||
1545 | + return 0; | ||
1546 | + | ||
1547 | + list_for_each_entry_safe(cur_cd, next_cd, | ||
1548 | + &xhci->cancel_cmd_list, cancel_cmd_list) { | ||
1549 | + if (cur_cd->cmd_trb == cmd_trb) { | ||
1550 | + if (cur_cd->command) | ||
1551 | + xhci_complete_cmd_in_cmd_wait_list(xhci, | ||
1552 | + cur_cd->command, COMP_CMD_STOP); | ||
1553 | + list_del(&cur_cd->cancel_cmd_list); | ||
1554 | + kfree(cur_cd); | ||
1555 | + return 1; | ||
1556 | + } | ||
1557 | + } | ||
1558 | + | ||
1559 | + return 0; | ||
1560 | +} | ||
1561 | + | ||
1562 | +/* | ||
1563 | + * If the cmd_trb_comp_code is COMP_CMD_ABORT, we just check whether the | ||
1564 | + * trb pointed by the command ring dequeue pointer is the trb we want to | ||
1565 | + * cancel or not. And if the cmd_trb_comp_code is COMP_CMD_STOP, we will | ||
1566 | + * traverse the cancel_cmd_list to trun the all of the commands according | ||
1567 | + * to command descriptor to NO-OP trb. | ||
1568 | + */ | ||
1569 | +static int handle_stopped_cmd_ring(struct xhci_hcd *xhci, | ||
1570 | + int cmd_trb_comp_code) | ||
1571 | +{ | ||
1572 | + int cur_trb_is_good = 0; | ||
1573 | + | ||
1574 | + /* Searching the cmd trb pointed by the command ring dequeue | ||
1575 | + * pointer in command descriptor list. If it is found, free it. | ||
1576 | + */ | ||
1577 | + cur_trb_is_good = xhci_search_cmd_trb_in_cd_list(xhci, | ||
1578 | + xhci->cmd_ring->dequeue); | ||
1579 | + | ||
1580 | + if (cmd_trb_comp_code == COMP_CMD_ABORT) | ||
1581 | + xhci->cmd_ring_state = CMD_RING_STATE_STOPPED; | ||
1582 | + else if (cmd_trb_comp_code == COMP_CMD_STOP) { | ||
1583 | + /* traversing the cancel_cmd_list and canceling | ||
1584 | + * the command according to command descriptor | ||
1585 | + */ | ||
1586 | + xhci_cancel_cmd_in_cd_list(xhci); | ||
1587 | + | ||
1588 | + xhci->cmd_ring_state = CMD_RING_STATE_RUNNING; | ||
1589 | + /* | ||
1590 | + * ring command ring doorbell again to restart the | ||
1591 | + * command ring | ||
1592 | + */ | ||
1593 | + if (xhci->cmd_ring->dequeue != xhci->cmd_ring->enqueue) | ||
1594 | + xhci_ring_cmd_db(xhci); | ||
1595 | + } | ||
1596 | + return cur_trb_is_good; | ||
1597 | +} | ||
1598 | + | ||
1599 | static void handle_cmd_completion(struct xhci_hcd *xhci, | ||
1600 | struct xhci_event_cmd *event) | ||
1601 | { | ||
1602 | @@ -1111,6 +1365,22 @@ static void handle_cmd_completion(struct xhci_hcd *xhci, | ||
1603 | xhci->error_bitmask |= 1 << 5; | ||
1604 | return; | ||
1605 | } | ||
1606 | + | ||
1607 | + if ((GET_COMP_CODE(le32_to_cpu(event->status)) == COMP_CMD_ABORT) || | ||
1608 | + (GET_COMP_CODE(le32_to_cpu(event->status)) == COMP_CMD_STOP)) { | ||
1609 | + /* If the return value is 0, we think the trb pointed by | ||
1610 | + * command ring dequeue pointer is a good trb. The good | ||
1611 | + * trb means we don't want to cancel the trb, but it have | ||
1612 | + * been stopped by host. So we should handle it normally. | ||
1613 | + * Otherwise, driver should invoke inc_deq() and return. | ||
1614 | + */ | ||
1615 | + if (handle_stopped_cmd_ring(xhci, | ||
1616 | + GET_COMP_CODE(le32_to_cpu(event->status)))) { | ||
1617 | + inc_deq(xhci, xhci->cmd_ring); | ||
1618 | + return; | ||
1619 | + } | ||
1620 | + } | ||
1621 | + | ||
1622 | switch (le32_to_cpu(xhci->cmd_ring->dequeue->generic.field[3]) | ||
1623 | & TRB_TYPE_BITMASK) { | ||
1624 | case TRB_TYPE(TRB_ENABLE_SLOT): | ||
1625 | @@ -3400,7 +3670,9 @@ static int xhci_queue_isoc_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | ||
1626 | } else { | ||
1627 | td->last_trb = ep_ring->enqueue; | ||
1628 | field |= TRB_IOC; | ||
1629 | - if (xhci->hci_version == 0x100) { | ||
1630 | + if (xhci->hci_version == 0x100 && | ||
1631 | + !(xhci->quirks & | ||
1632 | + XHCI_AVOID_BEI)) { | ||
1633 | /* Set BEI bit except for the last td */ | ||
1634 | if (i < num_tds - 1) | ||
1635 | field |= TRB_BEI; | ||
1636 | diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c | ||
1637 | index 6ece0ed..a49868d 100644 | ||
1638 | --- a/drivers/usb/host/xhci.c | ||
1639 | +++ b/drivers/usb/host/xhci.c | ||
1640 | @@ -52,7 +52,7 @@ MODULE_PARM_DESC(link_quirk, "Don't clear the chain bit on a link TRB"); | ||
1641 | * handshake done). There are two failure modes: "usec" have passed (major | ||
1642 | * hardware flakeout), or the register reads as all-ones (hardware removed). | ||
1643 | */ | ||
1644 | -static int handshake(struct xhci_hcd *xhci, void __iomem *ptr, | ||
1645 | +int handshake(struct xhci_hcd *xhci, void __iomem *ptr, | ||
1646 | u32 mask, u32 done, int usec) | ||
1647 | { | ||
1648 | u32 result; | ||
1649 | @@ -105,9 +105,10 @@ int xhci_halt(struct xhci_hcd *xhci) | ||
1650 | |||
1651 | ret = handshake(xhci, &xhci->op_regs->status, | ||
1652 | STS_HALT, STS_HALT, XHCI_MAX_HALT_USEC); | ||
1653 | - if (!ret) | ||
1654 | + if (!ret) { | ||
1655 | xhci->xhc_state |= XHCI_STATE_HALTED; | ||
1656 | - else | ||
1657 | + xhci->cmd_ring_state = CMD_RING_STATE_STOPPED; | ||
1658 | + } else | ||
1659 | xhci_warn(xhci, "Host not halted after %u microseconds.\n", | ||
1660 | XHCI_MAX_HALT_USEC); | ||
1661 | return ret; | ||
1662 | @@ -470,6 +471,8 @@ static bool compliance_mode_recovery_timer_quirk_check(void) | ||
1663 | |||
1664 | dmi_product_name = dmi_get_system_info(DMI_PRODUCT_NAME); | ||
1665 | dmi_sys_vendor = dmi_get_system_info(DMI_SYS_VENDOR); | ||
1666 | + if (!dmi_product_name || !dmi_sys_vendor) | ||
1667 | + return false; | ||
1668 | |||
1669 | if (!(strstr(dmi_sys_vendor, "Hewlett-Packard"))) | ||
1670 | return false; | ||
1671 | @@ -581,6 +584,7 @@ static int xhci_run_finished(struct xhci_hcd *xhci) | ||
1672 | return -ENODEV; | ||
1673 | } | ||
1674 | xhci->shared_hcd->state = HC_STATE_RUNNING; | ||
1675 | + xhci->cmd_ring_state = CMD_RING_STATE_RUNNING; | ||
1676 | |||
1677 | if (xhci->quirks & XHCI_NEC_HOST) | ||
1678 | xhci_ring_cmd_db(xhci); | ||
1679 | @@ -886,7 +890,7 @@ int xhci_suspend(struct xhci_hcd *xhci) | ||
1680 | command &= ~CMD_RUN; | ||
1681 | xhci_writel(xhci, command, &xhci->op_regs->command); | ||
1682 | if (handshake(xhci, &xhci->op_regs->status, | ||
1683 | - STS_HALT, STS_HALT, 100*100)) { | ||
1684 | + STS_HALT, STS_HALT, XHCI_MAX_HALT_USEC)) { | ||
1685 | xhci_warn(xhci, "WARN: xHC CMD_RUN timeout\n"); | ||
1686 | spin_unlock_irq(&xhci->lock); | ||
1687 | return -ETIMEDOUT; | ||
1688 | @@ -2521,6 +2525,7 @@ static int xhci_configure_endpoint(struct xhci_hcd *xhci, | ||
1689 | struct completion *cmd_completion; | ||
1690 | u32 *cmd_status; | ||
1691 | struct xhci_virt_device *virt_dev; | ||
1692 | + union xhci_trb *cmd_trb; | ||
1693 | |||
1694 | spin_lock_irqsave(&xhci->lock, flags); | ||
1695 | virt_dev = xhci->devs[udev->slot_id]; | ||
1696 | @@ -2566,6 +2571,7 @@ static int xhci_configure_endpoint(struct xhci_hcd *xhci, | ||
1697 | } | ||
1698 | init_completion(cmd_completion); | ||
1699 | |||
1700 | + cmd_trb = xhci->cmd_ring->dequeue; | ||
1701 | if (!ctx_change) | ||
1702 | ret = xhci_queue_configure_endpoint(xhci, in_ctx->dma, | ||
1703 | udev->slot_id, must_succeed); | ||
1704 | @@ -2587,14 +2593,17 @@ static int xhci_configure_endpoint(struct xhci_hcd *xhci, | ||
1705 | /* Wait for the configure endpoint command to complete */ | ||
1706 | timeleft = wait_for_completion_interruptible_timeout( | ||
1707 | cmd_completion, | ||
1708 | - USB_CTRL_SET_TIMEOUT); | ||
1709 | + XHCI_CMD_DEFAULT_TIMEOUT); | ||
1710 | if (timeleft <= 0) { | ||
1711 | xhci_warn(xhci, "%s while waiting for %s command\n", | ||
1712 | timeleft == 0 ? "Timeout" : "Signal", | ||
1713 | ctx_change == 0 ? | ||
1714 | "configure endpoint" : | ||
1715 | "evaluate context"); | ||
1716 | - /* FIXME cancel the configure endpoint command */ | ||
1717 | + /* cancel the configure endpoint command */ | ||
1718 | + ret = xhci_cancel_cmd(xhci, command, cmd_trb); | ||
1719 | + if (ret < 0) | ||
1720 | + return ret; | ||
1721 | return -ETIME; | ||
1722 | } | ||
1723 | |||
1724 | @@ -3543,8 +3552,10 @@ int xhci_alloc_dev(struct usb_hcd *hcd, struct usb_device *udev) | ||
1725 | unsigned long flags; | ||
1726 | int timeleft; | ||
1727 | int ret; | ||
1728 | + union xhci_trb *cmd_trb; | ||
1729 | |||
1730 | spin_lock_irqsave(&xhci->lock, flags); | ||
1731 | + cmd_trb = xhci->cmd_ring->dequeue; | ||
1732 | ret = xhci_queue_slot_control(xhci, TRB_ENABLE_SLOT, 0); | ||
1733 | if (ret) { | ||
1734 | spin_unlock_irqrestore(&xhci->lock, flags); | ||
1735 | @@ -3556,12 +3567,12 @@ int xhci_alloc_dev(struct usb_hcd *hcd, struct usb_device *udev) | ||
1736 | |||
1737 | /* XXX: how much time for xHC slot assignment? */ | ||
1738 | timeleft = wait_for_completion_interruptible_timeout(&xhci->addr_dev, | ||
1739 | - USB_CTRL_SET_TIMEOUT); | ||
1740 | + XHCI_CMD_DEFAULT_TIMEOUT); | ||
1741 | if (timeleft <= 0) { | ||
1742 | xhci_warn(xhci, "%s while waiting for a slot\n", | ||
1743 | timeleft == 0 ? "Timeout" : "Signal"); | ||
1744 | - /* FIXME cancel the enable slot request */ | ||
1745 | - return 0; | ||
1746 | + /* cancel the enable slot request */ | ||
1747 | + return xhci_cancel_cmd(xhci, NULL, cmd_trb); | ||
1748 | } | ||
1749 | |||
1750 | if (!xhci->slot_id) { | ||
1751 | @@ -3622,6 +3633,7 @@ int xhci_address_device(struct usb_hcd *hcd, struct usb_device *udev) | ||
1752 | struct xhci_slot_ctx *slot_ctx; | ||
1753 | struct xhci_input_control_ctx *ctrl_ctx; | ||
1754 | u64 temp_64; | ||
1755 | + union xhci_trb *cmd_trb; | ||
1756 | |||
1757 | if (!udev->slot_id) { | ||
1758 | xhci_dbg(xhci, "Bad Slot ID %d\n", udev->slot_id); | ||
1759 | @@ -3660,6 +3672,7 @@ int xhci_address_device(struct usb_hcd *hcd, struct usb_device *udev) | ||
1760 | xhci_dbg_ctx(xhci, virt_dev->in_ctx, 2); | ||
1761 | |||
1762 | spin_lock_irqsave(&xhci->lock, flags); | ||
1763 | + cmd_trb = xhci->cmd_ring->dequeue; | ||
1764 | ret = xhci_queue_address_device(xhci, virt_dev->in_ctx->dma, | ||
1765 | udev->slot_id); | ||
1766 | if (ret) { | ||
1767 | @@ -3672,7 +3685,7 @@ int xhci_address_device(struct usb_hcd *hcd, struct usb_device *udev) | ||
1768 | |||
1769 | /* ctrl tx can take up to 5 sec; XXX: need more time for xHC? */ | ||
1770 | timeleft = wait_for_completion_interruptible_timeout(&xhci->addr_dev, | ||
1771 | - USB_CTRL_SET_TIMEOUT); | ||
1772 | + XHCI_CMD_DEFAULT_TIMEOUT); | ||
1773 | /* FIXME: From section 4.3.4: "Software shall be responsible for timing | ||
1774 | * the SetAddress() "recovery interval" required by USB and aborting the | ||
1775 | * command on a timeout. | ||
1776 | @@ -3680,7 +3693,10 @@ int xhci_address_device(struct usb_hcd *hcd, struct usb_device *udev) | ||
1777 | if (timeleft <= 0) { | ||
1778 | xhci_warn(xhci, "%s while waiting for address device command\n", | ||
1779 | timeleft == 0 ? "Timeout" : "Signal"); | ||
1780 | - /* FIXME cancel the address device command */ | ||
1781 | + /* cancel the address device command */ | ||
1782 | + ret = xhci_cancel_cmd(xhci, NULL, cmd_trb); | ||
1783 | + if (ret < 0) | ||
1784 | + return ret; | ||
1785 | return -ETIME; | ||
1786 | } | ||
1787 | |||
1788 | diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h | ||
1789 | index 1a05908..53df4e7 100644 | ||
1790 | --- a/drivers/usb/host/xhci.h | ||
1791 | +++ b/drivers/usb/host/xhci.h | ||
1792 | @@ -1256,6 +1256,16 @@ struct xhci_td { | ||
1793 | union xhci_trb *last_trb; | ||
1794 | }; | ||
1795 | |||
1796 | +/* xHCI command default timeout value */ | ||
1797 | +#define XHCI_CMD_DEFAULT_TIMEOUT (5 * HZ) | ||
1798 | + | ||
1799 | +/* command descriptor */ | ||
1800 | +struct xhci_cd { | ||
1801 | + struct list_head cancel_cmd_list; | ||
1802 | + struct xhci_command *command; | ||
1803 | + union xhci_trb *cmd_trb; | ||
1804 | +}; | ||
1805 | + | ||
1806 | struct xhci_dequeue_state { | ||
1807 | struct xhci_segment *new_deq_seg; | ||
1808 | union xhci_trb *new_deq_ptr; | ||
1809 | @@ -1421,6 +1431,11 @@ struct xhci_hcd { | ||
1810 | /* data structures */ | ||
1811 | struct xhci_device_context_array *dcbaa; | ||
1812 | struct xhci_ring *cmd_ring; | ||
1813 | + unsigned int cmd_ring_state; | ||
1814 | +#define CMD_RING_STATE_RUNNING (1 << 0) | ||
1815 | +#define CMD_RING_STATE_ABORTED (1 << 1) | ||
1816 | +#define CMD_RING_STATE_STOPPED (1 << 2) | ||
1817 | + struct list_head cancel_cmd_list; | ||
1818 | unsigned int cmd_ring_reserved_trbs; | ||
1819 | struct xhci_ring *event_ring; | ||
1820 | struct xhci_erst erst; | ||
1821 | @@ -1496,6 +1511,7 @@ struct xhci_hcd { | ||
1822 | #define XHCI_INTEL_HOST (1 << 12) | ||
1823 | #define XHCI_SPURIOUS_REBOOT (1 << 13) | ||
1824 | #define XHCI_COMP_MODE_QUIRK (1 << 14) | ||
1825 | +#define XHCI_AVOID_BEI (1 << 15) | ||
1826 | unsigned int num_active_eps; | ||
1827 | unsigned int limit_active_eps; | ||
1828 | /* There are two roothubs to keep track of bus suspend info for */ | ||
1829 | @@ -1704,6 +1720,8 @@ static inline void xhci_unregister_plat(void) | ||
1830 | |||
1831 | /* xHCI host controller glue */ | ||
1832 | typedef void (*xhci_get_quirks_t)(struct device *, struct xhci_hcd *); | ||
1833 | +int handshake(struct xhci_hcd *xhci, void __iomem *ptr, | ||
1834 | + u32 mask, u32 done, int usec); | ||
1835 | void xhci_quiesce(struct xhci_hcd *xhci); | ||
1836 | int xhci_halt(struct xhci_hcd *xhci); | ||
1837 | int xhci_reset(struct xhci_hcd *xhci); | ||
1838 | @@ -1794,6 +1812,8 @@ void xhci_queue_config_ep_quirk(struct xhci_hcd *xhci, | ||
1839 | unsigned int slot_id, unsigned int ep_index, | ||
1840 | struct xhci_dequeue_state *deq_state); | ||
1841 | void xhci_stop_endpoint_command_watchdog(unsigned long arg); | ||
1842 | +int xhci_cancel_cmd(struct xhci_hcd *xhci, struct xhci_command *command, | ||
1843 | + union xhci_trb *cmd_trb); | ||
1844 | void xhci_ring_ep_doorbell(struct xhci_hcd *xhci, unsigned int slot_id, | ||
1845 | unsigned int ep_index, unsigned int stream_id); | ||
1846 | |||
1847 | diff --git a/drivers/usb/otg/mxs-phy.c b/drivers/usb/otg/mxs-phy.c | ||
1848 | index c1a67cb..88db976 100644 | ||
1849 | --- a/drivers/usb/otg/mxs-phy.c | ||
1850 | +++ b/drivers/usb/otg/mxs-phy.c | ||
1851 | @@ -20,6 +20,7 @@ | ||
1852 | #include <linux/delay.h> | ||
1853 | #include <linux/err.h> | ||
1854 | #include <linux/io.h> | ||
1855 | +#include <linux/workqueue.h> | ||
1856 | |||
1857 | #define DRIVER_NAME "mxs_phy" | ||
1858 | |||
1859 | @@ -34,9 +35,16 @@ | ||
1860 | #define BM_USBPHY_CTRL_ENUTMILEVEL2 BIT(14) | ||
1861 | #define BM_USBPHY_CTRL_ENHOSTDISCONDETECT BIT(1) | ||
1862 | |||
1863 | +/* | ||
1864 | + * Amount of delay in miliseconds to safely enable ENHOSTDISCONDETECT bit | ||
1865 | + * so that connection and reset processing can be completed for the root hub. | ||
1866 | + */ | ||
1867 | +#define MXY_PHY_ENHOSTDISCONDETECT_DELAY 250 | ||
1868 | + | ||
1869 | struct mxs_phy { | ||
1870 | struct usb_phy phy; | ||
1871 | struct clk *clk; | ||
1872 | + struct delayed_work enhostdiscondetect_work; | ||
1873 | }; | ||
1874 | |||
1875 | #define to_mxs_phy(p) container_of((p), struct mxs_phy, phy) | ||
1876 | @@ -62,6 +70,7 @@ static int mxs_phy_init(struct usb_phy *phy) | ||
1877 | |||
1878 | clk_prepare_enable(mxs_phy->clk); | ||
1879 | mxs_phy_hw_init(mxs_phy); | ||
1880 | + INIT_DELAYED_WORK(&mxs_phy->enhostdiscondetect_work, NULL); | ||
1881 | |||
1882 | return 0; | ||
1883 | } | ||
1884 | @@ -76,13 +85,34 @@ static void mxs_phy_shutdown(struct usb_phy *phy) | ||
1885 | clk_disable_unprepare(mxs_phy->clk); | ||
1886 | } | ||
1887 | |||
1888 | +static void mxs_phy_enhostdiscondetect_delay(struct work_struct *ws) | ||
1889 | +{ | ||
1890 | + struct mxs_phy *mxs_phy = container_of(ws, struct mxs_phy, | ||
1891 | + enhostdiscondetect_work.work); | ||
1892 | + | ||
1893 | + /* Enable HOSTDISCONDETECT after delay. */ | ||
1894 | + dev_dbg(mxs_phy->phy.dev, "Setting ENHOSTDISCONDETECT\n"); | ||
1895 | + writel_relaxed(BM_USBPHY_CTRL_ENHOSTDISCONDETECT, | ||
1896 | + mxs_phy->phy.io_priv + HW_USBPHY_CTRL_SET); | ||
1897 | +} | ||
1898 | + | ||
1899 | static int mxs_phy_on_connect(struct usb_phy *phy, int port) | ||
1900 | { | ||
1901 | + struct mxs_phy *mxs_phy = to_mxs_phy(phy); | ||
1902 | + | ||
1903 | dev_dbg(phy->dev, "Connect on port %d\n", port); | ||
1904 | |||
1905 | - mxs_phy_hw_init(to_mxs_phy(phy)); | ||
1906 | - writel_relaxed(BM_USBPHY_CTRL_ENHOSTDISCONDETECT, | ||
1907 | - phy->io_priv + HW_USBPHY_CTRL_SET); | ||
1908 | + mxs_phy_hw_init(mxs_phy); | ||
1909 | + | ||
1910 | + /* | ||
1911 | + * Delay enabling ENHOSTDISCONDETECT so that connection and | ||
1912 | + * reset processing can be completed for the root hub. | ||
1913 | + */ | ||
1914 | + dev_dbg(phy->dev, "Delaying setting ENHOSTDISCONDETECT\n"); | ||
1915 | + PREPARE_DELAYED_WORK(&mxs_phy->enhostdiscondetect_work, | ||
1916 | + mxs_phy_enhostdiscondetect_delay); | ||
1917 | + schedule_delayed_work(&mxs_phy->enhostdiscondetect_work, | ||
1918 | + msecs_to_jiffies(MXY_PHY_ENHOSTDISCONDETECT_DELAY)); | ||
1919 | |||
1920 | return 0; | ||
1921 | } | ||
1922 | @@ -91,6 +121,8 @@ static int mxs_phy_on_disconnect(struct usb_phy *phy, int port) | ||
1923 | { | ||
1924 | dev_dbg(phy->dev, "Disconnect on port %d\n", port); | ||
1925 | |||
1926 | + /* No need to delay before clearing ENHOSTDISCONDETECT. */ | ||
1927 | + dev_dbg(phy->dev, "Clearing ENHOSTDISCONDETECT\n"); | ||
1928 | writel_relaxed(BM_USBPHY_CTRL_ENHOSTDISCONDETECT, | ||
1929 | phy->io_priv + HW_USBPHY_CTRL_CLR); | ||
1930 | |||
1931 | diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c | ||
1932 | index f906b3a..b71ee32 100644 | ||
1933 | --- a/drivers/usb/serial/ftdi_sio.c | ||
1934 | +++ b/drivers/usb/serial/ftdi_sio.c | ||
1935 | @@ -584,6 +584,8 @@ static struct usb_device_id id_table_combined [] = { | ||
1936 | { USB_DEVICE(FTDI_VID, FTDI_IBS_PEDO_PID) }, | ||
1937 | { USB_DEVICE(FTDI_VID, FTDI_IBS_PROD_PID) }, | ||
1938 | { USB_DEVICE(FTDI_VID, FTDI_TAVIR_STK500_PID) }, | ||
1939 | + { USB_DEVICE(FTDI_VID, FTDI_TIAO_UMPA_PID), | ||
1940 | + .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, | ||
1941 | /* | ||
1942 | * ELV devices: | ||
1943 | */ | ||
1944 | diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h | ||
1945 | index 41fe582..57c12ef 100644 | ||
1946 | --- a/drivers/usb/serial/ftdi_sio_ids.h | ||
1947 | +++ b/drivers/usb/serial/ftdi_sio_ids.h | ||
1948 | @@ -517,6 +517,11 @@ | ||
1949 | */ | ||
1950 | #define FTDI_TAVIR_STK500_PID 0xFA33 /* STK500 AVR programmer */ | ||
1951 | |||
1952 | +/* | ||
1953 | + * TIAO product ids (FTDI_VID) | ||
1954 | + * http://www.tiaowiki.com/w/Main_Page | ||
1955 | + */ | ||
1956 | +#define FTDI_TIAO_UMPA_PID 0x8a98 /* TIAO/DIYGADGET USB Multi-Protocol Adapter */ | ||
1957 | |||
1958 | |||
1959 | /********************************/ | ||
1960 | diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c | ||
1961 | index 5ce88d1..5f30800 100644 | ||
1962 | --- a/drivers/usb/serial/option.c | ||
1963 | +++ b/drivers/usb/serial/option.c | ||
1964 | @@ -870,7 +870,8 @@ static const struct usb_device_id option_ids[] = { | ||
1965 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0153, 0xff, 0xff, 0xff) }, | ||
1966 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0155, 0xff, 0xff, 0xff) }, | ||
1967 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0156, 0xff, 0xff, 0xff) }, | ||
1968 | - { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0157, 0xff, 0xff, 0xff) }, | ||
1969 | + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0157, 0xff, 0xff, 0xff), | ||
1970 | + .driver_info = (kernel_ulong_t)&net_intf5_blacklist }, | ||
1971 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0158, 0xff, 0xff, 0xff) }, | ||
1972 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0159, 0xff, 0xff, 0xff) }, | ||
1973 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0161, 0xff, 0xff, 0xff) }, | ||
1974 | diff --git a/drivers/usb/serial/qcaux.c b/drivers/usb/serial/qcaux.c | ||
1975 | index a4edc7e..9b1b96f 100644 | ||
1976 | --- a/drivers/usb/serial/qcaux.c | ||
1977 | +++ b/drivers/usb/serial/qcaux.c | ||
1978 | @@ -36,8 +36,6 @@ | ||
1979 | #define UTSTARCOM_PRODUCT_UM175_V1 0x3712 | ||
1980 | #define UTSTARCOM_PRODUCT_UM175_V2 0x3714 | ||
1981 | #define UTSTARCOM_PRODUCT_UM175_ALLTEL 0x3715 | ||
1982 | -#define PANTECH_PRODUCT_UML190_VZW 0x3716 | ||
1983 | -#define PANTECH_PRODUCT_UML290_VZW 0x3718 | ||
1984 | |||
1985 | /* CMOTECH devices */ | ||
1986 | #define CMOTECH_VENDOR_ID 0x16d8 | ||
1987 | @@ -68,11 +66,9 @@ static struct usb_device_id id_table[] = { | ||
1988 | { USB_DEVICE_AND_INTERFACE_INFO(LG_VENDOR_ID, LG_PRODUCT_VX4400_6000, 0xff, 0xff, 0x00) }, | ||
1989 | { USB_DEVICE_AND_INTERFACE_INFO(SANYO_VENDOR_ID, SANYO_PRODUCT_KATANA_LX, 0xff, 0xff, 0x00) }, | ||
1990 | { USB_DEVICE_AND_INTERFACE_INFO(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_U520, 0xff, 0x00, 0x00) }, | ||
1991 | - { USB_DEVICE_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, PANTECH_PRODUCT_UML190_VZW, 0xff, 0xff, 0xff) }, | ||
1992 | - { USB_DEVICE_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, PANTECH_PRODUCT_UML190_VZW, 0xff, 0xfe, 0xff) }, | ||
1993 | - { USB_DEVICE_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, PANTECH_PRODUCT_UML290_VZW, 0xff, 0xfd, 0xff) }, /* NMEA */ | ||
1994 | - { USB_DEVICE_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, PANTECH_PRODUCT_UML290_VZW, 0xff, 0xfe, 0xff) }, /* WMC */ | ||
1995 | - { USB_DEVICE_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, PANTECH_PRODUCT_UML290_VZW, 0xff, 0xff, 0xff) }, /* DIAG */ | ||
1996 | + { USB_VENDOR_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, 0xff, 0xfd, 0xff) }, /* NMEA */ | ||
1997 | + { USB_VENDOR_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, 0xff, 0xfe, 0xff) }, /* WMC */ | ||
1998 | + { USB_VENDOR_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, 0xff, 0xff, 0xff) }, /* DIAG */ | ||
1999 | { }, | ||
2000 | }; | ||
2001 | MODULE_DEVICE_TABLE(usb, id_table); | ||
2002 | diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c | ||
2003 | index 27483f9..667c39c 100644 | ||
2004 | --- a/drivers/usb/serial/usb-serial.c | ||
2005 | +++ b/drivers/usb/serial/usb-serial.c | ||
2006 | @@ -1426,9 +1426,10 @@ int usb_serial_register_drivers(struct usb_serial_driver *const serial_drivers[] | ||
2007 | |||
2008 | /* we only set the reset_resume field if the serial_driver has one */ | ||
2009 | for (sd = serial_drivers; *sd; ++sd) { | ||
2010 | - if ((*sd)->reset_resume) | ||
2011 | + if ((*sd)->reset_resume) { | ||
2012 | udriver->reset_resume = usb_serial_reset_resume; | ||
2013 | break; | ||
2014 | + } | ||
2015 | } | ||
2016 | |||
2017 | rc = usb_register(udriver); | ||
2018 | diff --git a/drivers/xen/xen-pciback/pci_stub.c b/drivers/xen/xen-pciback/pci_stub.c | ||
2019 | index 0334272..77c9f76 100644 | ||
2020 | --- a/drivers/xen/xen-pciback/pci_stub.c | ||
2021 | +++ b/drivers/xen/xen-pciback/pci_stub.c | ||
2022 | @@ -362,6 +362,7 @@ static int __devinit pcistub_init_device(struct pci_dev *dev) | ||
2023 | else { | ||
2024 | dev_dbg(&dev->dev, "reseting (FLR, D3, etc) the device\n"); | ||
2025 | __pci_reset_function_locked(dev); | ||
2026 | + pci_restore_state(dev); | ||
2027 | } | ||
2028 | /* Now disable the device (this also ensures some private device | ||
2029 | * data is setup before we export) | ||
2030 | diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c | ||
2031 | index 1b52956..0225fdd 100644 | ||
2032 | --- a/fs/binfmt_elf.c | ||
2033 | +++ b/fs/binfmt_elf.c | ||
2034 | @@ -1696,30 +1696,19 @@ static int elf_note_info_init(struct elf_note_info *info) | ||
2035 | return 0; | ||
2036 | info->psinfo = kmalloc(sizeof(*info->psinfo), GFP_KERNEL); | ||
2037 | if (!info->psinfo) | ||
2038 | - goto notes_free; | ||
2039 | + return 0; | ||
2040 | info->prstatus = kmalloc(sizeof(*info->prstatus), GFP_KERNEL); | ||
2041 | if (!info->prstatus) | ||
2042 | - goto psinfo_free; | ||
2043 | + return 0; | ||
2044 | info->fpu = kmalloc(sizeof(*info->fpu), GFP_KERNEL); | ||
2045 | if (!info->fpu) | ||
2046 | - goto prstatus_free; | ||
2047 | + return 0; | ||
2048 | #ifdef ELF_CORE_COPY_XFPREGS | ||
2049 | info->xfpu = kmalloc(sizeof(*info->xfpu), GFP_KERNEL); | ||
2050 | if (!info->xfpu) | ||
2051 | - goto fpu_free; | ||
2052 | + return 0; | ||
2053 | #endif | ||
2054 | return 1; | ||
2055 | -#ifdef ELF_CORE_COPY_XFPREGS | ||
2056 | - fpu_free: | ||
2057 | - kfree(info->fpu); | ||
2058 | -#endif | ||
2059 | - prstatus_free: | ||
2060 | - kfree(info->prstatus); | ||
2061 | - psinfo_free: | ||
2062 | - kfree(info->psinfo); | ||
2063 | - notes_free: | ||
2064 | - kfree(info->notes); | ||
2065 | - return 0; | ||
2066 | } | ||
2067 | |||
2068 | static int fill_note_info(struct elfhdr *elf, int phdrs, | ||
2069 | diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h | ||
2070 | index 6b4565c..8d3c427 100644 | ||
2071 | --- a/include/linux/pci_ids.h | ||
2072 | +++ b/include/linux/pci_ids.h | ||
2073 | @@ -1847,7 +1847,6 @@ | ||
2074 | #define PCI_DEVICE_ID_SIIG_8S_20x_650 0x2081 | ||
2075 | #define PCI_DEVICE_ID_SIIG_8S_20x_850 0x2082 | ||
2076 | #define PCI_SUBDEVICE_ID_SIIG_QUARTET_SERIAL 0x2050 | ||
2077 | -#define PCI_SUBDEVICE_ID_SIIG_DUAL_SERIAL 0x2530 | ||
2078 | |||
2079 | #define PCI_VENDOR_ID_RADISYS 0x1331 | ||
2080 | |||
2081 | diff --git a/security/yama/yama_lsm.c b/security/yama/yama_lsm.c | ||
2082 | index 0cc99a3..dcd6178 100644 | ||
2083 | --- a/security/yama/yama_lsm.c | ||
2084 | +++ b/security/yama/yama_lsm.c | ||
2085 | @@ -143,7 +143,7 @@ static int yama_task_prctl(int option, unsigned long arg2, unsigned long arg3, | ||
2086 | if (arg2 == 0) { | ||
2087 | yama_ptracer_del(NULL, myself); | ||
2088 | rc = 0; | ||
2089 | - } else if (arg2 == PR_SET_PTRACER_ANY) { | ||
2090 | + } else if (arg2 == PR_SET_PTRACER_ANY || (int)arg2 == -1) { | ||
2091 | rc = yama_ptracer_add(NULL, myself); | ||
2092 | } else { | ||
2093 | struct task_struct *tracer; | ||
2094 | diff --git a/tools/hv/hv_kvp_daemon.c b/tools/hv/hv_kvp_daemon.c | ||
2095 | index d9834b3..2984ffb 100644 | ||
2096 | --- a/tools/hv/hv_kvp_daemon.c | ||
2097 | +++ b/tools/hv/hv_kvp_daemon.c | ||
2098 | @@ -106,7 +106,7 @@ static void kvp_acquire_lock(int pool) | ||
2099 | |||
2100 | if (fcntl(kvp_file_info[pool].fd, F_SETLKW, &fl) == -1) { | ||
2101 | syslog(LOG_ERR, "Failed to acquire the lock pool: %d", pool); | ||
2102 | - exit(-1); | ||
2103 | + exit(EXIT_FAILURE); | ||
2104 | } | ||
2105 | } | ||
2106 | |||
2107 | @@ -118,7 +118,7 @@ static void kvp_release_lock(int pool) | ||
2108 | if (fcntl(kvp_file_info[pool].fd, F_SETLK, &fl) == -1) { | ||
2109 | perror("fcntl"); | ||
2110 | syslog(LOG_ERR, "Failed to release the lock pool: %d", pool); | ||
2111 | - exit(-1); | ||
2112 | + exit(EXIT_FAILURE); | ||
2113 | } | ||
2114 | } | ||
2115 | |||
2116 | @@ -137,14 +137,19 @@ static void kvp_update_file(int pool) | ||
2117 | if (!filep) { | ||
2118 | kvp_release_lock(pool); | ||
2119 | syslog(LOG_ERR, "Failed to open file, pool: %d", pool); | ||
2120 | - exit(-1); | ||
2121 | + exit(EXIT_FAILURE); | ||
2122 | } | ||
2123 | |||
2124 | bytes_written = fwrite(kvp_file_info[pool].records, | ||
2125 | sizeof(struct kvp_record), | ||
2126 | kvp_file_info[pool].num_records, filep); | ||
2127 | |||
2128 | - fflush(filep); | ||
2129 | + if (ferror(filep) || fclose(filep)) { | ||
2130 | + kvp_release_lock(pool); | ||
2131 | + syslog(LOG_ERR, "Failed to write file, pool: %d", pool); | ||
2132 | + exit(EXIT_FAILURE); | ||
2133 | + } | ||
2134 | + | ||
2135 | kvp_release_lock(pool); | ||
2136 | } | ||
2137 | |||
2138 | @@ -163,14 +168,19 @@ static void kvp_update_mem_state(int pool) | ||
2139 | if (!filep) { | ||
2140 | kvp_release_lock(pool); | ||
2141 | syslog(LOG_ERR, "Failed to open file, pool: %d", pool); | ||
2142 | - exit(-1); | ||
2143 | + exit(EXIT_FAILURE); | ||
2144 | } | ||
2145 | - while (!feof(filep)) { | ||
2146 | + for (;;) { | ||
2147 | readp = &record[records_read]; | ||
2148 | records_read += fread(readp, sizeof(struct kvp_record), | ||
2149 | ENTRIES_PER_BLOCK * num_blocks, | ||
2150 | filep); | ||
2151 | |||
2152 | + if (ferror(filep)) { | ||
2153 | + syslog(LOG_ERR, "Failed to read file, pool: %d", pool); | ||
2154 | + exit(EXIT_FAILURE); | ||
2155 | + } | ||
2156 | + | ||
2157 | if (!feof(filep)) { | ||
2158 | /* | ||
2159 | * We have more data to read. | ||
2160 | @@ -180,7 +190,7 @@ static void kvp_update_mem_state(int pool) | ||
2161 | |||
2162 | if (record == NULL) { | ||
2163 | syslog(LOG_ERR, "malloc failed"); | ||
2164 | - exit(-1); | ||
2165 | + exit(EXIT_FAILURE); | ||
2166 | } | ||
2167 | continue; | ||
2168 | } | ||
2169 | @@ -191,6 +201,7 @@ static void kvp_update_mem_state(int pool) | ||
2170 | kvp_file_info[pool].records = record; | ||
2171 | kvp_file_info[pool].num_records = records_read; | ||
2172 | |||
2173 | + fclose(filep); | ||
2174 | kvp_release_lock(pool); | ||
2175 | } | ||
2176 | static int kvp_file_init(void) | ||
2177 | @@ -208,7 +219,7 @@ static int kvp_file_init(void) | ||
2178 | if (access("/var/opt/hyperv", F_OK)) { | ||
2179 | if (mkdir("/var/opt/hyperv", S_IRUSR | S_IWUSR | S_IROTH)) { | ||
2180 | syslog(LOG_ERR, " Failed to create /var/opt/hyperv"); | ||
2181 | - exit(-1); | ||
2182 | + exit(EXIT_FAILURE); | ||
2183 | } | ||
2184 | } | ||
2185 | |||
2186 | @@ -232,12 +243,18 @@ static int kvp_file_init(void) | ||
2187 | fclose(filep); | ||
2188 | return 1; | ||
2189 | } | ||
2190 | - while (!feof(filep)) { | ||
2191 | + for (;;) { | ||
2192 | readp = &record[records_read]; | ||
2193 | records_read += fread(readp, sizeof(struct kvp_record), | ||
2194 | ENTRIES_PER_BLOCK, | ||
2195 | filep); | ||
2196 | |||
2197 | + if (ferror(filep)) { | ||
2198 | + syslog(LOG_ERR, "Failed to read file, pool: %d", | ||
2199 | + i); | ||
2200 | + exit(EXIT_FAILURE); | ||
2201 | + } | ||
2202 | + | ||
2203 | if (!feof(filep)) { | ||
2204 | /* | ||
2205 | * We have more data to read. | ||
2206 | @@ -657,13 +674,13 @@ int main(void) | ||
2207 | |||
2208 | if (kvp_file_init()) { | ||
2209 | syslog(LOG_ERR, "Failed to initialize the pools"); | ||
2210 | - exit(-1); | ||
2211 | + exit(EXIT_FAILURE); | ||
2212 | } | ||
2213 | |||
2214 | fd = socket(AF_NETLINK, SOCK_DGRAM, NETLINK_CONNECTOR); | ||
2215 | if (fd < 0) { | ||
2216 | syslog(LOG_ERR, "netlink socket creation failed; error:%d", fd); | ||
2217 | - exit(-1); | ||
2218 | + exit(EXIT_FAILURE); | ||
2219 | } | ||
2220 | addr.nl_family = AF_NETLINK; | ||
2221 | addr.nl_pad = 0; | ||
2222 | @@ -675,7 +692,7 @@ int main(void) | ||
2223 | if (error < 0) { | ||
2224 | syslog(LOG_ERR, "bind failed; error:%d", error); | ||
2225 | close(fd); | ||
2226 | - exit(-1); | ||
2227 | + exit(EXIT_FAILURE); | ||
2228 | } | ||
2229 | sock_opt = addr.nl_groups; | ||
2230 | setsockopt(fd, 270, 1, &sock_opt, sizeof(sock_opt)); | ||
2231 | @@ -695,7 +712,7 @@ int main(void) | ||
2232 | if (len < 0) { | ||
2233 | syslog(LOG_ERR, "netlink_send failed; error:%d", len); | ||
2234 | close(fd); | ||
2235 | - exit(-1); | ||
2236 | + exit(EXIT_FAILURE); | ||
2237 | } | ||
2238 | |||
2239 | pfd.fd = fd; | ||
2240 | @@ -863,7 +880,7 @@ kvp_done: | ||
2241 | len = netlink_send(fd, incoming_cn_msg); | ||
2242 | if (len < 0) { | ||
2243 | syslog(LOG_ERR, "net_link send failed; error:%d", len); | ||
2244 | - exit(-1); | ||
2245 | + exit(EXIT_FAILURE); | ||
2246 | } | ||
2247 | } | ||
2248 |