/[linux-patches]/genpatches-2.6/tags/2.6.32-47/1039_linux-2.6.32.40.patch
Gentoo

Contents of /genpatches-2.6/tags/2.6.32-47/1039_linux-2.6.32.40.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2037 - (show annotations) (download)
Wed Dec 28 14:38:55 2011 UTC (6 years, 3 months ago) by psomas
File size: 170994 byte(s)
2.6.32-47 release
1 diff --git a/Documentation/sound/alsa/HD-Audio-Models.txt b/Documentation/sound/alsa/HD-Audio-Models.txt
2 index 4c7f9ae..92dc1ab 100644
3 --- a/Documentation/sound/alsa/HD-Audio-Models.txt
4 +++ b/Documentation/sound/alsa/HD-Audio-Models.txt
5 @@ -401,4 +401,5 @@ STAC9872
6 Cirrus Logic CS4206/4207
7 ========================
8 mbp55 MacBook Pro 5,5
9 + imac27 IMac 27 Inch
10 auto BIOS setup (default)
11 diff --git a/Documentation/usb/proc_usb_info.txt b/Documentation/usb/proc_usb_info.txt
12 index fafcd47..afe596d 100644
13 --- a/Documentation/usb/proc_usb_info.txt
14 +++ b/Documentation/usb/proc_usb_info.txt
15 @@ -1,12 +1,17 @@
16 /proc/bus/usb filesystem output
17 ===============================
18 -(version 2003.05.30)
19 +(version 2010.09.13)
20
21
22 The usbfs filesystem for USB devices is traditionally mounted at
23 /proc/bus/usb. It provides the /proc/bus/usb/devices file, as well as
24 the /proc/bus/usb/BBB/DDD files.
25
26 +In many modern systems the usbfs filsystem isn't used at all. Instead
27 +USB device nodes are created under /dev/usb/ or someplace similar. The
28 +"devices" file is available in debugfs, typically as
29 +/sys/kernel/debug/usb/devices.
30 +
31
32 **NOTE**: If /proc/bus/usb appears empty, and a host controller
33 driver has been linked, then you need to mount the
34 @@ -106,8 +111,8 @@ Legend:
35
36 Topology info:
37
38 -T: Bus=dd Lev=dd Prnt=dd Port=dd Cnt=dd Dev#=ddd Spd=ddd MxCh=dd
39 -| | | | | | | | |__MaxChildren
40 +T: Bus=dd Lev=dd Prnt=dd Port=dd Cnt=dd Dev#=ddd Spd=dddd MxCh=dd
41 +| | | | | | | | |__MaxChildren
42 | | | | | | | |__Device Speed in Mbps
43 | | | | | | |__DeviceNumber
44 | | | | | |__Count of devices at this level
45 @@ -120,8 +125,13 @@ T: Bus=dd Lev=dd Prnt=dd Port=dd Cnt=dd Dev#=ddd Spd=ddd MxCh=dd
46 Speed may be:
47 1.5 Mbit/s for low speed USB
48 12 Mbit/s for full speed USB
49 - 480 Mbit/s for high speed USB (added for USB 2.0)
50 + 480 Mbit/s for high speed USB (added for USB 2.0);
51 + also used for Wireless USB, which has no fixed speed
52 + 5000 Mbit/s for SuperSpeed USB (added for USB 3.0)
53
54 + For reasons lost in the mists of time, the Port number is always
55 + too low by 1. For example, a device plugged into port 4 will
56 + show up with "Port=03".
57
58 Bandwidth info:
59 B: Alloc=ddd/ddd us (xx%), #Int=ddd, #Iso=ddd
60 @@ -291,7 +301,7 @@ Here's an example, from a system which has a UHCI root hub,
61 an external hub connected to the root hub, and a mouse and
62 a serial converter connected to the external hub.
63
64 -T: Bus=00 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=12 MxCh= 2
65 +T: Bus=00 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=12 MxCh= 2
66 B: Alloc= 28/900 us ( 3%), #Int= 2, #Iso= 0
67 D: Ver= 1.00 Cls=09(hub ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1
68 P: Vendor=0000 ProdID=0000 Rev= 0.00
69 @@ -301,21 +311,21 @@ C:* #Ifs= 1 Cfg#= 1 Atr=40 MxPwr= 0mA
70 I: If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub
71 E: Ad=81(I) Atr=03(Int.) MxPS= 8 Ivl=255ms
72
73 -T: Bus=00 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=12 MxCh= 4
74 +T: Bus=00 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=12 MxCh= 4
75 D: Ver= 1.00 Cls=09(hub ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1
76 P: Vendor=0451 ProdID=1446 Rev= 1.00
77 C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=100mA
78 I: If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub
79 E: Ad=81(I) Atr=03(Int.) MxPS= 1 Ivl=255ms
80
81 -T: Bus=00 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#= 3 Spd=1.5 MxCh= 0
82 +T: Bus=00 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#= 3 Spd=1.5 MxCh= 0
83 D: Ver= 1.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1
84 P: Vendor=04b4 ProdID=0001 Rev= 0.00
85 C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=100mA
86 I: If#= 0 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=01 Prot=02 Driver=mouse
87 E: Ad=81(I) Atr=03(Int.) MxPS= 3 Ivl= 10ms
88
89 -T: Bus=00 Lev=02 Prnt=02 Port=02 Cnt=02 Dev#= 4 Spd=12 MxCh= 0
90 +T: Bus=00 Lev=02 Prnt=02 Port=02 Cnt=02 Dev#= 4 Spd=12 MxCh= 0
91 D: Ver= 1.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1
92 P: Vendor=0565 ProdID=0001 Rev= 1.08
93 S: Manufacturer=Peracom Networks, Inc.
94 @@ -330,12 +340,12 @@ E: Ad=82(I) Atr=03(Int.) MxPS= 8 Ivl= 8ms
95 Selecting only the "T:" and "I:" lines from this (for example, by using
96 "procusb ti"), we have:
97
98 -T: Bus=00 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=12 MxCh= 2
99 -T: Bus=00 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=12 MxCh= 4
100 +T: Bus=00 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=12 MxCh= 2
101 +T: Bus=00 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=12 MxCh= 4
102 I: If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub
103 -T: Bus=00 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#= 3 Spd=1.5 MxCh= 0
104 +T: Bus=00 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#= 3 Spd=1.5 MxCh= 0
105 I: If#= 0 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=01 Prot=02 Driver=mouse
106 -T: Bus=00 Lev=02 Prnt=02 Port=02 Cnt=02 Dev#= 4 Spd=12 MxCh= 0
107 +T: Bus=00 Lev=02 Prnt=02 Port=02 Cnt=02 Dev#= 4 Spd=12 MxCh= 0
108 I: If#= 0 Alt= 0 #EPs= 3 Cls=00(>ifc ) Sub=00 Prot=00 Driver=serial
109
110
111 diff --git a/arch/arm/kernel/sys_oabi-compat.c b/arch/arm/kernel/sys_oabi-compat.c
112 index d59a0cd..897b879 100644
113 --- a/arch/arm/kernel/sys_oabi-compat.c
114 +++ b/arch/arm/kernel/sys_oabi-compat.c
115 @@ -311,7 +311,7 @@ asmlinkage long sys_oabi_semtimedop(int semid,
116 long err;
117 int i;
118
119 - if (nsops < 1)
120 + if (nsops < 1 || nsops > SEMOPM)
121 return -EINVAL;
122 sops = kmalloc(sizeof(*sops) * nsops, GFP_KERNEL);
123 if (!sops)
124 diff --git a/arch/m68k/mm/motorola.c b/arch/m68k/mm/motorola.c
125 index 4665fc8..e7ad9ca 100644
126 --- a/arch/m68k/mm/motorola.c
127 +++ b/arch/m68k/mm/motorola.c
128 @@ -299,6 +299,8 @@ void __init paging_init(void)
129 zones_size[ZONE_DMA] = m68k_memory[i].size >> PAGE_SHIFT;
130 free_area_init_node(i, zones_size,
131 m68k_memory[i].addr >> PAGE_SHIFT, NULL);
132 + if (node_present_pages(i))
133 + node_set_state(i, N_NORMAL_MEMORY);
134 }
135 }
136
137 diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c
138 index 9367e33..3d9bb9b 100644
139 --- a/arch/mips/mm/dma-default.c
140 +++ b/arch/mips/mm/dma-default.c
141 @@ -43,27 +43,39 @@ static inline int cpu_is_noncoherent_r10000(struct device *dev)
142
143 static gfp_t massage_gfp_flags(const struct device *dev, gfp_t gfp)
144 {
145 + gfp_t dma_flag;
146 +
147 /* ignore region specifiers */
148 gfp &= ~(__GFP_DMA | __GFP_DMA32 | __GFP_HIGHMEM);
149
150 -#ifdef CONFIG_ZONE_DMA
151 +#ifdef CONFIG_ISA
152 if (dev == NULL)
153 - gfp |= __GFP_DMA;
154 - else if (dev->coherent_dma_mask < DMA_BIT_MASK(24))
155 - gfp |= __GFP_DMA;
156 + dma_flag = __GFP_DMA;
157 else
158 #endif
159 -#ifdef CONFIG_ZONE_DMA32
160 +#if defined(CONFIG_ZONE_DMA32) && defined(CONFIG_ZONE_DMA)
161 if (dev->coherent_dma_mask < DMA_BIT_MASK(32))
162 - gfp |= __GFP_DMA32;
163 + dma_flag = __GFP_DMA;
164 + else if (dev->coherent_dma_mask < DMA_BIT_MASK(64))
165 + dma_flag = __GFP_DMA32;
166 + else
167 +#endif
168 +#if defined(CONFIG_ZONE_DMA32) && !defined(CONFIG_ZONE_DMA)
169 + if (dev->coherent_dma_mask < DMA_BIT_MASK(64))
170 + dma_flag = __GFP_DMA32;
171 + else
172 +#endif
173 +#if defined(CONFIG_ZONE_DMA) && !defined(CONFIG_ZONE_DMA32)
174 + if (dev->coherent_dma_mask < DMA_BIT_MASK(64))
175 + dma_flag = __GFP_DMA;
176 else
177 #endif
178 - ;
179 + dma_flag = 0;
180
181 /* Don't invoke OOM killer */
182 gfp |= __GFP_NORETRY;
183
184 - return gfp;
185 + return gfp | dma_flag;
186 }
187
188 void *dma_alloc_noncoherent(struct device *dev, size_t size,
189 diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c
190 index 13b6e3e..2609f4d 100644
191 --- a/arch/parisc/mm/init.c
192 +++ b/arch/parisc/mm/init.c
193 @@ -265,8 +265,10 @@ static void __init setup_bootmem(void)
194 }
195 memset(pfnnid_map, 0xff, sizeof(pfnnid_map));
196
197 - for (i = 0; i < npmem_ranges; i++)
198 + for (i = 0; i < npmem_ranges; i++) {
199 + node_set_state(i, N_NORMAL_MEMORY);
200 node_set_online(i);
201 + }
202 #endif
203
204 /*
205 diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
206 index 7bfc8ad..2ce2ed2 100644
207 --- a/arch/powerpc/boot/Makefile
208 +++ b/arch/powerpc/boot/Makefile
209 @@ -364,7 +364,7 @@ INSTALL := install
210 extra-installed := $(patsubst $(obj)/%, $(DESTDIR)$(WRAPPER_OBJDIR)/%, $(extra-y))
211 hostprogs-installed := $(patsubst %, $(DESTDIR)$(WRAPPER_BINDIR)/%, $(hostprogs-y))
212 wrapper-installed := $(DESTDIR)$(WRAPPER_BINDIR)/wrapper
213 -dts-installed := $(patsubst $(obj)/dts/%, $(DESTDIR)$(WRAPPER_DTSDIR)/%, $(wildcard $(obj)/dts/*.dts))
214 +dts-installed := $(patsubst $(dtstree)/%, $(DESTDIR)$(WRAPPER_DTSDIR)/%, $(wildcard $(dtstree)/*.dts))
215
216 all-installed := $(extra-installed) $(hostprogs-installed) $(wrapper-installed) $(dts-installed)
217
218 diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
219 index 600807b..08bc2ff 100644
220 --- a/arch/x86/include/asm/kvm_host.h
221 +++ b/arch/x86/include/asm/kvm_host.h
222 @@ -357,6 +357,9 @@ struct kvm_vcpu_arch {
223 struct page *time_page;
224
225 bool singlestep; /* guest is single stepped by KVM */
226 + u64 last_guest_tsc;
227 + u64 last_kernel_ns;
228 +
229 bool nmi_pending;
230 bool nmi_injected;
231
232 diff --git a/arch/x86/include/asm/pvclock.h b/arch/x86/include/asm/pvclock.h
233 index daaacab..982aa32 100644
234 --- a/arch/x86/include/asm/pvclock.h
235 +++ b/arch/x86/include/asm/pvclock.h
236 @@ -12,4 +12,42 @@ void pvclock_read_wallclock(struct pvclock_wall_clock *wall,
237 struct timespec *ts);
238 void pvclock_resume(void);
239
240 +/*
241 + * Scale a 64-bit delta by scaling and multiplying by a 32-bit fraction,
242 + * yielding a 64-bit result.
243 + */
244 +static inline u64 pvclock_scale_delta(u64 delta, u32 mul_frac, int shift)
245 +{
246 + u64 product;
247 +#ifdef __i386__
248 + u32 tmp1, tmp2;
249 +#endif
250 +
251 + if (shift < 0)
252 + delta >>= -shift;
253 + else
254 + delta <<= shift;
255 +
256 +#ifdef __i386__
257 + __asm__ (
258 + "mul %5 ; "
259 + "mov %4,%%eax ; "
260 + "mov %%edx,%4 ; "
261 + "mul %5 ; "
262 + "xor %5,%5 ; "
263 + "add %4,%%eax ; "
264 + "adc %5,%%edx ; "
265 + : "=A" (product), "=r" (tmp1), "=r" (tmp2)
266 + : "a" ((u32)delta), "1" ((u32)(delta >> 32)), "2" (mul_frac) );
267 +#elif defined(__x86_64__)
268 + __asm__ (
269 + "mul %%rdx ; shrd $32,%%rdx,%%rax"
270 + : "=a" (product) : "0" (delta), "d" ((u64)mul_frac) );
271 +#else
272 +#error implement me!
273 +#endif
274 +
275 + return product;
276 +}
277 +
278 #endif /* _ASM_X86_PVCLOCK_H */
279 diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
280 index f893f73..8f9c307 100644
281 --- a/arch/x86/kernel/cpu/amd.c
282 +++ b/arch/x86/kernel/cpu/amd.c
283 @@ -653,7 +653,7 @@ cpu_dev_register(amd_cpu_dev);
284 */
285
286 const int amd_erratum_400[] =
287 - AMD_OSVW_ERRATUM(1, AMD_MODEL_RANGE(0xf, 0x41, 0x2, 0xff, 0xf),
288 + AMD_OSVW_ERRATUM(1, AMD_MODEL_RANGE(0x0f, 0x4, 0x2, 0xff, 0xf),
289 AMD_MODEL_RANGE(0x10, 0x2, 0x1, 0xff, 0xf));
290
291
292 diff --git a/arch/x86/kernel/pvclock.c b/arch/x86/kernel/pvclock.c
293 index b12fe8d..929047c 100644
294 --- a/arch/x86/kernel/pvclock.c
295 +++ b/arch/x86/kernel/pvclock.c
296 @@ -74,7 +74,8 @@ static inline u64 scale_delta(u64 delta, u32 mul_frac, int shift)
297 static u64 pvclock_get_nsec_offset(struct pvclock_shadow_time *shadow)
298 {
299 u64 delta = native_read_tsc() - shadow->tsc_timestamp;
300 - return scale_delta(delta, shadow->tsc_to_nsec_mul, shadow->tsc_shift);
301 + return pvclock_scale_delta(delta, shadow->tsc_to_nsec_mul,
302 + shadow->tsc_shift);
303 }
304
305 /*
306 diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
307 index b2c02a2..df1cefb 100644
308 --- a/arch/x86/kvm/x86.c
309 +++ b/arch/x86/kvm/x86.c
310 @@ -47,6 +47,7 @@
311 #include <asm/desc.h>
312 #include <asm/mtrr.h>
313 #include <asm/mce.h>
314 +#include <asm/pvclock.h>
315
316 #define MAX_IO_MSRS 256
317 #define CR0_RESERVED_BITS \
318 @@ -633,6 +634,8 @@ static void kvm_write_guest_time(struct kvm_vcpu *v)
319 struct kvm_vcpu_arch *vcpu = &v->arch;
320 void *shared_kaddr;
321 unsigned long this_tsc_khz;
322 + s64 kernel_ns, max_kernel_ns;
323 + u64 tsc_timestamp;
324
325 if ((!vcpu->time_page))
326 return;
327 @@ -646,15 +649,52 @@ static void kvm_write_guest_time(struct kvm_vcpu *v)
328
329 /* Keep irq disabled to prevent changes to the clock */
330 local_irq_save(flags);
331 - kvm_get_msr(v, MSR_IA32_TSC, &vcpu->hv_clock.tsc_timestamp);
332 + kvm_get_msr(v, MSR_IA32_TSC, &tsc_timestamp);
333 ktime_get_ts(&ts);
334 monotonic_to_bootbased(&ts);
335 + kernel_ns = timespec_to_ns(&ts);
336 local_irq_restore(flags);
337
338 + /*
339 + * Time as measured by the TSC may go backwards when resetting the base
340 + * tsc_timestamp. The reason for this is that the TSC resolution is
341 + * higher than the resolution of the other clock scales. Thus, many
342 + * possible measurments of the TSC correspond to one measurement of any
343 + * other clock, and so a spread of values is possible. This is not a
344 + * problem for the computation of the nanosecond clock; with TSC rates
345 + * around 1GHZ, there can only be a few cycles which correspond to one
346 + * nanosecond value, and any path through this code will inevitably
347 + * take longer than that. However, with the kernel_ns value itself,
348 + * the precision may be much lower, down to HZ granularity. If the
349 + * first sampling of TSC against kernel_ns ends in the low part of the
350 + * range, and the second in the high end of the range, we can get:
351 + *
352 + * (TSC - offset_low) * S + kns_old > (TSC - offset_high) * S + kns_new
353 + *
354 + * As the sampling errors potentially range in the thousands of cycles,
355 + * it is possible such a time value has already been observed by the
356 + * guest. To protect against this, we must compute the system time as
357 + * observed by the guest and ensure the new system time is greater.
358 + */
359 + max_kernel_ns = 0;
360 + if (vcpu->hv_clock.tsc_timestamp && vcpu->last_guest_tsc) {
361 + max_kernel_ns = vcpu->last_guest_tsc -
362 + vcpu->hv_clock.tsc_timestamp;
363 + max_kernel_ns = pvclock_scale_delta(max_kernel_ns,
364 + vcpu->hv_clock.tsc_to_system_mul,
365 + vcpu->hv_clock.tsc_shift);
366 + max_kernel_ns += vcpu->last_kernel_ns;
367 + }
368 +
369 + if (max_kernel_ns > kernel_ns)
370 + kernel_ns = max_kernel_ns;
371 +
372 /* With all the info we got, fill in the values */
373
374 - vcpu->hv_clock.system_time = ts.tv_nsec +
375 - (NSEC_PER_SEC * (u64)ts.tv_sec) + v->kvm->arch.kvmclock_offset;
376 + vcpu->hv_clock.tsc_timestamp = tsc_timestamp;
377 + vcpu->hv_clock.system_time = kernel_ns + v->kvm->arch.kvmclock_offset;
378 + vcpu->last_kernel_ns = kernel_ns;
379 + vcpu->last_guest_tsc = tsc_timestamp;
380
381 /*
382 * The interface expects us to write an even number signaling that the
383 @@ -3695,6 +3735,8 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
384 kvm_x86_ops->prepare_guest_switch(vcpu);
385 kvm_load_guest_fpu(vcpu);
386
387 + kvm_get_msr(vcpu, MSR_IA32_TSC, &vcpu->arch.last_guest_tsc);
388 +
389 local_irq_disable();
390
391 clear_bit(KVM_REQ_KICK, &vcpu->requests);
392 diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
393 index 8a6d81a..bb9c5ea 100644
394 --- a/block/blk-sysfs.c
395 +++ b/block/blk-sysfs.c
396 @@ -440,8 +440,10 @@ int blk_register_queue(struct gendisk *disk)
397 return ret;
398
399 ret = kobject_add(&q->kobj, kobject_get(&dev->kobj), "%s", "queue");
400 - if (ret < 0)
401 + if (ret < 0) {
402 + blk_trace_remove_sysfs(dev);
403 return ret;
404 + }
405
406 kobject_uevent(&q->kobj, KOBJ_ADD);
407
408 diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
409 index a158a6c..553edcc 100644
410 --- a/drivers/ata/libata-scsi.c
411 +++ b/drivers/ata/libata-scsi.c
412 @@ -1099,13 +1099,13 @@ static int ata_scsi_dev_config(struct scsi_device *sdev,
413 /* configure max sectors */
414 blk_queue_max_sectors(sdev->request_queue, dev->max_sectors);
415
416 + sdev->sector_size = ATA_SECT_SIZE;
417 +
418 if (dev->class == ATA_DEV_ATAPI) {
419 struct request_queue *q = sdev->request_queue;
420 void *buf;
421
422 - /* set the min alignment and padding */
423 - blk_queue_update_dma_alignment(sdev->request_queue,
424 - ATA_DMA_PAD_SZ - 1);
425 + /* set DMA padding */
426 blk_queue_update_dma_pad(sdev->request_queue,
427 ATA_DMA_PAD_SZ - 1);
428
429 @@ -1119,12 +1119,24 @@ static int ata_scsi_dev_config(struct scsi_device *sdev,
430
431 blk_queue_dma_drain(q, atapi_drain_needed, buf, ATAPI_MAX_DRAIN);
432 } else {
433 - /* ATA devices must be sector aligned */
434 - blk_queue_update_dma_alignment(sdev->request_queue,
435 - ATA_SECT_SIZE - 1);
436 sdev->manage_start_stop = 1;
437 }
438
439 + /*
440 + * ata_pio_sectors() expects buffer for each sector to not cross
441 + * page boundary. Enforce it by requiring buffers to be sector
442 + * aligned, which works iff sector_size is not larger than
443 + * PAGE_SIZE. ATAPI devices also need the alignment as
444 + * IDENTIFY_PACKET is executed as ATA_PROT_PIO.
445 + */
446 + if (sdev->sector_size > PAGE_SIZE)
447 + ata_dev_printk(dev, KERN_WARNING,
448 + "sector_size=%u > PAGE_SIZE, PIO may malfunction\n",
449 + sdev->sector_size);
450 +
451 + blk_queue_update_dma_alignment(sdev->request_queue,
452 + sdev->sector_size - 1);
453 +
454 if (dev->flags & ATA_DFLAG_AN)
455 set_bit(SDEV_EVT_MEDIA_CHANGE, sdev->supported_events);
456
457 diff --git a/drivers/ata/sata_via.c b/drivers/ata/sata_via.c
458 index e35596b..f5dcca7 100644
459 --- a/drivers/ata/sata_via.c
460 +++ b/drivers/ata/sata_via.c
461 @@ -40,6 +40,8 @@
462 #include <linux/blkdev.h>
463 #include <linux/delay.h>
464 #include <linux/device.h>
465 +#include <scsi/scsi.h>
466 +#include <scsi/scsi_cmnd.h>
467 #include <scsi/scsi_host.h>
468 #include <linux/libata.h>
469
470 @@ -80,6 +82,7 @@ static int vt8251_scr_write(struct ata_link *link, unsigned int scr, u32 val);
471 static void svia_tf_load(struct ata_port *ap, const struct ata_taskfile *tf);
472 static void svia_noop_freeze(struct ata_port *ap);
473 static int vt6420_prereset(struct ata_link *link, unsigned long deadline);
474 +static void vt6420_bmdma_start(struct ata_queued_cmd *qc);
475 static int vt6421_pata_cable_detect(struct ata_port *ap);
476 static void vt6421_set_pio_mode(struct ata_port *ap, struct ata_device *adev);
477 static void vt6421_set_dma_mode(struct ata_port *ap, struct ata_device *adev);
478 @@ -121,6 +124,7 @@ static struct ata_port_operations vt6420_sata_ops = {
479 .inherits = &svia_base_ops,
480 .freeze = svia_noop_freeze,
481 .prereset = vt6420_prereset,
482 + .bmdma_start = vt6420_bmdma_start,
483 };
484
485 static struct ata_port_operations vt6421_pata_ops = {
486 @@ -377,6 +381,17 @@ static int vt6420_prereset(struct ata_link *link, unsigned long deadline)
487 return 0;
488 }
489
490 +static void vt6420_bmdma_start(struct ata_queued_cmd *qc)
491 +{
492 + struct ata_port *ap = qc->ap;
493 + if ((qc->tf.command == ATA_CMD_PACKET) &&
494 + (qc->scsicmd->sc_data_direction == DMA_TO_DEVICE)) {
495 + /* Prevents corruption on some ATAPI burners */
496 + ata_sff_pause(ap);
497 + }
498 + ata_bmdma_start(qc);
499 +}
500 +
501 static int vt6421_pata_cable_detect(struct ata_port *ap)
502 {
503 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
504 diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
505 index c12d0fb..75185a6 100644
506 --- a/drivers/bluetooth/btusb.c
507 +++ b/drivers/bluetooth/btusb.c
508 @@ -59,9 +59,18 @@ static struct usb_device_id btusb_table[] = {
509 /* Generic Bluetooth USB device */
510 { USB_DEVICE_INFO(0xe0, 0x01, 0x01) },
511
512 + /* Apple MacBookPro 7,1 */
513 + { USB_DEVICE(0x05ac, 0x8213) },
514 +
515 /* Apple iMac11,1 */
516 { USB_DEVICE(0x05ac, 0x8215) },
517
518 + /* Apple MacBookPro6,2 */
519 + { USB_DEVICE(0x05ac, 0x8218) },
520 +
521 + /* Apple MacBookAir3,1, MacBookAir3,2 */
522 + { USB_DEVICE(0x05ac, 0x821b) },
523 +
524 /* Apple MacBookPro8,2 */
525 { USB_DEVICE(0x05ac, 0x821a) },
526
527 diff --git a/drivers/char/agp/generic.c b/drivers/char/agp/generic.c
528 index c505439..0d8d60c 100644
529 --- a/drivers/char/agp/generic.c
530 +++ b/drivers/char/agp/generic.c
531 @@ -123,6 +123,9 @@ static struct agp_memory *agp_create_user_memory(unsigned long num_agp_pages)
532 struct agp_memory *new;
533 unsigned long alloc_size = num_agp_pages*sizeof(struct page *);
534
535 + if (INT_MAX/sizeof(struct page *) < num_agp_pages)
536 + return NULL;
537 +
538 new = kzalloc(sizeof(struct agp_memory), GFP_KERNEL);
539 if (new == NULL)
540 return NULL;
541 @@ -242,11 +245,14 @@ struct agp_memory *agp_allocate_memory(struct agp_bridge_data *bridge,
542 int scratch_pages;
543 struct agp_memory *new;
544 size_t i;
545 + int cur_memory;
546
547 if (!bridge)
548 return NULL;
549
550 - if ((atomic_read(&bridge->current_memory_agp) + page_count) > bridge->max_memory_agp)
551 + cur_memory = atomic_read(&bridge->current_memory_agp);
552 + if ((cur_memory + page_count > bridge->max_memory_agp) ||
553 + (cur_memory + page_count < page_count))
554 return NULL;
555
556 if (type >= AGP_USER_TYPES) {
557 @@ -1123,8 +1129,8 @@ int agp_generic_insert_memory(struct agp_memory * mem, off_t pg_start, int type)
558 return -EINVAL;
559 }
560
561 - /* AK: could wrap */
562 - if ((pg_start + mem->page_count) > num_entries)
563 + if (((pg_start + mem->page_count) > num_entries) ||
564 + ((pg_start + mem->page_count) < pg_start))
565 return -EINVAL;
566
567 j = pg_start;
568 @@ -1158,7 +1164,7 @@ int agp_generic_remove_memory(struct agp_memory *mem, off_t pg_start, int type)
569 {
570 size_t i;
571 struct agp_bridge_data *bridge;
572 - int mask_type;
573 + int mask_type, num_entries;
574
575 bridge = mem->bridge;
576 if (!bridge)
577 @@ -1170,6 +1176,11 @@ int agp_generic_remove_memory(struct agp_memory *mem, off_t pg_start, int type)
578 if (type != mem->type)
579 return -EINVAL;
580
581 + num_entries = agp_num_entries();
582 + if (((pg_start + mem->page_count) > num_entries) ||
583 + ((pg_start + mem->page_count) < pg_start))
584 + return -EINVAL;
585 +
586 mask_type = bridge->driver->agp_type_to_mask_type(bridge, type);
587 if (mask_type != 0) {
588 /* The generic routines know nothing of memory types */
589 diff --git a/drivers/char/i8k.c b/drivers/char/i8k.c
590 index fc8cf7a..4365717 100644
591 --- a/drivers/char/i8k.c
592 +++ b/drivers/char/i8k.c
593 @@ -119,7 +119,7 @@ static int i8k_smm(struct smm_regs *regs)
594 int eax = regs->eax;
595
596 #if defined(CONFIG_X86_64)
597 - asm("pushq %%rax\n\t"
598 + asm volatile("pushq %%rax\n\t"
599 "movl 0(%%rax),%%edx\n\t"
600 "pushq %%rdx\n\t"
601 "movl 4(%%rax),%%ebx\n\t"
602 @@ -145,7 +145,7 @@ static int i8k_smm(struct smm_regs *regs)
603 : "a"(regs)
604 : "%ebx", "%ecx", "%edx", "%esi", "%edi", "memory");
605 #else
606 - asm("pushl %%eax\n\t"
607 + asm volatile("pushl %%eax\n\t"
608 "movl 0(%%eax),%%edx\n\t"
609 "push %%edx\n\t"
610 "movl 4(%%eax),%%ebx\n\t"
611 @@ -166,7 +166,8 @@ static int i8k_smm(struct smm_regs *regs)
612 "movl %%edx,0(%%eax)\n\t"
613 "lahf\n\t"
614 "shrl $8,%%eax\n\t"
615 - "andl $1,%%eax\n":"=a"(rc)
616 + "andl $1,%%eax\n"
617 + :"=a"(rc)
618 : "a"(regs)
619 : "%ebx", "%ecx", "%edx", "%esi", "%edi", "memory");
620 #endif
621 diff --git a/drivers/gpu/drm/radeon/atom.c b/drivers/gpu/drm/radeon/atom.c
622 index fed2291..dd72b91 100644
623 --- a/drivers/gpu/drm/radeon/atom.c
624 +++ b/drivers/gpu/drm/radeon/atom.c
625 @@ -126,7 +126,7 @@ static uint32_t atom_iio_execute(struct atom_context *ctx, int base,
626 case ATOM_IIO_MOVE_INDEX:
627 temp &=
628 ~((0xFFFFFFFF >> (32 - CU8(base + 1))) <<
629 - CU8(base + 2));
630 + CU8(base + 3));
631 temp |=
632 ((index >> CU8(base + 2)) &
633 (0xFFFFFFFF >> (32 - CU8(base + 1)))) << CU8(base +
634 @@ -136,7 +136,7 @@ static uint32_t atom_iio_execute(struct atom_context *ctx, int base,
635 case ATOM_IIO_MOVE_DATA:
636 temp &=
637 ~((0xFFFFFFFF >> (32 - CU8(base + 1))) <<
638 - CU8(base + 2));
639 + CU8(base + 3));
640 temp |=
641 ((data >> CU8(base + 2)) &
642 (0xFFFFFFFF >> (32 - CU8(base + 1)))) << CU8(base +
643 @@ -146,7 +146,7 @@ static uint32_t atom_iio_execute(struct atom_context *ctx, int base,
644 case ATOM_IIO_MOVE_ATTR:
645 temp &=
646 ~((0xFFFFFFFF >> (32 - CU8(base + 1))) <<
647 - CU8(base + 2));
648 + CU8(base + 3));
649 temp |=
650 ((ctx->
651 io_attr >> CU8(base + 2)) & (0xFFFFFFFF >> (32 -
652 diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c
653 index 5b4d66d..5f38014 100644
654 --- a/drivers/hid/hid-apple.c
655 +++ b/drivers/hid/hid-apple.c
656 @@ -53,6 +53,27 @@ struct apple_key_translation {
657 u8 flags;
658 };
659
660 +static const struct apple_key_translation macbookair_fn_keys[] = {
661 + { KEY_BACKSPACE, KEY_DELETE },
662 + { KEY_ENTER, KEY_INSERT },
663 + { KEY_F1, KEY_BRIGHTNESSDOWN, APPLE_FLAG_FKEY },
664 + { KEY_F2, KEY_BRIGHTNESSUP, APPLE_FLAG_FKEY },
665 + { KEY_F3, KEY_SCALE, APPLE_FLAG_FKEY },
666 + { KEY_F4, KEY_DASHBOARD, APPLE_FLAG_FKEY },
667 + { KEY_F6, KEY_PREVIOUSSONG, APPLE_FLAG_FKEY },
668 + { KEY_F7, KEY_PLAYPAUSE, APPLE_FLAG_FKEY },
669 + { KEY_F8, KEY_NEXTSONG, APPLE_FLAG_FKEY },
670 + { KEY_F9, KEY_MUTE, APPLE_FLAG_FKEY },
671 + { KEY_F10, KEY_VOLUMEDOWN, APPLE_FLAG_FKEY },
672 + { KEY_F11, KEY_VOLUMEUP, APPLE_FLAG_FKEY },
673 + { KEY_F12, KEY_EJECTCD, APPLE_FLAG_FKEY },
674 + { KEY_UP, KEY_PAGEUP },
675 + { KEY_DOWN, KEY_PAGEDOWN },
676 + { KEY_LEFT, KEY_HOME },
677 + { KEY_RIGHT, KEY_END },
678 + { }
679 +};
680 +
681 static const struct apple_key_translation apple_fn_keys[] = {
682 { KEY_BACKSPACE, KEY_DELETE },
683 { KEY_ENTER, KEY_INSERT },
684 @@ -151,10 +172,15 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input,
685 if (fnmode) {
686 int do_translate;
687
688 - trans = apple_find_translation((hid->product < 0x21d ||
689 - hid->product >= 0x300) ?
690 - powerbook_fn_keys : apple_fn_keys,
691 - usage->code);
692 + if(hid->product >= USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI &&
693 + hid->product <= USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS) {
694 + trans = apple_find_translation(macbookair_fn_keys, usage->code);
695 + } else if (hid->product < 0x21d || hid->product >= 0x300) {
696 + trans = apple_find_translation(powerbook_fn_keys, usage->code);
697 + } else {
698 + trans = apple_find_translation(apple_fn_keys, usage->code);
699 + }
700 +
701 if (trans) {
702 if (test_bit(usage->code, asc->pressed_fn))
703 do_translate = 1;
704 @@ -431,6 +457,18 @@ static const struct hid_device_id apple_devices[] = {
705 .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
706 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_JIS),
707 .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
708 + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI),
709 + .driver_data = APPLE_HAS_FN },
710 + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ISO),
711 + .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
712 + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_JIS),
713 + .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
714 + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI),
715 + .driver_data = APPLE_HAS_FN },
716 + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO),
717 + .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
718 + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS),
719 + .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
720 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI),
721 .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
722 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO),
723 diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
724 index 5e1b522..f3f1415 100644
725 --- a/drivers/hid/hid-core.c
726 +++ b/drivers/hid/hid-core.c
727 @@ -1287,6 +1287,12 @@ static const struct hid_device_id hid_blacklist[] = {
728 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI) },
729 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ISO) },
730 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_JIS) },
731 + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI) },
732 + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ISO) },
733 + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_JIS) },
734 + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI) },
735 + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO) },
736 + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS) },
737 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI) },
738 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO) },
739 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS) },
740 @@ -1705,6 +1711,12 @@ static const struct hid_device_id hid_mouse_ignore_list[] = {
741 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI) },
742 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ISO) },
743 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_JIS) },
744 + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI) },
745 + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ISO) },
746 + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_JIS) },
747 + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI) },
748 + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO) },
749 + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS) },
750 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) },
751 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) },
752 { }
753 diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
754 index d993e97..aef92bb 100644
755 --- a/drivers/hid/hid-ids.h
756 +++ b/drivers/hid/hid-ids.h
757 @@ -88,6 +88,12 @@
758 #define USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI 0x0236
759 #define USB_DEVICE_ID_APPLE_WELLSPRING3_ISO 0x0237
760 #define USB_DEVICE_ID_APPLE_WELLSPRING3_JIS 0x0238
761 +#define USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI 0x023f
762 +#define USB_DEVICE_ID_APPLE_WELLSPRING4_ISO 0x0240
763 +#define USB_DEVICE_ID_APPLE_WELLSPRING4_JIS 0x0241
764 +#define USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI 0x0242
765 +#define USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO 0x0243
766 +#define USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS 0x0244
767 #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI 0x0239
768 #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO 0x023a
769 #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS 0x023b
770 diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
771 index 7ea6a8f..f69f930 100644
772 --- a/drivers/hwmon/applesmc.c
773 +++ b/drivers/hwmon/applesmc.c
774 @@ -142,6 +142,30 @@ static const char *temperature_sensors_sets[][41] = {
775 "TM1S", "TM2P", "TM2S", "TM3S", "TM8P", "TM8S", "TM9P", "TM9S",
776 "TN0C", "TN0D", "TN0H", "TS0C", "Tp0C", "Tp1C", "Tv0S", "Tv1S",
777 NULL },
778 +/* Set 17: iMac 9,1 */
779 + { "TA0P", "TC0D", "TC0H", "TC0P", "TG0D", "TG0H", "TH0P", "TL0P",
780 + "TN0D", "TN0H", "TN0P", "TO0P", "Tm0P", "Tp0P", NULL },
781 +/* Set 18: MacBook Pro 2,2 */
782 + { "TB0T", "TC0D", "TC0P", "TG0H", "TG0P", "TG0T", "TM0P", "TTF0",
783 + "Th0H", "Th1H", "Tm0P", "Ts0P", NULL },
784 +/* Set 19: Macbook Pro 5,3 */
785 + { "TB0T", "TB1T", "TB2T", "TB3T", "TC0D", "TC0F", "TC0P", "TG0D",
786 + "TG0F", "TG0H", "TG0P", "TG0T", "TN0D", "TN0P", "TTF0", "Th2H",
787 + "Tm0P", "Ts0P", "Ts0S", NULL },
788 +/* Set 20: MacBook Pro 5,4 */
789 + { "TB0T", "TB1T", "TB2T", "TB3T", "TC0D", "TC0F", "TC0P", "TN0D",
790 + "TN0P", "TTF0", "Th2H", "Ts0P", "Ts0S", NULL },
791 +/* Set 21: MacBook Pro 6,2 */
792 + { "TB0T", "TB1T", "TB2T", "TC0C", "TC0D", "TC0P", "TC1C", "TG0D",
793 + "TG0P", "TG0T", "TMCD", "TP0P", "TPCD", "Th1H", "Th2H", "Tm0P",
794 + "Ts0P", "Ts0S", NULL },
795 +/* Set 22: MacBook Pro 7,1 */
796 + { "TB0T", "TB1T", "TB2T", "TC0D", "TC0P", "TN0D", "TN0P", "TN0S",
797 + "TN1D", "TN1F", "TN1G", "TN1S", "Th1H", "Ts0P", "Ts0S", NULL },
798 +/* Set 23: MacBook Air 3,1 */
799 + { "TB0T", "TB1T", "TB2T", "TC0D", "TC0E", "TC0P", "TC1E", "TCZ3",
800 + "TCZ4", "TCZ5", "TG0E", "TG1E", "TG2E", "TGZ3", "TGZ4", "TGZ5",
801 + "TH0F", "TH0O", "TM0P" },
802 };
803
804 /* List of keys used to read/write fan speeds */
805 @@ -1350,11 +1374,29 @@ static __initdata struct dmi_match_data applesmc_dmi_data[] = {
806 { .accelerometer = 1, .light = 1, .temperature_set = 15 },
807 /* MacPro3,1: temperature set 16 */
808 { .accelerometer = 0, .light = 0, .temperature_set = 16 },
809 +/* iMac 9,1: light sensor only, temperature set 17 */
810 + { .accelerometer = 0, .light = 0, .temperature_set = 17 },
811 +/* MacBook Pro 2,2: accelerometer, backlight and temperature set 18 */
812 + { .accelerometer = 1, .light = 1, .temperature_set = 18 },
813 +/* MacBook Pro 5,3: accelerometer, backlight and temperature set 19 */
814 + { .accelerometer = 1, .light = 1, .temperature_set = 19 },
815 +/* MacBook Pro 5,4: accelerometer, backlight and temperature set 20 */
816 + { .accelerometer = 1, .light = 1, .temperature_set = 20 },
817 +/* MacBook Pro 6,2: accelerometer, backlight and temperature set 21 */
818 + { .accelerometer = 1, .light = 1, .temperature_set = 21 },
819 +/* MacBook Pro 7,1: accelerometer, backlight and temperature set 22 */
820 + { .accelerometer = 1, .light = 1, .temperature_set = 22 },
821 +/* MacBook Air 3,1: accelerometer, backlight and temperature set 23 */
822 + { .accelerometer = 0, .light = 0, .temperature_set = 23 },
823 };
824
825 /* Note that DMI_MATCH(...,"MacBook") will match "MacBookPro1,1".
826 * So we need to put "Apple MacBook Pro" before "Apple MacBook". */
827 static __initdata struct dmi_system_id applesmc_whitelist[] = {
828 + { applesmc_dmi_match, "Apple MacBook Air 3", {
829 + DMI_MATCH(DMI_BOARD_VENDOR, "Apple"),
830 + DMI_MATCH(DMI_PRODUCT_NAME, "MacBookAir3") },
831 + &applesmc_dmi_data[23]},
832 { applesmc_dmi_match, "Apple MacBook Air 2", {
833 DMI_MATCH(DMI_BOARD_VENDOR, "Apple"),
834 DMI_MATCH(DMI_PRODUCT_NAME, "MacBookAir2") },
835 @@ -1363,6 +1405,22 @@ static __initdata struct dmi_system_id applesmc_whitelist[] = {
836 DMI_MATCH(DMI_BOARD_VENDOR, "Apple"),
837 DMI_MATCH(DMI_PRODUCT_NAME, "MacBookAir") },
838 &applesmc_dmi_data[7]},
839 + { applesmc_dmi_match, "Apple MacBook Pro 7", {
840 + DMI_MATCH(DMI_BOARD_VENDOR, "Apple"),
841 + DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro7") },
842 + &applesmc_dmi_data[22]},
843 + { applesmc_dmi_match, "Apple MacBook Pro 5,4", {
844 + DMI_MATCH(DMI_BOARD_VENDOR, "Apple"),
845 + DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro5,4") },
846 + &applesmc_dmi_data[20]},
847 + { applesmc_dmi_match, "Apple MacBook Pro 5,3", {
848 + DMI_MATCH(DMI_BOARD_VENDOR, "Apple"),
849 + DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro5,3") },
850 + &applesmc_dmi_data[19]},
851 + { applesmc_dmi_match, "Apple MacBook Pro 6", {
852 + DMI_MATCH(DMI_BOARD_VENDOR, "Apple"),
853 + DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro6") },
854 + &applesmc_dmi_data[21]},
855 { applesmc_dmi_match, "Apple MacBook Pro 5", {
856 DMI_MATCH(DMI_BOARD_VENDOR, "Apple"),
857 DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro5") },
858 @@ -1375,6 +1433,10 @@ static __initdata struct dmi_system_id applesmc_whitelist[] = {
859 DMI_MATCH(DMI_BOARD_VENDOR, "Apple"),
860 DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro3") },
861 &applesmc_dmi_data[9]},
862 + { applesmc_dmi_match, "Apple MacBook Pro 2,2", {
863 + DMI_MATCH(DMI_BOARD_VENDOR, "Apple Computer, Inc."),
864 + DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro2,2") },
865 + &applesmc_dmi_data[18]},
866 { applesmc_dmi_match, "Apple MacBook Pro", {
867 DMI_MATCH(DMI_BOARD_VENDOR,"Apple"),
868 DMI_MATCH(DMI_PRODUCT_NAME,"MacBookPro") },
869 @@ -1415,6 +1477,10 @@ static __initdata struct dmi_system_id applesmc_whitelist[] = {
870 DMI_MATCH(DMI_BOARD_VENDOR, "Apple"),
871 DMI_MATCH(DMI_PRODUCT_NAME, "MacPro") },
872 &applesmc_dmi_data[4]},
873 + { applesmc_dmi_match, "Apple iMac 9,1", {
874 + DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
875 + DMI_MATCH(DMI_PRODUCT_NAME, "iMac9,1") },
876 + &applesmc_dmi_data[17]},
877 { applesmc_dmi_match, "Apple iMac 8", {
878 DMI_MATCH(DMI_BOARD_VENDOR, "Apple"),
879 DMI_MATCH(DMI_PRODUCT_NAME, "iMac8") },
880 diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
881 index fda35e6..5b2339a 100644
882 --- a/drivers/input/mouse/elantech.c
883 +++ b/drivers/input/mouse/elantech.c
884 @@ -24,6 +24,10 @@
885 printk(KERN_DEBUG format, ##arg); \
886 } while (0)
887
888 +static bool force_elantech;
889 +module_param_named(force_elantech, force_elantech, bool, 0644);
890 +MODULE_PARM_DESC(force_elantech, "Force the Elantech PS/2 protocol extension to be used, 1 = enabled, 0 = disabled (default).");
891 +
892 /*
893 * Send a Synaptics style sliced query command
894 */
895 @@ -178,36 +182,44 @@ static void elantech_report_absolute_v1(struct psmouse *psmouse)
896 struct elantech_data *etd = psmouse->private;
897 unsigned char *packet = psmouse->packet;
898 int fingers;
899 - static int old_fingers;
900
901 - if (etd->fw_version_maj == 0x01) {
902 - /* byte 0: D U p1 p2 1 p3 R L
903 - byte 1: f 0 th tw x9 x8 y9 y8 */
904 + if (etd->fw_version < 0x020000) {
905 + /*
906 + * byte 0: D U p1 p2 1 p3 R L
907 + * byte 1: f 0 th tw x9 x8 y9 y8
908 + */
909 fingers = ((packet[1] & 0x80) >> 7) +
910 ((packet[1] & 0x30) >> 4);
911 } else {
912 - /* byte 0: n1 n0 p2 p1 1 p3 R L
913 - byte 1: 0 0 0 0 x9 x8 y9 y8 */
914 + /*
915 + * byte 0: n1 n0 p2 p1 1 p3 R L
916 + * byte 1: 0 0 0 0 x9 x8 y9 y8
917 + */
918 fingers = (packet[0] & 0xc0) >> 6;
919 }
920
921 if (etd->jumpy_cursor) {
922 - /* Discard packets that are likely to have bogus coordinates */
923 - if (fingers > old_fingers) {
924 + if (fingers != 1) {
925 + etd->single_finger_reports = 0;
926 + } else if (etd->single_finger_reports < 2) {
927 + /* Discard first 2 reports of one finger, bogus */
928 + etd->single_finger_reports++;
929 elantech_debug("elantech.c: discarding packet\n");
930 - goto discard_packet_v1;
931 + return;
932 }
933 }
934
935 input_report_key(dev, BTN_TOUCH, fingers != 0);
936
937 - /* byte 2: x7 x6 x5 x4 x3 x2 x1 x0
938 - byte 3: y7 y6 y5 y4 y3 y2 y1 y0 */
939 + /*
940 + * byte 2: x7 x6 x5 x4 x3 x2 x1 x0
941 + * byte 3: y7 y6 y5 y4 y3 y2 y1 y0
942 + */
943 if (fingers) {
944 input_report_abs(dev, ABS_X,
945 ((packet[1] & 0x0c) << 6) | packet[2]);
946 - input_report_abs(dev, ABS_Y, ETP_YMAX_V1 -
947 - (((packet[1] & 0x03) << 8) | packet[3]));
948 + input_report_abs(dev, ABS_Y,
949 + ETP_YMAX_V1 - (((packet[1] & 0x03) << 8) | packet[3]));
950 }
951
952 input_report_key(dev, BTN_TOOL_FINGER, fingers == 1);
953 @@ -216,7 +228,7 @@ static void elantech_report_absolute_v1(struct psmouse *psmouse)
954 input_report_key(dev, BTN_LEFT, packet[0] & 0x01);
955 input_report_key(dev, BTN_RIGHT, packet[0] & 0x02);
956
957 - if ((etd->fw_version_maj == 0x01) &&
958 + if (etd->fw_version < 0x020000 &&
959 (etd->capabilities & ETP_CAP_HAS_ROCKER)) {
960 /* rocker up */
961 input_report_key(dev, BTN_FORWARD, packet[0] & 0x40);
962 @@ -225,9 +237,6 @@ static void elantech_report_absolute_v1(struct psmouse *psmouse)
963 }
964
965 input_sync(dev);
966 -
967 - discard_packet_v1:
968 - old_fingers = fingers;
969 }
970
971 /*
972 @@ -246,34 +255,47 @@ static void elantech_report_absolute_v2(struct psmouse *psmouse)
973
974 switch (fingers) {
975 case 1:
976 - /* byte 1: x15 x14 x13 x12 x11 x10 x9 x8
977 - byte 2: x7 x6 x5 x4 x4 x2 x1 x0 */
978 - input_report_abs(dev, ABS_X, (packet[1] << 8) | packet[2]);
979 - /* byte 4: y15 y14 y13 y12 y11 y10 y8 y8
980 - byte 5: y7 y6 y5 y4 y3 y2 y1 y0 */
981 - input_report_abs(dev, ABS_Y, ETP_YMAX_V2 -
982 - ((packet[4] << 8) | packet[5]));
983 + /*
984 + * byte 1: . . . . . x10 x9 x8
985 + * byte 2: x7 x6 x5 x4 x4 x2 x1 x0
986 + */
987 + input_report_abs(dev, ABS_X,
988 + ((packet[1] & 0x07) << 8) | packet[2]);
989 + /*
990 + * byte 4: . . . . . . y9 y8
991 + * byte 5: y7 y6 y5 y4 y3 y2 y1 y0
992 + */
993 + input_report_abs(dev, ABS_Y,
994 + ETP_YMAX_V2 - (((packet[4] & 0x03) << 8) | packet[5]));
995 break;
996
997 case 2:
998 - /* The coordinate of each finger is reported separately with
999 - a lower resolution for two finger touches */
1000 - /* byte 0: . . ay8 ax8 . . . .
1001 - byte 1: ax7 ax6 ax5 ax4 ax3 ax2 ax1 ax0 */
1002 + /*
1003 + * The coordinate of each finger is reported separately
1004 + * with a lower resolution for two finger touches:
1005 + * byte 0: . . ay8 ax8 . . . .
1006 + * byte 1: ax7 ax6 ax5 ax4 ax3 ax2 ax1 ax0
1007 + */
1008 x1 = ((packet[0] & 0x10) << 4) | packet[1];
1009 /* byte 2: ay7 ay6 ay5 ay4 ay3 ay2 ay1 ay0 */
1010 y1 = ETP_2FT_YMAX - (((packet[0] & 0x20) << 3) | packet[2]);
1011 - /* byte 3: . . by8 bx8 . . . .
1012 - byte 4: bx7 bx6 bx5 bx4 bx3 bx2 bx1 bx0 */
1013 + /*
1014 + * byte 3: . . by8 bx8 . . . .
1015 + * byte 4: bx7 bx6 bx5 bx4 bx3 bx2 bx1 bx0
1016 + */
1017 x2 = ((packet[3] & 0x10) << 4) | packet[4];
1018 /* byte 5: by7 by8 by5 by4 by3 by2 by1 by0 */
1019 y2 = ETP_2FT_YMAX - (((packet[3] & 0x20) << 3) | packet[5]);
1020 - /* For compatibility with the X Synaptics driver scale up one
1021 - coordinate and report as ordinary mouse movent */
1022 + /*
1023 + * For compatibility with the X Synaptics driver scale up
1024 + * one coordinate and report as ordinary mouse movent
1025 + */
1026 input_report_abs(dev, ABS_X, x1 << 2);
1027 input_report_abs(dev, ABS_Y, y1 << 2);
1028 - /* For compatibility with the proprietary X Elantech driver
1029 - report both coordinates as hat coordinates */
1030 + /*
1031 + * For compatibility with the proprietary X Elantech driver
1032 + * report both coordinates as hat coordinates
1033 + */
1034 input_report_abs(dev, ABS_HAT0X, x1);
1035 input_report_abs(dev, ABS_HAT0Y, y1);
1036 input_report_abs(dev, ABS_HAT1X, x2);
1037 @@ -297,7 +319,7 @@ static int elantech_check_parity_v1(struct psmouse *psmouse)
1038 unsigned char p1, p2, p3;
1039
1040 /* Parity bits are placed differently */
1041 - if (etd->fw_version_maj == 0x01) {
1042 + if (etd->fw_version < 0x020000) {
1043 /* byte 0: D U p1 p2 1 p3 R L */
1044 p1 = (packet[0] & 0x20) >> 5;
1045 p2 = (packet[0] & 0x10) >> 4;
1046 @@ -420,6 +442,7 @@ static void elantech_set_input_params(struct psmouse *psmouse)
1047
1048 __set_bit(EV_KEY, dev->evbit);
1049 __set_bit(EV_ABS, dev->evbit);
1050 + __clear_bit(EV_REL, dev->evbit);
1051
1052 __set_bit(BTN_LEFT, dev->keybit);
1053 __set_bit(BTN_RIGHT, dev->keybit);
1054 @@ -432,7 +455,7 @@ static void elantech_set_input_params(struct psmouse *psmouse)
1055 switch (etd->hw_version) {
1056 case 1:
1057 /* Rocker button */
1058 - if ((etd->fw_version_maj == 0x01) &&
1059 + if (etd->fw_version < 0x020000 &&
1060 (etd->capabilities & ETP_CAP_HAS_ROCKER)) {
1061 __set_bit(BTN_FORWARD, dev->keybit);
1062 __set_bit(BTN_BACK, dev->keybit);
1063 @@ -550,6 +573,24 @@ static struct attribute_group elantech_attr_group = {
1064 .attrs = elantech_attrs,
1065 };
1066
1067 +static bool elantech_is_signature_valid(const unsigned char *param)
1068 +{
1069 + static const unsigned char rates[] = { 200, 100, 80, 60, 40, 20, 10 };
1070 + int i;
1071 +
1072 + if (param[0] == 0)
1073 + return false;
1074 +
1075 + if (param[1] == 0)
1076 + return true;
1077 +
1078 + for (i = 0; i < ARRAY_SIZE(rates); i++)
1079 + if (param[2] == rates[i])
1080 + return false;
1081 +
1082 + return true;
1083 +}
1084 +
1085 /*
1086 * Use magic knock to detect Elantech touchpad
1087 */
1088 @@ -593,9 +634,13 @@ int elantech_detect(struct psmouse *psmouse, bool set_properties)
1089 pr_debug("elantech.c: Elantech version query result 0x%02x, 0x%02x, 0x%02x.\n",
1090 param[0], param[1], param[2]);
1091
1092 - if (param[0] == 0 || param[1] != 0) {
1093 - pr_debug("elantech.c: Probably not a real Elantech touchpad. Aborting.\n");
1094 - return -1;
1095 + if (!elantech_is_signature_valid(param)) {
1096 + if (!force_elantech) {
1097 + pr_debug("elantech.c: Probably not a real Elantech touchpad. Aborting.\n");
1098 + return -1;
1099 + }
1100 +
1101 + pr_debug("elantech.c: Probably not a real Elantech touchpad. Enabling anyway due to force_elantech.\n");
1102 }
1103
1104 if (set_properties) {
1105 @@ -657,14 +702,14 @@ int elantech_init(struct psmouse *psmouse)
1106 pr_err("elantech.c: failed to query firmware version.\n");
1107 goto init_fail;
1108 }
1109 - etd->fw_version_maj = param[0];
1110 - etd->fw_version_min = param[2];
1111 +
1112 + etd->fw_version = (param[0] << 16) | (param[1] << 8) | param[2];
1113
1114 /*
1115 * Assume every version greater than this is new EeePC style
1116 * hardware with 6 byte packets
1117 */
1118 - if (etd->fw_version_maj >= 0x02 && etd->fw_version_min >= 0x30) {
1119 + if (etd->fw_version >= 0x020030) {
1120 etd->hw_version = 2;
1121 /* For now show extra debug information */
1122 etd->debug = 1;
1123 @@ -674,8 +719,9 @@ int elantech_init(struct psmouse *psmouse)
1124 etd->hw_version = 1;
1125 etd->paritycheck = 1;
1126 }
1127 - pr_info("elantech.c: assuming hardware version %d, firmware version %d.%d\n",
1128 - etd->hw_version, etd->fw_version_maj, etd->fw_version_min);
1129 +
1130 + pr_info("elantech.c: assuming hardware version %d, firmware version %d.%d.%d\n",
1131 + etd->hw_version, param[0], param[1], param[2]);
1132
1133 if (synaptics_send_cmd(psmouse, ETP_CAPABILITIES_QUERY, param)) {
1134 pr_err("elantech.c: failed to query capabilities.\n");
1135 @@ -686,14 +732,14 @@ int elantech_init(struct psmouse *psmouse)
1136 etd->capabilities = param[0];
1137
1138 /*
1139 - * This firmware seems to suffer from misreporting coordinates when
1140 + * This firmware suffers from misreporting coordinates when
1141 * a touch action starts causing the mouse cursor or scrolled page
1142 * to jump. Enable a workaround.
1143 */
1144 - if (etd->fw_version_maj == 0x02 && etd->fw_version_min == 0x22) {
1145 - pr_info("elantech.c: firmware version 2.34 detected, "
1146 + if (etd->fw_version == 0x020022 || etd->fw_version == 0x020600) {
1147 + pr_info("elantech.c: firmware version 2.0.34/2.6.0 detected, "
1148 "enabling jumpy cursor workaround\n");
1149 - etd->jumpy_cursor = 1;
1150 + etd->jumpy_cursor = true;
1151 }
1152
1153 if (elantech_set_absolute_mode(psmouse)) {
1154 diff --git a/drivers/input/mouse/elantech.h b/drivers/input/mouse/elantech.h
1155 index feac5f7..aa4aac5 100644
1156 --- a/drivers/input/mouse/elantech.h
1157 +++ b/drivers/input/mouse/elantech.h
1158 @@ -100,11 +100,11 @@ struct elantech_data {
1159 unsigned char reg_26;
1160 unsigned char debug;
1161 unsigned char capabilities;
1162 - unsigned char fw_version_maj;
1163 - unsigned char fw_version_min;
1164 + bool paritycheck;
1165 + bool jumpy_cursor;
1166 unsigned char hw_version;
1167 - unsigned char paritycheck;
1168 - unsigned char jumpy_cursor;
1169 + unsigned int fw_version;
1170 + unsigned int single_finger_reports;
1171 unsigned char parity[256];
1172 };
1173
1174 diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
1175 index f4a6125..391f91a 100644
1176 --- a/drivers/input/mouse/synaptics.c
1177 +++ b/drivers/input/mouse/synaptics.c
1178 @@ -135,7 +135,8 @@ static int synaptics_capability(struct psmouse *psmouse)
1179 if (synaptics_send_cmd(psmouse, SYN_QUE_CAPABILITIES, cap))
1180 return -1;
1181 priv->capabilities = (cap[0] << 16) | (cap[1] << 8) | cap[2];
1182 - priv->ext_cap = 0;
1183 + priv->ext_cap = priv->ext_cap_0c = 0;
1184 +
1185 if (!SYN_CAP_VALID(priv->capabilities))
1186 return -1;
1187
1188 @@ -148,7 +149,7 @@ static int synaptics_capability(struct psmouse *psmouse)
1189 if (SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 1) {
1190 if (synaptics_send_cmd(psmouse, SYN_QUE_EXT_CAPAB, cap)) {
1191 printk(KERN_ERR "Synaptics claims to have extended capabilities,"
1192 - " but I'm not able to read them.");
1193 + " but I'm not able to read them.\n");
1194 } else {
1195 priv->ext_cap = (cap[0] << 16) | (cap[1] << 8) | cap[2];
1196
1197 @@ -160,6 +161,16 @@ static int synaptics_capability(struct psmouse *psmouse)
1198 priv->ext_cap &= 0xff0fff;
1199 }
1200 }
1201 +
1202 + if (SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 4) {
1203 + if (synaptics_send_cmd(psmouse, SYN_QUE_EXT_CAPAB_0C, cap)) {
1204 + printk(KERN_ERR "Synaptics claims to have extended capability 0x0c,"
1205 + " but I'm not able to read it.\n");
1206 + } else {
1207 + priv->ext_cap_0c = (cap[0] << 16) | (cap[1] << 8) | cap[2];
1208 + }
1209 + }
1210 +
1211 return 0;
1212 }
1213
1214 @@ -346,7 +357,15 @@ static void synaptics_parse_hw_state(unsigned char buf[], struct synaptics_data
1215 hw->left = (buf[0] & 0x01) ? 1 : 0;
1216 hw->right = (buf[0] & 0x02) ? 1 : 0;
1217
1218 - if (SYN_CAP_MIDDLE_BUTTON(priv->capabilities)) {
1219 + if (SYN_CAP_CLICKPAD(priv->ext_cap_0c)) {
1220 + /*
1221 + * Clickpad's button is transmitted as middle button,
1222 + * however, since it is primary button, we will report
1223 + * it as BTN_LEFT.
1224 + */
1225 + hw->left = ((buf[0] ^ buf[3]) & 0x01) ? 1 : 0;
1226 +
1227 + } else if (SYN_CAP_MIDDLE_BUTTON(priv->capabilities)) {
1228 hw->middle = ((buf[0] ^ buf[3]) & 0x01) ? 1 : 0;
1229 if (hw->w == 2)
1230 hw->scroll = (signed char)(buf[1]);
1231 @@ -591,6 +610,12 @@ static void set_input_params(struct input_dev *dev, struct synaptics_data *priv)
1232
1233 dev->absres[ABS_X] = priv->x_res;
1234 dev->absres[ABS_Y] = priv->y_res;
1235 +
1236 + if (SYN_CAP_CLICKPAD(priv->ext_cap_0c)) {
1237 + /* Clickpads report only left button */
1238 + __clear_bit(BTN_RIGHT, dev->keybit);
1239 + __clear_bit(BTN_MIDDLE, dev->keybit);
1240 + }
1241 }
1242
1243 static void synaptics_disconnect(struct psmouse *psmouse)
1244 @@ -689,10 +714,10 @@ int synaptics_init(struct psmouse *psmouse)
1245
1246 priv->pkt_type = SYN_MODEL_NEWABS(priv->model_id) ? SYN_NEWABS : SYN_OLDABS;
1247
1248 - printk(KERN_INFO "Synaptics Touchpad, model: %ld, fw: %ld.%ld, id: %#lx, caps: %#lx/%#lx\n",
1249 + printk(KERN_INFO "Synaptics Touchpad, model: %ld, fw: %ld.%ld, id: %#lx, caps: %#lx/%#lx/%#lx\n",
1250 SYN_ID_MODEL(priv->identity),
1251 SYN_ID_MAJOR(priv->identity), SYN_ID_MINOR(priv->identity),
1252 - priv->model_id, priv->capabilities, priv->ext_cap);
1253 + priv->model_id, priv->capabilities, priv->ext_cap, priv->ext_cap_0c);
1254
1255 set_input_params(psmouse->dev, priv);
1256
1257 diff --git a/drivers/input/mouse/synaptics.h b/drivers/input/mouse/synaptics.h
1258 index 871f6fe..c197d94 100644
1259 --- a/drivers/input/mouse/synaptics.h
1260 +++ b/drivers/input/mouse/synaptics.h
1261 @@ -18,6 +18,7 @@
1262 #define SYN_QUE_SERIAL_NUMBER_SUFFIX 0x07
1263 #define SYN_QUE_RESOLUTION 0x08
1264 #define SYN_QUE_EXT_CAPAB 0x09
1265 +#define SYN_QUE_EXT_CAPAB_0C 0x0c
1266
1267 /* synatics modes */
1268 #define SYN_BIT_ABSOLUTE_MODE (1 << 7)
1269 @@ -48,6 +49,8 @@
1270 #define SYN_CAP_VALID(c) ((((c) & 0x00ff00) >> 8) == 0x47)
1271 #define SYN_EXT_CAP_REQUESTS(c) (((c) & 0x700000) >> 20)
1272 #define SYN_CAP_MULTI_BUTTON_NO(ec) (((ec) & 0x00f000) >> 12)
1273 +#define SYN_CAP_PRODUCT_ID(ec) (((ec) & 0xff0000) >> 16)
1274 +#define SYN_CAP_CLICKPAD(ex0c) ((ex0c) & 0x100100)
1275
1276 /* synaptics modes query bits */
1277 #define SYN_MODE_ABSOLUTE(m) ((m) & (1 << 7))
1278 @@ -96,6 +99,7 @@ struct synaptics_data {
1279 unsigned long int model_id; /* Model-ID */
1280 unsigned long int capabilities; /* Capabilities */
1281 unsigned long int ext_cap; /* Extended Capabilities */
1282 + unsigned long int ext_cap_0c; /* Ext Caps from 0x0c query */
1283 unsigned long int identity; /* Identification */
1284 int x_res; /* X resolution in units/mm */
1285 int y_res; /* Y resolution in units/mm */
1286 diff --git a/drivers/input/xen-kbdfront.c b/drivers/input/xen-kbdfront.c
1287 index eb88f40..480d5d2 100644
1288 --- a/drivers/input/xen-kbdfront.c
1289 +++ b/drivers/input/xen-kbdfront.c
1290 @@ -281,7 +281,7 @@ static void xenkbd_backend_changed(struct xenbus_device *dev,
1291 enum xenbus_state backend_state)
1292 {
1293 struct xenkbd_info *info = dev_get_drvdata(&dev->dev);
1294 - int val;
1295 + int ret, val;
1296
1297 switch (backend_state) {
1298 case XenbusStateInitialising:
1299 @@ -292,6 +292,16 @@ static void xenkbd_backend_changed(struct xenbus_device *dev,
1300
1301 case XenbusStateInitWait:
1302 InitWait:
1303 + ret = xenbus_scanf(XBT_NIL, info->xbdev->otherend,
1304 + "feature-abs-pointer", "%d", &val);
1305 + if (ret < 0)
1306 + val = 0;
1307 + if (val) {
1308 + ret = xenbus_printf(XBT_NIL, info->xbdev->nodename,
1309 + "request-abs-pointer", "1");
1310 + if (ret)
1311 + pr_warning("can't request abs-pointer\n");
1312 + }
1313 xenbus_switch_state(dev, XenbusStateConnected);
1314 break;
1315
1316 diff --git a/drivers/media/dvb/b2c2/flexcop-pci.c b/drivers/media/dvb/b2c2/flexcop-pci.c
1317 index 227c020..4f3e3ce 100644
1318 --- a/drivers/media/dvb/b2c2/flexcop-pci.c
1319 +++ b/drivers/media/dvb/b2c2/flexcop-pci.c
1320 @@ -38,7 +38,7 @@ MODULE_PARM_DESC(debug,
1321 DEBSTATUS);
1322
1323 #define DRIVER_VERSION "0.1"
1324 -#define DRIVER_NAME "Technisat/B2C2 FlexCop II/IIb/III Digital TV PCI Driver"
1325 +#define DRIVER_NAME "flexcop-pci"
1326 #define DRIVER_AUTHOR "Patrick Boettcher <patrick.boettcher@desy.de>"
1327
1328 struct flexcop_pci {
1329 diff --git a/drivers/media/dvb/dvb-usb/dib0700_devices.c b/drivers/media/dvb/dvb-usb/dib0700_devices.c
1330 index 6bd8951..524acf5 100644
1331 --- a/drivers/media/dvb/dvb-usb/dib0700_devices.c
1332 +++ b/drivers/media/dvb/dvb-usb/dib0700_devices.c
1333 @@ -874,6 +874,43 @@ static struct dvb_usb_rc_key dib0700_rc_keys[] = {
1334 { 0x1d37, KEY_RECORD },
1335 { 0x1d3b, KEY_GOTO },
1336 { 0x1d3d, KEY_POWER },
1337 +
1338 + /* Key codes for the Elgato EyeTV Diversity silver remote,
1339 + set dvb_usb_dib0700_ir_proto=0 */
1340 + { 0x4501, KEY_POWER },
1341 + { 0x4502, KEY_MUTE },
1342 + { 0x4503, KEY_1 },
1343 + { 0x4504, KEY_2 },
1344 + { 0x4505, KEY_3 },
1345 + { 0x4506, KEY_4 },
1346 + { 0x4507, KEY_5 },
1347 + { 0x4508, KEY_6 },
1348 + { 0x4509, KEY_7 },
1349 + { 0x450a, KEY_8 },
1350 + { 0x450b, KEY_9 },
1351 + { 0x450c, KEY_LAST },
1352 + { 0x450d, KEY_0 },
1353 + { 0x450e, KEY_ENTER },
1354 + { 0x450f, KEY_RED },
1355 + { 0x4510, KEY_CHANNELUP },
1356 + { 0x4511, KEY_GREEN },
1357 + { 0x4512, KEY_VOLUMEDOWN },
1358 + { 0x4513, KEY_OK },
1359 + { 0x4514, KEY_VOLUMEUP },
1360 + { 0x4515, KEY_YELLOW },
1361 + { 0x4516, KEY_CHANNELDOWN },
1362 + { 0x4517, KEY_BLUE },
1363 + { 0x4518, KEY_LEFT }, /* Skip backwards */
1364 + { 0x4519, KEY_PLAYPAUSE },
1365 + { 0x451a, KEY_RIGHT }, /* Skip forward */
1366 + { 0x451b, KEY_REWIND },
1367 + { 0x451c, KEY_L }, /* Live */
1368 + { 0x451d, KEY_FASTFORWARD },
1369 + { 0x451e, KEY_STOP }, /* 'Reveal' for Teletext */
1370 + { 0x451f, KEY_MENU }, /* KEY_TEXT for Teletext */
1371 + { 0x4540, KEY_RECORD }, /* Font 'Size' for Teletext */
1372 + { 0x4541, KEY_SCREEN }, /* Full screen toggle, 'Hold' for Teletext */
1373 + { 0x4542, KEY_SELECT }, /* Select video input, 'Select' for Teletext */
1374 };
1375
1376 /* STK7700P: Hauppauge Nova-T Stick, AVerMedia Volar */
1377 @@ -1861,6 +1898,7 @@ struct usb_device_id dib0700_usb_id_table[] = {
1378 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK807XPVR) },
1379 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK807XP) },
1380 { USB_DEVICE(USB_VID_PIXELVIEW, USB_PID_PIXELVIEW_SBTVD) },
1381 + { USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_DIVERSITY) },
1382 { 0 } /* Terminating entry */
1383 };
1384 MODULE_DEVICE_TABLE(usb, dib0700_usb_id_table);
1385 @@ -2173,7 +2211,7 @@ struct dvb_usb_device_properties dib0700_devices[] = {
1386 }
1387 },
1388
1389 - .num_device_descs = 6,
1390 + .num_device_descs = 7,
1391 .devices = {
1392 { "DiBcom STK7070PD reference design",
1393 { &dib0700_usb_id_table[17], NULL },
1394 @@ -2199,7 +2237,11 @@ struct dvb_usb_device_properties dib0700_devices[] = {
1395 { "Sony PlayTV",
1396 { &dib0700_usb_id_table[44], NULL },
1397 { NULL },
1398 - }
1399 + },
1400 + { "Elgato EyeTV Diversity",
1401 + { &dib0700_usb_id_table[64], NULL },
1402 + { NULL },
1403 + },
1404 },
1405 .rc_interval = DEFAULT_RC_INTERVAL,
1406 .rc_key_map = dib0700_rc_keys,
1407 diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h
1408 index a548c14..a7ae7b6 100644
1409 --- a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h
1410 +++ b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h
1411 @@ -271,6 +271,7 @@
1412 #define USB_PID_TELESTAR_STARSTICK_2 0x8000
1413 #define USB_PID_MSI_DIGI_VOX_MINI_III 0x8807
1414 #define USB_PID_SONY_PLAYTV 0x0003
1415 +#define USB_PID_ELGATO_EYETV_DIVERSITY 0x0011
1416 #define USB_PID_ELGATO_EYETV_DTT 0x0021
1417 #define USB_PID_ELGATO_EYETV_DTT_Dlx 0x0020
1418 #define USB_PID_DVB_T_USB_STICK_HIGH_SPEED_COLD 0x5000
1419 diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
1420 index 7dab2e5..f3320f2 100644
1421 --- a/drivers/mmc/core/core.c
1422 +++ b/drivers/mmc/core/core.c
1423 @@ -1041,6 +1041,17 @@ void mmc_rescan(struct work_struct *work)
1424 container_of(work, struct mmc_host, detect.work);
1425 u32 ocr;
1426 int err;
1427 + unsigned long flags;
1428 +
1429 + spin_lock_irqsave(&host->lock, flags);
1430 +
1431 + if (host->rescan_disable) {
1432 + spin_unlock_irqrestore(&host->lock, flags);
1433 + return;
1434 + }
1435 +
1436 + spin_unlock_irqrestore(&host->lock, flags);
1437 +
1438
1439 mmc_bus_get(host);
1440
1441 @@ -1247,18 +1258,6 @@ int mmc_suspend_host(struct mmc_host *host, pm_message_t state)
1442 if (host->bus_ops && !host->bus_dead) {
1443 if (host->bus_ops->suspend)
1444 err = host->bus_ops->suspend(host);
1445 - if (err == -ENOSYS || !host->bus_ops->resume) {
1446 - /*
1447 - * We simply "remove" the card in this case.
1448 - * It will be redetected on resume.
1449 - */
1450 - if (host->bus_ops->remove)
1451 - host->bus_ops->remove(host);
1452 - mmc_claim_host(host);
1453 - mmc_detach_bus(host);
1454 - mmc_release_host(host);
1455 - err = 0;
1456 - }
1457 }
1458 mmc_bus_put(host);
1459
1460 @@ -1288,28 +1287,60 @@ int mmc_resume_host(struct mmc_host *host)
1461 printk(KERN_WARNING "%s: error %d during resume "
1462 "(card was removed?)\n",
1463 mmc_hostname(host), err);
1464 - if (host->bus_ops->remove)
1465 - host->bus_ops->remove(host);
1466 - mmc_claim_host(host);
1467 - mmc_detach_bus(host);
1468 - mmc_release_host(host);
1469 - /* no need to bother upper layers */
1470 err = 0;
1471 }
1472 }
1473 mmc_bus_put(host);
1474
1475 - /*
1476 - * We add a slight delay here so that resume can progress
1477 - * in parallel.
1478 - */
1479 - mmc_detect_change(host, 1);
1480 -
1481 return err;
1482 }
1483 -
1484 EXPORT_SYMBOL(mmc_resume_host);
1485
1486 +/* Do the card removal on suspend if card is assumed removeable
1487 + * Do that in pm notifier while userspace isn't yet frozen, so we will be able
1488 + to sync the card.
1489 +*/
1490 +int mmc_pm_notify(struct notifier_block *notify_block,
1491 + unsigned long mode, void *unused)
1492 +{
1493 + struct mmc_host *host = container_of(
1494 + notify_block, struct mmc_host, pm_notify);
1495 + unsigned long flags;
1496 +
1497 +
1498 + switch (mode) {
1499 + case PM_HIBERNATION_PREPARE:
1500 + case PM_SUSPEND_PREPARE:
1501 +
1502 + spin_lock_irqsave(&host->lock, flags);
1503 + host->rescan_disable = 1;
1504 + spin_unlock_irqrestore(&host->lock, flags);
1505 + cancel_delayed_work_sync(&host->detect);
1506 +
1507 + if (!host->bus_ops || host->bus_ops->suspend)
1508 + break;
1509 +
1510 + mmc_claim_host(host);
1511 +
1512 + if (host->bus_ops->remove)
1513 + host->bus_ops->remove(host);
1514 +
1515 + mmc_detach_bus(host);
1516 + mmc_release_host(host);
1517 + break;
1518 +
1519 + case PM_POST_SUSPEND:
1520 + case PM_POST_HIBERNATION:
1521 +
1522 + spin_lock_irqsave(&host->lock, flags);
1523 + host->rescan_disable = 0;
1524 + spin_unlock_irqrestore(&host->lock, flags);
1525 + mmc_detect_change(host, 0);
1526 +
1527 + }
1528 +
1529 + return 0;
1530 +}
1531 #endif
1532
1533 static int __init mmc_init(void)
1534 diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
1535 index a268d12..bc875cd 100644
1536 --- a/drivers/mmc/core/host.c
1537 +++ b/drivers/mmc/core/host.c
1538 @@ -16,6 +16,7 @@
1539 #include <linux/idr.h>
1540 #include <linux/pagemap.h>
1541 #include <linux/leds.h>
1542 +#include <linux/suspend.h>
1543
1544 #include <linux/mmc/host.h>
1545
1546 @@ -84,6 +85,9 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *dev)
1547 init_waitqueue_head(&host->wq);
1548 INIT_DELAYED_WORK(&host->detect, mmc_rescan);
1549 INIT_DELAYED_WORK_DEFERRABLE(&host->disable, mmc_host_deeper_disable);
1550 +#ifdef CONFIG_PM
1551 + host->pm_notify.notifier_call = mmc_pm_notify;
1552 +#endif
1553
1554 /*
1555 * By default, hosts do not support SGIO or large requests.
1556 @@ -132,6 +136,7 @@ int mmc_add_host(struct mmc_host *host)
1557 #endif
1558
1559 mmc_start_host(host);
1560 + register_pm_notifier(&host->pm_notify);
1561
1562 return 0;
1563 }
1564 @@ -148,6 +153,7 @@ EXPORT_SYMBOL(mmc_add_host);
1565 */
1566 void mmc_remove_host(struct mmc_host *host)
1567 {
1568 + unregister_pm_notifier(&host->pm_notify);
1569 mmc_stop_host(host);
1570
1571 #ifdef CONFIG_DEBUG_FS
1572 diff --git a/drivers/mmc/host/sdhci-pci.c b/drivers/mmc/host/sdhci-pci.c
1573 index e035664..6fd20b42 100644
1574 --- a/drivers/mmc/host/sdhci-pci.c
1575 +++ b/drivers/mmc/host/sdhci-pci.c
1576 @@ -569,6 +569,7 @@ static struct sdhci_pci_slot * __devinit sdhci_pci_probe_slot(
1577 host->ioaddr = pci_ioremap_bar(pdev, bar);
1578 if (!host->ioaddr) {
1579 dev_err(&pdev->dev, "failed to remap registers\n");
1580 + ret = -ENOMEM;
1581 goto release;
1582 }
1583
1584 diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
1585 index c279fbc..e6c65a7 100644
1586 --- a/drivers/mmc/host/sdhci.c
1587 +++ b/drivers/mmc/host/sdhci.c
1588 @@ -1266,6 +1266,13 @@ static void sdhci_tasklet_finish(unsigned long param)
1589
1590 host = (struct sdhci_host*)param;
1591
1592 + /*
1593 + * If this tasklet gets rescheduled while running, it will
1594 + * be run again afterwards but without any active request.
1595 + */
1596 + if (!host->mrq)
1597 + return;
1598 +
1599 spin_lock_irqsave(&host->lock, flags);
1600
1601 del_timer(&host->timer);
1602 @@ -1277,7 +1284,7 @@ static void sdhci_tasklet_finish(unsigned long param)
1603 * upon error conditions.
1604 */
1605 if (!(host->flags & SDHCI_DEVICE_DEAD) &&
1606 - (mrq->cmd->error ||
1607 + ((mrq->cmd && mrq->cmd->error) ||
1608 (mrq->data && (mrq->data->error ||
1609 (mrq->data->stop && mrq->data->stop->error))) ||
1610 (host->quirks & SDHCI_QUIRK_RESET_AFTER_REQUEST))) {
1611 diff --git a/drivers/net/atl1c/atl1c_main.c b/drivers/net/atl1c/atl1c_main.c
1612 index be00ee9..77d9f3d 100644
1613 --- a/drivers/net/atl1c/atl1c_main.c
1614 +++ b/drivers/net/atl1c/atl1c_main.c
1615 @@ -1976,8 +1976,6 @@ static void atl1c_tx_map(struct atl1c_adapter *adapter,
1616 else {
1617 use_tpd = atl1c_get_tpd(adapter, type);
1618 memcpy(use_tpd, tpd, sizeof(struct atl1c_tpd_desc));
1619 - use_tpd = atl1c_get_tpd(adapter, type);
1620 - memcpy(use_tpd, tpd, sizeof(struct atl1c_tpd_desc));
1621 }
1622 buffer_info = atl1c_get_tx_buffer(adapter, use_tpd);
1623 buffer_info->length = buf_len - mapped_len;
1624 diff --git a/drivers/net/bnx2x_main.c b/drivers/net/bnx2x_main.c
1625 index 20f0ed9..96b17de 100644
1626 --- a/drivers/net/bnx2x_main.c
1627 +++ b/drivers/net/bnx2x_main.c
1628 @@ -49,6 +49,7 @@
1629 #include <linux/prefetch.h>
1630 #include <linux/zlib.h>
1631 #include <linux/io.h>
1632 +#include <linux/stringify.h>
1633
1634
1635 #include "bnx2x.h"
1636 @@ -63,8 +64,13 @@
1637 #include <linux/firmware.h>
1638 #include "bnx2x_fw_file_hdr.h"
1639 /* FW files */
1640 -#define FW_FILE_PREFIX_E1 "bnx2x-e1-"
1641 -#define FW_FILE_PREFIX_E1H "bnx2x-e1h-"
1642 +#define FW_FILE_VERSION \
1643 + __stringify(BCM_5710_FW_MAJOR_VERSION) "." \
1644 + __stringify(BCM_5710_FW_MINOR_VERSION) "." \
1645 + __stringify(BCM_5710_FW_REVISION_VERSION) "." \
1646 + __stringify(BCM_5710_FW_ENGINEERING_VERSION)
1647 +#define FW_FILE_NAME_E1 "bnx2x-e1-" FW_FILE_VERSION ".fw"
1648 +#define FW_FILE_NAME_E1H "bnx2x-e1h-" FW_FILE_VERSION ".fw"
1649
1650 /* Time in jiffies before concluding the transmitter is hung */
1651 #define TX_TIMEOUT (5*HZ)
1652 @@ -77,6 +83,8 @@ MODULE_AUTHOR("Eliezer Tamir");
1653 MODULE_DESCRIPTION("Broadcom NetXtreme II BCM57710/57711/57711E Driver");
1654 MODULE_LICENSE("GPL");
1655 MODULE_VERSION(DRV_MODULE_VERSION);
1656 +MODULE_FIRMWARE(FW_FILE_NAME_E1);
1657 +MODULE_FIRMWARE(FW_FILE_NAME_E1H);
1658
1659 static int multi_mode = 1;
1660 module_param(multi_mode, int, 0);
1661 @@ -11830,21 +11838,14 @@ static inline void be16_to_cpu_n(const u8 *_source, u8 *_target, u32 n)
1662
1663 static int __devinit bnx2x_init_firmware(struct bnx2x *bp, struct device *dev)
1664 {
1665 - char fw_file_name[40] = {0};
1666 + const char *fw_file_name;
1667 struct bnx2x_fw_file_hdr *fw_hdr;
1668 - int rc, offset;
1669 + int rc;
1670
1671 - /* Create a FW file name */
1672 if (CHIP_IS_E1(bp))
1673 - offset = sprintf(fw_file_name, FW_FILE_PREFIX_E1);
1674 + fw_file_name = FW_FILE_NAME_E1;
1675 else
1676 - offset = sprintf(fw_file_name, FW_FILE_PREFIX_E1H);
1677 -
1678 - sprintf(fw_file_name + offset, "%d.%d.%d.%d.fw",
1679 - BCM_5710_FW_MAJOR_VERSION,
1680 - BCM_5710_FW_MINOR_VERSION,
1681 - BCM_5710_FW_REVISION_VERSION,
1682 - BCM_5710_FW_ENGINEERING_VERSION);
1683 + fw_file_name = FW_FILE_NAME_E1H;
1684
1685 printk(KERN_INFO PFX "Loading %s\n", fw_file_name);
1686
1687 diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
1688 index d3854ac..223990d 100644
1689 --- a/drivers/net/bonding/bond_3ad.c
1690 +++ b/drivers/net/bonding/bond_3ad.c
1691 @@ -2451,6 +2451,10 @@ int bond_3ad_lacpdu_recv(struct sk_buff *skb, struct net_device *dev, struct pac
1692 if (!(dev->flags & IFF_MASTER))
1693 goto out;
1694
1695 + skb = skb_share_check(skb, GFP_ATOMIC);
1696 + if (!skb)
1697 + goto out;
1698 +
1699 if (!pskb_may_pull(skb, sizeof(struct lacpdu)))
1700 goto out;
1701
1702 diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c
1703 index 7114375..36a7ac8 100644
1704 --- a/drivers/net/bonding/bond_alb.c
1705 +++ b/drivers/net/bonding/bond_alb.c
1706 @@ -370,6 +370,10 @@ static int rlb_arp_recv(struct sk_buff *skb, struct net_device *bond_dev, struct
1707 goto out;
1708 }
1709
1710 + skb = skb_share_check(skb, GFP_ATOMIC);
1711 + if (!skb)
1712 + goto out;
1713 +
1714 if (!pskb_may_pull(skb, arp_hdr_len(bond_dev)))
1715 goto out;
1716
1717 diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
1718 index 40fb5ee..6ffbfb7 100644
1719 --- a/drivers/net/bonding/bond_main.c
1720 +++ b/drivers/net/bonding/bond_main.c
1721 @@ -2692,6 +2692,10 @@ static int bond_arp_rcv(struct sk_buff *skb, struct net_device *dev, struct pack
1722 if (!slave || !slave_do_arp_validate(bond, slave))
1723 goto out_unlock;
1724
1725 + skb = skb_share_check(skb, GFP_ATOMIC);
1726 + if (!skb)
1727 + goto out_unlock;
1728 +
1729 if (!pskb_may_pull(skb, arp_hdr_len(dev)))
1730 goto out_unlock;
1731
1732 diff --git a/drivers/net/cxgb3/common.h b/drivers/net/cxgb3/common.h
1733 index 1b2c305..6ff356d 100644
1734 --- a/drivers/net/cxgb3/common.h
1735 +++ b/drivers/net/cxgb3/common.h
1736 @@ -125,11 +125,9 @@ enum { /* adapter interrupt-maintained statistics */
1737 IRQ_NUM_STATS /* keep last */
1738 };
1739
1740 -enum {
1741 - TP_VERSION_MAJOR = 1,
1742 - TP_VERSION_MINOR = 1,
1743 - TP_VERSION_MICRO = 0
1744 -};
1745 +#define TP_VERSION_MAJOR 1
1746 +#define TP_VERSION_MINOR 1
1747 +#define TP_VERSION_MICRO 0
1748
1749 #define S_TP_VERSION_MAJOR 16
1750 #define M_TP_VERSION_MAJOR 0xFF
1751 diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
1752 index 2b378e7..1f9a06f 100644
1753 --- a/drivers/net/cxgb3/cxgb3_main.c
1754 +++ b/drivers/net/cxgb3/cxgb3_main.c
1755 @@ -44,6 +44,7 @@
1756 #include <linux/rtnetlink.h>
1757 #include <linux/firmware.h>
1758 #include <linux/log2.h>
1759 +#include <linux/stringify.h>
1760 #include <asm/uaccess.h>
1761
1762 #include "common.h"
1763 @@ -989,11 +990,21 @@ static int bind_qsets(struct adapter *adap)
1764 return err;
1765 }
1766
1767 -#define FW_FNAME "cxgb3/t3fw-%d.%d.%d.bin"
1768 -#define TPSRAM_NAME "cxgb3/t3%c_psram-%d.%d.%d.bin"
1769 +#define FW_VERSION __stringify(FW_VERSION_MAJOR) "." \
1770 + __stringify(FW_VERSION_MINOR) "." __stringify(FW_VERSION_MICRO)
1771 +#define FW_FNAME "cxgb3/t3fw-" FW_VERSION ".bin"
1772 +#define TPSRAM_VERSION __stringify(TP_VERSION_MAJOR) "." \
1773 + __stringify(TP_VERSION_MINOR) "." __stringify(TP_VERSION_MICRO)
1774 +#define TPSRAM_NAME "cxgb3/t3%c_psram-" TPSRAM_VERSION ".bin"
1775 #define AEL2005_OPT_EDC_NAME "cxgb3/ael2005_opt_edc.bin"
1776 #define AEL2005_TWX_EDC_NAME "cxgb3/ael2005_twx_edc.bin"
1777 #define AEL2020_TWX_EDC_NAME "cxgb3/ael2020_twx_edc.bin"
1778 +MODULE_FIRMWARE(FW_FNAME);
1779 +MODULE_FIRMWARE("cxgb3/t3b_psram-" TPSRAM_VERSION ".bin");
1780 +MODULE_FIRMWARE("cxgb3/t3c_psram-" TPSRAM_VERSION ".bin");
1781 +MODULE_FIRMWARE(AEL2005_OPT_EDC_NAME);
1782 +MODULE_FIRMWARE(AEL2005_TWX_EDC_NAME);
1783 +MODULE_FIRMWARE(AEL2020_TWX_EDC_NAME);
1784
1785 static inline const char *get_edc_fw_name(int edc_idx)
1786 {
1787 @@ -1064,16 +1075,13 @@ int t3_get_edc_fw(struct cphy *phy, int edc_idx, int size)
1788 static int upgrade_fw(struct adapter *adap)
1789 {
1790 int ret;
1791 - char buf[64];
1792 const struct firmware *fw;
1793 struct device *dev = &adap->pdev->dev;
1794
1795 - snprintf(buf, sizeof(buf), FW_FNAME, FW_VERSION_MAJOR,
1796 - FW_VERSION_MINOR, FW_VERSION_MICRO);
1797 - ret = request_firmware(&fw, buf, dev);
1798 + ret = request_firmware(&fw, FW_FNAME, dev);
1799 if (ret < 0) {
1800 dev_err(dev, "could not upgrade firmware: unable to load %s\n",
1801 - buf);
1802 + FW_FNAME);
1803 return ret;
1804 }
1805 ret = t3_load_fw(adap, fw->data, fw->size);
1806 @@ -1117,8 +1125,7 @@ static int update_tpsram(struct adapter *adap)
1807 if (!rev)
1808 return 0;
1809
1810 - snprintf(buf, sizeof(buf), TPSRAM_NAME, rev,
1811 - TP_VERSION_MAJOR, TP_VERSION_MINOR, TP_VERSION_MICRO);
1812 + snprintf(buf, sizeof(buf), TPSRAM_NAME, rev);
1813
1814 ret = request_firmware(&tpsram, buf, dev);
1815 if (ret < 0) {
1816 diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
1817 index 1a23f16..4079a33 100644
1818 --- a/drivers/net/e1000/e1000_main.c
1819 +++ b/drivers/net/e1000/e1000_main.c
1820 @@ -790,6 +790,70 @@ static const struct net_device_ops e1000_netdev_ops = {
1821 };
1822
1823 /**
1824 + * e1000_init_hw_struct - initialize members of hw struct
1825 + * @adapter: board private struct
1826 + * @hw: structure used by e1000_hw.c
1827 + *
1828 + * Factors out initialization of the e1000_hw struct to its own function
1829 + * that can be called very early at init (just after struct allocation).
1830 + * Fields are initialized based on PCI device information and
1831 + * OS network device settings (MTU size).
1832 + * Returns negative error codes if MAC type setup fails.
1833 + */
1834 +static int e1000_init_hw_struct(struct e1000_adapter *adapter,
1835 + struct e1000_hw *hw)
1836 +{
1837 + struct pci_dev *pdev = adapter->pdev;
1838 +
1839 + /* PCI config space info */
1840 + hw->vendor_id = pdev->vendor;
1841 + hw->device_id = pdev->device;
1842 + hw->subsystem_vendor_id = pdev->subsystem_vendor;
1843 + hw->subsystem_id = pdev->subsystem_device;
1844 + hw->revision_id = pdev->revision;
1845 +
1846 + pci_read_config_word(pdev, PCI_COMMAND, &hw->pci_cmd_word);
1847 +
1848 + hw->max_frame_size = adapter->netdev->mtu +
1849 + ENET_HEADER_SIZE + ETHERNET_FCS_SIZE;
1850 + hw->min_frame_size = MINIMUM_ETHERNET_FRAME_SIZE;
1851 +
1852 + /* identify the MAC */
1853 + if (e1000_set_mac_type(hw)) {
1854 + DPRINTK(PROBE, ERR, "Unknown MAC Type\n");
1855 + return -EIO;
1856 + }
1857 +
1858 + switch (hw->mac_type) {
1859 + default:
1860 + break;
1861 + case e1000_82541:
1862 + case e1000_82547:
1863 + case e1000_82541_rev_2:
1864 + case e1000_82547_rev_2:
1865 + hw->phy_init_script = 1;
1866 + break;
1867 + }
1868 +
1869 + e1000_set_media_type(hw);
1870 + e1000_get_bus_info(hw);
1871 +
1872 + hw->wait_autoneg_complete = false;
1873 + hw->tbi_compatibility_en = true;
1874 + hw->adaptive_ifs = true;
1875 +
1876 + /* Copper options */
1877 +
1878 + if (hw->media_type == e1000_media_type_copper) {
1879 + hw->mdix = AUTO_ALL_MODES;
1880 + hw->disable_polarity_correction = false;
1881 + hw->master_slave = E1000_MASTER_SLAVE;
1882 + }
1883 +
1884 + return 0;
1885 +}
1886 +
1887 +/**
1888 * e1000_probe - Device Initialization Routine
1889 * @pdev: PCI device information struct
1890 * @ent: entry in e1000_pci_tbl
1891 @@ -826,22 +890,6 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
1892 if (err)
1893 return err;
1894
1895 - if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) &&
1896 - !pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64))) {
1897 - pci_using_dac = 1;
1898 - } else {
1899 - err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
1900 - if (err) {
1901 - err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
1902 - if (err) {
1903 - E1000_ERR("No usable DMA configuration, "
1904 - "aborting\n");
1905 - goto err_dma;
1906 - }
1907 - }
1908 - pci_using_dac = 0;
1909 - }
1910 -
1911 err = pci_request_selected_regions(pdev, bars, e1000_driver_name);
1912 if (err)
1913 goto err_pci_reg;
1914 @@ -882,6 +930,32 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
1915 }
1916 }
1917
1918 + /* make ready for any if (hw->...) below */
1919 + err = e1000_init_hw_struct(adapter, hw);
1920 + if (err)
1921 + goto err_sw_init;
1922 +
1923 + /*
1924 + * there is a workaround being applied below that limits
1925 + * 64-bit DMA addresses to 64-bit hardware. There are some
1926 + * 32-bit adapters that Tx hang when given 64-bit DMA addresses
1927 + */
1928 + pci_using_dac = 0;
1929 + if ((hw->bus_type == e1000_bus_type_pcix) &&
1930 + !pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) {
1931 + /*
1932 + * according to DMA-API-HOWTO, coherent calls will always
1933 + * succeed if the set call did
1934 + */
1935 + pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64));
1936 + pci_using_dac = 1;
1937 + } else if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) {
1938 + pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
1939 + } else {
1940 + E1000_ERR("No usable DMA configuration, aborting\n");
1941 + goto err_dma;
1942 + }
1943 +
1944 netdev->netdev_ops = &e1000_netdev_ops;
1945 e1000_set_ethtool_ops(netdev);
1946 netdev->watchdog_timeo = 5 * HZ;
1947 @@ -956,8 +1030,6 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
1948 if (!is_valid_ether_addr(netdev->perm_addr))
1949 DPRINTK(PROBE, ERR, "Invalid MAC Address\n");
1950
1951 - e1000_get_bus_info(hw);
1952 -
1953 init_timer(&adapter->tx_fifo_stall_timer);
1954 adapter->tx_fifo_stall_timer.function = &e1000_82547_tx_fifo_stall;
1955 adapter->tx_fifo_stall_timer.data = (unsigned long)adapter;
1956 @@ -1070,6 +1142,7 @@ err_eeprom:
1957 iounmap(hw->flash_address);
1958 kfree(adapter->tx_ring);
1959 kfree(adapter->rx_ring);
1960 +err_dma:
1961 err_sw_init:
1962 iounmap(hw->hw_addr);
1963 err_ioremap:
1964 @@ -1077,7 +1150,6 @@ err_ioremap:
1965 err_alloc_etherdev:
1966 pci_release_selected_regions(pdev, bars);
1967 err_pci_reg:
1968 -err_dma:
1969 pci_disable_device(pdev);
1970 return err;
1971 }
1972 @@ -1129,62 +1201,12 @@ static void __devexit e1000_remove(struct pci_dev *pdev)
1973 * @adapter: board private structure to initialize
1974 *
1975 * e1000_sw_init initializes the Adapter private data structure.
1976 - * Fields are initialized based on PCI device information and
1977 - * OS network device settings (MTU size).
1978 + * e1000_init_hw_struct MUST be called before this function
1979 **/
1980
1981 static int __devinit e1000_sw_init(struct e1000_adapter *adapter)
1982 {
1983 - struct e1000_hw *hw = &adapter->hw;
1984 - struct net_device *netdev = adapter->netdev;
1985 - struct pci_dev *pdev = adapter->pdev;
1986 -
1987 - /* PCI config space info */
1988 -
1989 - hw->vendor_id = pdev->vendor;
1990 - hw->device_id = pdev->device;
1991 - hw->subsystem_vendor_id = pdev->subsystem_vendor;
1992 - hw->subsystem_id = pdev->subsystem_device;
1993 - hw->revision_id = pdev->revision;
1994 -
1995 - pci_read_config_word(pdev, PCI_COMMAND, &hw->pci_cmd_word);
1996 -
1997 adapter->rx_buffer_len = MAXIMUM_ETHERNET_VLAN_SIZE;
1998 - hw->max_frame_size = netdev->mtu +
1999 - ENET_HEADER_SIZE + ETHERNET_FCS_SIZE;
2000 - hw->min_frame_size = MINIMUM_ETHERNET_FRAME_SIZE;
2001 -
2002 - /* identify the MAC */
2003 -
2004 - if (e1000_set_mac_type(hw)) {
2005 - DPRINTK(PROBE, ERR, "Unknown MAC Type\n");
2006 - return -EIO;
2007 - }
2008 -
2009 - switch (hw->mac_type) {
2010 - default:
2011 - break;
2012 - case e1000_82541:
2013 - case e1000_82547:
2014 - case e1000_82541_rev_2:
2015 - case e1000_82547_rev_2:
2016 - hw->phy_init_script = 1;
2017 - break;
2018 - }
2019 -
2020 - e1000_set_media_type(hw);
2021 -
2022 - hw->wait_autoneg_complete = false;
2023 - hw->tbi_compatibility_en = true;
2024 - hw->adaptive_ifs = true;
2025 -
2026 - /* Copper options */
2027 -
2028 - if (hw->media_type == e1000_media_type_copper) {
2029 - hw->mdix = AUTO_ALL_MODES;
2030 - hw->disable_polarity_correction = false;
2031 - hw->master_slave = E1000_MASTER_SLAVE;
2032 - }
2033
2034 adapter->num_tx_queues = 1;
2035 adapter->num_rx_queues = 1;
2036 diff --git a/drivers/net/e1000e/ich8lan.c b/drivers/net/e1000e/ich8lan.c
2037 index c688b55..de39f9a 100644
2038 --- a/drivers/net/e1000e/ich8lan.c
2039 +++ b/drivers/net/e1000e/ich8lan.c
2040 @@ -274,6 +274,16 @@ static s32 e1000_init_phy_params_pchlan(struct e1000_hw *hw)
2041 phy->ops.write_phy_reg_locked = e1000_write_phy_reg_hv_locked;
2042 phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT;
2043
2044 + /*
2045 + * Reset the PHY before any acccess to it. Doing so, ensures that
2046 + * the PHY is in a known good state before we read/write PHY registers.
2047 + * The generic reset is sufficient here, because we haven't determined
2048 + * the PHY type yet.
2049 + */
2050 + ret_val = e1000e_phy_hw_reset_generic(hw);
2051 + if (ret_val)
2052 + goto out;
2053 +
2054 phy->id = e1000_phy_unknown;
2055 e1000e_get_phy_id(hw);
2056 phy->type = e1000e_get_phy_type_from_id(phy->id);
2057 @@ -287,6 +297,7 @@ static s32 e1000_init_phy_params_pchlan(struct e1000_hw *hw)
2058 phy->ops.commit_phy = e1000e_phy_sw_reset;
2059 }
2060
2061 + out:
2062 return ret_val;
2063 }
2064
2065 diff --git a/drivers/net/igbvf/igbvf.h b/drivers/net/igbvf/igbvf.h
2066 index 8e9b67e..6012410 100644
2067 --- a/drivers/net/igbvf/igbvf.h
2068 +++ b/drivers/net/igbvf/igbvf.h
2069 @@ -125,7 +125,6 @@ struct igbvf_buffer {
2070 unsigned int page_offset;
2071 };
2072 };
2073 - struct page *page;
2074 };
2075
2076 union igbvf_desc {
2077 diff --git a/drivers/net/ipg.c b/drivers/net/ipg.c
2078 index 9f7b5d4..41dd89e 100644
2079 --- a/drivers/net/ipg.c
2080 +++ b/drivers/net/ipg.c
2081 @@ -88,7 +88,6 @@ static const char *ipg_brand_name[] = {
2082 "Sundance Technology ST2021 based NIC",
2083 "Tamarack Microelectronics TC9020/9021 based NIC",
2084 "Tamarack Microelectronics TC9020/9021 based NIC",
2085 - "D-Link NIC",
2086 "D-Link NIC IP1000A"
2087 };
2088
2089 @@ -97,8 +96,7 @@ static struct pci_device_id ipg_pci_tbl[] __devinitdata = {
2090 { PCI_VDEVICE(SUNDANCE, 0x2021), 1 },
2091 { PCI_VDEVICE(SUNDANCE, 0x1021), 2 },
2092 { PCI_VDEVICE(DLINK, 0x9021), 3 },
2093 - { PCI_VDEVICE(DLINK, 0x4000), 4 },
2094 - { PCI_VDEVICE(DLINK, 0x4020), 5 },
2095 + { PCI_VDEVICE(DLINK, 0x4020), 4 },
2096 { 0, }
2097 };
2098
2099 diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c
2100 index b8dc2d1..5178674 100644
2101 --- a/drivers/net/myri10ge/myri10ge.c
2102 +++ b/drivers/net/myri10ge/myri10ge.c
2103 @@ -264,6 +264,10 @@ static char *myri10ge_fw_unaligned = "myri10ge_ethp_z8e.dat";
2104 static char *myri10ge_fw_aligned = "myri10ge_eth_z8e.dat";
2105 static char *myri10ge_fw_rss_unaligned = "myri10ge_rss_ethp_z8e.dat";
2106 static char *myri10ge_fw_rss_aligned = "myri10ge_rss_eth_z8e.dat";
2107 +MODULE_FIRMWARE("myri10ge_ethp_z8e.dat");
2108 +MODULE_FIRMWARE("myri10ge_eth_z8e.dat");
2109 +MODULE_FIRMWARE("myri10ge_rss_ethp_z8e.dat");
2110 +MODULE_FIRMWARE("myri10ge_rss_eth_z8e.dat");
2111
2112 static char *myri10ge_fw_name = NULL;
2113 module_param(myri10ge_fw_name, charp, S_IRUGO | S_IWUSR);
2114 diff --git a/drivers/net/netx-eth.c b/drivers/net/netx-eth.c
2115 index 9f42354..a0d65f5 100644
2116 --- a/drivers/net/netx-eth.c
2117 +++ b/drivers/net/netx-eth.c
2118 @@ -510,3 +510,6 @@ module_exit(netx_eth_cleanup);
2119 MODULE_AUTHOR("Sascha Hauer, Pengutronix");
2120 MODULE_LICENSE("GPL");
2121 MODULE_ALIAS("platform:" CARDNAME);
2122 +MODULE_FIRMWARE("xc0.bin");
2123 +MODULE_FIRMWARE("xc1.bin");
2124 +MODULE_FIRMWARE("xc2.bin");
2125 diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
2126 index e1237b8..71975ba 100644
2127 --- a/drivers/net/netxen/netxen_nic.h
2128 +++ b/drivers/net/netxen/netxen_nic.h
2129 @@ -487,6 +487,12 @@ struct status_desc {
2130 #define NX_P3_MN_ROMIMAGE 2
2131 #define NX_FLASH_ROMIMAGE 3
2132
2133 +#define NX_P2_MN_ROMIMAGE_NAME "nxromimg.bin"
2134 +#define NX_P3_CT_ROMIMAGE_NAME "nx3fwct.bin"
2135 +#define NX_P3_MN_ROMIMAGE_NAME "nx3fwmn.bin"
2136 +#define NX_UNIFIED_ROMIMAGE_NAME "phanfw.bin"
2137 +#define NX_FLASH_ROMIMAGE_NAME "flash"
2138 +
2139 extern char netxen_nic_driver_name[];
2140
2141 /* Number of status descriptors to handle per interrupt */
2142 diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c
2143 index 0f3ae46..562a488 100644
2144 --- a/drivers/net/netxen/netxen_nic_init.c
2145 +++ b/drivers/net/netxen/netxen_nic_init.c
2146 @@ -673,7 +673,11 @@ netxen_need_fw_reset(struct netxen_adapter *adapter)
2147 }
2148
2149 static char *fw_name[] = {
2150 - "nxromimg.bin", "nx3fwct.bin", "nx3fwmn.bin", "flash",
2151 + NX_P2_MN_ROMIMAGE_NAME,
2152 + NX_P3_CT_ROMIMAGE_NAME,
2153 + NX_P3_MN_ROMIMAGE_NAME,
2154 + NX_UNIFIED_ROMIMAGE_NAME,
2155 + NX_FLASH_ROMIMAGE_NAME,
2156 };
2157
2158 int
2159 diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
2160 index 3bf78db..9890a7e 100644
2161 --- a/drivers/net/netxen/netxen_nic_main.c
2162 +++ b/drivers/net/netxen/netxen_nic_main.c
2163 @@ -38,6 +38,10 @@
2164 MODULE_DESCRIPTION("NetXen Multi port (1/10) Gigabit Network Driver");
2165 MODULE_LICENSE("GPL");
2166 MODULE_VERSION(NETXEN_NIC_LINUX_VERSIONID);
2167 +MODULE_FIRMWARE(NX_P2_MN_ROMIMAGE_NAME);
2168 +MODULE_FIRMWARE(NX_P3_CT_ROMIMAGE_NAME);
2169 +MODULE_FIRMWARE(NX_P3_MN_ROMIMAGE_NAME);
2170 +MODULE_FIRMWARE(NX_UNIFIED_ROMIMAGE_NAME);
2171
2172 char netxen_nic_driver_name[] = "netxen_nic";
2173 static char netxen_nic_driver_string[] = "NetXen Network Driver version "
2174 diff --git a/drivers/net/niu.c b/drivers/net/niu.c
2175 index d6c7ac6..2dce134 100644
2176 --- a/drivers/net/niu.c
2177 +++ b/drivers/net/niu.c
2178 @@ -7315,33 +7315,28 @@ static int niu_get_ethtool_tcam_all(struct niu *np,
2179 struct niu_parent *parent = np->parent;
2180 struct niu_tcam_entry *tp;
2181 int i, idx, cnt;
2182 - u16 n_entries;
2183 unsigned long flags;
2184 -
2185 + int ret = 0;
2186
2187 /* put the tcam size here */
2188 nfc->data = tcam_get_size(np);
2189
2190 niu_lock_parent(np, flags);
2191 - n_entries = nfc->rule_cnt;
2192 for (cnt = 0, i = 0; i < nfc->data; i++) {
2193 idx = tcam_get_index(np, i);
2194 tp = &parent->tcam[idx];
2195 if (!tp->valid)
2196 continue;
2197 + if (cnt == nfc->rule_cnt) {
2198 + ret = -EMSGSIZE;
2199 + break;
2200 + }
2201 rule_locs[cnt] = i;
2202 cnt++;
2203 }
2204 niu_unlock_parent(np, flags);
2205
2206 - if (n_entries != cnt) {
2207 - /* print warning, this should not happen */
2208 - pr_info(PFX "niu%d: %s In niu_get_ethtool_tcam_all, "
2209 - "n_entries[%d] != cnt[%d]!!!\n\n",
2210 - np->parent->index, np->dev->name, n_entries, cnt);
2211 - }
2212 -
2213 - return 0;
2214 + return ret;
2215 }
2216
2217 static int niu_get_nfc(struct net_device *dev, struct ethtool_rxnfc *cmd,
2218 diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c
2219 index 94c9ad2..4696844 100644
2220 --- a/drivers/net/pcmcia/pcnet_cs.c
2221 +++ b/drivers/net/pcmcia/pcnet_cs.c
2222 @@ -1768,6 +1768,13 @@ static struct pcmcia_device_id pcnet_ids[] = {
2223 PCMCIA_DEVICE_NULL
2224 };
2225 MODULE_DEVICE_TABLE(pcmcia, pcnet_ids);
2226 +MODULE_FIRMWARE("cis/PCMLM28.cis");
2227 +MODULE_FIRMWARE("cis/DP83903.cis");
2228 +MODULE_FIRMWARE("cis/LA-PCM.cis");
2229 +MODULE_FIRMWARE("PE520.cis");
2230 +MODULE_FIRMWARE("cis/NE2K.cis");
2231 +MODULE_FIRMWARE("cis/PE-200.cis");
2232 +MODULE_FIRMWARE("cis/tamarack.cis");
2233
2234 static struct pcmcia_driver pcnet_driver = {
2235 .drv = {
2236 diff --git a/drivers/net/pppol2tp.c b/drivers/net/pppol2tp.c
2237 index b724d7f..9235901 100644
2238 --- a/drivers/net/pppol2tp.c
2239 +++ b/drivers/net/pppol2tp.c
2240 @@ -756,6 +756,7 @@ static int pppol2tp_recv_core(struct sock *sock, struct sk_buff *skb)
2241
2242 /* Try to dequeue as many skbs from reorder_q as we can. */
2243 pppol2tp_recv_dequeue(session);
2244 + sock_put(sock);
2245
2246 return 0;
2247
2248 @@ -772,6 +773,7 @@ discard_bad_csum:
2249 UDP_INC_STATS_USER(&init_net, UDP_MIB_INERRORS, 0);
2250 tunnel->stats.rx_errors++;
2251 kfree_skb(skb);
2252 + sock_put(sock);
2253
2254 return 0;
2255
2256 @@ -1658,6 +1660,7 @@ static int pppol2tp_connect(struct socket *sock, struct sockaddr *uservaddr,
2257 if (tunnel_sock == NULL)
2258 goto end;
2259
2260 + sock_hold(tunnel_sock);
2261 tunnel = tunnel_sock->sk_user_data;
2262 } else {
2263 tunnel = pppol2tp_tunnel_find(sock_net(sk), sp->pppol2tp.s_tunnel);
2264 diff --git a/drivers/net/spider_net.c b/drivers/net/spider_net.c
2265 index 90e663f..782910c 100644
2266 --- a/drivers/net/spider_net.c
2267 +++ b/drivers/net/spider_net.c
2268 @@ -57,6 +57,7 @@ MODULE_AUTHOR("Utz Bacher <utz.bacher@de.ibm.com> and Jens Osterkamp " \
2269 MODULE_DESCRIPTION("Spider Southbridge Gigabit Ethernet driver");
2270 MODULE_LICENSE("GPL");
2271 MODULE_VERSION(VERSION);
2272 +MODULE_FIRMWARE(SPIDER_NET_FIRMWARE_NAME);
2273
2274 static int rx_descriptors = SPIDER_NET_RX_DESCRIPTORS_DEFAULT;
2275 static int tx_descriptors = SPIDER_NET_TX_DESCRIPTORS_DEFAULT;
2276 diff --git a/drivers/net/tehuti.c b/drivers/net/tehuti.c
2277 index ec9dfb2..489994c 100644
2278 --- a/drivers/net/tehuti.c
2279 +++ b/drivers/net/tehuti.c
2280 @@ -324,7 +324,7 @@ static int bdx_fw_load(struct bdx_priv *priv)
2281 ENTER;
2282 master = READ_REG(priv, regINIT_SEMAPHORE);
2283 if (!READ_REG(priv, regINIT_STATUS) && master) {
2284 - rc = request_firmware(&fw, "tehuti/firmware.bin", &priv->pdev->dev);
2285 + rc = request_firmware(&fw, "tehuti/bdx.bin", &priv->pdev->dev);
2286 if (rc)
2287 goto out;
2288 bdx_tx_push_desc_safe(priv, (char *)fw->data, fw->size);
2289 @@ -2524,4 +2524,4 @@ module_exit(bdx_module_exit);
2290 MODULE_LICENSE("GPL");
2291 MODULE_AUTHOR(DRIVER_AUTHOR);
2292 MODULE_DESCRIPTION(BDX_DRV_DESC);
2293 -MODULE_FIRMWARE("tehuti/firmware.bin");
2294 +MODULE_FIRMWARE("tehuti/bdx.bin");
2295 diff --git a/drivers/net/tokenring/tms380tr.c b/drivers/net/tokenring/tms380tr.c
2296 index a7b6888..fa15214 100644
2297 --- a/drivers/net/tokenring/tms380tr.c
2298 +++ b/drivers/net/tokenring/tms380tr.c
2299 @@ -1364,6 +1364,8 @@ static int tms380tr_reset_adapter(struct net_device *dev)
2300 return (-1);
2301 }
2302
2303 +MODULE_FIRMWARE("tms380tr.bin");
2304 +
2305 /*
2306 * Starts bring up diagnostics of token ring adapter and evaluates
2307 * diagnostic results.
2308 diff --git a/drivers/net/tulip/tulip_core.c b/drivers/net/tulip/tulip_core.c
2309 index 88bf54f..43b1fcb 100644
2310 --- a/drivers/net/tulip/tulip_core.c
2311 +++ b/drivers/net/tulip/tulip_core.c
2312 @@ -249,6 +249,7 @@ static struct pci_device_id tulip_pci_tbl[] = {
2313 { 0x17B3, 0xAB08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET },
2314 { 0x10b7, 0x9300, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET }, /* 3Com 3CSOHO100B-TX */
2315 { 0x14ea, 0xab08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET }, /* Planex FNW-3602-TX */
2316 + { 0x1414, 0x0001, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET }, /* Microsoft MN-120 */
2317 { 0x1414, 0x0002, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET },
2318 { } /* terminate list */
2319 };
2320 diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
2321 index 7e3788d..bf6d850 100644
2322 --- a/drivers/net/virtio_net.c
2323 +++ b/drivers/net/virtio_net.c
2324 @@ -391,6 +391,20 @@ static void skb_recv_done(struct virtqueue *rvq)
2325 }
2326 }
2327
2328 +static void virtnet_napi_enable(struct virtnet_info *vi)
2329 +{
2330 + napi_enable(&vi->napi);
2331 +
2332 + /* If all buffers were filled by other side before we napi_enabled, we
2333 + * won't get another interrupt, so process any outstanding packets
2334 + * now. virtnet_poll wants re-enable the queue, so we disable here.
2335 + * We synchronize against interrupts via NAPI_STATE_SCHED */
2336 + if (napi_schedule_prep(&vi->napi)) {
2337 + vi->rvq->vq_ops->disable_cb(vi->rvq);
2338 + __napi_schedule(&vi->napi);
2339 + }
2340 +}
2341 +
2342 static void refill_work(struct work_struct *work)
2343 {
2344 struct virtnet_info *vi;
2345 @@ -399,7 +413,7 @@ static void refill_work(struct work_struct *work)
2346 vi = container_of(work, struct virtnet_info, refill.work);
2347 napi_disable(&vi->napi);
2348 still_empty = !try_fill_recv(vi, GFP_KERNEL);
2349 - napi_enable(&vi->napi);
2350 + virtnet_napi_enable(vi);
2351
2352 /* In theory, this can happen: if we don't get any buffers in
2353 * we will *never* try to fill again. */
2354 @@ -511,7 +525,6 @@ static netdev_tx_t start_xmit(struct sk_buff *skb, struct net_device *dev)
2355 struct virtnet_info *vi = netdev_priv(dev);
2356 int capacity;
2357
2358 -again:
2359 /* Free up any pending old buffers before queueing new ones. */
2360 free_old_xmit_skbs(vi);
2361
2362 @@ -520,14 +533,20 @@ again:
2363
2364 /* This can happen with OOM and indirect buffers. */
2365 if (unlikely(capacity < 0)) {
2366 - netif_stop_queue(dev);
2367 - dev_warn(&dev->dev, "Unexpected full queue\n");
2368 - if (unlikely(!vi->svq->vq_ops->enable_cb(vi->svq))) {
2369 - vi->svq->vq_ops->disable_cb(vi->svq);
2370 - netif_start_queue(dev);
2371 - goto again;
2372 + if (net_ratelimit()) {
2373 + if (likely(capacity == -ENOMEM)) {
2374 + dev_warn(&dev->dev,
2375 + "TX queue failure: out of memory\n");
2376 + } else {
2377 + dev->stats.tx_fifo_errors++;
2378 + dev_warn(&dev->dev,
2379 + "Unexpected TX queue failure: %d\n",
2380 + capacity);
2381 + }
2382 }
2383 - return NETDEV_TX_BUSY;
2384 + dev->stats.tx_dropped++;
2385 + kfree_skb(skb);
2386 + return NETDEV_TX_OK;
2387 }
2388 vi->svq->vq_ops->kick(vi->svq);
2389
2390 @@ -591,16 +610,7 @@ static int virtnet_open(struct net_device *dev)
2391 {
2392 struct virtnet_info *vi = netdev_priv(dev);
2393
2394 - napi_enable(&vi->napi);
2395 -
2396 - /* If all buffers were filled by other side before we napi_enabled, we
2397 - * won't get another interrupt, so process any outstanding packets
2398 - * now. virtnet_poll wants re-enable the queue, so we disable here.
2399 - * We synchronize against interrupts via NAPI_STATE_SCHED */
2400 - if (napi_schedule_prep(&vi->napi)) {
2401 - vi->rvq->vq_ops->disable_cb(vi->rvq);
2402 - __napi_schedule(&vi->napi);
2403 - }
2404 + virtnet_napi_enable(vi);
2405 return 0;
2406 }
2407
2408 diff --git a/drivers/net/wireless/ath/regd_common.h b/drivers/net/wireless/ath/regd_common.h
2409 index 9847af7..b4221b4 100644
2410 --- a/drivers/net/wireless/ath/regd_common.h
2411 +++ b/drivers/net/wireless/ath/regd_common.h
2412 @@ -195,6 +195,7 @@ static struct reg_dmn_pair_mapping regDomainPairs[] = {
2413 {APL9_WORLD, CTL_ETSI, CTL_ETSI},
2414
2415 {APL3_FCCA, CTL_FCC, CTL_FCC},
2416 + {APL7_FCCA, CTL_FCC, CTL_FCC},
2417 {APL1_ETSIC, CTL_FCC, CTL_ETSI},
2418 {APL2_ETSIC, CTL_FCC, CTL_ETSI},
2419 {APL2_APLD, CTL_FCC, NO_CTL},
2420 diff --git a/drivers/net/wireless/b43/sdio.c b/drivers/net/wireless/b43/sdio.c
2421 index 0d3ac64..3300dfe 100644
2422 --- a/drivers/net/wireless/b43/sdio.c
2423 +++ b/drivers/net/wireless/b43/sdio.c
2424 @@ -162,6 +162,7 @@ static int b43_sdio_probe(struct sdio_func *func,
2425 err_free_ssb:
2426 kfree(sdio);
2427 err_disable_func:
2428 + sdio_claim_host(func);
2429 sdio_disable_func(func);
2430 err_release_host:
2431 sdio_release_host(func);
2432 @@ -174,7 +175,9 @@ static void b43_sdio_remove(struct sdio_func *func)
2433 struct b43_sdio *sdio = sdio_get_drvdata(func);
2434
2435 ssb_bus_unregister(&sdio->ssb);
2436 + sdio_claim_host(func);
2437 sdio_disable_func(func);
2438 + sdio_release_host(func);
2439 kfree(sdio);
2440 sdio_set_drvdata(func, NULL);
2441 }
2442 diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c
2443 index 1f423f2..dbceac7 100644
2444 --- a/drivers/net/wireless/iwlwifi/iwl-5000.c
2445 +++ b/drivers/net/wireless/iwlwifi/iwl-5000.c
2446 @@ -47,7 +47,7 @@
2447 #include "iwl-6000-hw.h"
2448
2449 /* Highest firmware API version supported */
2450 -#define IWL5000_UCODE_API_MAX 2
2451 +#define IWL5000_UCODE_API_MAX 5
2452 #define IWL5150_UCODE_API_MAX 2
2453
2454 /* Lowest firmware API version supported */
2455 diff --git a/drivers/net/wireless/iwlwifi/iwl-tx.c b/drivers/net/wireless/iwlwifi/iwl-tx.c
2456 index d21c06e..c3d7dd6 100644
2457 --- a/drivers/net/wireless/iwlwifi/iwl-tx.c
2458 +++ b/drivers/net/wireless/iwlwifi/iwl-tx.c
2459 @@ -1088,11 +1088,15 @@ int iwl_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index)
2460 q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) {
2461
2462 tx_info = &txq->txb[txq->q.read_ptr];
2463 - ieee80211_tx_status_irqsafe(priv->hw, tx_info->skb[0]);
2464 +
2465 + if (WARN_ON_ONCE(tx_info->skb == NULL))
2466 + continue;
2467
2468 hdr = (struct ieee80211_hdr *)tx_info->skb[0]->data;
2469 - if (hdr && ieee80211_is_data_qos(hdr->frame_control))
2470 + if (ieee80211_is_data_qos(hdr->frame_control))
2471 nfreed++;
2472 +
2473 + ieee80211_tx_status_irqsafe(priv->hw, tx_info->skb[0]);
2474 tx_info->skb[0] = NULL;
2475
2476 if (priv->cfg->ops->lib->txq_inval_byte_cnt_tbl)
2477 diff --git a/drivers/net/wireless/p54/txrx.c b/drivers/net/wireless/p54/txrx.c
2478 index 9000787..24a1763 100644
2479 --- a/drivers/net/wireless/p54/txrx.c
2480 +++ b/drivers/net/wireless/p54/txrx.c
2481 @@ -703,7 +703,7 @@ int p54_tx_80211(struct ieee80211_hw *dev, struct sk_buff *skb)
2482 struct p54_tx_info *p54info;
2483 struct p54_hdr *hdr;
2484 struct p54_tx_data *txhdr;
2485 - unsigned int padding, len, extra_len;
2486 + unsigned int padding, len, extra_len = 0;
2487 int i, j, ridx;
2488 u16 hdr_flags = 0, aid = 0;
2489 u8 rate, queue = 0, crypt_offset = 0;
2490 diff --git a/drivers/net/wireless/rt2x00/rt2400pci.c b/drivers/net/wireless/rt2x00/rt2400pci.c
2491 index 798f625..f6b8a9b 100644
2492 --- a/drivers/net/wireless/rt2x00/rt2400pci.c
2493 +++ b/drivers/net/wireless/rt2x00/rt2400pci.c
2494 @@ -1431,7 +1431,6 @@ static int rt2400pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
2495 IEEE80211_HW_SIGNAL_DBM |
2496 IEEE80211_HW_SUPPORTS_PS |
2497 IEEE80211_HW_PS_NULLFUNC_STACK;
2498 - rt2x00dev->hw->extra_tx_headroom = 0;
2499
2500 SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev);
2501 SET_IEEE80211_PERM_ADDR(rt2x00dev->hw,
2502 @@ -1628,6 +1627,7 @@ static const struct rt2x00_ops rt2400pci_ops = {
2503 .eeprom_size = EEPROM_SIZE,
2504 .rf_size = RF_SIZE,
2505 .tx_queues = NUM_TX_QUEUES,
2506 + .extra_tx_headroom = 0,
2507 .rx = &rt2400pci_queue_rx,
2508 .tx = &rt2400pci_queue_tx,
2509 .bcn = &rt2400pci_queue_bcn,
2510 diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c
2511 index 2e872ac..5a4b9ba 100644
2512 --- a/drivers/net/wireless/rt2x00/rt2500pci.c
2513 +++ b/drivers/net/wireless/rt2x00/rt2500pci.c
2514 @@ -1732,8 +1732,6 @@ static int rt2500pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
2515 IEEE80211_HW_SUPPORTS_PS |
2516 IEEE80211_HW_PS_NULLFUNC_STACK;
2517
2518 - rt2x00dev->hw->extra_tx_headroom = 0;
2519 -
2520 SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev);
2521 SET_IEEE80211_PERM_ADDR(rt2x00dev->hw,
2522 rt2x00_eeprom_addr(rt2x00dev,
2523 @@ -1927,6 +1925,7 @@ static const struct rt2x00_ops rt2500pci_ops = {
2524 .eeprom_size = EEPROM_SIZE,
2525 .rf_size = RF_SIZE,
2526 .tx_queues = NUM_TX_QUEUES,
2527 + .extra_tx_headroom = 0,
2528 .rx = &rt2500pci_queue_rx,
2529 .tx = &rt2500pci_queue_tx,
2530 .bcn = &rt2500pci_queue_bcn,
2531 diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c
2532 index 22dd6d9..99d6fd7 100644
2533 --- a/drivers/net/wireless/rt2x00/rt2500usb.c
2534 +++ b/drivers/net/wireless/rt2x00/rt2500usb.c
2535 @@ -347,6 +347,7 @@ static int rt2500usb_config_key(struct rt2x00_dev *rt2x00dev,
2536 int timeout;
2537 u32 mask;
2538 u16 reg;
2539 + enum cipher curr_cipher;
2540
2541 if (crypto->cmd == SET_KEY) {
2542 /*
2543 @@ -357,6 +358,7 @@ static int rt2500usb_config_key(struct rt2x00_dev *rt2x00dev,
2544 mask = TXRX_CSR0_KEY_ID.bit_mask;
2545
2546 rt2500usb_register_read(rt2x00dev, TXRX_CSR0, &reg);
2547 + curr_cipher = rt2x00_get_field16(reg, TXRX_CSR0_ALGORITHM);
2548 reg &= mask;
2549
2550 if (reg && reg == mask)
2551 @@ -365,6 +367,14 @@ static int rt2500usb_config_key(struct rt2x00_dev *rt2x00dev,
2552 reg = rt2x00_get_field16(reg, TXRX_CSR0_KEY_ID);
2553
2554 key->hw_key_idx += reg ? ffz(reg) : 0;
2555 + /*
2556 + * Hardware requires that all keys use the same cipher
2557 + * (e.g. TKIP-only, AES-only, but not TKIP+AES).
2558 + * If this is not the first key, compare the cipher with the
2559 + * first one and fall back to SW crypto if not the same.
2560 + */
2561 + if (key->hw_key_idx > 0 && crypto->cipher != curr_cipher)
2562 + return -EOPNOTSUPP;
2563
2564 /*
2565 * The encryption key doesn't fit within the CSR cache,
2566 @@ -1788,8 +1798,6 @@ static int rt2500usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
2567 IEEE80211_HW_SUPPORTS_PS |
2568 IEEE80211_HW_PS_NULLFUNC_STACK;
2569
2570 - rt2x00dev->hw->extra_tx_headroom = TXD_DESC_SIZE;
2571 -
2572 SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev);
2573 SET_IEEE80211_PERM_ADDR(rt2x00dev->hw,
2574 rt2x00_eeprom_addr(rt2x00dev,
2575 @@ -1962,6 +1970,7 @@ static const struct rt2x00_ops rt2500usb_ops = {
2576 .eeprom_size = EEPROM_SIZE,
2577 .rf_size = RF_SIZE,
2578 .tx_queues = NUM_TX_QUEUES,
2579 + .extra_tx_headroom = TXD_DESC_SIZE,
2580 .rx = &rt2500usb_queue_rx,
2581 .tx = &rt2500usb_queue_tx,
2582 .bcn = &rt2500usb_queue_bcn,
2583 diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c
2584 index 9fe770f..db2b635 100644
2585 --- a/drivers/net/wireless/rt2x00/rt2800usb.c
2586 +++ b/drivers/net/wireless/rt2x00/rt2800usb.c
2587 @@ -2509,7 +2509,6 @@ static int rt2800usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
2588 IEEE80211_HW_SIGNAL_DBM |
2589 IEEE80211_HW_SUPPORTS_PS |
2590 IEEE80211_HW_PS_NULLFUNC_STACK;
2591 - rt2x00dev->hw->extra_tx_headroom = TXINFO_DESC_SIZE + TXWI_DESC_SIZE;
2592
2593 SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev);
2594 SET_IEEE80211_PERM_ADDR(rt2x00dev->hw,
2595 @@ -2858,6 +2857,7 @@ static const struct rt2x00_ops rt2800usb_ops = {
2596 .eeprom_size = EEPROM_SIZE,
2597 .rf_size = RF_SIZE,
2598 .tx_queues = NUM_TX_QUEUES,
2599 + .extra_tx_headroom = TXINFO_DESC_SIZE + TXWI_DESC_SIZE,
2600 .rx = &rt2800usb_queue_rx,
2601 .tx = &rt2800usb_queue_tx,
2602 .bcn = &rt2800usb_queue_bcn,
2603 diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
2604 index 27bc6b7..6d7a9a7 100644
2605 --- a/drivers/net/wireless/rt2x00/rt2x00.h
2606 +++ b/drivers/net/wireless/rt2x00/rt2x00.h
2607 @@ -112,6 +112,12 @@
2608 ( ((unsigned long)((__skb)->data + (__header))) & 3 )
2609
2610 /*
2611 + * Constants for extra TX headroom for alignment purposes.
2612 + */
2613 +#define RT2X00_ALIGN_SIZE 4 /* Only whole frame needs alignment */
2614 +#define RT2X00_L2PAD_SIZE 8 /* Both header & payload need alignment */
2615 +
2616 +/*
2617 * Standard timing and size defines.
2618 * These values should follow the ieee80211 specifications.
2619 */
2620 @@ -579,6 +585,7 @@ struct rt2x00_ops {
2621 const unsigned int eeprom_size;
2622 const unsigned int rf_size;
2623 const unsigned int tx_queues;
2624 + const unsigned int extra_tx_headroom;
2625 const struct data_queue_desc *rx;
2626 const struct data_queue_desc *tx;
2627 const struct data_queue_desc *bcn;
2628 diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
2629 index 73bbec5..6604c27 100644
2630 --- a/drivers/net/wireless/rt2x00/rt2x00dev.c
2631 +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
2632 @@ -684,6 +684,21 @@ static int rt2x00lib_probe_hw(struct rt2x00_dev *rt2x00dev)
2633 rt2x00dev->hw->queues = rt2x00dev->ops->tx_queues;
2634
2635 /*
2636 + * Initialize extra TX headroom required.
2637 + */
2638 + rt2x00dev->hw->extra_tx_headroom =
2639 + max_t(unsigned int, IEEE80211_TX_STATUS_HEADROOM,
2640 + rt2x00dev->ops->extra_tx_headroom);
2641 +
2642 + /*
2643 + * Take TX headroom required for alignment into account.
2644 + */
2645 + if (test_bit(DRIVER_REQUIRE_L2PAD, &rt2x00dev->flags))
2646 + rt2x00dev->hw->extra_tx_headroom += RT2X00_L2PAD_SIZE;
2647 + else if (test_bit(DRIVER_REQUIRE_DMA, &rt2x00dev->flags))
2648 + rt2x00dev->hw->extra_tx_headroom += RT2X00_ALIGN_SIZE;
2649 +
2650 + /*
2651 * Register HW.
2652 */
2653 status = ieee80211_register_hw(rt2x00dev->hw);
2654 diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c
2655 index 577029e..2ec9c14 100644
2656 --- a/drivers/net/wireless/rt2x00/rt2x00queue.c
2657 +++ b/drivers/net/wireless/rt2x00/rt2x00queue.c
2658 @@ -103,7 +103,7 @@ void rt2x00queue_map_txskb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb)
2659 * is also mapped to the DMA so it can be used for transfering
2660 * additional descriptor information to the hardware.
2661 */
2662 - skb_push(skb, rt2x00dev->hw->extra_tx_headroom);
2663 + skb_push(skb, rt2x00dev->ops->extra_tx_headroom);
2664
2665 skbdesc->skb_dma =
2666 dma_map_single(rt2x00dev->dev, skb->data, skb->len, DMA_TO_DEVICE);
2667 @@ -111,7 +111,7 @@ void rt2x00queue_map_txskb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb)
2668 /*
2669 * Restore data pointer to original location again.
2670 */
2671 - skb_pull(skb, rt2x00dev->hw->extra_tx_headroom);
2672 + skb_pull(skb, rt2x00dev->ops->extra_tx_headroom);
2673
2674 skbdesc->flags |= SKBDESC_DMA_MAPPED_TX;
2675 }
2676 @@ -133,7 +133,7 @@ void rt2x00queue_unmap_skb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb)
2677 * by the driver, but it was actually mapped to DMA.
2678 */
2679 dma_unmap_single(rt2x00dev->dev, skbdesc->skb_dma,
2680 - skb->len + rt2x00dev->hw->extra_tx_headroom,
2681 + skb->len + rt2x00dev->ops->extra_tx_headroom,
2682 DMA_TO_DEVICE);
2683 skbdesc->flags &= ~SKBDESC_DMA_MAPPED_TX;
2684 }
2685 diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c
2686 index 9a6ceb4..da8366d 100644
2687 --- a/drivers/net/wireless/rt2x00/rt61pci.c
2688 +++ b/drivers/net/wireless/rt2x00/rt61pci.c
2689 @@ -2550,7 +2550,6 @@ static int rt61pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
2690 IEEE80211_HW_SIGNAL_DBM |
2691 IEEE80211_HW_SUPPORTS_PS |
2692 IEEE80211_HW_PS_NULLFUNC_STACK;
2693 - rt2x00dev->hw->extra_tx_headroom = 0;
2694
2695 SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev);
2696 SET_IEEE80211_PERM_ADDR(rt2x00dev->hw,
2697 @@ -2798,6 +2797,7 @@ static const struct rt2x00_ops rt61pci_ops = {
2698 .eeprom_size = EEPROM_SIZE,
2699 .rf_size = RF_SIZE,
2700 .tx_queues = NUM_TX_QUEUES,
2701 + .extra_tx_headroom = 0,
2702 .rx = &rt61pci_queue_rx,
2703 .tx = &rt61pci_queue_tx,
2704 .bcn = &rt61pci_queue_bcn,
2705 diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c
2706 index 1585577..a3ceef2 100644
2707 --- a/drivers/net/wireless/rt2x00/rt73usb.c
2708 +++ b/drivers/net/wireless/rt2x00/rt73usb.c
2709 @@ -2068,7 +2068,6 @@ static int rt73usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
2710 IEEE80211_HW_SIGNAL_DBM |
2711 IEEE80211_HW_SUPPORTS_PS |
2712 IEEE80211_HW_PS_NULLFUNC_STACK;
2713 - rt2x00dev->hw->extra_tx_headroom = TXD_DESC_SIZE;
2714
2715 SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev);
2716 SET_IEEE80211_PERM_ADDR(rt2x00dev->hw,
2717 @@ -2311,6 +2310,7 @@ static const struct rt2x00_ops rt73usb_ops = {
2718 .eeprom_size = EEPROM_SIZE,
2719 .rf_size = RF_SIZE,
2720 .tx_queues = NUM_TX_QUEUES,
2721 + .extra_tx_headroom = TXD_DESC_SIZE,
2722 .rx = &rt73usb_queue_rx,
2723 .tx = &rt73usb_queue_tx,
2724 .bcn = &rt73usb_queue_bcn,
2725 diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c
2726 index ba83495..5b680df 100644
2727 --- a/drivers/pci/intel-iommu.c
2728 +++ b/drivers/pci/intel-iommu.c
2729 @@ -382,7 +382,7 @@ int dmar_disabled = 0;
2730 int dmar_disabled = 1;
2731 #endif /*CONFIG_DMAR_DEFAULT_ON*/
2732
2733 -static int __initdata dmar_map_gfx = 1;
2734 +static int dmar_map_gfx = 1;
2735 static int dmar_forcedac;
2736 static int intel_iommu_strict;
2737
2738 @@ -1858,7 +1858,7 @@ static struct dmar_domain *get_domain_for_dev(struct pci_dev *pdev, int gaw)
2739
2740 ret = iommu_attach_domain(domain, iommu);
2741 if (ret) {
2742 - domain_exit(domain);
2743 + free_domain_mem(domain);
2744 goto error;
2745 }
2746
2747 @@ -3244,9 +3244,15 @@ static int device_notifier(struct notifier_block *nb,
2748 if (!domain)
2749 return 0;
2750
2751 - if (action == BUS_NOTIFY_UNBOUND_DRIVER && !iommu_pass_through)
2752 + if (action == BUS_NOTIFY_UNBOUND_DRIVER && !iommu_pass_through) {
2753 domain_remove_one_dev_info(domain, pdev);
2754
2755 + if (!(domain->flags & DOMAIN_FLAG_VIRTUAL_MACHINE) &&
2756 + !(domain->flags & DOMAIN_FLAG_STATIC_IDENTITY) &&
2757 + list_empty(&domain->devices))
2758 + domain_exit(domain);
2759 + }
2760 +
2761 return 0;
2762 }
2763
2764 @@ -3393,6 +3399,11 @@ static void domain_remove_one_dev_info(struct dmar_domain *domain,
2765 domain->iommu_count--;
2766 domain_update_iommu_cap(domain);
2767 spin_unlock_irqrestore(&domain->iommu_lock, tmp_flags);
2768 +
2769 + spin_lock_irqsave(&iommu->lock, tmp_flags);
2770 + clear_bit(domain->id, iommu->domain_ids);
2771 + iommu->domains[domain->id] = NULL;
2772 + spin_unlock_irqrestore(&iommu->lock, tmp_flags);
2773 }
2774
2775 spin_unlock_irqrestore(&device_domain_lock, flags);
2776 @@ -3730,6 +3741,12 @@ static void __devinit quirk_iommu_rwbf(struct pci_dev *dev)
2777 */
2778 printk(KERN_INFO "DMAR: Forcing write-buffer flush capability\n");
2779 rwbf_quirk = 1;
2780 +
2781 + /* https://bugzilla.redhat.com/show_bug.cgi?id=538163 */
2782 + if (dev->revision == 0x07) {
2783 + printk(KERN_INFO "DMAR: Disabling IOMMU for graphics on this chipset\n");
2784 + dmar_map_gfx = 0;
2785 + }
2786 }
2787
2788 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2a40, quirk_iommu_rwbf);
2789 diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c
2790 index 74909c4..07a74da 100644
2791 --- a/drivers/platform/x86/dell-laptop.c
2792 +++ b/drivers/platform/x86/dell-laptop.c
2793 @@ -71,6 +71,19 @@ static const struct dmi_system_id __initdata dell_device_table[] = {
2794 DMI_MATCH(DMI_CHASSIS_TYPE, "8"),
2795 },
2796 },
2797 + {
2798 + .matches = {
2799 + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
2800 + DMI_MATCH(DMI_CHASSIS_TYPE, "9"), /*Laptop*/
2801 + },
2802 + },
2803 + {
2804 + .ident = "Dell Computer Corporation",
2805 + .matches = {
2806 + DMI_MATCH(DMI_SYS_VENDOR, "Dell Computer Corporation"),
2807 + DMI_MATCH(DMI_CHASSIS_TYPE, "8"),
2808 + },
2809 + },
2810 { }
2811 };
2812
2813 @@ -397,3 +410,5 @@ MODULE_AUTHOR("Matthew Garrett <mjg@redhat.com>");
2814 MODULE_DESCRIPTION("Dell laptop driver");
2815 MODULE_LICENSE("GPL");
2816 MODULE_ALIAS("dmi:*svnDellInc.:*:ct8:*");
2817 +MODULE_ALIAS("dmi:*svnDellInc.:*:ct9:*");
2818 +MODULE_ALIAS("dmi:*svnDellComputerCorporation.:*:ct8:*");
2819 diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c
2820 index 678bb94..4460e00 100644
2821 --- a/drivers/s390/block/dasd_eckd.c
2822 +++ b/drivers/s390/block/dasd_eckd.c
2823 @@ -63,7 +63,7 @@ static struct dasd_discipline dasd_eckd_discipline;
2824 static struct ccw_device_id dasd_eckd_ids[] = {
2825 { CCW_DEVICE_DEVTYPE (0x3990, 0, 0x3390, 0), .driver_info = 0x1},
2826 { CCW_DEVICE_DEVTYPE (0x2105, 0, 0x3390, 0), .driver_info = 0x2},
2827 - { CCW_DEVICE_DEVTYPE (0x3880, 0, 0x3390, 0), .driver_info = 0x3},
2828 + { CCW_DEVICE_DEVTYPE (0x3880, 0, 0x3380, 0), .driver_info = 0x3},
2829 { CCW_DEVICE_DEVTYPE (0x3990, 0, 0x3380, 0), .driver_info = 0x4},
2830 { CCW_DEVICE_DEVTYPE (0x2105, 0, 0x3380, 0), .driver_info = 0x5},
2831 { CCW_DEVICE_DEVTYPE (0x9343, 0, 0x9345, 0), .driver_info = 0x6},
2832 diff --git a/drivers/scsi/device_handler/scsi_dh_emc.c b/drivers/scsi/device_handler/scsi_dh_emc.c
2833 index 0cffe84..260cbae 100644
2834 --- a/drivers/scsi/device_handler/scsi_dh_emc.c
2835 +++ b/drivers/scsi/device_handler/scsi_dh_emc.c
2836 @@ -272,7 +272,7 @@ static struct request *get_req(struct scsi_device *sdev, int cmd,
2837 int len = 0;
2838
2839 rq = blk_get_request(sdev->request_queue,
2840 - (cmd == MODE_SELECT) ? WRITE : READ, GFP_NOIO);
2841 + (cmd != INQUIRY) ? WRITE : READ, GFP_NOIO);
2842 if (!rq) {
2843 sdev_printk(KERN_INFO, sdev, "get_req: blk_get_request failed");
2844 return NULL;
2845 @@ -284,16 +284,17 @@ static struct request *get_req(struct scsi_device *sdev, int cmd,
2846 switch (cmd) {
2847 case MODE_SELECT:
2848 len = sizeof(short_trespass);
2849 - rq->cmd_flags |= REQ_RW;
2850 rq->cmd[1] = 0x10;
2851 + rq->cmd[4] = len;
2852 break;
2853 case MODE_SELECT_10:
2854 len = sizeof(long_trespass);
2855 - rq->cmd_flags |= REQ_RW;
2856 rq->cmd[1] = 0x10;
2857 + rq->cmd[8] = len;
2858 break;
2859 case INQUIRY:
2860 len = CLARIION_BUFFER_SIZE;
2861 + rq->cmd[4] = len;
2862 memset(buffer, 0, len);
2863 break;
2864 default:
2865 @@ -301,7 +302,6 @@ static struct request *get_req(struct scsi_device *sdev, int cmd,
2866 break;
2867 }
2868
2869 - rq->cmd[4] = len;
2870 rq->cmd_type = REQ_TYPE_BLOCK_PC;
2871 rq->cmd_flags |= REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT |
2872 REQ_FAILFAST_DRIVER;
2873 diff --git a/drivers/scsi/mpt2sas/mpt2sas_ctl.c b/drivers/scsi/mpt2sas/mpt2sas_ctl.c
2874 index 57d7246..7767b8f 100644
2875 --- a/drivers/scsi/mpt2sas/mpt2sas_ctl.c
2876 +++ b/drivers/scsi/mpt2sas/mpt2sas_ctl.c
2877 @@ -636,6 +636,13 @@ _ctl_do_mpt_command(struct MPT2SAS_ADAPTER *ioc,
2878 data_out_sz = karg.data_out_size;
2879 data_in_sz = karg.data_in_size;
2880
2881 + /* Check for overflow and wraparound */
2882 + if (karg.data_sge_offset * 4 > ioc->request_sz ||
2883 + karg.data_sge_offset > (UINT_MAX / 4)) {
2884 + ret = -EINVAL;
2885 + goto out;
2886 + }
2887 +
2888 /* copy in request message frame from user */
2889 if (copy_from_user(mpi_request, mf, karg.data_sge_offset*4)) {
2890 printk(KERN_ERR "failure at %s:%d/%s()!\n", __FILE__, __LINE__,
2891 @@ -1809,7 +1816,7 @@ _ctl_diag_read_buffer(void __user *arg, enum block_state state)
2892 Mpi2DiagBufferPostReply_t *mpi_reply;
2893 int rc, i;
2894 u8 buffer_type;
2895 - unsigned long timeleft;
2896 + unsigned long timeleft, request_size, copy_size;
2897 u16 smid;
2898 u16 ioc_status;
2899 u8 issue_reset = 0;
2900 @@ -1845,6 +1852,8 @@ _ctl_diag_read_buffer(void __user *arg, enum block_state state)
2901 return -ENOMEM;
2902 }
2903
2904 + request_size = ioc->diag_buffer_sz[buffer_type];
2905 +
2906 if ((karg.starting_offset % 4) || (karg.bytes_to_read % 4)) {
2907 printk(MPT2SAS_ERR_FMT "%s: either the starting_offset "
2908 "or bytes_to_read are not 4 byte aligned\n", ioc->name,
2909 @@ -1852,13 +1861,23 @@ _ctl_diag_read_buffer(void __user *arg, enum block_state state)
2910 return -EINVAL;
2911 }
2912
2913 + if (karg.starting_offset > request_size)
2914 + return -EINVAL;
2915 +
2916 diag_data = (void *)(request_data + karg.starting_offset);
2917 dctlprintk(ioc, printk(MPT2SAS_DEBUG_FMT "%s: diag_buffer(%p), "
2918 "offset(%d), sz(%d)\n", ioc->name, __func__,
2919 diag_data, karg.starting_offset, karg.bytes_to_read));
2920
2921 + /* Truncate data on requests that are too large */
2922 + if ((diag_data + karg.bytes_to_read < diag_data) ||
2923 + (diag_data + karg.bytes_to_read > request_data + request_size))
2924 + copy_size = request_size - karg.starting_offset;
2925 + else
2926 + copy_size = karg.bytes_to_read;
2927 +
2928 if (copy_to_user((void __user *)uarg->diagnostic_data,
2929 - diag_data, karg.bytes_to_read)) {
2930 + diag_data, copy_size)) {
2931 printk(MPT2SAS_ERR_FMT "%s: Unable to write "
2932 "mpt_diag_read_buffer_t data @ %p\n", ioc->name,
2933 __func__, diag_data);
2934 diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
2935 index 9e75206..cb972b6 100644
2936 --- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c
2937 +++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
2938 @@ -945,7 +945,7 @@ _scsih_build_scatter_gather(struct MPT2SAS_ADAPTER *ioc,
2939 u32 chain_offset;
2940 u32 chain_length;
2941 u32 chain_flags;
2942 - u32 sges_left;
2943 + int sges_left;
2944 u32 sges_in_segment;
2945 u32 sgl_flags;
2946 u32 sgl_flags_last_element;
2947 @@ -966,7 +966,7 @@ _scsih_build_scatter_gather(struct MPT2SAS_ADAPTER *ioc,
2948
2949 sg_scmd = scsi_sglist(scmd);
2950 sges_left = scsi_dma_map(scmd);
2951 - if (!sges_left) {
2952 + if (sges_left < 0) {
2953 sdev_printk(KERN_ERR, scmd->device, "pci_map_sg"
2954 " failed: request for %d bytes!\n", scsi_bufflen(scmd));
2955 return -ENOMEM;
2956 diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
2957 index 0a97bc9..483370f 100644
2958 --- a/drivers/scsi/pmcraid.c
2959 +++ b/drivers/scsi/pmcraid.c
2960 @@ -3508,6 +3508,9 @@ static long pmcraid_ioctl_passthrough(
2961 rc = -EFAULT;
2962 goto out_free_buffer;
2963 }
2964 + } else if (request_size < 0) {
2965 + rc = -EINVAL;
2966 + goto out_free_buffer;
2967 }
2968
2969 /* check if we have any additional command parameters */
2970 diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
2971 index d78828f..1492e3e 100644
2972 --- a/drivers/scsi/scsi_lib.c
2973 +++ b/drivers/scsi/scsi_lib.c
2974 @@ -400,10 +400,15 @@ static inline int scsi_host_is_busy(struct Scsi_Host *shost)
2975 static void scsi_run_queue(struct request_queue *q)
2976 {
2977 struct scsi_device *sdev = q->queuedata;
2978 - struct Scsi_Host *shost = sdev->host;
2979 + struct Scsi_Host *shost;
2980 LIST_HEAD(starved_list);
2981 unsigned long flags;
2982
2983 + /* if the device is dead, sdev will be NULL, so no queue to run */
2984 + if (!sdev)
2985 + return;
2986 +
2987 + shost = sdev->host;
2988 if (scsi_target(sdev)->single_lun)
2989 scsi_single_lun_run(sdev);
2990
2991 diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
2992 index ad136c2..ab6ac95 100644
2993 --- a/drivers/scsi/scsi_sysfs.c
2994 +++ b/drivers/scsi/scsi_sysfs.c
2995 @@ -318,14 +318,8 @@ static void scsi_device_dev_release_usercontext(struct work_struct *work)
2996 kfree(evt);
2997 }
2998
2999 - if (sdev->request_queue) {
3000 - sdev->request_queue->queuedata = NULL;
3001 - /* user context needed to free queue */
3002 - scsi_free_queue(sdev->request_queue);
3003 - /* temporary expedient, try to catch use of queue lock
3004 - * after free of sdev */
3005 - sdev->request_queue = NULL;
3006 - }
3007 + /* NULL queue means the device can't be used */
3008 + sdev->request_queue = NULL;
3009
3010 scsi_target_reap(scsi_target(sdev));
3011
3012 @@ -925,6 +919,12 @@ void __scsi_remove_device(struct scsi_device *sdev)
3013 if (sdev->host->hostt->slave_destroy)
3014 sdev->host->hostt->slave_destroy(sdev);
3015 transport_destroy_device(dev);
3016 +
3017 + /* cause the request function to reject all I/O requests */
3018 + sdev->request_queue->queuedata = NULL;
3019 +
3020 + /* Freeing the queue signals to block that we're done */
3021 + scsi_free_queue(sdev->request_queue);
3022 put_device(dev);
3023 }
3024
3025 diff --git a/drivers/serial/imx.c b/drivers/serial/imx.c
3026 index 2b55018..70ffeb1 100644
3027 --- a/drivers/serial/imx.c
3028 +++ b/drivers/serial/imx.c
3029 @@ -382,12 +382,13 @@ static void imx_start_tx(struct uart_port *port)
3030 static irqreturn_t imx_rtsint(int irq, void *dev_id)
3031 {
3032 struct imx_port *sport = dev_id;
3033 - unsigned int val = readl(sport->port.membase + USR1) & USR1_RTSS;
3034 + unsigned int val;
3035 unsigned long flags;
3036
3037 spin_lock_irqsave(&sport->port.lock, flags);
3038
3039 writel(USR1_RTSD, sport->port.membase + USR1);
3040 + val = readl(sport->port.membase + USR1) & USR1_RTSS;
3041 uart_handle_cts_change(&sport->port, !!val);
3042 wake_up_interruptible(&sport->port.state->port.delta_msr_wait);
3043
3044 diff --git a/drivers/staging/rtl8192su/r8192S_firmware.c b/drivers/staging/rtl8192su/r8192S_firmware.c
3045 index 3561adf..6230661 100644
3046 --- a/drivers/staging/rtl8192su/r8192S_firmware.c
3047 +++ b/drivers/staging/rtl8192su/r8192S_firmware.c
3048 @@ -68,6 +68,11 @@ bool FirmwareDownloadCode(struct net_device *dev, u8 * code_virtual_address,u32
3049
3050 /* Allocate skb buffer to contain firmware info and tx descriptor info. */
3051 skb = dev_alloc_skb(frag_length);
3052 + if (skb == NULL) {
3053 + RT_TRACE(COMP_ERR, "(%s): unable to alloc skb buffer\n",
3054 + __func__);
3055 + goto cmdsend_downloadcode_fail;
3056 + }
3057 memcpy((unsigned char *)(skb->cb),&dev,sizeof(dev));
3058
3059 tcb_desc = (cb_desc*)(skb->cb + MAX_DEV_ADDR_SIZE);
3060 diff --git a/drivers/staging/rtl8192su/r8192U_core.c b/drivers/staging/rtl8192su/r8192U_core.c
3061 index 6d52d6a..80c21e1 100644
3062 --- a/drivers/staging/rtl8192su/r8192U_core.c
3063 +++ b/drivers/staging/rtl8192su/r8192U_core.c
3064 @@ -25,6 +25,7 @@
3065 */
3066
3067 #include <linux/vmalloc.h>
3068 +#include <linux/notifier.h>
3069
3070 #undef LOOP_TEST
3071 #undef DUMP_RX
3072 @@ -111,28 +112,30 @@ u32 rt_global_debug_component = \
3073 #define CAM_CONTENT_COUNT 8
3074
3075 static struct usb_device_id rtl8192_usb_id_tbl[] = {
3076 - /* Realtek */
3077 - {USB_DEVICE(0x0bda, 0x8171)},
3078 - {USB_DEVICE(0x0bda, 0x8192)},
3079 - {USB_DEVICE(0x0bda, 0x8709)},
3080 - /* Corega */
3081 - {USB_DEVICE(0x07aa, 0x0043)},
3082 - /* Belkin */
3083 - {USB_DEVICE(0x050d, 0x805E)},
3084 - {USB_DEVICE(0x050d, 0x815F)}, /* Belkin F5D8053 v6 */
3085 - /* Sitecom */
3086 - {USB_DEVICE(0x0df6, 0x0031)},
3087 - {USB_DEVICE(0x0df6, 0x004b)}, /* WL-349 */
3088 - /* EnGenius */
3089 - {USB_DEVICE(0x1740, 0x9201)},
3090 - /* Dlink */
3091 - {USB_DEVICE(0x2001, 0x3301)},
3092 - /* Zinwell */
3093 - {USB_DEVICE(0x5a57, 0x0290)},
3094 - /* Guillemot */
3095 - {USB_DEVICE(0x06f8, 0xe031)},
3096 - //92SU
3097 + {USB_DEVICE(0x0bda, 0x8171)}, /* Realtek */
3098 {USB_DEVICE(0x0bda, 0x8172)},
3099 + {USB_DEVICE(0x0bda, 0x8173)},
3100 + {USB_DEVICE(0x0bda, 0x8174)},
3101 + {USB_DEVICE(0x0bda, 0x8712)},
3102 + {USB_DEVICE(0x0bda, 0x8713)},
3103 + {USB_DEVICE(0x07aa, 0x0047)},
3104 + {USB_DEVICE(0x07d1, 0x3303)},
3105 + {USB_DEVICE(0x07d1, 0x3302)},
3106 + {USB_DEVICE(0x07d1, 0x3300)},
3107 + {USB_DEVICE(0x1740, 0x9603)},
3108 + {USB_DEVICE(0x1740, 0x9605)},
3109 + {USB_DEVICE(0x050d, 0x815F)},
3110 + {USB_DEVICE(0x06f8, 0xe031)},
3111 + {USB_DEVICE(0x7392, 0x7611)},
3112 + {USB_DEVICE(0x7392, 0x7612)},
3113 + {USB_DEVICE(0x7392, 0x7622)},
3114 + {USB_DEVICE(0x0DF6, 0x0045)},
3115 + {USB_DEVICE(0x0E66, 0x0015)},
3116 + {USB_DEVICE(0x0E66, 0x0016)},
3117 + {USB_DEVICE(0x0b05, 0x1786)},
3118 + /* these are not in the official list */
3119 + {USB_DEVICE(0x050d, 0x815F)}, /* Belkin F5D8053 v6 */
3120 + {USB_DEVICE(0x0df6, 0x004b)}, /* WL-349 */
3121 {}
3122 };
3123
3124 @@ -160,6 +163,8 @@ MODULE_PARM_DESC(channels," Channel bitmask for specific locales. NYI");
3125 static int __devinit rtl8192_usb_probe(struct usb_interface *intf,
3126 const struct usb_device_id *id);
3127 static void __devexit rtl8192_usb_disconnect(struct usb_interface *intf);
3128 +static const struct net_device_ops rtl8192_netdev_ops;
3129 +static struct notifier_block proc_netdev_notifier;
3130
3131 static struct usb_driver rtl8192_usb_driver = {
3132 .name = RTL819xU_MODULE_NAME, /* Driver name */
3133 @@ -959,15 +964,24 @@ static int proc_get_stats_rx(char *page, char **start,
3134 return len;
3135 }
3136
3137 -void rtl8192_proc_module_init(void)
3138 +int rtl8192_proc_module_init(void)
3139 {
3140 + int ret;
3141 +
3142 RT_TRACE(COMP_INIT, "Initializing proc filesystem");
3143 rtl8192_proc=create_proc_entry(RTL819xU_MODULE_NAME, S_IFDIR, init_net.proc_net);
3144 + if (!rtl8192_proc)
3145 + return -ENOMEM;
3146 + ret = register_netdevice_notifier(&proc_netdev_notifier);
3147 + if (ret)
3148 + remove_proc_entry(RTL819xU_MODULE_NAME, init_net.proc_net);
3149 + return ret;
3150 }
3151
3152
3153 void rtl8192_proc_module_remove(void)
3154 {
3155 + unregister_netdevice_notifier(&proc_netdev_notifier);
3156 remove_proc_entry(RTL819xU_MODULE_NAME, init_net.proc_net);
3157 }
3158
3159 @@ -995,8 +1009,7 @@ void rtl8192_proc_remove_one(struct net_device *dev)
3160 remove_proc_entry("registers-e", priv->dir_dev);
3161 // remove_proc_entry("cck-registers",priv->dir_dev);
3162 // remove_proc_entry("ofdm-registers",priv->dir_dev);
3163 - //remove_proc_entry(dev->name, rtl8192_proc);
3164 - remove_proc_entry("wlan0", rtl8192_proc);
3165 + remove_proc_entry(priv->dir_dev->name, rtl8192_proc);
3166 priv->dir_dev = NULL;
3167 }
3168 }
3169 @@ -1113,6 +1126,25 @@ void rtl8192_proc_init_one(struct net_device *dev)
3170 dev->name);
3171 }
3172 }
3173 +
3174 +static int proc_netdev_event(struct notifier_block *this,
3175 + unsigned long event, void *ptr)
3176 +{
3177 + struct net_device *net_dev = ptr;
3178 +
3179 + if (net_dev->netdev_ops == &rtl8192_netdev_ops &&
3180 + event == NETDEV_CHANGENAME) {
3181 + rtl8192_proc_remove_one(net_dev);
3182 + rtl8192_proc_init_one(net_dev);
3183 + }
3184 +
3185 + return NOTIFY_DONE;
3186 +}
3187 +
3188 +static struct notifier_block proc_netdev_notifier = {
3189 + .notifier_call = proc_netdev_event,
3190 +};
3191 +
3192 /****************************************************************************
3193 -----------------------------MISC STUFF-------------------------
3194 *****************************************************************************/
3195 @@ -7564,35 +7596,63 @@ static int __init rtl8192_usb_module_init(void)
3196 ret = ieee80211_crypto_init();
3197 if (ret) {
3198 printk(KERN_ERR "ieee80211_crypto_init() failed %d\n", ret);
3199 - return ret;
3200 + goto fail_crypto;
3201 }
3202
3203 ret = ieee80211_crypto_tkip_init();
3204 if (ret) {
3205 printk(KERN_ERR "ieee80211_crypto_tkip_init() failed %d\n",
3206 ret);
3207 - return ret;
3208 + goto fail_crypto_tkip;
3209 }
3210
3211 ret = ieee80211_crypto_ccmp_init();
3212 if (ret) {
3213 printk(KERN_ERR "ieee80211_crypto_ccmp_init() failed %d\n",
3214 ret);
3215 - return ret;
3216 + goto fail_crypto_ccmp;
3217 }
3218
3219 ret = ieee80211_crypto_wep_init();
3220 if (ret) {
3221 printk(KERN_ERR "ieee80211_crypto_wep_init() failed %d\n", ret);
3222 - return ret;
3223 + goto fail_crypto_wep;
3224 }
3225
3226 printk(KERN_INFO "\nLinux kernel driver for RTL8192 based WLAN cards\n");
3227 printk(KERN_INFO "Copyright (c) 2007-2008, Realsil Wlan\n");
3228 RT_TRACE(COMP_INIT, "Initializing module");
3229 RT_TRACE(COMP_INIT, "Wireless extensions version %d", WIRELESS_EXT);
3230 - rtl8192_proc_module_init();
3231 - return usb_register(&rtl8192_usb_driver);
3232 +
3233 + ret = rtl8192_proc_module_init();
3234 + if (ret) {
3235 + pr_err("rtl8192_proc_module_init() failed %d\n", ret);
3236 + goto fail_proc;
3237 + }
3238 +
3239 + ret = usb_register(&rtl8192_usb_driver);
3240 + if (ret) {
3241 + pr_err("usb_register() failed %d\n", ret);
3242 + goto fail_usb;
3243 + }
3244 +
3245 + return 0;
3246 +
3247 +fail_usb:
3248 + rtl8192_proc_module_remove();
3249 +fail_proc:
3250 + ieee80211_crypto_wep_exit();
3251 +fail_crypto_wep:
3252 + ieee80211_crypto_ccmp_exit();
3253 +fail_crypto_ccmp:
3254 + ieee80211_crypto_tkip_exit();
3255 +fail_crypto_tkip:
3256 + ieee80211_crypto_deinit();
3257 +fail_crypto:
3258 +#ifdef CONFIG_IEEE80211_DEBUG
3259 + ieee80211_debug_exit();
3260 +#endif
3261 + return ret;
3262 }
3263
3264
3265 diff --git a/drivers/staging/rtl8192su/r819xU_cmdpkt.c b/drivers/staging/rtl8192su/r819xU_cmdpkt.c
3266 index e2ba93e..071b5c6 100644
3267 --- a/drivers/staging/rtl8192su/r819xU_cmdpkt.c
3268 +++ b/drivers/staging/rtl8192su/r819xU_cmdpkt.c
3269 @@ -56,6 +56,12 @@ SendTxCommandPacket(
3270
3271 //Get TCB and local buffer from common pool. (It is shared by CmdQ, MgntQ, and USB coalesce DataQ)
3272 skb = dev_alloc_skb(USB_HWDESC_HEADER_LEN + DataLen + 4);
3273 + if (skb == NULL) {
3274 + RT_TRACE(COMP_ERR, "(%s): unable to alloc skb buffer\n",
3275 + __func__);
3276 + rtStatus = false;
3277 + return rtStatus;
3278 + }
3279 memcpy((unsigned char *)(skb->cb),&dev,sizeof(dev));
3280 tcb_desc = (cb_desc*)(skb->cb + MAX_DEV_ADDR_SIZE);
3281 tcb_desc->queue_index = TXCMD_QUEUE;
3282 diff --git a/drivers/staging/usbip/vhci_hcd.c b/drivers/staging/usbip/vhci_hcd.c
3283 index 1c17319..20cd7db 100644
3284 --- a/drivers/staging/usbip/vhci_hcd.c
3285 +++ b/drivers/staging/usbip/vhci_hcd.c
3286 @@ -1134,7 +1134,7 @@ static int vhci_hcd_probe(struct platform_device *pdev)
3287 usbip_uerr("create hcd failed\n");
3288 return -ENOMEM;
3289 }
3290 -
3291 + hcd->has_tt = 1;
3292
3293 /* this is private data for vhci_hcd */
3294 the_controller = hcd_to_vhci(hcd);
3295 diff --git a/drivers/usb/core/devices.c b/drivers/usb/core/devices.c
3296 index 2ce5963..8a54aa9 100644
3297 --- a/drivers/usb/core/devices.c
3298 +++ b/drivers/usb/core/devices.c
3299 @@ -65,8 +65,8 @@
3300 #define ALLOW_SERIAL_NUMBER
3301
3302 static const char *format_topo =
3303 -/* T: Bus=dd Lev=dd Prnt=dd Port=dd Cnt=dd Dev#=ddd Spd=ddd MxCh=dd */
3304 -"\nT: Bus=%2.2d Lev=%2.2d Prnt=%2.2d Port=%2.2d Cnt=%2.2d Dev#=%3d Spd=%3s MxCh=%2d\n";
3305 +/* T: Bus=dd Lev=dd Prnt=dd Port=dd Cnt=dd Dev#=ddd Spd=dddd MxCh=dd */
3306 +"\nT: Bus=%2.2d Lev=%2.2d Prnt=%2.2d Port=%2.2d Cnt=%2.2d Dev#=%3d Spd=%-4s MxCh=%2d\n";
3307
3308 static const char *format_string_manufacturer =
3309 /* S: Manufacturer=xxxx */
3310 @@ -510,11 +510,13 @@ static ssize_t usb_device_dump(char __user **buffer, size_t *nbytes,
3311 speed = "1.5"; break;
3312 case USB_SPEED_UNKNOWN: /* usb 1.1 root hub code */
3313 case USB_SPEED_FULL:
3314 - speed = "12 "; break;
3315 + speed = "12"; break;
3316 case USB_SPEED_HIGH:
3317 speed = "480"; break;
3318 + case USB_SPEED_SUPER:
3319 + speed = "5000"; break;
3320 default:
3321 - speed = "?? ";
3322 + speed = "??";
3323 }
3324 data_end = pages_start + sprintf(pages_start, format_topo,
3325 bus->busnum, level, parent_devnum,
3326 diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
3327 index fc722a0..283f019 100644
3328 --- a/drivers/usb/core/hub.c
3329 +++ b/drivers/usb/core/hub.c
3330 @@ -1424,11 +1424,11 @@ void usb_set_device_state(struct usb_device *udev,
3331 || new_state == USB_STATE_SUSPENDED)
3332 ; /* No change to wakeup settings */
3333 else if (new_state == USB_STATE_CONFIGURED)
3334 - device_init_wakeup(&udev->dev,
3335 + device_set_wakeup_capable(&udev->dev,
3336 (udev->actconfig->desc.bmAttributes
3337 & USB_CONFIG_ATT_WAKEUP));
3338 else
3339 - device_init_wakeup(&udev->dev, 0);
3340 + device_set_wakeup_capable(&udev->dev, 0);
3341 }
3342 if (udev->state == USB_STATE_SUSPENDED &&
3343 new_state != USB_STATE_SUSPENDED)
3344 @@ -1786,10 +1786,17 @@ int usb_new_device(struct usb_device *udev)
3345 {
3346 int err;
3347
3348 - /* Increment the parent's count of unsuspended children */
3349 - if (udev->parent)
3350 + if (udev->parent) {
3351 + /* Increment the parent's count of unsuspended children */
3352 usb_autoresume_device(udev->parent);
3353
3354 + /* Initialize non-root-hub device wakeup to disabled;
3355 + * device (un)configuration controls wakeup capable
3356 + * sysfs power/wakeup controls wakeup enabled/disabled
3357 + */
3358 + device_init_wakeup(&udev->dev, 0);
3359 + }
3360 +
3361 err = usb_enumerate_device(udev); /* Read descriptors */
3362 if (err < 0)
3363 goto fail;
3364 diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
3365 index 547e0e3..24212be 100644
3366 --- a/drivers/usb/musb/musb_core.c
3367 +++ b/drivers/usb/musb/musb_core.c
3368 @@ -1792,6 +1792,7 @@ allocate_instance(struct device *dev,
3369 INIT_LIST_HEAD(&musb->out_bulk);
3370
3371 hcd->uses_new_polling = 1;
3372 + hcd->has_tt = 1;
3373
3374 musb->vbuserr_retry = VBUSERR_RETRY_COUNT;
3375 musb->a_wait_bcon = OTG_TIME_A_WAIT_BCON;
3376 diff --git a/drivers/video/backlight/mbp_nvidia_bl.c b/drivers/video/backlight/mbp_nvidia_bl.c
3377 index 73ab600..99bdfa8 100644
3378 --- a/drivers/video/backlight/mbp_nvidia_bl.c
3379 +++ b/drivers/video/backlight/mbp_nvidia_bl.c
3380 @@ -272,6 +272,24 @@ static const struct dmi_system_id __initdata mbp_device_table[] = {
3381 },
3382 .driver_data = (void *)&nvidia_chipset_data,
3383 },
3384 + {
3385 + .callback = mbp_dmi_match,
3386 + .ident = "MacBookAir 3,1",
3387 + .matches = {
3388 + DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."),
3389 + DMI_MATCH(DMI_PRODUCT_NAME, "MacBookAir3,1"),
3390 + },
3391 + .driver_data = (void *)&nvidia_chipset_data,
3392 + },
3393 + {
3394 + .callback = mbp_dmi_match,
3395 + .ident = "MacBookAir 3,2",
3396 + .matches = {
3397 + DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."),
3398 + DMI_MATCH(DMI_PRODUCT_NAME, "MacBookAir3,2"),
3399 + },
3400 + .driver_data = (void *)&nvidia_chipset_data,
3401 + },
3402 { }
3403 };
3404
3405 diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
3406 index 41ecbb2..5d56a8d 100644
3407 --- a/fs/btrfs/volumes.c
3408 +++ b/fs/btrfs/volumes.c
3409 @@ -21,6 +21,7 @@
3410 #include <linux/blkdev.h>
3411 #include <linux/random.h>
3412 #include <linux/iocontext.h>
3413 +#include <linux/capability.h>
3414 #include <asm/div64.h>
3415 #include "compat.h"
3416 #include "ctree.h"
3417 @@ -1900,6 +1901,9 @@ int btrfs_balance(struct btrfs_root *dev_root)
3418 if (dev_root->fs_info->sb->s_flags & MS_RDONLY)
3419 return -EROFS;
3420
3421 + if (!capable(CAP_SYS_ADMIN))
3422 + return -EPERM;
3423 +
3424 mutex_lock(&dev_root->fs_info->volume_mutex);
3425 dev_root = dev_root->fs_info->dev_root;
3426
3427 diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
3428 index 303fd7f..33fa049 100644
3429 --- a/fs/cifs/inode.c
3430 +++ b/fs/cifs/inode.c
3431 @@ -688,8 +688,10 @@ struct inode *cifs_root_iget(struct super_block *sb, unsigned long ino)
3432 rc = cifs_get_inode_info(&inode, full_path, NULL, sb,
3433 xid, NULL);
3434
3435 - if (!inode)
3436 - return ERR_PTR(-ENOMEM);
3437 + if (!inode) {
3438 + inode = ERR_PTR(rc);
3439 + goto out;
3440 + }
3441
3442 if (rc && cifs_sb->tcon->ipc) {
3443 cFYI(1, ("ipc connection - fake read inode"));
3444 @@ -700,13 +702,11 @@ struct inode *cifs_root_iget(struct super_block *sb, unsigned long ino)
3445 inode->i_uid = cifs_sb->mnt_uid;
3446 inode->i_gid = cifs_sb->mnt_gid;
3447 } else if (rc) {
3448 - kfree(full_path);
3449 - _FreeXid(xid);
3450 iget_failed(inode);
3451 - return ERR_PTR(rc);
3452 + inode = ERR_PTR(rc);
3453 }
3454
3455 -
3456 +out:
3457 kfree(full_path);
3458 /* can not call macro FreeXid here since in a void func
3459 * TODO: This is no longer true
3460 diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c
3461 index 2e9b932..37af9a9 100644
3462 --- a/fs/gfs2/quota.c
3463 +++ b/fs/gfs2/quota.c
3464 @@ -15,7 +15,7 @@
3465 * fuzziness in the current usage value of IDs that are being used on different
3466 * nodes in the cluster simultaneously. So, it is possible for a user on
3467 * multiple nodes to overrun their quota, but that overrun is controlable.
3468 - * Since quota tags are part of transactions, there is no need to a quota check
3469 + * Since quota tags are part of transactions, there is no need for a quota check
3470 * program to be run on node crashes or anything like that.
3471 *
3472 * There are couple of knobs that let the administrator manage the quota
3473 @@ -65,13 +65,6 @@
3474 #define QUOTA_USER 1
3475 #define QUOTA_GROUP 0
3476
3477 -struct gfs2_quota_host {
3478 - u64 qu_limit;
3479 - u64 qu_warn;
3480 - s64 qu_value;
3481 - u32 qu_ll_next;
3482 -};
3483 -
3484 struct gfs2_quota_change_host {
3485 u64 qc_change;
3486 u32 qc_flags; /* GFS2_QCF_... */
3487 @@ -617,33 +610,19 @@ static void do_qc(struct gfs2_quota_data *qd, s64 change)
3488 mutex_unlock(&sdp->sd_quota_mutex);
3489 }
3490
3491 -static void gfs2_quota_in(struct gfs2_quota_host *qu, const void *buf)
3492 -{
3493 - const struct gfs2_quota *str = buf;
3494 -
3495 - qu->qu_limit = be64_to_cpu(str->qu_limit);
3496 - qu->qu_warn = be64_to_cpu(str->qu_warn);
3497 - qu->qu_value = be64_to_cpu(str->qu_value);
3498 - qu->qu_ll_next = be32_to_cpu(str->qu_ll_next);
3499 -}
3500 -
3501 -static void gfs2_quota_out(const struct gfs2_quota_host *qu, void *buf)
3502 -{
3503 - struct gfs2_quota *str = buf;
3504 -
3505 - str->qu_limit = cpu_to_be64(qu->qu_limit);
3506 - str->qu_warn = cpu_to_be64(qu->qu_warn);
3507 - str->qu_value = cpu_to_be64(qu->qu_value);
3508 - str->qu_ll_next = cpu_to_be32(qu->qu_ll_next);
3509 - memset(&str->qu_reserved, 0, sizeof(str->qu_reserved));
3510 -}
3511 -
3512 /**
3513 - * gfs2_adjust_quota
3514 + * gfs2_adjust_quota - adjust record of current block usage
3515 + * @ip: The quota inode
3516 + * @loc: Offset of the entry in the quota file
3517 + * @change: The amount of change to record
3518 + * @qd: The quota data
3519 *
3520 * This function was mostly borrowed from gfs2_block_truncate_page which was
3521 * in turn mostly borrowed from ext3
3522 + *
3523 + * Returns: 0 or -ve on error
3524 */
3525 +
3526 static int gfs2_adjust_quota(struct gfs2_inode *ip, loff_t loc,
3527 s64 change, struct gfs2_quota_data *qd)
3528 {
3529 @@ -654,15 +633,29 @@ static int gfs2_adjust_quota(struct gfs2_inode *ip, loff_t loc,
3530 unsigned blocksize, iblock, pos;
3531 struct buffer_head *bh;
3532 struct page *page;
3533 - void *kaddr;
3534 - char *ptr;
3535 - struct gfs2_quota_host qp;
3536 - s64 value;
3537 - int err = -EIO;
3538 + void *kaddr, *ptr;
3539 + struct gfs2_quota q, *qp;
3540 + int err, nbytes;
3541
3542 if (gfs2_is_stuffed(ip))
3543 gfs2_unstuff_dinode(ip, NULL);
3544 -
3545 +
3546 + memset(&q, 0, sizeof(struct gfs2_quota));
3547 + err = gfs2_internal_read(ip, NULL, (char *)&q, &loc, sizeof(q));
3548 + if (err < 0)
3549 + return err;
3550 +
3551 + err = -EIO;
3552 + qp = &q;
3553 + qp->qu_value = be64_to_cpu(qp->qu_value);
3554 + qp->qu_value += change;
3555 + qp->qu_value = cpu_to_be64(qp->qu_value);
3556 + qd->qd_qb.qb_value = qp->qu_value;
3557 +
3558 + /* Write the quota into the quota file on disk */
3559 + ptr = qp;
3560 + nbytes = sizeof(struct gfs2_quota);
3561 +get_a_page:
3562 page = grab_cache_page(mapping, index);
3563 if (!page)
3564 return -ENOMEM;
3565 @@ -684,7 +677,10 @@ static int gfs2_adjust_quota(struct gfs2_inode *ip, loff_t loc,
3566 if (!buffer_mapped(bh)) {
3567 gfs2_block_map(inode, iblock, bh, 1);
3568 if (!buffer_mapped(bh))
3569 - goto unlock;
3570 + goto unlock_out;
3571 + /* If it's a newly allocated disk block for quota, zero it */
3572 + if (buffer_new(bh))
3573 + zero_user(page, pos - blocksize, bh->b_size);
3574 }
3575
3576 if (PageUptodate(page))
3577 @@ -694,25 +690,32 @@ static int gfs2_adjust_quota(struct gfs2_inode *ip, loff_t loc,
3578 ll_rw_block(READ_META, 1, &bh);
3579 wait_on_buffer(bh);
3580 if (!buffer_uptodate(bh))
3581 - goto unlock;
3582 + goto unlock_out;
3583 }
3584
3585 gfs2_trans_add_bh(ip->i_gl, bh, 0);
3586
3587 kaddr = kmap_atomic(page, KM_USER0);
3588 - ptr = kaddr + offset;
3589 - gfs2_quota_in(&qp, ptr);
3590 - qp.qu_value += change;
3591 - value = qp.qu_value;
3592 - gfs2_quota_out(&qp, ptr);
3593 + if (offset + sizeof(struct gfs2_quota) > PAGE_CACHE_SIZE)
3594 + nbytes = PAGE_CACHE_SIZE - offset;
3595 + memcpy(kaddr + offset, ptr, nbytes);
3596 flush_dcache_page(page);
3597 kunmap_atomic(kaddr, KM_USER0);
3598 + unlock_page(page);
3599 + page_cache_release(page);
3600 +
3601 + /* If quota straddles page boundary, we need to update the rest of the
3602 + * quota at the beginning of the next page */
3603 + if ((offset + sizeof(struct gfs2_quota)) > PAGE_CACHE_SIZE) {
3604 + ptr = ptr + nbytes;
3605 + nbytes = sizeof(struct gfs2_quota) - nbytes;
3606 + offset = 0;
3607 + index++;
3608 + goto get_a_page;
3609 + }
3610 err = 0;
3611 - qd->qd_qb.qb_magic = cpu_to_be32(GFS2_MAGIC);
3612 - qd->qd_qb.qb_value = cpu_to_be64(value);
3613 - ((struct gfs2_quota_lvb*)(qd->qd_gl->gl_lvb))->qb_magic = cpu_to_be32(GFS2_MAGIC);
3614 - ((struct gfs2_quota_lvb*)(qd->qd_gl->gl_lvb))->qb_value = cpu_to_be64(value);
3615 -unlock:
3616 + return err;
3617 +unlock_out:
3618 unlock_page(page);
3619 page_cache_release(page);
3620 return err;
3621 @@ -740,8 +743,7 @@ static int do_sync(unsigned int num_qd, struct gfs2_quota_data **qda)
3622
3623 sort(qda, num_qd, sizeof(struct gfs2_quota_data *), sort_qd, NULL);
3624 for (qx = 0; qx < num_qd; qx++) {
3625 - error = gfs2_glock_nq_init(qda[qx]->qd_gl,
3626 - LM_ST_EXCLUSIVE,
3627 + error = gfs2_glock_nq_init(qda[qx]->qd_gl, LM_ST_EXCLUSIVE,
3628 GL_NOCACHE, &ghs[qx]);
3629 if (error)
3630 goto out;
3631 @@ -776,8 +778,10 @@ static int do_sync(unsigned int num_qd, struct gfs2_quota_data **qda)
3632 * rgrp since it won't be allocated during the transaction
3633 */
3634 al->al_requested = 1;
3635 - /* +1 in the end for block requested above for unstuffing */
3636 - blocks = num_qd * data_blocks + RES_DINODE + num_qd + 1;
3637 + /* +3 in the end for unstuffing block, inode size update block
3638 + * and another block in case quota straddles page boundary and
3639 + * two blocks need to be updated instead of 1 */
3640 + blocks = num_qd * data_blocks + RES_DINODE + num_qd + 3;
3641
3642 if (nalloc)
3643 al->al_requested += nalloc * (data_blocks + ind_blocks);
3644 @@ -796,8 +800,7 @@ static int do_sync(unsigned int num_qd, struct gfs2_quota_data **qda)
3645 qd = qda[x];
3646 offset = qd2offset(qd);
3647 error = gfs2_adjust_quota(ip, offset, qd->qd_change_sync,
3648 - (struct gfs2_quota_data *)
3649 - qd);
3650 + (struct gfs2_quota_data *)qd);
3651 if (error)
3652 goto out_end_trans;
3653
3654 @@ -828,8 +831,7 @@ static int do_glock(struct gfs2_quota_data *qd, int force_refresh,
3655 struct gfs2_sbd *sdp = qd->qd_gl->gl_sbd;
3656 struct gfs2_inode *ip = GFS2_I(sdp->sd_quota_inode);
3657 struct gfs2_holder i_gh;
3658 - struct gfs2_quota_host q;
3659 - char buf[sizeof(struct gfs2_quota)];
3660 + struct gfs2_quota q;
3661 int error;
3662 struct gfs2_quota_lvb *qlvb;
3663
3664 @@ -853,22 +855,23 @@ restart:
3665 if (error)
3666 goto fail;
3667
3668 - memset(buf, 0, sizeof(struct gfs2_quota));
3669 + memset(&q, 0, sizeof(struct gfs2_quota));
3670 pos = qd2offset(qd);
3671 - error = gfs2_internal_read(ip, NULL, buf, &pos,
3672 - sizeof(struct gfs2_quota));
3673 + error = gfs2_internal_read(ip, NULL, (char *)&q, &pos, sizeof(q));
3674 if (error < 0)
3675 goto fail_gunlock;
3676 -
3677 + if ((error < sizeof(q)) && force_refresh) {
3678 + error = -ENOENT;
3679 + goto fail_gunlock;
3680 + }
3681 gfs2_glock_dq_uninit(&i_gh);
3682
3683 - gfs2_quota_in(&q, buf);
3684 qlvb = (struct gfs2_quota_lvb *)qd->qd_gl->gl_lvb;
3685 qlvb->qb_magic = cpu_to_be32(GFS2_MAGIC);
3686 qlvb->__pad = 0;
3687 - qlvb->qb_limit = cpu_to_be64(q.qu_limit);
3688 - qlvb->qb_warn = cpu_to_be64(q.qu_warn);
3689 - qlvb->qb_value = cpu_to_be64(q.qu_value);
3690 + qlvb->qb_limit = q.qu_limit;
3691 + qlvb->qb_warn = q.qu_warn;
3692 + qlvb->qb_value = q.qu_value;
3693 qd->qd_qb = *qlvb;
3694
3695 if (gfs2_glock_is_blocking(qd->qd_gl)) {
3696 @@ -1127,7 +1130,6 @@ int gfs2_quota_refresh(struct gfs2_sbd *sdp, int user, u32 id)
3697 gfs2_glock_dq_uninit(&q_gh);
3698
3699 qd_put(qd);
3700 -
3701 return error;
3702 }
3703
3704 diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
3705 index 3c80474..bfaef7b 100644
3706 --- a/fs/nfs/inode.c
3707 +++ b/fs/nfs/inode.c
3708 @@ -861,9 +861,10 @@ out:
3709 return ret;
3710 }
3711
3712 -static void nfs_wcc_update_inode(struct inode *inode, struct nfs_fattr *fattr)
3713 +static unsigned long nfs_wcc_update_inode(struct inode *inode, struct nfs_fattr *fattr)
3714 {
3715 struct nfs_inode *nfsi = NFS_I(inode);
3716 + unsigned long ret = 0;
3717
3718 if ((fattr->valid & NFS_ATTR_FATTR_PRECHANGE)
3719 && (fattr->valid & NFS_ATTR_FATTR_CHANGE)
3720 @@ -871,25 +872,32 @@ static void nfs_wcc_update_inode(struct inode *inode, struct nfs_fattr *fattr)
3721 nfsi->change_attr = fattr->change_attr;
3722 if (S_ISDIR(inode->i_mode))
3723 nfsi->cache_validity |= NFS_INO_INVALID_DATA;
3724 + ret |= NFS_INO_INVALID_ATTR;
3725 }
3726 /* If we have atomic WCC data, we may update some attributes */
3727 if ((fattr->valid & NFS_ATTR_FATTR_PRECTIME)
3728 && (fattr->valid & NFS_ATTR_FATTR_CTIME)
3729 - && timespec_equal(&inode->i_ctime, &fattr->pre_ctime))
3730 - memcpy(&inode->i_ctime, &fattr->ctime, sizeof(inode->i_ctime));
3731 + && timespec_equal(&inode->i_ctime, &fattr->pre_ctime)) {
3732 + memcpy(&inode->i_ctime, &fattr->ctime, sizeof(inode->i_ctime));
3733 + ret |= NFS_INO_INVALID_ATTR;
3734 + }
3735
3736 if ((fattr->valid & NFS_ATTR_FATTR_PREMTIME)
3737 && (fattr->valid & NFS_ATTR_FATTR_MTIME)
3738 && timespec_equal(&inode->i_mtime, &fattr->pre_mtime)) {
3739 - memcpy(&inode->i_mtime, &fattr->mtime, sizeof(inode->i_mtime));
3740 - if (S_ISDIR(inode->i_mode))
3741 - nfsi->cache_validity |= NFS_INO_INVALID_DATA;
3742 + memcpy(&inode->i_mtime, &fattr->mtime, sizeof(inode->i_mtime));
3743 + if (S_ISDIR(inode->i_mode))
3744 + nfsi->cache_validity |= NFS_INO_INVALID_DATA;
3745 + ret |= NFS_INO_INVALID_ATTR;
3746 }
3747 if ((fattr->valid & NFS_ATTR_FATTR_PRESIZE)
3748 && (fattr->valid & NFS_ATTR_FATTR_SIZE)
3749 && i_size_read(inode) == nfs_size_to_loff_t(fattr->pre_size)
3750 - && nfsi->npages == 0)
3751 - i_size_write(inode, nfs_size_to_loff_t(fattr->size));
3752 + && nfsi->npages == 0) {
3753 + i_size_write(inode, nfs_size_to_loff_t(fattr->size));
3754 + ret |= NFS_INO_INVALID_ATTR;
3755 + }
3756 + return ret;
3757 }
3758
3759 /**
3760 @@ -1183,7 +1191,7 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
3761 | NFS_INO_REVAL_PAGECACHE);
3762
3763 /* Do atomic weak cache consistency updates */
3764 - nfs_wcc_update_inode(inode, fattr);
3765 + invalid |= nfs_wcc_update_inode(inode, fattr);
3766
3767 /* More cache consistency checks */
3768 if (fattr->valid & NFS_ATTR_FATTR_CHANGE) {
3769 diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
3770 index 3c7581b..eb4421b 100644
3771 --- a/fs/nfs/nfs4proc.c
3772 +++ b/fs/nfs/nfs4proc.c
3773 @@ -3133,6 +3133,35 @@ static void buf_to_pages(const void *buf, size_t buflen,
3774 }
3775 }
3776
3777 +static int buf_to_pages_noslab(const void *buf, size_t buflen,
3778 + struct page **pages, unsigned int *pgbase)
3779 +{
3780 + struct page *newpage, **spages;
3781 + int rc = 0;
3782 + size_t len;
3783 + spages = pages;
3784 +
3785 + do {
3786 + len = min_t(size_t, PAGE_CACHE_SIZE, buflen);
3787 + newpage = alloc_page(GFP_KERNEL);
3788 +
3789 + if (newpage == NULL)
3790 + goto unwind;
3791 + memcpy(page_address(newpage), buf, len);
3792 + buf += len;
3793 + buflen -= len;
3794 + *pages++ = newpage;
3795 + rc++;
3796 + } while (buflen != 0);
3797 +
3798 + return rc;
3799 +
3800 +unwind:
3801 + for(; rc > 0; rc--)
3802 + __free_page(spages[rc-1]);
3803 + return -ENOMEM;
3804 +}
3805 +
3806 struct nfs4_cached_acl {
3807 int cached;
3808 size_t len;
3809 @@ -3299,13 +3328,23 @@ static int __nfs4_proc_set_acl(struct inode *inode, const void *buf, size_t bufl
3810 .rpc_argp = &arg,
3811 .rpc_resp = &res,
3812 };
3813 - int ret;
3814 + int ret, i;
3815
3816 if (!nfs4_server_supports_acls(server))
3817 return -EOPNOTSUPP;
3818 + i = buf_to_pages_noslab(buf, buflen, arg.acl_pages, &arg.acl_pgbase);
3819 + if (i < 0)
3820 + return i;
3821 nfs_inode_return_delegation(inode);
3822 - buf_to_pages(buf, buflen, arg.acl_pages, &arg.acl_pgbase);
3823 ret = nfs4_call_sync(server, &msg, &arg, &res, 1);
3824 +
3825 + /*
3826 + * Free each page after tx, so the only ref left is
3827 + * held by the network stack
3828 + */
3829 + for (; i > 0; i--)
3830 + put_page(pages[i-1]);
3831 +
3832 nfs_access_zap_cache(inode);
3833 nfs_zap_acl_cache(inode);
3834 return ret;
3835 diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
3836 index 2ef4fec..2fd5287 100644
3837 --- a/fs/nfs/nfs4state.c
3838 +++ b/fs/nfs/nfs4state.c
3839 @@ -1228,7 +1228,7 @@ static void nfs4_state_manager(struct nfs_client *clp)
3840 int status = 0;
3841
3842 /* Ensure exclusive access to NFSv4 state */
3843 - for(;;) {
3844 + do {
3845 if (test_and_clear_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state)) {
3846 /* We're going to have to re-establish a clientid */
3847 status = nfs4_reclaim_lease(clp);
3848 @@ -1304,7 +1304,7 @@ static void nfs4_state_manager(struct nfs_client *clp)
3849 break;
3850 if (test_and_set_bit(NFS4CLNT_MANAGER_RUNNING, &clp->cl_state) != 0)
3851 break;
3852 - }
3853 + } while (atomic_read(&clp->cl_count) > 1);
3854 return;
3855 out_error:
3856 printk(KERN_WARNING "Error: state manager failed on NFSv4 server %s"
3857 diff --git a/fs/nfs/super.c b/fs/nfs/super.c
3858 index c0173a8..c346808 100644
3859 --- a/fs/nfs/super.c
3860 +++ b/fs/nfs/super.c
3861 @@ -1925,6 +1925,15 @@ nfs_remount(struct super_block *sb, int *flags, char *raw_data)
3862 if (error < 0)
3863 goto out;
3864
3865 + /*
3866 + * noac is a special case. It implies -o sync, but that's not
3867 + * necessarily reflected in the mtab options. do_remount_sb
3868 + * will clear MS_SYNCHRONOUS if -o sync wasn't specified in the
3869 + * remount options, so we have to explicitly reset it.
3870 + */
3871 + if (data->flags & NFS_MOUNT_NOAC)
3872 + *flags |= MS_SYNCHRONOUS;
3873 +
3874 /* compare new mount options with old ones */
3875 error = nfs_compare_remount_data(nfss, data);
3876 out:
3877 diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
3878 index 060a889..2e09588 100644
3879 --- a/fs/nfsd/vfs.c
3880 +++ b/fs/nfsd/vfs.c
3881 @@ -1379,7 +1379,7 @@ nfsd_create_v3(struct svc_rqst *rqstp, struct svc_fh *fhp,
3882 goto out;
3883 if (!(iap->ia_valid & ATTR_MODE))
3884 iap->ia_mode = 0;
3885 - err = fh_verify(rqstp, fhp, S_IFDIR, NFSD_MAY_CREATE);
3886 + err = fh_verify(rqstp, fhp, S_IFDIR, NFSD_MAY_EXEC);
3887 if (err)
3888 goto out;
3889
3890 @@ -1401,6 +1401,13 @@ nfsd_create_v3(struct svc_rqst *rqstp, struct svc_fh *fhp,
3891 if (IS_ERR(dchild))
3892 goto out_nfserr;
3893
3894 + /* If file doesn't exist, check for permissions to create one */
3895 + if (!dchild->d_inode) {
3896 + err = fh_verify(rqstp, fhp, S_IFDIR, NFSD_MAY_CREATE);
3897 + if (err)
3898 + goto out;
3899 + }
3900 +
3901 err = fh_compose(resfhp, fhp->fh_export, dchild, fhp);
3902 if (err)
3903 goto out;
3904 diff --git a/fs/partitions/ldm.c b/fs/partitions/ldm.c
3905 index 2cd9e43..a2a14cd 100644
3906 --- a/fs/partitions/ldm.c
3907 +++ b/fs/partitions/ldm.c
3908 @@ -1299,6 +1299,11 @@ static bool ldm_frag_add (const u8 *data, int size, struct list_head *frags)
3909
3910 BUG_ON (!data || !frags);
3911
3912 + if (size < 2 * VBLK_SIZE_HEAD) {
3913 + ldm_error("Value of size is to small.");
3914 + return false;
3915 + }
3916 +
3917 group = get_unaligned_be32(data + 0x08);
3918 rec = get_unaligned_be16(data + 0x0C);
3919 num = get_unaligned_be16(data + 0x0E);
3920 @@ -1306,6 +1311,10 @@ static bool ldm_frag_add (const u8 *data, int size, struct list_head *frags)
3921 ldm_error ("A VBLK claims to have %d parts.", num);
3922 return false;
3923 }
3924 + if (rec >= num) {
3925 + ldm_error("REC value (%d) exceeds NUM value (%d)", rec, num);
3926 + return false;
3927 + }
3928
3929 list_for_each (item, frags) {
3930 f = list_entry (item, struct frag, list);
3931 @@ -1334,10 +1343,9 @@ found:
3932
3933 f->map |= (1 << rec);
3934
3935 - if (num > 0) {
3936 - data += VBLK_SIZE_HEAD;
3937 - size -= VBLK_SIZE_HEAD;
3938 - }
3939 + data += VBLK_SIZE_HEAD;
3940 + size -= VBLK_SIZE_HEAD;
3941 +
3942 memcpy (f->data+rec*(size-VBLK_SIZE_HEAD)+VBLK_SIZE_HEAD, data, size);
3943
3944 return true;
3945 diff --git a/fs/partitions/osf.c b/fs/partitions/osf.c
3946 index c05c17b..9ddca58 100644
3947 --- a/fs/partitions/osf.c
3948 +++ b/fs/partitions/osf.c
3949 @@ -10,10 +10,13 @@
3950 #include "check.h"
3951 #include "osf.h"
3952
3953 +#define MAX_OSF_PARTITIONS 18
3954 +
3955 int osf_partition(struct parsed_partitions *state, struct block_device *bdev)
3956 {
3957 int i;
3958 int slot = 1;
3959 + unsigned int npartitions;
3960 Sector sect;
3961 unsigned char *data;
3962 struct disklabel {
3963 @@ -45,7 +48,7 @@ int osf_partition(struct parsed_partitions *state, struct block_device *bdev)
3964 u8 p_fstype;
3965 u8 p_frag;
3966 __le16 p_cpg;
3967 - } d_partitions[8];
3968 + } d_partitions[MAX_OSF_PARTITIONS];
3969 } * label;
3970 struct d_partition * partition;
3971
3972 @@ -63,7 +66,12 @@ int osf_partition(struct parsed_partitions *state, struct block_device *bdev)
3973 put_dev_sector(sect);
3974 return 0;
3975 }
3976 - for (i = 0 ; i < le16_to_cpu(label->d_npartitions); i++, partition++) {
3977 + npartitions = le16_to_cpu(label->d_npartitions);
3978 + if (npartitions > MAX_OSF_PARTITIONS) {
3979 + put_dev_sector(sect);
3980 + return 0;
3981 + }
3982 + for (i = 0 ; i < npartitions; i++, partition++) {
3983 if (slot == state->limit)
3984 break;
3985 if (le32_to_cpu(partition->p_size))
3986 diff --git a/fs/ubifs/recovery.c b/fs/ubifs/recovery.c
3987 index f94ddf7..31d09d1 100644
3988 --- a/fs/ubifs/recovery.c
3989 +++ b/fs/ubifs/recovery.c
3990 @@ -299,6 +299,32 @@ int ubifs_recover_master_node(struct ubifs_info *c)
3991 goto out_free;
3992 }
3993 memcpy(c->rcvrd_mst_node, c->mst_node, UBIFS_MST_NODE_SZ);
3994 +
3995 + /*
3996 + * We had to recover the master node, which means there was an
3997 + * unclean reboot. However, it is possible that the master node
3998 + * is clean at this point, i.e., %UBIFS_MST_DIRTY is not set.
3999 + * E.g., consider the following chain of events:
4000 + *
4001 + * 1. UBIFS was cleanly unmounted, so the master node is clean
4002 + * 2. UBIFS is being mounted R/W and starts changing the master
4003 + * node in the first (%UBIFS_MST_LNUM). A power cut happens,
4004 + * so this LEB ends up with some amount of garbage at the
4005 + * end.
4006 + * 3. UBIFS is being mounted R/O. We reach this place and
4007 + * recover the master node from the second LEB
4008 + * (%UBIFS_MST_LNUM + 1). But we cannot update the media
4009 + * because we are being mounted R/O. We have to defer the
4010 + * operation.
4011 + * 4. However, this master node (@c->mst_node) is marked as
4012 + * clean (since the step 1). And if we just return, the
4013 + * mount code will be confused and won't recover the master
4014 + * node when it is re-mounter R/W later.
4015 + *
4016 + * Thus, to force the recovery by marking the master node as
4017 + * dirty.
4018 + */
4019 + c->mst_node->flags |= cpu_to_le32(UBIFS_MST_DIRTY);
4020 } else {
4021 /* Write the recovered master node */
4022 c->max_sqnum = le64_to_cpu(mst->ch.sqnum) - 1;
4023 diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
4024 index eaf3636..475ca8a 100644
4025 --- a/include/linux/mmc/host.h
4026 +++ b/include/linux/mmc/host.h
4027 @@ -120,6 +120,7 @@ struct mmc_host {
4028 unsigned int f_min;
4029 unsigned int f_max;
4030 u32 ocr_avail;
4031 + struct notifier_block pm_notify;
4032
4033 #define MMC_VDD_165_195 0x00000080 /* VDD voltage 1.65 - 1.95 */
4034 #define MMC_VDD_20_21 0x00000100 /* VDD voltage 2.0 ~ 2.1 */
4035 @@ -177,6 +178,7 @@ struct mmc_host {
4036
4037 /* Only used with MMC_CAP_DISABLE */
4038 int enabled; /* host is enabled */
4039 + int rescan_disable; /* disable card detection */
4040 int nesting_cnt; /* "enable" nesting count */
4041 int en_dis_recurs; /* detect recursion */
4042 unsigned int disable_delay; /* disable delay in msecs */
4043 @@ -249,6 +251,7 @@ int mmc_card_can_sleep(struct mmc_host *host);
4044 int mmc_host_enable(struct mmc_host *host);
4045 int mmc_host_disable(struct mmc_host *host);
4046 int mmc_host_lazy_disable(struct mmc_host *host);
4047 +int mmc_pm_notify(struct notifier_block *notify_block, unsigned long, void *);
4048
4049 static inline void mmc_set_disable_delay(struct mmc_host *host,
4050 unsigned int disable_delay)
4051 diff --git a/include/net/af_unix.h b/include/net/af_unix.h
4052 index 1614d78..861045f 100644
4053 --- a/include/net/af_unix.h
4054 +++ b/include/net/af_unix.h
4055 @@ -10,6 +10,7 @@ extern void unix_inflight(struct file *fp);
4056 extern void unix_notinflight(struct file *fp);
4057 extern void unix_gc(void);
4058 extern void wait_for_unix_gc(void);
4059 +extern struct sock *unix_get_socket(struct file *filp);
4060
4061 #define UNIX_HASH_SIZE 256
4062
4063 @@ -56,6 +57,7 @@ struct unix_sock {
4064 spinlock_t lock;
4065 unsigned int gc_candidate : 1;
4066 unsigned int gc_maybe_cycle : 1;
4067 + unsigned char recursion_level;
4068 wait_queue_head_t peer_wait;
4069 };
4070 #define unix_sk(__sk) ((struct unix_sock *)__sk)
4071 diff --git a/include/net/mac80211.h b/include/net/mac80211.h
4072 index c39ed07..a2bd2f9 100644
4073 --- a/include/net/mac80211.h
4074 +++ b/include/net/mac80211.h
4075 @@ -1700,6 +1700,12 @@ void ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb);
4076 */
4077 void ieee80211_rx_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb);
4078
4079 +/*
4080 + * The TX headroom reserved by mac80211 for its own tx_status functions.
4081 + * This is enough for the radiotap header.
4082 + */
4083 +#define IEEE80211_TX_STATUS_HEADROOM 13
4084 +
4085 /**
4086 * ieee80211_tx_status - transmit status callback
4087 *
4088 diff --git a/init/Kconfig b/init/Kconfig
4089 index 0d6388a..d72691b 100644
4090 --- a/init/Kconfig
4091 +++ b/init/Kconfig
4092 @@ -1028,6 +1028,7 @@ config SLAB
4093 per cpu and per node queues.
4094
4095 config SLUB
4096 + depends on BROKEN || NUMA || !DISCONTIGMEM
4097 bool "SLUB (Unqueued Allocator)"
4098 help
4099 SLUB is a slab allocator that minimizes cache line usage
4100 diff --git a/init/main.c b/init/main.c
4101 index bc109c7..1eb4bd5 100644
4102 --- a/init/main.c
4103 +++ b/init/main.c
4104 @@ -407,16 +407,24 @@ static void __init setup_command_line(char *command_line)
4105 * gcc-3.4 accidentally inlines this function, so use noinline.
4106 */
4107
4108 +static __initdata DECLARE_COMPLETION(kthreadd_done);
4109 +
4110 static noinline void __init_refok rest_init(void)
4111 __releases(kernel_lock)
4112 {
4113 int pid;
4114
4115 rcu_scheduler_starting();
4116 + /*
4117 + * We need to spawn init first so that it obtains pid-1, however
4118 + * the init task will end up wanting to create kthreads, which, if
4119 + * we schedule it before we create kthreadd, will OOPS.
4120 + */
4121 kernel_thread(kernel_init, NULL, CLONE_FS | CLONE_SIGHAND);
4122 numa_default_policy();
4123 pid = kernel_thread(kthreadd, NULL, CLONE_FS | CLONE_FILES);
4124 kthreadd_task = find_task_by_pid_ns(pid, &init_pid_ns);
4125 + complete(&kthreadd_done);
4126 unlock_kernel();
4127
4128 /*
4129 @@ -841,6 +849,10 @@ static noinline int init_post(void)
4130
4131 static int __init kernel_init(void * unused)
4132 {
4133 + /*
4134 + * Wait until kthreadd is all set-up.
4135 + */
4136 + wait_for_completion(&kthreadd_done);
4137 lock_kernel();
4138
4139 /*
4140 diff --git a/net/can/bcm.c b/net/can/bcm.c
4141 index 029dcc2..2ffd2e0 100644
4142 --- a/net/can/bcm.c
4143 +++ b/net/can/bcm.c
4144 @@ -1425,9 +1425,14 @@ static int bcm_init(struct sock *sk)
4145 static int bcm_release(struct socket *sock)
4146 {
4147 struct sock *sk = sock->sk;
4148 - struct bcm_sock *bo = bcm_sk(sk);
4149 + struct bcm_sock *bo;
4150 struct bcm_op *op, *next;
4151
4152 + if (sk == NULL)
4153 + return 0;
4154 +
4155 + bo = bcm_sk(sk);
4156 +
4157 /* remove bcm_ops, timer, rx_unregister(), etc. */
4158
4159 unregister_netdevice_notifier(&bo->notifier);
4160 diff --git a/net/can/raw.c b/net/can/raw.c
4161 index b5e8979..c8241d0 100644
4162 --- a/net/can/raw.c
4163 +++ b/net/can/raw.c
4164 @@ -280,7 +280,12 @@ static int raw_init(struct sock *sk)
4165 static int raw_release(struct socket *sock)
4166 {
4167 struct sock *sk = sock->sk;
4168 - struct raw_sock *ro = raw_sk(sk);
4169 + struct raw_sock *ro;
4170 +
4171 + if (!sk)
4172 + return 0;
4173 +
4174 + ro = raw_sk(sk);
4175
4176 unregister_netdevice_notifier(&ro->notifier);
4177
4178 diff --git a/net/econet/af_econet.c b/net/econet/af_econet.c
4179 index 2a3b4e7..4be1db5 100644
4180 --- a/net/econet/af_econet.c
4181 +++ b/net/econet/af_econet.c
4182 @@ -30,6 +30,7 @@
4183 #include <linux/wireless.h>
4184 #include <linux/skbuff.h>
4185 #include <linux/udp.h>
4186 +#include <linux/vmalloc.h>
4187 #include <net/sock.h>
4188 #include <net/inet_common.h>
4189 #include <linux/stat.h>
4190 @@ -275,12 +276,12 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock,
4191 #endif
4192 #ifdef CONFIG_ECONET_AUNUDP
4193 struct msghdr udpmsg;
4194 - struct iovec iov[msg->msg_iovlen+1];
4195 + struct iovec iov[2];
4196 struct aunhdr ah;
4197 struct sockaddr_in udpdest;
4198 __kernel_size_t size;
4199 - int i;
4200 mm_segment_t oldfs;
4201 + char *userbuf;
4202 #endif
4203
4204 /*
4205 @@ -318,17 +319,17 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock,
4206 }
4207 }
4208
4209 - if (len + 15 > dev->mtu) {
4210 - mutex_unlock(&econet_mutex);
4211 - return -EMSGSIZE;
4212 - }
4213 -
4214 if (dev->type == ARPHRD_ECONET) {
4215 /* Real hardware Econet. We're not worthy etc. */
4216 #ifdef CONFIG_ECONET_NATIVE
4217 unsigned short proto = 0;
4218 int res;
4219
4220 + if (len + 15 > dev->mtu) {
4221 + mutex_unlock(&econet_mutex);
4222 + return -EMSGSIZE;
4223 + }
4224 +
4225 dev_hold(dev);
4226
4227 skb = sock_alloc_send_skb(sk, len+LL_ALLOCATED_SPACE(dev),
4228 @@ -404,6 +405,11 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock,
4229 return -ENETDOWN; /* No socket - can't send */
4230 }
4231
4232 + if (len > 32768) {
4233 + err = -E2BIG;
4234 + goto error;
4235 + }
4236 +
4237 /* Make up a UDP datagram and hand it off to some higher intellect. */
4238
4239 memset(&udpdest, 0, sizeof(udpdest));
4240 @@ -435,36 +441,26 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock,
4241
4242 /* tack our header on the front of the iovec */
4243 size = sizeof(struct aunhdr);
4244 - /*
4245 - * XXX: that is b0rken. We can't mix userland and kernel pointers
4246 - * in iovec, since on a lot of platforms copy_from_user() will
4247 - * *not* work with the kernel and userland ones at the same time,
4248 - * regardless of what we do with set_fs(). And we are talking about
4249 - * econet-over-ethernet here, so "it's only ARM anyway" doesn't
4250 - * apply. Any suggestions on fixing that code? -- AV
4251 - */
4252 iov[0].iov_base = (void *)&ah;
4253 iov[0].iov_len = size;
4254 - for (i = 0; i < msg->msg_iovlen; i++) {
4255 - void __user *base = msg->msg_iov[i].iov_base;
4256 - size_t len = msg->msg_iov[i].iov_len;
4257 - /* Check it now since we switch to KERNEL_DS later. */
4258 - if (!access_ok(VERIFY_READ, base, len)) {
4259 - mutex_unlock(&econet_mutex);
4260 - return -EFAULT;
4261 - }
4262 - iov[i+1].iov_base = base;
4263 - iov[i+1].iov_len = len;
4264 - size += len;
4265 +
4266 + userbuf = vmalloc(len);
4267 + if (userbuf == NULL) {
4268 + err = -ENOMEM;
4269 + goto error;
4270 }
4271
4272 + iov[1].iov_base = userbuf;
4273 + iov[1].iov_len = len;
4274 + err = memcpy_fromiovec(userbuf, msg->msg_iov, len);
4275 + if (err)
4276 + goto error_free_buf;
4277 +
4278 /* Get a skbuff (no data, just holds our cb information) */
4279 if ((skb = sock_alloc_send_skb(sk, 0,
4280 msg->msg_flags & MSG_DONTWAIT,
4281 - &err)) == NULL) {
4282 - mutex_unlock(&econet_mutex);
4283 - return err;
4284 - }
4285 + &err)) == NULL)
4286 + goto error_free_buf;
4287
4288 eb = (struct ec_cb *)&skb->cb;
4289
4290 @@ -480,7 +476,7 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock,
4291 udpmsg.msg_name = (void *)&udpdest;
4292 udpmsg.msg_namelen = sizeof(udpdest);
4293 udpmsg.msg_iov = &iov[0];
4294 - udpmsg.msg_iovlen = msg->msg_iovlen + 1;
4295 + udpmsg.msg_iovlen = 2;
4296 udpmsg.msg_control = NULL;
4297 udpmsg.msg_controllen = 0;
4298 udpmsg.msg_flags=0;
4299 @@ -488,9 +484,13 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock,
4300 oldfs = get_fs(); set_fs(KERNEL_DS); /* More privs :-) */
4301 err = sock_sendmsg(udpsock, &udpmsg, size);
4302 set_fs(oldfs);
4303 +
4304 +error_free_buf:
4305 + vfree(userbuf);
4306 #else
4307 err = -EPROTOTYPE;
4308 #endif
4309 + error:
4310 mutex_unlock(&econet_mutex);
4311
4312 return err;
4313 diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
4314 index 2ef9026..44b7910 100644
4315 --- a/net/ipv4/ip_output.c
4316 +++ b/net/ipv4/ip_output.c
4317 @@ -867,8 +867,10 @@ int ip_append_data(struct sock *sk,
4318 !exthdrlen)
4319 csummode = CHECKSUM_PARTIAL;
4320
4321 + skb = skb_peek_tail(&sk->sk_write_queue);
4322 +
4323 inet->cork.length += length;
4324 - if (((length> mtu) || !skb_queue_empty(&sk->sk_write_queue)) &&
4325 + if (((length > mtu) || (skb && skb_is_gso(skb))) &&
4326 (sk->sk_protocol == IPPROTO_UDP) &&
4327 (rt->u.dst.dev->features & NETIF_F_UFO)) {
4328 err = ip_ufo_append_data(sk, getfrag, from, length, hh_len,
4329 @@ -886,7 +888,7 @@ int ip_append_data(struct sock *sk,
4330 * adding appropriate IP header.
4331 */
4332
4333 - if ((skb = skb_peek_tail(&sk->sk_write_queue)) == NULL)
4334 + if (!skb)
4335 goto alloc_new_skb;
4336
4337 while (length > 0) {
4338 @@ -1115,7 +1117,8 @@ ssize_t ip_append_page(struct sock *sk, struct page *page,
4339 return -EINVAL;
4340
4341 inet->cork.length += size;
4342 - if ((sk->sk_protocol == IPPROTO_UDP) &&
4343 + if ((size + skb->len > mtu) &&
4344 + (sk->sk_protocol == IPPROTO_UDP) &&
4345 (rt->u.dst.dev->features & NETIF_F_UFO)) {
4346 skb_shinfo(skb)->gso_size = mtu - fragheaderlen;
4347 skb_shinfo(skb)->gso_type = SKB_GSO_UDP;
4348 diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
4349 index d1f77cc..8ac3d09 100644
4350 --- a/net/ipv6/addrconf.c
4351 +++ b/net/ipv6/addrconf.c
4352 @@ -407,9 +407,6 @@ static struct inet6_dev * ipv6_add_dev(struct net_device *dev)
4353 dev->type == ARPHRD_TUNNEL6 ||
4354 dev->type == ARPHRD_SIT ||
4355 dev->type == ARPHRD_NONE) {
4356 - printk(KERN_INFO
4357 - "%s: Disabled Privacy Extensions\n",
4358 - dev->name);
4359 ndev->cnf.use_tempaddr = -1;
4360 } else {
4361 in6_dev_hold(ndev);
4362 diff --git a/net/mac80211/main.c b/net/mac80211/main.c
4363 index 19fbd25..2dfe176 100644
4364 --- a/net/mac80211/main.c
4365 +++ b/net/mac80211/main.c
4366 @@ -859,6 +859,8 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
4367 * and we need some headroom for passing the frame to monitor
4368 * interfaces, but never both at the same time.
4369 */
4370 + BUILD_BUG_ON(IEEE80211_TX_STATUS_HEADROOM !=
4371 + sizeof(struct ieee80211_tx_status_rtap_hdr));
4372 local->tx_headroom = max_t(unsigned int , local->hw.extra_tx_headroom,
4373 sizeof(struct ieee80211_tx_status_rtap_hdr));
4374
4375 diff --git a/net/phonet/pn_dev.c b/net/phonet/pn_dev.c
4376 index 5a2275c..d94ca91 100644
4377 --- a/net/phonet/pn_dev.c
4378 +++ b/net/phonet/pn_dev.c
4379 @@ -225,6 +225,9 @@ static int phonet_device_notify(struct notifier_block *me, unsigned long what,
4380 {
4381 struct net_device *dev = arg;
4382
4383 + if (!net_eq(dev_net(dev), &init_net))
4384 + return 0;
4385 +
4386 switch (what) {
4387 case NETDEV_REGISTER:
4388 if (dev->type == ARPHRD_PHONET)
4389 diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
4390 index d270403..1d61c33 100644
4391 --- a/net/sunrpc/xprtsock.c
4392 +++ b/net/sunrpc/xprtsock.c
4393 @@ -1343,10 +1343,11 @@ static void xs_tcp_state_change(struct sock *sk)
4394 if (!(xprt = xprt_from_sock(sk)))
4395 goto out;
4396 dprintk("RPC: xs_tcp_state_change client %p...\n", xprt);
4397 - dprintk("RPC: state %x conn %d dead %d zapped %d\n",
4398 + dprintk("RPC: state %x conn %d dead %d zapped %d sk_shutdown %d\n",
4399 sk->sk_state, xprt_connected(xprt),
4400 sock_flag(sk, SOCK_DEAD),
4401 - sock_flag(sk, SOCK_ZAPPED));
4402 + sock_flag(sk, SOCK_ZAPPED),
4403 + sk->sk_shutdown);
4404
4405 switch (sk->sk_state) {
4406 case TCP_ESTABLISHED:
4407 @@ -1817,10 +1818,25 @@ static void xs_tcp_reuse_connection(struct rpc_xprt *xprt, struct sock_xprt *tra
4408 {
4409 unsigned int state = transport->inet->sk_state;
4410
4411 - if (state == TCP_CLOSE && transport->sock->state == SS_UNCONNECTED)
4412 - return;
4413 - if ((1 << state) & (TCPF_ESTABLISHED|TCPF_SYN_SENT))
4414 - return;
4415 + if (state == TCP_CLOSE && transport->sock->state == SS_UNCONNECTED) {
4416 + /* we don't need to abort the connection if the socket
4417 + * hasn't undergone a shutdown
4418 + */
4419 + if (transport->inet->sk_shutdown == 0)
4420 + return;
4421 + dprintk("RPC: %s: TCP_CLOSEd and sk_shutdown set to %d\n",
4422 + __func__, transport->inet->sk_shutdown);
4423 + }
4424 + if ((1 << state) & (TCPF_ESTABLISHED|TCPF_SYN_SENT)) {
4425 + /* we don't need to abort the connection if the socket
4426 + * hasn't undergone a shutdown
4427 + */
4428 + if (transport->inet->sk_shutdown == 0)
4429 + return;
4430 + dprintk("RPC: %s: ESTABLISHED/SYN_SENT "
4431 + "sk_shutdown set to %d\n",
4432 + __func__, transport->inet->sk_shutdown);
4433 + }
4434 xs_abort_connection(xprt, transport);
4435 }
4436
4437 diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
4438 index 065dc66..db8d51a 100644
4439 --- a/net/unix/af_unix.c
4440 +++ b/net/unix/af_unix.c
4441 @@ -503,6 +503,8 @@ static int unix_dgram_connect(struct socket *, struct sockaddr *,
4442 int, int);
4443 static int unix_seqpacket_sendmsg(struct kiocb *, struct socket *,
4444 struct msghdr *, size_t);
4445 +static int unix_seqpacket_recvmsg(struct kiocb *, struct socket *,
4446 + struct msghdr *, size_t, int);
4447
4448 static const struct proto_ops unix_stream_ops = {
4449 .family = PF_UNIX,
4450 @@ -562,7 +564,7 @@ static const struct proto_ops unix_seqpacket_ops = {
4451 .setsockopt = sock_no_setsockopt,
4452 .getsockopt = sock_no_getsockopt,
4453 .sendmsg = unix_seqpacket_sendmsg,
4454 - .recvmsg = unix_dgram_recvmsg,
4455 + .recvmsg = unix_seqpacket_recvmsg,
4456 .mmap = sock_no_mmap,
4457 .sendpage = sock_no_sendpage,
4458 };
4459 @@ -1323,9 +1325,25 @@ static void unix_destruct_fds(struct sk_buff *skb)
4460 sock_wfree(skb);
4461 }
4462
4463 +#define MAX_RECURSION_LEVEL 4
4464 +
4465 static int unix_attach_fds(struct scm_cookie *scm, struct sk_buff *skb)
4466 {
4467 int i;
4468 + unsigned char max_level = 0;
4469 + int unix_sock_count = 0;
4470 +
4471 + for (i = scm->fp->count - 1; i >= 0; i--) {
4472 + struct sock *sk = unix_get_socket(scm->fp->fp[i]);
4473 +
4474 + if (sk) {
4475 + unix_sock_count++;
4476 + max_level = max(max_level,
4477 + unix_sk(sk)->recursion_level);
4478 + }
4479 + }
4480 + if (unlikely(max_level > MAX_RECURSION_LEVEL))
4481 + return -ETOOMANYREFS;
4482
4483 /*
4484 * Need to duplicate file references for the sake of garbage
4485 @@ -1336,10 +1354,12 @@ static int unix_attach_fds(struct scm_cookie *scm, struct sk_buff *skb)
4486 if (!UNIXCB(skb).fp)
4487 return -ENOMEM;
4488
4489 - for (i = scm->fp->count-1; i >= 0; i--)
4490 - unix_inflight(scm->fp->fp[i]);
4491 + if (unix_sock_count) {
4492 + for (i = scm->fp->count - 1; i >= 0; i--)
4493 + unix_inflight(scm->fp->fp[i]);
4494 + }
4495 skb->destructor = unix_destruct_fds;
4496 - return 0;
4497 + return max_level;
4498 }
4499
4500 /*
4501 @@ -1361,6 +1381,7 @@ static int unix_dgram_sendmsg(struct kiocb *kiocb, struct socket *sock,
4502 struct sk_buff *skb;
4503 long timeo;
4504 struct scm_cookie tmp_scm;
4505 + int max_level = 0;
4506
4507 if (NULL == siocb->scm)
4508 siocb->scm = &tmp_scm;
4509 @@ -1401,8 +1422,9 @@ static int unix_dgram_sendmsg(struct kiocb *kiocb, struct socket *sock,
4510 memcpy(UNIXCREDS(skb), &siocb->scm->creds, sizeof(struct ucred));
4511 if (siocb->scm->fp) {
4512 err = unix_attach_fds(siocb->scm, skb);
4513 - if (err)
4514 + if (err < 0)
4515 goto out_free;
4516 + max_level = err + 1;
4517 }
4518 unix_get_secdata(siocb->scm, skb);
4519
4520 @@ -1483,6 +1505,8 @@ restart:
4521 }
4522
4523 skb_queue_tail(&other->sk_receive_queue, skb);
4524 + if (max_level > unix_sk(other)->recursion_level)
4525 + unix_sk(other)->recursion_level = max_level;
4526 unix_state_unlock(other);
4527 other->sk_data_ready(other, len);
4528 sock_put(other);
4529 @@ -1513,6 +1537,7 @@ static int unix_stream_sendmsg(struct kiocb *kiocb, struct socket *sock,
4530 int sent = 0;
4531 struct scm_cookie tmp_scm;
4532 bool fds_sent = false;
4533 + int max_level = 0;
4534
4535 if (NULL == siocb->scm)
4536 siocb->scm = &tmp_scm;
4537 @@ -1577,10 +1602,11 @@ static int unix_stream_sendmsg(struct kiocb *kiocb, struct socket *sock,
4538 /* Only send the fds in the first buffer */
4539 if (siocb->scm->fp && !fds_sent) {
4540 err = unix_attach_fds(siocb->scm, skb);
4541 - if (err) {
4542 + if (err < 0) {
4543 kfree_skb(skb);
4544 goto out_err;
4545 }
4546 + max_level = err + 1;
4547 fds_sent = true;
4548 }
4549
4550 @@ -1597,6 +1623,8 @@ static int unix_stream_sendmsg(struct kiocb *kiocb, struct socket *sock,
4551 goto pipe_err_free;
4552
4553 skb_queue_tail(&other->sk_receive_queue, skb);
4554 + if (max_level > unix_sk(other)->recursion_level)
4555 + unix_sk(other)->recursion_level = max_level;
4556 unix_state_unlock(other);
4557 other->sk_data_ready(other, size);
4558 sent += size;
4559 @@ -1639,6 +1667,18 @@ static int unix_seqpacket_sendmsg(struct kiocb *kiocb, struct socket *sock,
4560 return unix_dgram_sendmsg(kiocb, sock, msg, len);
4561 }
4562
4563 +static int unix_seqpacket_recvmsg(struct kiocb *iocb, struct socket *sock,
4564 + struct msghdr *msg, size_t size,
4565 + int flags)
4566 +{
4567 + struct sock *sk = sock->sk;
4568 +
4569 + if (sk->sk_state != TCP_ESTABLISHED)
4570 + return -ENOTCONN;
4571 +
4572 + return unix_dgram_recvmsg(iocb, sock, msg, size, flags);
4573 +}
4574 +
4575 static void unix_copy_addr(struct msghdr *msg, struct sock *sk)
4576 {
4577 struct unix_sock *u = unix_sk(sk);
4578 @@ -1813,6 +1853,7 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock,
4579 unix_state_lock(sk);
4580 skb = skb_dequeue(&sk->sk_receive_queue);
4581 if (skb == NULL) {
4582 + unix_sk(sk)->recursion_level = 0;
4583 if (copied >= target)
4584 goto unlock;
4585
4586 diff --git a/net/unix/garbage.c b/net/unix/garbage.c
4587 index 19c17e4..cb72e91 100644
4588 --- a/net/unix/garbage.c
4589 +++ b/net/unix/garbage.c
4590 @@ -97,7 +97,7 @@ static DECLARE_WAIT_QUEUE_HEAD(unix_gc_wait);
4591 unsigned int unix_tot_inflight;
4592
4593
4594 -static struct sock *unix_get_socket(struct file *filp)
4595 +struct sock *unix_get_socket(struct file *filp)
4596 {
4597 struct sock *u_sock = NULL;
4598 struct inode *inode = filp->f_path.dentry->d_inode;
4599 @@ -269,9 +269,16 @@ static void inc_inflight_move_tail(struct unix_sock *u)
4600 }
4601
4602 static bool gc_in_progress = false;
4603 +#define UNIX_INFLIGHT_TRIGGER_GC 16000
4604
4605 void wait_for_unix_gc(void)
4606 {
4607 + /*
4608 + * If number of inflight sockets is insane,
4609 + * force a garbage collect right now.
4610 + */
4611 + if (unix_tot_inflight > UNIX_INFLIGHT_TRIGGER_GC && !gc_in_progress)
4612 + unix_gc();
4613 wait_event(unix_gc_wait, gc_in_progress == false);
4614 }
4615
4616 diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
4617 index 9960d1c..7f97e3f 100644
4618 --- a/scripts/kconfig/conf.c
4619 +++ b/scripts/kconfig/conf.c
4620 @@ -330,7 +330,7 @@ static int conf_choice(struct menu *menu)
4621 }
4622 if (!child)
4623 continue;
4624 - if (line[strlen(line) - 1] == '?') {
4625 + if (line[0] && line[strlen(line) - 1] == '?') {
4626 print_help(child);
4627 continue;
4628 }
4629 diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c
4630 index 8ba3068..72c1b56 100644
4631 --- a/sound/pci/hda/patch_cirrus.c
4632 +++ b/sound/pci/hda/patch_cirrus.c
4633 @@ -65,7 +65,9 @@ struct cs_spec {
4634
4635 /* available models */
4636 enum {
4637 + CS420X_MBP53,
4638 CS420X_MBP55,
4639 + CS420X_IMAC27,
4640 CS420X_AUTO,
4641 CS420X_MODELS
4642 };
4643 @@ -832,7 +834,9 @@ static void cs_automute(struct hda_codec *codec)
4644 AC_VERB_SET_PIN_WIDGET_CONTROL,
4645 hp_present ? 0 : PIN_OUT);
4646 }
4647 - if (spec->board_config == CS420X_MBP55) {
4648 + if (spec->board_config == CS420X_MBP53 ||
4649 + spec->board_config == CS420X_MBP55 ||
4650 + spec->board_config == CS420X_IMAC27) {
4651 unsigned int gpio = hp_present ? 0x02 : 0x08;
4652 snd_hda_codec_write(codec, 0x01, 0,
4653 AC_VERB_SET_GPIO_DATA, gpio);
4654 @@ -1077,13 +1081,19 @@ static int cs_parse_auto_config(struct hda_codec *codec)
4655 }
4656
4657 static const char *cs420x_models[CS420X_MODELS] = {
4658 + [CS420X_MBP53] = "mbp53",
4659 [CS420X_MBP55] = "mbp55",
4660 + [CS420X_IMAC27] = "imac27",
4661 [CS420X_AUTO] = "auto",
4662 };
4663
4664
4665 static struct snd_pci_quirk cs420x_cfg_tbl[] = {
4666 + SND_PCI_QUIRK(0x10de, 0x0ac0, "MacBookPro 5,3", CS420X_MBP53),
4667 + SND_PCI_QUIRK(0x10de, 0x0d94, "MacBookAir 3,1(2)", CS420X_MBP55),
4668 SND_PCI_QUIRK(0x10de, 0xcb79, "MacBookPro 5,5", CS420X_MBP55),
4669 + SND_PCI_QUIRK(0x10de, 0xcb89, "MacBookPro 7,1", CS420X_MBP55),
4670 + SND_PCI_QUIRK(0x8086, 0x7270, "IMac 27 Inch", CS420X_IMAC27),
4671 {} /* terminator */
4672 };
4673
4674 @@ -1092,6 +1102,20 @@ struct cs_pincfg {
4675 u32 val;
4676 };
4677
4678 +static struct cs_pincfg mbp53_pincfgs[] = {
4679 + { 0x09, 0x012b4050 },
4680 + { 0x0a, 0x90100141 },
4681 + { 0x0b, 0x90100140 },
4682 + { 0x0c, 0x018b3020 },
4683 + { 0x0d, 0x90a00110 },
4684 + { 0x0e, 0x400000f0 },
4685 + { 0x0f, 0x01cbe030 },
4686 + { 0x10, 0x014be060 },
4687 + { 0x12, 0x400000f0 },
4688 + { 0x15, 0x400000f0 },
4689 + {} /* terminator */
4690 +};
4691 +
4692 static struct cs_pincfg mbp55_pincfgs[] = {
4693 { 0x09, 0x012b4030 },
4694 { 0x0a, 0x90100121 },
4695 @@ -1106,8 +1130,24 @@ static struct cs_pincfg mbp55_pincfgs[] = {
4696 {} /* terminator */
4697 };
4698
4699 +static struct cs_pincfg imac27_pincfgs[] = {
4700 + { 0x09, 0x012b4050 },
4701 + { 0x0a, 0x90100140 },
4702 + { 0x0b, 0x90100142 },
4703 + { 0x0c, 0x018b3020 },
4704 + { 0x0d, 0x90a00110 },
4705 + { 0x0e, 0x400000f0 },
4706 + { 0x0f, 0x01cbe030 },
4707 + { 0x10, 0x014be060 },
4708 + { 0x12, 0x01ab9070 },
4709 + { 0x15, 0x400000f0 },
4710 + {} /* terminator */
4711 +};
4712 +
4713 static struct cs_pincfg *cs_pincfgs[CS420X_MODELS] = {
4714 + [CS420X_MBP53] = mbp53_pincfgs,
4715 [CS420X_MBP55] = mbp55_pincfgs,
4716 + [CS420X_IMAC27] = imac27_pincfgs,
4717 };
4718
4719 static void fix_pincfg(struct hda_codec *codec, int model)
4720 @@ -1137,6 +1177,8 @@ static int patch_cs420x(struct hda_codec *codec)
4721 fix_pincfg(codec, spec->board_config);
4722
4723 switch (spec->board_config) {
4724 + case CS420X_IMAC27:
4725 + case CS420X_MBP53:
4726 case CS420X_MBP55:
4727 /* GPIO1 = headphones */
4728 /* GPIO3 = speakers */
4729 diff --git a/sound/ppc/tumbler.c b/sound/ppc/tumbler.c
4730 index 08e584d..578c9f2 100644
4731 --- a/sound/ppc/tumbler.c
4732 +++ b/sound/ppc/tumbler.c
4733 @@ -30,6 +30,7 @@
4734 #include <linux/kmod.h>
4735 #include <linux/slab.h>
4736 #include <linux/interrupt.h>
4737 +#include <linux/string.h>
4738 #include <sound/core.h>
4739 #include <asm/io.h>
4740 #include <asm/irq.h>
4741 @@ -46,6 +47,8 @@
4742 #define DBG(fmt...)
4743 #endif
4744
4745 +#define IS_G4DA (machine_is_compatible("PowerMac3,4"))
4746 +
4747 /* i2c address for tumbler */
4748 #define TAS_I2C_ADDR 0x34
4749
4750 @@ -1134,7 +1137,8 @@ static long tumbler_find_device(const char *device, const char *platform,
4751 gp->inactive_val = (*base) ? 0x4 : 0x5;
4752 } else {
4753 const u32 *prop = NULL;
4754 - gp->active_state = 0;
4755 + gp->active_state = IS_G4DA
4756 + && !strncmp(device, "keywest-gpio1", 13);
4757 gp->active_val = 0x4;
4758 gp->inactive_val = 0x5;
4759 /* Here are some crude hacks to extract the GPIO polarity and
4760 @@ -1312,6 +1316,9 @@ static int __devinit tumbler_init(struct snd_pmac *chip)
4761 if (irq <= NO_IRQ)
4762 irq = tumbler_find_device("line-output-detect",
4763 NULL, &mix->line_detect, 1);
4764 + if (IS_G4DA && irq <= NO_IRQ)
4765 + irq = tumbler_find_device("keywest-gpio16",
4766 + NULL, &mix->line_detect, 1);
4767 mix->lineout_irq = irq;
4768
4769 tumbler_reset_audio(chip);
4770 diff --git a/sound/soc/codecs/wm_hubs.c b/sound/soc/codecs/wm_hubs.c
4771 index e542027..a80f1ad 100644
4772 --- a/sound/soc/codecs/wm_hubs.c
4773 +++ b/sound/soc/codecs/wm_hubs.c
4774 @@ -593,12 +593,12 @@ static const struct snd_soc_dapm_route analogue_routes[] = {
4775
4776 { "SPKL", "Input Switch", "MIXINL" },
4777 { "SPKL", "IN1LP Switch", "IN1LP" },
4778 - { "SPKL", "Output Switch", "Left Output Mixer" },
4779 + { "SPKL", "Output Switch", "Left Output PGA" },
4780 { "SPKL", NULL, "TOCLK" },
4781
4782 { "SPKR", "Input Switch", "MIXINR" },
4783 { "SPKR", "IN1RP Switch", "IN1RP" },
4784 - { "SPKR", "Output Switch", "Right Output Mixer" },
4785 + { "SPKR", "Output Switch", "Right Output PGA" },
4786 { "SPKR", NULL, "TOCLK" },
4787
4788 { "SPKL Boost", "Direct Voice Switch", "Direct Voice" },
4789 @@ -620,8 +620,8 @@ static const struct snd_soc_dapm_route analogue_routes[] = {
4790 { "SPKOUTRP", NULL, "SPKR Driver" },
4791 { "SPKOUTRN", NULL, "SPKR Driver" },
4792
4793 - { "Left Headphone Mux", "Mixer", "Left Output Mixer" },
4794 - { "Right Headphone Mux", "Mixer", "Right Output Mixer" },
4795 + { "Left Headphone Mux", "Mixer", "Left Output PGA" },
4796 + { "Right Headphone Mux", "Mixer", "Right Output PGA" },
4797
4798 { "Headphone PGA", NULL, "Left Headphone Mux" },
4799 { "Headphone PGA", NULL, "Right Headphone Mux" },
4800 diff --git a/sound/synth/emux/emux_hwdep.c b/sound/synth/emux/emux_hwdep.c
4801 index ff0b2a8..5ae1eae 100644
4802 --- a/sound/synth/emux/emux_hwdep.c
4803 +++ b/sound/synth/emux/emux_hwdep.c
4804 @@ -128,6 +128,9 @@ snd_emux_init_hwdep(struct snd_emux *emu)
4805 strcpy(hw->name, SNDRV_EMUX_HWDEP_NAME);
4806 hw->iface = SNDRV_HWDEP_IFACE_EMUX_WAVETABLE;
4807 hw->ops.ioctl = snd_emux_hwdep_ioctl;
4808 + /* The ioctl parameter types are compatible between 32- and
4809 + * 64-bit architectures, so use the same function. */
4810 + hw->ops.ioctl_compat = snd_emux_hwdep_ioctl;
4811 hw->exclusive = 1;
4812 hw->private_data = emu;
4813 if ((err = snd_card_register(emu->card)) < 0)
4814 diff --git a/tools/perf/Makefile b/tools/perf/Makefile
4815 index 719d028..e5c942b 100644
4816 --- a/tools/perf/Makefile
4817 +++ b/tools/perf/Makefile
4818 @@ -2,6 +2,7 @@
4819 all::
4820
4821 # Define V=1 to have a more verbose compile.
4822 +# Define V=2 to have an even more verbose compile.
4823 #
4824 # Define SNPRINTF_RETURNS_BOGUS if your are on a system which snprintf()
4825 # or vsnprintf() return -1 instead of number of characters which would
4826 @@ -145,6 +146,10 @@ all::
4827 # Define NO_EXTERNAL_GREP if you don't want "perf grep" to ever call
4828 # your external grep (e.g., if your system lacks grep, if its grep is
4829 # broken, or spawning external process is slower than built-in grep perf has).
4830 +#
4831 +# Define LDFLAGS=-static to build a static binary.
4832 +#
4833 +# Define EXTRA_CFLAGS=-m64 or EXTRA_CFLAGS=-m32 as appropriate for cross-builds.
4834
4835 PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE
4836 @$(SHELL_PATH) util/PERF-VERSION-GEN
4837 @@ -157,20 +162,6 @@ uname_R := $(shell sh -c 'uname -r 2>/dev/null || echo not')
4838 uname_P := $(shell sh -c 'uname -p 2>/dev/null || echo not')
4839 uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not')
4840
4841 -#
4842 -# Add -m32 for cross-builds:
4843 -#
4844 -ifdef NO_64BIT
4845 - MBITS := -m32
4846 -else
4847 - #
4848 - # If we're on a 64-bit kernel, use -m64:
4849 - #
4850 - ifneq ($(patsubst %64,%,$(uname_M)),$(uname_M))
4851 - MBITS := -m64
4852 - endif
4853 -endif
4854 -
4855 # CFLAGS and LDFLAGS are for the users to override from the command line.
4856
4857 #
4858 @@ -200,8 +191,15 @@ EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wold-style-definition
4859 EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wstrict-prototypes
4860 EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wdeclaration-after-statement
4861
4862 -CFLAGS = $(MBITS) -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -fstack-protector-all -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS)
4863 -LDFLAGS = -lpthread -lrt -lelf -lm
4864 +ifeq ("$(origin DEBUG)", "command line")
4865 + PERF_DEBUG = $(DEBUG)
4866 +endif
4867 +ifndef PERF_DEBUG
4868 + CFLAGS_OPTIMIZE = -O6
4869 +endif
4870 +
4871 +CFLAGS = -ggdb3 -Wall -Wextra -std=gnu99 -Werror $(CFLAGS_OPTIMIZE) -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS) $(EXTRA_CFLAGS)
4872 +EXTLIBS = -lpthread -lrt -lelf -lm
4873 ALL_CFLAGS = $(CFLAGS)
4874 ALL_LDFLAGS = $(LDFLAGS)
4875 STRIP ?= strip
4876 @@ -254,6 +252,21 @@ PTHREAD_LIBS = -lpthread
4877 # explicitly what architecture to check for. Fix this up for yours..
4878 SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__
4879
4880 +ifeq ($(V), 2)
4881 + QUIET_STDERR = ">/dev/null"
4882 +else
4883 + QUIET_STDERR = ">/dev/null 2>&1"
4884 +endif
4885 +
4886 +BITBUCKET = "/dev/null"
4887 +
4888 +ifneq ($(shell sh -c "(echo '\#include <stdio.h>'; echo 'int main(void) { return puts(\"hi\"); }') | $(CC) -x c - $(ALL_CFLAGS) -o $(BITBUCKET) "$(QUIET_STDERR)" && echo y"), y)
4889 + BITBUCKET = .perf.dev.null
4890 +endif
4891 +
4892 +ifeq ($(shell sh -c "echo 'int foo(void) {char X[2]; return 3;}' | $(CC) -x c -c -Werror -fstack-protector-all - -o $(BITBUCKET) "$(QUIET_STDERR)" && echo y"), y)
4893 + CFLAGS := $(CFLAGS) -fstack-protector-all
4894 +endif
4895
4896
4897 ### --- END CONFIGURATION SECTION ---
4898 @@ -423,36 +436,43 @@ ifeq ($(uname_S),Darwin)
4899 PTHREAD_LIBS =
4900 endif
4901
4902 -ifeq ($(shell sh -c "(echo '\#include <libelf.h>'; echo 'int main(void) { Elf * elf = elf_begin(0, ELF_C_READ, 0); return (long)elf; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o /dev/null $(ALL_LDFLAGS) > /dev/null 2>&1 && echo y"), y)
4903 - ifneq ($(shell sh -c "(echo '\#include <libelf.h>'; echo 'int main(void) { Elf * elf = elf_begin(0, ELF_C_READ_MMAP, 0); return (long)elf; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o /dev/null $(ALL_LDFLAGS) > /dev/null 2>&1 && echo y"), y)
4904 +ifneq ($(shell sh -c "(echo '\#include <gnu/libc-version.h>'; echo 'int main(void) { const char * version = gnu_get_libc_version(); return (long)version; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y)
4905 + msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static);
4906 +endif
4907 +
4908 +ifeq ($(shell sh -c "(echo '\#include <libelf.h>'; echo 'int main(void) { Elf * elf = elf_begin(0, ELF_C_READ, 0); return (long)elf; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y)
4909 + ifneq ($(shell sh -c "(echo '\#include <libelf.h>'; echo 'int main(void) { Elf * elf = elf_begin(0, ELF_C_READ_MMAP, 0); return (long)elf; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y)
4910 BASIC_CFLAGS += -DLIBELF_NO_MMAP
4911 endif
4912 else
4913 - msg := $(error No libelf.h/libelf found, please install libelf-dev/elfutils-libelf-devel and glibc-dev[el]);
4914 + msg := $(error No libelf.h/libelf found, please install libelf-dev/elfutils-libelf-devel);
4915 endif
4916
4917 ifdef NO_DEMANGLE
4918 BASIC_CFLAGS += -DNO_DEMANGLE
4919 +else ifdef HAVE_CPLUS_DEMANGLE
4920 + EXTLIBS += -liberty
4921 + BASIC_CFLAGS += -DHAVE_CPLUS_DEMANGLE
4922 else
4923 - has_bfd := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o /dev/null $(ALL_LDFLAGS) -lbfd > /dev/null 2>&1 && echo y")
4924 + has_bfd := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) -lbfd "$(QUIET_STDERR)" && echo y")
4925
4926 ifeq ($(has_bfd),y)
4927 EXTLIBS += -lbfd
4928 else
4929 - has_bfd_iberty := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o /dev/null $(ALL_LDFLAGS) -lbfd -liberty > /dev/null 2>&1 && echo y")
4930 + has_bfd_iberty := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) -lbfd -liberty "$(QUIET_STDERR)" && echo y")
4931 ifeq ($(has_bfd_iberty),y)
4932 EXTLIBS += -lbfd -liberty
4933 else
4934 - has_bfd_iberty_z := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o /dev/null $(ALL_LDFLAGS) -lbfd -liberty -lz > /dev/null 2>&1 && echo y")
4935 + has_bfd_iberty_z := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) -lbfd -liberty -lz "$(QUIET_STDERR)" && echo y")
4936 ifeq ($(has_bfd_iberty_z),y)
4937 EXTLIBS += -lbfd -liberty -lz
4938 else
4939 - has_cplus_demangle := $(shell sh -c "(echo 'extern char *cplus_demangle(const char *, int);'; echo 'int main(void) { cplus_demangle(0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o /dev/null $(ALL_LDFLAGS) -liberty > /dev/null 2>&1 && echo y")
4940 + has_cplus_demangle := $(shell sh -c "(echo 'extern char *cplus_demangle(const char *, int);'; echo 'int main(void) { cplus_demangle(0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) -liberty "$(QUIET_STDERR)" && echo y")
4941 ifeq ($(has_cplus_demangle),y)
4942 EXTLIBS += -liberty
4943 BASIC_CFLAGS += -DHAVE_CPLUS_DEMANGLE
4944 else
4945 - msg := $(warning No bfd.h/libbfd found, install binutils-dev[el] to gain symbol demangling)
4946 + msg := $(warning No bfd.h/libbfd found, install binutils-dev[el]/zlib-static to gain symbol demangling)
4947 BASIC_CFLAGS += -DNO_DEMANGLE
4948 endif
4949 endif
4950 @@ -695,7 +715,7 @@ export TAR INSTALL DESTDIR SHELL_PATH
4951
4952 SHELL = $(SHELL_PATH)
4953
4954 -all:: shell_compatibility_test $(ALL_PROGRAMS) $(BUILT_INS) $(OTHER_PROGRAMS) PERF-BUILD-OPTIONS
4955 +all:: .perf.dev.null shell_compatibility_test $(ALL_PROGRAMS) $(BUILT_INS) $(OTHER_PROGRAMS) PERF-BUILD-OPTIONS
4956 ifneq (,$X)
4957 $(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) perf$X)), test '$p' -ef '$p$X' || $(RM) '$p';)
4958 endif
4959 @@ -998,6 +1018,11 @@ clean:
4960 .PHONY: .FORCE-PERF-VERSION-FILE TAGS tags cscope .FORCE-PERF-CFLAGS
4961 .PHONY: .FORCE-PERF-BUILD-OPTIONS
4962
4963 +.perf.dev.null:
4964 + touch .perf.dev.null
4965 +
4966 +.INTERMEDIATE: .perf.dev.null
4967 +
4968 ### Make sure built-ins do not have dups and listed in perf.c
4969 #
4970 check-builtins::

  ViewVC Help
Powered by ViewVC 1.1.20