]> git.ipfire.org Git - ipfire-2.x.git/blob - src/patches/suse-2.6.27.39/patches.kernel.org/patch-2.6.27.28-29
Imported linux-2.6.27.39 suse/xen patches.
[ipfire-2.x.git] / src / patches / suse-2.6.27.39 / patches.kernel.org / patch-2.6.27.28-29
1 From: Greg Kroah-Hartman <gregkh@suse.de>
2 Subject: Linux 2.6.27.29
3
4 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
5
6 diff --git a/Makefile b/Makefile
7 index 7598325..47d46f4 100644
8 --- a/Makefile
9 +++ b/Makefile
10 @@ -1,7 +1,7 @@
11 VERSION = 2
12 PATCHLEVEL = 6
13 SUBLEVEL = 27
14 -EXTRAVERSION = .28
15 +EXTRAVERSION = .29
16 NAME = Trembling Tortoise
17
18 # *DOCUMENTATION*
19 diff --git a/arch/x86/mm/gup.c b/arch/x86/mm/gup.c
20 index 007bb06..73e6ce1 100644
21 --- a/arch/x86/mm/gup.c
22 +++ b/arch/x86/mm/gup.c
23 @@ -231,10 +231,15 @@ int get_user_pages_fast(unsigned long start, int nr_pages, int write,
24 start &= PAGE_MASK;
25 addr = start;
26 len = (unsigned long) nr_pages << PAGE_SHIFT;
27 +
28 end = start + len;
29 - if (unlikely(!access_ok(write ? VERIFY_WRITE : VERIFY_READ,
30 - start, len)))
31 + if (end < start)
32 + goto slow_irqon;
33 +
34 +#ifdef CONFIG_X86_64
35 + if (end >> 47)
36 goto slow_irqon;
37 +#endif
38
39 /*
40 * XXX: batch / limit 'nr', to avoid large irq off latency
41 diff --git a/arch/x86/mm/srat_64.c b/arch/x86/mm/srat_64.c
42 index 1b4763e..e353618 100644
43 --- a/arch/x86/mm/srat_64.c
44 +++ b/arch/x86/mm/srat_64.c
45 @@ -87,8 +87,10 @@ static __init void bad_srat(void)
46 found_add_area = 0;
47 for (i = 0; i < MAX_LOCAL_APIC; i++)
48 apicid_to_node[i] = NUMA_NO_NODE;
49 - for (i = 0; i < MAX_NUMNODES; i++)
50 - nodes_add[i].start = nodes[i].end = 0;
51 + for (i = 0; i < MAX_NUMNODES; i++) {
52 + nodes[i].start = nodes[i].end = 0;
53 + nodes_add[i].start = nodes_add[i].end = 0;
54 + }
55 remove_all_active_ranges();
56 }
57
58 diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
59 index e618cbe..e6b3c7e 100644
60 --- a/drivers/acpi/ec.c
61 +++ b/drivers/acpi/ec.c
62 @@ -1013,7 +1013,8 @@ int __init acpi_ec_ecdt_probe(void)
63 * which needs it, has fake EC._INI method, so use it as flag.
64 * Keep boot_ec struct as it will be needed soon.
65 */
66 - if (ACPI_FAILURE(acpi_get_handle(boot_ec->handle, "_INI", &dummy)))
67 + if (!dmi_name_in_vendors("ASUS") ||
68 + ACPI_FAILURE(acpi_get_handle(boot_ec->handle, "_INI", &dummy)))
69 return -ENODEV;
70 install:
71 if (!ec_install_handlers(boot_ec)) {
72 diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c
73 index 842e9ed..993772c 100644
74 --- a/drivers/hid/usbhid/hiddev.c
75 +++ b/drivers/hid/usbhid/hiddev.c
76 @@ -484,8 +484,10 @@ static noinline int hiddev_ioctl_usage(struct hiddev *hiddev, unsigned int cmd,
77 goto goodreturn;
78
79 case HIDIOCGCOLLECTIONINDEX:
80 + i = field->usage[uref->usage_index].collection_index;
81 + unlock_kernel();
82 kfree(uref_multi);
83 - return field->usage[uref->usage_index].collection_index;
84 + return i;
85 case HIDIOCGUSAGES:
86 for (i = 0; i < uref_multi->num_values; i++)
87 uref_multi->values[i] =
88 diff --git a/drivers/hwmon/max6650.c b/drivers/hwmon/max6650.c
89 index f27af6a..65cf25f 100644
90 --- a/drivers/hwmon/max6650.c
91 +++ b/drivers/hwmon/max6650.c
92 @@ -407,6 +407,7 @@ static ssize_t set_div(struct device *dev, struct device_attribute *devattr,
93 data->count = 3;
94 break;
95 default:
96 + mutex_unlock(&data->update_lock);
97 dev_err(&client->dev,
98 "illegal value for fan divider (%d)\n", div);
99 return -EINVAL;
100 diff --git a/drivers/input/misc/wistron_btns.c b/drivers/input/misc/wistron_btns.c
101 index fe268be..2dacc3e 100644
102 --- a/drivers/input/misc/wistron_btns.c
103 +++ b/drivers/input/misc/wistron_btns.c
104 @@ -627,6 +627,15 @@ static struct dmi_system_id dmi_ids[] __initdata = {
105 },
106 {
107 .callback = dmi_matched,
108 + .ident = "Maxdata Pro 7000 DX",
109 + .matches = {
110 + DMI_MATCH(DMI_SYS_VENDOR, "MAXDATA"),
111 + DMI_MATCH(DMI_PRODUCT_NAME, "Pro 7000"),
112 + },
113 + .driver_data = keymap_fs_amilo_pro_v2000
114 + },
115 + {
116 + .callback = dmi_matched,
117 .ident = "Fujitsu N3510",
118 .matches = {
119 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
120 diff --git a/drivers/isdn/gigaset/ev-layer.c b/drivers/isdn/gigaset/ev-layer.c
121 index 5cbf64d..c712bcc 100644
122 --- a/drivers/isdn/gigaset/ev-layer.c
123 +++ b/drivers/isdn/gigaset/ev-layer.c
124 @@ -307,32 +307,33 @@ struct reply_t gigaset_tab_cid_m10x[] = /* for M10x */
125 {RSP_OK, 604,604, -1, 605, 5, {ACT_CMD+AT_MSN}},
126 {RSP_OK, 605,605, -1, 606, 5, {ACT_CMD+AT_ISO}},
127 {RSP_NULL, 605,605, -1, 606, 5, {ACT_CMD+AT_ISO}},
128 - {RSP_OK, 606,606, -1, 607, 5, {0}, "+VLS=17\r"}, /* set "Endgeraetemodus" */
129 + {RSP_OK, 606,606, -1, 607, 5, {0}, "+VLS=17\r"},
130 {RSP_OK, 607,607, -1, 608,-1},
131 - //{RSP_ZSAU, 608,608,ZSAU_PROCEEDING, 608, 0, {ACT_ERROR}},//DELETE
132 {RSP_ZSAU, 608,608,ZSAU_PROCEEDING, 609, 5, {ACT_CMD+AT_DIAL}},
133 {RSP_OK, 609,609, -1, 650, 0, {ACT_DIALING}},
134
135 - {RSP_ZVLS, 608,608, 17, -1,-1, {ACT_DEBUG}},
136 - {RSP_ZCTP, 609,609, -1, -1,-1, {ACT_DEBUG}},
137 - {RSP_ZCPN, 609,609, -1, -1,-1, {ACT_DEBUG}},
138 {RSP_ERROR, 601,609, -1, 0, 0, {ACT_ABORTDIAL}},
139 {EV_TIMEOUT, 601,609, -1, 0, 0, {ACT_ABORTDIAL}},
140
141 - /* dialing */
142 - {RSP_ZCTP, 650,650, -1, -1,-1, {ACT_DEBUG}},
143 - {RSP_ZCPN, 650,650, -1, -1,-1, {ACT_DEBUG}},
144 - {RSP_ZSAU, 650,650,ZSAU_CALL_DELIVERED, -1,-1, {ACT_DEBUG}}, /* some devices don't send this */
145 -
146 - /* connection established */
147 - {RSP_ZSAU, 650,650,ZSAU_ACTIVE, 800,-1, {ACT_CONNECT}}, //FIXME -> DLE1
148 - {RSP_ZSAU, 750,750,ZSAU_ACTIVE, 800,-1, {ACT_CONNECT}}, //FIXME -> DLE1
149 -
150 - {EV_BC_OPEN, 800,800, -1, 800,-1, {ACT_NOTIFY_BC_UP}}, //FIXME new constate + timeout
151 + /* optional dialing responses */
152 + {EV_BC_OPEN, 650,650, -1, 651,-1},
153 + {RSP_ZVLS, 608,651, 17, -1,-1, {ACT_DEBUG}},
154 + {RSP_ZCTP, 609,651, -1, -1,-1, {ACT_DEBUG}},
155 + {RSP_ZCPN, 609,651, -1, -1,-1, {ACT_DEBUG}},
156 + {RSP_ZSAU, 650,651,ZSAU_CALL_DELIVERED, -1,-1, {ACT_DEBUG}},
157 +
158 + /* connect */
159 + {RSP_ZSAU, 650,650,ZSAU_ACTIVE, 800,-1, {ACT_CONNECT}},
160 + {RSP_ZSAU, 651,651,ZSAU_ACTIVE, 800,-1, {ACT_CONNECT,
161 + ACT_NOTIFY_BC_UP}},
162 + {RSP_ZSAU, 750,750,ZSAU_ACTIVE, 800,-1, {ACT_CONNECT}},
163 + {RSP_ZSAU, 751,751,ZSAU_ACTIVE, 800,-1, {ACT_CONNECT,
164 + ACT_NOTIFY_BC_UP}},
165 + {EV_BC_OPEN, 800,800, -1, 800,-1, {ACT_NOTIFY_BC_UP}},
166
167 /* remote hangup */
168 - {RSP_ZSAU, 650,650,ZSAU_DISCONNECT_IND, 0, 0, {ACT_REMOTEREJECT}},
169 - {RSP_ZSAU, 750,750,ZSAU_DISCONNECT_IND, 0, 0, {ACT_REMOTEHUP}},
170 + {RSP_ZSAU, 650,651,ZSAU_DISCONNECT_IND, 0, 0, {ACT_REMOTEREJECT}},
171 + {RSP_ZSAU, 750,751,ZSAU_DISCONNECT_IND, 0, 0, {ACT_REMOTEHUP}},
172 {RSP_ZSAU, 800,800,ZSAU_DISCONNECT_IND, 0, 0, {ACT_REMOTEHUP}},
173
174 /* hangup */
175 @@ -371,7 +372,8 @@ struct reply_t gigaset_tab_cid_m10x[] = /* for M10x */
176 {RSP_ZSAU, 700,729,ZSAU_ACTIVE, 0, 0, {ACT_ABORTACCEPT}},
177 {RSP_ZSAU, 700,729,ZSAU_DISCONNECT_IND, 0, 0, {ACT_ABORTACCEPT}},
178
179 - {EV_TIMEOUT, 750,750, -1, 0, 0, {ACT_CONNTIMEOUT}},
180 + {EV_BC_OPEN, 750,750, -1, 751,-1},
181 + {EV_TIMEOUT, 750,751, -1, 0, 0, {ACT_CONNTIMEOUT}},
182
183 /* B channel closed (general case) */
184 {EV_BC_CLOSED, -1, -1, -1, -1,-1, {ACT_NOTIFY_BC_DOWN}}, //FIXME
185 @@ -914,12 +916,6 @@ static void bchannel_down(struct bc_state *bcs)
186
187 static void bchannel_up(struct bc_state *bcs)
188 {
189 - if (!(bcs->chstate & CHS_D_UP)) {
190 - dev_notice(bcs->cs->dev, "%s: D channel not up\n", __func__);
191 - bcs->chstate |= CHS_D_UP;
192 - gigaset_i4l_channel_cmd(bcs, ISDN_STAT_DCONN);
193 - }
194 -
195 if (bcs->chstate & CHS_B_UP) {
196 dev_notice(bcs->cs->dev, "%s: B channel already up\n",
197 __func__);
198 diff --git a/drivers/md/md.c b/drivers/md/md.c
199 index ebbc3bb..b60d328 100644
200 --- a/drivers/md/md.c
201 +++ b/drivers/md/md.c
202 @@ -3281,7 +3281,8 @@ suspend_lo_store(mddev_t *mddev, const char *buf, size_t len)
203 char *e;
204 unsigned long long new = simple_strtoull(buf, &e, 10);
205
206 - if (mddev->pers->quiesce == NULL)
207 + if (mddev->pers == NULL ||
208 + mddev->pers->quiesce == NULL)
209 return -EINVAL;
210 if (buf == e || (*e && *e != '\n'))
211 return -EINVAL;
212 @@ -3309,7 +3310,8 @@ suspend_hi_store(mddev_t *mddev, const char *buf, size_t len)
213 char *e;
214 unsigned long long new = simple_strtoull(buf, &e, 10);
215
216 - if (mddev->pers->quiesce == NULL)
217 + if (mddev->pers == NULL ||
218 + mddev->pers->quiesce == NULL)
219 return -EINVAL;
220 if (buf == e || (*e && *e != '\n'))
221 return -EINVAL;
222 diff --git a/drivers/net/e100.c b/drivers/net/e100.c
223 index 5cf78d6..d991167 100644
224 --- a/drivers/net/e100.c
225 +++ b/drivers/net/e100.c
226 @@ -1840,6 +1840,9 @@ static int e100_rx_indicate(struct nic *nic, struct rx *rx,
227
228 if (ioread8(&nic->csr->scb.status) & rus_no_res)
229 nic->ru_running = RU_SUSPENDED;
230 + pci_dma_sync_single_for_device(nic->pdev, rx->dma_addr,
231 + sizeof(struct rfd),
232 + PCI_DMA_BIDIRECTIONAL);
233 return -ENODATA;
234 }
235
236 diff --git a/drivers/net/hamradio/6pack.c b/drivers/net/hamradio/6pack.c
237 index 0f501d2..91e4232 100644
238 --- a/drivers/net/hamradio/6pack.c
239 +++ b/drivers/net/hamradio/6pack.c
240 @@ -397,13 +397,14 @@ static DEFINE_RWLOCK(disc_data_lock);
241
242 static struct sixpack *sp_get(struct tty_struct *tty)
243 {
244 + unsigned long flags;
245 struct sixpack *sp;
246
247 - read_lock(&disc_data_lock);
248 + read_lock_irqsave(&disc_data_lock, flags);
249 sp = tty->disc_data;
250 if (sp)
251 atomic_inc(&sp->refcnt);
252 - read_unlock(&disc_data_lock);
253 + read_unlock_irqrestore(&disc_data_lock, flags);
254
255 return sp;
256 }
257 @@ -687,12 +688,13 @@ out:
258 */
259 static void sixpack_close(struct tty_struct *tty)
260 {
261 + unsigned long flags;
262 struct sixpack *sp;
263
264 - write_lock(&disc_data_lock);
265 + write_lock_irqsave(&disc_data_lock, flags);
266 sp = tty->disc_data;
267 tty->disc_data = NULL;
268 - write_unlock(&disc_data_lock);
269 + write_unlock_irqrestore(&disc_data_lock, flags);
270 if (!sp)
271 return;
272
273 diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c
274 index b8e25c4..2a9adcc 100644
275 --- a/drivers/net/hamradio/mkiss.c
276 +++ b/drivers/net/hamradio/mkiss.c
277 @@ -246,15 +246,16 @@ static int kiss_esc_crc(unsigned char *s, unsigned char *d, unsigned short crc,
278 /* Send one completely decapsulated AX.25 packet to the AX.25 layer. */
279 static void ax_bump(struct mkiss *ax)
280 {
281 + unsigned long flags;
282 struct sk_buff *skb;
283 int count;
284
285 - spin_lock_bh(&ax->buflock);
286 + spin_lock_irqsave(&ax->buflock, flags);
287 if (ax->rbuff[0] > 0x0f) {
288 if (ax->rbuff[0] & 0x80) {
289 if (check_crc_16(ax->rbuff, ax->rcount) < 0) {
290 ax->stats.rx_errors++;
291 - spin_unlock_bh(&ax->buflock);
292 + spin_unlock_irqrestore(&ax->buflock, flags);
293
294 return;
295 }
296 @@ -269,7 +270,7 @@ static void ax_bump(struct mkiss *ax)
297 } else if (ax->rbuff[0] & 0x20) {
298 if (check_crc_flex(ax->rbuff, ax->rcount) < 0) {
299 ax->stats.rx_errors++;
300 - spin_unlock_bh(&ax->buflock);
301 + spin_unlock_irqrestore(&ax->buflock, flags);
302 return;
303 }
304 if (ax->crcmode != CRC_MODE_FLEX && ax->crcauto) {
305 @@ -296,7 +297,7 @@ static void ax_bump(struct mkiss *ax)
306 printk(KERN_ERR "mkiss: %s: memory squeeze, dropping packet.\n",
307 ax->dev->name);
308 ax->stats.rx_dropped++;
309 - spin_unlock_bh(&ax->buflock);
310 + spin_unlock_irqrestore(&ax->buflock, flags);
311 return;
312 }
313
314 @@ -306,11 +307,13 @@ static void ax_bump(struct mkiss *ax)
315 ax->dev->last_rx = jiffies;
316 ax->stats.rx_packets++;
317 ax->stats.rx_bytes += count;
318 - spin_unlock_bh(&ax->buflock);
319 + spin_unlock_irqrestore(&ax->buflock, flags);
320 }
321
322 static void kiss_unesc(struct mkiss *ax, unsigned char s)
323 {
324 + unsigned long flags;
325 +
326 switch (s) {
327 case END:
328 /* drop keeptest bit = VSV */
329 @@ -337,18 +340,18 @@ static void kiss_unesc(struct mkiss *ax, unsigned char s)
330 break;
331 }
332
333 - spin_lock_bh(&ax->buflock);
334 + spin_lock_irqsave(&ax->buflock, flags);
335 if (!test_bit(AXF_ERROR, &ax->flags)) {
336 if (ax->rcount < ax->buffsize) {
337 ax->rbuff[ax->rcount++] = s;
338 - spin_unlock_bh(&ax->buflock);
339 + spin_unlock_irqrestore(&ax->buflock, flags);
340 return;
341 }
342
343 ax->stats.rx_over_errors++;
344 set_bit(AXF_ERROR, &ax->flags);
345 }
346 - spin_unlock_bh(&ax->buflock);
347 + spin_unlock_irqrestore(&ax->buflock, flags);
348 }
349
350 static int ax_set_mac_address(struct net_device *dev, void *addr)
351 @@ -370,6 +373,7 @@ static void ax_changedmtu(struct mkiss *ax)
352 {
353 struct net_device *dev = ax->dev;
354 unsigned char *xbuff, *rbuff, *oxbuff, *orbuff;
355 + unsigned long flags;
356 int len;
357
358 len = dev->mtu * 2;
359 @@ -395,7 +399,7 @@ static void ax_changedmtu(struct mkiss *ax)
360 return;
361 }
362
363 - spin_lock_bh(&ax->buflock);
364 + spin_lock_irqsave(&ax->buflock, flags);
365
366 oxbuff = ax->xbuff;
367 ax->xbuff = xbuff;
368 @@ -426,7 +430,7 @@ static void ax_changedmtu(struct mkiss *ax)
369 ax->mtu = dev->mtu + 73;
370 ax->buffsize = len;
371
372 - spin_unlock_bh(&ax->buflock);
373 + spin_unlock_irqrestore(&ax->buflock, flags);
374
375 kfree(oxbuff);
376 kfree(orbuff);
377 @@ -436,6 +440,7 @@ static void ax_changedmtu(struct mkiss *ax)
378 static void ax_encaps(struct net_device *dev, unsigned char *icp, int len)
379 {
380 struct mkiss *ax = netdev_priv(dev);
381 + unsigned long flags;
382 unsigned char *p;
383 int actual, count;
384
385 @@ -452,7 +457,7 @@ static void ax_encaps(struct net_device *dev, unsigned char *icp, int len)
386
387 p = icp;
388
389 - spin_lock_bh(&ax->buflock);
390 + spin_lock_irqsave(&ax->buflock, flags);
391 if ((*p & 0x0f) != 0) {
392 /* Configuration Command (kissparms(1).
393 * Protocol spec says: never append CRC.
394 @@ -482,7 +487,7 @@ static void ax_encaps(struct net_device *dev, unsigned char *icp, int len)
395 ax->crcauto = (cmd ? 0 : 1);
396 printk(KERN_INFO "mkiss: %s: crc mode %s %d\n", ax->dev->name, (len) ? "set to" : "is", cmd);
397 }
398 - spin_unlock_bh(&ax->buflock);
399 + spin_unlock_irqrestore(&ax->buflock, flags);
400 netif_start_queue(dev);
401
402 return;
403 @@ -515,7 +520,7 @@ static void ax_encaps(struct net_device *dev, unsigned char *icp, int len)
404 count = kiss_esc(p, (unsigned char *)ax->xbuff, len);
405 }
406 }
407 - spin_unlock_bh(&ax->buflock);
408 + spin_unlock_irqrestore(&ax->buflock, flags);
409
410 set_bit(TTY_DO_WRITE_WAKEUP, &ax->tty->flags);
411 actual = ax->tty->ops->write(ax->tty, ax->xbuff, count);
412 @@ -711,13 +716,14 @@ static DEFINE_RWLOCK(disc_data_lock);
413
414 static struct mkiss *mkiss_get(struct tty_struct *tty)
415 {
416 + unsigned long flags;
417 struct mkiss *ax;
418
419 - read_lock(&disc_data_lock);
420 + read_lock_irqsave(&disc_data_lock, flags);
421 ax = tty->disc_data;
422 if (ax)
423 atomic_inc(&ax->refcnt);
424 - read_unlock(&disc_data_lock);
425 + read_unlock_irqrestore(&disc_data_lock, flags);
426
427 return ax;
428 }
429 @@ -816,12 +822,13 @@ out:
430
431 static void mkiss_close(struct tty_struct *tty)
432 {
433 + unsigned long flags;
434 struct mkiss *ax;
435
436 - write_lock(&disc_data_lock);
437 + write_lock_irqsave(&disc_data_lock, flags);
438 ax = tty->disc_data;
439 tty->disc_data = NULL;
440 - write_unlock(&disc_data_lock);
441 + write_unlock_irqrestore(&disc_data_lock, flags);
442
443 if (!ax)
444 return;
445 diff --git a/drivers/net/ppp_async.c b/drivers/net/ppp_async.c
446 index 451bdb5..7dac631 100644
447 --- a/drivers/net/ppp_async.c
448 +++ b/drivers/net/ppp_async.c
449 @@ -132,13 +132,15 @@ static DEFINE_RWLOCK(disc_data_lock);
450
451 static struct asyncppp *ap_get(struct tty_struct *tty)
452 {
453 + unsigned long flags;
454 struct asyncppp *ap;
455
456 - read_lock(&disc_data_lock);
457 + read_lock_irqsave(&disc_data_lock, flags);
458 ap = tty->disc_data;
459 if (ap != NULL)
460 atomic_inc(&ap->refcnt);
461 - read_unlock(&disc_data_lock);
462 + read_unlock_irqrestore(&disc_data_lock, flags);
463 +
464 return ap;
465 }
466
467 @@ -212,12 +214,13 @@ ppp_asynctty_open(struct tty_struct *tty)
468 static void
469 ppp_asynctty_close(struct tty_struct *tty)
470 {
471 + unsigned long flags;
472 struct asyncppp *ap;
473
474 - write_lock_irq(&disc_data_lock);
475 + write_lock_irqsave(&disc_data_lock, flags);
476 ap = tty->disc_data;
477 tty->disc_data = NULL;
478 - write_unlock_irq(&disc_data_lock);
479 + write_unlock_irqrestore(&disc_data_lock, flags);
480 if (!ap)
481 return;
482
483 diff --git a/drivers/net/ppp_synctty.c b/drivers/net/ppp_synctty.c
484 index 801d8f9..13cc986 100644
485 --- a/drivers/net/ppp_synctty.c
486 +++ b/drivers/net/ppp_synctty.c
487 @@ -182,13 +182,15 @@ static DEFINE_RWLOCK(disc_data_lock);
488
489 static struct syncppp *sp_get(struct tty_struct *tty)
490 {
491 + unsigned long flags;
492 struct syncppp *ap;
493
494 - read_lock(&disc_data_lock);
495 + read_lock_irqsave(&disc_data_lock, flags);
496 ap = tty->disc_data;
497 if (ap != NULL)
498 atomic_inc(&ap->refcnt);
499 - read_unlock(&disc_data_lock);
500 + read_unlock_irqrestore(&disc_data_lock, flags);
501 +
502 return ap;
503 }
504
505 @@ -259,12 +261,13 @@ ppp_sync_open(struct tty_struct *tty)
506 static void
507 ppp_sync_close(struct tty_struct *tty)
508 {
509 + unsigned long flags;
510 struct syncppp *ap;
511
512 - write_lock_irq(&disc_data_lock);
513 + write_lock_irqsave(&disc_data_lock, flags);
514 ap = tty->disc_data;
515 tty->disc_data = NULL;
516 - write_unlock_irq(&disc_data_lock);
517 + write_unlock_irqrestore(&disc_data_lock, flags);
518 if (!ap)
519 return;
520
521 diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
522 index 5952522..f718215 100644
523 --- a/drivers/net/r8169.c
524 +++ b/drivers/net/r8169.c
525 @@ -2850,54 +2850,64 @@ static irqreturn_t rtl8169_interrupt(int irq, void *dev_instance)
526 int handled = 0;
527 int status;
528
529 + /* loop handling interrupts until we have no new ones or
530 + * we hit a invalid/hotplug case.
531 + */
532 status = RTL_R16(IntrStatus);
533 + while (status && status != 0xffff) {
534 + handled = 1;
535
536 - /* hotplug/major error/no more work/shared irq */
537 - if ((status == 0xffff) || !status)
538 - goto out;
539 -
540 - handled = 1;
541 + /* Handle all of the error cases first. These will reset
542 + * the chip, so just exit the loop.
543 + */
544 + if (unlikely(!netif_running(dev))) {
545 + rtl8169_asic_down(ioaddr);
546 + break;
547 + }
548
549 - if (unlikely(!netif_running(dev))) {
550 - rtl8169_asic_down(ioaddr);
551 - goto out;
552 - }
553 + /* Work around for rx fifo overflow */
554 + if (unlikely(status & RxFIFOOver) &&
555 + (tp->mac_version == RTL_GIGA_MAC_VER_11)) {
556 + netif_stop_queue(dev);
557 + rtl8169_tx_timeout(dev);
558 + break;
559 + }
560
561 - status &= tp->intr_mask;
562 - RTL_W16(IntrStatus,
563 - (status & RxFIFOOver) ? (status | RxOverflow) : status);
564 + if (unlikely(status & SYSErr)) {
565 + rtl8169_pcierr_interrupt(dev);
566 + break;
567 + }
568
569 - if (!(status & tp->intr_event))
570 - goto out;
571 + if (status & LinkChg)
572 + rtl8169_check_link_status(dev, tp, ioaddr);
573
574 - /* Work around for rx fifo overflow */
575 - if (unlikely(status & RxFIFOOver) &&
576 - (tp->mac_version == RTL_GIGA_MAC_VER_11)) {
577 - netif_stop_queue(dev);
578 - rtl8169_tx_timeout(dev);
579 - goto out;
580 - }
581 + /* We need to see the lastest version of tp->intr_mask to
582 + * avoid ignoring an MSI interrupt and having to wait for
583 + * another event which may never come.
584 + */
585 + smp_rmb();
586 + if (status & tp->intr_mask & tp->napi_event) {
587 + RTL_W16(IntrMask, tp->intr_event & ~tp->napi_event);
588 + tp->intr_mask = ~tp->napi_event;
589 +
590 + if (likely(napi_schedule_prep(&tp->napi)))
591 + __napi_schedule(&tp->napi);
592 + else if (netif_msg_intr(tp)) {
593 + printk(KERN_INFO "%s: interrupt %04x in poll\n",
594 + dev->name, status);
595 + }
596 + }
597
598 - if (unlikely(status & SYSErr)) {
599 - rtl8169_pcierr_interrupt(dev);
600 - goto out;
601 + /* We only get a new MSI interrupt when all active irq
602 + * sources on the chip have been acknowledged. So, ack
603 + * everything we've seen and check if new sources have become
604 + * active to avoid blocking all interrupts from the chip.
605 + */
606 + RTL_W16(IntrStatus,
607 + (status & RxFIFOOver) ? (status | RxOverflow) : status);
608 + status = RTL_R16(IntrStatus);
609 }
610
611 - if (status & LinkChg)
612 - rtl8169_check_link_status(dev, tp, ioaddr);
613 -
614 - if (status & tp->napi_event) {
615 - RTL_W16(IntrMask, tp->intr_event & ~tp->napi_event);
616 - tp->intr_mask = ~tp->napi_event;
617 -
618 - if (likely(netif_rx_schedule_prep(dev, &tp->napi)))
619 - __netif_rx_schedule(dev, &tp->napi);
620 - else if (netif_msg_intr(tp)) {
621 - printk(KERN_INFO "%s: interrupt %04x in poll\n",
622 - dev->name, status);
623 - }
624 - }
625 -out:
626 return IRQ_RETVAL(handled);
627 }
628
629 @@ -2913,13 +2923,15 @@ static int rtl8169_poll(struct napi_struct *napi, int budget)
630
631 if (work_done < budget) {
632 netif_rx_complete(dev, napi);
633 - tp->intr_mask = 0xffff;
634 - /*
635 - * 20040426: the barrier is not strictly required but the
636 - * behavior of the irq handler could be less predictable
637 - * without it. Btw, the lack of flush for the posted pci
638 - * write is safe - FR
639 +
640 + /* We need for force the visibility of tp->intr_mask
641 + * for other CPUs, as we can loose an MSI interrupt
642 + * and potentially wait for a retransmit timeout if we don't.
643 + * The posted write to IntrMask is safe, as it will
644 + * eventually make it to the chip and we won't loose anything
645 + * until it does.
646 */
647 + tp->intr_mask = 0xffff;
648 smp_wmb();
649 RTL_W16(IntrMask, tp->intr_event);
650 }
651 diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
652 index b68bc39..42963a9 100644
653 --- a/drivers/net/sky2.c
654 +++ b/drivers/net/sky2.c
655 @@ -2393,7 +2393,7 @@ static int sky2_status_intr(struct sky2_hw *hw, int to_do, u16 idx)
656 if (likely(status >> 16 == (status & 0xffff))) {
657 skb = sky2->rx_ring[sky2->rx_next].skb;
658 skb->ip_summed = CHECKSUM_COMPLETE;
659 - skb->csum = status & 0xffff;
660 + skb->csum = le16_to_cpu(status);
661 } else {
662 printk(KERN_NOTICE PFX "%s: hardware receive "
663 "checksum problem (status = %#x)\n",
664 diff --git a/drivers/net/usb/cdc_subset.c b/drivers/net/usb/cdc_subset.c
665 index c66b9c3..ca39ace 100644
666 --- a/drivers/net/usb/cdc_subset.c
667 +++ b/drivers/net/usb/cdc_subset.c
668 @@ -307,9 +307,10 @@ static const struct usb_device_id products [] = {
669 USB_DEVICE (0x1286, 0x8001), // "blob" bootloader
670 .driver_info = (unsigned long) &blob_info,
671 }, {
672 - // Linux Ethernet/RNDIS gadget on pxa210/25x/26x, second config
673 - // e.g. Gumstix, current OpenZaurus, ...
674 - USB_DEVICE_VER (0x0525, 0xa4a2, 0x0203, 0x0203),
675 + // Linux Ethernet/RNDIS gadget, mostly on PXA, second config
676 + // e.g. Gumstix, current OpenZaurus, ... or anything else
677 + // that just enables this gadget option.
678 + USB_DEVICE (0x0525, 0xa4a2),
679 .driver_info = (unsigned long) &linuxdev_info,
680 },
681 #endif
682 diff --git a/drivers/net/usb/pegasus.c b/drivers/net/usb/pegasus.c
683 index 8c19307..a04a8b0 100644
684 --- a/drivers/net/usb/pegasus.c
685 +++ b/drivers/net/usb/pegasus.c
686 @@ -295,7 +295,7 @@ static int update_eth_regs_async(pegasus_t * pegasus)
687
688 pegasus->dr.bRequestType = PEGASUS_REQT_WRITE;
689 pegasus->dr.bRequest = PEGASUS_REQ_SET_REGS;
690 - pegasus->dr.wValue = 0;
691 + pegasus->dr.wValue = cpu_to_le16(0);
692 pegasus->dr.wIndex = cpu_to_le16(EthCtrl0);
693 pegasus->dr.wLength = cpu_to_le16(3);
694 pegasus->ctrl_urb->transfer_buffer_length = 3;
695 @@ -444,11 +444,12 @@ static int write_eprom_word(pegasus_t * pegasus, __u8 index, __u16 data)
696 int i;
697 __u8 tmp, d[4] = { 0x3f, 0, 0, EPROM_WRITE };
698 int ret;
699 + __le16 le_data = cpu_to_le16(data);
700
701 set_registers(pegasus, EpromOffset, 4, d);
702 enable_eprom_write(pegasus);
703 set_register(pegasus, EpromOffset, index);
704 - set_registers(pegasus, EpromData, 2, &data);
705 + set_registers(pegasus, EpromData, 2, &le_data);
706 set_register(pegasus, EpromCtrl, EPROM_WRITE);
707
708 for (i = 0; i < REG_TIMEOUT; i++) {
709 @@ -918,29 +919,32 @@ static struct net_device_stats *pegasus_netdev_stats(struct net_device *dev)
710
711 static inline void disable_net_traffic(pegasus_t * pegasus)
712 {
713 - int tmp = 0;
714 + __le16 tmp = cpu_to_le16(0);
715
716 - set_registers(pegasus, EthCtrl0, 2, &tmp);
717 + set_registers(pegasus, EthCtrl0, sizeof(tmp), &tmp);
718 }
719
720 static inline void get_interrupt_interval(pegasus_t * pegasus)
721 {
722 - __u8 data[2];
723 + u16 data;
724 + u8 interval;
725
726 - read_eprom_word(pegasus, 4, (__u16 *) data);
727 + read_eprom_word(pegasus, 4, &data);
728 + interval = data >> 8;
729 if (pegasus->usb->speed != USB_SPEED_HIGH) {
730 - if (data[1] < 0x80) {
731 + if (interval < 0x80) {
732 if (netif_msg_timer(pegasus))
733 dev_info(&pegasus->intf->dev, "intr interval "
734 "changed from %ums to %ums\n",
735 - data[1], 0x80);
736 - data[1] = 0x80;
737 + interval, 0x80);
738 + interval = 0x80;
739 + data = (data & 0x00FF) | ((u16)interval << 8);
740 #ifdef PEGASUS_WRITE_EEPROM
741 - write_eprom_word(pegasus, 4, *(__u16 *) data);
742 + write_eprom_word(pegasus, 4, data);
743 #endif
744 }
745 }
746 - pegasus->intr_interval = data[1];
747 + pegasus->intr_interval = interval;
748 }
749
750 static void set_carrier(struct net_device *net)
751 @@ -1293,7 +1297,8 @@ static int pegasus_blacklisted(struct usb_device *udev)
752 /* Special quirk to keep the driver from handling the Belkin Bluetooth
753 * dongle which happens to have the same ID.
754 */
755 - if ((udd->idVendor == VENDOR_BELKIN && udd->idProduct == 0x0121) &&
756 + if ((udd->idVendor == cpu_to_le16(VENDOR_BELKIN)) &&
757 + (udd->idProduct == cpu_to_le16(0x0121)) &&
758 (udd->bDeviceClass == USB_CLASS_WIRELESS_CONTROLLER) &&
759 (udd->bDeviceProtocol == 1))
760 return 1;
761 diff --git a/drivers/net/wireless/strip.c b/drivers/net/wireless/strip.c
762 index 417e9e6..1e26ddc 100644
763 --- a/drivers/net/wireless/strip.c
764 +++ b/drivers/net/wireless/strip.c
765 @@ -856,6 +856,7 @@ static int strip_change_mtu(struct net_device *dev, int new_mtu)
766 unsigned char *orbuff = strip_info->rx_buff;
767 unsigned char *osbuff = strip_info->sx_buff;
768 unsigned char *otbuff = strip_info->tx_buff;
769 + unsigned long flags;
770
771 if (new_mtu > MAX_SEND_MTU) {
772 printk(KERN_ERR
773 @@ -864,11 +865,11 @@ static int strip_change_mtu(struct net_device *dev, int new_mtu)
774 return -EINVAL;
775 }
776
777 - spin_lock_bh(&strip_lock);
778 + spin_lock_irqsave(&strip_lock, flags);
779 if (!allocate_buffers(strip_info, new_mtu)) {
780 printk(KERN_ERR "%s: unable to grow strip buffers, MTU change cancelled.\n",
781 strip_info->dev->name);
782 - spin_unlock_bh(&strip_lock);
783 + spin_unlock_irqrestore(&strip_lock, flags);
784 return -ENOMEM;
785 }
786
787 @@ -892,7 +893,7 @@ static int strip_change_mtu(struct net_device *dev, int new_mtu)
788 }
789 }
790 strip_info->tx_head = strip_info->tx_buff;
791 - spin_unlock_bh(&strip_lock);
792 + spin_unlock_irqrestore(&strip_lock, flags);
793
794 printk(KERN_NOTICE "%s: strip MTU changed fom %d to %d.\n",
795 strip_info->dev->name, old_mtu, strip_info->mtu);
796 @@ -981,10 +982,13 @@ static void strip_seq_neighbours(struct seq_file *seq,
797 const MetricomNodeTable * table,
798 const char *title)
799 {
800 - /* We wrap this in a do/while loop, so if the table changes */
801 - /* while we're reading it, we just go around and try again. */
802 + unsigned long flags;
803 struct timeval t;
804
805 + /*
806 + * We wrap this in a do/while loop, so if the table changes
807 + * while we're reading it, we just go around and try again.
808 + */
809 do {
810 int i;
811 t = table->timestamp;
812 @@ -993,9 +997,9 @@ static void strip_seq_neighbours(struct seq_file *seq,
813 for (i = 0; i < table->num_nodes; i++) {
814 MetricomNode node;
815
816 - spin_lock_bh(&strip_lock);
817 + spin_lock_irqsave(&strip_lock, flags);
818 node = table->node[i];
819 - spin_unlock_bh(&strip_lock);
820 + spin_unlock_irqrestore(&strip_lock, flags);
821 seq_printf(seq, " %s\n", node.c);
822 }
823 } while (table->timestamp.tv_sec != t.tv_sec
824 @@ -1535,6 +1539,7 @@ static void strip_send(struct strip *strip_info, struct sk_buff *skb)
825 static int strip_xmit(struct sk_buff *skb, struct net_device *dev)
826 {
827 struct strip *strip_info = netdev_priv(dev);
828 + unsigned long flags;
829
830 if (!netif_running(dev)) {
831 printk(KERN_ERR "%s: xmit call when iface is down\n",
832 @@ -1573,11 +1578,11 @@ static int strip_xmit(struct sk_buff *skb, struct net_device *dev)
833 strip_info->dev->name, sx_pps_count / 8);
834 }
835
836 - spin_lock_bh(&strip_lock);
837 + spin_lock_irqsave(&strip_lock, flags);
838
839 strip_send(strip_info, skb);
840
841 - spin_unlock_bh(&strip_lock);
842 + spin_unlock_irqrestore(&strip_lock, flags);
843
844 if (skb)
845 dev_kfree_skb(skb);
846 @@ -2263,12 +2268,13 @@ static void strip_receive_buf(struct tty_struct *tty, const unsigned char *cp,
847 {
848 struct strip *strip_info = (struct strip *) tty->disc_data;
849 const unsigned char *end = cp + count;
850 + unsigned long flags;
851
852 if (!strip_info || strip_info->magic != STRIP_MAGIC
853 || !netif_running(strip_info->dev))
854 return;
855
856 - spin_lock_bh(&strip_lock);
857 + spin_lock_irqsave(&strip_lock, flags);
858 #if 0
859 {
860 struct timeval tv;
861 @@ -2335,7 +2341,7 @@ static void strip_receive_buf(struct tty_struct *tty, const unsigned char *cp,
862 }
863 cp++;
864 }
865 - spin_unlock_bh(&strip_lock);
866 + spin_unlock_irqrestore(&strip_lock, flags);
867 }
868
869
870 @@ -2525,9 +2531,11 @@ static void strip_dev_setup(struct net_device *dev)
871
872 static void strip_free(struct strip *strip_info)
873 {
874 - spin_lock_bh(&strip_lock);
875 + unsigned long flags;
876 +
877 + spin_lock_irqsave(&strip_lock, flags);
878 list_del_rcu(&strip_info->list);
879 - spin_unlock_bh(&strip_lock);
880 + spin_unlock_irqrestore(&strip_lock, flags);
881
882 strip_info->magic = 0;
883
884 @@ -2541,6 +2549,7 @@ static void strip_free(struct strip *strip_info)
885 static struct strip *strip_alloc(void)
886 {
887 struct list_head *n;
888 + unsigned long flags;
889 struct net_device *dev;
890 struct strip *strip_info;
891
892 @@ -2564,7 +2573,7 @@ static struct strip *strip_alloc(void)
893 strip_info->idle_timer.function = strip_IdleTask;
894
895
896 - spin_lock_bh(&strip_lock);
897 + spin_lock_irqsave(&strip_lock, flags);
898 rescan:
899 /*
900 * Search the list to find where to put our new entry
901 @@ -2583,7 +2592,7 @@ static struct strip *strip_alloc(void)
902 sprintf(dev->name, "st%ld", dev->base_addr);
903
904 list_add_tail_rcu(&strip_info->list, &strip_list);
905 - spin_unlock_bh(&strip_lock);
906 + spin_unlock_irqrestore(&strip_lock, flags);
907
908 return strip_info;
909 }
910 diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c
911 index 98b9df7..c193540 100644
912 --- a/drivers/pnp/pnpacpi/core.c
913 +++ b/drivers/pnp/pnpacpi/core.c
914 @@ -84,7 +84,6 @@ static int pnpacpi_set_resources(struct pnp_dev *dev)
915 acpi_handle handle = dev->data;
916 struct acpi_buffer buffer;
917 int ret;
918 - acpi_status status;
919
920 dev_dbg(&dev->dev, "set resources\n");
921 ret = pnpacpi_build_resource_template(dev, &buffer);
922 @@ -95,21 +94,29 @@ static int pnpacpi_set_resources(struct pnp_dev *dev)
923 kfree(buffer.pointer);
924 return ret;
925 }
926 - status = acpi_set_current_resources(handle, &buffer);
927 - if (ACPI_FAILURE(status))
928 + if (ACPI_FAILURE(acpi_set_current_resources(handle, &buffer)))
929 ret = -EINVAL;
930 + else if (acpi_bus_power_manageable(handle))
931 + ret = acpi_bus_set_power(handle, ACPI_STATE_D0);
932 kfree(buffer.pointer);
933 return ret;
934 }
935
936 static int pnpacpi_disable_resources(struct pnp_dev *dev)
937 {
938 - acpi_status status;
939 + acpi_handle handle = dev->data;
940 + int ret;
941 +
942 + dev_dbg(&dev->dev, "disable resources\n");
943
944 /* acpi_unregister_gsi(pnp_irq(dev, 0)); */
945 - status = acpi_evaluate_object((acpi_handle) dev->data,
946 - "_DIS", NULL, NULL);
947 - return ACPI_FAILURE(status) ? -ENODEV : 0;
948 + ret = 0;
949 + if (acpi_bus_power_manageable(handle))
950 + acpi_bus_set_power(handle, ACPI_STATE_D3);
951 + /* continue even if acpi_bus_set_power() fails */
952 + if (ACPI_FAILURE(acpi_evaluate_object(handle, "_DIS", NULL, NULL)))
953 + ret = -ENODEV;
954 + return ret;
955 }
956
957 #ifdef CONFIG_ACPI_SLEEP
958 diff --git a/drivers/scsi/zalon.c b/drivers/scsi/zalon.c
959 index 3c4a300..b8171de 100644
960 --- a/drivers/scsi/zalon.c
961 +++ b/drivers/scsi/zalon.c
962 @@ -134,7 +134,7 @@ zalon_probe(struct parisc_device *dev)
963
964 host = ncr_attach(&zalon7xx_template, unit, &device);
965 if (!host)
966 - goto fail;
967 + return -ENODEV;
968
969 if (request_irq(dev->irq, ncr53c8xx_intr, IRQF_SHARED, "zalon", host)) {
970 printk(KERN_ERR "%s: irq problem with %d, detaching\n ",
971 diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
972 index 8d2d79e..1ff88af 100644
973 --- a/drivers/usb/core/devio.c
974 +++ b/drivers/usb/core/devio.c
975 @@ -976,7 +976,7 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb,
976 USBDEVFS_URB_ZERO_PACKET |
977 USBDEVFS_URB_NO_INTERRUPT))
978 return -EINVAL;
979 - if (!uurb->buffer)
980 + if (uurb->buffer_length > 0 && !uurb->buffer)
981 return -EINVAL;
982 if (uurb->signr != 0 && (uurb->signr < SIGRTMIN ||
983 uurb->signr > SIGRTMAX))
984 @@ -1035,11 +1035,6 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb,
985 is_in = 0;
986 uurb->endpoint &= ~USB_DIR_IN;
987 }
988 - if (!access_ok(is_in ? VERIFY_WRITE : VERIFY_READ,
989 - uurb->buffer, uurb->buffer_length)) {
990 - kfree(dr);
991 - return -EFAULT;
992 - }
993 snoop(&ps->dev->dev, "control urb: bRequest=%02x "
994 "bRrequestType=%02x wValue=%04x "
995 "wIndex=%04x wLength=%04x\n",
996 @@ -1059,9 +1054,6 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb,
997 uurb->number_of_packets = 0;
998 if (uurb->buffer_length > MAX_USBFS_BUFFER_SIZE)
999 return -EINVAL;
1000 - if (!access_ok(is_in ? VERIFY_WRITE : VERIFY_READ,
1001 - uurb->buffer, uurb->buffer_length))
1002 - return -EFAULT;
1003 snoop(&ps->dev->dev, "bulk urb\n");
1004 break;
1005
1006 @@ -1103,28 +1095,35 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb,
1007 return -EINVAL;
1008 if (uurb->buffer_length > MAX_USBFS_BUFFER_SIZE)
1009 return -EINVAL;
1010 - if (!access_ok(is_in ? VERIFY_WRITE : VERIFY_READ,
1011 - uurb->buffer, uurb->buffer_length))
1012 - return -EFAULT;
1013 snoop(&ps->dev->dev, "interrupt urb\n");
1014 break;
1015
1016 default:
1017 return -EINVAL;
1018 }
1019 - as = alloc_async(uurb->number_of_packets);
1020 - if (!as) {
1021 + if (uurb->buffer_length > 0 &&
1022 + !access_ok(is_in ? VERIFY_WRITE : VERIFY_READ,
1023 + uurb->buffer, uurb->buffer_length)) {
1024 kfree(isopkt);
1025 kfree(dr);
1026 - return -ENOMEM;
1027 + return -EFAULT;
1028 }
1029 - as->urb->transfer_buffer = kmalloc(uurb->buffer_length, GFP_KERNEL);
1030 - if (!as->urb->transfer_buffer) {
1031 + as = alloc_async(uurb->number_of_packets);
1032 + if (!as) {
1033 kfree(isopkt);
1034 kfree(dr);
1035 - free_async(as);
1036 return -ENOMEM;
1037 }
1038 + if (uurb->buffer_length > 0) {
1039 + as->urb->transfer_buffer = kmalloc(uurb->buffer_length,
1040 + GFP_KERNEL);
1041 + if (!as->urb->transfer_buffer) {
1042 + kfree(isopkt);
1043 + kfree(dr);
1044 + free_async(as);
1045 + return -ENOMEM;
1046 + }
1047 + }
1048 as->urb->dev = ps->dev;
1049 as->urb->pipe = (uurb->type << 30) |
1050 __create_pipe(ps->dev, uurb->endpoint & 0xf) |
1051 @@ -1166,7 +1165,7 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb,
1052 kfree(isopkt);
1053 as->ps = ps;
1054 as->userurb = arg;
1055 - if (uurb->endpoint & USB_DIR_IN)
1056 + if (is_in && uurb->buffer_length > 0)
1057 as->userbuffer = uurb->buffer;
1058 else
1059 as->userbuffer = NULL;
1060 @@ -1176,9 +1175,9 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb,
1061 as->uid = current->uid;
1062 as->euid = current->euid;
1063 security_task_getsecid(current, &as->secid);
1064 - if (!is_in) {
1065 + if (!is_in && uurb->buffer_length > 0) {
1066 if (copy_from_user(as->urb->transfer_buffer, uurb->buffer,
1067 - as->urb->transfer_buffer_length)) {
1068 + uurb->buffer_length)) {
1069 free_async(as);
1070 return -EFAULT;
1071 }
1072 @@ -1228,22 +1227,22 @@ static int processcompl(struct async *as, void __user * __user *arg)
1073 if (as->userbuffer)
1074 if (copy_to_user(as->userbuffer, urb->transfer_buffer,
1075 urb->transfer_buffer_length))
1076 - return -EFAULT;
1077 + goto err_out;
1078 if (put_user(as->status, &userurb->status))
1079 - return -EFAULT;
1080 + goto err_out;
1081 if (put_user(urb->actual_length, &userurb->actual_length))
1082 - return -EFAULT;
1083 + goto err_out;
1084 if (put_user(urb->error_count, &userurb->error_count))
1085 - return -EFAULT;
1086 + goto err_out;
1087
1088 if (usb_endpoint_xfer_isoc(&urb->ep->desc)) {
1089 for (i = 0; i < urb->number_of_packets; i++) {
1090 if (put_user(urb->iso_frame_desc[i].actual_length,
1091 &userurb->iso_frame_desc[i].actual_length))
1092 - return -EFAULT;
1093 + goto err_out;
1094 if (put_user(urb->iso_frame_desc[i].status,
1095 &userurb->iso_frame_desc[i].status))
1096 - return -EFAULT;
1097 + goto err_out;
1098 }
1099 }
1100
1101 @@ -1252,6 +1251,10 @@ static int processcompl(struct async *as, void __user * __user *arg)
1102 if (put_user(addr, (void __user * __user *)arg))
1103 return -EFAULT;
1104 return 0;
1105 +
1106 +err_out:
1107 + free_async(as);
1108 + return -EFAULT;
1109 }
1110
1111 static struct async *reap_as(struct dev_state *ps)
1112 diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
1113 index bcac2e6..c5d6765 100644
1114 --- a/drivers/usb/gadget/ether.c
1115 +++ b/drivers/usb/gadget/ether.c
1116 @@ -273,15 +273,16 @@ static int __init eth_bind(struct usb_composite_dev *cdev)
1117 /* CDC Subset */
1118 eth_config_driver.label = "CDC Subset/SAFE";
1119
1120 - device_desc.idVendor = cpu_to_le16(SIMPLE_VENDOR_NUM),
1121 - device_desc.idProduct = cpu_to_le16(SIMPLE_PRODUCT_NUM),
1122 - device_desc.bDeviceClass = USB_CLASS_VENDOR_SPEC;
1123 + device_desc.idVendor = cpu_to_le16(SIMPLE_VENDOR_NUM);
1124 + device_desc.idProduct = cpu_to_le16(SIMPLE_PRODUCT_NUM);
1125 + if (!has_rndis())
1126 + device_desc.bDeviceClass = USB_CLASS_VENDOR_SPEC;
1127 }
1128
1129 if (has_rndis()) {
1130 /* RNDIS plus ECM-or-Subset */
1131 - device_desc.idVendor = cpu_to_le16(RNDIS_VENDOR_NUM),
1132 - device_desc.idProduct = cpu_to_le16(RNDIS_PRODUCT_NUM),
1133 + device_desc.idVendor = cpu_to_le16(RNDIS_VENDOR_NUM);
1134 + device_desc.idProduct = cpu_to_le16(RNDIS_PRODUCT_NUM);
1135 device_desc.bNumConfigurations = 2;
1136 }
1137
1138 diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c
1139 index 1d0b49e..18e8741 100644
1140 --- a/drivers/usb/host/ehci-sched.c
1141 +++ b/drivers/usb/host/ehci-sched.c
1142 @@ -1617,11 +1617,14 @@ itd_complete (
1143 desc->status = -EPROTO;
1144
1145 /* HC need not update length with this error */
1146 - if (!(t & EHCI_ISOC_BABBLE))
1147 - desc->actual_length = EHCI_ITD_LENGTH (t);
1148 + if (!(t & EHCI_ISOC_BABBLE)) {
1149 + desc->actual_length = EHCI_ITD_LENGTH(t);
1150 + urb->actual_length += desc->actual_length;
1151 + }
1152 } else if (likely ((t & EHCI_ISOC_ACTIVE) == 0)) {
1153 desc->status = 0;
1154 - desc->actual_length = EHCI_ITD_LENGTH (t);
1155 + desc->actual_length = EHCI_ITD_LENGTH(t);
1156 + urb->actual_length += desc->actual_length;
1157 } else {
1158 /* URB was too late */
1159 desc->status = -EXDEV;
1160 @@ -2012,7 +2015,8 @@ sitd_complete (
1161 desc->status = -EPROTO;
1162 } else {
1163 desc->status = 0;
1164 - desc->actual_length = desc->length - SITD_LENGTH (t);
1165 + desc->actual_length = desc->length - SITD_LENGTH(t);
1166 + urb->actual_length += desc->actual_length;
1167 }
1168 stream->depth -= stream->interval << 3;
1169
1170 diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c
1171 index d8c41ae..bc5e905 100644
1172 --- a/drivers/usb/serial/ti_usb_3410_5052.c
1173 +++ b/drivers/usb/serial/ti_usb_3410_5052.c
1174 @@ -240,7 +240,6 @@ static struct usb_device_id ti_id_table_5052[5+TI_EXTRA_VID_PID_COUNT+1] = {
1175 { USB_DEVICE(TI_VENDOR_ID, TI_5152_BOOT_PRODUCT_ID) },
1176 { USB_DEVICE(TI_VENDOR_ID, TI_5052_EEPROM_PRODUCT_ID) },
1177 { USB_DEVICE(TI_VENDOR_ID, TI_5052_FIRMWARE_PRODUCT_ID) },
1178 - { USB_DEVICE(IBM_VENDOR_ID, IBM_4543_PRODUCT_ID) },
1179 };
1180
1181 static struct usb_device_id ti_id_table_combined[14+2*TI_EXTRA_VID_PID_COUNT+1] = {
1182 @@ -1703,7 +1702,7 @@ static int ti_do_download(struct usb_device *dev, int pipe,
1183 u8 cs = 0;
1184 int done;
1185 struct ti_firmware_header *header;
1186 - int status;
1187 + int status = 0;
1188 int len;
1189
1190 for (pos = sizeof(struct ti_firmware_header); pos < size; pos++)
1191 diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
1192 index e57df48..a6f8b8f 100644
1193 --- a/fs/binfmt_elf.c
1194 +++ b/fs/binfmt_elf.c
1195 @@ -1517,11 +1517,11 @@ static int fill_note_info(struct elfhdr *elf, int phdrs,
1196 info->thread = NULL;
1197
1198 psinfo = kmalloc(sizeof(*psinfo), GFP_KERNEL);
1199 - fill_note(&info->psinfo, "CORE", NT_PRPSINFO, sizeof(*psinfo), psinfo);
1200 -
1201 if (psinfo == NULL)
1202 return 0;
1203
1204 + fill_note(&info->psinfo, "CORE", NT_PRPSINFO, sizeof(*psinfo), psinfo);
1205 +
1206 /*
1207 * Figure out how many notes we're going to need for each thread.
1208 */
1209 diff --git a/fs/ecryptfs/keystore.c b/fs/ecryptfs/keystore.c
1210 index 59b9833..247c0d4 100644
1211 --- a/fs/ecryptfs/keystore.c
1212 +++ b/fs/ecryptfs/keystore.c
1213 @@ -730,6 +730,13 @@ parse_tag_3_packet(struct ecryptfs_crypt_stat *crypt_stat,
1214 }
1215 (*new_auth_tok)->session_key.encrypted_key_size =
1216 (body_size - (ECRYPTFS_SALT_SIZE + 5));
1217 + if ((*new_auth_tok)->session_key.encrypted_key_size
1218 + > ECRYPTFS_MAX_ENCRYPTED_KEY_BYTES) {
1219 + printk(KERN_WARNING "Tag 3 packet contains key larger "
1220 + "than ECRYPTFS_MAX_ENCRYPTED_KEY_BYTES\n");
1221 + rc = -EINVAL;
1222 + goto out_free;
1223 + }
1224 if (unlikely(data[(*packet_size)++] != 0x04)) {
1225 printk(KERN_WARNING "Unknown version number [%d]\n",
1226 data[(*packet_size) - 1]);
1227 @@ -876,6 +883,12 @@ parse_tag_11_packet(unsigned char *data, unsigned char *contents,
1228 rc = -EINVAL;
1229 goto out;
1230 }
1231 + if (unlikely((*tag_11_contents_size) > max_contents_bytes)) {
1232 + printk(KERN_ERR "Literal data section in tag 11 packet exceeds "
1233 + "expected size\n");
1234 + rc = -EINVAL;
1235 + goto out;
1236 + }
1237 if (data[(*packet_size)++] != 0x62) {
1238 printk(KERN_WARNING "Unrecognizable packet\n");
1239 rc = -EINVAL;
1240 diff --git a/include/net/x25.h b/include/net/x25.h
1241 index fc3f03d..2cda040 100644
1242 --- a/include/net/x25.h
1243 +++ b/include/net/x25.h
1244 @@ -187,7 +187,7 @@ extern int x25_addr_ntoa(unsigned char *, struct x25_address *,
1245 extern int x25_addr_aton(unsigned char *, struct x25_address *,
1246 struct x25_address *);
1247 extern struct sock *x25_find_socket(unsigned int, struct x25_neigh *);
1248 -extern void x25_destroy_socket(struct sock *);
1249 +extern void x25_destroy_socket_from_timer(struct sock *);
1250 extern int x25_rx_call_request(struct sk_buff *, struct x25_neigh *, unsigned int);
1251 extern void x25_kill_by_neigh(struct x25_neigh *);
1252
1253 diff --git a/mm/filemap.c b/mm/filemap.c
1254 index 8a477d3..bff0b00 100644
1255 --- a/mm/filemap.c
1256 +++ b/mm/filemap.c
1257 @@ -2441,6 +2441,7 @@ again:
1258 pagefault_enable();
1259 flush_dcache_page(page);
1260
1261 + mark_page_accessed(page);
1262 status = a_ops->write_end(file, mapping, pos, bytes, copied,
1263 page, fsdata);
1264 if (unlikely(status < 0))
1265 diff --git a/mm/slab.c b/mm/slab.c
1266 index e76eee4..600e864 100644
1267 --- a/mm/slab.c
1268 +++ b/mm/slab.c
1269 @@ -2580,7 +2580,7 @@ void kmem_cache_destroy(struct kmem_cache *cachep)
1270 }
1271
1272 if (unlikely(cachep->flags & SLAB_DESTROY_BY_RCU))
1273 - synchronize_rcu();
1274 + rcu_barrier();
1275
1276 __kmem_cache_destroy(cachep);
1277 mutex_unlock(&cache_chain_mutex);
1278 diff --git a/mm/slob.c b/mm/slob.c
1279 index cb675d1..ed04252 100644
1280 --- a/mm/slob.c
1281 +++ b/mm/slob.c
1282 @@ -561,6 +561,8 @@ EXPORT_SYMBOL(kmem_cache_create);
1283
1284 void kmem_cache_destroy(struct kmem_cache *c)
1285 {
1286 + if (c->flags & SLAB_DESTROY_BY_RCU)
1287 + rcu_barrier();
1288 slob_free(c, sizeof(struct kmem_cache));
1289 }
1290 EXPORT_SYMBOL(kmem_cache_destroy);
1291 diff --git a/mm/slub.c b/mm/slub.c
1292 index 0c83e6a..f0175b4 100644
1293 --- a/mm/slub.c
1294 +++ b/mm/slub.c
1295 @@ -2447,6 +2447,8 @@ static inline int kmem_cache_close(struct kmem_cache *s)
1296 */
1297 void kmem_cache_destroy(struct kmem_cache *s)
1298 {
1299 + if (s->flags & SLAB_DESTROY_BY_RCU)
1300 + rcu_barrier();
1301 down_write(&slub_lock);
1302 s->refcount--;
1303 if (!s->refcount) {
1304 diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
1305 index 76739e9..66cfe88 100644
1306 --- a/net/sunrpc/clnt.c
1307 +++ b/net/sunrpc/clnt.c
1308 @@ -1089,14 +1089,24 @@ static void
1309 call_transmit_status(struct rpc_task *task)
1310 {
1311 task->tk_action = call_status;
1312 - /*
1313 - * Special case: if we've been waiting on the socket's write_space()
1314 - * callback, then don't call xprt_end_transmit().
1315 - */
1316 - if (task->tk_status == -EAGAIN)
1317 - return;
1318 - xprt_end_transmit(task);
1319 - rpc_task_force_reencode(task);
1320 + switch (task->tk_status) {
1321 + case -EAGAIN:
1322 + break;
1323 + default:
1324 + xprt_end_transmit(task);
1325 + /*
1326 + * Special cases: if we've been waiting on the
1327 + * socket's write_space() callback, or if the
1328 + * socket just returned a connection error,
1329 + * then hold onto the transport lock.
1330 + */
1331 + case -ECONNREFUSED:
1332 + case -ENOTCONN:
1333 + case -EHOSTDOWN:
1334 + case -EHOSTUNREACH:
1335 + case -ENETUNREACH:
1336 + rpc_task_force_reencode(task);
1337 + }
1338 }
1339
1340 /*
1341 diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
1342 index 4486c59..8f9295d 100644
1343 --- a/net/sunrpc/xprtsock.c
1344 +++ b/net/sunrpc/xprtsock.c
1345 @@ -1150,7 +1150,6 @@ static void xs_tcp_state_change(struct sock *sk)
1346 break;
1347 case TCP_CLOSE_WAIT:
1348 /* The server initiated a shutdown of the socket */
1349 - set_bit(XPRT_CLOSING, &xprt->state);
1350 xprt_force_disconnect(xprt);
1351 case TCP_SYN_SENT:
1352 xprt->connect_cookie++;
1353 @@ -1163,6 +1162,7 @@ static void xs_tcp_state_change(struct sock *sk)
1354 xprt->reestablish_timeout = XS_TCP_INIT_REEST_TO;
1355 break;
1356 case TCP_LAST_ACK:
1357 + set_bit(XPRT_CLOSING, &xprt->state);
1358 smp_mb__before_clear_bit();
1359 clear_bit(XPRT_CONNECTED, &xprt->state);
1360 smp_mb__after_clear_bit();
1361 @@ -1560,10 +1560,9 @@ out:
1362 * We need to preserve the port number so the reply cache on the server can
1363 * find our cached RPC replies when we get around to reconnecting.
1364 */
1365 -static void xs_tcp_reuse_connection(struct rpc_xprt *xprt)
1366 +static void xs_abort_connection(struct rpc_xprt *xprt, struct sock_xprt *transport)
1367 {
1368 int result;
1369 - struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt);
1370 struct sockaddr any;
1371
1372 dprintk("RPC: disconnecting xprt %p to reuse port\n", xprt);
1373 @@ -1580,6 +1579,17 @@ static void xs_tcp_reuse_connection(struct rpc_xprt *xprt)
1374 result);
1375 }
1376
1377 +static void xs_tcp_reuse_connection(struct rpc_xprt *xprt, struct sock_xprt *transport)
1378 +{
1379 + unsigned int state = transport->inet->sk_state;
1380 +
1381 + if (state == TCP_CLOSE && transport->sock->state == SS_UNCONNECTED)
1382 + return;
1383 + if ((1 << state) & (TCPF_ESTABLISHED|TCPF_SYN_SENT))
1384 + return;
1385 + xs_abort_connection(xprt, transport);
1386 +}
1387 +
1388 static int xs_tcp_finish_connecting(struct rpc_xprt *xprt, struct socket *sock)
1389 {
1390 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt);
1391 @@ -1650,7 +1660,7 @@ static void xs_tcp_connect_worker4(struct work_struct *work)
1392 }
1393 } else
1394 /* "close" the socket, preserving the local port */
1395 - xs_tcp_reuse_connection(xprt);
1396 + xs_tcp_reuse_connection(xprt, transport);
1397
1398 dprintk("RPC: worker connecting xprt %p to address: %s\n",
1399 xprt, xprt->address_strings[RPC_DISPLAY_ALL]);
1400 @@ -1710,7 +1720,7 @@ static void xs_tcp_connect_worker6(struct work_struct *work)
1401 }
1402 } else
1403 /* "close" the socket, preserving the local port */
1404 - xs_tcp_reuse_connection(xprt);
1405 + xs_tcp_reuse_connection(xprt, transport);
1406
1407 dprintk("RPC: worker connecting xprt %p to address: %s\n",
1408 xprt, xprt->address_strings[RPC_DISPLAY_ALL]);
1409 @@ -1780,9 +1790,6 @@ static void xs_tcp_connect(struct rpc_task *task)
1410 {
1411 struct rpc_xprt *xprt = task->tk_xprt;
1412
1413 - /* Initiate graceful shutdown of the socket if not already done */
1414 - if (test_bit(XPRT_CONNECTED, &xprt->state))
1415 - xs_tcp_shutdown(xprt);
1416 /* Exit if we need to wait for socket shutdown to complete */
1417 if (test_bit(XPRT_CLOSING, &xprt->state))
1418 return;
1419 diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c
1420 index 88d80f5..220a5e3 100644
1421 --- a/net/x25/af_x25.c
1422 +++ b/net/x25/af_x25.c
1423 @@ -332,14 +332,14 @@ static unsigned int x25_new_lci(struct x25_neigh *nb)
1424 /*
1425 * Deferred destroy.
1426 */
1427 -void x25_destroy_socket(struct sock *);
1428 +static void __x25_destroy_socket(struct sock *);
1429
1430 /*
1431 * handler for deferred kills.
1432 */
1433 static void x25_destroy_timer(unsigned long data)
1434 {
1435 - x25_destroy_socket((struct sock *)data);
1436 + x25_destroy_socket_from_timer((struct sock *)data);
1437 }
1438
1439 /*
1440 @@ -349,12 +349,10 @@ static void x25_destroy_timer(unsigned long data)
1441 * will touch it and we are (fairly 8-) ) safe.
1442 * Not static as it's used by the timer
1443 */
1444 -void x25_destroy_socket(struct sock *sk)
1445 +static void __x25_destroy_socket(struct sock *sk)
1446 {
1447 struct sk_buff *skb;
1448
1449 - sock_hold(sk);
1450 - lock_sock(sk);
1451 x25_stop_heartbeat(sk);
1452 x25_stop_timer(sk);
1453
1454 @@ -385,7 +383,22 @@ void x25_destroy_socket(struct sock *sk)
1455 /* drop last reference so sock_put will free */
1456 __sock_put(sk);
1457 }
1458 +}
1459
1460 +void x25_destroy_socket_from_timer(struct sock *sk)
1461 +{
1462 + sock_hold(sk);
1463 + bh_lock_sock(sk);
1464 + __x25_destroy_socket(sk);
1465 + bh_unlock_sock(sk);
1466 + sock_put(sk);
1467 +}
1468 +
1469 +static void x25_destroy_socket(struct sock *sk)
1470 +{
1471 + sock_hold(sk);
1472 + lock_sock(sk);
1473 + __x25_destroy_socket(sk);
1474 release_sock(sk);
1475 sock_put(sk);
1476 }
1477 diff --git a/net/x25/x25_timer.c b/net/x25/x25_timer.c
1478 index d3e3e54..5c5db1a 100644
1479 --- a/net/x25/x25_timer.c
1480 +++ b/net/x25/x25_timer.c
1481 @@ -113,7 +113,7 @@ static void x25_heartbeat_expiry(unsigned long param)
1482 (sk->sk_state == TCP_LISTEN &&
1483 sock_flag(sk, SOCK_DEAD))) {
1484 bh_unlock_sock(sk);
1485 - x25_destroy_socket(sk);
1486 + x25_destroy_socket_from_timer(sk);
1487 return;
1488 }
1489 break;
1490 diff --git a/net/xfrm/xfrm_algo.c b/net/xfrm/xfrm_algo.c
1491 index 96036cf..79d78f4 100644
1492 --- a/net/xfrm/xfrm_algo.c
1493 +++ b/net/xfrm/xfrm_algo.c
1494 @@ -292,8 +292,8 @@ static struct xfrm_algo_desc ealg_list[] = {
1495 }
1496 },
1497 {
1498 - .name = "cbc(cast128)",
1499 - .compat = "cast128",
1500 + .name = "cbc(cast5)",
1501 + .compat = "cast5",
1502
1503 .uinfo = {
1504 .encr = {
1505 diff --git a/sound/pci/ca0106/ca0106_main.c b/sound/pci/ca0106/ca0106_main.c
1506 index 6abe8a3..2b8b1ed 100644
1507 --- a/sound/pci/ca0106/ca0106_main.c
1508 +++ b/sound/pci/ca0106/ca0106_main.c
1509 @@ -311,9 +311,9 @@ static struct snd_pcm_hardware snd_ca0106_capture_hw = {
1510 .rate_max = 192000,
1511 .channels_min = 2,
1512 .channels_max = 2,
1513 - .buffer_bytes_max = ((65536 - 64) * 8),
1514 + .buffer_bytes_max = 65536 - 128,
1515 .period_bytes_min = 64,
1516 - .period_bytes_max = (65536 - 64),
1517 + .period_bytes_max = 32768 - 64,
1518 .periods_min = 2,
1519 .periods_max = 2,
1520 .fifo_size = 0,
1521 diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
1522 index 3b5c6c2..07f8dcc 100644
1523 --- a/sound/pci/hda/patch_realtek.c
1524 +++ b/sound/pci/hda/patch_realtek.c
1525 @@ -9214,6 +9214,18 @@ static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
1526 alc262_lenovo_3000_automute(codec, 1);
1527 }
1528
1529 +static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
1530 + int dir, int idx, long *valp)
1531 +{
1532 + int i, change = 0;
1533 +
1534 + for (i = 0; i < 2; i++, valp++)
1535 + change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
1536 + HDA_AMP_MUTE,
1537 + *valp ? 0 : HDA_AMP_MUTE);
1538 + return change;
1539 +}
1540 +
1541 /* bind hp and internal speaker mute (with plug check) */
1542 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
1543 struct snd_ctl_elem_value *ucontrol)
1544 @@ -9222,13 +9234,8 @@ static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
1545 long *valp = ucontrol->value.integer.value;
1546 int change;
1547
1548 - change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
1549 - HDA_AMP_MUTE,
1550 - valp ? 0 : HDA_AMP_MUTE);
1551 - change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
1552 - HDA_AMP_MUTE,
1553 - valp ? 0 : HDA_AMP_MUTE);
1554 -
1555 + change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
1556 + change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
1557 if (change)
1558 alc262_fujitsu_automute(codec, 0);
1559 return change;
1560 @@ -9265,10 +9272,7 @@ static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
1561 long *valp = ucontrol->value.integer.value;
1562 int change;
1563
1564 - change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
1565 - HDA_AMP_MUTE,
1566 - valp ? 0 : HDA_AMP_MUTE);
1567 -
1568 + change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
1569 if (change)
1570 alc262_lenovo_3000_automute(codec, 0);
1571 return change;
1572 @@ -10280,12 +10284,7 @@ static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
1573 long *valp = ucontrol->value.integer.value;
1574 int change;
1575
1576 - change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
1577 - HDA_AMP_MUTE,
1578 - valp[0] ? 0 : HDA_AMP_MUTE);
1579 - change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
1580 - HDA_AMP_MUTE,
1581 - valp[1] ? 0 : HDA_AMP_MUTE);
1582 + change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
1583 if (change)
1584 alc268_acer_automute(codec, 0);
1585 return change;
1586 diff --git a/sound/pci/oxygen/virtuoso.c b/sound/pci/oxygen/virtuoso.c
1587 index 01d7b75..d1773f6 100644
1588 --- a/sound/pci/oxygen/virtuoso.c
1589 +++ b/sound/pci/oxygen/virtuoso.c
1590 @@ -376,6 +376,8 @@ static void xonar_d2_resume(struct oxygen *chip)
1591
1592 static void xonar_d1_resume(struct oxygen *chip)
1593 {
1594 + oxygen_set_bits8(chip, OXYGEN_FUNCTION, OXYGEN_FUNCTION_RESET_CODEC);
1595 + msleep(1);
1596 cs43xx_init(chip);
1597 xonar_enable_output(chip);
1598 }
1599 diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c
1600 index c10e476..915a131 100644
1601 --- a/sound/usb/usbaudio.c
1602 +++ b/sound/usb/usbaudio.c
1603 @@ -2674,7 +2674,7 @@ static int parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no)
1604 struct usb_interface_descriptor *altsd;
1605 int i, altno, err, stream;
1606 int format;
1607 - struct audioformat *fp;
1608 + struct audioformat *fp = NULL;
1609 unsigned char *fmt, *csep;
1610 int num;
1611
1612 @@ -2747,6 +2747,18 @@ static int parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no)
1613 continue;
1614 }
1615
1616 + /*
1617 + * Blue Microphones workaround: The last altsetting is identical
1618 + * with the previous one, except for a larger packet size, but
1619 + * is actually a mislabeled two-channel setting; ignore it.
1620 + */
1621 + if (fmt[4] == 1 && fmt[5] == 2 && altno == 2 && num == 3 &&
1622 + fp && fp->altsetting == 1 && fp->channels == 1 &&
1623 + fp->format == SNDRV_PCM_FORMAT_S16_LE &&
1624 + le16_to_cpu(get_endpoint(alts, 0)->wMaxPacketSize) ==
1625 + fp->maxpacksize * 2)
1626 + continue;
1627 +
1628 csep = snd_usb_find_desc(alts->endpoint[0].extra, alts->endpoint[0].extralen, NULL, USB_DT_CS_ENDPOINT);
1629 /* Creamware Noah has this descriptor after the 2nd endpoint */
1630 if (!csep && altsd->bNumEndpoints >= 2)