Magellan Linux

Contents of /trunk/kernel26-magellan/patches-2.6.31-r4/0106-2.6.31.7-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 968 - (show annotations) (download)
Fri Jan 1 14:52:51 2010 UTC (14 years, 3 months ago) by niro
File size: 133338 byte(s)
-2.6.31-magellan-r4:
-updated to linux-2.6.31.9

1 diff --git a/Documentation/video4linux/gspca.txt b/Documentation/video4linux/gspca.txt
2 index 573f95b..d0a9ee3 100644
3 --- a/Documentation/video4linux/gspca.txt
4 +++ b/Documentation/video4linux/gspca.txt
5 @@ -284,6 +284,7 @@ sonixj 0c45:613a Microdia Sonix PC Camera
6 sonixj 0c45:613b Surfer SN-206
7 sonixj 0c45:613c Sonix Pccam168
8 sonixj 0c45:6143 Sonix Pccam168
9 +sonixj 0c45:6148 Digitus DA-70811/ZSMC USB PC Camera ZS211/Microdia
10 sn9c20x 0c45:6240 PC Camera (SN9C201 + MT9M001)
11 sn9c20x 0c45:6242 PC Camera (SN9C201 + MT9M111)
12 sn9c20x 0c45:6248 PC Camera (SN9C201 + OV9655)
13 diff --git a/arch/arm/include/asm/kmap_types.h b/arch/arm/include/asm/kmap_types.h
14 index d16ec97..c019949 100644
15 --- a/arch/arm/include/asm/kmap_types.h
16 +++ b/arch/arm/include/asm/kmap_types.h
17 @@ -22,4 +22,10 @@ enum km_type {
18 KM_TYPE_NR
19 };
20
21 +#ifdef CONFIG_DEBUG_HIGHMEM
22 +#define KM_NMI (-1)
23 +#define KM_NMI_PTE (-1)
24 +#define KM_IRQ_PTE (-1)
25 +#endif
26 +
27 #endif
28 diff --git a/arch/powerpc/include/asm/kmap_types.h b/arch/powerpc/include/asm/kmap_types.h
29 index b6bac6f..9163695 100644
30 --- a/arch/powerpc/include/asm/kmap_types.h
31 +++ b/arch/powerpc/include/asm/kmap_types.h
32 @@ -29,5 +29,16 @@ enum km_type {
33 KM_TYPE_NR
34 };
35
36 +/*
37 + * This is a temporary build fix that (so they say on lkml....) should no longer
38 + * be required after 2.6.33, because of changes planned to the kmap code.
39 + * Let's try to remove this cruft then.
40 + */
41 +#ifdef CONFIG_DEBUG_HIGHMEM
42 +#define KM_NMI (-1)
43 +#define KM_NMI_PTE (-1)
44 +#define KM_IRQ_PTE (-1)
45 +#endif
46 +
47 #endif /* __KERNEL__ */
48 #endif /* _ASM_POWERPC_KMAP_TYPES_H */
49 diff --git a/arch/sparc/kernel/prom_common.c b/arch/sparc/kernel/prom_common.c
50 index 0fb5789..7b4adbc 100644
51 --- a/arch/sparc/kernel/prom_common.c
52 +++ b/arch/sparc/kernel/prom_common.c
53 @@ -76,6 +76,7 @@ int of_set_property(struct device_node *dp, const char *name, void *val, int len
54
55 err = -ENODEV;
56
57 + mutex_lock(&of_set_property_mutex);
58 write_lock(&devtree_lock);
59 prevp = &dp->properties;
60 while (*prevp) {
61 @@ -85,9 +86,7 @@ int of_set_property(struct device_node *dp, const char *name, void *val, int len
62 void *old_val = prop->value;
63 int ret;
64
65 - mutex_lock(&of_set_property_mutex);
66 ret = prom_setprop(dp->node, name, val, len);
67 - mutex_unlock(&of_set_property_mutex);
68
69 err = -EINVAL;
70 if (ret >= 0) {
71 @@ -106,6 +105,7 @@ int of_set_property(struct device_node *dp, const char *name, void *val, int len
72 prevp = &(*prevp)->next;
73 }
74 write_unlock(&devtree_lock);
75 + mutex_unlock(&of_set_property_mutex);
76
77 /* XXX Upate procfs if necessary... */
78
79 diff --git a/arch/sparc/kernel/visemul.c b/arch/sparc/kernel/visemul.c
80 index b956fd7..d231cbd 100644
81 --- a/arch/sparc/kernel/visemul.c
82 +++ b/arch/sparc/kernel/visemul.c
83 @@ -617,7 +617,7 @@ static void pmul(struct pt_regs *regs, unsigned int insn, unsigned int opf)
84 rs2 = fps_regval(f, RS2(insn));
85
86 rd_val = 0;
87 - src2 = (rs2 >> (opf == FMUL8x16AU_OPF) ? 16 : 0);
88 + src2 = rs2 >> (opf == FMUL8x16AU_OPF ? 16 : 0);
89 for (byte = 0; byte < 4; byte++) {
90 u16 src1 = (rs1 >> (byte * 8)) & 0x00ff;
91 u32 prod = src1 * src2;
92 diff --git a/arch/x86/kernel/acpi/processor.c b/arch/x86/kernel/acpi/processor.c
93 index d296f4a..d85d1b2 100644
94 --- a/arch/x86/kernel/acpi/processor.c
95 +++ b/arch/x86/kernel/acpi/processor.c
96 @@ -79,7 +79,8 @@ void arch_acpi_processor_init_pdc(struct acpi_processor *pr)
97 struct cpuinfo_x86 *c = &cpu_data(pr->id);
98
99 pr->pdc = NULL;
100 - if (c->x86_vendor == X86_VENDOR_INTEL)
101 + if (c->x86_vendor == X86_VENDOR_INTEL ||
102 + c->x86_vendor == X86_VENDOR_CENTAUR)
103 init_intel_pdc(pr, c);
104
105 return;
106 diff --git a/arch/x86/kernel/cpu/cpufreq/speedstep-ich.c b/arch/x86/kernel/cpu/cpufreq/speedstep-ich.c
107 index 6911e91..3ae5a7a 100644
108 --- a/arch/x86/kernel/cpu/cpufreq/speedstep-ich.c
109 +++ b/arch/x86/kernel/cpu/cpufreq/speedstep-ich.c
110 @@ -232,28 +232,23 @@ static unsigned int speedstep_detect_chipset(void)
111 return 0;
112 }
113
114 -struct get_freq_data {
115 - unsigned int speed;
116 - unsigned int processor;
117 -};
118 -
119 -static void get_freq_data(void *_data)
120 +static void get_freq_data(void *_speed)
121 {
122 - struct get_freq_data *data = _data;
123 + unsigned int *speed = _speed;
124
125 - data->speed = speedstep_get_frequency(data->processor);
126 + *speed = speedstep_get_frequency(speedstep_processor);
127 }
128
129 static unsigned int speedstep_get(unsigned int cpu)
130 {
131 - struct get_freq_data data = { .processor = cpu };
132 + unsigned int speed;
133
134 /* You're supposed to ensure CPU is online. */
135 - if (smp_call_function_single(cpu, get_freq_data, &data, 1) != 0)
136 + if (smp_call_function_single(cpu, get_freq_data, &speed, 1) != 0)
137 BUG();
138
139 - dprintk("detected %u kHz as current frequency\n", data.speed);
140 - return data.speed;
141 + dprintk("detected %u kHz as current frequency\n", speed);
142 + return speed;
143 }
144
145 /**
146 diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c
147 index 6a45365..62711dd 100644
148 --- a/drivers/char/agp/intel-agp.c
149 +++ b/drivers/char/agp/intel-agp.c
150 @@ -52,6 +52,7 @@
151 #define PCI_DEVICE_ID_INTEL_IGDNG_D_IG 0x0042
152 #define PCI_DEVICE_ID_INTEL_IGDNG_M_HB 0x0044
153 #define PCI_DEVICE_ID_INTEL_IGDNG_MA_HB 0x0062
154 +#define PCI_DEVICE_ID_INTEL_IGDNG_MC2_HB 0x006a
155 #define PCI_DEVICE_ID_INTEL_IGDNG_M_IG 0x0046
156
157 /* cover 915 and 945 variants */
158 @@ -86,7 +87,8 @@
159 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_B43_HB || \
160 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_IGDNG_D_HB || \
161 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_IGDNG_M_HB || \
162 - agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_IGDNG_MA_HB)
163 + agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_IGDNG_MA_HB || \
164 + agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_IGDNG_MC2_HB)
165
166 extern int agp_memory_reserved;
167
168 @@ -1239,6 +1241,7 @@ static void intel_i965_get_gtt_range(int *gtt_offset, int *gtt_size)
169 case PCI_DEVICE_ID_INTEL_IGDNG_D_HB:
170 case PCI_DEVICE_ID_INTEL_IGDNG_M_HB:
171 case PCI_DEVICE_ID_INTEL_IGDNG_MA_HB:
172 + case PCI_DEVICE_ID_INTEL_IGDNG_MC2_HB:
173 *gtt_offset = *gtt_size = MB(2);
174 break;
175 default:
176 @@ -2222,6 +2225,8 @@ static const struct intel_driver_description {
177 "IGDNG/M", NULL, &intel_i965_driver },
178 { PCI_DEVICE_ID_INTEL_IGDNG_MA_HB, PCI_DEVICE_ID_INTEL_IGDNG_M_IG, 0,
179 "IGDNG/MA", NULL, &intel_i965_driver },
180 + { PCI_DEVICE_ID_INTEL_IGDNG_MC2_HB, PCI_DEVICE_ID_INTEL_IGDNG_M_IG, 0,
181 + "IGDNG/MC2", NULL, &intel_i965_driver },
182 { 0, 0, 0, NULL, NULL, NULL }
183 };
184
185 @@ -2418,6 +2423,7 @@ static struct pci_device_id agp_intel_pci_table[] = {
186 ID(PCI_DEVICE_ID_INTEL_IGDNG_D_HB),
187 ID(PCI_DEVICE_ID_INTEL_IGDNG_M_HB),
188 ID(PCI_DEVICE_ID_INTEL_IGDNG_MA_HB),
189 + ID(PCI_DEVICE_ID_INTEL_IGDNG_MC2_HB),
190 { }
191 };
192
193 diff --git a/drivers/char/keyboard.c b/drivers/char/keyboard.c
194 index 737be95..950837c 100644
195 --- a/drivers/char/keyboard.c
196 +++ b/drivers/char/keyboard.c
197 @@ -1249,7 +1249,7 @@ static void kbd_keycode(unsigned int keycode, int down, int hw_raw)
198
199 if (keycode >= NR_KEYS)
200 if (keycode >= KEY_BRL_DOT1 && keycode <= KEY_BRL_DOT8)
201 - keysym = K(KT_BRL, keycode - KEY_BRL_DOT1 + 1);
202 + keysym = U(K(KT_BRL, keycode - KEY_BRL_DOT1 + 1));
203 else
204 return;
205 else
206 diff --git a/drivers/char/tty_port.c b/drivers/char/tty_port.c
207 index fa4ce67..c0ff7ee 100644
208 --- a/drivers/char/tty_port.c
209 +++ b/drivers/char/tty_port.c
210 @@ -217,8 +217,14 @@ int tty_port_block_til_ready(struct tty_port *port,
211
212 /* if non-blocking mode is set we can pass directly to open unless
213 the port has just hung up or is in another error state */
214 - if ((filp->f_flags & O_NONBLOCK) ||
215 - (tty->flags & (1 << TTY_IO_ERROR))) {
216 + if (tty->flags & (1 << TTY_IO_ERROR)) {
217 + port->flags |= ASYNC_NORMAL_ACTIVE;
218 + return 0;
219 + }
220 + if (filp->f_flags & O_NONBLOCK) {
221 + /* Indicate we are open */
222 + if (tty->termios->c_cflag & CBAUD)
223 + tty_port_raise_dtr_rts(port);
224 port->flags |= ASYNC_NORMAL_ACTIVE;
225 return 0;
226 }
227 diff --git a/drivers/crypto/padlock-aes.c b/drivers/crypto/padlock-aes.c
228 index a9952b1..84c51e1 100644
229 --- a/drivers/crypto/padlock-aes.c
230 +++ b/drivers/crypto/padlock-aes.c
231 @@ -236,7 +236,7 @@ static inline void ecb_crypt(const u8 *in, u8 *out, u32 *key,
232 /* Padlock in ECB mode fetches at least ecb_fetch_bytes of data.
233 * We could avoid some copying here but it's probably not worth it.
234 */
235 - if (unlikely(((unsigned long)in & PAGE_SIZE) + ecb_fetch_bytes > PAGE_SIZE)) {
236 + if (unlikely(((unsigned long)in & ~PAGE_MASK) + ecb_fetch_bytes > PAGE_SIZE)) {
237 ecb_crypt_copy(in, out, key, cword, count);
238 return;
239 }
240 @@ -248,7 +248,7 @@ static inline u8 *cbc_crypt(const u8 *in, u8 *out, u32 *key,
241 u8 *iv, struct cword *cword, int count)
242 {
243 /* Padlock in CBC mode fetches at least cbc_fetch_bytes of data. */
244 - if (unlikely(((unsigned long)in & PAGE_SIZE) + cbc_fetch_bytes > PAGE_SIZE))
245 + if (unlikely(((unsigned long)in & ~PAGE_MASK) + cbc_fetch_bytes > PAGE_SIZE))
246 return cbc_crypt_copy(in, out, key, iv, cword, count);
247
248 return rep_xcrypt_cbc(in, out, key, iv, cword, count);
249 diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
250 index 39b393d..012cf1f 100644
251 --- a/drivers/gpu/drm/Kconfig
252 +++ b/drivers/gpu/drm/Kconfig
253 @@ -82,6 +82,7 @@ config DRM_I830
254 config DRM_I915
255 tristate "i915 driver"
256 depends on AGP_INTEL
257 + select SHMEM
258 select FB_CFB_FILLRECT
259 select FB_CFB_COPYAREA
260 select FB_CFB_IMAGEBLIT
261 diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
262 index 7f2728b..55fb98d 100644
263 --- a/drivers/gpu/drm/drm_edid.c
264 +++ b/drivers/gpu/drm/drm_edid.c
265 @@ -333,6 +333,12 @@ static struct drm_display_mode *drm_mode_detailed(struct drm_device *dev,
266 mode->vsync_end = mode->vsync_start + vsync_pulse_width;
267 mode->vtotal = mode->vdisplay + vblank;
268
269 + /* Some EDIDs have bogus h/vtotal values */
270 + if (mode->hsync_end > mode->htotal)
271 + mode->htotal = mode->hsync_end + 1;
272 + if (mode->vsync_end > mode->vtotal)
273 + mode->vtotal = mode->vsync_end + 1;
274 +
275 drm_mode_set_name(mode);
276
277 if (pt->misc & DRM_EDID_PT_INTERLACED)
278 diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
279 index 7ebc84c..9431a72 100644
280 --- a/drivers/gpu/drm/i915/i915_irq.c
281 +++ b/drivers/gpu/drm/i915/i915_irq.c
282 @@ -253,10 +253,15 @@ irqreturn_t igdng_irq_handler(struct drm_device *dev)
283 {
284 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
285 int ret = IRQ_NONE;
286 - u32 de_iir, gt_iir;
287 + u32 de_iir, gt_iir, de_ier;
288 u32 new_de_iir, new_gt_iir;
289 struct drm_i915_master_private *master_priv;
290
291 + /* disable master interrupt before clearing iir */
292 + de_ier = I915_READ(DEIER);
293 + I915_WRITE(DEIER, de_ier & ~DE_MASTER_IRQ_CONTROL);
294 + (void)I915_READ(DEIER);
295 +
296 de_iir = I915_READ(DEIIR);
297 gt_iir = I915_READ(GTIIR);
298
299 @@ -287,6 +292,9 @@ irqreturn_t igdng_irq_handler(struct drm_device *dev)
300 gt_iir = new_gt_iir;
301 }
302
303 + I915_WRITE(DEIER, de_ier);
304 + (void)I915_READ(DEIER);
305 +
306 return ret;
307 }
308
309 diff --git a/drivers/gpu/drm/i915/intel_fb.c b/drivers/gpu/drm/i915/intel_fb.c
310 index 1d30802..75a9b83 100644
311 --- a/drivers/gpu/drm/i915/intel_fb.c
312 +++ b/drivers/gpu/drm/i915/intel_fb.c
313 @@ -114,7 +114,7 @@ static int intelfb_check_var(struct fb_var_screeninfo *var,
314 struct drm_framebuffer *fb = &intel_fb->base;
315 int depth;
316
317 - if (var->pixclock == -1 || !var->pixclock)
318 + if (var->pixclock != 0)
319 return -EINVAL;
320
321 /* Need to resize the fb object !!! */
322 @@ -205,7 +205,7 @@ static int intelfb_set_par(struct fb_info *info)
323
324 DRM_DEBUG("%d %d\n", var->xres, var->pixclock);
325
326 - if (var->pixclock != -1) {
327 + if (var->pixclock != 0) {
328
329 DRM_ERROR("PIXEL CLOCK SET\n");
330 return -EINVAL;
331 @@ -692,7 +692,7 @@ static int intelfb_multi_fb_probe_crtc(struct drm_device *dev, struct drm_crtc *
332 par->crtc_count = 1;
333
334 if (new_fb) {
335 - info->var.pixclock = -1;
336 + info->var.pixclock = 0;
337 if (register_framebuffer(info) < 0)
338 return -EINVAL;
339 } else
340 @@ -846,7 +846,7 @@ static int intelfb_single_fb_probe(struct drm_device *dev)
341 par->crtc_count = crtc_count;
342
343 if (new_fb) {
344 - info->var.pixclock = -1;
345 + info->var.pixclock = 0;
346 if (register_framebuffer(info) < 0)
347 return -EINVAL;
348 } else
349 diff --git a/drivers/gpu/drm/radeon/radeon_fb.c b/drivers/gpu/drm/radeon/radeon_fb.c
350 index ec383ed..f1d6d3d 100644
351 --- a/drivers/gpu/drm/radeon/radeon_fb.c
352 +++ b/drivers/gpu/drm/radeon/radeon_fb.c
353 @@ -120,7 +120,7 @@ static int radeonfb_check_var(struct fb_var_screeninfo *var,
354 struct drm_framebuffer *fb = &rfb->base;
355 int depth;
356
357 - if (var->pixclock == -1 || !var->pixclock) {
358 + if (var->pixclock != 0) {
359 return -EINVAL;
360 }
361 /* Need to resize the fb object !!! */
362 @@ -234,7 +234,7 @@ static int radeonfb_set_par(struct fb_info *info)
363 int ret;
364 int i;
365
366 - if (var->pixclock != -1) {
367 + if (var->pixclock != 0) {
368 DRM_ERROR("PIXEL CLCOK SET\n");
369 return -EINVAL;
370 }
371 @@ -828,7 +828,7 @@ static int radeonfb_single_fb_probe(struct radeon_device *rdev)
372 rfbdev->crtc_count = crtc_count;
373
374 if (new_fb) {
375 - info->var.pixclock = -1;
376 + info->var.pixclock = 0;
377 if (register_framebuffer(info) < 0)
378 return -EINVAL;
379 } else {
380 diff --git a/drivers/hwmon/adt7475.c b/drivers/hwmon/adt7475.c
381 index d39877a..20579fa 100644
382 --- a/drivers/hwmon/adt7475.c
383 +++ b/drivers/hwmon/adt7475.c
384 @@ -350,8 +350,7 @@ static ssize_t show_temp(struct device *dev, struct device_attribute *attr,
385
386 case FAULT:
387 /* Note - only for remote1 and remote2 */
388 - out = data->alarms & (sattr->index ? 0x8000 : 0x4000);
389 - out = out ? 0 : 1;
390 + out = !!(data->alarms & (sattr->index ? 0x8000 : 0x4000));
391 break;
392
393 default:
394 @@ -1152,7 +1151,7 @@ static struct adt7475_data *adt7475_update_device(struct device *dev)
395 }
396
397 /* Limits and settings, should never change update every 60 seconds */
398 - if (time_after(jiffies, data->limits_updated + HZ * 2) ||
399 + if (time_after(jiffies, data->limits_updated + HZ * 60) ||
400 !data->valid) {
401 data->config5 = adt7475_read(REG_CONFIG5);
402
403 diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
404 index 0e45c29..529d82c 100644
405 --- a/drivers/i2c/i2c-core.c
406 +++ b/drivers/i2c/i2c-core.c
407 @@ -718,6 +718,7 @@ int i2c_del_adapter(struct i2c_adapter *adap)
408 {
409 int res = 0;
410 struct i2c_adapter *found;
411 + struct i2c_client *client, *next;
412
413 /* First make sure that this adapter was ever added */
414 mutex_lock(&core_lock);
415 @@ -737,6 +738,16 @@ int i2c_del_adapter(struct i2c_adapter *adap)
416 if (res)
417 return res;
418
419 + /* Remove devices instantiated from sysfs */
420 + list_for_each_entry_safe(client, next, &userspace_devices, detected) {
421 + if (client->adapter == adap) {
422 + dev_dbg(&adap->dev, "Removing %s at 0x%x\n",
423 + client->name, client->addr);
424 + list_del(&client->detected);
425 + i2c_unregister_device(client);
426 + }
427 + }
428 +
429 /* Detach any active clients. This can't fail, thus we do not
430 checking the returned value. */
431 res = device_for_each_child(&adap->dev, NULL, __unregister_client);
432 diff --git a/drivers/isdn/hisax/hfc_usb.c b/drivers/isdn/hisax/hfc_usb.c
433 index 9de5420..a420b64 100644
434 --- a/drivers/isdn/hisax/hfc_usb.c
435 +++ b/drivers/isdn/hisax/hfc_usb.c
436 @@ -817,8 +817,8 @@ collect_rx_frame(usb_fifo * fifo, __u8 * data, int len, int finish)
437 }
438 /* we have a complete hdlc packet */
439 if (finish) {
440 - if ((!fifo->skbuff->data[fifo->skbuff->len - 1])
441 - && (fifo->skbuff->len > 3)) {
442 + if (fifo->skbuff->len > 3 &&
443 + !fifo->skbuff->data[fifo->skbuff->len - 1]) {
444
445 if (fifon == HFCUSB_D_RX) {
446 DBG(HFCUSB_DBG_DCHANNEL,
447 diff --git a/drivers/md/md.c b/drivers/md/md.c
448 index 9dd8720..78871cd 100644
449 --- a/drivers/md/md.c
450 +++ b/drivers/md/md.c
451 @@ -6495,8 +6495,9 @@ void md_do_sync(mddev_t *mddev)
452 skip:
453 mddev->curr_resync = 0;
454 mddev->curr_resync_completed = 0;
455 - mddev->resync_min = 0;
456 - mddev->resync_max = MaxSector;
457 + if (!test_bit(MD_RECOVERY_INTR, &mddev->recovery))
458 + /* We completed so max setting can be forgotten. */
459 + mddev->resync_max = MaxSector;
460 sysfs_notify(&mddev->kobj, NULL, "sync_completed");
461 wake_up(&resync_wait);
462 set_bit(MD_RECOVERY_DONE, &mddev->recovery);
463 diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
464 index 8726fd7..d3e492e 100644
465 --- a/drivers/md/raid1.c
466 +++ b/drivers/md/raid1.c
467 @@ -1643,11 +1643,12 @@ static void raid1d(mddev_t *mddev)
468 r1_bio->sector,
469 r1_bio->sectors);
470 unfreeze_array(conf);
471 - }
472 + } else
473 + md_error(mddev,
474 + conf->mirrors[r1_bio->read_disk].rdev);
475
476 bio = r1_bio->bios[r1_bio->read_disk];
477 - if ((disk=read_balance(conf, r1_bio)) == -1 ||
478 - disk == r1_bio->read_disk) {
479 + if ((disk=read_balance(conf, r1_bio)) == -1) {
480 printk(KERN_ALERT "raid1: %s: unrecoverable I/O"
481 " read error for block %llu\n",
482 bdevname(bio->bi_bdev,b),
483 @@ -1676,6 +1677,7 @@ static void raid1d(mddev_t *mddev)
484 generic_make_request(bio);
485 }
486 }
487 + cond_resched();
488 }
489 if (unplug)
490 unplug_slaves(mddev);
491 diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
492 index 3d9020c..6a5a5fb 100644
493 --- a/drivers/md/raid10.c
494 +++ b/drivers/md/raid10.c
495 @@ -1630,6 +1630,7 @@ static void raid10d(mddev_t *mddev)
496 generic_make_request(bio);
497 }
498 }
499 + cond_resched();
500 }
501 if (unplug)
502 unplug_slaves(mddev);
503 diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
504 index b8a2c5d..c339c8f 100644
505 --- a/drivers/md/raid5.c
506 +++ b/drivers/md/raid5.c
507 @@ -3790,6 +3790,8 @@ static sector_t reshape_request(mddev_t *mddev, sector_t sector_nr, int *skipped
508 sector_nr = conf->reshape_progress;
509 sector_div(sector_nr, new_data_disks);
510 if (sector_nr) {
511 + mddev->curr_resync_completed = sector_nr;
512 + sysfs_notify(&mddev->kobj, NULL, "sync_completed");
513 *skipped = 1;
514 return sector_nr;
515 }
516 diff --git a/drivers/media/common/tuners/tda18271-fe.c b/drivers/media/common/tuners/tda18271-fe.c
517 index b109356..f446f9a 100644
518 --- a/drivers/media/common/tuners/tda18271-fe.c
519 +++ b/drivers/media/common/tuners/tda18271-fe.c
520 @@ -595,13 +595,13 @@ static int tda18271_rf_tracking_filters_init(struct dvb_frontend *fe, u32 freq)
521 case RF2:
522 map[i].rf_a1 = (prog_cal[RF2] - prog_tab[RF2] -
523 prog_cal[RF1] + prog_tab[RF1]) /
524 - ((rf_freq[RF2] - rf_freq[RF1]) / 1000);
525 + (s32)((rf_freq[RF2] - rf_freq[RF1]) / 1000);
526 map[i].rf2 = rf_freq[RF2] / 1000;
527 break;
528 case RF3:
529 map[i].rf_a2 = (prog_cal[RF3] - prog_tab[RF3] -
530 prog_cal[RF2] + prog_tab[RF2]) /
531 - ((rf_freq[RF3] - rf_freq[RF2]) / 1000);
532 + (s32)((rf_freq[RF3] - rf_freq[RF2]) / 1000);
533 map[i].rf_b2 = prog_cal[RF2] - prog_tab[RF2];
534 map[i].rf3 = rf_freq[RF3] / 1000;
535 break;
536 @@ -963,12 +963,12 @@ static int tda18271_set_analog_params(struct dvb_frontend *fe,
537 struct tda18271_std_map_item *map;
538 char *mode;
539 int ret;
540 - u32 freq = params->frequency * 62500;
541 + u32 freq = params->frequency * 125 *
542 + ((params->mode == V4L2_TUNER_RADIO) ? 1 : 1000) / 2;
543
544 priv->mode = TDA18271_ANALOG;
545
546 if (params->mode == V4L2_TUNER_RADIO) {
547 - freq = freq / 1000;
548 map = &std_map->fm_radio;
549 mode = "fm";
550 } else if (params->std & V4L2_STD_MN) {
551 diff --git a/drivers/media/dvb/dvb-usb/cxusb.c b/drivers/media/dvb/dvb-usb/cxusb.c
552 index 406d7fb..f32b332 100644
553 --- a/drivers/media/dvb/dvb-usb/cxusb.c
554 +++ b/drivers/media/dvb/dvb-usb/cxusb.c
555 @@ -663,6 +663,14 @@ static struct zl10353_config cxusb_zl10353_xc3028_config = {
556 .parallel_ts = 1,
557 };
558
559 +static struct zl10353_config cxusb_zl10353_xc3028_config_no_i2c_gate = {
560 + .demod_address = 0x0f,
561 + .if2 = 45600,
562 + .no_tuner = 1,
563 + .parallel_ts = 1,
564 + .disable_i2c_gate_ctrl = 1,
565 +};
566 +
567 static struct mt352_config cxusb_mt352_xc3028_config = {
568 .demod_address = 0x0f,
569 .if2 = 4560,
570 @@ -894,7 +902,7 @@ static int cxusb_dualdig4_frontend_attach(struct dvb_usb_adapter *adap)
571 cxusb_bluebird_gpio_pulse(adap->dev, 0x02, 1);
572
573 if ((adap->fe = dvb_attach(zl10353_attach,
574 - &cxusb_zl10353_xc3028_config,
575 + &cxusb_zl10353_xc3028_config_no_i2c_gate,
576 &adap->dev->i2c_adap)) == NULL)
577 return -EIO;
578
579 diff --git a/drivers/media/dvb/frontends/dib7000p.c b/drivers/media/dvb/frontends/dib7000p.c
580 index 8217e5b..ac10fff 100644
581 --- a/drivers/media/dvb/frontends/dib7000p.c
582 +++ b/drivers/media/dvb/frontends/dib7000p.c
583 @@ -1344,6 +1344,11 @@ struct dvb_frontend * dib7000p_attach(struct i2c_adapter *i2c_adap, u8 i2c_addr,
584 if (dib7000p_identify(st) != 0)
585 goto error;
586
587 + /* FIXME: make sure the dev.parent field is initialized, or else
588 + request_firmware() will hit an OOPS (this should be moved somewhere
589 + more common) */
590 + st->i2c_master.gated_tuner_i2c_adap.dev.parent = i2c_adap->dev.parent;
591 +
592 dibx000_init_i2c_master(&st->i2c_master, DIB7000P, st->i2c_adap, st->i2c_addr);
593
594 dib7000p_demod_reset(st);
595 diff --git a/drivers/media/dvb/siano/smsusb.c b/drivers/media/dvb/siano/smsusb.c
596 index cb8a358..8f88a58 100644
597 --- a/drivers/media/dvb/siano/smsusb.c
598 +++ b/drivers/media/dvb/siano/smsusb.c
599 @@ -529,6 +529,12 @@ struct usb_device_id smsusb_id_table[] = {
600 .driver_info = SMS1XXX_BOARD_SIANO_NICE },
601 { USB_DEVICE(0x187f, 0x0301),
602 .driver_info = SMS1XXX_BOARD_SIANO_VENICE },
603 + { USB_DEVICE(0x2040, 0xb900),
604 + .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
605 + { USB_DEVICE(0x2040, 0xb910),
606 + .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
607 + { USB_DEVICE(0x2040, 0xc000),
608 + .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
609 { } /* Terminating entry */
610 };
611
612 diff --git a/drivers/media/radio/radio-gemtek-pci.c b/drivers/media/radio/radio-gemtek-pci.c
613 index c3f579d..c6cf116 100644
614 --- a/drivers/media/radio/radio-gemtek-pci.c
615 +++ b/drivers/media/radio/radio-gemtek-pci.c
616 @@ -181,12 +181,10 @@ static void gemtek_pci_mute(struct gemtek_pci *card)
617
618 static void gemtek_pci_unmute(struct gemtek_pci *card)
619 {
620 - mutex_lock(&card->lock);
621 if (card->mute) {
622 gemtek_pci_setfrequency(card, card->current_frequency);
623 card->mute = false;
624 }
625 - mutex_unlock(&card->lock);
626 }
627
628 static int gemtek_pci_getsignal(struct gemtek_pci *card)
629 diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c
630 index 8cc6dd2..b8e276c 100644
631 --- a/drivers/media/video/bt8xx/bttv-driver.c
632 +++ b/drivers/media/video/bt8xx/bttv-driver.c
633 @@ -1299,7 +1299,7 @@ set_tvnorm(struct bttv *btv, unsigned int norm)
634
635 tvnorm = &bttv_tvnorms[norm];
636
637 - if (!memcmp(&bttv_tvnorms[btv->tvnorm].cropcap, &tvnorm->cropcap,
638 + if (memcmp(&bttv_tvnorms[btv->tvnorm].cropcap, &tvnorm->cropcap,
639 sizeof (tvnorm->cropcap))) {
640 bttv_crop_reset(&btv->crop[0], norm);
641 btv->crop[1] = btv->crop[0]; /* current = default */
642 @@ -3798,11 +3798,34 @@ bttv_irq_next_video(struct bttv *btv, struct bttv_buffer_set *set)
643 if (!V4L2_FIELD_HAS_BOTH(item->vb.field) &&
644 (item->vb.queue.next != &btv->capture)) {
645 item = list_entry(item->vb.queue.next, struct bttv_buffer, vb.queue);
646 + /* Mike Isely <isely@pobox.com> - Only check
647 + * and set up the bottom field in the logic
648 + * below. Don't ever do the top field. This
649 + * of course means that if we set up the
650 + * bottom field in the above code that we'll
651 + * actually skip a field. But that's OK.
652 + * Having processed only a single buffer this
653 + * time, then the next time around the first
654 + * available buffer should be for a top field.
655 + * That will then cause us here to set up a
656 + * top then a bottom field in the normal way.
657 + * The alternative to this understanding is
658 + * that we set up the second available buffer
659 + * as a top field, but that's out of order
660 + * since this driver always processes the top
661 + * field first - the effect will be the two
662 + * buffers being returned in the wrong order,
663 + * with the second buffer also being delayed
664 + * by one field time (owing to the fifo nature
665 + * of videobuf). Worse still, we'll be stuck
666 + * doing fields out of order now every time
667 + * until something else causes a field to be
668 + * dropped. By effectively forcing a field to
669 + * drop this way then we always get back into
670 + * sync within a single frame time. (Out of
671 + * order fields can screw up deinterlacing
672 + * algorithms.) */
673 if (!V4L2_FIELD_HAS_BOTH(item->vb.field)) {
674 - if (NULL == set->top &&
675 - V4L2_FIELD_TOP == item->vb.field) {
676 - set->top = item;
677 - }
678 if (NULL == set->bottom &&
679 V4L2_FIELD_BOTTOM == item->vb.field) {
680 set->bottom = item;
681 diff --git a/drivers/media/video/em28xx/em28xx-audio.c b/drivers/media/video/em28xx/em28xx-audio.c
682 index 7bd8a70..ac947ae 100644
683 --- a/drivers/media/video/em28xx/em28xx-audio.c
684 +++ b/drivers/media/video/em28xx/em28xx-audio.c
685 @@ -383,6 +383,11 @@ static int snd_em28xx_hw_capture_free(struct snd_pcm_substream *substream)
686
687 static int snd_em28xx_prepare(struct snd_pcm_substream *substream)
688 {
689 + struct em28xx *dev = snd_pcm_substream_chip(substream);
690 +
691 + dev->adev.hwptr_done_capture = 0;
692 + dev->adev.capture_transfer_done = 0;
693 +
694 return 0;
695 }
696
697 diff --git a/drivers/media/video/gspca/m5602/m5602_s5k4aa.c b/drivers/media/video/gspca/m5602/m5602_s5k4aa.c
698 index 0163903..3b159e4 100644
699 --- a/drivers/media/video/gspca/m5602/m5602_s5k4aa.c
700 +++ b/drivers/media/video/gspca/m5602/m5602_s5k4aa.c
701 @@ -35,12 +35,25 @@ static
702 const
703 struct dmi_system_id s5k4aa_vflip_dmi_table[] = {
704 {
705 + .ident = "BRUNEINIT",
706 + .matches = {
707 + DMI_MATCH(DMI_SYS_VENDOR, "BRUNENIT"),
708 + DMI_MATCH(DMI_PRODUCT_NAME, "BRUNENIT"),
709 + DMI_MATCH(DMI_BOARD_VERSION, "00030D0000000001")
710 + }
711 + }, {
712 .ident = "Fujitsu-Siemens Amilo Xa 2528",
713 .matches = {
714 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
715 DMI_MATCH(DMI_PRODUCT_NAME, "AMILO Xa 2528")
716 }
717 }, {
718 + .ident = "Fujitsu-Siemens Amilo Xi 2528",
719 + .matches = {
720 + DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
721 + DMI_MATCH(DMI_PRODUCT_NAME, "AMILO Xi 2528")
722 + }
723 + }, {
724 .ident = "Fujitsu-Siemens Amilo Xi 2550",
725 .matches = {
726 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
727 @@ -51,6 +64,13 @@ static
728 .matches = {
729 DMI_MATCH(DMI_SYS_VENDOR, "Micro-Star International"),
730 DMI_MATCH(DMI_PRODUCT_NAME, "GX700"),
731 + DMI_MATCH(DMI_BIOS_DATE, "12/02/2008")
732 + }
733 + }, {
734 + .ident = "MSI GX700",
735 + .matches = {
736 + DMI_MATCH(DMI_SYS_VENDOR, "Micro-Star International"),
737 + DMI_MATCH(DMI_PRODUCT_NAME, "GX700"),
738 DMI_MATCH(DMI_BIOS_DATE, "07/26/2007")
739 }
740 }, {
741 diff --git a/drivers/media/video/gspca/sonixj.c b/drivers/media/video/gspca/sonixj.c
742 index d6332ab..33f4d0a 100644
743 --- a/drivers/media/video/gspca/sonixj.c
744 +++ b/drivers/media/video/gspca/sonixj.c
745 @@ -727,7 +727,7 @@ static const u8 ov7660_sensor_init[][8] = {
746 {0xa1, 0x21, 0x12, 0x05, 0x00, 0x00, 0x00, 0x10},
747 /* Outformat = rawRGB */
748 {0xa1, 0x21, 0x13, 0xb8, 0x00, 0x00, 0x00, 0x10}, /* init COM8 */
749 - {0xd1, 0x21, 0x00, 0x01, 0x74, 0x74, 0x00, 0x10},
750 + {0xd1, 0x21, 0x00, 0x01, 0x74, 0x92, 0x00, 0x10},
751 /* GAIN BLUE RED VREF */
752 {0xd1, 0x21, 0x04, 0x00, 0x7d, 0x62, 0x00, 0x10},
753 /* COM 1 BAVE GEAVE AECHH */
754 @@ -783,7 +783,7 @@ static const u8 ov7660_sensor_init[][8] = {
755 {0xc1, 0x21, 0x88, 0xaf, 0xc7, 0xdf, 0x00, 0x10}, /* gamma curve */
756 {0xc1, 0x21, 0x8b, 0x99, 0x99, 0xcf, 0x00, 0x10}, /* reserved */
757 {0xb1, 0x21, 0x92, 0x00, 0x00, 0x00, 0x00, 0x10}, /* DM_LNL/H */
758 - {0xb1, 0x21, 0xa1, 0x00, 0x00, 0x00, 0x00, 0x10},
759 + {0xa1, 0x21, 0xa1, 0x00, 0x00, 0x00, 0x00, 0x10},
760 /****** (some exchanges in the win trace) ******/
761 {0xa1, 0x21, 0x1e, 0x01, 0x00, 0x00, 0x00, 0x10}, /* MVFP */
762 /* bits[3..0]reserved */
763 @@ -1145,17 +1145,12 @@ static int configure_gpio(struct gspca_dev *gspca_dev,
764 reg_w1(gspca_dev, 0x01, 0x42);
765 break;
766 case SENSOR_OV7660:
767 - reg_w1(gspca_dev, 0x01, 0x61);
768 - reg_w1(gspca_dev, 0x17, 0x20);
769 - reg_w1(gspca_dev, 0x01, 0x60);
770 - reg_w1(gspca_dev, 0x01, 0x40);
771 - break;
772 case SENSOR_SP80708:
773 reg_w1(gspca_dev, 0x01, 0x63);
774 reg_w1(gspca_dev, 0x17, 0x20);
775 reg_w1(gspca_dev, 0x01, 0x62);
776 reg_w1(gspca_dev, 0x01, 0x42);
777 - mdelay(100);
778 + msleep(100);
779 reg_w1(gspca_dev, 0x02, 0x62);
780 break;
781 /* case SENSOR_HV7131R: */
782 @@ -1624,6 +1619,8 @@ static void setvflip(struct sd *sd)
783
784 static void setinfrared(struct sd *sd)
785 {
786 + if (sd->gspca_dev.ctrl_dis & (1 << INFRARED_IDX))
787 + return;
788 /*fixme: different sequence for StarCam Clip and StarCam 370i */
789 /* Clip */
790 i2c_w1(&sd->gspca_dev, 0x02, /* gpio */
791 @@ -1637,16 +1634,19 @@ static void setfreq(struct gspca_dev *gspca_dev)
792 if (gspca_dev->ctrl_dis & (1 << FREQ_IDX))
793 return;
794 if (sd->sensor == SENSOR_OV7660) {
795 + u8 com8;
796 +
797 + com8 = 0xdf; /* auto gain/wb/expo */
798 switch (sd->freq) {
799 case 0: /* Banding filter disabled */
800 - i2c_w1(gspca_dev, 0x13, 0xdf);
801 + i2c_w1(gspca_dev, 0x13, com8 | 0x20);
802 break;
803 case 1: /* 50 hz */
804 - i2c_w1(gspca_dev, 0x13, 0xff);
805 + i2c_w1(gspca_dev, 0x13, com8);
806 i2c_w1(gspca_dev, 0x3b, 0x0a);
807 break;
808 case 2: /* 60 hz */
809 - i2c_w1(gspca_dev, 0x13, 0xff);
810 + i2c_w1(gspca_dev, 0x13, com8);
811 i2c_w1(gspca_dev, 0x3b, 0x02);
812 break;
813 }
814 @@ -1796,12 +1796,6 @@ static int sd_start(struct gspca_dev *gspca_dev)
815 reg_w1(gspca_dev, 0x99, 0x60);
816 break;
817 case SENSOR_OV7660:
818 - reg_w1(gspca_dev, 0x9a, 0x05);
819 - if (sd->bridge == BRIDGE_SN9C105)
820 - reg_w1(gspca_dev, 0x99, 0xff);
821 - else
822 - reg_w1(gspca_dev, 0x99, 0x5b);
823 - break;
824 case SENSOR_SP80708:
825 reg_w1(gspca_dev, 0x9a, 0x05);
826 reg_w1(gspca_dev, 0x99, 0x59);
827 @@ -2325,18 +2319,19 @@ static const __devinitdata struct usb_device_id device_table[] = {
828 {USB_DEVICE(0x0c45, 0x607c), BSI(SN9C102P, HV7131R, 0x11)},
829 /* {USB_DEVICE(0x0c45, 0x607e), BSI(SN9C102P, OV7630, 0x??)}, */
830 {USB_DEVICE(0x0c45, 0x60c0), BSI(SN9C105, MI0360, 0x5d)},
831 -/* {USB_DEVICE(0x0c45, 0x60c8), BSI(SN9C105, OM6801, 0x??)}, */
832 +/* {USB_DEVICE(0x0c45, 0x60c8), BSI(SN9C105, OM6802, 0x??)}, */
833 /* {USB_DEVICE(0x0c45, 0x60cc), BSI(SN9C105, HV7131GP, 0x??)}, */
834 {USB_DEVICE(0x0c45, 0x60ec), BSI(SN9C105, MO4000, 0x21)},
835 /* {USB_DEVICE(0x0c45, 0x60ef), BSI(SN9C105, ICM105C, 0x??)}, */
836 /* {USB_DEVICE(0x0c45, 0x60fa), BSI(SN9C105, OV7648, 0x??)}, */
837 {USB_DEVICE(0x0c45, 0x60fb), BSI(SN9C105, OV7660, 0x21)},
838 - {USB_DEVICE(0x0c45, 0x60fc), BSI(SN9C105, HV7131R, 0x11)},
839 #if !defined CONFIG_USB_SN9C102 && !defined CONFIG_USB_SN9C102_MODULE
840 + {USB_DEVICE(0x0c45, 0x60fc), BSI(SN9C105, HV7131R, 0x11)},
841 {USB_DEVICE(0x0c45, 0x60fe), BSI(SN9C105, OV7630, 0x21)},
842 #endif
843 {USB_DEVICE(0x0c45, 0x6100), BSI(SN9C120, MI0360, 0x5d)}, /*sn9c128*/
844 -/* {USB_DEVICE(0x0c45, 0x6108), BSI(SN9C120, OM6801, 0x??)}, */
845 +/* {USB_DEVICE(0x0c45, 0x6102), BSI(SN9C120, PO2030N, ??)}, */
846 +/* {USB_DEVICE(0x0c45, 0x6108), BSI(SN9C120, OM6802, 0x21)}, */
847 {USB_DEVICE(0x0c45, 0x610a), BSI(SN9C120, OV7648, 0x21)}, /*sn9c128*/
848 {USB_DEVICE(0x0c45, 0x610b), BSI(SN9C120, OV7660, 0x21)}, /*sn9c128*/
849 {USB_DEVICE(0x0c45, 0x610c), BSI(SN9C120, HV7131R, 0x11)}, /*sn9c128*/
850 @@ -2352,6 +2347,7 @@ static const __devinitdata struct usb_device_id device_table[] = {
851 #if !defined CONFIG_USB_SN9C102 && !defined CONFIG_USB_SN9C102_MODULE
852 {USB_DEVICE(0x0c45, 0x6130), BSI(SN9C120, MI0360, 0x5d)},
853 #endif
854 +/* {USB_DEVICE(0x0c45, 0x6132), BSI(SN9C120, OV7670, 0x21)}, */
855 {USB_DEVICE(0x0c45, 0x6138), BSI(SN9C120, MO4000, 0x21)},
856 {USB_DEVICE(0x0c45, 0x613a), BSI(SN9C120, OV7648, 0x21)},
857 #if !defined CONFIG_USB_SN9C102 && !defined CONFIG_USB_SN9C102_MODULE
858 @@ -2359,7 +2355,9 @@ static const __devinitdata struct usb_device_id device_table[] = {
859 #endif
860 {USB_DEVICE(0x0c45, 0x613c), BSI(SN9C120, HV7131R, 0x11)},
861 {USB_DEVICE(0x0c45, 0x613e), BSI(SN9C120, OV7630, 0x21)},
862 - {USB_DEVICE(0x0c45, 0x6143), BSI(SN9C120, SP80708, 0x18)},
863 +/* {USB_DEVICE(0x0c45, 0x6142), BSI(SN9C120, PO2030N, ??)}, *sn9c120b*/
864 + {USB_DEVICE(0x0c45, 0x6143), BSI(SN9C120, SP80708, 0x18)}, /*sn9c120b*/
865 + {USB_DEVICE(0x0c45, 0x6148), BSI(SN9C120, OM6802, 0x21)}, /*sn9c120b*/
866 {}
867 };
868 MODULE_DEVICE_TABLE(usb, device_table);
869 diff --git a/drivers/media/video/s2255drv.c b/drivers/media/video/s2255drv.c
870 index 9e3262c..2c0bb06 100644
871 --- a/drivers/media/video/s2255drv.c
872 +++ b/drivers/media/video/s2255drv.c
873 @@ -598,11 +598,6 @@ static int s2255_got_frame(struct s2255_dev *dev, int chn, int jpgsize)
874 buf = list_entry(dma_q->active.next,
875 struct s2255_buffer, vb.queue);
876
877 - if (!waitqueue_active(&buf->vb.done)) {
878 - /* no one active */
879 - rc = -1;
880 - goto unlock;
881 - }
882 list_del(&buf->vb.queue);
883 do_gettimeofday(&buf->vb.ts);
884 dprintk(100, "[%p/%d] wakeup\n", buf, buf->vb.i);
885 diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c
886 index 6eebe3e..52a79b3 100644
887 --- a/drivers/media/video/saa7134/saa7134-cards.c
888 +++ b/drivers/media/video/saa7134/saa7134-cards.c
889 @@ -3373,6 +3373,7 @@ struct saa7134_board saa7134_boards[] = {
890 .tuner_config = 3,
891 .mpeg = SAA7134_MPEG_DVB,
892 .ts_type = SAA7134_MPEG_TS_SERIAL,
893 + .ts_force_val = 1,
894 .gpiomask = 0x0800100, /* GPIO 21 is an INPUT */
895 .inputs = {{
896 .name = name_tv,
897 diff --git a/drivers/media/video/saa7134/saa7134-ts.c b/drivers/media/video/saa7134/saa7134-ts.c
898 index 3fa6522..03488ba 100644
899 --- a/drivers/media/video/saa7134/saa7134-ts.c
900 +++ b/drivers/media/video/saa7134/saa7134-ts.c
901 @@ -262,11 +262,13 @@ int saa7134_ts_start(struct saa7134_dev *dev)
902 switch (saa7134_boards[dev->board].ts_type) {
903 case SAA7134_MPEG_TS_PARALLEL:
904 saa_writeb(SAA7134_TS_SERIAL0, 0x40);
905 - saa_writeb(SAA7134_TS_PARALLEL, 0xec);
906 + saa_writeb(SAA7134_TS_PARALLEL, 0xec |
907 + (saa7134_boards[dev->board].ts_force_val << 4));
908 break;
909 case SAA7134_MPEG_TS_SERIAL:
910 saa_writeb(SAA7134_TS_SERIAL0, 0xd8);
911 - saa_writeb(SAA7134_TS_PARALLEL, 0x6c);
912 + saa_writeb(SAA7134_TS_PARALLEL, 0x6c |
913 + (saa7134_boards[dev->board].ts_force_val << 4));
914 saa_writeb(SAA7134_TS_PARALLEL_SERIAL, 0xbc);
915 saa_writeb(SAA7134_TS_SERIAL1, 0x02);
916 break;
917 diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h
918 index 4d85f5c..f50734f 100644
919 --- a/drivers/media/video/saa7134/saa7134.h
920 +++ b/drivers/media/video/saa7134/saa7134.h
921 @@ -355,6 +355,7 @@ struct saa7134_board {
922 enum saa7134_mpeg_type mpeg;
923 enum saa7134_mpeg_ts_type ts_type;
924 unsigned int vid_port_opts;
925 + unsigned int ts_force_val:1;
926 };
927
928 #define card_has_radio(dev) (NULL != saa7134_boards[dev->board].radio.name)
929 diff --git a/drivers/media/video/sn9c102/sn9c102_devtable.h b/drivers/media/video/sn9c102/sn9c102_devtable.h
930 index 38a7160..36ee43a 100644
931 --- a/drivers/media/video/sn9c102/sn9c102_devtable.h
932 +++ b/drivers/media/video/sn9c102/sn9c102_devtable.h
933 @@ -123,8 +123,8 @@ static const struct usb_device_id sn9c102_id_table[] = {
934 { SN9C102_USB_DEVICE(0x0c45, 0x613b, BRIDGE_SN9C120), },
935 #if !defined CONFIG_USB_GSPCA && !defined CONFIG_USB_GSPCA_MODULE
936 { SN9C102_USB_DEVICE(0x0c45, 0x613c, BRIDGE_SN9C120), },
937 -#endif
938 { SN9C102_USB_DEVICE(0x0c45, 0x613e, BRIDGE_SN9C120), },
939 +#endif
940 { }
941 };
942
943 diff --git a/drivers/media/video/v4l1-compat.c b/drivers/media/video/v4l1-compat.c
944 index 02f2a6d..ec76693 100644
945 --- a/drivers/media/video/v4l1-compat.c
946 +++ b/drivers/media/video/v4l1-compat.c
947 @@ -565,10 +565,9 @@ static noinline long v4l1_compat_get_input_info(
948 break;
949 }
950 chan->norm = 0;
951 - err = drv(file, VIDIOC_G_STD, &sid);
952 - if (err < 0)
953 - dprintk("VIDIOCGCHAN / VIDIOC_G_STD: %ld\n", err);
954 - if (err == 0) {
955 + /* Note: G_STD might not be present for radio receivers,
956 + * so we should ignore any errors. */
957 + if (drv(file, VIDIOC_G_STD, &sid) == 0) {
958 if (sid & V4L2_STD_PAL)
959 chan->norm = VIDEO_MODE_PAL;
960 if (sid & V4L2_STD_NTSC)
961 @@ -777,10 +776,9 @@ static noinline long v4l1_compat_get_tuner(
962 tun->flags |= VIDEO_TUNER_SECAM;
963 }
964
965 - err = drv(file, VIDIOC_G_STD, &sid);
966 - if (err < 0)
967 - dprintk("VIDIOCGTUNER / VIDIOC_G_STD: %ld\n", err);
968 - if (err == 0) {
969 + /* Note: G_STD might not be present for radio receivers,
970 + * so we should ignore any errors. */
971 + if (drv(file, VIDIOC_G_STD, &sid) == 0) {
972 if (sid & V4L2_STD_PAL)
973 tun->mode = VIDEO_MODE_PAL;
974 if (sid & V4L2_STD_NTSC)
975 diff --git a/drivers/mmc/host/pxamci.c b/drivers/mmc/host/pxamci.c
976 index e55ac79..c8c0a7e 100644
977 --- a/drivers/mmc/host/pxamci.c
978 +++ b/drivers/mmc/host/pxamci.c
979 @@ -694,14 +694,14 @@ static int pxamci_remove(struct platform_device *pdev)
980 if (mmc) {
981 struct pxamci_host *host = mmc_priv(mmc);
982
983 + mmc_remove_host(mmc);
984 +
985 if (host->vcc)
986 regulator_put(host->vcc);
987
988 if (host->pdata && host->pdata->exit)
989 host->pdata->exit(&pdev->dev, mmc);
990
991 - mmc_remove_host(mmc);
992 -
993 pxamci_stop_clock(host);
994 writel(TXFIFO_WR_REQ|RXFIFO_RD_REQ|CLK_IS_OFF|STOP_CMD|
995 END_CMD_RES|PRG_DONE|DATA_TRAN_DONE,
996 diff --git a/drivers/net/acenic.c b/drivers/net/acenic.c
997 index 08419ee..12bfc44 100644
998 --- a/drivers/net/acenic.c
999 +++ b/drivers/net/acenic.c
1000 @@ -1209,7 +1209,8 @@ static int __devinit ace_init(struct net_device *dev)
1001 memset(ap->info, 0, sizeof(struct ace_info));
1002 memset(ap->skb, 0, sizeof(struct ace_skb));
1003
1004 - if (ace_load_firmware(dev))
1005 + ecode = ace_load_firmware(dev);
1006 + if (ecode)
1007 goto init_error;
1008
1009 ap->fw_running = 0;
1010 diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
1011 index 7029d53..bcd8df9 100644
1012 --- a/drivers/net/bonding/bond_main.c
1013 +++ b/drivers/net/bonding/bond_main.c
1014 @@ -3707,10 +3707,10 @@ static int bond_xmit_hash_policy_l23(struct sk_buff *skb,
1015
1016 if (skb->protocol == htons(ETH_P_IP)) {
1017 return ((ntohl(iph->saddr ^ iph->daddr) & 0xffff) ^
1018 - (data->h_dest[5] ^ bond_dev->dev_addr[5])) % count;
1019 + (data->h_dest[5] ^ data->h_source[5])) % count;
1020 }
1021
1022 - return (data->h_dest[5] ^ bond_dev->dev_addr[5]) % count;
1023 + return (data->h_dest[5] ^ data->h_source[5]) % count;
1024 }
1025
1026 /*
1027 @@ -3737,7 +3737,7 @@ static int bond_xmit_hash_policy_l34(struct sk_buff *skb,
1028
1029 }
1030
1031 - return (data->h_dest[5] ^ bond_dev->dev_addr[5]) % count;
1032 + return (data->h_dest[5] ^ data->h_source[5]) % count;
1033 }
1034
1035 /*
1036 @@ -3748,7 +3748,7 @@ static int bond_xmit_hash_policy_l2(struct sk_buff *skb,
1037 {
1038 struct ethhdr *data = (struct ethhdr *)skb->data;
1039
1040 - return (data->h_dest[5] ^ bond_dev->dev_addr[5]) % count;
1041 + return (data->h_dest[5] ^ data->h_source[5]) % count;
1042 }
1043
1044 /*-------------------------- Device entry points ----------------------------*/
1045 diff --git a/drivers/net/sfc/rx.c b/drivers/net/sfc/rx.c
1046 index 01f9432..98bff5a 100644
1047 --- a/drivers/net/sfc/rx.c
1048 +++ b/drivers/net/sfc/rx.c
1049 @@ -444,7 +444,8 @@ static void efx_rx_packet__check_len(struct efx_rx_queue *rx_queue,
1050 * the appropriate LRO method
1051 */
1052 static void efx_rx_packet_lro(struct efx_channel *channel,
1053 - struct efx_rx_buffer *rx_buf)
1054 + struct efx_rx_buffer *rx_buf,
1055 + bool checksummed)
1056 {
1057 struct napi_struct *napi = &channel->napi_str;
1058
1059 @@ -466,7 +467,8 @@ static void efx_rx_packet_lro(struct efx_channel *channel,
1060 skb->len = rx_buf->len;
1061 skb->data_len = rx_buf->len;
1062 skb->truesize += rx_buf->len;
1063 - skb->ip_summed = CHECKSUM_UNNECESSARY;
1064 + skb->ip_summed =
1065 + checksummed ? CHECKSUM_UNNECESSARY : CHECKSUM_NONE;
1066
1067 napi_gro_frags(napi);
1068
1069 @@ -475,6 +477,7 @@ out:
1070 rx_buf->page = NULL;
1071 } else {
1072 EFX_BUG_ON_PARANOID(!rx_buf->skb);
1073 + EFX_BUG_ON_PARANOID(!checksummed);
1074
1075 napi_gro_receive(napi, rx_buf->skb);
1076 rx_buf->skb = NULL;
1077 @@ -570,7 +573,7 @@ void __efx_rx_packet(struct efx_channel *channel,
1078 }
1079
1080 if (likely(checksummed || rx_buf->page)) {
1081 - efx_rx_packet_lro(channel, rx_buf);
1082 + efx_rx_packet_lro(channel, rx_buf, checksummed);
1083 goto done;
1084 }
1085
1086 diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
1087 index a606e7f..329f447 100644
1088 --- a/drivers/net/sky2.c
1089 +++ b/drivers/net/sky2.c
1090 @@ -4528,6 +4528,8 @@ static int __devinit sky2_probe(struct pci_dev *pdev,
1091 goto err_out_free_netdev;
1092 }
1093
1094 + netif_carrier_off(dev);
1095 +
1096 netif_napi_add(dev, &hw->napi, sky2_poll, NAPI_WEIGHT);
1097
1098 err = request_irq(pdev->irq, sky2_intr,
1099 diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
1100 index f8c6d7e..9e1fc29 100644
1101 --- a/drivers/net/usb/hso.c
1102 +++ b/drivers/net/usb/hso.c
1103 @@ -1362,7 +1362,7 @@ static void hso_serial_close(struct tty_struct *tty, struct file *filp)
1104 /* reset the rts and dtr */
1105 /* do the actual close */
1106 serial->open_count--;
1107 - kref_put(&serial->parent->ref, hso_serial_ref_free);
1108 +
1109 if (serial->open_count <= 0) {
1110 serial->open_count = 0;
1111 spin_lock_irq(&serial->serial_lock);
1112 @@ -1382,6 +1382,8 @@ static void hso_serial_close(struct tty_struct *tty, struct file *filp)
1113 usb_autopm_put_interface(serial->parent->interface);
1114
1115 mutex_unlock(&serial->parent->mutex);
1116 +
1117 + kref_put(&serial->parent->ref, hso_serial_ref_free);
1118 }
1119
1120 /* close the requested serial port */
1121 diff --git a/drivers/net/wireless/ath/ath5k/phy.c b/drivers/net/wireless/ath/ath5k/phy.c
1122 index a876ca8..0981fb4 100644
1123 --- a/drivers/net/wireless/ath/ath5k/phy.c
1124 +++ b/drivers/net/wireless/ath/ath5k/phy.c
1125 @@ -740,13 +740,22 @@ int ath5k_hw_rfregs_init(struct ath5k_hw *ah, struct ieee80211_channel *channel,
1126 AR5K_RF_XPD_GAIN, true);
1127
1128 } else {
1129 - /* TODO: Set high and low gain bits */
1130 - ath5k_hw_rfb_op(ah, rf_regs,
1131 - ee->ee_x_gain[ee_mode],
1132 + u8 *pdg_curve_to_idx = ee->ee_pdc_to_idx[ee_mode];
1133 + if (ee->ee_pd_gains[ee_mode] > 1) {
1134 + ath5k_hw_rfb_op(ah, rf_regs,
1135 + pdg_curve_to_idx[0],
1136 AR5K_RF_PD_GAIN_LO, true);
1137 - ath5k_hw_rfb_op(ah, rf_regs,
1138 - ee->ee_x_gain[ee_mode],
1139 + ath5k_hw_rfb_op(ah, rf_regs,
1140 + pdg_curve_to_idx[1],
1141 AR5K_RF_PD_GAIN_HI, true);
1142 + } else {
1143 + ath5k_hw_rfb_op(ah, rf_regs,
1144 + pdg_curve_to_idx[0],
1145 + AR5K_RF_PD_GAIN_LO, true);
1146 + ath5k_hw_rfb_op(ah, rf_regs,
1147 + pdg_curve_to_idx[0],
1148 + AR5K_RF_PD_GAIN_HI, true);
1149 + }
1150
1151 /* Lower synth voltage on Rev 2 */
1152 ath5k_hw_rfb_op(ah, rf_regs, 2,
1153 @@ -1897,8 +1906,9 @@ ath5k_get_linear_pcdac_min(const u8 *stepL, const u8 *stepR,
1154 s16 min_pwrL, min_pwrR;
1155 s16 pwr_i;
1156
1157 - if (WARN_ON(stepL[0] == stepL[1] || stepR[0] == stepR[1]))
1158 - return 0;
1159 + /* Some vendors write the same pcdac value twice !!! */
1160 + if (stepL[0] == stepL[1] || stepR[0] == stepR[1])
1161 + return max(pwrL[0], pwrR[0]);
1162
1163 if (pwrL[0] == pwrL[1])
1164 min_pwrL = pwrL[0];
1165 diff --git a/drivers/net/wireless/b43/dma.c b/drivers/net/wireless/b43/dma.c
1166 index 7964cc3..32e9513 100644
1167 --- a/drivers/net/wireless/b43/dma.c
1168 +++ b/drivers/net/wireless/b43/dma.c
1169 @@ -1158,8 +1158,9 @@ struct b43_dmaring *parse_cookie(struct b43_wldev *dev, u16 cookie, int *slot)
1170 }
1171
1172 static int dma_tx_fragment(struct b43_dmaring *ring,
1173 - struct sk_buff *skb)
1174 + struct sk_buff **in_skb)
1175 {
1176 + struct sk_buff *skb = *in_skb;
1177 const struct b43_dma_ops *ops = ring->ops;
1178 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1179 u8 *header;
1180 @@ -1225,8 +1226,14 @@ static int dma_tx_fragment(struct b43_dmaring *ring,
1181 }
1182
1183 memcpy(skb_put(bounce_skb, skb->len), skb->data, skb->len);
1184 + memcpy(bounce_skb->cb, skb->cb, sizeof(skb->cb));
1185 + bounce_skb->dev = skb->dev;
1186 + skb_set_queue_mapping(bounce_skb, skb_get_queue_mapping(skb));
1187 + info = IEEE80211_SKB_CB(bounce_skb);
1188 +
1189 dev_kfree_skb_any(skb);
1190 skb = bounce_skb;
1191 + *in_skb = bounce_skb;
1192 meta->skb = skb;
1193 meta->dmaaddr = map_descbuffer(ring, skb->data, skb->len, 1);
1194 if (b43_dma_mapping_error(ring, meta->dmaaddr, skb->len, 1)) {
1195 @@ -1334,13 +1341,22 @@ int b43_dma_tx(struct b43_wldev *dev, struct sk_buff *skb)
1196 spin_lock_irqsave(&ring->lock, flags);
1197
1198 B43_WARN_ON(!ring->tx);
1199 - /* Check if the queue was stopped in mac80211,
1200 - * but we got called nevertheless.
1201 - * That would be a mac80211 bug. */
1202 - B43_WARN_ON(ring->stopped);
1203
1204 - if (unlikely(free_slots(ring) < TX_SLOTS_PER_FRAME)) {
1205 - b43warn(dev->wl, "DMA queue overflow\n");
1206 + if (unlikely(ring->stopped)) {
1207 + /* We get here only because of a bug in mac80211.
1208 + * Because of a race, one packet may be queued after
1209 + * the queue is stopped, thus we got called when we shouldn't.
1210 + * For now, just refuse the transmit. */
1211 + if (b43_debug(dev, B43_DBG_DMAVERBOSE))
1212 + b43err(dev->wl, "Packet after queue stopped\n");
1213 + err = -ENOSPC;
1214 + goto out_unlock;
1215 + }
1216 +
1217 + if (unlikely(WARN_ON(free_slots(ring) < TX_SLOTS_PER_FRAME))) {
1218 + /* If we get here, we have a real error with the queue
1219 + * full, but queues not stopped. */
1220 + b43err(dev->wl, "DMA queue overflow\n");
1221 err = -ENOSPC;
1222 goto out_unlock;
1223 }
1224 @@ -1350,7 +1366,11 @@ int b43_dma_tx(struct b43_wldev *dev, struct sk_buff *skb)
1225 * static, so we don't need to store it per frame. */
1226 ring->queue_prio = skb_get_queue_mapping(skb);
1227
1228 - err = dma_tx_fragment(ring, skb);
1229 + /* dma_tx_fragment might reallocate the skb, so invalidate pointers pointing
1230 + * into the skb data or cb now. */
1231 + hdr = NULL;
1232 + info = NULL;
1233 + err = dma_tx_fragment(ring, &skb);
1234 if (unlikely(err == -ENOKEY)) {
1235 /* Drop this packet, as we don't have the encryption key
1236 * anymore and must not transmit it unencrypted. */
1237 diff --git a/drivers/net/wireless/iwlwifi/iwl-1000.c b/drivers/net/wireless/iwlwifi/iwl-1000.c
1238 index d83d430..44baa60 100644
1239 --- a/drivers/net/wireless/iwlwifi/iwl-1000.c
1240 +++ b/drivers/net/wireless/iwlwifi/iwl-1000.c
1241 @@ -71,5 +71,6 @@ struct iwl_cfg iwl1000_bgn_cfg = {
1242 .need_pll_cfg = true,
1243 .max_ll_items = OTP_MAX_LL_ITEMS_1000,
1244 .shadow_ram_support = false,
1245 + .use_rts_for_ht = true, /* use rts/cts protection */
1246 };
1247
1248 diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c
1249 index e4a405f..ee7b48e 100644
1250 --- a/drivers/net/wireless/iwlwifi/iwl-6000.c
1251 +++ b/drivers/net/wireless/iwlwifi/iwl-6000.c
1252 @@ -109,6 +109,7 @@ struct iwl_cfg iwl6000_2agn_cfg = {
1253 .need_pll_cfg = false,
1254 .max_ll_items = OTP_MAX_LL_ITEMS_6x00,
1255 .shadow_ram_support = true,
1256 + .use_rts_for_ht = true, /* use rts/cts protection */
1257 };
1258
1259 struct iwl_cfg iwl6050_2agn_cfg = {
1260 @@ -127,6 +128,7 @@ struct iwl_cfg iwl6050_2agn_cfg = {
1261 .need_pll_cfg = false,
1262 .max_ll_items = OTP_MAX_LL_ITEMS_6x00,
1263 .shadow_ram_support = true,
1264 + .use_rts_for_ht = true, /* use rts/cts protection */
1265 };
1266
1267 struct iwl_cfg iwl6000_3agn_cfg = {
1268 @@ -145,6 +147,7 @@ struct iwl_cfg iwl6000_3agn_cfg = {
1269 .need_pll_cfg = false,
1270 .max_ll_items = OTP_MAX_LL_ITEMS_6x00,
1271 .shadow_ram_support = true,
1272 + .use_rts_for_ht = true, /* use rts/cts protection */
1273 };
1274
1275 struct iwl_cfg iwl6050_3agn_cfg = {
1276 @@ -163,6 +166,7 @@ struct iwl_cfg iwl6050_3agn_cfg = {
1277 .need_pll_cfg = false,
1278 .max_ll_items = OTP_MAX_LL_ITEMS_6x00,
1279 .shadow_ram_support = true,
1280 + .use_rts_for_ht = true, /* use rts/cts protection */
1281 };
1282
1283 MODULE_FIRMWARE(IWL6000_MODULE_FIRMWARE(IWL6000_UCODE_API_MAX));
1284 diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
1285 index ff20e50..f5c108b 100644
1286 --- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
1287 +++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
1288 @@ -415,6 +415,15 @@ static void rs_tl_turn_on_agg(struct iwl_priv *priv, u8 tid,
1289 else if (tid == IWL_AGG_ALL_TID)
1290 for (tid = 0; tid < TID_MAX_LOAD_COUNT; tid++)
1291 rs_tl_turn_on_agg_for_tid(priv, lq_data, tid, sta);
1292 + if (priv->cfg->use_rts_for_ht) {
1293 + /*
1294 + * switch to RTS/CTS if it is the prefer protection method
1295 + * for HT traffic
1296 + */
1297 + IWL_DEBUG_HT(priv, "use RTS/CTS protection for HT\n");
1298 + priv->staging_rxon.flags &= ~RXON_FLG_SELF_CTS_EN;
1299 + iwlcore_commit_rxon(priv);
1300 + }
1301 }
1302
1303 static inline int get_num_of_ant_from_rate(u32 rate_n_flags)
1304 diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
1305 index 2a577ae..fc33b29 100644
1306 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c
1307 +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
1308 @@ -115,9 +115,6 @@ int iwl_commit_rxon(struct iwl_priv *priv)
1309
1310 /* always get timestamp with Rx frame */
1311 priv->staging_rxon.flags |= RXON_FLG_TSF2HOST_MSK;
1312 - /* allow CTS-to-self if possible. this is relevant only for
1313 - * 5000, but will not damage 4965 */
1314 - priv->staging_rxon.flags |= RXON_FLG_SELF_CTS_EN;
1315
1316 ret = iwl_check_rxon_cmd(priv);
1317 if (ret) {
1318 @@ -217,6 +214,13 @@ int iwl_commit_rxon(struct iwl_priv *priv)
1319 "Could not send WEP static key.\n");
1320 }
1321
1322 + /*
1323 + * allow CTS-to-self if possible for new association.
1324 + * this is relevant only for 5000 series and up,
1325 + * but will not damage 4965
1326 + */
1327 + priv->staging_rxon.flags |= RXON_FLG_SELF_CTS_EN;
1328 +
1329 /* Apply the new configuration
1330 * RXON assoc doesn't clear the station table in uCode,
1331 */
1332 diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
1333 index 1e51891..4e616ec 100644
1334 --- a/drivers/net/wireless/iwlwifi/iwl-core.h
1335 +++ b/drivers/net/wireless/iwlwifi/iwl-core.h
1336 @@ -209,6 +209,7 @@ struct iwl_mod_params {
1337 * @ucode_api_min: Lowest version of uCode API supported by driver.
1338 * @max_ll_items: max number of OTP blocks
1339 * @shadow_ram_support: shadow support for OTP memory
1340 + * @use_rts_for_ht: use rts/cts protection for HT traffic
1341 *
1342 * We enable the driver to be backward compatible wrt API version. The
1343 * driver specifies which APIs it supports (with @ucode_api_max being the
1344 @@ -247,6 +248,7 @@ struct iwl_cfg {
1345 bool use_isr_legacy;
1346 const u16 max_ll_items;
1347 const bool shadow_ram_support;
1348 + bool use_rts_for_ht;
1349 };
1350
1351 /***************************
1352 diff --git a/drivers/net/wireless/iwlwifi/iwl-tx.c b/drivers/net/wireless/iwlwifi/iwl-tx.c
1353 index 2e89040..c17b8f9 100644
1354 --- a/drivers/net/wireless/iwlwifi/iwl-tx.c
1355 +++ b/drivers/net/wireless/iwlwifi/iwl-tx.c
1356 @@ -1233,8 +1233,16 @@ int iwl_tx_agg_stop(struct iwl_priv *priv , const u8 *ra, u16 tid)
1357 return -ENXIO;
1358 }
1359
1360 + if (priv->stations[sta_id].tid[tid].agg.state ==
1361 + IWL_EMPTYING_HW_QUEUE_ADDBA) {
1362 + IWL_DEBUG_HT(priv, "AGG stop before setup done\n");
1363 + ieee80211_stop_tx_ba_cb_irqsafe(priv->hw, ra, tid);
1364 + priv->stations[sta_id].tid[tid].agg.state = IWL_AGG_OFF;
1365 + return 0;
1366 + }
1367 +
1368 if (priv->stations[sta_id].tid[tid].agg.state != IWL_AGG_ON)
1369 - IWL_WARN(priv, "Stopping AGG while state not IWL_AGG_ON\n");
1370 + IWL_WARN(priv, "Stopping AGG while state not ON or starting\n");
1371
1372 tid_data = &priv->stations[sta_id].tid[tid];
1373 ssn = (tid_data->seq_number & IEEE80211_SCTL_SEQ) >> 4;
1374 diff --git a/drivers/net/wireless/rtl818x/rtl8187_leds.c b/drivers/net/wireless/rtl818x/rtl8187_leds.c
1375 index cf9f899..75648dd 100644
1376 --- a/drivers/net/wireless/rtl818x/rtl8187_leds.c
1377 +++ b/drivers/net/wireless/rtl818x/rtl8187_leds.c
1378 @@ -210,10 +210,10 @@ void rtl8187_leds_exit(struct ieee80211_hw *dev)
1379
1380 /* turn the LED off before exiting */
1381 queue_delayed_work(dev->workqueue, &priv->led_off, 0);
1382 - cancel_delayed_work_sync(&priv->led_off);
1383 - cancel_delayed_work_sync(&priv->led_on);
1384 rtl8187_unregister_led(&priv->led_rx);
1385 rtl8187_unregister_led(&priv->led_tx);
1386 + cancel_delayed_work_sync(&priv->led_off);
1387 + cancel_delayed_work_sync(&priv->led_on);
1388 }
1389 #endif /* def CONFIG_RTL8187_LED */
1390
1391 diff --git a/drivers/pci/pcie/aer/aerdrv.c b/drivers/pci/pcie/aer/aerdrv.c
1392 index 4770f13..e2504be 100644
1393 --- a/drivers/pci/pcie/aer/aerdrv.c
1394 +++ b/drivers/pci/pcie/aer/aerdrv.c
1395 @@ -52,7 +52,7 @@ static struct pci_error_handlers aer_error_handlers = {
1396
1397 static struct pcie_port_service_driver aerdriver = {
1398 .name = "aer",
1399 - .port_type = PCIE_ANY_PORT,
1400 + .port_type = PCIE_RC_PORT,
1401 .service = PCIE_PORT_SERVICE_AER,
1402
1403 .probe = aer_probe,
1404 diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c
1405 index bdfee17..ec13977 100644
1406 --- a/drivers/platform/x86/acerhdf.c
1407 +++ b/drivers/platform/x86/acerhdf.c
1408 @@ -52,7 +52,7 @@
1409 */
1410 #undef START_IN_KERNEL_MODE
1411
1412 -#define DRV_VER "0.5.13"
1413 +#define DRV_VER "0.5.16"
1414
1415 /*
1416 * According to the Atom N270 datasheet,
1417 @@ -61,7 +61,7 @@
1418 * measured by the on-die thermal monitor are within 0 <= Tj <= 90. So,
1419 * assume 89°C is critical temperature.
1420 */
1421 -#define ACERHDF_TEMP_CRIT 89
1422 +#define ACERHDF_TEMP_CRIT 89000
1423 #define ACERHDF_FAN_OFF 0
1424 #define ACERHDF_FAN_AUTO 1
1425
1426 @@ -69,7 +69,7 @@
1427 * No matter what value the user puts into the fanon variable, turn on the fan
1428 * at 80 degree Celsius to prevent hardware damage
1429 */
1430 -#define ACERHDF_MAX_FANON 80
1431 +#define ACERHDF_MAX_FANON 80000
1432
1433 /*
1434 * Maximum interval between two temperature checks is 15 seconds, as the die
1435 @@ -85,11 +85,12 @@ static int kernelmode;
1436 #endif
1437
1438 static unsigned int interval = 10;
1439 -static unsigned int fanon = 63;
1440 -static unsigned int fanoff = 58;
1441 +static unsigned int fanon = 63000;
1442 +static unsigned int fanoff = 58000;
1443 static unsigned int verbose;
1444 static unsigned int fanstate = ACERHDF_FAN_AUTO;
1445 static char force_bios[16];
1446 +static char force_product[16];
1447 static unsigned int prev_interval;
1448 struct thermal_zone_device *thz_dev;
1449 struct thermal_cooling_device *cl_dev;
1450 @@ -107,34 +108,62 @@ module_param(verbose, uint, 0600);
1451 MODULE_PARM_DESC(verbose, "Enable verbose dmesg output");
1452 module_param_string(force_bios, force_bios, 16, 0);
1453 MODULE_PARM_DESC(force_bios, "Force BIOS version and omit BIOS check");
1454 +module_param_string(force_product, force_product, 16, 0);
1455 +MODULE_PARM_DESC(force_product, "Force BIOS product and omit BIOS check");
1456 +
1457 +/*
1458 + * cmd_off: to switch the fan completely off / to check if the fan is off
1459 + * cmd_auto: to set the BIOS in control of the fan. The BIOS regulates then
1460 + * the fan speed depending on the temperature
1461 + */
1462 +struct fancmd {
1463 + u8 cmd_off;
1464 + u8 cmd_auto;
1465 +};
1466
1467 /* BIOS settings */
1468 struct bios_settings_t {
1469 const char *vendor;
1470 + const char *product;
1471 const char *version;
1472 unsigned char fanreg;
1473 unsigned char tempreg;
1474 - unsigned char fancmd[2]; /* fan off and auto commands */
1475 + struct fancmd cmd;
1476 };
1477
1478 /* Register addresses and values for different BIOS versions */
1479 static const struct bios_settings_t bios_tbl[] = {
1480 - {"Acer", "v0.3109", 0x55, 0x58, {0x1f, 0x00} },
1481 - {"Acer", "v0.3114", 0x55, 0x58, {0x1f, 0x00} },
1482 - {"Acer", "v0.3301", 0x55, 0x58, {0xaf, 0x00} },
1483 - {"Acer", "v0.3304", 0x55, 0x58, {0xaf, 0x00} },
1484 - {"Acer", "v0.3305", 0x55, 0x58, {0xaf, 0x00} },
1485 - {"Acer", "v0.3308", 0x55, 0x58, {0x21, 0x00} },
1486 - {"Acer", "v0.3309", 0x55, 0x58, {0x21, 0x00} },
1487 - {"Acer", "v0.3310", 0x55, 0x58, {0x21, 0x00} },
1488 - {"Gateway", "v0.3103", 0x55, 0x58, {0x21, 0x00} },
1489 - {"Packard Bell", "v0.3105", 0x55, 0x58, {0x21, 0x00} },
1490 - {"", "", 0, 0, {0, 0} }
1491 + /* AOA110 */
1492 + {"Acer", "AOA110", "v0.3109", 0x55, 0x58, {0x1f, 0x00} },
1493 + {"Acer", "AOA110", "v0.3114", 0x55, 0x58, {0x1f, 0x00} },
1494 + {"Acer", "AOA110", "v0.3301", 0x55, 0x58, {0xaf, 0x00} },
1495 + {"Acer", "AOA110", "v0.3304", 0x55, 0x58, {0xaf, 0x00} },
1496 + {"Acer", "AOA110", "v0.3305", 0x55, 0x58, {0xaf, 0x00} },
1497 + {"Acer", "AOA110", "v0.3307", 0x55, 0x58, {0xaf, 0x00} },
1498 + {"Acer", "AOA110", "v0.3308", 0x55, 0x58, {0x21, 0x00} },
1499 + {"Acer", "AOA110", "v0.3309", 0x55, 0x58, {0x21, 0x00} },
1500 + {"Acer", "AOA110", "v0.3310", 0x55, 0x58, {0x21, 0x00} },
1501 + /* AOA150 */
1502 + {"Acer", "AOA150", "v0.3114", 0x55, 0x58, {0x20, 0x00} },
1503 + {"Acer", "AOA150", "v0.3301", 0x55, 0x58, {0x20, 0x00} },
1504 + {"Acer", "AOA150", "v0.3304", 0x55, 0x58, {0x20, 0x00} },
1505 + {"Acer", "AOA150", "v0.3305", 0x55, 0x58, {0x20, 0x00} },
1506 + {"Acer", "AOA150", "v0.3307", 0x55, 0x58, {0x20, 0x00} },
1507 + {"Acer", "AOA150", "v0.3308", 0x55, 0x58, {0x20, 0x00} },
1508 + {"Acer", "AOA150", "v0.3309", 0x55, 0x58, {0x20, 0x00} },
1509 + {"Acer", "AOA150", "v0.3310", 0x55, 0x58, {0x20, 0x00} },
1510 + /* special BIOS / other */
1511 + {"Gateway", "AOA110", "v0.3103", 0x55, 0x58, {0x21, 0x00} },
1512 + {"Gateway", "AOA150", "v0.3103", 0x55, 0x58, {0x20, 0x00} },
1513 + {"Packard Bell", "DOA150", "v0.3104", 0x55, 0x58, {0x21, 0x00} },
1514 + {"Packard Bell", "AOA110", "v0.3105", 0x55, 0x58, {0x21, 0x00} },
1515 + {"Packard Bell", "AOA150", "v0.3105", 0x55, 0x58, {0x20, 0x00} },
1516 + /* pewpew-terminator */
1517 + {"", "", "", 0, 0, {0, 0} }
1518 };
1519
1520 static const struct bios_settings_t *bios_cfg __read_mostly;
1521
1522 -
1523 static int acerhdf_get_temp(int *temp)
1524 {
1525 u8 read_temp;
1526 @@ -142,7 +171,7 @@ static int acerhdf_get_temp(int *temp)
1527 if (ec_read(bios_cfg->tempreg, &read_temp))
1528 return -EINVAL;
1529
1530 - *temp = read_temp;
1531 + *temp = read_temp * 1000;
1532
1533 return 0;
1534 }
1535 @@ -150,13 +179,14 @@ static int acerhdf_get_temp(int *temp)
1536 static int acerhdf_get_fanstate(int *state)
1537 {
1538 u8 fan;
1539 - bool tmp;
1540
1541 if (ec_read(bios_cfg->fanreg, &fan))
1542 return -EINVAL;
1543
1544 - tmp = (fan == bios_cfg->fancmd[ACERHDF_FAN_OFF]);
1545 - *state = tmp ? ACERHDF_FAN_OFF : ACERHDF_FAN_AUTO;
1546 + if (fan != bios_cfg->cmd.cmd_off)
1547 + *state = ACERHDF_FAN_AUTO;
1548 + else
1549 + *state = ACERHDF_FAN_OFF;
1550
1551 return 0;
1552 }
1553 @@ -175,7 +205,8 @@ static void acerhdf_change_fanstate(int state)
1554 state = ACERHDF_FAN_AUTO;
1555 }
1556
1557 - cmd = bios_cfg->fancmd[state];
1558 + cmd = (state == ACERHDF_FAN_OFF) ? bios_cfg->cmd.cmd_off
1559 + : bios_cfg->cmd.cmd_auto;
1560 fanstate = state;
1561
1562 ec_write(bios_cfg->fanreg, cmd);
1563 @@ -437,7 +468,7 @@ static int acerhdf_remove(struct platform_device *device)
1564 return 0;
1565 }
1566
1567 -struct platform_driver acerhdf_drv = {
1568 +static struct platform_driver acerhdf_driver = {
1569 .driver = {
1570 .name = "acerhdf",
1571 .owner = THIS_MODULE,
1572 @@ -454,32 +485,40 @@ static int acerhdf_check_hardware(void)
1573 {
1574 char const *vendor, *version, *product;
1575 int i;
1576 + unsigned long prod_len = 0;
1577
1578 /* get BIOS data */
1579 vendor = dmi_get_system_info(DMI_SYS_VENDOR);
1580 version = dmi_get_system_info(DMI_BIOS_VERSION);
1581 product = dmi_get_system_info(DMI_PRODUCT_NAME);
1582
1583 +
1584 pr_info("Acer Aspire One Fan driver, v.%s\n", DRV_VER);
1585
1586 - if (!force_bios[0]) {
1587 - if (strncmp(product, "AO", 2)) {
1588 - pr_err("no Aspire One hardware found\n");
1589 - return -EINVAL;
1590 - }
1591 - } else {
1592 - pr_info("forcing BIOS version: %s\n", version);
1593 + if (force_bios[0]) {
1594 version = force_bios;
1595 + pr_info("forcing BIOS version: %s\n", version);
1596 kernelmode = 0;
1597 }
1598
1599 + if (force_product[0]) {
1600 + product = force_product;
1601 + pr_info("forcing BIOS product: %s\n", product);
1602 + kernelmode = 0;
1603 + }
1604 +
1605 + prod_len = strlen(product);
1606 +
1607 if (verbose)
1608 pr_info("BIOS info: %s %s, product: %s\n",
1609 vendor, version, product);
1610
1611 /* search BIOS version and vendor in BIOS settings table */
1612 for (i = 0; bios_tbl[i].version[0]; i++) {
1613 - if (!strcmp(bios_tbl[i].vendor, vendor) &&
1614 + if (strlen(bios_tbl[i].product) >= prod_len &&
1615 + !strncmp(bios_tbl[i].product, product,
1616 + strlen(bios_tbl[i].product)) &&
1617 + !strcmp(bios_tbl[i].vendor, vendor) &&
1618 !strcmp(bios_tbl[i].version, version)) {
1619 bios_cfg = &bios_tbl[i];
1620 break;
1621 @@ -487,8 +526,8 @@ static int acerhdf_check_hardware(void)
1622 }
1623
1624 if (!bios_cfg) {
1625 - pr_err("unknown (unsupported) BIOS version %s/%s, "
1626 - "please report, aborting!\n", vendor, version);
1627 + pr_err("unknown (unsupported) BIOS version %s/%s/%s, "
1628 + "please report, aborting!\n", vendor, product, version);
1629 return -EINVAL;
1630 }
1631
1632 @@ -509,7 +548,7 @@ static int acerhdf_register_platform(void)
1633 {
1634 int err = 0;
1635
1636 - err = platform_driver_register(&acerhdf_drv);
1637 + err = platform_driver_register(&acerhdf_driver);
1638 if (err)
1639 return err;
1640
1641 @@ -525,7 +564,7 @@ static void acerhdf_unregister_platform(void)
1642 return;
1643
1644 platform_device_del(acerhdf_dev);
1645 - platform_driver_unregister(&acerhdf_drv);
1646 + platform_driver_unregister(&acerhdf_driver);
1647 }
1648
1649 static int acerhdf_register_thermal(void)
1650 diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
1651 index d287283..e5a7eab 100644
1652 --- a/drivers/platform/x86/thinkpad_acpi.c
1653 +++ b/drivers/platform/x86/thinkpad_acpi.c
1654 @@ -5863,7 +5863,7 @@ static int brightness_write(char *buf)
1655 * Doing it this way makes the syscall restartable in case of EINTR
1656 */
1657 rc = brightness_set(level);
1658 - return (rc == -EINTR)? ERESTARTSYS : rc;
1659 + return (rc == -EINTR)? -ERESTARTSYS : rc;
1660 }
1661
1662 static struct ibm_struct brightness_driver_data = {
1663 diff --git a/drivers/pps/kapi.c b/drivers/pps/kapi.c
1664 index 35a0b19..2d414e2 100644
1665 --- a/drivers/pps/kapi.c
1666 +++ b/drivers/pps/kapi.c
1667 @@ -271,6 +271,7 @@ void pps_event(int source, struct pps_ktime *ts, int event, void *data)
1668 {
1669 struct pps_device *pps;
1670 unsigned long flags;
1671 + int captured = 0;
1672
1673 if ((event & (PPS_CAPTUREASSERT | PPS_CAPTURECLEAR)) == 0) {
1674 printk(KERN_ERR "pps: unknown event (%x) for source %d\n",
1675 @@ -293,7 +294,8 @@ void pps_event(int source, struct pps_ktime *ts, int event, void *data)
1676
1677 /* Check the event */
1678 pps->current_mode = pps->params.mode;
1679 - if (event & PPS_CAPTUREASSERT) {
1680 + if ((event & PPS_CAPTUREASSERT) &
1681 + (pps->params.mode & PPS_CAPTUREASSERT)) {
1682 /* We have to add an offset? */
1683 if (pps->params.mode & PPS_OFFSETASSERT)
1684 pps_add_offset(ts, &pps->params.assert_off_tu);
1685 @@ -303,8 +305,11 @@ void pps_event(int source, struct pps_ktime *ts, int event, void *data)
1686 pps->assert_sequence++;
1687 pr_debug("capture assert seq #%u for source %d\n",
1688 pps->assert_sequence, source);
1689 +
1690 + captured = ~0;
1691 }
1692 - if (event & PPS_CAPTURECLEAR) {
1693 + if ((event & PPS_CAPTURECLEAR) &
1694 + (pps->params.mode & PPS_CAPTURECLEAR)) {
1695 /* We have to add an offset? */
1696 if (pps->params.mode & PPS_OFFSETCLEAR)
1697 pps_add_offset(ts, &pps->params.clear_off_tu);
1698 @@ -314,12 +319,17 @@ void pps_event(int source, struct pps_ktime *ts, int event, void *data)
1699 pps->clear_sequence++;
1700 pr_debug("capture clear seq #%u for source %d\n",
1701 pps->clear_sequence, source);
1702 +
1703 + captured = ~0;
1704 }
1705
1706 - pps->go = ~0;
1707 - wake_up_interruptible(&pps->queue);
1708 + /* Wake up iif captured somthing */
1709 + if (captured) {
1710 + pps->go = ~0;
1711 + wake_up_interruptible(&pps->queue);
1712
1713 - kill_fasync(&pps->async_queue, SIGIO, POLL_IN);
1714 + kill_fasync(&pps->async_queue, SIGIO, POLL_IN);
1715 + }
1716
1717 spin_unlock_irqrestore(&pps->lock, flags);
1718
1719 diff --git a/drivers/pps/pps.c b/drivers/pps/pps.c
1720 index fea17e7..ca5183b 100644
1721 --- a/drivers/pps/pps.c
1722 +++ b/drivers/pps/pps.c
1723 @@ -71,9 +71,14 @@ static long pps_cdev_ioctl(struct file *file,
1724 case PPS_GETPARAMS:
1725 pr_debug("PPS_GETPARAMS: source %d\n", pps->id);
1726
1727 - /* Return current parameters */
1728 - err = copy_to_user(uarg, &pps->params,
1729 - sizeof(struct pps_kparams));
1730 + spin_lock_irq(&pps->lock);
1731 +
1732 + /* Get the current parameters */
1733 + params = pps->params;
1734 +
1735 + spin_unlock_irq(&pps->lock);
1736 +
1737 + err = copy_to_user(uarg, &params, sizeof(struct pps_kparams));
1738 if (err)
1739 return -EFAULT;
1740
1741 diff --git a/drivers/rtc/rtc-v3020.c b/drivers/rtc/rtc-v3020.c
1742 index ad16405..423cd5a 100644
1743 --- a/drivers/rtc/rtc-v3020.c
1744 +++ b/drivers/rtc/rtc-v3020.c
1745 @@ -96,7 +96,7 @@ static void v3020_mmio_write_bit(struct v3020 *chip, unsigned char bit)
1746
1747 static unsigned char v3020_mmio_read_bit(struct v3020 *chip)
1748 {
1749 - return readl(chip->ioaddress) & (1 << chip->leftshift);
1750 + return !!(readl(chip->ioaddress) & (1 << chip->leftshift));
1751 }
1752
1753 static struct v3020_chip_ops v3020_mmio_ops = {
1754 diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c
1755 index 185e6bc..9e8fce0 100644
1756 --- a/drivers/scsi/gdth.c
1757 +++ b/drivers/scsi/gdth.c
1758 @@ -2900,7 +2900,7 @@ static int gdth_read_event(gdth_ha_str *ha, int handle, gdth_evt_str *estr)
1759 eindex = handle;
1760 estr->event_source = 0;
1761
1762 - if (eindex >= MAX_EVENTS) {
1763 + if (eindex < 0 || eindex >= MAX_EVENTS) {
1764 spin_unlock_irqrestore(&ha->smp_lock, flags);
1765 return eindex;
1766 }
1767 diff --git a/drivers/serial/of_serial.c b/drivers/serial/of_serial.c
1768 index 02406ba..cdf172e 100644
1769 --- a/drivers/serial/of_serial.c
1770 +++ b/drivers/serial/of_serial.c
1771 @@ -161,6 +161,7 @@ static int of_platform_serial_remove(struct of_device *ofdev)
1772 static struct of_device_id __devinitdata of_platform_serial_table[] = {
1773 { .type = "serial", .compatible = "ns8250", .data = (void *)PORT_8250, },
1774 { .type = "serial", .compatible = "ns16450", .data = (void *)PORT_16450, },
1775 + { .type = "serial", .compatible = "ns16550a", .data = (void *)PORT_16550A, },
1776 { .type = "serial", .compatible = "ns16550", .data = (void *)PORT_16550, },
1777 { .type = "serial", .compatible = "ns16750", .data = (void *)PORT_16750, },
1778 { .type = "serial", .compatible = "ns16850", .data = (void *)PORT_16850, },
1779 diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
1780 index e3861b2..b72fa49 100644
1781 --- a/drivers/usb/class/cdc-acm.c
1782 +++ b/drivers/usb/class/cdc-acm.c
1783 @@ -609,9 +609,9 @@ static int acm_tty_open(struct tty_struct *tty, struct file *filp)
1784
1785 acm->throttle = 0;
1786
1787 - tasklet_schedule(&acm->urb_task);
1788 set_bit(ASYNCB_INITIALIZED, &acm->port.flags);
1789 rv = tty_port_block_til_ready(&acm->port, tty, filp);
1790 + tasklet_schedule(&acm->urb_task);
1791 done:
1792 mutex_unlock(&acm->mutex);
1793 err_out:
1794 diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
1795 index 71f86c6..b41989e 100644
1796 --- a/drivers/usb/core/hub.c
1797 +++ b/drivers/usb/core/hub.c
1798 @@ -439,7 +439,7 @@ resubmit:
1799 static inline int
1800 hub_clear_tt_buffer (struct usb_device *hdev, u16 devinfo, u16 tt)
1801 {
1802 - return usb_control_msg(hdev, usb_rcvctrlpipe(hdev, 0),
1803 + return usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0),
1804 HUB_CLEAR_TT_BUFFER, USB_RT_PORT, devinfo,
1805 tt, NULL, 0, 1000);
1806 }
1807 diff --git a/drivers/usb/gadget/amd5536udc.c b/drivers/usb/gadget/amd5536udc.c
1808 index 77352cc..fb09766 100644
1809 --- a/drivers/usb/gadget/amd5536udc.c
1810 +++ b/drivers/usb/gadget/amd5536udc.c
1811 @@ -1213,7 +1213,12 @@ udc_queue(struct usb_ep *usbep, struct usb_request *usbreq, gfp_t gfp)
1812 tmp &= AMD_UNMASK_BIT(ep->num);
1813 writel(tmp, &dev->regs->ep_irqmsk);
1814 }
1815 - }
1816 + } else if (ep->in) {
1817 + /* enable ep irq */
1818 + tmp = readl(&dev->regs->ep_irqmsk);
1819 + tmp &= AMD_UNMASK_BIT(ep->num);
1820 + writel(tmp, &dev->regs->ep_irqmsk);
1821 + }
1822
1823 } else if (ep->dma) {
1824
1825 @@ -2005,18 +2010,17 @@ __acquires(dev->lock)
1826 {
1827 int tmp;
1828
1829 - /* empty queues and init hardware */
1830 - udc_basic_init(dev);
1831 - for (tmp = 0; tmp < UDC_EP_NUM; tmp++) {
1832 - empty_req_queue(&dev->ep[tmp]);
1833 - }
1834 -
1835 if (dev->gadget.speed != USB_SPEED_UNKNOWN) {
1836 spin_unlock(&dev->lock);
1837 driver->disconnect(&dev->gadget);
1838 spin_lock(&dev->lock);
1839 }
1840 - /* init */
1841 +
1842 + /* empty queues and init hardware */
1843 + udc_basic_init(dev);
1844 + for (tmp = 0; tmp < UDC_EP_NUM; tmp++)
1845 + empty_req_queue(&dev->ep[tmp]);
1846 +
1847 udc_setup_endpoints(dev);
1848 }
1849
1850 @@ -2478,6 +2482,13 @@ static irqreturn_t udc_data_in_isr(struct udc *dev, int ep_ix)
1851 }
1852 }
1853
1854 + } else if (!use_dma && ep->in) {
1855 + /* disable interrupt */
1856 + tmp = readl(
1857 + &dev->regs->ep_irqmsk);
1858 + tmp |= AMD_BIT(ep->num);
1859 + writel(tmp,
1860 + &dev->regs->ep_irqmsk);
1861 }
1862 }
1863 /* clear status bits */
1864 @@ -3285,6 +3296,17 @@ static int udc_pci_probe(
1865 goto finished;
1866 }
1867
1868 + spin_lock_init(&dev->lock);
1869 + /* udc csr registers base */
1870 + dev->csr = dev->virt_addr + UDC_CSR_ADDR;
1871 + /* dev registers base */
1872 + dev->regs = dev->virt_addr + UDC_DEVCFG_ADDR;
1873 + /* ep registers base */
1874 + dev->ep_regs = dev->virt_addr + UDC_EPREGS_ADDR;
1875 + /* fifo's base */
1876 + dev->rxfifo = (u32 __iomem *)(dev->virt_addr + UDC_RXFIFO_ADDR);
1877 + dev->txfifo = (u32 __iomem *)(dev->virt_addr + UDC_TXFIFO_ADDR);
1878 +
1879 if (request_irq(pdev->irq, udc_irq, IRQF_SHARED, name, dev) != 0) {
1880 dev_dbg(&dev->pdev->dev, "request_irq(%d) fail\n", pdev->irq);
1881 kfree(dev);
1882 @@ -3337,7 +3359,6 @@ static int udc_probe(struct udc *dev)
1883 udc_pollstall_timer.data = 0;
1884
1885 /* device struct setup */
1886 - spin_lock_init(&dev->lock);
1887 dev->gadget.ops = &udc_ops;
1888
1889 dev_set_name(&dev->gadget.dev, "gadget");
1890 @@ -3346,16 +3367,6 @@ static int udc_probe(struct udc *dev)
1891 dev->gadget.name = name;
1892 dev->gadget.is_dualspeed = 1;
1893
1894 - /* udc csr registers base */
1895 - dev->csr = dev->virt_addr + UDC_CSR_ADDR;
1896 - /* dev registers base */
1897 - dev->regs = dev->virt_addr + UDC_DEVCFG_ADDR;
1898 - /* ep registers base */
1899 - dev->ep_regs = dev->virt_addr + UDC_EPREGS_ADDR;
1900 - /* fifo's base */
1901 - dev->rxfifo = (u32 __iomem *)(dev->virt_addr + UDC_RXFIFO_ADDR);
1902 - dev->txfifo = (u32 __iomem *)(dev->virt_addr + UDC_TXFIFO_ADDR);
1903 -
1904 /* init registers, interrupts, ... */
1905 startup_registers(dev);
1906
1907 diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
1908 index 11c627c..7e4b381 100644
1909 --- a/drivers/usb/host/ehci-hcd.c
1910 +++ b/drivers/usb/host/ehci-hcd.c
1911 @@ -28,6 +28,7 @@
1912 #include <linux/errno.h>
1913 #include <linux/init.h>
1914 #include <linux/timer.h>
1915 +#include <linux/ktime.h>
1916 #include <linux/list.h>
1917 #include <linux/interrupt.h>
1918 #include <linux/reboot.h>
1919 @@ -655,6 +656,7 @@ static int ehci_run (struct usb_hcd *hcd)
1920 ehci_readl(ehci, &ehci->regs->command); /* unblock posted writes */
1921 msleep(5);
1922 up_write(&ehci_cf_port_reset_rwsem);
1923 + ehci->last_periodic_enable = ktime_get_real();
1924
1925 temp = HC_VERSION(ehci_readl(ehci, &ehci->caps->hc_capbase));
1926 ehci_info (ehci,
1927 diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c
1928 index c2f1b7d..c757a70 100644
1929 --- a/drivers/usb/host/ehci-pci.c
1930 +++ b/drivers/usb/host/ehci-pci.c
1931 @@ -72,6 +72,12 @@ static int ehci_pci_setup(struct usb_hcd *hcd)
1932 int retval;
1933
1934 switch (pdev->vendor) {
1935 + case PCI_VENDOR_ID_INTEL:
1936 + if (pdev->device == 0x27cc) {
1937 + ehci->broken_periodic = 1;
1938 + ehci_info(ehci, "using broken periodic workaround\n");
1939 + }
1940 + break;
1941 case PCI_VENDOR_ID_TOSHIBA_2:
1942 /* celleb's companion chip */
1943 if (pdev->device == 0x01b5) {
1944 diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c
1945 index 7673554..6b6c240 100644
1946 --- a/drivers/usb/host/ehci-q.c
1947 +++ b/drivers/usb/host/ehci-q.c
1948 @@ -475,8 +475,20 @@ halt:
1949 * we must clear the TT buffer (11.17.5).
1950 */
1951 if (unlikely(last_status != -EINPROGRESS &&
1952 - last_status != -EREMOTEIO))
1953 - ehci_clear_tt_buffer(ehci, qh, urb, token);
1954 + last_status != -EREMOTEIO)) {
1955 + /* The TT's in some hubs malfunction when they
1956 + * receive this request following a STALL (they
1957 + * stop sending isochronous packets). Since a
1958 + * STALL can't leave the TT buffer in a busy
1959 + * state (if you believe Figures 11-48 - 11-51
1960 + * in the USB 2.0 spec), we won't clear the TT
1961 + * buffer in this case. Strictly speaking this
1962 + * is a violation of the spec.
1963 + */
1964 + if (last_status != -EPIPE)
1965 + ehci_clear_tt_buffer(ehci, qh, urb,
1966 + token);
1967 + }
1968 }
1969
1970 /* if we're removing something not at the queue head,
1971 diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c
1972 index edd61ee..c340f1f 100644
1973 --- a/drivers/usb/host/ehci-sched.c
1974 +++ b/drivers/usb/host/ehci-sched.c
1975 @@ -456,6 +456,8 @@ static int enable_periodic (struct ehci_hcd *ehci)
1976 /* make sure ehci_work scans these */
1977 ehci->next_uframe = ehci_readl(ehci, &ehci->regs->frame_index)
1978 % (ehci->periodic_size << 3);
1979 + if (unlikely(ehci->broken_periodic))
1980 + ehci->last_periodic_enable = ktime_get_real();
1981 return 0;
1982 }
1983
1984 @@ -467,6 +469,16 @@ static int disable_periodic (struct ehci_hcd *ehci)
1985 if (--ehci->periodic_sched)
1986 return 0;
1987
1988 + if (unlikely(ehci->broken_periodic)) {
1989 + /* delay experimentally determined */
1990 + ktime_t safe = ktime_add_us(ehci->last_periodic_enable, 1000);
1991 + ktime_t now = ktime_get_real();
1992 + s64 delay = ktime_us_delta(safe, now);
1993 +
1994 + if (unlikely(delay > 0))
1995 + udelay(delay);
1996 + }
1997 +
1998 /* did setting PSE not take effect yet?
1999 * takes effect only at frame boundaries...
2000 */
2001 diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
2002 index 2bfff30..aab3cbc 100644
2003 --- a/drivers/usb/host/ehci.h
2004 +++ b/drivers/usb/host/ehci.h
2005 @@ -118,6 +118,7 @@ struct ehci_hcd { /* one per controller */
2006 unsigned stamp;
2007 unsigned random_frame;
2008 unsigned long next_statechange;
2009 + ktime_t last_periodic_enable;
2010 u32 command;
2011
2012 /* SILICON QUIRKS */
2013 @@ -126,6 +127,7 @@ struct ehci_hcd { /* one per controller */
2014 unsigned big_endian_mmio:1;
2015 unsigned big_endian_desc:1;
2016 unsigned has_amcc_usb23:1;
2017 + unsigned broken_periodic:1;
2018
2019 /* required for usb32 quirk */
2020 #define OHCI_CTRL_HCFS (3 << 6)
2021 diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
2022 index 5815168..1ed2a16 100644
2023 --- a/drivers/usb/host/ohci-hcd.c
2024 +++ b/drivers/usb/host/ohci-hcd.c
2025 @@ -88,6 +88,7 @@ static int ohci_restart (struct ohci_hcd *ohci);
2026 #ifdef CONFIG_PCI
2027 static void quirk_amd_pll(int state);
2028 static void amd_iso_dev_put(void);
2029 +static void sb800_prefetch(struct ohci_hcd *ohci, int on);
2030 #else
2031 static inline void quirk_amd_pll(int state)
2032 {
2033 @@ -97,6 +98,10 @@ static inline void amd_iso_dev_put(void)
2034 {
2035 return;
2036 }
2037 +static inline void sb800_prefetch(struct ohci_hcd *ohci, int on)
2038 +{
2039 + return;
2040 +}
2041 #endif
2042
2043
2044 diff --git a/drivers/usb/host/ohci-pci.c b/drivers/usb/host/ohci-pci.c
2045 index d2ba04d..b8a1148 100644
2046 --- a/drivers/usb/host/ohci-pci.c
2047 +++ b/drivers/usb/host/ohci-pci.c
2048 @@ -177,6 +177,13 @@ static int ohci_quirk_amd700(struct usb_hcd *hcd)
2049 return 0;
2050
2051 pci_read_config_byte(amd_smbus_dev, PCI_REVISION_ID, &rev);
2052 +
2053 + /* SB800 needs pre-fetch fix */
2054 + if ((rev >= 0x40) && (rev <= 0x4f)) {
2055 + ohci->flags |= OHCI_QUIRK_AMD_PREFETCH;
2056 + ohci_dbg(ohci, "enabled AMD prefetch quirk\n");
2057 + }
2058 +
2059 if ((rev > 0x3b) || (rev < 0x30)) {
2060 pci_dev_put(amd_smbus_dev);
2061 amd_smbus_dev = NULL;
2062 @@ -262,6 +269,19 @@ static void amd_iso_dev_put(void)
2063
2064 }
2065
2066 +static void sb800_prefetch(struct ohci_hcd *ohci, int on)
2067 +{
2068 + struct pci_dev *pdev;
2069 + u16 misc;
2070 +
2071 + pdev = to_pci_dev(ohci_to_hcd(ohci)->self.controller);
2072 + pci_read_config_word(pdev, 0x50, &misc);
2073 + if (on == 0)
2074 + pci_write_config_word(pdev, 0x50, misc & 0xfcff);
2075 + else
2076 + pci_write_config_word(pdev, 0x50, misc | 0x0300);
2077 +}
2078 +
2079 /* List of quirks for OHCI */
2080 static const struct pci_device_id ohci_pci_quirks[] = {
2081 {
2082 diff --git a/drivers/usb/host/ohci-q.c b/drivers/usb/host/ohci-q.c
2083 index c2d80f8..2c7409b 100644
2084 --- a/drivers/usb/host/ohci-q.c
2085 +++ b/drivers/usb/host/ohci-q.c
2086 @@ -49,9 +49,12 @@ __acquires(ohci->lock)
2087 switch (usb_pipetype (urb->pipe)) {
2088 case PIPE_ISOCHRONOUS:
2089 ohci_to_hcd(ohci)->self.bandwidth_isoc_reqs--;
2090 - if (ohci_to_hcd(ohci)->self.bandwidth_isoc_reqs == 0
2091 - && quirk_amdiso(ohci))
2092 - quirk_amd_pll(1);
2093 + if (ohci_to_hcd(ohci)->self.bandwidth_isoc_reqs == 0) {
2094 + if (quirk_amdiso(ohci))
2095 + quirk_amd_pll(1);
2096 + if (quirk_amdprefetch(ohci))
2097 + sb800_prefetch(ohci, 0);
2098 + }
2099 break;
2100 case PIPE_INTERRUPT:
2101 ohci_to_hcd(ohci)->self.bandwidth_int_reqs--;
2102 @@ -680,9 +683,12 @@ static void td_submit_urb (
2103 data + urb->iso_frame_desc [cnt].offset,
2104 urb->iso_frame_desc [cnt].length, urb, cnt);
2105 }
2106 - if (ohci_to_hcd(ohci)->self.bandwidth_isoc_reqs == 0
2107 - && quirk_amdiso(ohci))
2108 - quirk_amd_pll(0);
2109 + if (ohci_to_hcd(ohci)->self.bandwidth_isoc_reqs == 0) {
2110 + if (quirk_amdiso(ohci))
2111 + quirk_amd_pll(0);
2112 + if (quirk_amdprefetch(ohci))
2113 + sb800_prefetch(ohci, 1);
2114 + }
2115 periodic = ohci_to_hcd(ohci)->self.bandwidth_isoc_reqs++ == 0
2116 && ohci_to_hcd(ohci)->self.bandwidth_int_reqs == 0;
2117 break;
2118 diff --git a/drivers/usb/host/ohci.h b/drivers/usb/host/ohci.h
2119 index 222011f..5bf15fe 100644
2120 --- a/drivers/usb/host/ohci.h
2121 +++ b/drivers/usb/host/ohci.h
2122 @@ -402,6 +402,7 @@ struct ohci_hcd {
2123 #define OHCI_QUIRK_FRAME_NO 0x80 /* no big endian frame_no shift */
2124 #define OHCI_QUIRK_HUB_POWER 0x100 /* distrust firmware power/oc setup */
2125 #define OHCI_QUIRK_AMD_ISO 0x200 /* ISO transfers*/
2126 +#define OHCI_QUIRK_AMD_PREFETCH 0x400 /* pre-fetch for ISO transfer */
2127 // there are also chip quirks/bugs in init logic
2128
2129 struct work_struct nec_work; /* Worker for NEC quirk */
2130 @@ -433,6 +434,10 @@ static inline int quirk_amdiso(struct ohci_hcd *ohci)
2131 {
2132 return ohci->flags & OHCI_QUIRK_AMD_ISO;
2133 }
2134 +static inline int quirk_amdprefetch(struct ohci_hcd *ohci)
2135 +{
2136 + return ohci->flags & OHCI_QUIRK_AMD_PREFETCH;
2137 +}
2138 #else
2139 static inline int quirk_nec(struct ohci_hcd *ohci)
2140 {
2141 @@ -446,6 +451,10 @@ static inline int quirk_amdiso(struct ohci_hcd *ohci)
2142 {
2143 return 0;
2144 }
2145 +static inline int quirk_amdprefetch(struct ohci_hcd *ohci)
2146 +{
2147 + return 0;
2148 +}
2149 #endif
2150
2151 /* convert between an hcd pointer and the corresponding ohci_hcd */
2152 diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
2153 index 55920b3..2114648 100644
2154 --- a/drivers/usb/host/xhci-mem.c
2155 +++ b/drivers/usb/host/xhci-mem.c
2156 @@ -756,9 +756,11 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci)
2157 int i;
2158
2159 /* Free the Event Ring Segment Table and the actual Event Ring */
2160 - xhci_writel(xhci, 0, &xhci->ir_set->erst_size);
2161 - xhci_write_64(xhci, 0, &xhci->ir_set->erst_base);
2162 - xhci_write_64(xhci, 0, &xhci->ir_set->erst_dequeue);
2163 + if (xhci->ir_set) {
2164 + xhci_writel(xhci, 0, &xhci->ir_set->erst_size);
2165 + xhci_write_64(xhci, 0, &xhci->ir_set->erst_base);
2166 + xhci_write_64(xhci, 0, &xhci->ir_set->erst_dequeue);
2167 + }
2168 size = sizeof(struct xhci_erst_entry)*(xhci->erst.num_entries);
2169 if (xhci->erst.entries)
2170 pci_free_consistent(pdev, size,
2171 @@ -795,9 +797,9 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci)
2172 xhci->dcbaa, xhci->dcbaa->dma);
2173 xhci->dcbaa = NULL;
2174
2175 + scratchpad_free(xhci);
2176 xhci->page_size = 0;
2177 xhci->page_shift = 0;
2178 - scratchpad_free(xhci);
2179 }
2180
2181 int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags)
2182 diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
2183 index ff5e6bc..9874d9a 100644
2184 --- a/drivers/usb/host/xhci-ring.c
2185 +++ b/drivers/usb/host/xhci-ring.c
2186 @@ -822,9 +822,11 @@ static struct xhci_segment *trb_in_td(
2187 cur_seg = start_seg;
2188
2189 do {
2190 + if (start_dma == 0)
2191 + return 0;
2192 /* We may get an event for a Link TRB in the middle of a TD */
2193 end_seg_dma = xhci_trb_virt_to_dma(cur_seg,
2194 - &start_seg->trbs[TRBS_PER_SEGMENT - 1]);
2195 + &cur_seg->trbs[TRBS_PER_SEGMENT - 1]);
2196 /* If the end TRB isn't in this segment, this is set to 0 */
2197 end_trb_dma = xhci_trb_virt_to_dma(cur_seg, end_trb);
2198
2199 @@ -851,8 +853,9 @@ static struct xhci_segment *trb_in_td(
2200 }
2201 cur_seg = cur_seg->next;
2202 start_dma = xhci_trb_virt_to_dma(cur_seg, &cur_seg->trbs[0]);
2203 - } while (1);
2204 + } while (cur_seg != start_seg);
2205
2206 + return 0;
2207 }
2208
2209 /*
2210 diff --git a/drivers/usb/mon/mon_bin.c b/drivers/usb/mon/mon_bin.c
2211 index 0f7a30b..fb1dd27 100644
2212 --- a/drivers/usb/mon/mon_bin.c
2213 +++ b/drivers/usb/mon/mon_bin.c
2214 @@ -350,12 +350,12 @@ static unsigned int mon_buff_area_alloc_contiguous(struct mon_reader_bin *rp,
2215
2216 /*
2217 * Return a few (kilo-)bytes to the head of the buffer.
2218 - * This is used if a DMA fetch fails.
2219 + * This is used if a data fetch fails.
2220 */
2221 static void mon_buff_area_shrink(struct mon_reader_bin *rp, unsigned int size)
2222 {
2223
2224 - size = (size + PKT_ALIGN-1) & ~(PKT_ALIGN-1);
2225 + /* size &= ~(PKT_ALIGN-1); -- we're called with aligned size */
2226 rp->b_cnt -= size;
2227 if (rp->b_in < size)
2228 rp->b_in += rp->b_size;
2229 @@ -442,6 +442,7 @@ static void mon_bin_event(struct mon_reader_bin *rp, struct urb *urb,
2230 unsigned int urb_length;
2231 unsigned int offset;
2232 unsigned int length;
2233 + unsigned int delta;
2234 unsigned int ndesc, lendesc;
2235 unsigned char dir;
2236 struct mon_bin_hdr *ep;
2237 @@ -546,8 +547,10 @@ static void mon_bin_event(struct mon_reader_bin *rp, struct urb *urb,
2238 if (length != 0) {
2239 ep->flag_data = mon_bin_get_data(rp, offset, urb, length);
2240 if (ep->flag_data != 0) { /* Yes, it's 0x00, not '0' */
2241 - ep->len_cap = 0;
2242 - mon_buff_area_shrink(rp, length);
2243 + delta = (ep->len_cap + PKT_ALIGN-1) & ~(PKT_ALIGN-1);
2244 + ep->len_cap -= length;
2245 + delta -= (ep->len_cap + PKT_ALIGN-1) & ~(PKT_ALIGN-1);
2246 + mon_buff_area_shrink(rp, delta);
2247 }
2248 } else {
2249 ep->flag_data = data_tag;
2250 diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
2251 index 8b3c4e2..74073f9 100644
2252 --- a/drivers/usb/musb/musb_gadget.c
2253 +++ b/drivers/usb/musb/musb_gadget.c
2254 @@ -4,6 +4,7 @@
2255 * Copyright 2005 Mentor Graphics Corporation
2256 * Copyright (C) 2005-2006 by Texas Instruments
2257 * Copyright (C) 2006-2007 Nokia Corporation
2258 + * Copyright (C) 2009 MontaVista Software, Inc. <source@mvista.com>
2259 *
2260 * This program is free software; you can redistribute it and/or
2261 * modify it under the terms of the GNU General Public License
2262 @@ -436,14 +437,6 @@ void musb_g_tx(struct musb *musb, u8 epnum)
2263 csr |= MUSB_TXCSR_P_WZC_BITS;
2264 csr &= ~MUSB_TXCSR_P_SENTSTALL;
2265 musb_writew(epio, MUSB_TXCSR, csr);
2266 - if (dma_channel_status(dma) == MUSB_DMA_STATUS_BUSY) {
2267 - dma->status = MUSB_DMA_STATUS_CORE_ABORT;
2268 - musb->dma_controller->channel_abort(dma);
2269 - }
2270 -
2271 - if (request)
2272 - musb_g_giveback(musb_ep, request, -EPIPE);
2273 -
2274 break;
2275 }
2276
2277 @@ -582,15 +575,25 @@ void musb_g_tx(struct musb *musb, u8 epnum)
2278 */
2279 static void rxstate(struct musb *musb, struct musb_request *req)
2280 {
2281 - u16 csr = 0;
2282 const u8 epnum = req->epnum;
2283 struct usb_request *request = &req->request;
2284 struct musb_ep *musb_ep = &musb->endpoints[epnum].ep_out;
2285 void __iomem *epio = musb->endpoints[epnum].regs;
2286 unsigned fifo_count = 0;
2287 u16 len = musb_ep->packet_sz;
2288 + u16 csr = musb_readw(epio, MUSB_RXCSR);
2289
2290 - csr = musb_readw(epio, MUSB_RXCSR);
2291 + /* We shouldn't get here while DMA is active, but we do... */
2292 + if (dma_channel_status(musb_ep->dma) == MUSB_DMA_STATUS_BUSY) {
2293 + DBG(4, "DMA pending...\n");
2294 + return;
2295 + }
2296 +
2297 + if (csr & MUSB_RXCSR_P_SENDSTALL) {
2298 + DBG(5, "%s stalling, RXCSR %04x\n",
2299 + musb_ep->end_point.name, csr);
2300 + return;
2301 + }
2302
2303 if (is_cppi_enabled() && musb_ep->dma) {
2304 struct dma_controller *c = musb->dma_controller;
2305 @@ -761,19 +764,10 @@ void musb_g_rx(struct musb *musb, u8 epnum)
2306 csr, dma ? " (dma)" : "", request);
2307
2308 if (csr & MUSB_RXCSR_P_SENTSTALL) {
2309 - if (dma_channel_status(dma) == MUSB_DMA_STATUS_BUSY) {
2310 - dma->status = MUSB_DMA_STATUS_CORE_ABORT;
2311 - (void) musb->dma_controller->channel_abort(dma);
2312 - request->actual += musb_ep->dma->actual_len;
2313 - }
2314 -
2315 csr |= MUSB_RXCSR_P_WZC_BITS;
2316 csr &= ~MUSB_RXCSR_P_SENTSTALL;
2317 musb_writew(epio, MUSB_RXCSR, csr);
2318 -
2319 - if (request)
2320 - musb_g_giveback(musb_ep, request, -EPIPE);
2321 - goto done;
2322 + return;
2323 }
2324
2325 if (csr & MUSB_RXCSR_P_OVERRUN) {
2326 @@ -795,7 +789,7 @@ void musb_g_rx(struct musb *musb, u8 epnum)
2327 DBG((csr & MUSB_RXCSR_DMAENAB) ? 4 : 1,
2328 "%s busy, csr %04x\n",
2329 musb_ep->end_point.name, csr);
2330 - goto done;
2331 + return;
2332 }
2333
2334 if (dma && (csr & MUSB_RXCSR_DMAENAB)) {
2335 @@ -826,22 +820,15 @@ void musb_g_rx(struct musb *musb, u8 epnum)
2336 if ((request->actual < request->length)
2337 && (musb_ep->dma->actual_len
2338 == musb_ep->packet_sz))
2339 - goto done;
2340 + return;
2341 #endif
2342 musb_g_giveback(musb_ep, request, 0);
2343
2344 request = next_request(musb_ep);
2345 if (!request)
2346 - goto done;
2347 -
2348 - /* don't start more i/o till the stall clears */
2349 - musb_ep_select(mbase, epnum);
2350 - csr = musb_readw(epio, MUSB_RXCSR);
2351 - if (csr & MUSB_RXCSR_P_SENDSTALL)
2352 - goto done;
2353 + return;
2354 }
2355
2356 -
2357 /* analyze request if the ep is hot */
2358 if (request)
2359 rxstate(musb, to_musb_request(request));
2360 @@ -849,8 +836,6 @@ void musb_g_rx(struct musb *musb, u8 epnum)
2361 DBG(3, "packet waiting for %s%s request\n",
2362 musb_ep->desc ? "" : "inactive ",
2363 musb_ep->end_point.name);
2364 -
2365 -done:
2366 return;
2367 }
2368
2369 @@ -1244,7 +1229,7 @@ int musb_gadget_set_halt(struct usb_ep *ep, int value)
2370 void __iomem *mbase;
2371 unsigned long flags;
2372 u16 csr;
2373 - struct musb_request *request = NULL;
2374 + struct musb_request *request;
2375 int status = 0;
2376
2377 if (!ep)
2378 @@ -1260,24 +1245,29 @@ int musb_gadget_set_halt(struct usb_ep *ep, int value)
2379
2380 musb_ep_select(mbase, epnum);
2381
2382 - /* cannot portably stall with non-empty FIFO */
2383 request = to_musb_request(next_request(musb_ep));
2384 - if (value && musb_ep->is_in) {
2385 - csr = musb_readw(epio, MUSB_TXCSR);
2386 - if (csr & MUSB_TXCSR_FIFONOTEMPTY) {
2387 - DBG(3, "%s fifo busy, cannot halt\n", ep->name);
2388 - spin_unlock_irqrestore(&musb->lock, flags);
2389 - return -EAGAIN;
2390 + if (value) {
2391 + if (request) {
2392 + DBG(3, "request in progress, cannot halt %s\n",
2393 + ep->name);
2394 + status = -EAGAIN;
2395 + goto done;
2396 + }
2397 + /* Cannot portably stall with non-empty FIFO */
2398 + if (musb_ep->is_in) {
2399 + csr = musb_readw(epio, MUSB_TXCSR);
2400 + if (csr & MUSB_TXCSR_FIFONOTEMPTY) {
2401 + DBG(3, "FIFO busy, cannot halt %s\n", ep->name);
2402 + status = -EAGAIN;
2403 + goto done;
2404 + }
2405 }
2406 -
2407 }
2408
2409 /* set/clear the stall and toggle bits */
2410 DBG(2, "%s: %s stall\n", ep->name, value ? "set" : "clear");
2411 if (musb_ep->is_in) {
2412 csr = musb_readw(epio, MUSB_TXCSR);
2413 - if (csr & MUSB_TXCSR_FIFONOTEMPTY)
2414 - csr |= MUSB_TXCSR_FLUSHFIFO;
2415 csr |= MUSB_TXCSR_P_WZC_BITS
2416 | MUSB_TXCSR_CLRDATATOG;
2417 if (value)
2418 @@ -1300,14 +1290,13 @@ int musb_gadget_set_halt(struct usb_ep *ep, int value)
2419 musb_writew(epio, MUSB_RXCSR, csr);
2420 }
2421
2422 -done:
2423 -
2424 /* maybe start the first request in the queue */
2425 if (!musb_ep->busy && !value && request) {
2426 DBG(3, "restarting the request\n");
2427 musb_ep_restart(musb, request);
2428 }
2429
2430 +done:
2431 spin_unlock_irqrestore(&musb->lock, flags);
2432 return status;
2433 }
2434 diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
2435 index a69457f..2367325 100644
2436 --- a/drivers/usb/serial/cp210x.c
2437 +++ b/drivers/usb/serial/cp210x.c
2438 @@ -51,6 +51,8 @@ static int cp210x_tiocmset_port(struct usb_serial_port *port, struct file *,
2439 static void cp210x_break_ctl(struct tty_struct *, int);
2440 static int cp210x_startup(struct usb_serial *);
2441 static void cp210x_disconnect(struct usb_serial *);
2442 +static void cp210x_dtr_rts(struct usb_serial_port *p, int on);
2443 +static int cp210x_carrier_raised(struct usb_serial_port *p);
2444
2445 static int debug;
2446
2447 @@ -144,6 +146,8 @@ static struct usb_serial_driver cp210x_device = {
2448 .tiocmset = cp210x_tiocmset,
2449 .attach = cp210x_startup,
2450 .disconnect = cp210x_disconnect,
2451 + .dtr_rts = cp210x_dtr_rts,
2452 + .carrier_raised = cp210x_carrier_raised
2453 };
2454
2455 /* Config request types */
2456 @@ -748,6 +752,14 @@ static int cp210x_tiocmset_port(struct usb_serial_port *port, struct file *file,
2457 return cp210x_set_config(port, CP210X_SET_MHS, &control, 2);
2458 }
2459
2460 +static void cp210x_dtr_rts(struct usb_serial_port *p, int on)
2461 +{
2462 + if (on)
2463 + cp210x_tiocmset_port(p, NULL, TIOCM_DTR|TIOCM_RTS, 0);
2464 + else
2465 + cp210x_tiocmset_port(p, NULL, 0, TIOCM_DTR|TIOCM_RTS);
2466 +}
2467 +
2468 static int cp210x_tiocmget (struct tty_struct *tty, struct file *file)
2469 {
2470 struct usb_serial_port *port = tty->driver_data;
2471 @@ -770,6 +782,15 @@ static int cp210x_tiocmget (struct tty_struct *tty, struct file *file)
2472 return result;
2473 }
2474
2475 +static int cp210x_carrier_raised(struct usb_serial_port *p)
2476 +{
2477 + unsigned int control;
2478 + cp210x_get_config(p, CP210X_GET_MDMSTS, &control, 1);
2479 + if (control & CONTROL_DCD)
2480 + return 1;
2481 + return 0;
2482 +}
2483 +
2484 static void cp210x_break_ctl (struct tty_struct *tty, int break_state)
2485 {
2486 struct usb_serial_port *port = tty->driver_data;
2487 diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
2488 index 048b563..8410201 100644
2489 --- a/drivers/usb/serial/ftdi_sio.c
2490 +++ b/drivers/usb/serial/ftdi_sio.c
2491 @@ -1939,7 +1939,7 @@ static void ftdi_write_bulk_callback(struct urb *urb)
2492 return;
2493 }
2494 /* account for transferred data */
2495 - countback = urb->actual_length;
2496 + countback = urb->transfer_buffer_length;
2497 data_offset = priv->write_offset;
2498 if (data_offset > 0) {
2499 /* Subtract the control bytes */
2500 @@ -1952,7 +1952,6 @@ static void ftdi_write_bulk_callback(struct urb *urb)
2501
2502 if (status) {
2503 dbg("nonzero write bulk status received: %d", status);
2504 - return;
2505 }
2506
2507 usb_serial_port_softint(port);
2508 diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
2509 index 7c99185..dd50b78 100644
2510 --- a/drivers/usb/serial/option.c
2511 +++ b/drivers/usb/serial/option.c
2512 @@ -309,6 +309,7 @@ static int option_resume(struct usb_serial *serial);
2513
2514 #define DLINK_VENDOR_ID 0x1186
2515 #define DLINK_PRODUCT_DWM_652 0x3e04
2516 +#define DLINK_PRODUCT_DWM_652_U5 0xce16
2517
2518 #define QISDA_VENDOR_ID 0x1da5
2519 #define QISDA_PRODUCT_H21_4512 0x4512
2520 @@ -587,6 +588,7 @@ static struct usb_device_id option_ids[] = {
2521 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC2726, 0xff, 0xff, 0xff) },
2522 { USB_DEVICE(BENQ_VENDOR_ID, BENQ_PRODUCT_H10) },
2523 { USB_DEVICE(DLINK_VENDOR_ID, DLINK_PRODUCT_DWM_652) },
2524 + { USB_DEVICE(ALINK_VENDOR_ID, DLINK_PRODUCT_DWM_652_U5) }, /* Yes, ALINK_VENDOR_ID */
2525 { USB_DEVICE(QISDA_VENDOR_ID, QISDA_PRODUCT_H21_4512) },
2526 { USB_DEVICE(QISDA_VENDOR_ID, QISDA_PRODUCT_H21_4523) },
2527 { USB_DEVICE(QISDA_VENDOR_ID, QISDA_PRODUCT_H20_4515) },
2528 diff --git a/fs/block_dev.c b/fs/block_dev.c
2529 index 94dfda2..9d544ea 100644
2530 --- a/fs/block_dev.c
2531 +++ b/fs/block_dev.c
2532 @@ -1243,8 +1243,8 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part)
2533 bd_set_size(bdev, (loff_t)bdev->bd_part->nr_sects << 9);
2534 }
2535 } else {
2536 - put_disk(disk);
2537 module_put(disk->fops->owner);
2538 + put_disk(disk);
2539 disk = NULL;
2540 if (bdev->bd_contains == bdev) {
2541 if (bdev->bd_disk->fops->open) {
2542 diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h
2543 index da8fbf5..3949ae1 100644
2544 --- a/fs/cifs/cifsproto.h
2545 +++ b/fs/cifs/cifsproto.h
2546 @@ -389,4 +389,5 @@ extern int CIFSSMBSetPosixACL(const int xid, struct cifsTconInfo *tcon,
2547 const struct nls_table *nls_codepage, int remap_special_chars);
2548 extern int CIFSGetExtAttr(const int xid, struct cifsTconInfo *tcon,
2549 const int netfid, __u64 *pExtAttrBits, __u64 *pMask);
2550 +extern void cifs_autodisable_serverino(struct cifs_sb_info *cifs_sb);
2551 #endif /* _CIFSPROTO_H */
2552 diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
2553 index 1b056d4..5c084e5 100644
2554 --- a/fs/cifs/connect.c
2555 +++ b/fs/cifs/connect.c
2556 @@ -2200,16 +2200,8 @@ is_path_accessible(int xid, struct cifsTconInfo *tcon,
2557 struct cifs_sb_info *cifs_sb, const char *full_path)
2558 {
2559 int rc;
2560 - __u64 inode_num;
2561 FILE_ALL_INFO *pfile_info;
2562
2563 - rc = CIFSGetSrvInodeNumber(xid, tcon, full_path, &inode_num,
2564 - cifs_sb->local_nls,
2565 - cifs_sb->mnt_cifs_flags &
2566 - CIFS_MOUNT_MAP_SPECIAL_CHR);
2567 - if (rc != -EOPNOTSUPP)
2568 - return rc;
2569 -
2570 pfile_info = kmalloc(sizeof(FILE_ALL_INFO), GFP_KERNEL);
2571 if (pfile_info == NULL)
2572 return -ENOMEM;
2573 diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
2574 index 4326ffd..9652690 100644
2575 --- a/fs/cifs/dir.c
2576 +++ b/fs/cifs/dir.c
2577 @@ -212,8 +212,6 @@ int cifs_posix_open(char *full_path, struct inode **pinode,
2578 posix_flags |= SMB_O_EXCL;
2579 if (oflags & O_TRUNC)
2580 posix_flags |= SMB_O_TRUNC;
2581 - if (oflags & O_APPEND)
2582 - posix_flags |= SMB_O_APPEND;
2583 if (oflags & O_SYNC)
2584 posix_flags |= SMB_O_SYNC;
2585 if (oflags & O_DIRECTORY)
2586 @@ -648,7 +646,7 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry,
2587 * O_EXCL: optimize away the lookup, but don't hash the dentry. Let
2588 * the VFS handle the create.
2589 */
2590 - if (nd->flags & LOOKUP_EXCL) {
2591 + if (nd && (nd->flags & LOOKUP_EXCL)) {
2592 d_instantiate(direntry, NULL);
2593 return 0;
2594 }
2595 @@ -680,7 +678,7 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry,
2596 * reduction in network traffic in the other paths.
2597 */
2598 if (pTcon->unix_ext) {
2599 - if (!(nd->flags & (LOOKUP_PARENT | LOOKUP_DIRECTORY)) &&
2600 + if (nd && !(nd->flags & (LOOKUP_PARENT | LOOKUP_DIRECTORY)) &&
2601 (nd->flags & LOOKUP_OPEN) && !pTcon->broken_posix_open &&
2602 (nd->intent.open.flags & O_CREAT)) {
2603 rc = cifs_posix_open(full_path, &newInode,
2604 diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
2605 index 82d8383..9a77a30 100644
2606 --- a/fs/cifs/inode.c
2607 +++ b/fs/cifs/inode.c
2608 @@ -512,13 +512,10 @@ int cifs_get_inode_info(struct inode **pinode,
2609 cifs_sb->local_nls,
2610 cifs_sb->mnt_cifs_flags &
2611 CIFS_MOUNT_MAP_SPECIAL_CHR);
2612 - if (rc1) {
2613 + if (rc1 || !fattr.cf_uniqueid) {
2614 cFYI(1, ("GetSrvInodeNum rc %d", rc1));
2615 fattr.cf_uniqueid = iunique(sb, ROOT_I);
2616 - /* disable serverino if call not supported */
2617 - if (rc1 == -EINVAL)
2618 - cifs_sb->mnt_cifs_flags &=
2619 - ~CIFS_MOUNT_SERVER_INUM;
2620 + cifs_autodisable_serverino(cifs_sb);
2621 }
2622 } else {
2623 fattr.cf_uniqueid = iunique(sb, ROOT_I);
2624 diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c
2625 index e079a91..b8dc3ed 100644
2626 --- a/fs/cifs/misc.c
2627 +++ b/fs/cifs/misc.c
2628 @@ -705,3 +705,17 @@ cifsConvertToUCS(__le16 *target, const char *source, int maxlen,
2629 ctoUCS_out:
2630 return i;
2631 }
2632 +
2633 +void
2634 +cifs_autodisable_serverino(struct cifs_sb_info *cifs_sb)
2635 +{
2636 + if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) {
2637 + cifs_sb->mnt_cifs_flags &= ~CIFS_MOUNT_SERVER_INUM;
2638 + cERROR(1, ("Autodisabling the use of server inode numbers on "
2639 + "%s. This server doesn't seem to support them "
2640 + "properly. Hardlinks will not be recognized on this "
2641 + "mount. Consider mounting with the \"noserverino\" "
2642 + "option to silence this message.",
2643 + cifs_sb->tcon->treeName));
2644 + }
2645 +}
2646 diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c
2647 index f823a4a..01ce279 100644
2648 --- a/fs/cifs/readdir.c
2649 +++ b/fs/cifs/readdir.c
2650 @@ -727,11 +727,12 @@ static int cifs_filldir(char *pfindEntry, struct file *file, filldir_t filldir,
2651 cifs_dir_info_to_fattr(&fattr, (FILE_DIRECTORY_INFO *)
2652 pfindEntry, cifs_sb);
2653
2654 - /* FIXME: make _to_fattr functions fill this out */
2655 - if (pCifsF->srch_inf.info_level == SMB_FIND_FILE_ID_FULL_DIR_INFO)
2656 + if (inum && (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM)) {
2657 fattr.cf_uniqueid = inum;
2658 - else
2659 + } else {
2660 fattr.cf_uniqueid = iunique(sb, ROOT_I);
2661 + cifs_autodisable_serverino(cifs_sb);
2662 + }
2663
2664 ino = cifs_uniqueid_to_ino_t(fattr.cf_uniqueid);
2665 tmp_dentry = cifs_readdir_lookup(file->f_dentry, &qstring, &fattr);
2666 diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
2667 index f91fd51..d84e705 100644
2668 --- a/fs/compat_ioctl.c
2669 +++ b/fs/compat_ioctl.c
2670 @@ -1800,7 +1800,7 @@ struct space_resv_32 {
2671 /* just account for different alignment */
2672 static int compat_ioctl_preallocate(struct file *file, unsigned long arg)
2673 {
2674 - struct space_resv_32 __user *p32 = (void __user *)arg;
2675 + struct space_resv_32 __user *p32 = compat_ptr(arg);
2676 struct space_resv __user *p = compat_alloc_user_space(sizeof(*p));
2677
2678 if (copy_in_user(&p->l_type, &p32->l_type, sizeof(s16)) ||
2679 @@ -2802,7 +2802,7 @@ asmlinkage long compat_sys_ioctl(unsigned int fd, unsigned int cmd,
2680 #else
2681 case FS_IOC_RESVSP:
2682 case FS_IOC_RESVSP64:
2683 - error = ioctl_preallocate(filp, (void __user *)arg);
2684 + error = ioctl_preallocate(filp, compat_ptr(arg));
2685 goto out_fput;
2686 #endif
2687
2688 diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
2689 index e703654..d0dcaef 100644
2690 --- a/fs/fuse/dir.c
2691 +++ b/fs/fuse/dir.c
2692 @@ -385,6 +385,9 @@ static int fuse_create_open(struct inode *dir, struct dentry *entry, int mode,
2693 if (fc->no_create)
2694 return -ENOSYS;
2695
2696 + if (flags & O_DIRECT)
2697 + return -EINVAL;
2698 +
2699 forget_req = fuse_get_req(fc);
2700 if (IS_ERR(forget_req))
2701 return PTR_ERR(forget_req);
2702 diff --git a/fs/jffs2/read.c b/fs/jffs2/read.c
2703 index cfe05c1..3f39be1 100644
2704 --- a/fs/jffs2/read.c
2705 +++ b/fs/jffs2/read.c
2706 @@ -164,12 +164,15 @@ int jffs2_read_inode_range(struct jffs2_sb_info *c, struct jffs2_inode_info *f,
2707
2708 /* XXX FIXME: Where a single physical node actually shows up in two
2709 frags, we read it twice. Don't do that. */
2710 - /* Now we're pointing at the first frag which overlaps our page */
2711 + /* Now we're pointing at the first frag which overlaps our page
2712 + * (or perhaps is before it, if we've been asked to read off the
2713 + * end of the file). */
2714 while(offset < end) {
2715 D2(printk(KERN_DEBUG "jffs2_read_inode_range: offset %d, end %d\n", offset, end));
2716 - if (unlikely(!frag || frag->ofs > offset)) {
2717 + if (unlikely(!frag || frag->ofs > offset ||
2718 + frag->ofs + frag->size <= offset)) {
2719 uint32_t holesize = end - offset;
2720 - if (frag) {
2721 + if (frag && frag->ofs > offset) {
2722 D1(printk(KERN_NOTICE "Eep. Hole in ino #%u fraglist. frag->ofs = 0x%08x, offset = 0x%08x\n", f->inocache->ino, frag->ofs, offset));
2723 holesize = min(holesize, frag->ofs - offset);
2724 }
2725 diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
2726 index 2aa2396..54baaef 100644
2727 --- a/fs/nfs/nfs4proc.c
2728 +++ b/fs/nfs/nfs4proc.c
2729 @@ -2740,7 +2740,7 @@ static int _nfs4_proc_readdir(struct dentry *dentry, struct rpc_cred *cred,
2730 .pages = &page,
2731 .pgbase = 0,
2732 .count = count,
2733 - .bitmask = NFS_SERVER(dentry->d_inode)->cache_consistency_bitmask,
2734 + .bitmask = NFS_SERVER(dentry->d_inode)->attr_bitmask,
2735 };
2736 struct nfs4_readdir_res res;
2737 struct rpc_message msg = {
2738 diff --git a/fs/nilfs2/ioctl.c b/fs/nilfs2/ioctl.c
2739 index 6ea5f87..f6b6016 100644
2740 --- a/fs/nilfs2/ioctl.c
2741 +++ b/fs/nilfs2/ioctl.c
2742 @@ -297,7 +297,18 @@ static int nilfs_ioctl_move_inode_block(struct inode *inode,
2743 (unsigned long long)vdesc->vd_vblocknr);
2744 return ret;
2745 }
2746 - bh->b_private = vdesc;
2747 + if (unlikely(!list_empty(&bh->b_assoc_buffers))) {
2748 + printk(KERN_CRIT "%s: conflicting %s buffer: ino=%llu, "
2749 + "cno=%llu, offset=%llu, blocknr=%llu, vblocknr=%llu\n",
2750 + __func__, vdesc->vd_flags ? "node" : "data",
2751 + (unsigned long long)vdesc->vd_ino,
2752 + (unsigned long long)vdesc->vd_cno,
2753 + (unsigned long long)vdesc->vd_offset,
2754 + (unsigned long long)vdesc->vd_blocknr,
2755 + (unsigned long long)vdesc->vd_vblocknr);
2756 + brelse(bh);
2757 + return -EEXIST;
2758 + }
2759 list_add_tail(&bh->b_assoc_buffers, buffers);
2760 return 0;
2761 }
2762 @@ -335,24 +346,10 @@ static int nilfs_ioctl_move_blocks(struct the_nilfs *nilfs,
2763 list_for_each_entry_safe(bh, n, &buffers, b_assoc_buffers) {
2764 ret = nilfs_gccache_wait_and_mark_dirty(bh);
2765 if (unlikely(ret < 0)) {
2766 - if (ret == -EEXIST) {
2767 - vdesc = bh->b_private;
2768 - printk(KERN_CRIT
2769 - "%s: conflicting %s buffer: "
2770 - "ino=%llu, cno=%llu, offset=%llu, "
2771 - "blocknr=%llu, vblocknr=%llu\n",
2772 - __func__,
2773 - vdesc->vd_flags ? "node" : "data",
2774 - (unsigned long long)vdesc->vd_ino,
2775 - (unsigned long long)vdesc->vd_cno,
2776 - (unsigned long long)vdesc->vd_offset,
2777 - (unsigned long long)vdesc->vd_blocknr,
2778 - (unsigned long long)vdesc->vd_vblocknr);
2779 - }
2780 + WARN_ON(ret == -EEXIST);
2781 goto failed;
2782 }
2783 list_del_init(&bh->b_assoc_buffers);
2784 - bh->b_private = NULL;
2785 brelse(bh);
2786 }
2787 return nmembs;
2788 @@ -360,7 +357,6 @@ static int nilfs_ioctl_move_blocks(struct the_nilfs *nilfs,
2789 failed:
2790 list_for_each_entry_safe(bh, n, &buffers, b_assoc_buffers) {
2791 list_del_init(&bh->b_assoc_buffers);
2792 - bh->b_private = NULL;
2793 brelse(bh);
2794 }
2795 return ret;
2796 diff --git a/fs/proc/base.c b/fs/proc/base.c
2797 index 6f742f6..baf53d9 100644
2798 --- a/fs/proc/base.c
2799 +++ b/fs/proc/base.c
2800 @@ -2580,8 +2580,7 @@ static void proc_flush_task_mnt(struct vfsmount *mnt, pid_t pid, pid_t tgid)
2801 name.len = snprintf(buf, sizeof(buf), "%d", pid);
2802 dentry = d_hash_and_lookup(mnt->mnt_root, &name);
2803 if (dentry) {
2804 - if (!(current->flags & PF_EXITING))
2805 - shrink_dcache_parent(dentry);
2806 + shrink_dcache_parent(dentry);
2807 d_drop(dentry);
2808 dput(dentry);
2809 }
2810 diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
2811 index f2c69a2..ff06fb2 100644
2812 --- a/include/linux/skbuff.h
2813 +++ b/include/linux/skbuff.h
2814 @@ -1761,6 +1761,8 @@ extern int skb_copy_datagram_const_iovec(const struct sk_buff *from,
2815 int to_offset,
2816 int size);
2817 extern void skb_free_datagram(struct sock *sk, struct sk_buff *skb);
2818 +extern void skb_free_datagram_locked(struct sock *sk,
2819 + struct sk_buff *skb);
2820 extern int skb_kill_datagram(struct sock *sk, struct sk_buff *skb,
2821 unsigned int flags);
2822 extern __wsum skb_checksum(const struct sk_buff *skb, int offset,
2823 diff --git a/include/net/mac80211.h b/include/net/mac80211.h
2824 index c061044..5edf792 100644
2825 --- a/include/net/mac80211.h
2826 +++ b/include/net/mac80211.h
2827 @@ -1244,6 +1244,12 @@ enum ieee80211_filter_flags {
2828 *
2829 * These flags are used with the ampdu_action() callback in
2830 * &struct ieee80211_ops to indicate which action is needed.
2831 + *
2832 + * Note that drivers MUST be able to deal with a TX aggregation
2833 + * session being stopped even before they OK'ed starting it by
2834 + * calling ieee80211_start_tx_ba_cb(_irqsafe), because the peer
2835 + * might receive the addBA frame and send a delBA right away!
2836 + *
2837 * @IEEE80211_AMPDU_RX_START: start Rx aggregation
2838 * @IEEE80211_AMPDU_RX_STOP: stop Rx aggregation
2839 * @IEEE80211_AMPDU_TX_START: start Tx aggregation
2840 diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
2841 index cbdd628..5cf7270 100644
2842 --- a/include/net/netfilter/nf_conntrack.h
2843 +++ b/include/net/netfilter/nf_conntrack.h
2844 @@ -255,11 +255,9 @@ static inline bool nf_ct_kill(struct nf_conn *ct)
2845 }
2846
2847 /* These are for NAT. Icky. */
2848 -/* Update TCP window tracking data when NAT mangles the packet */
2849 -extern void nf_conntrack_tcp_update(const struct sk_buff *skb,
2850 - unsigned int dataoff,
2851 - struct nf_conn *ct, int dir,
2852 - s16 offset);
2853 +extern s16 (*nf_ct_nat_offset)(const struct nf_conn *ct,
2854 + enum ip_conntrack_dir dir,
2855 + u32 seq);
2856
2857 /* Fake conntrack entry for untracked connections */
2858 extern struct nf_conn nf_conntrack_untracked;
2859 diff --git a/include/net/netfilter/nf_nat_helper.h b/include/net/netfilter/nf_nat_helper.h
2860 index 237a961..4222220 100644
2861 --- a/include/net/netfilter/nf_nat_helper.h
2862 +++ b/include/net/netfilter/nf_nat_helper.h
2863 @@ -32,4 +32,8 @@ extern int (*nf_nat_seq_adjust_hook)(struct sk_buff *skb,
2864 * to port ct->master->saved_proto. */
2865 extern void nf_nat_follow_master(struct nf_conn *ct,
2866 struct nf_conntrack_expect *this);
2867 +
2868 +extern s16 nf_nat_get_offset(const struct nf_conn *ct,
2869 + enum ip_conntrack_dir dir,
2870 + u32 seq);
2871 #endif
2872 diff --git a/init/main.c b/init/main.c
2873 index 11f4f14..1ec6347 100644
2874 --- a/init/main.c
2875 +++ b/init/main.c
2876 @@ -250,7 +250,7 @@ early_param("loglevel", loglevel);
2877
2878 /*
2879 * Unknown boot options get handed to init, unless they look like
2880 - * failed parameters
2881 + * unused parameters (modprobe will find them in /proc/cmdline).
2882 */
2883 static int __init unknown_bootoption(char *param, char *val)
2884 {
2885 @@ -271,14 +271,9 @@ static int __init unknown_bootoption(char *param, char *val)
2886 if (obsolete_checksetup(param))
2887 return 0;
2888
2889 - /*
2890 - * Preemptive maintenance for "why didn't my misspelled command
2891 - * line work?"
2892 - */
2893 - if (strchr(param, '.') && (!val || strchr(param, '.') < val)) {
2894 - printk(KERN_ERR "Unknown boot option `%s': ignoring\n", param);
2895 + /* Unused module parameter. */
2896 + if (strchr(param, '.') && (!val || strchr(param, '.') < val))
2897 return 0;
2898 - }
2899
2900 if (panic_later)
2901 return 0;
2902 diff --git a/kernel/module.c b/kernel/module.c
2903 index 2d53718..cda4d76 100644
2904 --- a/kernel/module.c
2905 +++ b/kernel/module.c
2906 @@ -1179,7 +1179,8 @@ static void add_sect_attrs(struct module *mod, unsigned int nsect,
2907
2908 /* Count loaded sections and allocate structures */
2909 for (i = 0; i < nsect; i++)
2910 - if (sechdrs[i].sh_flags & SHF_ALLOC)
2911 + if (sechdrs[i].sh_flags & SHF_ALLOC
2912 + && sechdrs[i].sh_size)
2913 nloaded++;
2914 size[0] = ALIGN(sizeof(*sect_attrs)
2915 + nloaded * sizeof(sect_attrs->attrs[0]),
2916 @@ -1199,6 +1200,8 @@ static void add_sect_attrs(struct module *mod, unsigned int nsect,
2917 for (i = 0; i < nsect; i++) {
2918 if (! (sechdrs[i].sh_flags & SHF_ALLOC))
2919 continue;
2920 + if (!sechdrs[i].sh_size)
2921 + continue;
2922 sattr->address = sechdrs[i].sh_addr;
2923 sattr->name = kstrdup(secstrings + sechdrs[i].sh_name,
2924 GFP_KERNEL);
2925 diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
2926 index b1dc468..237fd07 100644
2927 --- a/kernel/perf_counter.c
2928 +++ b/kernel/perf_counter.c
2929 @@ -1363,7 +1363,7 @@ static void perf_ctx_adjust_freq(struct perf_counter_context *ctx)
2930 u64 interrupts, freq;
2931
2932 spin_lock(&ctx->lock);
2933 - list_for_each_entry(counter, &ctx->counter_list, list_entry) {
2934 + list_for_each_entry_rcu(counter, &ctx->counter_list, event_entry) {
2935 if (counter->state != PERF_COUNTER_STATE_ACTIVE)
2936 continue;
2937
2938 diff --git a/kernel/sched.c b/kernel/sched.c
2939 index 1b59e26..81ede13 100644
2940 --- a/kernel/sched.c
2941 +++ b/kernel/sched.c
2942 @@ -7945,6 +7945,7 @@ static cpumask_var_t cpu_isolated_map;
2943 /* Setup the mask of cpus configured for isolated domains */
2944 static int __init isolated_cpu_setup(char *str)
2945 {
2946 + alloc_bootmem_cpumask_var(&cpu_isolated_map);
2947 cpulist_parse(str, cpu_isolated_map);
2948 return 1;
2949 }
2950 @@ -9383,13 +9384,15 @@ void __init sched_init(void)
2951 current->sched_class = &fair_sched_class;
2952
2953 /* Allocate the nohz_cpu_mask if CONFIG_CPUMASK_OFFSTACK */
2954 - alloc_cpumask_var(&nohz_cpu_mask, GFP_NOWAIT);
2955 + zalloc_cpumask_var(&nohz_cpu_mask, GFP_NOWAIT);
2956 #ifdef CONFIG_SMP
2957 #ifdef CONFIG_NO_HZ
2958 - alloc_cpumask_var(&nohz.cpu_mask, GFP_NOWAIT);
2959 + zalloc_cpumask_var(&nohz.cpu_mask, GFP_NOWAIT);
2960 alloc_cpumask_var(&nohz.ilb_grp_nohz_mask, GFP_NOWAIT);
2961 #endif
2962 - alloc_cpumask_var(&cpu_isolated_map, GFP_NOWAIT);
2963 + /* May be allocated at isolcpus cmdline parse time */
2964 + if (cpu_isolated_map == NULL)
2965 + zalloc_cpumask_var(&cpu_isolated_map, GFP_NOWAIT);
2966 #endif /* SMP */
2967
2968 perf_counter_init();
2969 diff --git a/kernel/user.c b/kernel/user.c
2970 index 2c000e7..46d0165 100644
2971 --- a/kernel/user.c
2972 +++ b/kernel/user.c
2973 @@ -330,9 +330,9 @@ done:
2974 */
2975 static void free_user(struct user_struct *up, unsigned long flags)
2976 {
2977 - spin_unlock_irqrestore(&uidhash_lock, flags);
2978 INIT_DELAYED_WORK(&up->work, cleanup_user_struct);
2979 schedule_delayed_work(&up->work, msecs_to_jiffies(1000));
2980 + spin_unlock_irqrestore(&uidhash_lock, flags);
2981 }
2982
2983 #else /* CONFIG_USER_SCHED && CONFIG_SYSFS */
2984 diff --git a/mm/highmem.c b/mm/highmem.c
2985 index 25878cc..9c1e627 100644
2986 --- a/mm/highmem.c
2987 +++ b/mm/highmem.c
2988 @@ -426,16 +426,21 @@ void __init page_address_init(void)
2989
2990 void debug_kmap_atomic(enum km_type type)
2991 {
2992 - static unsigned warn_count = 10;
2993 + static int warn_count = 10;
2994
2995 - if (unlikely(warn_count == 0))
2996 + if (unlikely(warn_count < 0))
2997 return;
2998
2999 if (unlikely(in_interrupt())) {
3000 - if (in_irq()) {
3001 + if (in_nmi()) {
3002 + if (type != KM_NMI && type != KM_NMI_PTE) {
3003 + WARN_ON(1);
3004 + warn_count--;
3005 + }
3006 + } else if (in_irq()) {
3007 if (type != KM_IRQ0 && type != KM_IRQ1 &&
3008 type != KM_BIO_SRC_IRQ && type != KM_BIO_DST_IRQ &&
3009 - type != KM_BOUNCE_READ) {
3010 + type != KM_BOUNCE_READ && type != KM_IRQ_PTE) {
3011 WARN_ON(1);
3012 warn_count--;
3013 }
3014 @@ -452,7 +457,9 @@ void debug_kmap_atomic(enum km_type type)
3015 }
3016
3017 if (type == KM_IRQ0 || type == KM_IRQ1 || type == KM_BOUNCE_READ ||
3018 - type == KM_BIO_SRC_IRQ || type == KM_BIO_DST_IRQ) {
3019 + type == KM_BIO_SRC_IRQ || type == KM_BIO_DST_IRQ ||
3020 + type == KM_IRQ_PTE || type == KM_NMI ||
3021 + type == KM_NMI_PTE ) {
3022 if (!irqs_disabled()) {
3023 WARN_ON(1);
3024 warn_count--;
3025 diff --git a/mm/migrate.c b/mm/migrate.c
3026 index 939888f..598abad 100644
3027 --- a/mm/migrate.c
3028 +++ b/mm/migrate.c
3029 @@ -597,7 +597,7 @@ static int unmap_and_move(new_page_t get_new_page, unsigned long private,
3030 struct page *newpage = get_new_page(page, private, &result);
3031 int rcu_locked = 0;
3032 int charge = 0;
3033 - struct mem_cgroup *mem;
3034 + struct mem_cgroup *mem = NULL;
3035
3036 if (!newpage)
3037 return -ENOMEM;
3038 diff --git a/mm/page_alloc.c b/mm/page_alloc.c
3039 index 0b3c6cb..957b551 100644
3040 --- a/mm/page_alloc.c
3041 +++ b/mm/page_alloc.c
3042 @@ -1715,7 +1715,7 @@ gfp_to_alloc_flags(gfp_t gfp_mask)
3043 * See also cpuset_zone_allowed() comment in kernel/cpuset.c.
3044 */
3045 alloc_flags &= ~ALLOC_CPUSET;
3046 - } else if (unlikely(rt_task(p)))
3047 + } else if (unlikely(rt_task(p)) && !in_interrupt())
3048 alloc_flags |= ALLOC_HARDER;
3049
3050 if (likely(!(gfp_mask & __GFP_NOMEMALLOC))) {
3051 @@ -1763,6 +1763,7 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
3052 if (NUMA_BUILD && (gfp_mask & GFP_THISNODE) == GFP_THISNODE)
3053 goto nopage;
3054
3055 +restart:
3056 wake_all_kswapd(order, zonelist, high_zoneidx);
3057
3058 /*
3059 @@ -1772,7 +1773,6 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
3060 */
3061 alloc_flags = gfp_to_alloc_flags(gfp_mask);
3062
3063 -restart:
3064 /* This is the last chance, in general, before the goto nopage. */
3065 page = get_page_from_freelist(gfp_mask, nodemask, order, zonelist,
3066 high_zoneidx, alloc_flags & ~ALLOC_NO_WATERMARKS,
3067 diff --git a/net/core/datagram.c b/net/core/datagram.c
3068 index b0fe692..caeb285 100644
3069 --- a/net/core/datagram.c
3070 +++ b/net/core/datagram.c
3071 @@ -223,6 +223,15 @@ void skb_free_datagram(struct sock *sk, struct sk_buff *skb)
3072 consume_skb(skb);
3073 sk_mem_reclaim_partial(sk);
3074 }
3075 +EXPORT_SYMBOL(skb_free_datagram);
3076 +
3077 +void skb_free_datagram_locked(struct sock *sk, struct sk_buff *skb)
3078 +{
3079 + lock_sock(sk);
3080 + skb_free_datagram(sk, skb);
3081 + release_sock(sk);
3082 +}
3083 +EXPORT_SYMBOL(skb_free_datagram_locked);
3084
3085 /**
3086 * skb_kill_datagram - Free a datagram skbuff forcibly
3087 @@ -749,5 +758,4 @@ unsigned int datagram_poll(struct file *file, struct socket *sock,
3088 EXPORT_SYMBOL(datagram_poll);
3089 EXPORT_SYMBOL(skb_copy_and_csum_datagram_iovec);
3090 EXPORT_SYMBOL(skb_copy_datagram_iovec);
3091 -EXPORT_SYMBOL(skb_free_datagram);
3092 EXPORT_SYMBOL(skb_recv_datagram);
3093 diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
3094 index 575f9bd..d3fe10b 100644
3095 --- a/net/ipv4/ip_fragment.c
3096 +++ b/net/ipv4/ip_fragment.c
3097 @@ -563,7 +563,7 @@ out_oversize:
3098 printk(KERN_INFO "Oversized IP packet from %pI4.\n",
3099 &qp->saddr);
3100 out_fail:
3101 - IP_INC_STATS_BH(dev_net(dev), IPSTATS_MIB_REASMFAILS);
3102 + IP_INC_STATS_BH(net, IPSTATS_MIB_REASMFAILS);
3103 return err;
3104 }
3105
3106 diff --git a/net/ipv4/netfilter/nf_nat_core.c b/net/ipv4/netfilter/nf_nat_core.c
3107 index b6ddd56..d396abf 100644
3108 --- a/net/ipv4/netfilter/nf_nat_core.c
3109 +++ b/net/ipv4/netfilter/nf_nat_core.c
3110 @@ -750,6 +750,8 @@ static int __init nf_nat_init(void)
3111 BUG_ON(nfnetlink_parse_nat_setup_hook != NULL);
3112 rcu_assign_pointer(nfnetlink_parse_nat_setup_hook,
3113 nfnetlink_parse_nat_setup);
3114 + BUG_ON(nf_ct_nat_offset != NULL);
3115 + rcu_assign_pointer(nf_ct_nat_offset, nf_nat_get_offset);
3116 return 0;
3117
3118 cleanup_extend:
3119 @@ -764,6 +766,7 @@ static void __exit nf_nat_cleanup(void)
3120 nf_ct_extend_unregister(&nat_extend);
3121 rcu_assign_pointer(nf_nat_seq_adjust_hook, NULL);
3122 rcu_assign_pointer(nfnetlink_parse_nat_setup_hook, NULL);
3123 + rcu_assign_pointer(nf_ct_nat_offset, NULL);
3124 synchronize_net();
3125 }
3126
3127 diff --git a/net/ipv4/netfilter/nf_nat_helper.c b/net/ipv4/netfilter/nf_nat_helper.c
3128 index 09172a6..f9520fa 100644
3129 --- a/net/ipv4/netfilter/nf_nat_helper.c
3130 +++ b/net/ipv4/netfilter/nf_nat_helper.c
3131 @@ -73,6 +73,28 @@ adjust_tcp_sequence(u32 seq,
3132 DUMP_OFFSET(this_way);
3133 }
3134
3135 +/* Get the offset value, for conntrack */
3136 +s16 nf_nat_get_offset(const struct nf_conn *ct,
3137 + enum ip_conntrack_dir dir,
3138 + u32 seq)
3139 +{
3140 + struct nf_conn_nat *nat = nfct_nat(ct);
3141 + struct nf_nat_seq *this_way;
3142 + s16 offset;
3143 +
3144 + if (!nat)
3145 + return 0;
3146 +
3147 + this_way = &nat->seq[dir];
3148 + spin_lock_bh(&nf_nat_seqofs_lock);
3149 + offset = after(seq, this_way->correction_pos)
3150 + ? this_way->offset_after : this_way->offset_before;
3151 + spin_unlock_bh(&nf_nat_seqofs_lock);
3152 +
3153 + return offset;
3154 +}
3155 +EXPORT_SYMBOL_GPL(nf_nat_get_offset);
3156 +
3157 /* Frobs data inside this packet, which is linear. */
3158 static void mangle_contents(struct sk_buff *skb,
3159 unsigned int dataoff,
3160 @@ -189,11 +211,6 @@ nf_nat_mangle_tcp_packet(struct sk_buff *skb,
3161 adjust_tcp_sequence(ntohl(tcph->seq),
3162 (int)rep_len - (int)match_len,
3163 ct, ctinfo);
3164 - /* Tell TCP window tracking about seq change */
3165 - nf_conntrack_tcp_update(skb, ip_hdrlen(skb),
3166 - ct, CTINFO2DIR(ctinfo),
3167 - (int)rep_len - (int)match_len);
3168 -
3169 nf_conntrack_event_cache(IPCT_NATSEQADJ, ct);
3170 }
3171 return 1;
3172 @@ -415,12 +432,7 @@ nf_nat_seq_adjust(struct sk_buff *skb,
3173 tcph->seq = newseq;
3174 tcph->ack_seq = newack;
3175
3176 - if (!nf_nat_sack_adjust(skb, tcph, ct, ctinfo))
3177 - return 0;
3178 -
3179 - nf_conntrack_tcp_update(skb, ip_hdrlen(skb), ct, dir, seqoff);
3180 -
3181 - return 1;
3182 + return nf_nat_sack_adjust(skb, tcph, ct, ctinfo);
3183 }
3184
3185 /* Setup NAT on this expected conntrack so it follows master. */
3186 diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
3187 index 80e3812..00d1f6d 100644
3188 --- a/net/ipv4/udp.c
3189 +++ b/net/ipv4/udp.c
3190 @@ -831,6 +831,42 @@ out:
3191 return ret;
3192 }
3193
3194 +
3195 +/**
3196 + * first_packet_length - return length of first packet in receive queue
3197 + * @sk: socket
3198 + *
3199 + * Drops all bad checksum frames, until a valid one is found.
3200 + * Returns the length of found skb, or 0 if none is found.
3201 + */
3202 +static unsigned int first_packet_length(struct sock *sk)
3203 +{
3204 + struct sk_buff_head list_kill, *rcvq = &sk->sk_receive_queue;
3205 + struct sk_buff *skb;
3206 + unsigned int res;
3207 +
3208 + __skb_queue_head_init(&list_kill);
3209 +
3210 + spin_lock_bh(&rcvq->lock);
3211 + while ((skb = skb_peek(rcvq)) != NULL &&
3212 + udp_lib_checksum_complete(skb)) {
3213 + UDP_INC_STATS_BH(sock_net(sk), UDP_MIB_INERRORS,
3214 + IS_UDPLITE(sk));
3215 + __skb_unlink(skb, rcvq);
3216 + __skb_queue_tail(&list_kill, skb);
3217 + }
3218 + res = skb ? skb->len : 0;
3219 + spin_unlock_bh(&rcvq->lock);
3220 +
3221 + if (!skb_queue_empty(&list_kill)) {
3222 + lock_sock(sk);
3223 + __skb_queue_purge(&list_kill);
3224 + sk_mem_reclaim_partial(sk);
3225 + release_sock(sk);
3226 + }
3227 + return res;
3228 +}
3229 +
3230 /*
3231 * IOCTL requests applicable to the UDP protocol
3232 */
3233 @@ -847,21 +883,16 @@ int udp_ioctl(struct sock *sk, int cmd, unsigned long arg)
3234
3235 case SIOCINQ:
3236 {
3237 - struct sk_buff *skb;
3238 - unsigned long amount;
3239 + unsigned int amount = first_packet_length(sk);
3240
3241 - amount = 0;
3242 - spin_lock_bh(&sk->sk_receive_queue.lock);
3243 - skb = skb_peek(&sk->sk_receive_queue);
3244 - if (skb != NULL) {
3245 + if (amount)
3246 /*
3247 * We will only return the amount
3248 * of this packet since that is all
3249 * that will be read.
3250 */
3251 - amount = skb->len - sizeof(struct udphdr);
3252 - }
3253 - spin_unlock_bh(&sk->sk_receive_queue.lock);
3254 + amount -= sizeof(struct udphdr);
3255 +
3256 return put_user(amount, (int __user *)arg);
3257 }
3258
3259 @@ -956,9 +987,7 @@ try_again:
3260 err = ulen;
3261
3262 out_free:
3263 - lock_sock(sk);
3264 - skb_free_datagram(sk, skb);
3265 - release_sock(sk);
3266 + skb_free_datagram_locked(sk, skb);
3267 out:
3268 return err;
3269
3270 @@ -1525,32 +1554,13 @@ unsigned int udp_poll(struct file *file, struct socket *sock, poll_table *wait)
3271 {
3272 unsigned int mask = datagram_poll(file, sock, wait);
3273 struct sock *sk = sock->sk;
3274 - int is_lite = IS_UDPLITE(sk);
3275
3276 /* Check for false positives due to checksum errors */
3277 - if ( (mask & POLLRDNORM) &&
3278 - !(file->f_flags & O_NONBLOCK) &&
3279 - !(sk->sk_shutdown & RCV_SHUTDOWN)){
3280 - struct sk_buff_head *rcvq = &sk->sk_receive_queue;
3281 - struct sk_buff *skb;
3282 -
3283 - spin_lock_bh(&rcvq->lock);
3284 - while ((skb = skb_peek(rcvq)) != NULL &&
3285 - udp_lib_checksum_complete(skb)) {
3286 - UDP_INC_STATS_BH(sock_net(sk),
3287 - UDP_MIB_INERRORS, is_lite);
3288 - __skb_unlink(skb, rcvq);
3289 - kfree_skb(skb);
3290 - }
3291 - spin_unlock_bh(&rcvq->lock);
3292 -
3293 - /* nothing to see, move along */
3294 - if (skb == NULL)
3295 - mask &= ~(POLLIN | POLLRDNORM);
3296 - }
3297 + if ((mask & POLLRDNORM) && !(file->f_flags & O_NONBLOCK) &&
3298 + !(sk->sk_shutdown & RCV_SHUTDOWN) && !first_packet_length(sk))
3299 + mask &= ~(POLLIN | POLLRDNORM);
3300
3301 return mask;
3302 -
3303 }
3304
3305 struct proto udp_prot = {
3306 diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
3307 index 33b59bd..333a6ec 100644
3308 --- a/net/ipv6/udp.c
3309 +++ b/net/ipv6/udp.c
3310 @@ -288,9 +288,7 @@ try_again:
3311 err = ulen;
3312
3313 out_free:
3314 - lock_sock(sk);
3315 - skb_free_datagram(sk, skb);
3316 - release_sock(sk);
3317 + skb_free_datagram_locked(sk, skb);
3318 out:
3319 return err;
3320
3321 diff --git a/net/mac80211/agg-rx.c b/net/mac80211/agg-rx.c
3322 index bc064d7..ce8e0e7 100644
3323 --- a/net/mac80211/agg-rx.c
3324 +++ b/net/mac80211/agg-rx.c
3325 @@ -85,10 +85,6 @@ void ieee80211_sta_stop_rx_ba_session(struct ieee80211_sub_if_data *sdata, u8 *r
3326 struct ieee80211_local *local = sdata->local;
3327 struct sta_info *sta;
3328
3329 - /* stop HW Rx aggregation. ampdu_action existence
3330 - * already verified in session init so we add the BUG_ON */
3331 - BUG_ON(!local->ops->ampdu_action);
3332 -
3333 rcu_read_lock();
3334
3335 sta = sta_info_get(local, ra);
3336 diff --git a/net/mac80211/agg-tx.c b/net/mac80211/agg-tx.c
3337 index a24e598..b9005e1 100644
3338 --- a/net/mac80211/agg-tx.c
3339 +++ b/net/mac80211/agg-tx.c
3340 @@ -123,13 +123,18 @@ void ieee80211_send_bar(struct ieee80211_sub_if_data *sdata, u8 *ra, u16 tid, u1
3341 ieee80211_tx_skb(sdata, skb, 0);
3342 }
3343
3344 -static int ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid,
3345 - enum ieee80211_back_parties initiator)
3346 +int ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid,
3347 + enum ieee80211_back_parties initiator)
3348 {
3349 struct ieee80211_local *local = sta->local;
3350 int ret;
3351 u8 *state;
3352
3353 +#ifdef CONFIG_MAC80211_HT_DEBUG
3354 + printk(KERN_DEBUG "Tx BA session stop requested for %pM tid %u\n",
3355 + sta->sta.addr, tid);
3356 +#endif /* CONFIG_MAC80211_HT_DEBUG */
3357 +
3358 state = &sta->ampdu_mlme.tid_state_tx[tid];
3359
3360 if (*state == HT_AGG_STATE_OPERATIONAL)
3361 @@ -143,7 +148,6 @@ static int ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid,
3362
3363 /* HW shall not deny going back to legacy */
3364 if (WARN_ON(ret)) {
3365 - *state = HT_AGG_STATE_OPERATIONAL;
3366 /*
3367 * We may have pending packets get stuck in this case...
3368 * Not bothering with a workaround for now.
3369 @@ -526,11 +530,6 @@ int __ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid,
3370 goto unlock;
3371 }
3372
3373 -#ifdef CONFIG_MAC80211_HT_DEBUG
3374 - printk(KERN_DEBUG "Tx BA session stop requested for %pM tid %u\n",
3375 - sta->sta.addr, tid);
3376 -#endif /* CONFIG_MAC80211_HT_DEBUG */
3377 -
3378 ret = ___ieee80211_stop_tx_ba_session(sta, tid, initiator);
3379
3380 unlock:
3381 @@ -546,7 +545,7 @@ int ieee80211_stop_tx_ba_session(struct ieee80211_hw *hw,
3382 struct sta_info *sta;
3383 int ret = 0;
3384
3385 - if (WARN_ON(!local->ops->ampdu_action))
3386 + if (!local->ops->ampdu_action)
3387 return -EINVAL;
3388
3389 if (tid >= STA_TID_NUM)
3390 diff --git a/net/mac80211/ht.c b/net/mac80211/ht.c
3391 index 0891bfb..a6b8eb4 100644
3392 --- a/net/mac80211/ht.c
3393 +++ b/net/mac80211/ht.c
3394 @@ -141,7 +141,6 @@ void ieee80211_process_delba(struct ieee80211_sub_if_data *sdata,
3395 struct sta_info *sta,
3396 struct ieee80211_mgmt *mgmt, size_t len)
3397 {
3398 - struct ieee80211_local *local = sdata->local;
3399 u16 tid, params;
3400 u16 initiator;
3401
3402 @@ -161,10 +160,9 @@ void ieee80211_process_delba(struct ieee80211_sub_if_data *sdata,
3403 WLAN_BACK_INITIATOR, 0);
3404 else { /* WLAN_BACK_RECIPIENT */
3405 spin_lock_bh(&sta->lock);
3406 - sta->ampdu_mlme.tid_state_tx[tid] =
3407 - HT_AGG_STATE_OPERATIONAL;
3408 + if (sta->ampdu_mlme.tid_state_tx[tid] & HT_ADDBA_REQUESTED_MSK)
3409 + ___ieee80211_stop_tx_ba_session(sta, tid,
3410 + WLAN_BACK_RECIPIENT);
3411 spin_unlock_bh(&sta->lock);
3412 - ieee80211_stop_tx_ba_session(&local->hw, sta->sta.addr, tid,
3413 - WLAN_BACK_RECIPIENT);
3414 }
3415 }
3416 diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
3417 index 68eb505..33a7e75 100644
3418 --- a/net/mac80211/ieee80211_i.h
3419 +++ b/net/mac80211/ieee80211_i.h
3420 @@ -1057,6 +1057,8 @@ void ieee80211_process_addba_request(struct ieee80211_local *local,
3421
3422 int __ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid,
3423 enum ieee80211_back_parties initiator);
3424 +int ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid,
3425 + enum ieee80211_back_parties initiator);
3426
3427 /* Spectrum management */
3428 void ieee80211_process_measurement_req(struct ieee80211_sub_if_data *sdata,
3429 diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
3430 index b8614c6..4299db7 100644
3431 --- a/net/netfilter/nf_conntrack_core.c
3432 +++ b/net/netfilter/nf_conntrack_core.c
3433 @@ -1350,6 +1350,11 @@ err_stat:
3434 return ret;
3435 }
3436
3437 +s16 (*nf_ct_nat_offset)(const struct nf_conn *ct,
3438 + enum ip_conntrack_dir dir,
3439 + u32 seq);
3440 +EXPORT_SYMBOL_GPL(nf_ct_nat_offset);
3441 +
3442 int nf_conntrack_init(struct net *net)
3443 {
3444 int ret;
3445 @@ -1367,6 +1372,9 @@ int nf_conntrack_init(struct net *net)
3446 /* For use by REJECT target */
3447 rcu_assign_pointer(ip_ct_attach, nf_conntrack_attach);
3448 rcu_assign_pointer(nf_ct_destroy, destroy_conntrack);
3449 +
3450 + /* Howto get NAT offsets */
3451 + rcu_assign_pointer(nf_ct_nat_offset, NULL);
3452 }
3453 return 0;
3454
3455 diff --git a/net/netfilter/nf_conntrack_proto_tcp.c b/net/netfilter/nf_conntrack_proto_tcp.c
3456 index 97a82ba..ba2b769 100644
3457 --- a/net/netfilter/nf_conntrack_proto_tcp.c
3458 +++ b/net/netfilter/nf_conntrack_proto_tcp.c
3459 @@ -492,6 +492,21 @@ static void tcp_sack(const struct sk_buff *skb, unsigned int dataoff,
3460 }
3461 }
3462
3463 +#ifdef CONFIG_NF_NAT_NEEDED
3464 +static inline s16 nat_offset(const struct nf_conn *ct,
3465 + enum ip_conntrack_dir dir,
3466 + u32 seq)
3467 +{
3468 + typeof(nf_ct_nat_offset) get_offset = rcu_dereference(nf_ct_nat_offset);
3469 +
3470 + return get_offset != NULL ? get_offset(ct, dir, seq) : 0;
3471 +}
3472 +#define NAT_OFFSET(pf, ct, dir, seq) \
3473 + (pf == NFPROTO_IPV4 ? nat_offset(ct, dir, seq) : 0)
3474 +#else
3475 +#define NAT_OFFSET(pf, ct, dir, seq) 0
3476 +#endif
3477 +
3478 static bool tcp_in_window(const struct nf_conn *ct,
3479 struct ip_ct_tcp *state,
3480 enum ip_conntrack_dir dir,
3481 @@ -506,6 +521,7 @@ static bool tcp_in_window(const struct nf_conn *ct,
3482 struct ip_ct_tcp_state *receiver = &state->seen[!dir];
3483 const struct nf_conntrack_tuple *tuple = &ct->tuplehash[dir].tuple;
3484 __u32 seq, ack, sack, end, win, swin;
3485 + s16 receiver_offset;
3486 bool res;
3487
3488 /*
3489 @@ -519,11 +535,16 @@ static bool tcp_in_window(const struct nf_conn *ct,
3490 if (receiver->flags & IP_CT_TCP_FLAG_SACK_PERM)
3491 tcp_sack(skb, dataoff, tcph, &sack);
3492
3493 + /* Take into account NAT sequence number mangling */
3494 + receiver_offset = NAT_OFFSET(pf, ct, !dir, ack - 1);
3495 + ack -= receiver_offset;
3496 + sack -= receiver_offset;
3497 +
3498 pr_debug("tcp_in_window: START\n");
3499 pr_debug("tcp_in_window: ");
3500 nf_ct_dump_tuple(tuple);
3501 - pr_debug("seq=%u ack=%u sack=%u win=%u end=%u\n",
3502 - seq, ack, sack, win, end);
3503 + pr_debug("seq=%u ack=%u+(%d) sack=%u+(%d) win=%u end=%u\n",
3504 + seq, ack, receiver_offset, sack, receiver_offset, win, end);
3505 pr_debug("tcp_in_window: sender end=%u maxend=%u maxwin=%u scale=%i "
3506 "receiver end=%u maxend=%u maxwin=%u scale=%i\n",
3507 sender->td_end, sender->td_maxend, sender->td_maxwin,
3508 @@ -613,8 +634,8 @@ static bool tcp_in_window(const struct nf_conn *ct,
3509
3510 pr_debug("tcp_in_window: ");
3511 nf_ct_dump_tuple(tuple);
3512 - pr_debug("seq=%u ack=%u sack =%u win=%u end=%u\n",
3513 - seq, ack, sack, win, end);
3514 + pr_debug("seq=%u ack=%u+(%d) sack=%u+(%d) win=%u end=%u\n",
3515 + seq, ack, receiver_offset, sack, receiver_offset, win, end);
3516 pr_debug("tcp_in_window: sender end=%u maxend=%u maxwin=%u scale=%i "
3517 "receiver end=%u maxend=%u maxwin=%u scale=%i\n",
3518 sender->td_end, sender->td_maxend, sender->td_maxwin,
3519 @@ -700,7 +721,7 @@ static bool tcp_in_window(const struct nf_conn *ct,
3520 before(seq, sender->td_maxend + 1) ?
3521 after(end, sender->td_end - receiver->td_maxwin - 1) ?
3522 before(sack, receiver->td_end + 1) ?
3523 - after(ack, receiver->td_end - MAXACKWINDOW(sender)) ? "BUG"
3524 + after(sack, receiver->td_end - MAXACKWINDOW(sender) - 1) ? "BUG"
3525 : "ACK is under the lower bound (possible overly delayed ACK)"
3526 : "ACK is over the upper bound (ACKed data not seen yet)"
3527 : "SEQ is under the lower bound (already ACKed data retransmitted)"
3528 @@ -715,39 +736,6 @@ static bool tcp_in_window(const struct nf_conn *ct,
3529 return res;
3530 }
3531
3532 -#ifdef CONFIG_NF_NAT_NEEDED
3533 -/* Update sender->td_end after NAT successfully mangled the packet */
3534 -/* Caller must linearize skb at tcp header. */
3535 -void nf_conntrack_tcp_update(const struct sk_buff *skb,
3536 - unsigned int dataoff,
3537 - struct nf_conn *ct, int dir,
3538 - s16 offset)
3539 -{
3540 - const struct tcphdr *tcph = (const void *)skb->data + dataoff;
3541 - const struct ip_ct_tcp_state *sender = &ct->proto.tcp.seen[dir];
3542 - const struct ip_ct_tcp_state *receiver = &ct->proto.tcp.seen[!dir];
3543 - __u32 end;
3544 -
3545 - end = segment_seq_plus_len(ntohl(tcph->seq), skb->len, dataoff, tcph);
3546 -
3547 - spin_lock_bh(&ct->lock);
3548 - /*
3549 - * We have to worry for the ack in the reply packet only...
3550 - */
3551 - if (ct->proto.tcp.seen[dir].td_end + offset == end)
3552 - ct->proto.tcp.seen[dir].td_end = end;
3553 - ct->proto.tcp.last_end = end;
3554 - spin_unlock_bh(&ct->lock);
3555 - pr_debug("tcp_update: sender end=%u maxend=%u maxwin=%u scale=%i "
3556 - "receiver end=%u maxend=%u maxwin=%u scale=%i\n",
3557 - sender->td_end, sender->td_maxend, sender->td_maxwin,
3558 - sender->td_scale,
3559 - receiver->td_end, receiver->td_maxend, receiver->td_maxwin,
3560 - receiver->td_scale);
3561 -}
3562 -EXPORT_SYMBOL_GPL(nf_conntrack_tcp_update);
3563 -#endif
3564 -
3565 #define TH_FIN 0x01
3566 #define TH_SYN 0x02
3567 #define TH_RST 0x04
3568 diff --git a/net/netfilter/xt_connlimit.c b/net/netfilter/xt_connlimit.c
3569 index 6809809..38f03f7 100644
3570 --- a/net/netfilter/xt_connlimit.c
3571 +++ b/net/netfilter/xt_connlimit.c
3572 @@ -103,7 +103,7 @@ static int count_them(struct xt_connlimit_data *data,
3573 const struct nf_conntrack_tuple *tuple,
3574 const union nf_inet_addr *addr,
3575 const union nf_inet_addr *mask,
3576 - const struct xt_match *match)
3577 + u_int8_t family)
3578 {
3579 const struct nf_conntrack_tuple_hash *found;
3580 struct xt_connlimit_conn *conn;
3581 @@ -113,8 +113,7 @@ static int count_them(struct xt_connlimit_data *data,
3582 bool addit = true;
3583 int matches = 0;
3584
3585 -
3586 - if (match->family == NFPROTO_IPV6)
3587 + if (family == NFPROTO_IPV6)
3588 hash = &data->iphash[connlimit_iphash6(addr, mask)];
3589 else
3590 hash = &data->iphash[connlimit_iphash(addr->ip & mask->ip)];
3591 @@ -157,8 +156,7 @@ static int count_them(struct xt_connlimit_data *data,
3592 continue;
3593 }
3594
3595 - if (same_source_net(addr, mask, &conn->tuple.src.u3,
3596 - match->family))
3597 + if (same_source_net(addr, mask, &conn->tuple.src.u3, family))
3598 /* same source network -> be counted! */
3599 ++matches;
3600 nf_ct_put(found_ct);
3601 @@ -207,7 +205,7 @@ connlimit_mt(const struct sk_buff *skb, const struct xt_match_param *par)
3602
3603 spin_lock_bh(&info->data->lock);
3604 connections = count_them(info->data, tuple_ptr, &addr,
3605 - &info->mask, par->match);
3606 + &info->mask, par->family);
3607 spin_unlock_bh(&info->data->lock);
3608
3609 if (connections < 0) {
3610 diff --git a/net/rfkill/core.c b/net/rfkill/core.c
3611 index 2fc4a17..d2438f9 100644
3612 --- a/net/rfkill/core.c
3613 +++ b/net/rfkill/core.c
3614 @@ -1180,6 +1180,7 @@ static long rfkill_fop_ioctl(struct file *file, unsigned int cmd,
3615 #endif
3616
3617 static const struct file_operations rfkill_fops = {
3618 + .owner = THIS_MODULE,
3619 .open = rfkill_fop_open,
3620 .read = rfkill_fop_read,
3621 .write = rfkill_fop_write,
3622 diff --git a/net/sched/act_pedit.c b/net/sched/act_pedit.c
3623 index 96c0ed1..6b0359a 100644
3624 --- a/net/sched/act_pedit.c
3625 +++ b/net/sched/act_pedit.c
3626 @@ -34,7 +34,7 @@ static struct tcf_hashinfo pedit_hash_info = {
3627 };
3628
3629 static const struct nla_policy pedit_policy[TCA_PEDIT_MAX + 1] = {
3630 - [TCA_PEDIT_PARMS] = { .len = sizeof(struct tcf_pedit) },
3631 + [TCA_PEDIT_PARMS] = { .len = sizeof(struct tc_pedit) },
3632 };
3633
3634 static int tcf_pedit_init(struct nlattr *nla, struct nlattr *est,
3635 diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
3636 index 23128ee..39e37bc 100644
3637 --- a/net/sunrpc/svcsock.c
3638 +++ b/net/sunrpc/svcsock.c
3639 @@ -110,7 +110,7 @@ static void svc_release_skb(struct svc_rqst *rqstp)
3640 rqstp->rq_xprt_ctxt = NULL;
3641
3642 dprintk("svc: service %p, releasing skb %p\n", rqstp, skb);
3643 - skb_free_datagram(svsk->sk_sk, skb);
3644 + skb_free_datagram_locked(svsk->sk_sk, skb);
3645 }
3646 }
3647
3648 @@ -537,7 +537,7 @@ static int svc_udp_recvfrom(struct svc_rqst *rqstp)
3649 printk("rpcsvc: received unknown control message:"
3650 "%d/%d\n",
3651 cmh->cmsg_level, cmh->cmsg_type);
3652 - skb_free_datagram(svsk->sk_sk, skb);
3653 + skb_free_datagram_locked(svsk->sk_sk, skb);
3654 return 0;
3655 }
3656 svc_udp_get_dest_address(rqstp, cmh);
3657 @@ -548,18 +548,18 @@ static int svc_udp_recvfrom(struct svc_rqst *rqstp)
3658 if (csum_partial_copy_to_xdr(&rqstp->rq_arg, skb)) {
3659 local_bh_enable();
3660 /* checksum error */
3661 - skb_free_datagram(svsk->sk_sk, skb);
3662 + skb_free_datagram_locked(svsk->sk_sk, skb);
3663 return 0;
3664 }
3665 local_bh_enable();
3666 - skb_free_datagram(svsk->sk_sk, skb);
3667 + skb_free_datagram_locked(svsk->sk_sk, skb);
3668 } else {
3669 /* we can use it in-place */
3670 rqstp->rq_arg.head[0].iov_base = skb->data +
3671 sizeof(struct udphdr);
3672 rqstp->rq_arg.head[0].iov_len = len;
3673 if (skb_checksum_complete(skb)) {
3674 - skb_free_datagram(svsk->sk_sk, skb);
3675 + skb_free_datagram_locked(svsk->sk_sk, skb);
3676 return 0;
3677 }
3678 rqstp->rq_xprt_ctxt = skb;
3679 diff --git a/security/integrity/ima/ima_iint.c b/security/integrity/ima/ima_iint.c
3680 index b8dd693..a4e2b1d 100644
3681 --- a/security/integrity/ima/ima_iint.c
3682 +++ b/security/integrity/ima/ima_iint.c
3683 @@ -58,11 +58,11 @@ struct ima_iint_cache *ima_iint_insert(struct inode *inode)
3684
3685 if (!ima_initialized)
3686 return iint;
3687 - iint = kmem_cache_alloc(iint_cache, GFP_KERNEL);
3688 + iint = kmem_cache_alloc(iint_cache, GFP_NOFS);
3689 if (!iint)
3690 return iint;
3691
3692 - rc = radix_tree_preload(GFP_KERNEL);
3693 + rc = radix_tree_preload(GFP_NOFS);
3694 if (rc < 0)
3695 goto out;
3696
3697 diff --git a/sound/arm/aaci.c b/sound/arm/aaci.c
3698 index dc78272..dbb05b7 100644
3699 --- a/sound/arm/aaci.c
3700 +++ b/sound/arm/aaci.c
3701 @@ -504,6 +504,10 @@ static int aaci_pcm_hw_params(struct snd_pcm_substream *substream,
3702 int err;
3703
3704 aaci_pcm_hw_free(substream);
3705 + if (aacirun->pcm_open) {
3706 + snd_ac97_pcm_close(aacirun->pcm);
3707 + aacirun->pcm_open = 0;
3708 + }
3709
3710 err = devdma_hw_alloc(NULL, substream,
3711 params_buffer_bytes(params));
3712 @@ -517,7 +521,7 @@ static int aaci_pcm_hw_params(struct snd_pcm_substream *substream,
3713 else
3714 err = snd_ac97_pcm_open(aacirun->pcm, params_rate(params),
3715 params_channels(params),
3716 - aacirun->pcm->r[1].slots);
3717 + aacirun->pcm->r[0].slots);
3718
3719 if (err)
3720 goto out;
3721 diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c
3722 index 473247c..70d6f25 100644
3723 --- a/sound/core/rawmidi.c
3724 +++ b/sound/core/rawmidi.c
3725 @@ -248,7 +248,8 @@ static int assign_substream(struct snd_rawmidi *rmidi, int subdevice,
3726 list_for_each_entry(substream, &s->substreams, list) {
3727 if (substream->opened) {
3728 if (stream == SNDRV_RAWMIDI_STREAM_INPUT ||
3729 - !(mode & SNDRV_RAWMIDI_LFLG_APPEND))
3730 + !(mode & SNDRV_RAWMIDI_LFLG_APPEND) ||
3731 + !substream->append)
3732 continue;
3733 }
3734 if (subdevice < 0 || subdevice == substream->number) {
3735 @@ -266,17 +267,21 @@ static int open_substream(struct snd_rawmidi *rmidi,
3736 {
3737 int err;
3738
3739 - err = snd_rawmidi_runtime_create(substream);
3740 - if (err < 0)
3741 - return err;
3742 - err = substream->ops->open(substream);
3743 - if (err < 0)
3744 - return err;
3745 - substream->opened = 1;
3746 - if (substream->use_count++ == 0)
3747 - substream->active_sensing = 1;
3748 - if (mode & SNDRV_RAWMIDI_LFLG_APPEND)
3749 - substream->append = 1;
3750 + if (substream->use_count == 0) {
3751 + err = snd_rawmidi_runtime_create(substream);
3752 + if (err < 0)
3753 + return err;
3754 + err = substream->ops->open(substream);
3755 + if (err < 0) {
3756 + snd_rawmidi_runtime_free(substream);
3757 + return err;
3758 + }
3759 + substream->opened = 1;
3760 + substream->active_sensing = 0;
3761 + if (mode & SNDRV_RAWMIDI_LFLG_APPEND)
3762 + substream->append = 1;
3763 + }
3764 + substream->use_count++;
3765 rmidi->streams[substream->stream].substream_opened++;
3766 return 0;
3767 }
3768 @@ -297,27 +302,27 @@ static int rawmidi_open_priv(struct snd_rawmidi *rmidi, int subdevice, int mode,
3769 SNDRV_RAWMIDI_STREAM_INPUT,
3770 mode, &sinput);
3771 if (err < 0)
3772 - goto __error;
3773 + return err;
3774 }
3775 if (mode & SNDRV_RAWMIDI_LFLG_OUTPUT) {
3776 err = assign_substream(rmidi, subdevice,
3777 SNDRV_RAWMIDI_STREAM_OUTPUT,
3778 mode, &soutput);
3779 if (err < 0)
3780 - goto __error;
3781 + return err;
3782 }
3783
3784 if (sinput) {
3785 err = open_substream(rmidi, sinput, mode);
3786 if (err < 0)
3787 - goto __error;
3788 + return err;
3789 }
3790 if (soutput) {
3791 err = open_substream(rmidi, soutput, mode);
3792 if (err < 0) {
3793 if (sinput)
3794 close_substream(rmidi, sinput, 0);
3795 - goto __error;
3796 + return err;
3797 }
3798 }
3799
3800 @@ -325,13 +330,6 @@ static int rawmidi_open_priv(struct snd_rawmidi *rmidi, int subdevice, int mode,
3801 rfile->input = sinput;
3802 rfile->output = soutput;
3803 return 0;
3804 -
3805 - __error:
3806 - if (sinput && sinput->runtime)
3807 - snd_rawmidi_runtime_free(sinput);
3808 - if (soutput && soutput->runtime)
3809 - snd_rawmidi_runtime_free(soutput);
3810 - return err;
3811 }
3812
3813 /* called from sound/core/seq/seq_midi.c */
3814 diff --git a/sound/core/seq/seq_midi.c b/sound/core/seq/seq_midi.c
3815 index 4d26146..90356b8 100644
3816 --- a/sound/core/seq/seq_midi.c
3817 +++ b/sound/core/seq/seq_midi.c
3818 @@ -236,6 +236,7 @@ static int midisynth_use(void *private_data, struct snd_seq_port_subscribe *info
3819 memset(&params, 0, sizeof(params));
3820 params.avail_min = 1;
3821 params.buffer_size = output_buffer_size;
3822 + params.no_active_sensing = 1;
3823 if ((err = snd_rawmidi_output_params(msynth->output_rfile.output, &params)) < 0) {
3824 snd_rawmidi_kernel_release(&msynth->output_rfile);
3825 return err;
3826 diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
3827 index 6990cfc..285b1e2 100644
3828 --- a/sound/pci/hda/patch_sigmatel.c
3829 +++ b/sound/pci/hda/patch_sigmatel.c
3830 @@ -1817,6 +1817,8 @@ static struct snd_pci_quirk stac92hd73xx_cfg_tbl[] = {
3831 "Dell Studio 17", STAC_DELL_M6_DMIC),
3832 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02be,
3833 "Dell Studio 1555", STAC_DELL_M6_DMIC),
3834 + SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02bd,
3835 + "Dell Studio 1557", STAC_DELL_M6_DMIC),
3836 {} /* terminator */
3837 };
3838
3839 diff --git a/sound/soc/codecs/tlv320aic23.c b/sound/soc/codecs/tlv320aic23.c
3840 index 0b8dcb5..1365de0 100644
3841 --- a/sound/soc/codecs/tlv320aic23.c
3842 +++ b/sound/soc/codecs/tlv320aic23.c
3843 @@ -625,11 +625,10 @@ static int tlv320aic23_resume(struct platform_device *pdev)
3844 {
3845 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
3846 struct snd_soc_codec *codec = socdev->card->codec;
3847 - int i;
3848 u16 reg;
3849
3850 /* Sync reg_cache with the hardware */
3851 - for (reg = 0; reg < ARRAY_SIZE(tlv320aic23_reg); i++) {
3852 + for (reg = 0; reg < TLV320AIC23_RESET; reg++) {
3853 u16 val = tlv320aic23_read_reg_cache(codec, reg);
3854 tlv320aic23_write(codec, reg, val);
3855 }
3856 diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
3857 index 21c6907..4aba33f 100644
3858 --- a/sound/soc/soc-dapm.c
3859 +++ b/sound/soc/soc-dapm.c
3860 @@ -774,9 +774,19 @@ static int dapm_power_widgets(struct snd_soc_codec *codec, int event)
3861 if (!w->power_check)
3862 continue;
3863
3864 - power = w->power_check(w);
3865 - if (power)
3866 - sys_power = 1;
3867 + /* If we're suspending then pull down all the
3868 + * power. */
3869 + switch (event) {
3870 + case SND_SOC_DAPM_STREAM_SUSPEND:
3871 + power = 0;
3872 + break;
3873 +
3874 + default:
3875 + power = w->power_check(w);
3876 + if (power)
3877 + sys_power = 1;
3878 + break;
3879 + }
3880
3881 if (w->power == power)
3882 continue;
3883 diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h
3884 index 8e7f789..e9a3a9d 100644
3885 --- a/sound/usb/usbaudio.h
3886 +++ b/sound/usb/usbaudio.h
3887 @@ -210,7 +210,7 @@ struct snd_usb_midi_endpoint_info {
3888 /*
3889 */
3890
3891 -#define combine_word(s) ((*s) | ((unsigned int)(s)[1] << 8))
3892 +#define combine_word(s) ((*(s)) | ((unsigned int)(s)[1] << 8))
3893 #define combine_triple(s) (combine_word(s) | ((unsigned int)(s)[2] << 16))
3894 #define combine_quad(s) (combine_triple(s) | ((unsigned int)(s)[3] << 24))
3895