Magellan Linux

Annotation of /trunk/kernel-magellan/patches-3.7/0103-3.7.4-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2040 - (hide annotations) (download)
Mon Jan 28 08:11:29 2013 UTC (11 years, 3 months ago) by niro
File size: 39774 byte(s)
linux-3.7.4
1 niro 2040 diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
2     index 64b1339..7adf414 100644
3     --- a/arch/arm64/include/asm/pgtable.h
4     +++ b/arch/arm64/include/asm/pgtable.h
5     @@ -132,9 +132,8 @@ extern struct page *empty_zero_page;
6     #define pte_write(pte) (!(pte_val(pte) & PTE_RDONLY))
7     #define pte_exec(pte) (!(pte_val(pte) & PTE_UXN))
8    
9     -#define pte_present_exec_user(pte) \
10     - ((pte_val(pte) & (PTE_VALID | PTE_USER | PTE_UXN)) == \
11     - (PTE_VALID | PTE_USER))
12     +#define pte_present_user(pte) \
13     + ((pte_val(pte) & (PTE_VALID | PTE_USER)) == (PTE_VALID | PTE_USER))
14    
15     #define PTE_BIT_FUNC(fn,op) \
16     static inline pte_t pte_##fn(pte_t pte) { pte_val(pte) op; return pte; }
17     @@ -157,10 +156,13 @@ extern void __sync_icache_dcache(pte_t pteval, unsigned long addr);
18     static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,
19     pte_t *ptep, pte_t pte)
20     {
21     - if (pte_present_exec_user(pte))
22     - __sync_icache_dcache(pte, addr);
23     - if (!pte_dirty(pte))
24     - pte = pte_wrprotect(pte);
25     + if (pte_present_user(pte)) {
26     + if (pte_exec(pte))
27     + __sync_icache_dcache(pte, addr);
28     + if (!pte_dirty(pte))
29     + pte = pte_wrprotect(pte);
30     + }
31     +
32     set_pte(ptep, pte);
33     }
34    
35     diff --git a/arch/s390/include/asm/timex.h b/arch/s390/include/asm/timex.h
36     index fba4d66..4c060bb 100644
37     --- a/arch/s390/include/asm/timex.h
38     +++ b/arch/s390/include/asm/timex.h
39     @@ -128,4 +128,32 @@ static inline unsigned long long get_clock_monotonic(void)
40     return get_clock_xt() - sched_clock_base_cc;
41     }
42    
43     +/**
44     + * tod_to_ns - convert a TOD format value to nanoseconds
45     + * @todval: to be converted TOD format value
46     + * Returns: number of nanoseconds that correspond to the TOD format value
47     + *
48     + * Converting a 64 Bit TOD format value to nanoseconds means that the value
49     + * must be divided by 4.096. In order to achieve that we multiply with 125
50     + * and divide by 512:
51     + *
52     + * ns = (todval * 125) >> 9;
53     + *
54     + * In order to avoid an overflow with the multiplication we can rewrite this.
55     + * With a split todval == 2^32 * th + tl (th upper 32 bits, tl lower 32 bits)
56     + * we end up with
57     + *
58     + * ns = ((2^32 * th + tl) * 125 ) >> 9;
59     + * -> ns = (2^23 * th * 125) + ((tl * 125) >> 9);
60     + *
61     + */
62     +static inline unsigned long long tod_to_ns(unsigned long long todval)
63     +{
64     + unsigned long long ns;
65     +
66     + ns = ((todval >> 32) << 23) * 125;
67     + ns += ((todval & 0xffffffff) * 125) >> 9;
68     + return ns;
69     +}
70     +
71     #endif
72     diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c
73     index 7fcd690..b5d8a18 100644
74     --- a/arch/s390/kernel/time.c
75     +++ b/arch/s390/kernel/time.c
76     @@ -63,7 +63,7 @@ static DEFINE_PER_CPU(struct clock_event_device, comparators);
77     */
78     unsigned long long notrace __kprobes sched_clock(void)
79     {
80     - return (get_clock_monotonic() * 125) >> 9;
81     + return tod_to_ns(get_clock_monotonic());
82     }
83    
84     /*
85     diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c
86     index ff1e2f8..d533389 100644
87     --- a/arch/s390/kvm/interrupt.c
88     +++ b/arch/s390/kvm/interrupt.c
89     @@ -408,7 +408,7 @@ int kvm_s390_handle_wait(struct kvm_vcpu *vcpu)
90     return 0;
91     }
92    
93     - sltime = ((vcpu->arch.sie_block->ckc - now)*125)>>9;
94     + sltime = tod_to_ns(vcpu->arch.sie_block->ckc - now);
95    
96     hrtimer_start(&vcpu->arch.ckc_timer, ktime_set (0, sltime) , HRTIMER_MODE_REL);
97     VCPU_EVENT(vcpu, 5, "enabled wait via clock comparator: %llx ns", sltime);
98     diff --git a/arch/sh/include/asm/elf.h b/arch/sh/include/asm/elf.h
99     index 37924af..bf9f44f 100644
100     --- a/arch/sh/include/asm/elf.h
101     +++ b/arch/sh/include/asm/elf.h
102     @@ -203,9 +203,9 @@ extern void __kernel_vsyscall;
103     if (vdso_enabled) \
104     NEW_AUX_ENT(AT_SYSINFO_EHDR, VDSO_BASE); \
105     else \
106     - NEW_AUX_ENT(AT_IGNORE, 0);
107     + NEW_AUX_ENT(AT_IGNORE, 0)
108     #else
109     -#define VSYSCALL_AUX_ENT
110     +#define VSYSCALL_AUX_ENT NEW_AUX_ENT(AT_IGNORE, 0)
111     #endif /* CONFIG_VSYSCALL */
112    
113     #ifdef CONFIG_SH_FPU
114     diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S
115     index 88b725a..cf8639b 100644
116     --- a/arch/x86/kernel/entry_32.S
117     +++ b/arch/x86/kernel/entry_32.S
118     @@ -1084,7 +1084,6 @@ ENTRY(xen_failsafe_callback)
119     lea 16(%esp),%esp
120     CFI_ADJUST_CFA_OFFSET -16
121     jz 5f
122     - addl $16,%esp
123     jmp iret_exc
124     5: pushl_cfi $-1 /* orig_ax = -1 => not a system call */
125     SAVE_ALL
126     diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
127     index ca45696..86c524c 100644
128     --- a/arch/x86/kernel/setup.c
129     +++ b/arch/x86/kernel/setup.c
130     @@ -614,6 +614,81 @@ static __init void reserve_ibft_region(void)
131    
132     static unsigned reserve_low = CONFIG_X86_RESERVE_LOW << 10;
133    
134     +static bool __init snb_gfx_workaround_needed(void)
135     +{
136     + int i;
137     + u16 vendor, devid;
138     + static const u16 snb_ids[] = {
139     + 0x0102,
140     + 0x0112,
141     + 0x0122,
142     + 0x0106,
143     + 0x0116,
144     + 0x0126,
145     + 0x010a,
146     + };
147     +
148     + /* Assume no if something weird is going on with PCI */
149     + if (!early_pci_allowed())
150     + return false;
151     +
152     + vendor = read_pci_config_16(0, 2, 0, PCI_VENDOR_ID);
153     + if (vendor != 0x8086)
154     + return false;
155     +
156     + devid = read_pci_config_16(0, 2, 0, PCI_DEVICE_ID);
157     + for (i = 0; i < ARRAY_SIZE(snb_ids); i++)
158     + if (devid == snb_ids[i])
159     + return true;
160     +
161     + return false;
162     +}
163     +
164     +/*
165     + * Sandy Bridge graphics has trouble with certain ranges, exclude
166     + * them from allocation.
167     + */
168     +static void __init trim_snb_memory(void)
169     +{
170     + static const unsigned long bad_pages[] = {
171     + 0x20050000,
172     + 0x20110000,
173     + 0x20130000,
174     + 0x20138000,
175     + 0x40004000,
176     + };
177     + int i;
178     +
179     + if (!snb_gfx_workaround_needed())
180     + return;
181     +
182     + printk(KERN_DEBUG "reserving inaccessible SNB gfx pages\n");
183     +
184     + /*
185     + * Reserve all memory below the 1 MB mark that has not
186     + * already been reserved.
187     + */
188     + memblock_reserve(0, 1<<20);
189     +
190     + for (i = 0; i < ARRAY_SIZE(bad_pages); i++) {
191     + if (memblock_reserve(bad_pages[i], PAGE_SIZE))
192     + printk(KERN_WARNING "failed to reserve 0x%08lx\n",
193     + bad_pages[i]);
194     + }
195     +}
196     +
197     +/*
198     + * Here we put platform-specific memory range workarounds, i.e.
199     + * memory known to be corrupt or otherwise in need to be reserved on
200     + * specific platforms.
201     + *
202     + * If this gets used more widely it could use a real dispatch mechanism.
203     + */
204     +static void __init trim_platform_memory_ranges(void)
205     +{
206     + trim_snb_memory();
207     +}
208     +
209     static void __init trim_bios_range(void)
210     {
211     /*
212     @@ -634,6 +709,7 @@ static void __init trim_bios_range(void)
213     * take them out.
214     */
215     e820_remove_range(BIOS_BEGIN, BIOS_END - BIOS_BEGIN, E820_RAM, 1);
216     +
217     sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map);
218     }
219    
220     @@ -912,6 +988,8 @@ void __init setup_arch(char **cmdline_p)
221    
222     setup_real_mode();
223    
224     + trim_platform_memory_ranges();
225     +
226     init_gbpages();
227    
228     /* max_pfn_mapped is updated here */
229     diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
230     index be5f7aa..3724891 100644
231     --- a/drivers/base/firmware_class.c
232     +++ b/drivers/base/firmware_class.c
233     @@ -295,7 +295,7 @@ static bool fw_read_file_contents(struct file *file, struct firmware_buf *fw_buf
234     char *buf;
235    
236     size = fw_file_size(file);
237     - if (size < 0)
238     + if (size <= 0)
239     return false;
240     buf = vmalloc(size);
241     if (!buf)
242     diff --git a/drivers/gpu/drm/radeon/r600_cs.c b/drivers/gpu/drm/radeon/r600_cs.c
243     index 211c402..1a8594b 100644
244     --- a/drivers/gpu/drm/radeon/r600_cs.c
245     +++ b/drivers/gpu/drm/radeon/r600_cs.c
246     @@ -2429,8 +2429,10 @@ static void r600_cs_parser_fini(struct radeon_cs_parser *parser, int error)
247     kfree(parser->relocs);
248     for (i = 0; i < parser->nchunks; i++) {
249     kfree(parser->chunks[i].kdata);
250     - kfree(parser->chunks[i].kpage[0]);
251     - kfree(parser->chunks[i].kpage[1]);
252     + if (parser->rdev && (parser->rdev->flags & RADEON_IS_AGP)) {
253     + kfree(parser->chunks[i].kpage[0]);
254     + kfree(parser->chunks[i].kpage[1]);
255     + }
256     }
257     kfree(parser->chunks);
258     kfree(parser->chunks_array);
259     diff --git a/drivers/gpu/drm/radeon/radeon_cs.c b/drivers/gpu/drm/radeon/radeon_cs.c
260     index 41672cc..dc8d15a 100644
261     --- a/drivers/gpu/drm/radeon/radeon_cs.c
262     +++ b/drivers/gpu/drm/radeon/radeon_cs.c
263     @@ -266,7 +266,7 @@ int radeon_cs_parser_init(struct radeon_cs_parser *p, void *data)
264     p->chunks[p->chunk_ib_idx].length_dw);
265     return -EINVAL;
266     }
267     - if ((p->rdev->flags & RADEON_IS_AGP)) {
268     + if (p->rdev && (p->rdev->flags & RADEON_IS_AGP)) {
269     p->chunks[p->chunk_ib_idx].kpage[0] = kmalloc(PAGE_SIZE, GFP_KERNEL);
270     p->chunks[p->chunk_ib_idx].kpage[1] = kmalloc(PAGE_SIZE, GFP_KERNEL);
271     if (p->chunks[p->chunk_ib_idx].kpage[0] == NULL ||
272     @@ -570,7 +570,8 @@ static int radeon_cs_update_pages(struct radeon_cs_parser *p, int pg_idx)
273     struct radeon_cs_chunk *ibc = &p->chunks[p->chunk_ib_idx];
274     int i;
275     int size = PAGE_SIZE;
276     - bool copy1 = (p->rdev->flags & RADEON_IS_AGP) ? false : true;
277     + bool copy1 = (p->rdev && (p->rdev->flags & RADEON_IS_AGP)) ?
278     + false : true;
279    
280     for (i = ibc->last_copied_page + 1; i < pg_idx; i++) {
281     if (DRM_COPY_FROM_USER(p->ib.ptr + (i * (PAGE_SIZE/4)),
282     diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
283     index 9476c1b..c2c07a4 100644
284     --- a/drivers/iommu/intel-iommu.c
285     +++ b/drivers/iommu/intel-iommu.c
286     @@ -2327,8 +2327,39 @@ static int domain_add_dev_info(struct dmar_domain *domain,
287     return 0;
288     }
289    
290     +static bool device_has_rmrr(struct pci_dev *dev)
291     +{
292     + struct dmar_rmrr_unit *rmrr;
293     + int i;
294     +
295     + for_each_rmrr_units(rmrr) {
296     + for (i = 0; i < rmrr->devices_cnt; i++) {
297     + /*
298     + * Return TRUE if this RMRR contains the device that
299     + * is passed in.
300     + */
301     + if (rmrr->devices[i] == dev)
302     + return true;
303     + }
304     + }
305     + return false;
306     +}
307     +
308     static int iommu_should_identity_map(struct pci_dev *pdev, int startup)
309     {
310     +
311     + /*
312     + * We want to prevent any device associated with an RMRR from
313     + * getting placed into the SI Domain. This is done because
314     + * problems exist when devices are moved in and out of domains
315     + * and their respective RMRR info is lost. We exempt USB devices
316     + * from this process due to their usage of RMRRs that are known
317     + * to not be needed after BIOS hand-off to OS.
318     + */
319     + if (device_has_rmrr(pdev) &&
320     + (pdev->class >> 8) != PCI_CLASS_SERIAL_USB)
321     + return 0;
322     +
323     if ((iommu_identity_mapping & IDENTMAP_AZALIA) && IS_AZALIA(pdev))
324     return 1;
325    
326     diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
327     index e1ceb37..9b178a3 100644
328     --- a/drivers/net/ethernet/intel/igb/igb_main.c
329     +++ b/drivers/net/ethernet/intel/igb/igb_main.c
330     @@ -909,17 +909,18 @@ static int igb_request_msix(struct igb_adapter *adapter)
331     {
332     struct net_device *netdev = adapter->netdev;
333     struct e1000_hw *hw = &adapter->hw;
334     - int i, err = 0, vector = 0;
335     + int i, err = 0, vector = 0, free_vector = 0;
336    
337     err = request_irq(adapter->msix_entries[vector].vector,
338     igb_msix_other, 0, netdev->name, adapter);
339     if (err)
340     - goto out;
341     - vector++;
342     + goto err_out;
343    
344     for (i = 0; i < adapter->num_q_vectors; i++) {
345     struct igb_q_vector *q_vector = adapter->q_vector[i];
346    
347     + vector++;
348     +
349     q_vector->itr_register = hw->hw_addr + E1000_EITR(vector);
350    
351     if (q_vector->rx.ring && q_vector->tx.ring)
352     @@ -938,13 +939,22 @@ static int igb_request_msix(struct igb_adapter *adapter)
353     igb_msix_ring, 0, q_vector->name,
354     q_vector);
355     if (err)
356     - goto out;
357     - vector++;
358     + goto err_free;
359     }
360    
361     igb_configure_msix(adapter);
362     return 0;
363     -out:
364     +
365     +err_free:
366     + /* free already assigned IRQs */
367     + free_irq(adapter->msix_entries[free_vector++].vector, adapter);
368     +
369     + vector--;
370     + for (i = 0; i < vector; i++) {
371     + free_irq(adapter->msix_entries[free_vector++].vector,
372     + adapter->q_vector[i]);
373     + }
374     +err_out:
375     return err;
376     }
377    
378     diff --git a/drivers/staging/vt6656/bssdb.h b/drivers/staging/vt6656/bssdb.h
379     index 6b2ec39..806cbf7 100644
380     --- a/drivers/staging/vt6656/bssdb.h
381     +++ b/drivers/staging/vt6656/bssdb.h
382     @@ -90,7 +90,6 @@ typedef struct tagSRSNCapObject {
383     } SRSNCapObject, *PSRSNCapObject;
384    
385     // BSS info(AP)
386     -#pragma pack(1)
387     typedef struct tagKnownBSS {
388     // BSS info
389     BOOL bActive;
390     diff --git a/drivers/staging/vt6656/int.h b/drivers/staging/vt6656/int.h
391     index 3734e2c..91ceb77 100644
392     --- a/drivers/staging/vt6656/int.h
393     +++ b/drivers/staging/vt6656/int.h
394     @@ -34,7 +34,6 @@
395     #include "device.h"
396    
397     /*--------------------- Export Definitions -------------------------*/
398     -#pragma pack(1)
399     typedef struct tagSINTData {
400     BYTE byTSR0;
401     BYTE byPkt0;
402     diff --git a/drivers/staging/vt6656/iocmd.h b/drivers/staging/vt6656/iocmd.h
403     index 22710ce..ae6e2d2 100644
404     --- a/drivers/staging/vt6656/iocmd.h
405     +++ b/drivers/staging/vt6656/iocmd.h
406     @@ -95,13 +95,12 @@ typedef enum tagWZONETYPE {
407     // Ioctl interface structure
408     // Command structure
409     //
410     -#pragma pack(1)
411     typedef struct tagSCmdRequest {
412     u8 name[16];
413     void *data;
414     u16 wResult;
415     u16 wCmdCode;
416     -} SCmdRequest, *PSCmdRequest;
417     +} __packed SCmdRequest, *PSCmdRequest;
418    
419     //
420     // Scan
421     @@ -111,7 +110,7 @@ typedef struct tagSCmdScan {
422    
423     u8 ssid[SSID_MAXLEN + 2];
424    
425     -} SCmdScan, *PSCmdScan;
426     +} __packed SCmdScan, *PSCmdScan;
427    
428     //
429     // BSS Join
430     @@ -126,7 +125,7 @@ typedef struct tagSCmdBSSJoin {
431     BOOL bPSEnable;
432     BOOL bShareKeyAuth;
433    
434     -} SCmdBSSJoin, *PSCmdBSSJoin;
435     +} __packed SCmdBSSJoin, *PSCmdBSSJoin;
436    
437     //
438     // Zonetype Setting
439     @@ -137,7 +136,7 @@ typedef struct tagSCmdZoneTypeSet {
440     BOOL bWrite;
441     WZONETYPE ZoneType;
442    
443     -} SCmdZoneTypeSet, *PSCmdZoneTypeSet;
444     +} __packed SCmdZoneTypeSet, *PSCmdZoneTypeSet;
445    
446     typedef struct tagSWPAResult {
447     char ifname[100];
448     @@ -145,7 +144,7 @@ typedef struct tagSWPAResult {
449     u8 key_mgmt;
450     u8 eap_type;
451     BOOL authenticated;
452     -} SWPAResult, *PSWPAResult;
453     +} __packed SWPAResult, *PSWPAResult;
454    
455     typedef struct tagSCmdStartAP {
456    
457     @@ -157,7 +156,7 @@ typedef struct tagSCmdStartAP {
458     BOOL bShareKeyAuth;
459     u8 byBasicRate;
460    
461     -} SCmdStartAP, *PSCmdStartAP;
462     +} __packed SCmdStartAP, *PSCmdStartAP;
463    
464     typedef struct tagSCmdSetWEP {
465    
466     @@ -167,7 +166,7 @@ typedef struct tagSCmdSetWEP {
467     BOOL bWepKeyAvailable[WEP_NKEYS];
468     u32 auWepKeyLength[WEP_NKEYS];
469    
470     -} SCmdSetWEP, *PSCmdSetWEP;
471     +} __packed SCmdSetWEP, *PSCmdSetWEP;
472    
473     typedef struct tagSBSSIDItem {
474    
475     @@ -180,14 +179,14 @@ typedef struct tagSBSSIDItem {
476     BOOL bWEPOn;
477     u32 uRSSI;
478    
479     -} SBSSIDItem;
480     +} __packed SBSSIDItem;
481    
482    
483     typedef struct tagSBSSIDList {
484    
485     u32 uItem;
486     SBSSIDItem sBSSIDList[0];
487     -} SBSSIDList, *PSBSSIDList;
488     +} __packed SBSSIDList, *PSBSSIDList;
489    
490    
491     typedef struct tagSNodeItem {
492     @@ -208,7 +207,7 @@ typedef struct tagSNodeItem {
493     u32 uTxAttempts;
494     u16 wFailureRatio;
495    
496     -} SNodeItem;
497     +} __packed SNodeItem;
498    
499    
500     typedef struct tagSNodeList {
501     @@ -216,7 +215,7 @@ typedef struct tagSNodeList {
502     u32 uItem;
503     SNodeItem sNodeList[0];
504    
505     -} SNodeList, *PSNodeList;
506     +} __packed SNodeList, *PSNodeList;
507    
508    
509     typedef struct tagSCmdLinkStatus {
510     @@ -229,7 +228,7 @@ typedef struct tagSCmdLinkStatus {
511     u32 uChannel;
512     u32 uLinkRate;
513    
514     -} SCmdLinkStatus, *PSCmdLinkStatus;
515     +} __packed SCmdLinkStatus, *PSCmdLinkStatus;
516    
517     //
518     // 802.11 counter
519     @@ -247,7 +246,7 @@ typedef struct tagSDot11MIBCount {
520     u32 ReceivedFragmentCount;
521     u32 MulticastReceivedFrameCount;
522     u32 FCSErrorCount;
523     -} SDot11MIBCount, *PSDot11MIBCount;
524     +} __packed SDot11MIBCount, *PSDot11MIBCount;
525    
526    
527    
528     @@ -355,13 +354,13 @@ typedef struct tagSStatMIBCount {
529     u32 ullTxBroadcastBytes[2];
530     u32 ullTxMulticastBytes[2];
531     u32 ullTxDirectedBytes[2];
532     -} SStatMIBCount, *PSStatMIBCount;
533     +} __packed SStatMIBCount, *PSStatMIBCount;
534    
535     typedef struct tagSCmdValue {
536    
537     u32 dwValue;
538    
539     -} SCmdValue, *PSCmdValue;
540     +} __packed SCmdValue, *PSCmdValue;
541    
542     //
543     // hostapd & viawget ioctl related
544     @@ -431,7 +430,7 @@ struct viawget_hostapd_param {
545     u8 ssid[32];
546     } scan_req;
547     } u;
548     -};
549     +} __packed;
550    
551     /*--------------------- Export Classes ----------------------------*/
552    
553     diff --git a/drivers/staging/vt6656/iowpa.h b/drivers/staging/vt6656/iowpa.h
554     index 959c886..2522dde 100644
555     --- a/drivers/staging/vt6656/iowpa.h
556     +++ b/drivers/staging/vt6656/iowpa.h
557     @@ -67,12 +67,11 @@ enum {
558    
559    
560    
561     -#pragma pack(1)
562     typedef struct viawget_wpa_header {
563     u8 type;
564     u16 req_ie_len;
565     u16 resp_ie_len;
566     -} viawget_wpa_header;
567     +} __packed viawget_wpa_header;
568    
569     struct viawget_wpa_param {
570     u32 cmd;
571     @@ -113,9 +112,8 @@ struct viawget_wpa_param {
572     u8 *buf;
573     } scan_results;
574     } u;
575     -};
576     +} __packed;
577    
578     -#pragma pack(1)
579     struct viawget_scan_result {
580     u8 bssid[6];
581     u8 ssid[32];
582     @@ -130,7 +128,7 @@ struct viawget_scan_result {
583     int noise;
584     int level;
585     int maxrate;
586     -};
587     +} __packed;
588    
589     /*--------------------- Export Classes ----------------------------*/
590    
591     diff --git a/drivers/staging/wlan-ng/prism2mgmt.c b/drivers/staging/wlan-ng/prism2mgmt.c
592     index 4efa9bc..89bfd85 100644
593     --- a/drivers/staging/wlan-ng/prism2mgmt.c
594     +++ b/drivers/staging/wlan-ng/prism2mgmt.c
595     @@ -406,7 +406,7 @@ int prism2mgmt_scan_results(wlandevice_t *wlandev, void *msgp)
596     /* SSID */
597     req->ssid.status = P80211ENUM_msgitem_status_data_ok;
598     req->ssid.data.len = le16_to_cpu(item->ssid.len);
599     - req->ssid.data.len = min_t(u16, req->ssid.data.len, WLAN_BSSID_LEN);
600     + req->ssid.data.len = min_t(u16, req->ssid.data.len, WLAN_SSID_MAXLEN);
601     memcpy(req->ssid.data.data, item->ssid.data, req->ssid.data.len);
602    
603     /* supported rates */
604     diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c
605     index 9abef9f..0943ff0 100644
606     --- a/drivers/target/target_core_device.c
607     +++ b/drivers/target/target_core_device.c
608     @@ -1624,6 +1624,7 @@ int core_dev_setup_virtual_lun0(void)
609     ret = PTR_ERR(dev);
610     goto out;
611     }
612     + dev->dev_link_magic = SE_DEV_LINK_MAGIC;
613     se_dev->se_dev_ptr = dev;
614     g_lun0_dev = dev;
615    
616     diff --git a/drivers/target/target_core_fabric_configfs.c b/drivers/target/target_core_fabric_configfs.c
617     index bca737b..a55f91a 100644
618     --- a/drivers/target/target_core_fabric_configfs.c
619     +++ b/drivers/target/target_core_fabric_configfs.c
620     @@ -71,6 +71,12 @@ static int target_fabric_mappedlun_link(
621     struct se_portal_group *se_tpg;
622     struct config_item *nacl_ci, *tpg_ci, *tpg_ci_s, *wwn_ci, *wwn_ci_s;
623     int ret = 0, lun_access;
624     +
625     + if (lun->lun_link_magic != SE_LUN_LINK_MAGIC) {
626     + pr_err("Bad lun->lun_link_magic, not a valid lun_ci pointer:"
627     + " %p to struct lun: %p\n", lun_ci, lun);
628     + return -EFAULT;
629     + }
630     /*
631     * Ensure that the source port exists
632     */
633     @@ -745,6 +751,12 @@ static int target_fabric_port_link(
634     struct target_fabric_configfs *tf;
635     int ret;
636    
637     + if (dev->dev_link_magic != SE_DEV_LINK_MAGIC) {
638     + pr_err("Bad dev->dev_link_magic, not a valid se_dev_ci pointer:"
639     + " %p to struct se_device: %p\n", se_dev_ci, dev);
640     + return -EFAULT;
641     + }
642     +
643     tpg_ci = &lun_ci->ci_parent->ci_group->cg_item;
644     se_tpg = container_of(to_config_group(tpg_ci),
645     struct se_portal_group, tpg_group);
646     diff --git a/drivers/target/target_core_tpg.c b/drivers/target/target_core_tpg.c
647     index a531fe2..4c34665 100644
648     --- a/drivers/target/target_core_tpg.c
649     +++ b/drivers/target/target_core_tpg.c
650     @@ -672,6 +672,7 @@ int core_tpg_register(
651     for (i = 0; i < TRANSPORT_MAX_LUNS_PER_TPG; i++) {
652     lun = se_tpg->tpg_lun_list[i];
653     lun->unpacked_lun = i;
654     + lun->lun_link_magic = SE_LUN_LINK_MAGIC;
655     lun->lun_status = TRANSPORT_LUN_STATUS_FREE;
656     atomic_set(&lun->lun_acl_count, 0);
657     init_completion(&lun->lun_shutdown_comp);
658     diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
659     index dcecbfb..13fe16c 100644
660     --- a/drivers/target/target_core_transport.c
661     +++ b/drivers/target/target_core_transport.c
662     @@ -545,9 +545,6 @@ static void transport_lun_remove_cmd(struct se_cmd *cmd)
663    
664     void transport_cmd_finish_abort(struct se_cmd *cmd, int remove)
665     {
666     - if (!(cmd->se_cmd_flags & SCF_SCSI_TMR_CDB))
667     - transport_lun_remove_cmd(cmd);
668     -
669     if (transport_cmd_check_stop_to_fabric(cmd))
670     return;
671     if (remove)
672     @@ -1074,6 +1071,7 @@ struct se_device *transport_add_device_to_core_hba(
673     dev->se_hba = hba;
674     dev->se_sub_dev = se_dev;
675     dev->transport = transport;
676     + dev->dev_link_magic = SE_DEV_LINK_MAGIC;
677     INIT_LIST_HEAD(&dev->dev_list);
678     INIT_LIST_HEAD(&dev->dev_sep_list);
679     INIT_LIST_HEAD(&dev->dev_tmr_list);
680     @@ -1616,6 +1614,8 @@ static void target_complete_tmr_failure(struct work_struct *work)
681    
682     se_cmd->se_tmr_req->response = TMR_LUN_DOES_NOT_EXIST;
683     se_cmd->se_tfo->queue_tm_rsp(se_cmd);
684     +
685     + transport_cmd_check_stop_to_fabric(se_cmd);
686     }
687    
688     /**
689     @@ -1853,6 +1853,7 @@ void target_execute_cmd(struct se_cmd *cmd)
690     }
691    
692     cmd->t_state = TRANSPORT_PROCESSING;
693     + cmd->transport_state |= CMD_T_ACTIVE;
694     spin_unlock_irq(&cmd->t_state_lock);
695    
696     if (dev->dev_task_attr_type != SAM_TASK_ATTR_EMULATED)
697     @@ -3024,7 +3025,7 @@ int transport_send_check_condition_and_sense(
698     /* ILLEGAL REQUEST */
699     buffer[SPC_SENSE_KEY_OFFSET] = ILLEGAL_REQUEST;
700     /* LOGICAL UNIT COMMUNICATION FAILURE */
701     - buffer[SPC_ASC_KEY_OFFSET] = 0x80;
702     + buffer[SPC_ASC_KEY_OFFSET] = 0x08;
703     break;
704     }
705     /*
706     @@ -3089,6 +3090,8 @@ void transport_send_task_abort(struct se_cmd *cmd)
707     }
708     cmd->scsi_status = SAM_STAT_TASK_ABORTED;
709    
710     + transport_lun_remove_cmd(cmd);
711     +
712     pr_debug("Setting SAM_STAT_TASK_ABORTED status for CDB: 0x%02x,"
713     " ITT: 0x%08x\n", cmd->t_task_cdb[0],
714     cmd->se_tfo->get_task_tag(cmd));
715     diff --git a/drivers/target/tcm_fc/tfc_sess.c b/drivers/target/tcm_fc/tfc_sess.c
716     index 12d6fa2..6659dd3 100644
717     --- a/drivers/target/tcm_fc/tfc_sess.c
718     +++ b/drivers/target/tcm_fc/tfc_sess.c
719     @@ -355,11 +355,11 @@ static int ft_prli_locked(struct fc_rport_priv *rdata, u32 spp_len,
720    
721     tport = ft_tport_create(rdata->local_port);
722     if (!tport)
723     - return 0; /* not a target for this local port */
724     + goto not_target; /* not a target for this local port */
725    
726     acl = ft_acl_get(tport->tpg, rdata);
727     if (!acl)
728     - return 0;
729     + goto not_target; /* no target for this remote */
730    
731     if (!rspp)
732     goto fill;
733     @@ -396,12 +396,18 @@ static int ft_prli_locked(struct fc_rport_priv *rdata, u32 spp_len,
734    
735     /*
736     * OR in our service parameters with other provider (initiator), if any.
737     - * TBD XXX - indicate RETRY capability?
738     */
739     fill:
740     fcp_parm = ntohl(spp->spp_params);
741     + fcp_parm &= ~FCP_SPPF_RETRY;
742     spp->spp_params = htonl(fcp_parm | FCP_SPPF_TARG_FCN);
743     return FC_SPP_RESP_ACK;
744     +
745     +not_target:
746     + fcp_parm = ntohl(spp->spp_params);
747     + fcp_parm &= ~FCP_SPPF_TARG_FCN;
748     + spp->spp_params = htonl(fcp_parm);
749     + return 0;
750     }
751    
752     /**
753     diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c
754     index a82b399..8cf8d0a 100644
755     --- a/drivers/tty/pty.c
756     +++ b/drivers/tty/pty.c
757     @@ -395,6 +395,8 @@ static int pty_bsd_ioctl(struct tty_struct *tty,
758     return pty_set_lock(tty, (int __user *) arg);
759     case TIOCSIG: /* Send signal to other side of pty */
760     return pty_signal(tty, (int) arg);
761     + case TIOCGPTN: /* TTY returns ENOTTY, but glibc expects EINVAL here */
762     + return -EINVAL;
763     }
764     return -ENOIOCTLCMD;
765     }
766     diff --git a/drivers/tty/serial/8250/8250.c b/drivers/tty/serial/8250/8250.c
767     index 3ba4234..2c09e64 100644
768     --- a/drivers/tty/serial/8250/8250.c
769     +++ b/drivers/tty/serial/8250/8250.c
770     @@ -290,6 +290,12 @@ static const struct serial8250_config uart_config[] = {
771     UART_FCR_R_TRIG_00 | UART_FCR_T_TRIG_00,
772     .flags = UART_CAP_FIFO,
773     },
774     + [PORT_BRCM_TRUMANAGE] = {
775     + .name = "TruManage",
776     + .fifo_size = 1,
777     + .tx_loadsz = 1024,
778     + .flags = UART_CAP_HFIFO,
779     + },
780     [PORT_8250_CIR] = {
781     .name = "CIR port"
782     }
783     @@ -1441,6 +1447,11 @@ void serial8250_tx_chars(struct uart_8250_port *up)
784     port->icount.tx++;
785     if (uart_circ_empty(xmit))
786     break;
787     + if (up->capabilities & UART_CAP_HFIFO) {
788     + if ((serial_port_in(port, UART_LSR) & BOTH_EMPTY) !=
789     + BOTH_EMPTY)
790     + break;
791     + }
792     } while (--count > 0);
793    
794     if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
795     diff --git a/drivers/tty/serial/8250/8250.h b/drivers/tty/serial/8250/8250.h
796     index 5a76f9c..c0be2fa 100644
797     --- a/drivers/tty/serial/8250/8250.h
798     +++ b/drivers/tty/serial/8250/8250.h
799     @@ -40,6 +40,7 @@ struct serial8250_config {
800     #define UART_CAP_AFE (1 << 11) /* MCR-based hw flow control */
801     #define UART_CAP_UUE (1 << 12) /* UART needs IER bit 6 set (Xscale) */
802     #define UART_CAP_RTOIE (1 << 13) /* UART needs IER bit 4 set (Xscale, Tegra) */
803     +#define UART_CAP_HFIFO (1 << 14) /* UART has a "hidden" FIFO */
804    
805     #define UART_BUG_QUOT (1 << 0) /* UART has buggy quot LSB */
806     #define UART_BUG_TXEN (1 << 1) /* UART has buggy TX IIR status */
807     diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c
808     index c3b2ec0..71ce540 100644
809     --- a/drivers/tty/serial/8250/8250_dw.c
810     +++ b/drivers/tty/serial/8250/8250_dw.c
811     @@ -79,7 +79,7 @@ static int dw8250_handle_irq(struct uart_port *p)
812     } else if ((iir & UART_IIR_BUSY) == UART_IIR_BUSY) {
813     /* Clear the USR and write the LCR again. */
814     (void)p->serial_in(p, UART_USR);
815     - p->serial_out(p, d->last_lcr, UART_LCR);
816     + p->serial_out(p, UART_LCR, d->last_lcr);
817    
818     return 1;
819     }
820     diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c
821     index 17b7d26..a29df69 100644
822     --- a/drivers/tty/serial/8250/8250_pci.c
823     +++ b/drivers/tty/serial/8250/8250_pci.c
824     @@ -1085,6 +1085,18 @@ pci_omegapci_setup(struct serial_private *priv,
825     return setup_port(priv, port, 2, idx * 8, 0);
826     }
827    
828     +static int
829     +pci_brcm_trumanage_setup(struct serial_private *priv,
830     + const struct pciserial_board *board,
831     + struct uart_8250_port *port, int idx)
832     +{
833     + int ret = pci_default_setup(priv, board, port, idx);
834     +
835     + port->port.type = PORT_BRCM_TRUMANAGE;
836     + port->port.flags = (port->port.flags | UPF_FIXED_PORT | UPF_FIXED_TYPE);
837     + return ret;
838     +}
839     +
840     static int skip_tx_en_setup(struct serial_private *priv,
841     const struct pciserial_board *board,
842     struct uart_8250_port *port, int idx)
843     @@ -1213,6 +1225,7 @@ pci_wch_ch353_setup(struct serial_private *priv,
844     #define PCI_VENDOR_ID_AGESTAR 0x5372
845     #define PCI_DEVICE_ID_AGESTAR_9375 0x6872
846     #define PCI_VENDOR_ID_ASIX 0x9710
847     +#define PCI_DEVICE_ID_BROADCOM_TRUMANAGE 0x160a
848    
849     /* Unknown vendors/cards - this should not be in linux/pci_ids.h */
850     #define PCI_SUBDEVICE_ID_UNKNOWN_0x1584 0x1584
851     @@ -1788,6 +1801,17 @@ static struct pci_serial_quirk pci_serial_quirks[] __refdata = {
852     .setup = pci_asix_setup,
853     },
854     /*
855     + * Broadcom TruManage (NetXtreme)
856     + */
857     + {
858     + .vendor = PCI_VENDOR_ID_BROADCOM,
859     + .device = PCI_DEVICE_ID_BROADCOM_TRUMANAGE,
860     + .subvendor = PCI_ANY_ID,
861     + .subdevice = PCI_ANY_ID,
862     + .setup = pci_brcm_trumanage_setup,
863     + },
864     +
865     + /*
866     * Default "match everything" terminator entry
867     */
868     {
869     @@ -1975,6 +1999,7 @@ enum pci_board_num_t {
870     pbn_ce4100_1_115200,
871     pbn_omegapci,
872     pbn_NETMOS9900_2s_115200,
873     + pbn_brcm_trumanage,
874     };
875    
876     /*
877     @@ -2674,6 +2699,12 @@ static struct pciserial_board pci_boards[] __devinitdata = {
878     .num_ports = 2,
879     .base_baud = 115200,
880     },
881     + [pbn_brcm_trumanage] = {
882     + .flags = FL_BASE0,
883     + .num_ports = 1,
884     + .reg_shift = 2,
885     + .base_baud = 115200,
886     + },
887     };
888    
889     static const struct pci_device_id blacklist[] = {
890     @@ -4238,6 +4269,13 @@ static struct pci_device_id serial_pci_tbl[] = {
891     pbn_omegapci },
892    
893     /*
894     + * Broadcom TruManage
895     + */
896     + { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_BROADCOM_TRUMANAGE,
897     + PCI_ANY_ID, PCI_ANY_ID, 0, 0,
898     + pbn_brcm_trumanage },
899     +
900     + /*
901     * AgeStar as-prs2-009
902     */
903     { PCI_VENDOR_ID_AGESTAR, PCI_DEVICE_ID_AGESTAR_9375,
904     diff --git a/drivers/tty/serial/ifx6x60.c b/drivers/tty/serial/ifx6x60.c
905     index 5b9bc19..f5e9666 100644
906     --- a/drivers/tty/serial/ifx6x60.c
907     +++ b/drivers/tty/serial/ifx6x60.c
908     @@ -552,6 +552,7 @@ static void ifx_port_shutdown(struct tty_port *port)
909     container_of(port, struct ifx_spi_device, tty_port);
910    
911     mrdy_set_low(ifx_dev);
912     + del_timer(&ifx_dev->spi_timer);
913     clear_bit(IFX_SPI_STATE_TIMER_PENDING, &ifx_dev->flags);
914     tasklet_kill(&ifx_dev->io_work_tasklet);
915     }
916     diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c
917     index 6db3baa..ea513c9 100644
918     --- a/drivers/tty/serial/mxs-auart.c
919     +++ b/drivers/tty/serial/mxs-auart.c
920     @@ -260,10 +260,12 @@ static void mxs_auart_set_mctrl(struct uart_port *u, unsigned mctrl)
921    
922     u32 ctrl = readl(u->membase + AUART_CTRL2);
923    
924     - ctrl &= ~AUART_CTRL2_RTSEN;
925     + ctrl &= ~(AUART_CTRL2_RTSEN | AUART_CTRL2_RTS);
926     if (mctrl & TIOCM_RTS) {
927     if (tty_port_cts_enabled(&u->state->port))
928     ctrl |= AUART_CTRL2_RTSEN;
929     + else
930     + ctrl |= AUART_CTRL2_RTS;
931     }
932    
933     s->ctrl = mctrl;
934     diff --git a/drivers/tty/serial/vt8500_serial.c b/drivers/tty/serial/vt8500_serial.c
935     index 205d4cf..f528cc2 100644
936     --- a/drivers/tty/serial/vt8500_serial.c
937     +++ b/drivers/tty/serial/vt8500_serial.c
938     @@ -604,7 +604,7 @@ static int __devinit vt8500_serial_probe(struct platform_device *pdev)
939     vt8500_port->uart.flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF;
940    
941     vt8500_port->clk = of_clk_get(pdev->dev.of_node, 0);
942     - if (vt8500_port->clk) {
943     + if (!IS_ERR(vt8500_port->clk)) {
944     vt8500_port->uart.uartclk = clk_get_rate(vt8500_port->clk);
945     } else {
946     /* use the default of 24Mhz if not specified and warn */
947     diff --git a/drivers/usb/chipidea/host.c b/drivers/usb/chipidea/host.c
948     index ebff9f4..7c212f5 100644
949     --- a/drivers/usb/chipidea/host.c
950     +++ b/drivers/usb/chipidea/host.c
951     @@ -129,6 +129,9 @@ static int host_start(struct ci13xxx *ci)
952     else
953     ci->hcd = hcd;
954    
955     + if (ci->platdata->flags & CI13XXX_DISABLE_STREAMING)
956     + hw_write(ci, OP_USBMODE, USBMODE_CI_SDIS, USBMODE_CI_SDIS);
957     +
958     return ret;
959     }
960    
961     diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c
962     index 60023c2..ed83e7a 100644
963     --- a/drivers/usb/serial/io_ti.c
964     +++ b/drivers/usb/serial/io_ti.c
965     @@ -534,6 +534,9 @@ static void chase_port(struct edgeport_port *port, unsigned long timeout,
966     wait_queue_t wait;
967     unsigned long flags;
968    
969     + if (!tty)
970     + return;
971     +
972     if (!timeout)
973     timeout = (HZ * EDGE_CLOSING_WAIT)/100;
974    
975     diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
976     index fd47369..f2727e4 100644
977     --- a/drivers/usb/serial/option.c
978     +++ b/drivers/usb/serial/option.c
979     @@ -450,6 +450,10 @@ static void option_instat_callback(struct urb *urb);
980     #define PETATEL_VENDOR_ID 0x1ff4
981     #define PETATEL_PRODUCT_NP10T 0x600e
982    
983     +/* TP-LINK Incorporated products */
984     +#define TPLINK_VENDOR_ID 0x2357
985     +#define TPLINK_PRODUCT_MA180 0x0201
986     +
987     /* some devices interfaces need special handling due to a number of reasons */
988     enum option_blacklist_reason {
989     OPTION_BLACKLIST_NONE = 0,
990     @@ -931,7 +935,8 @@ static const struct usb_device_id option_ids[] = {
991     { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0254, 0xff, 0xff, 0xff) },
992     { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0257, 0xff, 0xff, 0xff), /* ZTE MF821 */
993     .driver_info = (kernel_ulong_t)&net_intf3_blacklist },
994     - { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0265, 0xff, 0xff, 0xff) },
995     + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0265, 0xff, 0xff, 0xff), /* ONDA MT8205 */
996     + .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
997     { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0284, 0xff, 0xff, 0xff), /* ZTE MF880 */
998     .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
999     { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0317, 0xff, 0xff, 0xff) },
1000     @@ -1312,6 +1317,8 @@ static const struct usb_device_id option_ids[] = {
1001     { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_DC_4COM2, 0xff, 0x00, 0x00) },
1002     { USB_DEVICE(CELLIENT_VENDOR_ID, CELLIENT_PRODUCT_MEN200) },
1003     { USB_DEVICE(PETATEL_VENDOR_ID, PETATEL_PRODUCT_NP10T) },
1004     + { USB_DEVICE(TPLINK_VENDOR_ID, TPLINK_PRODUCT_MA180),
1005     + .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1006     { } /* Terminating entry */
1007     };
1008     MODULE_DEVICE_TABLE(usb, option_ids);
1009     diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c
1010     index b91f14e..95ce9d0 100644
1011     --- a/drivers/xen/grant-table.c
1012     +++ b/drivers/xen/grant-table.c
1013     @@ -56,10 +56,6 @@
1014     /* External tools reserve first few grant table entries. */
1015     #define NR_RESERVED_ENTRIES 8
1016     #define GNTTAB_LIST_END 0xffffffff
1017     -#define GREFS_PER_GRANT_FRAME \
1018     -(grant_table_version == 1 ? \
1019     -(PAGE_SIZE / sizeof(struct grant_entry_v1)) : \
1020     -(PAGE_SIZE / sizeof(union grant_entry_v2)))
1021    
1022     static grant_ref_t **gnttab_list;
1023     static unsigned int nr_grant_frames;
1024     @@ -154,6 +150,7 @@ static struct gnttab_ops *gnttab_interface;
1025     static grant_status_t *grstatus;
1026    
1027     static int grant_table_version;
1028     +static int grefs_per_grant_frame;
1029    
1030     static struct gnttab_free_callback *gnttab_free_callback_list;
1031    
1032     @@ -767,12 +764,14 @@ static int grow_gnttab_list(unsigned int more_frames)
1033     unsigned int new_nr_grant_frames, extra_entries, i;
1034     unsigned int nr_glist_frames, new_nr_glist_frames;
1035    
1036     + BUG_ON(grefs_per_grant_frame == 0);
1037     +
1038     new_nr_grant_frames = nr_grant_frames + more_frames;
1039     - extra_entries = more_frames * GREFS_PER_GRANT_FRAME;
1040     + extra_entries = more_frames * grefs_per_grant_frame;
1041    
1042     - nr_glist_frames = (nr_grant_frames * GREFS_PER_GRANT_FRAME + RPP - 1) / RPP;
1043     + nr_glist_frames = (nr_grant_frames * grefs_per_grant_frame + RPP - 1) / RPP;
1044     new_nr_glist_frames =
1045     - (new_nr_grant_frames * GREFS_PER_GRANT_FRAME + RPP - 1) / RPP;
1046     + (new_nr_grant_frames * grefs_per_grant_frame + RPP - 1) / RPP;
1047     for (i = nr_glist_frames; i < new_nr_glist_frames; i++) {
1048     gnttab_list[i] = (grant_ref_t *)__get_free_page(GFP_ATOMIC);
1049     if (!gnttab_list[i])
1050     @@ -780,12 +779,12 @@ static int grow_gnttab_list(unsigned int more_frames)
1051     }
1052    
1053    
1054     - for (i = GREFS_PER_GRANT_FRAME * nr_grant_frames;
1055     - i < GREFS_PER_GRANT_FRAME * new_nr_grant_frames - 1; i++)
1056     + for (i = grefs_per_grant_frame * nr_grant_frames;
1057     + i < grefs_per_grant_frame * new_nr_grant_frames - 1; i++)
1058     gnttab_entry(i) = i + 1;
1059    
1060     gnttab_entry(i) = gnttab_free_head;
1061     - gnttab_free_head = GREFS_PER_GRANT_FRAME * nr_grant_frames;
1062     + gnttab_free_head = grefs_per_grant_frame * nr_grant_frames;
1063     gnttab_free_count += extra_entries;
1064    
1065     nr_grant_frames = new_nr_grant_frames;
1066     @@ -957,7 +956,8 @@ EXPORT_SYMBOL_GPL(gnttab_unmap_refs);
1067    
1068     static unsigned nr_status_frames(unsigned nr_grant_frames)
1069     {
1070     - return (nr_grant_frames * GREFS_PER_GRANT_FRAME + SPP - 1) / SPP;
1071     + BUG_ON(grefs_per_grant_frame == 0);
1072     + return (nr_grant_frames * grefs_per_grant_frame + SPP - 1) / SPP;
1073     }
1074    
1075     static int gnttab_map_frames_v1(xen_pfn_t *frames, unsigned int nr_gframes)
1076     @@ -1115,6 +1115,7 @@ static void gnttab_request_version(void)
1077     rc = HYPERVISOR_grant_table_op(GNTTABOP_set_version, &gsv, 1);
1078     if (rc == 0 && gsv.version == 2) {
1079     grant_table_version = 2;
1080     + grefs_per_grant_frame = PAGE_SIZE / sizeof(union grant_entry_v2);
1081     gnttab_interface = &gnttab_v2_ops;
1082     } else if (grant_table_version == 2) {
1083     /*
1084     @@ -1127,17 +1128,17 @@ static void gnttab_request_version(void)
1085     panic("we need grant tables version 2, but only version 1 is available");
1086     } else {
1087     grant_table_version = 1;
1088     + grefs_per_grant_frame = PAGE_SIZE / sizeof(struct grant_entry_v1);
1089     gnttab_interface = &gnttab_v1_ops;
1090     }
1091     printk(KERN_INFO "Grant tables using version %d layout.\n",
1092     grant_table_version);
1093     }
1094    
1095     -int gnttab_resume(void)
1096     +static int gnttab_setup(void)
1097     {
1098     unsigned int max_nr_gframes;
1099    
1100     - gnttab_request_version();
1101     max_nr_gframes = gnttab_max_grant_frames();
1102     if (max_nr_gframes < nr_grant_frames)
1103     return -ENOSYS;
1104     @@ -1160,6 +1161,12 @@ int gnttab_resume(void)
1105     return 0;
1106     }
1107    
1108     +int gnttab_resume(void)
1109     +{
1110     + gnttab_request_version();
1111     + return gnttab_setup();
1112     +}
1113     +
1114     int gnttab_suspend(void)
1115     {
1116     gnttab_interface->unmap_frames();
1117     @@ -1171,9 +1178,10 @@ static int gnttab_expand(unsigned int req_entries)
1118     int rc;
1119     unsigned int cur, extra;
1120    
1121     + BUG_ON(grefs_per_grant_frame == 0);
1122     cur = nr_grant_frames;
1123     - extra = ((req_entries + (GREFS_PER_GRANT_FRAME-1)) /
1124     - GREFS_PER_GRANT_FRAME);
1125     + extra = ((req_entries + (grefs_per_grant_frame-1)) /
1126     + grefs_per_grant_frame);
1127     if (cur + extra > gnttab_max_grant_frames())
1128     return -ENOSPC;
1129    
1130     @@ -1191,21 +1199,23 @@ int gnttab_init(void)
1131     unsigned int nr_init_grefs;
1132     int ret;
1133    
1134     + gnttab_request_version();
1135     nr_grant_frames = 1;
1136     boot_max_nr_grant_frames = __max_nr_grant_frames();
1137    
1138     /* Determine the maximum number of frames required for the
1139     * grant reference free list on the current hypervisor.
1140     */
1141     + BUG_ON(grefs_per_grant_frame == 0);
1142     max_nr_glist_frames = (boot_max_nr_grant_frames *
1143     - GREFS_PER_GRANT_FRAME / RPP);
1144     + grefs_per_grant_frame / RPP);
1145    
1146     gnttab_list = kmalloc(max_nr_glist_frames * sizeof(grant_ref_t *),
1147     GFP_KERNEL);
1148     if (gnttab_list == NULL)
1149     return -ENOMEM;
1150    
1151     - nr_glist_frames = (nr_grant_frames * GREFS_PER_GRANT_FRAME + RPP - 1) / RPP;
1152     + nr_glist_frames = (nr_grant_frames * grefs_per_grant_frame + RPP - 1) / RPP;
1153     for (i = 0; i < nr_glist_frames; i++) {
1154     gnttab_list[i] = (grant_ref_t *)__get_free_page(GFP_KERNEL);
1155     if (gnttab_list[i] == NULL) {
1156     @@ -1214,12 +1224,12 @@ int gnttab_init(void)
1157     }
1158     }
1159    
1160     - if (gnttab_resume() < 0) {
1161     + if (gnttab_setup() < 0) {
1162     ret = -ENODEV;
1163     goto ini_nomem;
1164     }
1165    
1166     - nr_init_grefs = nr_grant_frames * GREFS_PER_GRANT_FRAME;
1167     + nr_init_grefs = nr_grant_frames * grefs_per_grant_frame;
1168    
1169     for (i = NR_RESERVED_ENTRIES; i < nr_init_grefs - 1; i++)
1170     gnttab_entry(i) = i + 1;
1171     diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
1172     index b3c243b..f89c0e5 100644
1173     --- a/fs/ext4/inode.c
1174     +++ b/fs/ext4/inode.c
1175     @@ -1503,6 +1503,8 @@ static void ext4_da_block_invalidatepages(struct mpage_da_data *mpd)
1176    
1177     index = mpd->first_page;
1178     end = mpd->next_page - 1;
1179     +
1180     + pagevec_init(&pvec, 0);
1181     while (index <= end) {
1182     nr_pages = pagevec_lookup(&pvec, mapping, index, PAGEVEC_SIZE);
1183     if (nr_pages == 0)
1184     diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h
1185     index 5be8937..fca8bbe 100644
1186     --- a/include/target/target_core_base.h
1187     +++ b/include/target/target_core_base.h
1188     @@ -734,6 +734,8 @@ struct se_subsystem_dev {
1189     };
1190    
1191     struct se_device {
1192     +#define SE_DEV_LINK_MAGIC 0xfeeddeef
1193     + u32 dev_link_magic;
1194     /* RELATIVE TARGET PORT IDENTIFER Counter */
1195     u16 dev_rpti_counter;
1196     /* Used for SAM Task Attribute ordering */
1197     @@ -820,6 +822,8 @@ struct se_port_stat_grps {
1198     };
1199    
1200     struct se_lun {
1201     +#define SE_LUN_LINK_MAGIC 0xffff7771
1202     + u32 lun_link_magic;
1203     /* See transport_lun_status_table */
1204     enum transport_lun_status_table lun_status;
1205     u32 lun_access;
1206     diff --git a/include/uapi/linux/serial_core.h b/include/uapi/linux/serial_core.h
1207     index 7e1ab20..dbb95db 100644
1208     --- a/include/uapi/linux/serial_core.h
1209     +++ b/include/uapi/linux/serial_core.h
1210     @@ -49,7 +49,9 @@
1211     #define PORT_XR17D15X 21 /* Exar XR17D15x UART */
1212     #define PORT_LPC3220 22 /* NXP LPC32xx SoC "Standard" UART */
1213     #define PORT_8250_CIR 23 /* CIR infrared port, has its own driver */
1214     -#define PORT_MAX_8250 23 /* max port ID */
1215     +#define PORT_XR17V35X 24 /* Exar XR17V35x UARTs */
1216     +#define PORT_BRCM_TRUMANAGE 24
1217     +#define PORT_MAX_8250 25 /* max port ID */
1218    
1219     /*
1220     * ARM specific type numbers. These are not currently guaranteed
1221     diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
1222     index 4642c68..a95e198 100644
1223     --- a/sound/pci/hda/patch_hdmi.c
1224     +++ b/sound/pci/hda/patch_hdmi.c
1225     @@ -1499,7 +1499,7 @@ static int hdmi_chmap_ctl_put(struct snd_kcontrol *kcontrol,
1226     ctl_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
1227     substream = snd_pcm_chmap_substream(info, ctl_idx);
1228     if (!substream || !substream->runtime)
1229     - return -EBADFD;
1230     + return 0; /* just for avoiding error from alsactl restore */
1231     switch (substream->runtime->status->state) {
1232     case SNDRV_PCM_STATE_OPEN:
1233     case SNDRV_PCM_STATE_SETUP:
1234     diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
1235     index 0f58b4b..b8d1ad1 100644
1236     --- a/sound/usb/quirks.c
1237     +++ b/sound/usb/quirks.c
1238     @@ -387,11 +387,13 @@ static int snd_usb_fasttrackpro_boot_quirk(struct usb_device *dev)
1239     * rules
1240     */
1241     err = usb_driver_set_configuration(dev, 2);
1242     - if (err < 0) {
1243     + if (err < 0)
1244     snd_printdd("error usb_driver_set_configuration: %d\n",
1245     err);
1246     - return -ENODEV;
1247     - }
1248     + /* Always return an error, so that we stop creating a device
1249     + that will just be destroyed and recreated with a new
1250     + configuration */
1251     + return -ENODEV;
1252     } else
1253     snd_printk(KERN_INFO "usb-audio: Fast Track Pro config OK\n");
1254