Magellan Linux

Annotation of /trunk/kernel-magellan/patches-3.2/0105-3.2.6-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1644 - (hide annotations) (download)
Thu Feb 16 12:24:52 2012 UTC (12 years, 3 months ago) by niro
File size: 99436 byte(s)
-3.2.6-magellan-r1
1 niro 1644 diff --git a/arch/arm/kernel/ptrace.c b/arch/arm/kernel/ptrace.c
2     index 483727a..90fa8b3 100644
3     --- a/arch/arm/kernel/ptrace.c
4     +++ b/arch/arm/kernel/ptrace.c
5     @@ -699,10 +699,13 @@ static int vfp_set(struct task_struct *target,
6     {
7     int ret;
8     struct thread_info *thread = task_thread_info(target);
9     - struct vfp_hard_struct new_vfp = thread->vfpstate.hard;
10     + struct vfp_hard_struct new_vfp;
11     const size_t user_fpregs_offset = offsetof(struct user_vfp, fpregs);
12     const size_t user_fpscr_offset = offsetof(struct user_vfp, fpscr);
13    
14     + vfp_sync_hwstate(thread);
15     + new_vfp = thread->vfpstate.hard;
16     +
17     ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
18     &new_vfp.fpregs,
19     user_fpregs_offset,
20     @@ -723,9 +726,8 @@ static int vfp_set(struct task_struct *target,
21     if (ret)
22     return ret;
23    
24     - vfp_sync_hwstate(thread);
25     - thread->vfpstate.hard = new_vfp;
26     vfp_flush_hwstate(thread);
27     + thread->vfpstate.hard = new_vfp;
28    
29     return 0;
30     }
31     diff --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c
32     index 0340224..9e617bd 100644
33     --- a/arch/arm/kernel/signal.c
34     +++ b/arch/arm/kernel/signal.c
35     @@ -227,6 +227,8 @@ static int restore_vfp_context(struct vfp_sigframe __user *frame)
36     if (magic != VFP_MAGIC || size != VFP_STORAGE_SIZE)
37     return -EINVAL;
38    
39     + vfp_flush_hwstate(thread);
40     +
41     /*
42     * Copy the floating point registers. There can be unused
43     * registers see asm/hwcap.h for details.
44     @@ -251,9 +253,6 @@ static int restore_vfp_context(struct vfp_sigframe __user *frame)
45     __get_user_error(h->fpinst, &frame->ufp_exc.fpinst, err);
46     __get_user_error(h->fpinst2, &frame->ufp_exc.fpinst2, err);
47    
48     - if (!err)
49     - vfp_flush_hwstate(thread);
50     -
51     return err ? -EFAULT : 0;
52     }
53    
54     diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
55     index 130034b..dfffbbf 100644
56     --- a/arch/arm/mach-omap2/gpmc.c
57     +++ b/arch/arm/mach-omap2/gpmc.c
58     @@ -528,7 +528,13 @@ int gpmc_cs_configure(int cs, int cmd, int wval)
59    
60     case GPMC_CONFIG_DEV_SIZE:
61     regval = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1);
62     +
63     + /* clear 2 target bits */
64     + regval &= ~GPMC_CONFIG1_DEVICESIZE(3);
65     +
66     + /* set the proper value */
67     regval |= GPMC_CONFIG1_DEVICESIZE(wval);
68     +
69     gpmc_cs_write_reg(cs, GPMC_CS_CONFIG1, regval);
70     break;
71    
72     diff --git a/drivers/cpufreq/powernow-k8.c b/drivers/cpufreq/powernow-k8.c
73     index bce576d..ad683ec 100644
74     --- a/drivers/cpufreq/powernow-k8.c
75     +++ b/drivers/cpufreq/powernow-k8.c
76     @@ -54,6 +54,9 @@ static DEFINE_PER_CPU(struct powernow_k8_data *, powernow_data);
77    
78     static int cpu_family = CPU_OPTERON;
79    
80     +/* array to map SW pstate number to acpi state */
81     +static u32 ps_to_as[8];
82     +
83     /* core performance boost */
84     static bool cpb_capable, cpb_enabled;
85     static struct msr __percpu *msrs;
86     @@ -80,9 +83,9 @@ static u32 find_khz_freq_from_fid(u32 fid)
87     }
88    
89     static u32 find_khz_freq_from_pstate(struct cpufreq_frequency_table *data,
90     - u32 pstate)
91     + u32 pstate)
92     {
93     - return data[pstate].frequency;
94     + return data[ps_to_as[pstate]].frequency;
95     }
96    
97     /* Return the vco fid for an input fid
98     @@ -926,23 +929,27 @@ static int fill_powernow_table_pstate(struct powernow_k8_data *data,
99     invalidate_entry(powernow_table, i);
100     continue;
101     }
102     - rdmsr(MSR_PSTATE_DEF_BASE + index, lo, hi);
103     - if (!(hi & HW_PSTATE_VALID_MASK)) {
104     - pr_debug("invalid pstate %d, ignoring\n", index);
105     - invalidate_entry(powernow_table, i);
106     - continue;
107     - }
108    
109     - powernow_table[i].index = index;
110     + ps_to_as[index] = i;
111    
112     /* Frequency may be rounded for these */
113     if ((boot_cpu_data.x86 == 0x10 && boot_cpu_data.x86_model < 10)
114     || boot_cpu_data.x86 == 0x11) {
115     +
116     + rdmsr(MSR_PSTATE_DEF_BASE + index, lo, hi);
117     + if (!(hi & HW_PSTATE_VALID_MASK)) {
118     + pr_debug("invalid pstate %d, ignoring\n", index);
119     + invalidate_entry(powernow_table, i);
120     + continue;
121     + }
122     +
123     powernow_table[i].frequency =
124     freq_from_fid_did(lo & 0x3f, (lo >> 6) & 7);
125     } else
126     powernow_table[i].frequency =
127     data->acpi_data.states[i].core_frequency * 1000;
128     +
129     + powernow_table[i].index = index;
130     }
131     return 0;
132     }
133     @@ -1189,7 +1196,8 @@ static int powernowk8_target(struct cpufreq_policy *pol,
134     powernow_k8_acpi_pst_values(data, newstate);
135    
136     if (cpu_family == CPU_HW_PSTATE)
137     - ret = transition_frequency_pstate(data, newstate);
138     + ret = transition_frequency_pstate(data,
139     + data->powernow_table[newstate].index);
140     else
141     ret = transition_frequency_fidvid(data, newstate);
142     if (ret) {
143     @@ -1202,7 +1210,7 @@ static int powernowk8_target(struct cpufreq_policy *pol,
144    
145     if (cpu_family == CPU_HW_PSTATE)
146     pol->cur = find_khz_freq_from_pstate(data->powernow_table,
147     - newstate);
148     + data->powernow_table[newstate].index);
149     else
150     pol->cur = find_khz_freq_from_fid(data->currfid);
151     ret = 0;
152     diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
153     index fcfa0a8..a60adbf 100644
154     --- a/drivers/dma/at_hdmac.c
155     +++ b/drivers/dma/at_hdmac.c
156     @@ -1286,7 +1286,7 @@ static int __init at_dma_probe(struct platform_device *pdev)
157    
158     tasklet_init(&atchan->tasklet, atc_tasklet,
159     (unsigned long)atchan);
160     - atc_enable_irq(atchan);
161     + atc_enable_chan_irq(atdma, i);
162     }
163    
164     /* set base routines */
165     @@ -1353,7 +1353,7 @@ static int __exit at_dma_remove(struct platform_device *pdev)
166     struct at_dma_chan *atchan = to_at_dma_chan(chan);
167    
168     /* Disable interrupts */
169     - atc_disable_irq(atchan);
170     + atc_disable_chan_irq(atdma, chan->chan_id);
171     tasklet_disable(&atchan->tasklet);
172    
173     tasklet_kill(&atchan->tasklet);
174     diff --git a/drivers/dma/at_hdmac_regs.h b/drivers/dma/at_hdmac_regs.h
175     index aa4c9ae..5aa82b4 100644
176     --- a/drivers/dma/at_hdmac_regs.h
177     +++ b/drivers/dma/at_hdmac_regs.h
178     @@ -326,28 +326,27 @@ static void atc_dump_lli(struct at_dma_chan *atchan, struct at_lli *lli)
179     }
180    
181    
182     -static void atc_setup_irq(struct at_dma_chan *atchan, int on)
183     +static void atc_setup_irq(struct at_dma *atdma, int chan_id, int on)
184     {
185     - struct at_dma *atdma = to_at_dma(atchan->chan_common.device);
186     - u32 ebci;
187     + u32 ebci;
188    
189     /* enable interrupts on buffer transfer completion & error */
190     - ebci = AT_DMA_BTC(atchan->chan_common.chan_id)
191     - | AT_DMA_ERR(atchan->chan_common.chan_id);
192     + ebci = AT_DMA_BTC(chan_id)
193     + | AT_DMA_ERR(chan_id);
194     if (on)
195     dma_writel(atdma, EBCIER, ebci);
196     else
197     dma_writel(atdma, EBCIDR, ebci);
198     }
199    
200     -static inline void atc_enable_irq(struct at_dma_chan *atchan)
201     +static void atc_enable_chan_irq(struct at_dma *atdma, int chan_id)
202     {
203     - atc_setup_irq(atchan, 1);
204     + atc_setup_irq(atdma, chan_id, 1);
205     }
206    
207     -static inline void atc_disable_irq(struct at_dma_chan *atchan)
208     +static void atc_disable_chan_irq(struct at_dma *atdma, int chan_id)
209     {
210     - atc_setup_irq(atchan, 0);
211     + atc_setup_irq(atdma, chan_id, 0);
212     }
213    
214    
215     diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c
216     index 6628fea..7f5f0da 100644
217     --- a/drivers/firewire/ohci.c
218     +++ b/drivers/firewire/ohci.c
219     @@ -263,6 +263,7 @@ static inline struct fw_ohci *fw_ohci(struct fw_card *card)
220     static char ohci_driver_name[] = KBUILD_MODNAME;
221    
222     #define PCI_DEVICE_ID_AGERE_FW643 0x5901
223     +#define PCI_DEVICE_ID_CREATIVE_SB1394 0x4001
224     #define PCI_DEVICE_ID_JMICRON_JMB38X_FW 0x2380
225     #define PCI_DEVICE_ID_TI_TSB12LV22 0x8009
226     #define PCI_DEVICE_ID_TI_TSB12LV26 0x8020
227     @@ -289,6 +290,9 @@ static const struct {
228     {PCI_VENDOR_ID_ATT, PCI_DEVICE_ID_AGERE_FW643, 6,
229     QUIRK_NO_MSI},
230    
231     + {PCI_VENDOR_ID_CREATIVE, PCI_DEVICE_ID_CREATIVE_SB1394, PCI_ANY_ID,
232     + QUIRK_RESET_PACKET},
233     +
234     {PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB38X_FW, PCI_ANY_ID,
235     QUIRK_NO_MSI},
236    
237     @@ -299,7 +303,7 @@ static const struct {
238     QUIRK_NO_MSI},
239    
240     {PCI_VENDOR_ID_RICOH, PCI_ANY_ID, PCI_ANY_ID,
241     - QUIRK_CYCLE_TIMER},
242     + QUIRK_CYCLE_TIMER | QUIRK_NO_MSI},
243    
244     {PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_TSB12LV22, PCI_ANY_ID,
245     QUIRK_CYCLE_TIMER | QUIRK_RESET_PACKET | QUIRK_NO_1394A},
246     diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
247     index 004b048..b2e3c97 100644
248     --- a/drivers/gpu/drm/i915/i915_debugfs.c
249     +++ b/drivers/gpu/drm/i915/i915_debugfs.c
250     @@ -1314,9 +1314,13 @@ static int i915_gen6_forcewake_count_info(struct seq_file *m, void *data)
251     struct drm_info_node *node = (struct drm_info_node *) m->private;
252     struct drm_device *dev = node->minor->dev;
253     struct drm_i915_private *dev_priv = dev->dev_private;
254     + unsigned forcewake_count;
255    
256     - seq_printf(m, "forcewake count = %d\n",
257     - atomic_read(&dev_priv->forcewake_count));
258     + spin_lock_irq(&dev_priv->gt_lock);
259     + forcewake_count = dev_priv->forcewake_count;
260     + spin_unlock_irq(&dev_priv->gt_lock);
261     +
262     + seq_printf(m, "forcewake count = %u\n", forcewake_count);
263    
264     return 0;
265     }
266     diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
267     index a9ae374..c4da951 100644
268     --- a/drivers/gpu/drm/i915/i915_dma.c
269     +++ b/drivers/gpu/drm/i915/i915_dma.c
270     @@ -2042,6 +2042,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
271     if (!IS_I945G(dev) && !IS_I945GM(dev))
272     pci_enable_msi(dev->pdev);
273    
274     + spin_lock_init(&dev_priv->gt_lock);
275     spin_lock_init(&dev_priv->irq_lock);
276     spin_lock_init(&dev_priv->error_lock);
277     spin_lock_init(&dev_priv->rps_lock);
278     diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
279     index a1103fc..e2d85a9 100644
280     --- a/drivers/gpu/drm/i915/i915_drv.c
281     +++ b/drivers/gpu/drm/i915/i915_drv.c
282     @@ -368,11 +368,12 @@ void __gen6_gt_force_wake_mt_get(struct drm_i915_private *dev_priv)
283     */
284     void gen6_gt_force_wake_get(struct drm_i915_private *dev_priv)
285     {
286     - WARN_ON(!mutex_is_locked(&dev_priv->dev->struct_mutex));
287     + unsigned long irqflags;
288    
289     - /* Forcewake is atomic in case we get in here without the lock */
290     - if (atomic_add_return(1, &dev_priv->forcewake_count) == 1)
291     + spin_lock_irqsave(&dev_priv->gt_lock, irqflags);
292     + if (dev_priv->forcewake_count++ == 0)
293     dev_priv->display.force_wake_get(dev_priv);
294     + spin_unlock_irqrestore(&dev_priv->gt_lock, irqflags);
295     }
296    
297     void __gen6_gt_force_wake_put(struct drm_i915_private *dev_priv)
298     @@ -392,10 +393,12 @@ void __gen6_gt_force_wake_mt_put(struct drm_i915_private *dev_priv)
299     */
300     void gen6_gt_force_wake_put(struct drm_i915_private *dev_priv)
301     {
302     - WARN_ON(!mutex_is_locked(&dev_priv->dev->struct_mutex));
303     + unsigned long irqflags;
304    
305     - if (atomic_dec_and_test(&dev_priv->forcewake_count))
306     + spin_lock_irqsave(&dev_priv->gt_lock, irqflags);
307     + if (--dev_priv->forcewake_count == 0)
308     dev_priv->display.force_wake_put(dev_priv);
309     + spin_unlock_irqrestore(&dev_priv->gt_lock, irqflags);
310     }
311    
312     void __gen6_gt_wait_for_fifo(struct drm_i915_private *dev_priv)
313     @@ -626,6 +629,7 @@ int i915_reset(struct drm_device *dev, u8 flags)
314     * need to
315     */
316     bool need_display = true;
317     + unsigned long irqflags;
318     int ret;
319    
320     if (!i915_try_reset)
321     @@ -644,8 +648,10 @@ int i915_reset(struct drm_device *dev, u8 flags)
322     case 6:
323     ret = gen6_do_reset(dev, flags);
324     /* If reset with a user forcewake, try to restore */
325     - if (atomic_read(&dev_priv->forcewake_count))
326     - __gen6_gt_force_wake_get(dev_priv);
327     + spin_lock_irqsave(&dev_priv->gt_lock, irqflags);
328     + if (dev_priv->forcewake_count)
329     + dev_priv->display.force_wake_get(dev_priv);
330     + spin_unlock_irqrestore(&dev_priv->gt_lock, irqflags);
331     break;
332     case 5:
333     ret = ironlake_do_reset(dev, flags);
334     diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
335     index 554bef7..ae294a0 100644
336     --- a/drivers/gpu/drm/i915/i915_drv.h
337     +++ b/drivers/gpu/drm/i915/i915_drv.h
338     @@ -286,7 +286,13 @@ typedef struct drm_i915_private {
339     int relative_constants_mode;
340    
341     void __iomem *regs;
342     - u32 gt_fifo_count;
343     + /** gt_fifo_count and the subsequent register write are synchronized
344     + * with dev->struct_mutex. */
345     + unsigned gt_fifo_count;
346     + /** forcewake_count is protected by gt_lock */
347     + unsigned forcewake_count;
348     + /** gt_lock is also taken in irq contexts. */
349     + struct spinlock gt_lock;
350    
351     struct intel_gmbus {
352     struct i2c_adapter adapter;
353     @@ -337,6 +343,8 @@ typedef struct drm_i915_private {
354     struct timer_list hangcheck_timer;
355     int hangcheck_count;
356     uint32_t last_acthd;
357     + uint32_t last_acthd_bsd;
358     + uint32_t last_acthd_blt;
359     uint32_t last_instdone;
360     uint32_t last_instdone1;
361    
362     @@ -736,8 +744,6 @@ typedef struct drm_i915_private {
363    
364     struct drm_property *broadcast_rgb_property;
365     struct drm_property *force_audio_property;
366     -
367     - atomic_t forcewake_count;
368     } drm_i915_private_t;
369    
370     enum i915_cache_level {
371     diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
372     index b40004b..d47a53b 100644
373     --- a/drivers/gpu/drm/i915/i915_irq.c
374     +++ b/drivers/gpu/drm/i915/i915_irq.c
375     @@ -1669,7 +1669,7 @@ void i915_hangcheck_elapsed(unsigned long data)
376     {
377     struct drm_device *dev = (struct drm_device *)data;
378     drm_i915_private_t *dev_priv = dev->dev_private;
379     - uint32_t acthd, instdone, instdone1;
380     + uint32_t acthd, instdone, instdone1, acthd_bsd, acthd_blt;
381     bool err = false;
382    
383     if (!i915_enable_hangcheck)
384     @@ -1686,16 +1686,21 @@ void i915_hangcheck_elapsed(unsigned long data)
385     }
386    
387     if (INTEL_INFO(dev)->gen < 4) {
388     - acthd = I915_READ(ACTHD);
389     instdone = I915_READ(INSTDONE);
390     instdone1 = 0;
391     } else {
392     - acthd = I915_READ(ACTHD_I965);
393     instdone = I915_READ(INSTDONE_I965);
394     instdone1 = I915_READ(INSTDONE1);
395     }
396     + acthd = intel_ring_get_active_head(&dev_priv->ring[RCS]);
397     + acthd_bsd = HAS_BSD(dev) ?
398     + intel_ring_get_active_head(&dev_priv->ring[VCS]) : 0;
399     + acthd_blt = HAS_BLT(dev) ?
400     + intel_ring_get_active_head(&dev_priv->ring[BCS]) : 0;
401    
402     if (dev_priv->last_acthd == acthd &&
403     + dev_priv->last_acthd_bsd == acthd_bsd &&
404     + dev_priv->last_acthd_blt == acthd_blt &&
405     dev_priv->last_instdone == instdone &&
406     dev_priv->last_instdone1 == instdone1) {
407     if (dev_priv->hangcheck_count++ > 1) {
408     @@ -1727,6 +1732,8 @@ void i915_hangcheck_elapsed(unsigned long data)
409     dev_priv->hangcheck_count = 0;
410    
411     dev_priv->last_acthd = acthd;
412     + dev_priv->last_acthd_bsd = acthd_bsd;
413     + dev_priv->last_acthd_blt = acthd_blt;
414     dev_priv->last_instdone = instdone;
415     dev_priv->last_instdone1 = instdone1;
416     }
417     diff --git a/drivers/gpu/drm/i915/i915_suspend.c b/drivers/gpu/drm/i915/i915_suspend.c
418     index 43cbafe..a1eb83d 100644
419     --- a/drivers/gpu/drm/i915/i915_suspend.c
420     +++ b/drivers/gpu/drm/i915/i915_suspend.c
421     @@ -34,6 +34,10 @@ static bool i915_pipe_enabled(struct drm_device *dev, enum pipe pipe)
422     struct drm_i915_private *dev_priv = dev->dev_private;
423     u32 dpll_reg;
424    
425     + /* On IVB, 3rd pipe shares PLL with another one */
426     + if (pipe > 1)
427     + return false;
428     +
429     if (HAS_PCH_SPLIT(dev))
430     dpll_reg = (pipe == PIPE_A) ? _PCH_DPLL_A : _PCH_DPLL_B;
431     else
432     diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
433     index 92b041b..db3b461 100644
434     --- a/drivers/gpu/drm/i915/intel_dp.c
435     +++ b/drivers/gpu/drm/i915/intel_dp.c
436     @@ -1926,6 +1926,7 @@ intel_dp_link_down(struct intel_dp *intel_dp)
437     intel_wait_for_vblank(dev, to_intel_crtc(crtc)->pipe);
438     }
439    
440     + DP &= ~DP_AUDIO_OUTPUT_ENABLE;
441     I915_WRITE(intel_dp->output_reg, DP & ~DP_PORT_EN);
442     POSTING_READ(intel_dp->output_reg);
443     msleep(intel_dp->panel_power_down_delay);
444     diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
445     index d4f5a0b..64541f7 100644
446     --- a/drivers/gpu/drm/i915/intel_hdmi.c
447     +++ b/drivers/gpu/drm/i915/intel_hdmi.c
448     @@ -269,6 +269,10 @@ static void intel_hdmi_dpms(struct drm_encoder *encoder, int mode)
449     struct drm_i915_private *dev_priv = dev->dev_private;
450     struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
451     u32 temp;
452     + u32 enable_bits = SDVO_ENABLE;
453     +
454     + if (intel_hdmi->has_audio)
455     + enable_bits |= SDVO_AUDIO_ENABLE;
456    
457     temp = I915_READ(intel_hdmi->sdvox_reg);
458    
459     @@ -281,9 +285,9 @@ static void intel_hdmi_dpms(struct drm_encoder *encoder, int mode)
460     }
461    
462     if (mode != DRM_MODE_DPMS_ON) {
463     - temp &= ~SDVO_ENABLE;
464     + temp &= ~enable_bits;
465     } else {
466     - temp |= SDVO_ENABLE;
467     + temp |= enable_bits;
468     }
469    
470     I915_WRITE(intel_hdmi->sdvox_reg, temp);
471     diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c
472     index f3c6a9a..2b1fcad 100644
473     --- a/drivers/gpu/drm/i915/intel_tv.c
474     +++ b/drivers/gpu/drm/i915/intel_tv.c
475     @@ -417,7 +417,7 @@ static const struct tv_mode tv_modes[] = {
476     {
477     .name = "NTSC-M",
478     .clock = 108000,
479     - .refresh = 29970,
480     + .refresh = 59940,
481     .oversample = TV_OVERSAMPLE_8X,
482     .component_only = 0,
483     /* 525 Lines, 60 Fields, 15.734KHz line, Sub-Carrier 3.580MHz */
484     @@ -460,7 +460,7 @@ static const struct tv_mode tv_modes[] = {
485     {
486     .name = "NTSC-443",
487     .clock = 108000,
488     - .refresh = 29970,
489     + .refresh = 59940,
490     .oversample = TV_OVERSAMPLE_8X,
491     .component_only = 0,
492     /* 525 Lines, 60 Fields, 15.734KHz line, Sub-Carrier 4.43MHz */
493     @@ -502,7 +502,7 @@ static const struct tv_mode tv_modes[] = {
494     {
495     .name = "NTSC-J",
496     .clock = 108000,
497     - .refresh = 29970,
498     + .refresh = 59940,
499     .oversample = TV_OVERSAMPLE_8X,
500     .component_only = 0,
501    
502     @@ -545,7 +545,7 @@ static const struct tv_mode tv_modes[] = {
503     {
504     .name = "PAL-M",
505     .clock = 108000,
506     - .refresh = 29970,
507     + .refresh = 59940,
508     .oversample = TV_OVERSAMPLE_8X,
509     .component_only = 0,
510    
511     @@ -589,7 +589,7 @@ static const struct tv_mode tv_modes[] = {
512     /* 625 Lines, 50 Fields, 15.625KHz line, Sub-Carrier 4.434MHz */
513     .name = "PAL-N",
514     .clock = 108000,
515     - .refresh = 25000,
516     + .refresh = 50000,
517     .oversample = TV_OVERSAMPLE_8X,
518     .component_only = 0,
519    
520     @@ -634,7 +634,7 @@ static const struct tv_mode tv_modes[] = {
521     /* 625 Lines, 50 Fields, 15.625KHz line, Sub-Carrier 4.434MHz */
522     .name = "PAL",
523     .clock = 108000,
524     - .refresh = 25000,
525     + .refresh = 50000,
526     .oversample = TV_OVERSAMPLE_8X,
527     .component_only = 0,
528    
529     @@ -821,7 +821,7 @@ static const struct tv_mode tv_modes[] = {
530     {
531     .name = "1080i@50Hz",
532     .clock = 148800,
533     - .refresh = 25000,
534     + .refresh = 50000,
535     .oversample = TV_OVERSAMPLE_2X,
536     .component_only = 1,
537    
538     @@ -847,7 +847,7 @@ static const struct tv_mode tv_modes[] = {
539     {
540     .name = "1080i@60Hz",
541     .clock = 148800,
542     - .refresh = 30000,
543     + .refresh = 60000,
544     .oversample = TV_OVERSAMPLE_2X,
545     .component_only = 1,
546    
547     diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c
548     index 5f0bc57..7ce3fde 100644
549     --- a/drivers/gpu/drm/nouveau/nouveau_gem.c
550     +++ b/drivers/gpu/drm/nouveau/nouveau_gem.c
551     @@ -380,6 +380,25 @@ retry:
552     }
553    
554     static int
555     +validate_sync(struct nouveau_channel *chan, struct nouveau_bo *nvbo)
556     +{
557     + struct nouveau_fence *fence = NULL;
558     + int ret = 0;
559     +
560     + spin_lock(&nvbo->bo.bdev->fence_lock);
561     + if (nvbo->bo.sync_obj)
562     + fence = nouveau_fence_ref(nvbo->bo.sync_obj);
563     + spin_unlock(&nvbo->bo.bdev->fence_lock);
564     +
565     + if (fence) {
566     + ret = nouveau_fence_sync(fence, chan);
567     + nouveau_fence_unref(&fence);
568     + }
569     +
570     + return ret;
571     +}
572     +
573     +static int
574     validate_list(struct nouveau_channel *chan, struct list_head *list,
575     struct drm_nouveau_gem_pushbuf_bo *pbbo, uint64_t user_pbbo_ptr)
576     {
577     @@ -393,7 +412,7 @@ validate_list(struct nouveau_channel *chan, struct list_head *list,
578     list_for_each_entry(nvbo, list, entry) {
579     struct drm_nouveau_gem_pushbuf_bo *b = &pbbo[nvbo->pbbo_index];
580    
581     - ret = nouveau_fence_sync(nvbo->bo.sync_obj, chan);
582     + ret = validate_sync(chan, nvbo);
583     if (unlikely(ret)) {
584     NV_ERROR(dev, "fail pre-validate sync\n");
585     return ret;
586     @@ -416,7 +435,7 @@ validate_list(struct nouveau_channel *chan, struct list_head *list,
587     return ret;
588     }
589    
590     - ret = nouveau_fence_sync(nvbo->bo.sync_obj, chan);
591     + ret = validate_sync(chan, nvbo);
592     if (unlikely(ret)) {
593     NV_ERROR(dev, "fail post-validate sync\n");
594     return ret;
595     diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c
596     index 2b97262..b30081f 100644
597     --- a/drivers/gpu/drm/radeon/atombios_crtc.c
598     +++ b/drivers/gpu/drm/radeon/atombios_crtc.c
599     @@ -1189,7 +1189,7 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc,
600     WREG32(EVERGREEN_GRPH_ENABLE + radeon_crtc->crtc_offset, 1);
601    
602     WREG32(EVERGREEN_DESKTOP_HEIGHT + radeon_crtc->crtc_offset,
603     - crtc->mode.vdisplay);
604     + target_fb->height);
605     x &= ~3;
606     y &= ~1;
607     WREG32(EVERGREEN_VIEWPORT_START + radeon_crtc->crtc_offset,
608     @@ -1358,7 +1358,7 @@ static int avivo_crtc_do_set_base(struct drm_crtc *crtc,
609     WREG32(AVIVO_D1GRPH_ENABLE + radeon_crtc->crtc_offset, 1);
610    
611     WREG32(AVIVO_D1MODE_DESKTOP_HEIGHT + radeon_crtc->crtc_offset,
612     - crtc->mode.vdisplay);
613     + target_fb->height);
614     x &= ~3;
615     y &= ~1;
616     WREG32(AVIVO_D1MODE_VIEWPORT_START + radeon_crtc->crtc_offset,
617     diff --git a/drivers/gpu/drm/radeon/atombios_dp.c b/drivers/gpu/drm/radeon/atombios_dp.c
618     index a71557c..552b436 100644
619     --- a/drivers/gpu/drm/radeon/atombios_dp.c
620     +++ b/drivers/gpu/drm/radeon/atombios_dp.c
621     @@ -564,9 +564,21 @@ int radeon_dp_get_panel_mode(struct drm_encoder *encoder,
622     ENCODER_OBJECT_ID_NUTMEG)
623     panel_mode = DP_PANEL_MODE_INTERNAL_DP1_MODE;
624     else if (radeon_connector_encoder_get_dp_bridge_encoder_id(connector) ==
625     - ENCODER_OBJECT_ID_TRAVIS)
626     - panel_mode = DP_PANEL_MODE_INTERNAL_DP2_MODE;
627     - else if (connector->connector_type == DRM_MODE_CONNECTOR_eDP) {
628     + ENCODER_OBJECT_ID_TRAVIS) {
629     + u8 id[6];
630     + int i;
631     + for (i = 0; i < 6; i++)
632     + id[i] = radeon_read_dpcd_reg(radeon_connector, 0x503 + i);
633     + if (id[0] == 0x73 &&
634     + id[1] == 0x69 &&
635     + id[2] == 0x76 &&
636     + id[3] == 0x61 &&
637     + id[4] == 0x72 &&
638     + id[5] == 0x54)
639     + panel_mode = DP_PANEL_MODE_INTERNAL_DP1_MODE;
640     + else
641     + panel_mode = DP_PANEL_MODE_INTERNAL_DP2_MODE;
642     + } else if (connector->connector_type == DRM_MODE_CONNECTOR_eDP) {
643     u8 tmp = radeon_read_dpcd_reg(radeon_connector, DP_EDP_CONFIGURATION_CAP);
644     if (tmp & 1)
645     panel_mode = DP_PANEL_MODE_INTERNAL_DP2_MODE;
646     diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
647     index 9b39145..9231564 100644
648     --- a/drivers/gpu/drm/radeon/radeon_device.c
649     +++ b/drivers/gpu/drm/radeon/radeon_device.c
650     @@ -864,6 +864,8 @@ int radeon_suspend_kms(struct drm_device *dev, pm_message_t state)
651     if (dev->switch_power_state == DRM_SWITCH_POWER_OFF)
652     return 0;
653    
654     + drm_kms_helper_poll_disable(dev);
655     +
656     /* turn off display hw */
657     list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
658     drm_helper_connector_dpms(connector, DRM_MODE_DPMS_OFF);
659     @@ -950,6 +952,8 @@ int radeon_resume_kms(struct drm_device *dev)
660     list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
661     drm_helper_connector_dpms(connector, DRM_MODE_DPMS_ON);
662     }
663     +
664     + drm_kms_helper_poll_enable(dev);
665     return 0;
666     }
667    
668     diff --git a/drivers/hwmon/w83627ehf.c b/drivers/hwmon/w83627ehf.c
669     index 4b57ab6..c25387d 100644
670     --- a/drivers/hwmon/w83627ehf.c
671     +++ b/drivers/hwmon/w83627ehf.c
672     @@ -1920,9 +1920,26 @@ w83627ehf_check_fan_inputs(const struct w83627ehf_sio_data *sio_data,
673     fan4min = 0;
674     fan5pin = 0;
675     } else if (sio_data->kind == nct6776) {
676     - fan3pin = !(superio_inb(sio_data->sioreg, 0x24) & 0x40);
677     - fan4pin = !!(superio_inb(sio_data->sioreg, 0x1C) & 0x01);
678     - fan5pin = !!(superio_inb(sio_data->sioreg, 0x1C) & 0x02);
679     + bool gpok = superio_inb(sio_data->sioreg, 0x27) & 0x80;
680     +
681     + superio_select(sio_data->sioreg, W83627EHF_LD_HWM);
682     + regval = superio_inb(sio_data->sioreg, SIO_REG_ENABLE);
683     +
684     + if (regval & 0x80)
685     + fan3pin = gpok;
686     + else
687     + fan3pin = !(superio_inb(sio_data->sioreg, 0x24) & 0x40);
688     +
689     + if (regval & 0x40)
690     + fan4pin = gpok;
691     + else
692     + fan4pin = !!(superio_inb(sio_data->sioreg, 0x1C) & 0x01);
693     +
694     + if (regval & 0x20)
695     + fan5pin = gpok;
696     + else
697     + fan5pin = !!(superio_inb(sio_data->sioreg, 0x1C) & 0x02);
698     +
699     fan4min = fan4pin;
700     } else if (sio_data->kind == w83667hg || sio_data->kind == w83667hg_b) {
701     fan3pin = 1;
702     diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
703     index e3db8ef..a8445b8 100644
704     --- a/drivers/infiniband/core/uverbs_cmd.c
705     +++ b/drivers/infiniband/core/uverbs_cmd.c
706     @@ -1485,6 +1485,7 @@ ssize_t ib_uverbs_create_qp(struct ib_uverbs_file *file,
707     qp->event_handler = attr.event_handler;
708     qp->qp_context = attr.qp_context;
709     qp->qp_type = attr.qp_type;
710     + atomic_set(&qp->usecnt, 0);
711     atomic_inc(&pd->usecnt);
712     atomic_inc(&attr.send_cq->usecnt);
713     if (attr.recv_cq)
714     diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
715     index 602b1bd..575b780 100644
716     --- a/drivers/infiniband/core/verbs.c
717     +++ b/drivers/infiniband/core/verbs.c
718     @@ -421,6 +421,7 @@ struct ib_qp *ib_create_qp(struct ib_pd *pd,
719     qp->uobject = NULL;
720     qp->qp_type = qp_init_attr->qp_type;
721    
722     + atomic_set(&qp->usecnt, 0);
723     if (qp_init_attr->qp_type == IB_QPT_XRC_TGT) {
724     qp->event_handler = __ib_shared_qp_event_handler;
725     qp->qp_context = qp;
726     @@ -430,7 +431,6 @@ struct ib_qp *ib_create_qp(struct ib_pd *pd,
727     qp->xrcd = qp_init_attr->xrcd;
728     atomic_inc(&qp_init_attr->xrcd->usecnt);
729     INIT_LIST_HEAD(&qp->open_list);
730     - atomic_set(&qp->usecnt, 0);
731    
732     real_qp = qp;
733     qp = __ib_open_qp(real_qp, qp_init_attr->event_handler,
734     diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c
735     index f36da99..77702c0 100644
736     --- a/drivers/infiniband/hw/mlx4/mad.c
737     +++ b/drivers/infiniband/hw/mlx4/mad.c
738     @@ -256,12 +256,9 @@ static int ib_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num,
739     return IB_MAD_RESULT_SUCCESS;
740    
741     /*
742     - * Don't process SMInfo queries or vendor-specific
743     - * MADs -- the SMA can't handle them.
744     + * Don't process SMInfo queries -- the SMA can't handle them.
745     */
746     - if (in_mad->mad_hdr.attr_id == IB_SMP_ATTR_SM_INFO ||
747     - ((in_mad->mad_hdr.attr_id & IB_SMP_ATTR_VENDOR_MASK) ==
748     - IB_SMP_ATTR_VENDOR_MASK))
749     + if (in_mad->mad_hdr.attr_id == IB_SMP_ATTR_SM_INFO)
750     return IB_MAD_RESULT_SUCCESS;
751     } else if (in_mad->mad_hdr.mgmt_class == IB_MGMT_CLASS_PERF_MGMT ||
752     in_mad->mad_hdr.mgmt_class == MLX4_IB_VENDOR_CLASS1 ||
753     diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
754     index 4ee277a..e0b3e33 100644
755     --- a/drivers/iommu/amd_iommu.c
756     +++ b/drivers/iommu/amd_iommu.c
757     @@ -2479,6 +2479,9 @@ static unsigned device_dma_ops_init(void)
758    
759     for_each_pci_dev(pdev) {
760     if (!check_device(&pdev->dev)) {
761     +
762     + iommu_ignore_device(&pdev->dev);
763     +
764     unhandled += 1;
765     continue;
766     }
767     diff --git a/drivers/iommu/msm_iommu.c b/drivers/iommu/msm_iommu.c
768     index 5865dd2..a4d134d 100644
769     --- a/drivers/iommu/msm_iommu.c
770     +++ b/drivers/iommu/msm_iommu.c
771     @@ -481,23 +481,19 @@ static int msm_iommu_unmap(struct iommu_domain *domain, unsigned long va,
772    
773     priv = domain->priv;
774    
775     - if (!priv) {
776     - ret = -ENODEV;
777     + if (!priv)
778     goto fail;
779     - }
780    
781     fl_table = priv->pgtable;
782    
783     if (len != SZ_16M && len != SZ_1M &&
784     len != SZ_64K && len != SZ_4K) {
785     pr_debug("Bad length: %d\n", len);
786     - ret = -EINVAL;
787     goto fail;
788     }
789    
790     if (!fl_table) {
791     pr_debug("Null page table\n");
792     - ret = -EINVAL;
793     goto fail;
794     }
795    
796     @@ -506,7 +502,6 @@ static int msm_iommu_unmap(struct iommu_domain *domain, unsigned long va,
797    
798     if (*fl_pte == 0) {
799     pr_debug("First level PTE is 0\n");
800     - ret = -ENODEV;
801     goto fail;
802     }
803    
804     diff --git a/drivers/misc/cb710/core.c b/drivers/misc/cb710/core.c
805     index 68cd05b..85cc771 100644
806     --- a/drivers/misc/cb710/core.c
807     +++ b/drivers/misc/cb710/core.c
808     @@ -245,6 +245,7 @@ static int __devinit cb710_probe(struct pci_dev *pdev,
809     if (err)
810     return err;
811    
812     + spin_lock_init(&chip->irq_lock);
813     chip->pdev = pdev;
814     chip->iobase = pcim_iomap_table(pdev)[0];
815    
816     diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c
817     index 23e5d77..ee6e26e 100644
818     --- a/drivers/mtd/nand/atmel_nand.c
819     +++ b/drivers/mtd/nand/atmel_nand.c
820     @@ -161,6 +161,37 @@ static int atmel_nand_device_ready(struct mtd_info *mtd)
821     !!host->board->rdy_pin_active_low;
822     }
823    
824     +/*
825     + * Minimal-overhead PIO for data access.
826     + */
827     +static void atmel_read_buf8(struct mtd_info *mtd, u8 *buf, int len)
828     +{
829     + struct nand_chip *nand_chip = mtd->priv;
830     +
831     + __raw_readsb(nand_chip->IO_ADDR_R, buf, len);
832     +}
833     +
834     +static void atmel_read_buf16(struct mtd_info *mtd, u8 *buf, int len)
835     +{
836     + struct nand_chip *nand_chip = mtd->priv;
837     +
838     + __raw_readsw(nand_chip->IO_ADDR_R, buf, len / 2);
839     +}
840     +
841     +static void atmel_write_buf8(struct mtd_info *mtd, const u8 *buf, int len)
842     +{
843     + struct nand_chip *nand_chip = mtd->priv;
844     +
845     + __raw_writesb(nand_chip->IO_ADDR_W, buf, len);
846     +}
847     +
848     +static void atmel_write_buf16(struct mtd_info *mtd, const u8 *buf, int len)
849     +{
850     + struct nand_chip *nand_chip = mtd->priv;
851     +
852     + __raw_writesw(nand_chip->IO_ADDR_W, buf, len / 2);
853     +}
854     +
855     static void dma_complete_func(void *completion)
856     {
857     complete(completion);
858     @@ -235,27 +266,33 @@ err_buf:
859     static void atmel_read_buf(struct mtd_info *mtd, u8 *buf, int len)
860     {
861     struct nand_chip *chip = mtd->priv;
862     + struct atmel_nand_host *host = chip->priv;
863    
864     if (use_dma && len > mtd->oobsize)
865     /* only use DMA for bigger than oob size: better performances */
866     if (atmel_nand_dma_op(mtd, buf, len, 1) == 0)
867     return;
868    
869     - /* if no DMA operation possible, use PIO */
870     - memcpy_fromio(buf, chip->IO_ADDR_R, len);
871     + if (host->board->bus_width_16)
872     + atmel_read_buf16(mtd, buf, len);
873     + else
874     + atmel_read_buf8(mtd, buf, len);
875     }
876    
877     static void atmel_write_buf(struct mtd_info *mtd, const u8 *buf, int len)
878     {
879     struct nand_chip *chip = mtd->priv;
880     + struct atmel_nand_host *host = chip->priv;
881    
882     if (use_dma && len > mtd->oobsize)
883     /* only use DMA for bigger than oob size: better performances */
884     if (atmel_nand_dma_op(mtd, (void *)buf, len, 0) == 0)
885     return;
886    
887     - /* if no DMA operation possible, use PIO */
888     - memcpy_toio(chip->IO_ADDR_W, buf, len);
889     + if (host->board->bus_width_16)
890     + atmel_write_buf16(mtd, buf, len);
891     + else
892     + atmel_write_buf8(mtd, buf, len);
893     }
894    
895     /*
896     diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-lib.c b/drivers/mtd/nand/gpmi-nand/gpmi-lib.c
897     index de4db76..bb2fe60 100644
898     --- a/drivers/mtd/nand/gpmi-nand/gpmi-lib.c
899     +++ b/drivers/mtd/nand/gpmi-nand/gpmi-lib.c
900     @@ -69,17 +69,19 @@ static int clear_poll_bit(void __iomem *addr, u32 mask)
901     * [1] enable the module.
902     * [2] reset the module.
903     *
904     - * In most of the cases, it's ok. But there is a hardware bug in the BCH block.
905     + * In most of the cases, it's ok.
906     + * But in MX23, there is a hardware bug in the BCH block (see erratum #2847).
907     * If you try to soft reset the BCH block, it becomes unusable until
908     * the next hard reset. This case occurs in the NAND boot mode. When the board
909     * boots by NAND, the ROM of the chip will initialize the BCH blocks itself.
910     * So If the driver tries to reset the BCH again, the BCH will not work anymore.
911     - * You will see a DMA timeout in this case.
912     + * You will see a DMA timeout in this case. The bug has been fixed
913     + * in the following chips, such as MX28.
914     *
915     * To avoid this bug, just add a new parameter `just_enable` for
916     * the mxs_reset_block(), and rewrite it here.
917     */
918     -int gpmi_reset_block(void __iomem *reset_addr, bool just_enable)
919     +static int gpmi_reset_block(void __iomem *reset_addr, bool just_enable)
920     {
921     int ret;
922     int timeout = 0x400;
923     @@ -206,7 +208,15 @@ int bch_set_geometry(struct gpmi_nand_data *this)
924     if (ret)
925     goto err_out;
926    
927     - ret = gpmi_reset_block(r->bch_regs, true);
928     + /*
929     + * Due to erratum #2847 of the MX23, the BCH cannot be soft reset on this
930     + * chip, otherwise it will lock up. So we skip resetting BCH on the MX23.
931     + * On the other hand, the MX28 needs the reset, because one case has been
932     + * seen where the BCH produced ECC errors constantly after 10000
933     + * consecutive reboots. The latter case has not been seen on the MX23 yet,
934     + * still we don't know if it could happen there as well.
935     + */
936     + ret = gpmi_reset_block(r->bch_regs, GPMI_IS_MX23(this));
937     if (ret)
938     goto err_out;
939    
940     diff --git a/drivers/net/ethernet/realtek/8139cp.c b/drivers/net/ethernet/realtek/8139cp.c
941     index ee5da92..aba4f67 100644
942     --- a/drivers/net/ethernet/realtek/8139cp.c
943     +++ b/drivers/net/ethernet/realtek/8139cp.c
944     @@ -563,6 +563,7 @@ rx_next:
945     if (cpr16(IntrStatus) & cp_rx_intr_mask)
946     goto rx_status_loop;
947    
948     + napi_gro_flush(napi);
949     spin_lock_irqsave(&cp->lock, flags);
950     __napi_complete(napi);
951     cpw16_f(IntrMask, cp_intr_mask);
952     diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c
953     index 749c2a1..1932029 100644
954     --- a/drivers/pcmcia/ds.c
955     +++ b/drivers/pcmcia/ds.c
956     @@ -1269,10 +1269,8 @@ static int pcmcia_bus_add(struct pcmcia_socket *skt)
957    
958     static int pcmcia_bus_early_resume(struct pcmcia_socket *skt)
959     {
960     - if (!verify_cis_cache(skt)) {
961     - pcmcia_put_socket(skt);
962     + if (!verify_cis_cache(skt))
963     return 0;
964     - }
965    
966     dev_dbg(&skt->dev, "cis mismatch - different card\n");
967    
968     diff --git a/drivers/staging/asus_oled/asus_oled.c b/drivers/staging/asus_oled/asus_oled.c
969     index 7bb7da7..63bafbb 100644
970     --- a/drivers/staging/asus_oled/asus_oled.c
971     +++ b/drivers/staging/asus_oled/asus_oled.c
972     @@ -355,7 +355,14 @@ static void send_data(struct asus_oled_dev *odev)
973    
974     static int append_values(struct asus_oled_dev *odev, uint8_t val, size_t count)
975     {
976     - while (count-- > 0 && val) {
977     + odev->last_val = val;
978     +
979     + if (val == 0) {
980     + odev->buf_offs += count;
981     + return 0;
982     + }
983     +
984     + while (count-- > 0) {
985     size_t x = odev->buf_offs % odev->width;
986     size_t y = odev->buf_offs / odev->width;
987     size_t i;
988     @@ -406,7 +413,6 @@ static int append_values(struct asus_oled_dev *odev, uint8_t val, size_t count)
989     ;
990     }
991    
992     - odev->last_val = val;
993     odev->buf_offs++;
994     }
995    
996     @@ -805,10 +811,9 @@ error:
997    
998     static void __exit asus_oled_exit(void)
999     {
1000     + usb_deregister(&oled_driver);
1001     class_remove_file(oled_class, &class_attr_version.attr);
1002     class_destroy(oled_class);
1003     -
1004     - usb_deregister(&oled_driver);
1005     }
1006    
1007     module_init(asus_oled_init);
1008     diff --git a/drivers/staging/rtl8712/drv_types.h b/drivers/staging/rtl8712/drv_types.h
1009     index 9b5d771..ed85b44 100644
1010     --- a/drivers/staging/rtl8712/drv_types.h
1011     +++ b/drivers/staging/rtl8712/drv_types.h
1012     @@ -37,6 +37,8 @@ struct _adapter;
1013     #include "wlan_bssdef.h"
1014     #include "rtl8712_spec.h"
1015     #include "rtl8712_hal.h"
1016     +#include <linux/mutex.h>
1017     +#include <linux/completion.h>
1018    
1019     enum _NIC_VERSION {
1020     RTL8711_NIC,
1021     @@ -168,6 +170,7 @@ struct _adapter {
1022     s32 bSurpriseRemoved;
1023     u32 IsrContent;
1024     u32 ImrContent;
1025     + bool fw_found;
1026     u8 EepromAddressSize;
1027     u8 hw_init_completed;
1028     struct task_struct *cmdThread;
1029     @@ -184,6 +187,10 @@ struct _adapter {
1030     _workitem wkFilterRxFF0;
1031     u8 blnEnableRxFF0Filter;
1032     spinlock_t lockRxFF0Filter;
1033     + const struct firmware *fw;
1034     + struct usb_interface *pusb_intf;
1035     + struct mutex mutex_start;
1036     + struct completion rtl8712_fw_ready;
1037     };
1038    
1039     static inline u8 *myid(struct eeprom_priv *peepriv)
1040     diff --git a/drivers/staging/rtl8712/hal_init.c b/drivers/staging/rtl8712/hal_init.c
1041     index d0029aa..cc893c0 100644
1042     --- a/drivers/staging/rtl8712/hal_init.c
1043     +++ b/drivers/staging/rtl8712/hal_init.c
1044     @@ -42,29 +42,56 @@
1045     #define FWBUFF_ALIGN_SZ 512
1046     #define MAX_DUMP_FWSZ 49152 /*default = 49152 (48k)*/
1047    
1048     -static u32 rtl871x_open_fw(struct _adapter *padapter, void **pphfwfile_hdl,
1049     - const u8 **ppmappedfw)
1050     +static void rtl871x_load_fw_cb(const struct firmware *firmware, void *context)
1051     {
1052     + struct _adapter *padapter = context;
1053     +
1054     + complete(&padapter->rtl8712_fw_ready);
1055     + if (!firmware) {
1056     + struct usb_device *udev = padapter->dvobjpriv.pusbdev;
1057     + struct usb_interface *pusb_intf = padapter->pusb_intf;
1058     + printk(KERN_ERR "r8712u: Firmware request failed\n");
1059     + padapter->fw_found = false;
1060     + usb_put_dev(udev);
1061     + usb_set_intfdata(pusb_intf, NULL);
1062     + return;
1063     + }
1064     + padapter->fw = firmware;
1065     + padapter->fw_found = true;
1066     + /* firmware available - start netdev */
1067     + register_netdev(padapter->pnetdev);
1068     +}
1069     +
1070     +static const char firmware_file[] = "rtlwifi/rtl8712u.bin";
1071     +
1072     +int rtl871x_load_fw(struct _adapter *padapter)
1073     +{
1074     + struct device *dev = &padapter->dvobjpriv.pusbdev->dev;
1075     int rc;
1076     - const char firmware_file[] = "rtlwifi/rtl8712u.bin";
1077     - const struct firmware **praw = (const struct firmware **)
1078     - (pphfwfile_hdl);
1079     - struct dvobj_priv *pdvobjpriv = (struct dvobj_priv *)
1080     - (&padapter->dvobjpriv);
1081     - struct usb_device *pusbdev = pdvobjpriv->pusbdev;
1082    
1083     + init_completion(&padapter->rtl8712_fw_ready);
1084     printk(KERN_INFO "r8712u: Loading firmware from \"%s\"\n",
1085     firmware_file);
1086     - rc = request_firmware(praw, firmware_file, &pusbdev->dev);
1087     - if (rc < 0) {
1088     - printk(KERN_ERR "r8712u: Unable to load firmware\n");
1089     - printk(KERN_ERR "r8712u: Install latest linux-firmware\n");
1090     + rc = request_firmware_nowait(THIS_MODULE, 1, firmware_file, dev,
1091     + GFP_KERNEL, padapter, rtl871x_load_fw_cb);
1092     + if (rc)
1093     + printk(KERN_ERR "r8712u: Firmware request error %d\n", rc);
1094     + return rc;
1095     +}
1096     +MODULE_FIRMWARE("rtlwifi/rtl8712u.bin");
1097     +
1098     +static u32 rtl871x_open_fw(struct _adapter *padapter, const u8 **ppmappedfw)
1099     +{
1100     + const struct firmware **praw = &padapter->fw;
1101     +
1102     + if (padapter->fw->size > 200000) {
1103     + printk(KERN_ERR "r8172u: Badfw->size of %d\n",
1104     + (int)padapter->fw->size);
1105     return 0;
1106     }
1107     *ppmappedfw = (u8 *)((*praw)->data);
1108     return (*praw)->size;
1109     }
1110     -MODULE_FIRMWARE("rtlwifi/rtl8712u.bin");
1111    
1112     static void fill_fwpriv(struct _adapter *padapter, struct fw_priv *pfwpriv)
1113     {
1114     @@ -142,18 +169,17 @@ static u8 rtl8712_dl_fw(struct _adapter *padapter)
1115     uint dump_imem_sz, imem_sz, dump_emem_sz, emem_sz; /* max = 49152; */
1116     struct fw_hdr fwhdr;
1117     u32 ulfilelength; /* FW file size */
1118     - void *phfwfile_hdl = NULL;
1119     const u8 *pmappedfw = NULL;
1120     u8 *ptmpchar = NULL, *ppayload, *ptr;
1121     struct tx_desc *ptx_desc;
1122     u32 txdscp_sz = sizeof(struct tx_desc);
1123     u8 ret = _FAIL;
1124    
1125     - ulfilelength = rtl871x_open_fw(padapter, &phfwfile_hdl, &pmappedfw);
1126     + ulfilelength = rtl871x_open_fw(padapter, &pmappedfw);
1127     if (pmappedfw && (ulfilelength > 0)) {
1128     update_fwhdr(&fwhdr, pmappedfw);
1129     if (chk_fwhdr(&fwhdr, ulfilelength) == _FAIL)
1130     - goto firmware_rel;
1131     + return ret;
1132     fill_fwpriv(padapter, &fwhdr.fwpriv);
1133     /* firmware check ok */
1134     maxlen = (fwhdr.img_IMEM_size > fwhdr.img_SRAM_size) ?
1135     @@ -161,7 +187,7 @@ static u8 rtl8712_dl_fw(struct _adapter *padapter)
1136     maxlen += txdscp_sz;
1137     ptmpchar = _malloc(maxlen + FWBUFF_ALIGN_SZ);
1138     if (ptmpchar == NULL)
1139     - goto firmware_rel;
1140     + return ret;
1141    
1142     ptx_desc = (struct tx_desc *)(ptmpchar + FWBUFF_ALIGN_SZ -
1143     ((addr_t)(ptmpchar) & (FWBUFF_ALIGN_SZ - 1)));
1144     @@ -297,8 +323,6 @@ static u8 rtl8712_dl_fw(struct _adapter *padapter)
1145    
1146     exit_fail:
1147     kfree(ptmpchar);
1148     -firmware_rel:
1149     - release_firmware((struct firmware *)phfwfile_hdl);
1150     return ret;
1151     }
1152    
1153     diff --git a/drivers/staging/rtl8712/os_intfs.c b/drivers/staging/rtl8712/os_intfs.c
1154     index 9a75c6d..98a3d68 100644
1155     --- a/drivers/staging/rtl8712/os_intfs.c
1156     +++ b/drivers/staging/rtl8712/os_intfs.c
1157     @@ -31,6 +31,7 @@
1158     #include <linux/module.h>
1159     #include <linux/init.h>
1160     #include <linux/kthread.h>
1161     +#include <linux/firmware.h>
1162     #include "osdep_service.h"
1163     #include "drv_types.h"
1164     #include "xmit_osdep.h"
1165     @@ -264,12 +265,12 @@ static void start_drv_timers(struct _adapter *padapter)
1166     void r8712_stop_drv_timers(struct _adapter *padapter)
1167     {
1168     _cancel_timer_ex(&padapter->mlmepriv.assoc_timer);
1169     - _cancel_timer_ex(&padapter->mlmepriv.sitesurveyctrl.
1170     - sitesurvey_ctrl_timer);
1171     _cancel_timer_ex(&padapter->securitypriv.tkip_timer);
1172     _cancel_timer_ex(&padapter->mlmepriv.scan_to_timer);
1173     _cancel_timer_ex(&padapter->mlmepriv.dhcp_timer);
1174     _cancel_timer_ex(&padapter->mlmepriv.wdg_timer);
1175     + _cancel_timer_ex(&padapter->mlmepriv.sitesurveyctrl.
1176     + sitesurvey_ctrl_timer);
1177     }
1178    
1179     static u8 init_default_value(struct _adapter *padapter)
1180     @@ -347,7 +348,8 @@ u8 r8712_free_drv_sw(struct _adapter *padapter)
1181     r8712_free_mlme_priv(&padapter->mlmepriv);
1182     r8712_free_io_queue(padapter);
1183     _free_xmit_priv(&padapter->xmitpriv);
1184     - _r8712_free_sta_priv(&padapter->stapriv);
1185     + if (padapter->fw_found)
1186     + _r8712_free_sta_priv(&padapter->stapriv);
1187     _r8712_free_recv_priv(&padapter->recvpriv);
1188     mp871xdeinit(padapter);
1189     if (pnetdev)
1190     @@ -388,6 +390,7 @@ static int netdev_open(struct net_device *pnetdev)
1191     {
1192     struct _adapter *padapter = (struct _adapter *)netdev_priv(pnetdev);
1193    
1194     + mutex_lock(&padapter->mutex_start);
1195     if (padapter->bup == false) {
1196     padapter->bDriverStopped = false;
1197     padapter->bSurpriseRemoved = false;
1198     @@ -435,11 +438,13 @@ static int netdev_open(struct net_device *pnetdev)
1199     /* start driver mlme relation timer */
1200     start_drv_timers(padapter);
1201     padapter->ledpriv.LedControlHandler(padapter, LED_CTL_NO_LINK);
1202     + mutex_unlock(&padapter->mutex_start);
1203     return 0;
1204     netdev_open_error:
1205     padapter->bup = false;
1206     netif_carrier_off(pnetdev);
1207     netif_stop_queue(pnetdev);
1208     + mutex_unlock(&padapter->mutex_start);
1209     return -1;
1210     }
1211    
1212     @@ -473,6 +478,9 @@ static int netdev_close(struct net_device *pnetdev)
1213     r8712_free_network_queue(padapter);
1214     /* The interface is no longer Up: */
1215     padapter->bup = false;
1216     + release_firmware(padapter->fw);
1217     + /* never exit with a firmware callback pending */
1218     + wait_for_completion(&padapter->rtl8712_fw_ready);
1219     return 0;
1220     }
1221    
1222     diff --git a/drivers/staging/rtl8712/rtl8712_hal.h b/drivers/staging/rtl8712/rtl8712_hal.h
1223     index 665e718..d19865a 100644
1224     --- a/drivers/staging/rtl8712/rtl8712_hal.h
1225     +++ b/drivers/staging/rtl8712/rtl8712_hal.h
1226     @@ -145,5 +145,6 @@ struct hal_priv {
1227     };
1228    
1229     uint rtl8712_hal_init(struct _adapter *padapter);
1230     +int rtl871x_load_fw(struct _adapter *padapter);
1231    
1232     #endif
1233     diff --git a/drivers/staging/rtl8712/usb_intf.c b/drivers/staging/rtl8712/usb_intf.c
1234     index 5385da2..9bade18 100644
1235     --- a/drivers/staging/rtl8712/usb_intf.c
1236     +++ b/drivers/staging/rtl8712/usb_intf.c
1237     @@ -89,6 +89,7 @@ static struct usb_device_id rtl871x_usb_id_tbl[] = {
1238     {USB_DEVICE(0x0DF6, 0x0045)},
1239     {USB_DEVICE(0x0DF6, 0x0059)}, /* 11n mode disable */
1240     {USB_DEVICE(0x0DF6, 0x004B)},
1241     + {USB_DEVICE(0x0DF6, 0x005B)},
1242     {USB_DEVICE(0x0DF6, 0x005D)},
1243     {USB_DEVICE(0x0DF6, 0x0063)},
1244     /* Sweex */
1245     @@ -389,6 +390,7 @@ static int r871xu_drv_init(struct usb_interface *pusb_intf,
1246     pdvobjpriv = &padapter->dvobjpriv;
1247     pdvobjpriv->padapter = padapter;
1248     padapter->dvobjpriv.pusbdev = udev;
1249     + padapter->pusb_intf = pusb_intf;
1250     usb_set_intfdata(pusb_intf, pnetdev);
1251     SET_NETDEV_DEV(pnetdev, &pusb_intf->dev);
1252     /* step 2. */
1253     @@ -595,10 +597,11 @@ static int r871xu_drv_init(struct usb_interface *pusb_intf,
1254     "%pM\n", mac);
1255     memcpy(pnetdev->dev_addr, mac, ETH_ALEN);
1256     }
1257     - /* step 6. Tell the network stack we exist */
1258     - if (register_netdev(pnetdev) != 0)
1259     + /* step 6. Load the firmware asynchronously */
1260     + if (rtl871x_load_fw(padapter))
1261     goto error;
1262     spin_lock_init(&padapter->lockRxFF0Filter);
1263     + mutex_init(&padapter->mutex_start);
1264     return 0;
1265     error:
1266     usb_put_dev(udev);
1267     @@ -629,7 +632,8 @@ static void r871xu_dev_remove(struct usb_interface *pusb_intf)
1268     flush_scheduled_work();
1269     udelay(1);
1270     /*Stop driver mlme relation timer */
1271     - r8712_stop_drv_timers(padapter);
1272     + if (padapter->fw_found)
1273     + r8712_stop_drv_timers(padapter);
1274     r871x_dev_unload(padapter);
1275     r8712_free_drv_sw(padapter);
1276     }
1277     diff --git a/drivers/staging/zcache/zcache-main.c b/drivers/staging/zcache/zcache-main.c
1278     index 56c1f9c..f5e469d 100644
1279     --- a/drivers/staging/zcache/zcache-main.c
1280     +++ b/drivers/staging/zcache/zcache-main.c
1281     @@ -358,8 +358,8 @@ static struct zbud_hdr *zbud_create(uint16_t client_id, uint16_t pool_id,
1282     if (unlikely(zbpg == NULL))
1283     goto out;
1284     /* ok, have a page, now compress the data before taking locks */
1285     - spin_lock(&zbpg->lock);
1286     spin_lock(&zbud_budlists_spinlock);
1287     + spin_lock(&zbpg->lock);
1288     list_add_tail(&zbpg->bud_list, &zbud_unbuddied[nchunks].list);
1289     zbud_unbuddied[nchunks].count++;
1290     zh = &zbpg->buddy[0];
1291     @@ -389,12 +389,11 @@ init_zh:
1292     zh->oid = *oid;
1293     zh->pool_id = pool_id;
1294     zh->client_id = client_id;
1295     - /* can wait to copy the data until the list locks are dropped */
1296     - spin_unlock(&zbud_budlists_spinlock);
1297     -
1298     to = zbud_data(zh, size);
1299     memcpy(to, cdata, size);
1300     spin_unlock(&zbpg->lock);
1301     + spin_unlock(&zbud_budlists_spinlock);
1302     +
1303     zbud_cumul_chunk_counts[nchunks]++;
1304     atomic_inc(&zcache_zbud_curr_zpages);
1305     zcache_zbud_cumul_zpages++;
1306     @@ -1782,9 +1781,9 @@ static int zcache_frontswap_poolid = -1;
1307     * Swizzling increases objects per swaptype, increasing tmem concurrency
1308     * for heavy swaploads. Later, larger nr_cpus -> larger SWIZ_BITS
1309     * Setting SWIZ_BITS to 27 basically reconstructs the swap entry from
1310     - * frontswap_get_page()
1311     + * frontswap_get_page(), but has side-effects. Hence using 8.
1312     */
1313     -#define SWIZ_BITS 27
1314     +#define SWIZ_BITS 8
1315     #define SWIZ_MASK ((1 << SWIZ_BITS) - 1)
1316     #define _oswiz(_type, _ind) ((_type << SWIZ_BITS) | (_ind & SWIZ_MASK))
1317     #define iswiz(_ind) (_ind >> SWIZ_BITS)
1318     diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
1319     index 8599545..0c1d5c73 100644
1320     --- a/drivers/target/iscsi/iscsi_target.c
1321     +++ b/drivers/target/iscsi/iscsi_target.c
1322     @@ -1062,7 +1062,7 @@ attach_cmd:
1323     if (ret < 0)
1324     return iscsit_add_reject_from_cmd(
1325     ISCSI_REASON_BOOKMARK_NO_RESOURCES,
1326     - 1, 1, buf, cmd);
1327     + 1, 0, buf, cmd);
1328     /*
1329     * Check the CmdSN against ExpCmdSN/MaxCmdSN here if
1330     * the Immediate Bit is not set, and no Immediate
1331     @@ -3165,6 +3165,30 @@ static int iscsit_send_task_mgt_rsp(
1332     return 0;
1333     }
1334    
1335     +static bool iscsit_check_inaddr_any(struct iscsi_np *np)
1336     +{
1337     + bool ret = false;
1338     +
1339     + if (np->np_sockaddr.ss_family == AF_INET6) {
1340     + const struct sockaddr_in6 sin6 = {
1341     + .sin6_addr = IN6ADDR_ANY_INIT };
1342     + struct sockaddr_in6 *sock_in6 =
1343     + (struct sockaddr_in6 *)&np->np_sockaddr;
1344     +
1345     + if (!memcmp(sock_in6->sin6_addr.s6_addr,
1346     + sin6.sin6_addr.s6_addr, 16))
1347     + ret = true;
1348     + } else {
1349     + struct sockaddr_in * sock_in =
1350     + (struct sockaddr_in *)&np->np_sockaddr;
1351     +
1352     + if (sock_in->sin_addr.s_addr == INADDR_ANY)
1353     + ret = true;
1354     + }
1355     +
1356     + return ret;
1357     +}
1358     +
1359     static int iscsit_build_sendtargets_response(struct iscsi_cmd *cmd)
1360     {
1361     char *payload = NULL;
1362     @@ -3214,12 +3238,17 @@ static int iscsit_build_sendtargets_response(struct iscsi_cmd *cmd)
1363     spin_lock(&tpg->tpg_np_lock);
1364     list_for_each_entry(tpg_np, &tpg->tpg_gnp_list,
1365     tpg_np_list) {
1366     + struct iscsi_np *np = tpg_np->tpg_np;
1367     + bool inaddr_any = iscsit_check_inaddr_any(np);
1368     +
1369     len = sprintf(buf, "TargetAddress="
1370     "%s%s%s:%hu,%hu",
1371     - (tpg_np->tpg_np->np_sockaddr.ss_family == AF_INET6) ?
1372     - "[" : "", tpg_np->tpg_np->np_ip,
1373     - (tpg_np->tpg_np->np_sockaddr.ss_family == AF_INET6) ?
1374     - "]" : "", tpg_np->tpg_np->np_port,
1375     + (np->np_sockaddr.ss_family == AF_INET6) ?
1376     + "[" : "", (inaddr_any == false) ?
1377     + np->np_ip : conn->local_ip,
1378     + (np->np_sockaddr.ss_family == AF_INET6) ?
1379     + "]" : "", (inaddr_any == false) ?
1380     + np->np_port : conn->local_port,
1381     tpg->tpgt);
1382     len += 1;
1383    
1384     diff --git a/drivers/target/iscsi/iscsi_target_core.h b/drivers/target/iscsi/iscsi_target_core.h
1385     index f1a02da..7da2d6a 100644
1386     --- a/drivers/target/iscsi/iscsi_target_core.h
1387     +++ b/drivers/target/iscsi/iscsi_target_core.h
1388     @@ -508,6 +508,7 @@ struct iscsi_conn {
1389     u16 cid;
1390     /* Remote TCP Port */
1391     u16 login_port;
1392     + u16 local_port;
1393     int net_size;
1394     u32 auth_id;
1395     #define CONNFLAG_SCTP_STRUCT_FILE 0x01
1396     @@ -527,6 +528,7 @@ struct iscsi_conn {
1397     unsigned char bad_hdr[ISCSI_HDR_LEN];
1398     #define IPV6_ADDRESS_SPACE 48
1399     unsigned char login_ip[IPV6_ADDRESS_SPACE];
1400     + unsigned char local_ip[IPV6_ADDRESS_SPACE];
1401     int conn_usage_count;
1402     int conn_waiting_on_uc;
1403     atomic_t check_immediate_queue;
1404     diff --git a/drivers/target/iscsi/iscsi_target_login.c b/drivers/target/iscsi/iscsi_target_login.c
1405     index d734bde..bd2adec 100644
1406     --- a/drivers/target/iscsi/iscsi_target_login.c
1407     +++ b/drivers/target/iscsi/iscsi_target_login.c
1408     @@ -616,8 +616,8 @@ static int iscsi_post_login_handler(
1409     }
1410    
1411     pr_debug("iSCSI Login successful on CID: %hu from %s to"
1412     - " %s:%hu,%hu\n", conn->cid, conn->login_ip, np->np_ip,
1413     - np->np_port, tpg->tpgt);
1414     + " %s:%hu,%hu\n", conn->cid, conn->login_ip,
1415     + conn->local_ip, conn->local_port, tpg->tpgt);
1416    
1417     list_add_tail(&conn->conn_list, &sess->sess_conn_list);
1418     atomic_inc(&sess->nconn);
1419     @@ -659,7 +659,8 @@ static int iscsi_post_login_handler(
1420     sess->session_state = TARG_SESS_STATE_LOGGED_IN;
1421    
1422     pr_debug("iSCSI Login successful on CID: %hu from %s to %s:%hu,%hu\n",
1423     - conn->cid, conn->login_ip, np->np_ip, np->np_port, tpg->tpgt);
1424     + conn->cid, conn->login_ip, conn->local_ip, conn->local_port,
1425     + tpg->tpgt);
1426    
1427     spin_lock_bh(&sess->conn_lock);
1428     list_add_tail(&conn->conn_list, &sess->sess_conn_list);
1429     @@ -1019,6 +1020,18 @@ static int __iscsi_target_login_thread(struct iscsi_np *np)
1430     snprintf(conn->login_ip, sizeof(conn->login_ip), "%pI6c",
1431     &sock_in6.sin6_addr.in6_u);
1432     conn->login_port = ntohs(sock_in6.sin6_port);
1433     +
1434     + if (conn->sock->ops->getname(conn->sock,
1435     + (struct sockaddr *)&sock_in6, &err, 0) < 0) {
1436     + pr_err("sock_ops->getname() failed.\n");
1437     + iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_TARGET_ERR,
1438     + ISCSI_LOGIN_STATUS_TARGET_ERROR);
1439     + goto new_sess_out;
1440     + }
1441     + snprintf(conn->local_ip, sizeof(conn->local_ip), "%pI6c",
1442     + &sock_in6.sin6_addr.in6_u);
1443     + conn->local_port = ntohs(sock_in6.sin6_port);
1444     +
1445     } else {
1446     memset(&sock_in, 0, sizeof(struct sockaddr_in));
1447    
1448     @@ -1031,6 +1044,16 @@ static int __iscsi_target_login_thread(struct iscsi_np *np)
1449     }
1450     sprintf(conn->login_ip, "%pI4", &sock_in.sin_addr.s_addr);
1451     conn->login_port = ntohs(sock_in.sin_port);
1452     +
1453     + if (conn->sock->ops->getname(conn->sock,
1454     + (struct sockaddr *)&sock_in, &err, 0) < 0) {
1455     + pr_err("sock_ops->getname() failed.\n");
1456     + iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_TARGET_ERR,
1457     + ISCSI_LOGIN_STATUS_TARGET_ERROR);
1458     + goto new_sess_out;
1459     + }
1460     + sprintf(conn->local_ip, "%pI4", &sock_in.sin_addr.s_addr);
1461     + conn->local_port = ntohs(sock_in.sin_port);
1462     }
1463    
1464     conn->network_transport = np->np_network_transport;
1465     @@ -1038,7 +1061,7 @@ static int __iscsi_target_login_thread(struct iscsi_np *np)
1466     pr_debug("Received iSCSI login request from %s on %s Network"
1467     " Portal %s:%hu\n", conn->login_ip,
1468     (conn->network_transport == ISCSI_TCP) ? "TCP" : "SCTP",
1469     - np->np_ip, np->np_port);
1470     + conn->local_ip, conn->local_port);
1471    
1472     pr_debug("Moving to TARG_CONN_STATE_IN_LOGIN.\n");
1473     conn->conn_state = TARG_CONN_STATE_IN_LOGIN;
1474     diff --git a/drivers/target/iscsi/iscsi_target_util.c b/drivers/target/iscsi/iscsi_target_util.c
1475     index 02348f7..99f2af3 100644
1476     --- a/drivers/target/iscsi/iscsi_target_util.c
1477     +++ b/drivers/target/iscsi/iscsi_target_util.c
1478     @@ -851,6 +851,17 @@ void iscsit_free_cmd(struct iscsi_cmd *cmd)
1479     case ISCSI_OP_SCSI_TMFUNC:
1480     transport_generic_free_cmd(&cmd->se_cmd, 1);
1481     break;
1482     + case ISCSI_OP_REJECT:
1483     + /*
1484     + * Handle special case for REJECT when iscsi_add_reject*() has
1485     + * overwritten the original iscsi_opcode assignment, and the
1486     + * associated cmd->se_cmd needs to be released.
1487     + */
1488     + if (cmd->se_cmd.se_tfo != NULL) {
1489     + transport_generic_free_cmd(&cmd->se_cmd, 1);
1490     + break;
1491     + }
1492     + /* Fall-through */
1493     default:
1494     iscsit_release_cmd(cmd);
1495     break;
1496     diff --git a/drivers/target/target_core_cdb.c b/drivers/target/target_core_cdb.c
1497     index 2e8c1be..251e48f 100644
1498     --- a/drivers/target/target_core_cdb.c
1499     +++ b/drivers/target/target_core_cdb.c
1500     @@ -701,6 +701,13 @@ int target_emulate_inquiry(struct se_task *task)
1501     int p, ret;
1502    
1503     if (!(cdb[1] & 0x1)) {
1504     + if (cdb[2]) {
1505     + pr_err("INQUIRY with EVPD==0 but PAGE CODE=%02x\n",
1506     + cdb[2]);
1507     + cmd->scsi_sense_reason = TCM_INVALID_CDB_FIELD;
1508     + return -EINVAL;
1509     + }
1510     +
1511     ret = target_emulate_inquiry_std(cmd);
1512     goto out;
1513     }
1514     @@ -732,7 +739,7 @@ int target_emulate_inquiry(struct se_task *task)
1515     }
1516    
1517     pr_err("Unknown VPD Code: 0x%02x\n", cdb[2]);
1518     - cmd->scsi_sense_reason = TCM_UNSUPPORTED_SCSI_OPCODE;
1519     + cmd->scsi_sense_reason = TCM_INVALID_CDB_FIELD;
1520     ret = -EINVAL;
1521    
1522     out_unmap:
1523     diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c
1524     index 95dee70..9119d92 100644
1525     --- a/drivers/target/target_core_pr.c
1526     +++ b/drivers/target/target_core_pr.c
1527     @@ -481,6 +481,7 @@ static int core_scsi3_pr_seq_non_holder(
1528     case READ_MEDIA_SERIAL_NUMBER:
1529     case REPORT_LUNS:
1530     case REQUEST_SENSE:
1531     + case PERSISTENT_RESERVE_IN:
1532     ret = 0; /*/ Allowed CDBs */
1533     break;
1534     default:
1535     @@ -3138,7 +3139,7 @@ static int core_scsi3_pro_preempt(
1536     if (!calling_it_nexus)
1537     core_scsi3_ua_allocate(pr_reg_nacl,
1538     pr_res_mapped_lun, 0x2A,
1539     - ASCQ_2AH_RESERVATIONS_PREEMPTED);
1540     + ASCQ_2AH_REGISTRATIONS_PREEMPTED);
1541     }
1542     spin_unlock(&pr_tmpl->registration_lock);
1543     /*
1544     @@ -3251,7 +3252,7 @@ static int core_scsi3_pro_preempt(
1545     * additional sense code set to REGISTRATIONS PREEMPTED;
1546     */
1547     core_scsi3_ua_allocate(pr_reg_nacl, pr_res_mapped_lun, 0x2A,
1548     - ASCQ_2AH_RESERVATIONS_PREEMPTED);
1549     + ASCQ_2AH_REGISTRATIONS_PREEMPTED);
1550     }
1551     spin_unlock(&pr_tmpl->registration_lock);
1552     /*
1553     diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
1554     index e87d0eb..861628e 100644
1555     --- a/drivers/target/target_core_transport.c
1556     +++ b/drivers/target/target_core_transport.c
1557     @@ -3701,6 +3701,11 @@ transport_allocate_control_task(struct se_cmd *cmd)
1558     struct se_task *task;
1559     unsigned long flags;
1560    
1561     + /* Workaround for handling zero-length control CDBs */
1562     + if ((cmd->se_cmd_flags & SCF_SCSI_CONTROL_SG_IO_CDB) &&
1563     + !cmd->data_length)
1564     + return 0;
1565     +
1566     task = transport_generic_get_task(cmd, cmd->data_direction);
1567     if (!task)
1568     return -ENOMEM;
1569     @@ -3772,6 +3777,14 @@ int transport_generic_new_cmd(struct se_cmd *cmd)
1570     else if (!task_cdbs && (cmd->se_cmd_flags & SCF_SCSI_DATA_SG_IO_CDB)) {
1571     cmd->t_state = TRANSPORT_COMPLETE;
1572     atomic_set(&cmd->t_transport_active, 1);
1573     +
1574     + if (cmd->t_task_cdb[0] == REQUEST_SENSE) {
1575     + u8 ua_asc = 0, ua_ascq = 0;
1576     +
1577     + core_scsi3_ua_clear_for_request_sense(cmd,
1578     + &ua_asc, &ua_ascq);
1579     + }
1580     +
1581     INIT_WORK(&cmd->work, target_complete_ok_work);
1582     queue_work(target_completion_wq, &cmd->work);
1583     return 0;
1584     @@ -4403,8 +4416,8 @@ int transport_send_check_condition_and_sense(
1585     /* CURRENT ERROR */
1586     buffer[offset] = 0x70;
1587     buffer[offset+SPC_ADD_SENSE_LEN_OFFSET] = 10;
1588     - /* ABORTED COMMAND */
1589     - buffer[offset+SPC_SENSE_KEY_OFFSET] = ABORTED_COMMAND;
1590     + /* ILLEGAL REQUEST */
1591     + buffer[offset+SPC_SENSE_KEY_OFFSET] = ILLEGAL_REQUEST;
1592     /* INVALID FIELD IN CDB */
1593     buffer[offset+SPC_ASC_KEY_OFFSET] = 0x24;
1594     break;
1595     @@ -4412,8 +4425,8 @@ int transport_send_check_condition_and_sense(
1596     /* CURRENT ERROR */
1597     buffer[offset] = 0x70;
1598     buffer[offset+SPC_ADD_SENSE_LEN_OFFSET] = 10;
1599     - /* ABORTED COMMAND */
1600     - buffer[offset+SPC_SENSE_KEY_OFFSET] = ABORTED_COMMAND;
1601     + /* ILLEGAL REQUEST */
1602     + buffer[offset+SPC_SENSE_KEY_OFFSET] = ILLEGAL_REQUEST;
1603     /* INVALID FIELD IN PARAMETER LIST */
1604     buffer[offset+SPC_ASC_KEY_OFFSET] = 0x26;
1605     break;
1606     diff --git a/drivers/tty/vt/vt_ioctl.c b/drivers/tty/vt/vt_ioctl.c
1607     index 5e096f4..65447c5 100644
1608     --- a/drivers/tty/vt/vt_ioctl.c
1609     +++ b/drivers/tty/vt/vt_ioctl.c
1610     @@ -1463,7 +1463,6 @@ compat_kdfontop_ioctl(struct compat_console_font_op __user *fontop,
1611     if (!perm && op->op != KD_FONT_OP_GET)
1612     return -EPERM;
1613     op->data = compat_ptr(((struct compat_console_font_op *)op)->data);
1614     - op->flags |= KD_FONT_FLAG_OLD;
1615     i = con_font_op(vc, op);
1616     if (i)
1617     return i;
1618     diff --git a/drivers/usb/gadget/f_loopback.c b/drivers/usb/gadget/f_loopback.c
1619     index 6d87f28..2c0cd82 100644
1620     --- a/drivers/usb/gadget/f_loopback.c
1621     +++ b/drivers/usb/gadget/f_loopback.c
1622     @@ -418,7 +418,7 @@ int __init loopback_add(struct usb_composite_dev *cdev, bool autoresume)
1623    
1624     /* support autoresume for remote wakeup testing */
1625     if (autoresume)
1626     - sourcesink_driver.bmAttributes |= USB_CONFIG_ATT_WAKEUP;
1627     + loopback_driver.bmAttributes |= USB_CONFIG_ATT_WAKEUP;
1628    
1629     /* support OTG systems */
1630     if (gadget_is_otg(cdev->gadget)) {
1631     diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c
1632     index caf8742..ac53a66 100644
1633     --- a/drivers/usb/host/pci-quirks.c
1634     +++ b/drivers/usb/host/pci-quirks.c
1635     @@ -867,6 +867,12 @@ hc_init:
1636    
1637     static void __devinit quirk_usb_early_handoff(struct pci_dev *pdev)
1638     {
1639     + /* Skip Netlogic mips SoC's internal PCI USB controller.
1640     + * This device does not need/support EHCI/OHCI handoff
1641     + */
1642     + if (pdev->vendor == 0x184e) /* vendor Netlogic */
1643     + return;
1644     +
1645     if (pdev->class == PCI_CLASS_SERIAL_USB_UHCI)
1646     quirk_usb_handoff_uhci(pdev);
1647     else if (pdev->class == PCI_CLASS_SERIAL_USB_OHCI)
1648     diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
1649     index 058b92c..f030471 100644
1650     --- a/drivers/usb/serial/ftdi_sio.c
1651     +++ b/drivers/usb/serial/ftdi_sio.c
1652     @@ -839,6 +839,7 @@ static struct usb_device_id id_table_combined [] = {
1653     { USB_DEVICE(FTDI_VID, FTDI_SCIENCESCOPE_LOGBOOKML_PID) },
1654     { USB_DEVICE(FTDI_VID, FTDI_SCIENCESCOPE_LS_LOGBOOK_PID) },
1655     { USB_DEVICE(FTDI_VID, FTDI_SCIENCESCOPE_HS_LOGBOOK_PID) },
1656     + { USB_DEVICE(FTDI_VID, FTDI_CINTERION_MC55I_PID) },
1657     { USB_DEVICE(FTDI_VID, FTDI_DOTEC_PID) },
1658     { USB_DEVICE(QIHARDWARE_VID, MILKYMISTONE_JTAGSERIAL_PID),
1659     .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
1660     diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h
1661     index 76d4f31..4eb7715 100644
1662     --- a/drivers/usb/serial/ftdi_sio_ids.h
1663     +++ b/drivers/usb/serial/ftdi_sio_ids.h
1664     @@ -1187,3 +1187,10 @@
1665     */
1666     /* ZigBee controller */
1667     #define FTDI_RF_R106 0x8A28
1668     +
1669     +/*
1670     + * Product: HCP HIT GPRS modem
1671     + * Manufacturer: HCP d.o.o.
1672     + * ATI command output: Cinterion MC55i
1673     + */
1674     +#define FTDI_CINTERION_MC55I_PID 0xA951
1675     diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
1676     index 2a9ed6e..338d082 100644
1677     --- a/drivers/usb/serial/option.c
1678     +++ b/drivers/usb/serial/option.c
1679     @@ -855,6 +855,18 @@ static const struct usb_device_id option_ids[] = {
1680     { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0083, 0xff, 0xff, 0xff) },
1681     { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0086, 0xff, 0xff, 0xff) },
1682     { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0087, 0xff, 0xff, 0xff) },
1683     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0088, 0xff, 0xff, 0xff) },
1684     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0089, 0xff, 0xff, 0xff) },
1685     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0090, 0xff, 0xff, 0xff) },
1686     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0091, 0xff, 0xff, 0xff) },
1687     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0092, 0xff, 0xff, 0xff) },
1688     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0093, 0xff, 0xff, 0xff) },
1689     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0094, 0xff, 0xff, 0xff) },
1690     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0095, 0xff, 0xff, 0xff) },
1691     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0096, 0xff, 0xff, 0xff) },
1692     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0097, 0xff, 0xff, 0xff) },
1693     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0098, 0xff, 0xff, 0xff) },
1694     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0099, 0xff, 0xff, 0xff) },
1695     { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0104, 0xff, 0xff, 0xff),
1696     .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1697     { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0105, 0xff, 0xff, 0xff) },
1698     @@ -883,7 +895,6 @@ static const struct usb_device_id option_ids[] = {
1699     { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0151, 0xff, 0xff, 0xff) },
1700     { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0152, 0xff, 0xff, 0xff) },
1701     { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0153, 0xff, 0xff, 0xff) },
1702     - { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0154, 0xff, 0xff, 0xff) },
1703     { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0155, 0xff, 0xff, 0xff) },
1704     { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0156, 0xff, 0xff, 0xff) },
1705     { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0157, 0xff, 0xff, 0xff) },
1706     @@ -892,6 +903,12 @@ static const struct usb_device_id option_ids[] = {
1707     { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0160, 0xff, 0xff, 0xff) },
1708     { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0161, 0xff, 0xff, 0xff) },
1709     { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0162, 0xff, 0xff, 0xff) },
1710     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0164, 0xff, 0xff, 0xff) },
1711     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0165, 0xff, 0xff, 0xff) },
1712     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0168, 0xff, 0xff, 0xff) },
1713     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0170, 0xff, 0xff, 0xff) },
1714     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0176, 0xff, 0xff, 0xff) },
1715     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0178, 0xff, 0xff, 0xff) },
1716     { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1008, 0xff, 0xff, 0xff) },
1717     { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1010, 0xff, 0xff, 0xff) },
1718     { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1012, 0xff, 0xff, 0xff) },
1719     @@ -1066,6 +1083,116 @@ static const struct usb_device_id option_ids[] = {
1720     { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1298, 0xff, 0xff, 0xff) },
1721     { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1299, 0xff, 0xff, 0xff) },
1722     { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1300, 0xff, 0xff, 0xff) },
1723     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1401, 0xff, 0xff, 0xff) },
1724     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1402, 0xff, 0xff, 0xff) },
1725     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1403, 0xff, 0xff, 0xff) },
1726     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1404, 0xff, 0xff, 0xff) },
1727     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1405, 0xff, 0xff, 0xff) },
1728     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1406, 0xff, 0xff, 0xff) },
1729     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1407, 0xff, 0xff, 0xff) },
1730     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1408, 0xff, 0xff, 0xff) },
1731     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1409, 0xff, 0xff, 0xff) },
1732     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1410, 0xff, 0xff, 0xff) },
1733     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1411, 0xff, 0xff, 0xff) },
1734     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1412, 0xff, 0xff, 0xff) },
1735     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1413, 0xff, 0xff, 0xff) },
1736     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1414, 0xff, 0xff, 0xff) },
1737     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1415, 0xff, 0xff, 0xff) },
1738     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1416, 0xff, 0xff, 0xff) },
1739     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1417, 0xff, 0xff, 0xff) },
1740     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1418, 0xff, 0xff, 0xff) },
1741     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1419, 0xff, 0xff, 0xff) },
1742     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1420, 0xff, 0xff, 0xff) },
1743     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1421, 0xff, 0xff, 0xff) },
1744     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1422, 0xff, 0xff, 0xff) },
1745     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1423, 0xff, 0xff, 0xff) },
1746     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1424, 0xff, 0xff, 0xff) },
1747     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1425, 0xff, 0xff, 0xff) },
1748     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1426, 0xff, 0xff, 0xff) },
1749     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1427, 0xff, 0xff, 0xff) },
1750     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1428, 0xff, 0xff, 0xff) },
1751     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1429, 0xff, 0xff, 0xff) },
1752     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1430, 0xff, 0xff, 0xff) },
1753     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1431, 0xff, 0xff, 0xff) },
1754     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1432, 0xff, 0xff, 0xff) },
1755     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1433, 0xff, 0xff, 0xff) },
1756     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1434, 0xff, 0xff, 0xff) },
1757     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1435, 0xff, 0xff, 0xff) },
1758     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1436, 0xff, 0xff, 0xff) },
1759     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1437, 0xff, 0xff, 0xff) },
1760     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1438, 0xff, 0xff, 0xff) },
1761     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1439, 0xff, 0xff, 0xff) },
1762     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1440, 0xff, 0xff, 0xff) },
1763     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1441, 0xff, 0xff, 0xff) },
1764     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1442, 0xff, 0xff, 0xff) },
1765     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1443, 0xff, 0xff, 0xff) },
1766     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1444, 0xff, 0xff, 0xff) },
1767     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1445, 0xff, 0xff, 0xff) },
1768     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1446, 0xff, 0xff, 0xff) },
1769     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1447, 0xff, 0xff, 0xff) },
1770     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1448, 0xff, 0xff, 0xff) },
1771     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1449, 0xff, 0xff, 0xff) },
1772     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1450, 0xff, 0xff, 0xff) },
1773     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1451, 0xff, 0xff, 0xff) },
1774     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1452, 0xff, 0xff, 0xff) },
1775     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1453, 0xff, 0xff, 0xff) },
1776     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1454, 0xff, 0xff, 0xff) },
1777     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1455, 0xff, 0xff, 0xff) },
1778     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1456, 0xff, 0xff, 0xff) },
1779     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1457, 0xff, 0xff, 0xff) },
1780     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1458, 0xff, 0xff, 0xff) },
1781     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1459, 0xff, 0xff, 0xff) },
1782     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1460, 0xff, 0xff, 0xff) },
1783     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1461, 0xff, 0xff, 0xff) },
1784     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1462, 0xff, 0xff, 0xff) },
1785     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1463, 0xff, 0xff, 0xff) },
1786     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1464, 0xff, 0xff, 0xff) },
1787     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1465, 0xff, 0xff, 0xff) },
1788     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1466, 0xff, 0xff, 0xff) },
1789     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1467, 0xff, 0xff, 0xff) },
1790     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1468, 0xff, 0xff, 0xff) },
1791     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1469, 0xff, 0xff, 0xff) },
1792     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1470, 0xff, 0xff, 0xff) },
1793     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1471, 0xff, 0xff, 0xff) },
1794     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1472, 0xff, 0xff, 0xff) },
1795     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1473, 0xff, 0xff, 0xff) },
1796     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1474, 0xff, 0xff, 0xff) },
1797     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1475, 0xff, 0xff, 0xff) },
1798     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1476, 0xff, 0xff, 0xff) },
1799     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1477, 0xff, 0xff, 0xff) },
1800     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1478, 0xff, 0xff, 0xff) },
1801     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1479, 0xff, 0xff, 0xff) },
1802     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1480, 0xff, 0xff, 0xff) },
1803     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1481, 0xff, 0xff, 0xff) },
1804     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1482, 0xff, 0xff, 0xff) },
1805     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1483, 0xff, 0xff, 0xff) },
1806     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1484, 0xff, 0xff, 0xff) },
1807     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1485, 0xff, 0xff, 0xff) },
1808     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1486, 0xff, 0xff, 0xff) },
1809     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1487, 0xff, 0xff, 0xff) },
1810     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1488, 0xff, 0xff, 0xff) },
1811     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1489, 0xff, 0xff, 0xff) },
1812     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1490, 0xff, 0xff, 0xff) },
1813     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1491, 0xff, 0xff, 0xff) },
1814     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1492, 0xff, 0xff, 0xff) },
1815     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1493, 0xff, 0xff, 0xff) },
1816     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1494, 0xff, 0xff, 0xff) },
1817     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1495, 0xff, 0xff, 0xff) },
1818     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1496, 0xff, 0xff, 0xff) },
1819     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1497, 0xff, 0xff, 0xff) },
1820     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1498, 0xff, 0xff, 0xff) },
1821     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1499, 0xff, 0xff, 0xff) },
1822     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1500, 0xff, 0xff, 0xff) },
1823     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1501, 0xff, 0xff, 0xff) },
1824     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1502, 0xff, 0xff, 0xff) },
1825     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1503, 0xff, 0xff, 0xff) },
1826     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1504, 0xff, 0xff, 0xff) },
1827     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1505, 0xff, 0xff, 0xff) },
1828     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1506, 0xff, 0xff, 0xff) },
1829     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1507, 0xff, 0xff, 0xff) },
1830     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1508, 0xff, 0xff, 0xff) },
1831     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1509, 0xff, 0xff, 0xff) },
1832     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1510, 0xff, 0xff, 0xff) },
1833     { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0014, 0xff, 0xff, 0xff) }, /* ZTE CDMA products */
1834     { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0027, 0xff, 0xff, 0xff) },
1835     { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0059, 0xff, 0xff, 0xff) },
1836     diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c
1837     index 63409c1..e919c70 100644
1838     --- a/drivers/video/atmel_lcdfb.c
1839     +++ b/drivers/video/atmel_lcdfb.c
1840     @@ -1089,7 +1089,7 @@ static int atmel_lcdfb_suspend(struct platform_device *pdev, pm_message_t mesg)
1841     */
1842     lcdc_writel(sinfo, ATMEL_LCDC_IDR, ~0UL);
1843    
1844     - sinfo->saved_lcdcon = lcdc_readl(sinfo, ATMEL_LCDC_CONTRAST_VAL);
1845     + sinfo->saved_lcdcon = lcdc_readl(sinfo, ATMEL_LCDC_CONTRAST_CTR);
1846     lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, 0);
1847     if (sinfo->atmel_lcdfb_power_control)
1848     sinfo->atmel_lcdfb_power_control(0);
1849     diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c
1850     index 4ec3ee9..2504809 100644
1851     --- a/fs/cifs/sess.c
1852     +++ b/fs/cifs/sess.c
1853     @@ -246,16 +246,15 @@ static void ascii_ssetup_strings(char **pbcc_area, struct cifs_ses *ses,
1854     /* copy user */
1855     /* BB what about null user mounts - check that we do this BB */
1856     /* copy user */
1857     - if (ses->user_name != NULL)
1858     + if (ses->user_name != NULL) {
1859     strncpy(bcc_ptr, ses->user_name, MAX_USERNAME_SIZE);
1860     + bcc_ptr += strnlen(ses->user_name, MAX_USERNAME_SIZE);
1861     + }
1862     /* else null user mount */
1863     -
1864     - bcc_ptr += strnlen(ses->user_name, MAX_USERNAME_SIZE);
1865     *bcc_ptr = 0;
1866     bcc_ptr++; /* account for null termination */
1867    
1868     /* copy domain */
1869     -
1870     if (ses->domainName != NULL) {
1871     strncpy(bcc_ptr, ses->domainName, 256);
1872     bcc_ptr += strnlen(ses->domainName, 256);
1873     diff --git a/fs/ecryptfs/read_write.c b/fs/ecryptfs/read_write.c
1874     index 54eb14c..608c1c3 100644
1875     --- a/fs/ecryptfs/read_write.c
1876     +++ b/fs/ecryptfs/read_write.c
1877     @@ -130,7 +130,7 @@ int ecryptfs_write(struct inode *ecryptfs_inode, char *data, loff_t offset,
1878     pgoff_t ecryptfs_page_idx = (pos >> PAGE_CACHE_SHIFT);
1879     size_t start_offset_in_page = (pos & ~PAGE_CACHE_MASK);
1880     size_t num_bytes = (PAGE_CACHE_SIZE - start_offset_in_page);
1881     - size_t total_remaining_bytes = ((offset + size) - pos);
1882     + loff_t total_remaining_bytes = ((offset + size) - pos);
1883    
1884     if (fatal_signal_pending(current)) {
1885     rc = -EINTR;
1886     @@ -141,7 +141,7 @@ int ecryptfs_write(struct inode *ecryptfs_inode, char *data, loff_t offset,
1887     num_bytes = total_remaining_bytes;
1888     if (pos < offset) {
1889     /* remaining zeros to write, up to destination offset */
1890     - size_t total_remaining_zeros = (offset - pos);
1891     + loff_t total_remaining_zeros = (offset - pos);
1892    
1893     if (num_bytes > total_remaining_zeros)
1894     num_bytes = total_remaining_zeros;
1895     diff --git a/fs/proc/base.c b/fs/proc/base.c
1896     index 1fc1dca..1ace83d 100644
1897     --- a/fs/proc/base.c
1898     +++ b/fs/proc/base.c
1899     @@ -775,6 +775,13 @@ static int mem_open(struct inode* inode, struct file* file)
1900     if (IS_ERR(mm))
1901     return PTR_ERR(mm);
1902    
1903     + if (mm) {
1904     + /* ensure this mm_struct can't be freed */
1905     + atomic_inc(&mm->mm_count);
1906     + /* but do not pin its memory */
1907     + mmput(mm);
1908     + }
1909     +
1910     /* OK to pass negative loff_t, we can catch out-of-range */
1911     file->f_mode |= FMODE_UNSIGNED_OFFSET;
1912     file->private_data = mm;
1913     @@ -782,57 +789,13 @@ static int mem_open(struct inode* inode, struct file* file)
1914     return 0;
1915     }
1916    
1917     -static ssize_t mem_read(struct file * file, char __user * buf,
1918     - size_t count, loff_t *ppos)
1919     +static ssize_t mem_rw(struct file *file, char __user *buf,
1920     + size_t count, loff_t *ppos, int write)
1921     {
1922     - int ret;
1923     - char *page;
1924     - unsigned long src = *ppos;
1925     struct mm_struct *mm = file->private_data;
1926     -
1927     - if (!mm)
1928     - return 0;
1929     -
1930     - page = (char *)__get_free_page(GFP_TEMPORARY);
1931     - if (!page)
1932     - return -ENOMEM;
1933     -
1934     - ret = 0;
1935     -
1936     - while (count > 0) {
1937     - int this_len, retval;
1938     -
1939     - this_len = (count > PAGE_SIZE) ? PAGE_SIZE : count;
1940     - retval = access_remote_vm(mm, src, page, this_len, 0);
1941     - if (!retval) {
1942     - if (!ret)
1943     - ret = -EIO;
1944     - break;
1945     - }
1946     -
1947     - if (copy_to_user(buf, page, retval)) {
1948     - ret = -EFAULT;
1949     - break;
1950     - }
1951     -
1952     - ret += retval;
1953     - src += retval;
1954     - buf += retval;
1955     - count -= retval;
1956     - }
1957     - *ppos = src;
1958     -
1959     - free_page((unsigned long) page);
1960     - return ret;
1961     -}
1962     -
1963     -static ssize_t mem_write(struct file * file, const char __user *buf,
1964     - size_t count, loff_t *ppos)
1965     -{
1966     - int copied;
1967     + unsigned long addr = *ppos;
1968     + ssize_t copied;
1969     char *page;
1970     - unsigned long dst = *ppos;
1971     - struct mm_struct *mm = file->private_data;
1972    
1973     if (!mm)
1974     return 0;
1975     @@ -842,31 +805,54 @@ static ssize_t mem_write(struct file * file, const char __user *buf,
1976     return -ENOMEM;
1977    
1978     copied = 0;
1979     + if (!atomic_inc_not_zero(&mm->mm_users))
1980     + goto free;
1981     +
1982     while (count > 0) {
1983     - int this_len, retval;
1984     + int this_len = min_t(int, count, PAGE_SIZE);
1985    
1986     - this_len = (count > PAGE_SIZE) ? PAGE_SIZE : count;
1987     - if (copy_from_user(page, buf, this_len)) {
1988     + if (write && copy_from_user(page, buf, this_len)) {
1989     copied = -EFAULT;
1990     break;
1991     }
1992     - retval = access_remote_vm(mm, dst, page, this_len, 1);
1993     - if (!retval) {
1994     +
1995     + this_len = access_remote_vm(mm, addr, page, this_len, write);
1996     + if (!this_len) {
1997     if (!copied)
1998     copied = -EIO;
1999     break;
2000     }
2001     - copied += retval;
2002     - buf += retval;
2003     - dst += retval;
2004     - count -= retval;
2005     +
2006     + if (!write && copy_to_user(buf, page, this_len)) {
2007     + copied = -EFAULT;
2008     + break;
2009     + }
2010     +
2011     + buf += this_len;
2012     + addr += this_len;
2013     + copied += this_len;
2014     + count -= this_len;
2015     }
2016     - *ppos = dst;
2017     + *ppos = addr;
2018    
2019     + mmput(mm);
2020     +free:
2021     free_page((unsigned long) page);
2022     return copied;
2023     }
2024    
2025     +static ssize_t mem_read(struct file *file, char __user *buf,
2026     + size_t count, loff_t *ppos)
2027     +{
2028     + return mem_rw(file, buf, count, ppos, 0);
2029     +}
2030     +
2031     +static ssize_t mem_write(struct file *file, const char __user *buf,
2032     + size_t count, loff_t *ppos)
2033     +{
2034     + return mem_rw(file, (char __user*)buf, count, ppos, 1);
2035     +}
2036     +
2037     loff_t mem_lseek(struct file *file, loff_t offset, int orig)
2038     {
2039     switch (orig) {
2040     @@ -886,8 +872,8 @@ loff_t mem_lseek(struct file *file, loff_t offset, int orig)
2041     static int mem_release(struct inode *inode, struct file *file)
2042     {
2043     struct mm_struct *mm = file->private_data;
2044     -
2045     - mmput(mm);
2046     + if (mm)
2047     + mmdrop(mm);
2048     return 0;
2049     }
2050    
2051     diff --git a/fs/udf/super.c b/fs/udf/super.c
2052     index e185253..87cb24a 100644
2053     --- a/fs/udf/super.c
2054     +++ b/fs/udf/super.c
2055     @@ -1799,6 +1799,12 @@ static void udf_close_lvid(struct super_block *sb)
2056     le16_to_cpu(lvid->descTag.descCRCLength)));
2057    
2058     lvid->descTag.tagChecksum = udf_tag_checksum(&lvid->descTag);
2059     + /*
2060     + * We set buffer uptodate unconditionally here to avoid spurious
2061     + * warnings from mark_buffer_dirty() when previous EIO has marked
2062     + * the buffer as !uptodate
2063     + */
2064     + set_buffer_uptodate(bh);
2065     mark_buffer_dirty(bh);
2066     sbi->s_lvid_dirty = 0;
2067     mutex_unlock(&sbi->s_alloc_mutex);
2068     diff --git a/include/linux/freezer.h b/include/linux/freezer.h
2069     index a5386e3..b5d6b6a 100644
2070     --- a/include/linux/freezer.h
2071     +++ b/include/linux/freezer.h
2072     @@ -51,6 +51,7 @@ extern void refrigerator(void);
2073     extern int freeze_processes(void);
2074     extern int freeze_kernel_threads(void);
2075     extern void thaw_processes(void);
2076     +extern void thaw_kernel_threads(void);
2077    
2078     static inline int try_to_freeze(void)
2079     {
2080     @@ -185,6 +186,7 @@ static inline void refrigerator(void) {}
2081     static inline int freeze_processes(void) { return -ENOSYS; }
2082     static inline int freeze_kernel_threads(void) { return -ENOSYS; }
2083     static inline void thaw_processes(void) {}
2084     +static inline void thaw_kernel_threads(void) {}
2085    
2086     static inline int try_to_freeze(void) { return 0; }
2087    
2088     diff --git a/include/linux/pm_qos.h b/include/linux/pm_qos.h
2089     index 83b0ea3..8a0ede4 100644
2090     --- a/include/linux/pm_qos.h
2091     +++ b/include/linux/pm_qos.h
2092     @@ -107,7 +107,19 @@ static inline void pm_qos_remove_request(struct pm_qos_request *req)
2093     { return; }
2094    
2095     static inline int pm_qos_request(int pm_qos_class)
2096     - { return 0; }
2097     +{
2098     + switch (pm_qos_class) {
2099     + case PM_QOS_CPU_DMA_LATENCY:
2100     + return PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE;
2101     + case PM_QOS_NETWORK_LATENCY:
2102     + return PM_QOS_NETWORK_LAT_DEFAULT_VALUE;
2103     + case PM_QOS_NETWORK_THROUGHPUT:
2104     + return PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE;
2105     + default:
2106     + return PM_QOS_DEFAULT_VALUE;
2107     + }
2108     +}
2109     +
2110     static inline int pm_qos_add_notifier(int pm_qos_class,
2111     struct notifier_block *notifier)
2112     { return 0; }
2113     diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h
2114     index 61b2905..3b6f628 100644
2115     --- a/include/linux/usb/ch9.h
2116     +++ b/include/linux/usb/ch9.h
2117     @@ -589,7 +589,7 @@ static inline int usb_endpoint_is_isoc_out(
2118     */
2119     static inline int usb_endpoint_maxp(const struct usb_endpoint_descriptor *epd)
2120     {
2121     - return le16_to_cpu(epd->wMaxPacketSize);
2122     + return __le16_to_cpu(epd->wMaxPacketSize);
2123     }
2124    
2125     /*-------------------------------------------------------------------------*/
2126     diff --git a/kernel/kprobes.c b/kernel/kprobes.c
2127     index 52fd049..faa39d1 100644
2128     --- a/kernel/kprobes.c
2129     +++ b/kernel/kprobes.c
2130     @@ -1673,8 +1673,12 @@ static int __kprobes pre_handler_kretprobe(struct kprobe *p,
2131     ri->rp = rp;
2132     ri->task = current;
2133    
2134     - if (rp->entry_handler && rp->entry_handler(ri, regs))
2135     + if (rp->entry_handler && rp->entry_handler(ri, regs)) {
2136     + raw_spin_lock_irqsave(&rp->lock, flags);
2137     + hlist_add_head(&ri->hlist, &rp->free_instances);
2138     + raw_spin_unlock_irqrestore(&rp->lock, flags);
2139     return 0;
2140     + }
2141    
2142     arch_prepare_kretprobe(ri, regs);
2143    
2144     diff --git a/kernel/panic.c b/kernel/panic.c
2145     index b2659360..3458469 100644
2146     --- a/kernel/panic.c
2147     +++ b/kernel/panic.c
2148     @@ -237,11 +237,20 @@ void add_taint(unsigned flag)
2149     * Can't trust the integrity of the kernel anymore.
2150     * We don't call directly debug_locks_off() because the issue
2151     * is not necessarily serious enough to set oops_in_progress to 1
2152     - * Also we want to keep up lockdep for staging development and
2153     - * post-warning case.
2154     + * Also we want to keep up lockdep for staging/out-of-tree
2155     + * development and post-warning case.
2156     */
2157     - if (flag != TAINT_CRAP && flag != TAINT_WARN && __debug_locks_off())
2158     - printk(KERN_WARNING "Disabling lock debugging due to kernel taint\n");
2159     + switch (flag) {
2160     + case TAINT_CRAP:
2161     + case TAINT_OOT_MODULE:
2162     + case TAINT_WARN:
2163     + case TAINT_FIRMWARE_WORKAROUND:
2164     + break;
2165     +
2166     + default:
2167     + if (__debug_locks_off())
2168     + printk(KERN_WARNING "Disabling lock debugging due to kernel taint\n");
2169     + }
2170    
2171     set_bit(flag, &tainted_mask);
2172     }
2173     diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
2174     index a6b0503..624538a 100644
2175     --- a/kernel/power/hibernate.c
2176     +++ b/kernel/power/hibernate.c
2177     @@ -55,7 +55,7 @@ enum {
2178    
2179     static int hibernation_mode = HIBERNATION_SHUTDOWN;
2180    
2181     -static bool freezer_test_done;
2182     +bool freezer_test_done;
2183    
2184     static const struct platform_hibernation_ops *hibernation_ops;
2185    
2186     diff --git a/kernel/power/power.h b/kernel/power/power.h
2187     index 23a2db1..0c4defe 100644
2188     --- a/kernel/power/power.h
2189     +++ b/kernel/power/power.h
2190     @@ -50,6 +50,8 @@ static inline char *check_image_kernel(struct swsusp_info *info)
2191     #define SPARE_PAGES ((1024 * 1024) >> PAGE_SHIFT)
2192    
2193     /* kernel/power/hibernate.c */
2194     +extern bool freezer_test_done;
2195     +
2196     extern int hibernation_snapshot(int platform_mode);
2197     extern int hibernation_restore(int platform_mode);
2198     extern int hibernation_platform_enter(void);
2199     diff --git a/kernel/power/process.c b/kernel/power/process.c
2200     index addbbe5..3d4b954 100644
2201     --- a/kernel/power/process.c
2202     +++ b/kernel/power/process.c
2203     @@ -203,3 +203,12 @@ void thaw_processes(void)
2204     printk("done.\n");
2205     }
2206    
2207     +void thaw_kernel_threads(void)
2208     +{
2209     + printk("Restarting kernel threads ... ");
2210     + thaw_workqueues();
2211     + thaw_tasks(true);
2212     + schedule();
2213     + printk("done.\n");
2214     +}
2215     +
2216     diff --git a/kernel/power/user.c b/kernel/power/user.c
2217     index 6d8f535..f08d227 100644
2218     --- a/kernel/power/user.c
2219     +++ b/kernel/power/user.c
2220     @@ -283,10 +283,17 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd,
2221     }
2222     pm_restore_gfp_mask();
2223     error = hibernation_snapshot(data->platform_support);
2224     - if (!error)
2225     + if (error) {
2226     + thaw_kernel_threads();
2227     + } else {
2228     error = put_user(in_suspend, (int __user *)arg);
2229     - if (!error)
2230     - data->ready = 1;
2231     + if (!error && !freezer_test_done)
2232     + data->ready = 1;
2233     + if (freezer_test_done) {
2234     + freezer_test_done = false;
2235     + thaw_kernel_threads();
2236     + }
2237     + }
2238     break;
2239    
2240     case SNAPSHOT_ATOMIC_RESTORE:
2241     @@ -303,6 +310,15 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd,
2242     swsusp_free();
2243     memset(&data->handle, 0, sizeof(struct snapshot_handle));
2244     data->ready = 0;
2245     + /*
2246     + * It is necessary to thaw kernel threads here, because
2247     + * SNAPSHOT_CREATE_IMAGE may be invoked directly after
2248     + * SNAPSHOT_FREE. In that case, if kernel threads were not
2249     + * thawed, the preallocation of memory carried out by
2250     + * hibernation_snapshot() might run into problems (i.e. it
2251     + * might fail or even deadlock).
2252     + */
2253     + thaw_kernel_threads();
2254     break;
2255    
2256     case SNAPSHOT_SET_IMAGE_SIZE:
2257     diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c
2258     index 583a136..78fcacf 100644
2259     --- a/kernel/sched_rt.c
2260     +++ b/kernel/sched_rt.c
2261     @@ -1388,6 +1388,11 @@ static int push_rt_task(struct rq *rq)
2262     if (!next_task)
2263     return 0;
2264    
2265     +#ifdef __ARCH_WANT_INTERRUPTS_ON_CTXSW
2266     + if (unlikely(task_running(rq, next_task)))
2267     + return 0;
2268     +#endif
2269     +
2270     retry:
2271     if (unlikely(next_task == rq->curr)) {
2272     WARN_ON(1);
2273     diff --git a/mm/compaction.c b/mm/compaction.c
2274     index 899d956..8fb8a40 100644
2275     --- a/mm/compaction.c
2276     +++ b/mm/compaction.c
2277     @@ -313,12 +313,34 @@ static isolate_migrate_t isolate_migratepages(struct zone *zone,
2278     } else if (!locked)
2279     spin_lock_irq(&zone->lru_lock);
2280    
2281     + /*
2282     + * migrate_pfn does not necessarily start aligned to a
2283     + * pageblock. Ensure that pfn_valid is called when moving
2284     + * into a new MAX_ORDER_NR_PAGES range in case of large
2285     + * memory holes within the zone
2286     + */
2287     + if ((low_pfn & (MAX_ORDER_NR_PAGES - 1)) == 0) {
2288     + if (!pfn_valid(low_pfn)) {
2289     + low_pfn += MAX_ORDER_NR_PAGES - 1;
2290     + continue;
2291     + }
2292     + }
2293     +
2294     if (!pfn_valid_within(low_pfn))
2295     continue;
2296     nr_scanned++;
2297    
2298     - /* Get the page and skip if free */
2299     + /*
2300     + * Get the page and ensure the page is within the same zone.
2301     + * See the comment in isolate_freepages about overlapping
2302     + * nodes. It is deliberate that the new zone lock is not taken
2303     + * as memory compaction should not move pages between nodes.
2304     + */
2305     page = pfn_to_page(low_pfn);
2306     + if (page_zone(page) != zone)
2307     + continue;
2308     +
2309     + /* Skip if free */
2310     if (PageBuddy(page))
2311     continue;
2312    
2313     diff --git a/mm/filemap.c b/mm/filemap.c
2314     index 90286a4..03c5b0e 100644
2315     --- a/mm/filemap.c
2316     +++ b/mm/filemap.c
2317     @@ -1400,15 +1400,12 @@ generic_file_aio_read(struct kiocb *iocb, const struct iovec *iov,
2318     unsigned long seg = 0;
2319     size_t count;
2320     loff_t *ppos = &iocb->ki_pos;
2321     - struct blk_plug plug;
2322    
2323     count = 0;
2324     retval = generic_segment_checks(iov, &nr_segs, &count, VERIFY_WRITE);
2325     if (retval)
2326     return retval;
2327    
2328     - blk_start_plug(&plug);
2329     -
2330     /* coalesce the iovecs and go direct-to-BIO for O_DIRECT */
2331     if (filp->f_flags & O_DIRECT) {
2332     loff_t size;
2333     @@ -1424,8 +1421,12 @@ generic_file_aio_read(struct kiocb *iocb, const struct iovec *iov,
2334     retval = filemap_write_and_wait_range(mapping, pos,
2335     pos + iov_length(iov, nr_segs) - 1);
2336     if (!retval) {
2337     + struct blk_plug plug;
2338     +
2339     + blk_start_plug(&plug);
2340     retval = mapping->a_ops->direct_IO(READ, iocb,
2341     iov, pos, nr_segs);
2342     + blk_finish_plug(&plug);
2343     }
2344     if (retval > 0) {
2345     *ppos = pos + retval;
2346     @@ -1481,7 +1482,6 @@ generic_file_aio_read(struct kiocb *iocb, const struct iovec *iov,
2347     break;
2348     }
2349     out:
2350     - blk_finish_plug(&plug);
2351     return retval;
2352     }
2353     EXPORT_SYMBOL(generic_file_aio_read);
2354     diff --git a/mm/filemap_xip.c b/mm/filemap_xip.c
2355     index f91b2f6..a4eb311 100644
2356     --- a/mm/filemap_xip.c
2357     +++ b/mm/filemap_xip.c
2358     @@ -263,7 +263,12 @@ found:
2359     xip_pfn);
2360     if (err == -ENOMEM)
2361     return VM_FAULT_OOM;
2362     - BUG_ON(err);
2363     + /*
2364     + * err == -EBUSY is fine, we've raced against another thread
2365     + * that faulted-in the same page
2366     + */
2367     + if (err != -EBUSY)
2368     + BUG_ON(err);
2369     return VM_FAULT_NOPAGE;
2370     } else {
2371     int err, ret = VM_FAULT_OOM;
2372     diff --git a/mm/huge_memory.c b/mm/huge_memory.c
2373     index 36b3d98..33141f5 100644
2374     --- a/mm/huge_memory.c
2375     +++ b/mm/huge_memory.c
2376     @@ -2064,7 +2064,7 @@ static void collect_mm_slot(struct mm_slot *mm_slot)
2377     {
2378     struct mm_struct *mm = mm_slot->mm;
2379    
2380     - VM_BUG_ON(!spin_is_locked(&khugepaged_mm_lock));
2381     + VM_BUG_ON(NR_CPUS != 1 && !spin_is_locked(&khugepaged_mm_lock));
2382    
2383     if (khugepaged_test_exit(mm)) {
2384     /* free mm_slot */
2385     @@ -2094,7 +2094,7 @@ static unsigned int khugepaged_scan_mm_slot(unsigned int pages,
2386     int progress = 0;
2387    
2388     VM_BUG_ON(!pages);
2389     - VM_BUG_ON(!spin_is_locked(&khugepaged_mm_lock));
2390     + VM_BUG_ON(NR_CPUS != 1 && !spin_is_locked(&khugepaged_mm_lock));
2391    
2392     if (khugepaged_scan.mm_slot)
2393     mm_slot = khugepaged_scan.mm_slot;
2394     diff --git a/mm/swap.c b/mm/swap.c
2395     index a91caf7..55b266d 100644
2396     --- a/mm/swap.c
2397     +++ b/mm/swap.c
2398     @@ -667,7 +667,7 @@ void lru_add_page_tail(struct zone* zone,
2399     VM_BUG_ON(!PageHead(page));
2400     VM_BUG_ON(PageCompound(page_tail));
2401     VM_BUG_ON(PageLRU(page_tail));
2402     - VM_BUG_ON(!spin_is_locked(&zone->lru_lock));
2403     + VM_BUG_ON(NR_CPUS != 1 && !spin_is_locked(&zone->lru_lock));
2404    
2405     SetPageLRU(page_tail);
2406    
2407     diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
2408     index 4562e9d..05c8768 100644
2409     --- a/sound/pci/hda/hda_codec.c
2410     +++ b/sound/pci/hda/hda_codec.c
2411     @@ -1446,7 +1446,7 @@ void snd_hda_codec_setup_stream(struct hda_codec *codec, hda_nid_t nid,
2412     for (i = 0; i < c->cvt_setups.used; i++) {
2413     p = snd_array_elem(&c->cvt_setups, i);
2414     if (!p->active && p->stream_tag == stream_tag &&
2415     - get_wcaps_type(get_wcaps(codec, p->nid)) == type)
2416     + get_wcaps_type(get_wcaps(c, p->nid)) == type)
2417     p->dirty = 1;
2418     }
2419     }
2420     diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c
2421     index 5b0a9bb..ec0518e 100644
2422     --- a/sound/pci/hda/patch_cirrus.c
2423     +++ b/sound/pci/hda/patch_cirrus.c
2424     @@ -976,8 +976,10 @@ static void cs_automic(struct hda_codec *codec)
2425     /* specific to CS421x, single ADC */
2426     if (spec->vendor_nid == CS421X_VENDOR_NID) {
2427     if (present) {
2428     - spec->last_input = spec->cur_input;
2429     - spec->cur_input = spec->automic_idx;
2430     + if (spec->cur_input != spec->automic_idx) {
2431     + spec->last_input = spec->cur_input;
2432     + spec->cur_input = spec->automic_idx;
2433     + }
2434     } else {
2435     spec->cur_input = spec->last_input;
2436     }
2437     diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
2438     index 5f03c40..34e5fcc 100644
2439     --- a/sound/pci/hda/patch_realtek.c
2440     +++ b/sound/pci/hda/patch_realtek.c
2441     @@ -176,6 +176,7 @@ struct alc_spec {
2442     unsigned int detect_lo:1; /* Line-out detection enabled */
2443     unsigned int automute_speaker_possible:1; /* there are speakers and either LO or HP */
2444     unsigned int automute_lo_possible:1; /* there are line outs and HP */
2445     + unsigned int keep_vref_in_automute:1; /* Don't clear VREF in automute */
2446    
2447     /* other flags */
2448     unsigned int no_analog :1; /* digital I/O only */
2449     @@ -519,13 +520,24 @@ static void do_automute(struct hda_codec *codec, int num_pins, hda_nid_t *pins,
2450    
2451     for (i = 0; i < num_pins; i++) {
2452     hda_nid_t nid = pins[i];
2453     + unsigned int val;
2454     if (!nid)
2455     break;
2456     switch (spec->automute_mode) {
2457     case ALC_AUTOMUTE_PIN:
2458     + /* don't reset VREF value in case it's controlling
2459     + * the amp (see alc861_fixup_asus_amp_vref_0f())
2460     + */
2461     + if (spec->keep_vref_in_automute) {
2462     + val = snd_hda_codec_read(codec, nid, 0,
2463     + AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
2464     + val &= ~PIN_HP;
2465     + } else
2466     + val = 0;
2467     + val |= pin_bits;
2468     snd_hda_codec_write(codec, nid, 0,
2469     AC_VERB_SET_PIN_WIDGET_CONTROL,
2470     - pin_bits);
2471     + val);
2472     break;
2473     case ALC_AUTOMUTE_AMP:
2474     snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
2475     @@ -5011,7 +5023,6 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
2476     SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
2477     ALC269_FIXUP_AMIC),
2478     SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
2479     - SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269_FIXUP_AMIC),
2480     SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
2481     SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
2482     SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
2483     @@ -5226,6 +5237,25 @@ enum {
2484     PINFIX_ASUS_A6RP,
2485     };
2486    
2487     +/* On some laptops, VREF of pin 0x0f is abused for controlling the main amp */
2488     +static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
2489     + const struct alc_fixup *fix, int action)
2490     +{
2491     + struct alc_spec *spec = codec->spec;
2492     + unsigned int val;
2493     +
2494     + if (action != ALC_FIXUP_ACT_INIT)
2495     + return;
2496     + val = snd_hda_codec_read(codec, 0x0f, 0,
2497     + AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
2498     + if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
2499     + val |= AC_PINCTL_IN_EN;
2500     + val |= AC_PINCTL_VREF_50;
2501     + snd_hda_codec_write(codec, 0x0f, 0,
2502     + AC_VERB_SET_PIN_WIDGET_CONTROL, val);
2503     + spec->keep_vref_in_automute = 1;
2504     +}
2505     +
2506     static const struct alc_fixup alc861_fixups[] = {
2507     [PINFIX_FSC_AMILO_PI1505] = {
2508     .type = ALC_FIXUP_PINS,
2509     @@ -5236,17 +5266,13 @@ static const struct alc_fixup alc861_fixups[] = {
2510     }
2511     },
2512     [PINFIX_ASUS_A6RP] = {
2513     - .type = ALC_FIXUP_VERBS,
2514     - .v.verbs = (const struct hda_verb[]) {
2515     - /* node 0x0f VREF seems controlling the master output */
2516     - { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 },
2517     - { }
2518     - },
2519     + .type = ALC_FIXUP_FUNC,
2520     + .v.func = alc861_fixup_asus_amp_vref_0f,
2521     },
2522     };
2523    
2524     static const struct snd_pci_quirk alc861_fixup_tbl[] = {
2525     - SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", PINFIX_ASUS_A6RP),
2526     + SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", PINFIX_ASUS_A6RP),
2527     SND_PCI_QUIRK(0x1584, 0x2b01, "Haier W18", PINFIX_ASUS_A6RP),
2528     SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505),
2529     {}
2530     diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c
2531     index 8d69e59..a0a3f50 100644
2532     --- a/sound/pci/hda/patch_via.c
2533     +++ b/sound/pci/hda/patch_via.c
2534     @@ -198,6 +198,9 @@ struct via_spec {
2535     unsigned int no_pin_power_ctl;
2536     enum VIA_HDA_CODEC codec_type;
2537    
2538     + /* analog low-power control */
2539     + bool alc_mode;
2540     +
2541     /* smart51 setup */
2542     unsigned int smart51_nums;
2543     hda_nid_t smart51_pins[2];
2544     @@ -748,6 +751,7 @@ static int via_pin_power_ctl_put(struct snd_kcontrol *kcontrol,
2545     return 0;
2546     spec->no_pin_power_ctl = val;
2547     set_widgets_power_state(codec);
2548     + analog_low_current_mode(codec);
2549     return 1;
2550     }
2551    
2552     @@ -1035,13 +1039,19 @@ static bool is_aa_path_mute(struct hda_codec *codec)
2553     }
2554    
2555     /* enter/exit analog low-current mode */
2556     -static void analog_low_current_mode(struct hda_codec *codec)
2557     +static void __analog_low_current_mode(struct hda_codec *codec, bool force)
2558     {
2559     struct via_spec *spec = codec->spec;
2560     bool enable;
2561     unsigned int verb, parm;
2562    
2563     - enable = is_aa_path_mute(codec) && (spec->opened_streams != 0);
2564     + if (spec->no_pin_power_ctl)
2565     + enable = false;
2566     + else
2567     + enable = is_aa_path_mute(codec) && !spec->opened_streams;
2568     + if (enable == spec->alc_mode && !force)
2569     + return;
2570     + spec->alc_mode = enable;
2571    
2572     /* decide low current mode's verb & parameter */
2573     switch (spec->codec_type) {
2574     @@ -1073,6 +1083,11 @@ static void analog_low_current_mode(struct hda_codec *codec)
2575     snd_hda_codec_write(codec, codec->afg, 0, verb, parm);
2576     }
2577    
2578     +static void analog_low_current_mode(struct hda_codec *codec)
2579     +{
2580     + return __analog_low_current_mode(codec, false);
2581     +}
2582     +
2583     /*
2584     * generic initialization of ADC, input mixers and output mixers
2585     */
2586     @@ -1445,6 +1460,7 @@ static int via_build_controls(struct hda_codec *codec)
2587     struct snd_kcontrol *kctl;
2588     int err, i;
2589    
2590     + spec->no_pin_power_ctl = 1;
2591     if (spec->set_widgets_power_state)
2592     if (!via_clone_control(spec, &via_pin_power_ctl_enum))
2593     return -ENOMEM;
2594     @@ -1498,10 +1514,6 @@ static int via_build_controls(struct hda_codec *codec)
2595     return err;
2596     }
2597    
2598     - /* init power states */
2599     - set_widgets_power_state(codec);
2600     - analog_low_current_mode(codec);
2601     -
2602     via_free_kctls(codec); /* no longer needed */
2603     return 0;
2604     }
2605     @@ -2771,6 +2783,10 @@ static int via_init(struct hda_codec *codec)
2606     for (i = 0; i < spec->num_iverbs; i++)
2607     snd_hda_sequence_write(codec, spec->init_verbs[i]);
2608    
2609     + /* init power states */
2610     + set_widgets_power_state(codec);
2611     + __analog_low_current_mode(codec, true);
2612     +
2613     via_auto_init_multi_out(codec);
2614     via_auto_init_hp_out(codec);
2615     via_auto_init_speaker_out(codec);
2616     diff --git a/sound/pci/oxygen/oxygen_mixer.c b/sound/pci/oxygen/oxygen_mixer.c
2617     index 26c7e8b..c0dbb52 100644
2618     --- a/sound/pci/oxygen/oxygen_mixer.c
2619     +++ b/sound/pci/oxygen/oxygen_mixer.c
2620     @@ -618,9 +618,12 @@ static int ac97_volume_get(struct snd_kcontrol *ctl,
2621     mutex_lock(&chip->mutex);
2622     reg = oxygen_read_ac97(chip, codec, index);
2623     mutex_unlock(&chip->mutex);
2624     - value->value.integer.value[0] = 31 - (reg & 0x1f);
2625     - if (stereo)
2626     - value->value.integer.value[1] = 31 - ((reg >> 8) & 0x1f);
2627     + if (!stereo) {
2628     + value->value.integer.value[0] = 31 - (reg & 0x1f);
2629     + } else {
2630     + value->value.integer.value[0] = 31 - ((reg >> 8) & 0x1f);
2631     + value->value.integer.value[1] = 31 - (reg & 0x1f);
2632     + }
2633     return 0;
2634     }
2635    
2636     @@ -636,14 +639,14 @@ static int ac97_volume_put(struct snd_kcontrol *ctl,
2637    
2638     mutex_lock(&chip->mutex);
2639     oldreg = oxygen_read_ac97(chip, codec, index);
2640     - newreg = oldreg;
2641     - newreg = (newreg & ~0x1f) |
2642     - (31 - (value->value.integer.value[0] & 0x1f));
2643     - if (stereo)
2644     - newreg = (newreg & ~0x1f00) |
2645     - ((31 - (value->value.integer.value[1] & 0x1f)) << 8);
2646     - else
2647     - newreg = (newreg & ~0x1f00) | ((newreg & 0x1f) << 8);
2648     + if (!stereo) {
2649     + newreg = oldreg & ~0x1f;
2650     + newreg |= 31 - (value->value.integer.value[0] & 0x1f);
2651     + } else {
2652     + newreg = oldreg & ~0x1f1f;
2653     + newreg |= (31 - (value->value.integer.value[0] & 0x1f)) << 8;
2654     + newreg |= 31 - (value->value.integer.value[1] & 0x1f);
2655     + }
2656     change = newreg != oldreg;
2657     if (change)
2658     oxygen_write_ac97(chip, codec, index, newreg);
2659     diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c
2660     index 53edd9a..d795294 100644
2661     --- a/sound/soc/codecs/wm8962.c
2662     +++ b/sound/soc/codecs/wm8962.c
2663     @@ -3172,13 +3172,13 @@ static int wm8962_hw_params(struct snd_pcm_substream *substream,
2664     case SNDRV_PCM_FORMAT_S16_LE:
2665     break;
2666     case SNDRV_PCM_FORMAT_S20_3LE:
2667     - aif0 |= 0x40;
2668     + aif0 |= 0x4;
2669     break;
2670     case SNDRV_PCM_FORMAT_S24_LE:
2671     - aif0 |= 0x80;
2672     + aif0 |= 0x8;
2673     break;
2674     case SNDRV_PCM_FORMAT_S32_LE:
2675     - aif0 |= 0xc0;
2676     + aif0 |= 0xc;
2677     break;
2678     default:
2679     return -EINVAL;
2680     diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c
2681     index d0c545b..6e502af 100644
2682     --- a/sound/soc/codecs/wm8994.c
2683     +++ b/sound/soc/codecs/wm8994.c
2684     @@ -729,6 +729,8 @@ static void vmid_reference(struct snd_soc_codec *codec)
2685     {
2686     struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
2687    
2688     + pm_runtime_get_sync(codec->dev);
2689     +
2690     wm8994->vmid_refcount++;
2691    
2692     dev_dbg(codec->dev, "Referencing VMID, refcount is now %d\n",
2693     @@ -742,7 +744,7 @@ static void vmid_reference(struct snd_soc_codec *codec)
2694     WM8994_VMID_RAMP_MASK,
2695     WM8994_STARTUP_BIAS_ENA |
2696     WM8994_VMID_BUF_ENA |
2697     - (0x11 << WM8994_VMID_RAMP_SHIFT));
2698     + (0x3 << WM8994_VMID_RAMP_SHIFT));
2699    
2700     /* Main bias enable, VMID=2x40k */
2701     snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_1,
2702     @@ -796,6 +798,8 @@ static void vmid_dereference(struct snd_soc_codec *codec)
2703     WM8994_VMID_BUF_ENA |
2704     WM8994_VMID_RAMP_MASK, 0);
2705     }
2706     +
2707     + pm_runtime_put(codec->dev);
2708     }
2709    
2710     static int vmid_event(struct snd_soc_dapm_widget *w,
2711     diff --git a/sound/soc/codecs/wm_hubs.c b/sound/soc/codecs/wm_hubs.c
2712     index 48e61e9..3642e06 100644
2713     --- a/sound/soc/codecs/wm_hubs.c
2714     +++ b/sound/soc/codecs/wm_hubs.c
2715     @@ -587,14 +587,14 @@ SOC_DAPM_SINGLE("Left Output Switch", WM8993_LINE_MIXER1, 0, 1, 0),
2716     };
2717    
2718     static const struct snd_kcontrol_new line2_mix[] = {
2719     -SOC_DAPM_SINGLE("IN2R Switch", WM8993_LINE_MIXER2, 2, 1, 0),
2720     -SOC_DAPM_SINGLE("IN2L Switch", WM8993_LINE_MIXER2, 1, 1, 0),
2721     +SOC_DAPM_SINGLE("IN1L Switch", WM8993_LINE_MIXER2, 2, 1, 0),
2722     +SOC_DAPM_SINGLE("IN1R Switch", WM8993_LINE_MIXER2, 1, 1, 0),
2723     SOC_DAPM_SINGLE("Output Switch", WM8993_LINE_MIXER2, 0, 1, 0),
2724     };
2725    
2726     static const struct snd_kcontrol_new line2n_mix[] = {
2727     -SOC_DAPM_SINGLE("Left Output Switch", WM8993_LINE_MIXER2, 6, 1, 0),
2728     -SOC_DAPM_SINGLE("Right Output Switch", WM8993_LINE_MIXER2, 5, 1, 0),
2729     +SOC_DAPM_SINGLE("Left Output Switch", WM8993_LINE_MIXER2, 5, 1, 0),
2730     +SOC_DAPM_SINGLE("Right Output Switch", WM8993_LINE_MIXER2, 6, 1, 0),
2731     };
2732    
2733     static const struct snd_kcontrol_new line2p_mix[] = {
2734     @@ -614,6 +614,8 @@ SND_SOC_DAPM_INPUT("IN2RP:VXRP"),
2735     SND_SOC_DAPM_MICBIAS("MICBIAS2", WM8993_POWER_MANAGEMENT_1, 5, 0),
2736     SND_SOC_DAPM_MICBIAS("MICBIAS1", WM8993_POWER_MANAGEMENT_1, 4, 0),
2737    
2738     +SND_SOC_DAPM_SUPPLY("LINEOUT_VMID_BUF", WM8993_ANTIPOP1, 7, 0, NULL, 0),
2739     +
2740     SND_SOC_DAPM_MIXER("IN1L PGA", WM8993_POWER_MANAGEMENT_2, 6, 0,
2741     in1l_pga, ARRAY_SIZE(in1l_pga)),
2742     SND_SOC_DAPM_MIXER("IN1R PGA", WM8993_POWER_MANAGEMENT_2, 4, 0,
2743     @@ -832,9 +834,11 @@ static const struct snd_soc_dapm_route lineout1_diff_routes[] = {
2744     };
2745    
2746     static const struct snd_soc_dapm_route lineout1_se_routes[] = {
2747     + { "LINEOUT1N Mixer", NULL, "LINEOUT_VMID_BUF" },
2748     { "LINEOUT1N Mixer", "Left Output Switch", "Left Output PGA" },
2749     { "LINEOUT1N Mixer", "Right Output Switch", "Right Output PGA" },
2750    
2751     + { "LINEOUT1P Mixer", NULL, "LINEOUT_VMID_BUF" },
2752     { "LINEOUT1P Mixer", "Left Output Switch", "Left Output PGA" },
2753    
2754     { "LINEOUT1N Driver", NULL, "LINEOUT1N Mixer" },
2755     @@ -842,8 +846,8 @@ static const struct snd_soc_dapm_route lineout1_se_routes[] = {
2756     };
2757    
2758     static const struct snd_soc_dapm_route lineout2_diff_routes[] = {
2759     - { "LINEOUT2 Mixer", "IN2L Switch", "IN2L PGA" },
2760     - { "LINEOUT2 Mixer", "IN2R Switch", "IN2R PGA" },
2761     + { "LINEOUT2 Mixer", "IN1L Switch", "IN1L PGA" },
2762     + { "LINEOUT2 Mixer", "IN1R Switch", "IN1R PGA" },
2763     { "LINEOUT2 Mixer", "Output Switch", "Right Output PGA" },
2764    
2765     { "LINEOUT2N Driver", NULL, "LINEOUT2 Mixer" },
2766     @@ -851,9 +855,11 @@ static const struct snd_soc_dapm_route lineout2_diff_routes[] = {
2767     };
2768    
2769     static const struct snd_soc_dapm_route lineout2_se_routes[] = {
2770     + { "LINEOUT2N Mixer", NULL, "LINEOUT_VMID_BUF" },
2771     { "LINEOUT2N Mixer", "Left Output Switch", "Left Output PGA" },
2772     { "LINEOUT2N Mixer", "Right Output Switch", "Right Output PGA" },
2773    
2774     + { "LINEOUT2P Mixer", NULL, "LINEOUT_VMID_BUF" },
2775     { "LINEOUT2P Mixer", "Right Output Switch", "Right Output PGA" },
2776    
2777     { "LINEOUT2N Driver", NULL, "LINEOUT2N Mixer" },