Magellan Linux

Contents of /trunk/kernel26-magellan/patches-2.6.31-r4/0104-2.6.31.5-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


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

1 diff --git a/Documentation/connector/cn_test.c b/Documentation/connector/cn_test.c
2 index 6a5be5d..473c589 100644
3 --- a/Documentation/connector/cn_test.c
4 +++ b/Documentation/connector/cn_test.c
5 @@ -32,10 +32,8 @@ static char cn_test_name[] = "cn_test";
6 static struct sock *nls;
7 static struct timer_list cn_test_timer;
8
9 -void cn_test_callback(void *data)
10 +static void cn_test_callback(struct cn_msg *msg, struct netlink_skb_parms *nsp)
11 {
12 - struct cn_msg *msg = (struct cn_msg *)data;
13 -
14 printk("%s: %lu: idx=%x, val=%x, seq=%u, ack=%u, len=%d: %s.\n",
15 __func__, jiffies, msg->id.idx, msg->id.val,
16 msg->seq, msg->ack, msg->len, (char *)msg->data);
17 diff --git a/Documentation/connector/connector.txt b/Documentation/connector/connector.txt
18 index ad6e0ba..3e6dcc7 100644
19 --- a/Documentation/connector/connector.txt
20 +++ b/Documentation/connector/connector.txt
21 @@ -23,7 +23,7 @@ handling... Connector allows any kernelspace agents to use netlink
22 based networking for inter-process communication in a significantly
23 easier way:
24
25 -int cn_add_callback(struct cb_id *id, char *name, void (*callback) (void *));
26 +int cn_add_callback(struct cb_id *id, char *name, void (*callback) (struct cn_msg *, struct netlink_skb_parms *));
27 void cn_netlink_send(struct cn_msg *msg, u32 __group, int gfp_mask);
28
29 struct cb_id
30 @@ -53,15 +53,15 @@ struct cn_msg
31 Connector interfaces.
32 /*****************************************/
33
34 -int cn_add_callback(struct cb_id *id, char *name, void (*callback) (void *));
35 +int cn_add_callback(struct cb_id *id, char *name, void (*callback) (struct cn_msg *, struct netlink_skb_parms *));
36
37 Registers new callback with connector core.
38
39 struct cb_id *id - unique connector's user identifier.
40 It must be registered in connector.h for legal in-kernel users.
41 char *name - connector's callback symbolic name.
42 -void (*callback) (void *) - connector's callback.
43 - Argument must be dereferenced to struct cn_msg *.
44 +void (*callback) (struct cn..) - connector's callback.
45 + cn_msg and the sender's credentials
46
47 void cn_del_callback(struct cb_id *id);
48
49 diff --git a/MAINTAINERS b/MAINTAINERS
50 index 2ccc21c..94138c4 100644
51 --- a/MAINTAINERS
52 +++ b/MAINTAINERS
53 @@ -1992,7 +1992,7 @@ S: Maintained
54 F: fs/*
55
56 FINTEK F75375S HARDWARE MONITOR AND FAN CONTROLLER DRIVER
57 -M: Riku Voipio <riku.vipio@iki.fi>
58 +M: Riku Voipio <riku.voipio@iki.fi>
59 L: lm-sensors@lm-sensors.org
60 S: Maintained
61 F: drivers/hwmon/f75375s.c
62 diff --git a/Makefile b/Makefile
63 index 314a3aa..8190a1c 100644
64 --- a/Makefile
65 +++ b/Makefile
66 @@ -980,11 +980,6 @@ prepare0: archprepare FORCE
67 # All the preparing..
68 prepare: prepare0
69
70 -# Leave this as default for preprocessing vmlinux.lds.S, which is now
71 -# done in arch/$(ARCH)/kernel/Makefile
72 -
73 -export CPPFLAGS_vmlinux.lds += -P -C -U$(ARCH)
74 -
75 # The asm symlink changes when $(ARCH) changes.
76 # Detect this and ask user to run make mrproper
77 # If asm is a stale symlink (point to dir that does not exist) remove it
78 diff --git a/arch/arm/Makefile b/arch/arm/Makefile
79 index c877d6d..41edaf2 100644
80 --- a/arch/arm/Makefile
81 +++ b/arch/arm/Makefile
82 @@ -14,7 +14,7 @@ LDFLAGS_vmlinux :=-p --no-undefined -X
83 ifeq ($(CONFIG_CPU_ENDIAN_BE8),y)
84 LDFLAGS_vmlinux += --be8
85 endif
86 -CPPFLAGS_vmlinux.lds = -DTEXT_OFFSET=$(TEXT_OFFSET)
87 +
88 OBJCOPYFLAGS :=-O binary -R .note -R .note.gnu.build-id -R .comment -S
89 GZFLAGS :=-9
90 #KBUILD_CFLAGS +=-pipe
91 diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile
92 index ff89d0b..60be28d 100644
93 --- a/arch/arm/kernel/Makefile
94 +++ b/arch/arm/kernel/Makefile
95 @@ -2,7 +2,8 @@
96 # Makefile for the linux kernel.
97 #
98
99 -AFLAGS_head.o := -DTEXT_OFFSET=$(TEXT_OFFSET)
100 +CPPFLAGS_vmlinux.lds := -DTEXT_OFFSET=$(TEXT_OFFSET)
101 +AFLAGS_head.o := -DTEXT_OFFSET=$(TEXT_OFFSET)
102
103 ifdef CONFIG_DYNAMIC_FTRACE
104 CFLAGS_REMOVE_ftrace.o = -pg
105 diff --git a/arch/arm/mach-pxa/cpufreq-pxa2xx.c b/arch/arm/mach-pxa/cpufreq-pxa2xx.c
106 index 3a8ee22..983cc8c 100644
107 --- a/arch/arm/mach-pxa/cpufreq-pxa2xx.c
108 +++ b/arch/arm/mach-pxa/cpufreq-pxa2xx.c
109 @@ -155,7 +155,7 @@ MODULE_PARM_DESC(pxa255_turbo_table, "Selects the frequency table (0 = run table
110
111 static pxa_freqs_t pxa27x_freqs[] = {
112 {104000, 104000, PXA27x_CCCR(1, 8, 2), 0, CCLKCFG2(1, 0, 1), 900000, 1705000 },
113 - {156000, 104000, PXA27x_CCCR(1, 8, 6), 0, CCLKCFG2(1, 1, 1), 1000000, 1705000 },
114 + {156000, 104000, PXA27x_CCCR(1, 8, 3), 0, CCLKCFG2(1, 0, 1), 1000000, 1705000 },
115 {208000, 208000, PXA27x_CCCR(0, 16, 2), 1, CCLKCFG2(0, 0, 1), 1180000, 1705000 },
116 {312000, 208000, PXA27x_CCCR(1, 16, 3), 1, CCLKCFG2(1, 0, 1), 1250000, 1705000 },
117 {416000, 208000, PXA27x_CCCR(1, 16, 4), 1, CCLKCFG2(1, 0, 1), 1350000, 1705000 },
118 diff --git a/arch/cris/Makefile b/arch/cris/Makefile
119 index 71e17d3..29c2ceb 100644
120 --- a/arch/cris/Makefile
121 +++ b/arch/cris/Makefile
122 @@ -42,8 +42,6 @@ LD = $(CROSS_COMPILE)ld -mcrislinux
123
124 OBJCOPYFLAGS := -O binary -R .note -R .comment -S
125
126 -CPPFLAGS_vmlinux.lds = -DDRAM_VIRTUAL_BASE=0x$(CONFIG_ETRAX_DRAM_VIRTUAL_BASE)
127 -
128 KBUILD_AFLAGS += -mlinux -march=$(arch-y) $(inc)
129 KBUILD_CFLAGS += -mlinux -march=$(arch-y) -pipe $(inc)
130 KBUILD_CPPFLAGS += $(inc)
131 diff --git a/arch/cris/kernel/Makefile b/arch/cris/kernel/Makefile
132 index ee7bcd4..b45640b 100644
133 --- a/arch/cris/kernel/Makefile
134 +++ b/arch/cris/kernel/Makefile
135 @@ -3,6 +3,7 @@
136 # Makefile for the linux kernel.
137 #
138
139 +CPPFLAGS_vmlinux.lds := -DDRAM_VIRTUAL_BASE=0x$(CONFIG_ETRAX_DRAM_VIRTUAL_BASE)
140 extra-y := vmlinux.lds
141
142 obj-y := process.o traps.o irq.o ptrace.o setup.o time.o sys_cris.o
143 diff --git a/arch/mips/Makefile b/arch/mips/Makefile
144 index 861da51..7d651d5 100644
145 --- a/arch/mips/Makefile
146 +++ b/arch/mips/Makefile
147 @@ -615,16 +615,6 @@ endif
148 cflags-y += -I$(srctree)/arch/mips/include/asm/mach-generic
149 drivers-$(CONFIG_PCI) += arch/mips/pci/
150
151 -ifdef CONFIG_32BIT
152 -ifdef CONFIG_CPU_LITTLE_ENDIAN
153 -JIFFIES = jiffies_64
154 -else
155 -JIFFIES = jiffies_64 + 4
156 -endif
157 -else
158 -JIFFIES = jiffies_64
159 -endif
160 -
161 #
162 # Automatically detect the build format. By default we choose
163 # the elf format according to the load address.
164 @@ -648,8 +638,9 @@ ifdef CONFIG_64BIT
165 endif
166
167 KBUILD_AFLAGS += $(cflags-y)
168 -KBUILD_CFLAGS += $(cflags-y) \
169 - -D"VMLINUX_LOAD_ADDRESS=$(load-y)"
170 +KBUILD_CFLAGS += $(cflags-y)
171 +KBUILD_CPPFLAGS += -D"VMLINUX_LOAD_ADDRESS=$(load-y)"
172 +KBUILD_CPPFLAGS += -D"DATAOFFSET=$(if $(dataoffset-y),$(dataoffset-y),0)"
173
174 LDFLAGS += -m $(ld-emul)
175
176 @@ -664,18 +655,6 @@ endif
177
178 OBJCOPYFLAGS += --remove-section=.reginfo
179
180 -#
181 -# Choosing incompatible machines durings configuration will result in
182 -# error messages during linking. Select a default linkscript if
183 -# none has been choosen above.
184 -#
185 -
186 -CPPFLAGS_vmlinux.lds := \
187 - $(KBUILD_CFLAGS) \
188 - -D"LOADADDR=$(load-y)" \
189 - -D"JIFFIES=$(JIFFIES)" \
190 - -D"DATAOFFSET=$(if $(dataoffset-y),$(dataoffset-y),0)"
191 -
192 head-y := arch/mips/kernel/head.o arch/mips/kernel/init_task.o
193
194 libs-y += arch/mips/lib/
195 diff --git a/arch/mips/kernel/vmlinux.lds.S b/arch/mips/kernel/vmlinux.lds.S
196 index 58738c8..576f8fb 100644
197 --- a/arch/mips/kernel/vmlinux.lds.S
198 +++ b/arch/mips/kernel/vmlinux.lds.S
199 @@ -9,7 +9,16 @@ PHDRS {
200 text PT_LOAD FLAGS(7); /* RWX */
201 note PT_NOTE FLAGS(4); /* R__ */
202 }
203 -jiffies = JIFFIES;
204 +
205 +ifdef CONFIG_32BIT
206 + ifdef CONFIG_CPU_LITTLE_ENDIAN
207 + jiffies = jiffies_64;
208 + else
209 + jiffies = jiffies_64 + 4;
210 + endif
211 +else
212 + jiffies = jiffies_64;
213 +endif
214
215 SECTIONS
216 {
217 @@ -28,7 +37,7 @@ SECTIONS
218 /* . = 0xa800000000300000; */
219 . = 0xffffffff80300000;
220 #endif
221 - . = LOADADDR;
222 + . = VMLINUX_LOAD_ADDRESS;
223 /* read-only */
224 _text = .; /* Text and read-only data */
225 .text : {
226 diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
227 index bc35f4e..39d44f7 100644
228 --- a/arch/powerpc/Makefile
229 +++ b/arch/powerpc/Makefile
230 @@ -158,8 +158,6 @@ drivers-$(CONFIG_OPROFILE) += arch/powerpc/oprofile/
231 # Default to zImage, override when needed
232 all: zImage
233
234 -CPPFLAGS_vmlinux.lds := -Upowerpc
235 -
236 BOOT_TARGETS = zImage zImage.initrd uImage zImage% dtbImage% treeImage.% cuImage.% simpleImage.%
237
238 PHONY += $(BOOT_TARGETS)
239 diff --git a/arch/sparc/Makefile b/arch/sparc/Makefile
240 index 2003ded..6c21179 100644
241 --- a/arch/sparc/Makefile
242 +++ b/arch/sparc/Makefile
243 @@ -31,7 +31,6 @@ export BITS := 32
244 #KBUILD_CFLAGS += -g -pipe -fcall-used-g5 -fcall-used-g7
245 KBUILD_CFLAGS += -m32 -pipe -mno-fpu -fcall-used-g5 -fcall-used-g7
246 KBUILD_AFLAGS += -m32
247 -CPPFLAGS_vmlinux.lds += -m32
248
249 #LDFLAGS_vmlinux = -N -Ttext 0xf0004000
250 # Since 2.5.40, the first stage is left not btfix-ed.
251 @@ -49,9 +48,6 @@ else
252
253 CHECKFLAGS += -D__sparc__ -D__sparc_v9__ -D__arch64__ -m64
254
255 -# Undefine sparc when processing vmlinux.lds - it is used
256 -# And teach CPP we are doing 64 bit builds (for this case)
257 -CPPFLAGS_vmlinux.lds += -m64 -Usparc
258 LDFLAGS := -m elf64_sparc
259 export BITS := 64
260
261 diff --git a/arch/sparc/kernel/Makefile b/arch/sparc/kernel/Makefile
262 index 475ce46..cbf5d0b 100644
263 --- a/arch/sparc/kernel/Makefile
264 +++ b/arch/sparc/kernel/Makefile
265 @@ -7,7 +7,11 @@ ccflags-y := -Werror
266
267 extra-y := head_$(BITS).o
268 extra-y += init_task.o
269 -extra-y += vmlinux.lds
270 +
271 +# Undefine sparc when processing vmlinux.lds - it is used
272 +# And teach CPP we are doing $(BITS) builds (for this case)
273 +CPPFLAGS_vmlinux.lds := -Usparc -m$(BITS)
274 +extra-y += vmlinux.lds
275
276 obj-$(CONFIG_SPARC32) += entry.o wof.o wuf.o
277 obj-$(CONFIG_SPARC32) += etrap_32.o
278 diff --git a/arch/um/Makefile b/arch/um/Makefile
279 index 0728def..fc633db 100644
280 --- a/arch/um/Makefile
281 +++ b/arch/um/Makefile
282 @@ -96,11 +96,10 @@ CFLAGS_NO_HARDENING := $(call cc-option, -fno-PIC,) $(call cc-option, -fno-pic,)
283 $(call cc-option, -fno-stack-protector,) \
284 $(call cc-option, -fno-stack-protector-all,)
285
286 -CONFIG_KERNEL_STACK_ORDER ?= 2
287 -STACK_SIZE := $(shell echo $$[ 4096 * (1 << $(CONFIG_KERNEL_STACK_ORDER)) ] )
288 -
289 -CPPFLAGS_vmlinux.lds = -U$(SUBARCH) -DSTART=$(START) -DELF_ARCH=$(ELF_ARCH) \
290 - -DELF_FORMAT="$(ELF_FORMAT)" -DKERNEL_STACK_SIZE=$(STACK_SIZE)
291 +# Options used by linker script
292 +export LDS_START := $(START)
293 +export LDS_ELF_ARCH := $(ELF_ARCH)
294 +export LDS_ELF_FORMAT := $(ELF_FORMAT)
295
296 # The wrappers will select whether using "malloc" or the kernel allocator.
297 LINK_WRAPS = -Wl,--wrap,malloc -Wl,--wrap,free -Wl,--wrap,calloc
298 diff --git a/arch/um/kernel/Makefile b/arch/um/kernel/Makefile
299 index 388ec0a..1119233 100644
300 --- a/arch/um/kernel/Makefile
301 +++ b/arch/um/kernel/Makefile
302 @@ -3,6 +3,9 @@
303 # Licensed under the GPL
304 #
305
306 +CPPFLAGS_vmlinux.lds := -U$(SUBARCH) -DSTART=$(LDS_START) \
307 + -DELF_ARCH=$(LDS_ELF_ARCH) \
308 + -DELF_FORMAT=$(LDS_ELF_FORMAT)
309 extra-y := vmlinux.lds
310 clean-files :=
311
312 diff --git a/arch/um/kernel/vmlinux.lds.S b/arch/um/kernel/vmlinux.lds.S
313 index f8aeb44..16e49bf 100644
314 --- a/arch/um/kernel/vmlinux.lds.S
315 +++ b/arch/um/kernel/vmlinux.lds.S
316 @@ -1,3 +1,6 @@
317 +
318 +KERNEL_STACK_SIZE = 4096 * (1 << CONFIG_KERNEL_STACK_ORDER);
319 +
320 #ifdef CONFIG_LD_SCRIPT_STATIC
321 #include "uml.lds.S"
322 #else
323 diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravirt.h
324 index 4fb37c8..43b8adb 100644
325 --- a/arch/x86/include/asm/paravirt.h
326 +++ b/arch/x86/include/asm/paravirt.h
327 @@ -528,10 +528,11 @@ int paravirt_disable_iospace(void);
328 #define EXTRA_CLOBBERS
329 #define VEXTRA_CLOBBERS
330 #else /* CONFIG_X86_64 */
331 +/* [re]ax isn't an arg, but the return val */
332 #define PVOP_VCALL_ARGS \
333 unsigned long __edi = __edi, __esi = __esi, \
334 - __edx = __edx, __ecx = __ecx
335 -#define PVOP_CALL_ARGS PVOP_VCALL_ARGS, __eax
336 + __edx = __edx, __ecx = __ecx, __eax = __eax
337 +#define PVOP_CALL_ARGS PVOP_VCALL_ARGS
338
339 #define PVOP_CALL_ARG1(x) "D" ((unsigned long)(x))
340 #define PVOP_CALL_ARG2(x) "S" ((unsigned long)(x))
341 @@ -543,6 +544,7 @@ int paravirt_disable_iospace(void);
342 "=c" (__ecx)
343 #define PVOP_CALL_CLOBBERS PVOP_VCALL_CLOBBERS, "=a" (__eax)
344
345 +/* void functions are still allowed [re]ax for scratch */
346 #define PVOP_VCALLEE_CLOBBERS "=a" (__eax)
347 #define PVOP_CALLEE_CLOBBERS PVOP_VCALLEE_CLOBBERS
348
349 @@ -617,8 +619,8 @@ int paravirt_disable_iospace(void);
350 VEXTRA_CLOBBERS, \
351 pre, post, ##__VA_ARGS__)
352
353 -#define __PVOP_VCALLEESAVE(rettype, op, pre, post, ...) \
354 - ____PVOP_CALL(rettype, op.func, CLBR_RET_REG, \
355 +#define __PVOP_VCALLEESAVE(op, pre, post, ...) \
356 + ____PVOP_VCALL(op.func, CLBR_RET_REG, \
357 PVOP_VCALLEE_CLOBBERS, , \
358 pre, post, ##__VA_ARGS__)
359
360 @@ -1565,42 +1567,22 @@ extern struct paravirt_patch_site __parainstructions[],
361
362 static inline unsigned long __raw_local_save_flags(void)
363 {
364 - unsigned long f;
365 -
366 - asm volatile(paravirt_alt(PARAVIRT_CALL)
367 - : "=a"(f)
368 - : paravirt_type(pv_irq_ops.save_fl),
369 - paravirt_clobber(CLBR_EAX)
370 - : "memory", "cc");
371 - return f;
372 + return PVOP_CALLEE0(unsigned long, pv_irq_ops.save_fl);
373 }
374
375 static inline void raw_local_irq_restore(unsigned long f)
376 {
377 - asm volatile(paravirt_alt(PARAVIRT_CALL)
378 - : "=a"(f)
379 - : PV_FLAGS_ARG(f),
380 - paravirt_type(pv_irq_ops.restore_fl),
381 - paravirt_clobber(CLBR_EAX)
382 - : "memory", "cc");
383 + PVOP_VCALLEE1(pv_irq_ops.restore_fl, f);
384 }
385
386 static inline void raw_local_irq_disable(void)
387 {
388 - asm volatile(paravirt_alt(PARAVIRT_CALL)
389 - :
390 - : paravirt_type(pv_irq_ops.irq_disable),
391 - paravirt_clobber(CLBR_EAX)
392 - : "memory", "eax", "cc");
393 + PVOP_VCALLEE0(pv_irq_ops.irq_disable);
394 }
395
396 static inline void raw_local_irq_enable(void)
397 {
398 - asm volatile(paravirt_alt(PARAVIRT_CALL)
399 - :
400 - : paravirt_type(pv_irq_ops.irq_enable),
401 - paravirt_clobber(CLBR_EAX)
402 - : "memory", "eax", "cc");
403 + PVOP_VCALLEE0(pv_irq_ops.irq_enable);
404 }
405
406 static inline unsigned long __raw_local_irq_save(void)
407 diff --git a/arch/xtensa/kernel/Makefile b/arch/xtensa/kernel/Makefile
408 index fe3186d..6f56d95 100644
409 --- a/arch/xtensa/kernel/Makefile
410 +++ b/arch/xtensa/kernel/Makefile
411 @@ -27,7 +27,8 @@ sed-y = -e 's/(\(\.[a-z]*it\|\.ref\|\)\.text)/(\1.literal \1.text)/g' \
412 -e 's/(\(\.text\.[a-z]*\))/(\1.literal \1)/g'
413
414 quiet_cmd__cpp_lds_S = LDS $@
415 - cmd__cpp_lds_S = $(CPP) $(cpp_flags) -D__ASSEMBLY__ $< | sed $(sed-y) >$@
416 + cmd__cpp_lds_S = $(CPP) $(cpp_flags) -P -C -Uxtensa -D__ASSEMBLY__ $< \
417 + | sed $(sed-y) >$@
418
419 $(obj)/vmlinux.lds: $(src)/vmlinux.lds.S FORCE
420 $(call if_changed_dep,_cpp_lds_S)
421 diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c
422 index b0603b2..47c2d27 100644
423 --- a/drivers/char/tpm/tpm.c
424 +++ b/drivers/char/tpm/tpm.c
425 @@ -696,8 +696,7 @@ int __tpm_pcr_read(struct tpm_chip *chip, int pcr_idx, u8 *res_buf)
426
427 cmd.header.in = pcrread_header;
428 cmd.params.pcrread_in.pcr_idx = cpu_to_be32(pcr_idx);
429 - BUILD_BUG_ON(cmd.header.in.length > READ_PCR_RESULT_SIZE);
430 - rc = transmit_cmd(chip, &cmd, cmd.header.in.length,
431 + rc = transmit_cmd(chip, &cmd, READ_PCR_RESULT_SIZE,
432 "attempting to read a pcr value");
433
434 if (rc == 0)
435 @@ -742,7 +741,7 @@ EXPORT_SYMBOL_GPL(tpm_pcr_read);
436 * the module usage count.
437 */
438 #define TPM_ORD_PCR_EXTEND cpu_to_be32(20)
439 -#define EXTEND_PCR_SIZE 34
440 +#define EXTEND_PCR_RESULT_SIZE 34
441 static struct tpm_input_header pcrextend_header = {
442 .tag = TPM_TAG_RQU_COMMAND,
443 .length = cpu_to_be32(34),
444 @@ -760,10 +759,9 @@ int tpm_pcr_extend(u32 chip_num, int pcr_idx, const u8 *hash)
445 return -ENODEV;
446
447 cmd.header.in = pcrextend_header;
448 - BUILD_BUG_ON(be32_to_cpu(cmd.header.in.length) > EXTEND_PCR_SIZE);
449 cmd.params.pcrextend_in.pcr_idx = cpu_to_be32(pcr_idx);
450 memcpy(cmd.params.pcrextend_in.hash, hash, TPM_DIGEST_SIZE);
451 - rc = transmit_cmd(chip, &cmd, cmd.header.in.length,
452 + rc = transmit_cmd(chip, &cmd, EXTEND_PCR_RESULT_SIZE,
453 "attempting extend a PCR value");
454
455 module_put(chip->dev->driver->owner);
456 diff --git a/drivers/char/tty_buffer.c b/drivers/char/tty_buffer.c
457 index 3108991..0296612 100644
458 --- a/drivers/char/tty_buffer.c
459 +++ b/drivers/char/tty_buffer.c
460 @@ -402,28 +402,26 @@ static void flush_to_ldisc(struct work_struct *work)
461 container_of(work, struct tty_struct, buf.work.work);
462 unsigned long flags;
463 struct tty_ldisc *disc;
464 - struct tty_buffer *tbuf, *head;
465 - char *char_buf;
466 - unsigned char *flag_buf;
467
468 disc = tty_ldisc_ref(tty);
469 if (disc == NULL) /* !TTY_LDISC */
470 return;
471
472 spin_lock_irqsave(&tty->buf.lock, flags);
473 - /* So we know a flush is running */
474 - set_bit(TTY_FLUSHING, &tty->flags);
475 - head = tty->buf.head;
476 - if (head != NULL) {
477 - tty->buf.head = NULL;
478 - for (;;) {
479 - int count = head->commit - head->read;
480 +
481 + if (!test_and_set_bit(TTY_FLUSHING, &tty->flags)) {
482 + struct tty_buffer *head;
483 + while ((head = tty->buf.head) != NULL) {
484 + int count;
485 + char *char_buf;
486 + unsigned char *flag_buf;
487 +
488 + count = head->commit - head->read;
489 if (!count) {
490 if (head->next == NULL)
491 break;
492 - tbuf = head;
493 - head = head->next;
494 - tty_buffer_free(tty, tbuf);
495 + tty->buf.head = head->next;
496 + tty_buffer_free(tty, head);
497 continue;
498 }
499 /* Ldisc or user is trying to flush the buffers
500 @@ -445,9 +443,9 @@ static void flush_to_ldisc(struct work_struct *work)
501 flag_buf, count);
502 spin_lock_irqsave(&tty->buf.lock, flags);
503 }
504 - /* Restore the queue head */
505 - tty->buf.head = head;
506 + clear_bit(TTY_FLUSHING, &tty->flags);
507 }
508 +
509 /* We may have a deferred request to flush the input buffer,
510 if so pull the chain under the lock and empty the queue */
511 if (test_bit(TTY_FLUSHPENDING, &tty->flags)) {
512 @@ -455,7 +453,6 @@ static void flush_to_ldisc(struct work_struct *work)
513 clear_bit(TTY_FLUSHPENDING, &tty->flags);
514 wake_up(&tty->read_wait);
515 }
516 - clear_bit(TTY_FLUSHING, &tty->flags);
517 spin_unlock_irqrestore(&tty->buf.lock, flags);
518
519 tty_ldisc_deref(disc);
520 diff --git a/drivers/connector/cn_proc.c b/drivers/connector/cn_proc.c
521 index c5afc98..9ca20d0 100644
522 --- a/drivers/connector/cn_proc.c
523 +++ b/drivers/connector/cn_proc.c
524 @@ -202,9 +202,8 @@ static void cn_proc_ack(int err, int rcvd_seq, int rcvd_ack)
525 * cn_proc_mcast_ctl
526 * @data: message sent from userspace via the connector
527 */
528 -static void cn_proc_mcast_ctl(void *data)
529 +static void cn_proc_mcast_ctl(struct cn_msg *msg, struct netlink_skb_parms *nsp)
530 {
531 - struct cn_msg *msg = data;
532 enum proc_cn_mcast_op *mc_op = NULL;
533 int err = 0;
534
535 diff --git a/drivers/connector/cn_queue.c b/drivers/connector/cn_queue.c
536 index 408c2af..210338e 100644
537 --- a/drivers/connector/cn_queue.c
538 +++ b/drivers/connector/cn_queue.c
539 @@ -78,16 +78,20 @@ void cn_queue_wrapper(struct work_struct *work)
540 struct cn_callback_entry *cbq =
541 container_of(work, struct cn_callback_entry, work);
542 struct cn_callback_data *d = &cbq->data;
543 + struct cn_msg *msg = NLMSG_DATA(nlmsg_hdr(d->skb));
544 + struct netlink_skb_parms *nsp = &NETLINK_CB(d->skb);
545
546 - d->callback(d->callback_priv);
547 + d->callback(msg, nsp);
548
549 - d->destruct_data(d->ddata);
550 - d->ddata = NULL;
551 + kfree_skb(d->skb);
552 + d->skb = NULL;
553
554 kfree(d->free);
555 }
556
557 -static struct cn_callback_entry *cn_queue_alloc_callback_entry(char *name, struct cb_id *id, void (*callback)(void *))
558 +static struct cn_callback_entry *
559 +cn_queue_alloc_callback_entry(char *name, struct cb_id *id,
560 + void (*callback)(struct cn_msg *, struct netlink_skb_parms *))
561 {
562 struct cn_callback_entry *cbq;
563
564 @@ -120,7 +124,8 @@ int cn_cb_equal(struct cb_id *i1, struct cb_id *i2)
565 return ((i1->idx == i2->idx) && (i1->val == i2->val));
566 }
567
568 -int cn_queue_add_callback(struct cn_queue_dev *dev, char *name, struct cb_id *id, void (*callback)(void *))
569 +int cn_queue_add_callback(struct cn_queue_dev *dev, char *name, struct cb_id *id,
570 + void (*callback)(struct cn_msg *, struct netlink_skb_parms *))
571 {
572 struct cn_callback_entry *cbq, *__cbq;
573 int found = 0;
574 diff --git a/drivers/connector/connector.c b/drivers/connector/connector.c
575 index 08b2500..f060246 100644
576 --- a/drivers/connector/connector.c
577 +++ b/drivers/connector/connector.c
578 @@ -129,21 +129,19 @@ EXPORT_SYMBOL_GPL(cn_netlink_send);
579 /*
580 * Callback helper - queues work and setup destructor for given data.
581 */
582 -static int cn_call_callback(struct cn_msg *msg, void (*destruct_data)(void *), void *data)
583 +static int cn_call_callback(struct sk_buff *skb)
584 {
585 struct cn_callback_entry *__cbq, *__new_cbq;
586 struct cn_dev *dev = &cdev;
587 + struct cn_msg *msg = NLMSG_DATA(nlmsg_hdr(skb));
588 int err = -ENODEV;
589
590 spin_lock_bh(&dev->cbdev->queue_lock);
591 list_for_each_entry(__cbq, &dev->cbdev->queue_list, callback_entry) {
592 if (cn_cb_equal(&__cbq->id.id, &msg->id)) {
593 if (likely(!work_pending(&__cbq->work) &&
594 - __cbq->data.ddata == NULL)) {
595 - __cbq->data.callback_priv = msg;
596 -
597 - __cbq->data.ddata = data;
598 - __cbq->data.destruct_data = destruct_data;
599 + __cbq->data.skb == NULL)) {
600 + __cbq->data.skb = skb;
601
602 if (queue_cn_work(__cbq, &__cbq->work))
603 err = 0;
604 @@ -156,10 +154,8 @@ static int cn_call_callback(struct cn_msg *msg, void (*destruct_data)(void *), v
605 __new_cbq = kzalloc(sizeof(struct cn_callback_entry), GFP_ATOMIC);
606 if (__new_cbq) {
607 d = &__new_cbq->data;
608 - d->callback_priv = msg;
609 + d->skb = skb;
610 d->callback = __cbq->data.callback;
611 - d->ddata = data;
612 - d->destruct_data = destruct_data;
613 d->free = __new_cbq;
614
615 __new_cbq->pdev = __cbq->pdev;
616 @@ -191,7 +187,6 @@ static int cn_call_callback(struct cn_msg *msg, void (*destruct_data)(void *), v
617 */
618 static void cn_rx_skb(struct sk_buff *__skb)
619 {
620 - struct cn_msg *msg;
621 struct nlmsghdr *nlh;
622 int err;
623 struct sk_buff *skb;
624 @@ -208,8 +203,7 @@ static void cn_rx_skb(struct sk_buff *__skb)
625 return;
626 }
627
628 - msg = NLMSG_DATA(nlh);
629 - err = cn_call_callback(msg, (void (*)(void *))kfree_skb, skb);
630 + err = cn_call_callback(skb);
631 if (err < 0)
632 kfree_skb(skb);
633 }
634 @@ -269,7 +263,8 @@ static void cn_notify(struct cb_id *id, u32 notify_event)
635 *
636 * May sleep.
637 */
638 -int cn_add_callback(struct cb_id *id, char *name, void (*callback)(void *))
639 +int cn_add_callback(struct cb_id *id, char *name,
640 + void (*callback)(struct cn_msg *, struct netlink_skb_parms *))
641 {
642 int err;
643 struct cn_dev *dev = &cdev;
644 @@ -351,9 +346,8 @@ static int cn_ctl_msg_equals(struct cn_ctl_msg *m1, struct cn_ctl_msg *m2)
645 *
646 * Used for notification of a request's processing.
647 */
648 -static void cn_callback(void *data)
649 +static void cn_callback(struct cn_msg *msg, struct netlink_skb_parms *nsp)
650 {
651 - struct cn_msg *msg = data;
652 struct cn_ctl_msg *ctl;
653 struct cn_ctl_entry *ent;
654 u32 size;
655 diff --git a/drivers/i2c/busses/i2c-amd756.c b/drivers/i2c/busses/i2c-amd756.c
656 index f7d6fe9..8f0b90e 100644
657 --- a/drivers/i2c/busses/i2c-amd756.c
658 +++ b/drivers/i2c/busses/i2c-amd756.c
659 @@ -364,7 +364,7 @@ static int __devinit amd756_probe(struct pci_dev *pdev,
660 error = acpi_check_region(amd756_ioport, SMB_IOSIZE,
661 amd756_driver.name);
662 if (error)
663 - return error;
664 + return -ENODEV;
665
666 if (!request_region(amd756_ioport, SMB_IOSIZE, amd756_driver.name)) {
667 dev_err(&pdev->dev, "SMB region 0x%x already in use!\n",
668 diff --git a/drivers/i2c/busses/i2c-amd8111.c b/drivers/i2c/busses/i2c-amd8111.c
669 index a7c5990..5b4ad86 100644
670 --- a/drivers/i2c/busses/i2c-amd8111.c
671 +++ b/drivers/i2c/busses/i2c-amd8111.c
672 @@ -376,8 +376,10 @@ static int __devinit amd8111_probe(struct pci_dev *dev,
673 smbus->size = pci_resource_len(dev, 0);
674
675 error = acpi_check_resource_conflict(&dev->resource[0]);
676 - if (error)
677 + if (error) {
678 + error = -ENODEV;
679 goto out_kfree;
680 + }
681
682 if (!request_region(smbus->base, smbus->size, amd8111_driver.name)) {
683 error = -EBUSY;
684 diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
685 index 9d2c5ad..55edcfe 100644
686 --- a/drivers/i2c/busses/i2c-i801.c
687 +++ b/drivers/i2c/busses/i2c-i801.c
688 @@ -732,8 +732,10 @@ static int __devinit i801_probe(struct pci_dev *dev, const struct pci_device_id
689 }
690
691 err = acpi_check_resource_conflict(&dev->resource[SMBBAR]);
692 - if (err)
693 + if (err) {
694 + err = -ENODEV;
695 goto exit;
696 + }
697
698 err = pci_request_region(dev, SMBBAR, i801_driver.name);
699 if (err) {
700 diff --git a/drivers/i2c/busses/i2c-isch.c b/drivers/i2c/busses/i2c-isch.c
701 index 9f6b8e0..dba6eb0 100644
702 --- a/drivers/i2c/busses/i2c-isch.c
703 +++ b/drivers/i2c/busses/i2c-isch.c
704 @@ -281,7 +281,7 @@ static int __devinit sch_probe(struct pci_dev *dev,
705 return -ENODEV;
706 }
707 if (acpi_check_region(sch_smba, SMBIOSIZE, sch_driver.name))
708 - return -EBUSY;
709 + return -ENODEV;
710 if (!request_region(sch_smba, SMBIOSIZE, sch_driver.name)) {
711 dev_err(&dev->dev, "SMBus region 0x%x already in use!\n",
712 sch_smba);
713 diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c
714 index 0249a7d..808e49e 100644
715 --- a/drivers/i2c/busses/i2c-piix4.c
716 +++ b/drivers/i2c/busses/i2c-piix4.c
717 @@ -168,7 +168,7 @@ static int __devinit piix4_setup(struct pci_dev *PIIX4_dev,
718 }
719
720 if (acpi_check_region(piix4_smba, SMBIOSIZE, piix4_driver.name))
721 - return -EBUSY;
722 + return -ENODEV;
723
724 if (!request_region(piix4_smba, SMBIOSIZE, piix4_driver.name)) {
725 dev_err(&PIIX4_dev->dev, "SMBus region 0x%x already in use!\n",
726 @@ -259,7 +259,7 @@ static int __devinit piix4_setup_sb800(struct pci_dev *PIIX4_dev,
727
728 piix4_smba = ((smba_en_hi << 8) | smba_en_lo) & 0xffe0;
729 if (acpi_check_region(piix4_smba, SMBIOSIZE, piix4_driver.name))
730 - return -EBUSY;
731 + return -ENODEV;
732
733 if (!request_region(piix4_smba, SMBIOSIZE, piix4_driver.name)) {
734 dev_err(&PIIX4_dev->dev, "SMBus region 0x%x already in use!\n",
735 diff --git a/drivers/i2c/busses/i2c-sis96x.c b/drivers/i2c/busses/i2c-sis96x.c
736 index 8295885..1649963 100644
737 --- a/drivers/i2c/busses/i2c-sis96x.c
738 +++ b/drivers/i2c/busses/i2c-sis96x.c
739 @@ -280,7 +280,7 @@ static int __devinit sis96x_probe(struct pci_dev *dev,
740
741 retval = acpi_check_resource_conflict(&dev->resource[SIS96x_BAR]);
742 if (retval)
743 - return retval;
744 + return -ENODEV;
745
746 /* Everything is happy, let's grab the memory and set things up. */
747 if (!request_region(sis96x_smbus_base, SMB_IOSIZE,
748 diff --git a/drivers/i2c/busses/i2c-viapro.c b/drivers/i2c/busses/i2c-viapro.c
749 index 54d810a..e4b1543 100644
750 --- a/drivers/i2c/busses/i2c-viapro.c
751 +++ b/drivers/i2c/busses/i2c-viapro.c
752 @@ -365,7 +365,7 @@ static int __devinit vt596_probe(struct pci_dev *pdev,
753 found:
754 error = acpi_check_region(vt596_smba, 8, vt596_driver.name);
755 if (error)
756 - return error;
757 + return -ENODEV;
758
759 if (!request_region(vt596_smba, 8, vt596_driver.name)) {
760 dev_err(&pdev->dev, "SMBus region 0x%x already in use!\n",
761 diff --git a/drivers/macintosh/therm_adt746x.c b/drivers/macintosh/therm_adt746x.c
762 index fde377c..556f0fe 100644
763 --- a/drivers/macintosh/therm_adt746x.c
764 +++ b/drivers/macintosh/therm_adt746x.c
765 @@ -124,6 +124,8 @@ read_reg(struct thermostat* th, int reg)
766 return data;
767 }
768
769 +static struct i2c_driver thermostat_driver;
770 +
771 static int
772 attach_thermostat(struct i2c_adapter *adapter)
773 {
774 @@ -148,7 +150,7 @@ attach_thermostat(struct i2c_adapter *adapter)
775 * Let i2c-core delete that device on driver removal.
776 * This is safe because i2c-core holds the core_lock mutex for us.
777 */
778 - list_add_tail(&client->detected, &client->driver->clients);
779 + list_add_tail(&client->detected, &thermostat_driver.clients);
780 return 0;
781 }
782
783 diff --git a/drivers/macintosh/therm_pm72.c b/drivers/macintosh/therm_pm72.c
784 index a028598..ea32c7e 100644
785 --- a/drivers/macintosh/therm_pm72.c
786 +++ b/drivers/macintosh/therm_pm72.c
787 @@ -286,6 +286,8 @@ struct fcu_fan_table fcu_fans[] = {
788 },
789 };
790
791 +static struct i2c_driver therm_pm72_driver;
792 +
793 /*
794 * Utility function to create an i2c_client structure and
795 * attach it to one of u3 adapters
796 @@ -318,7 +320,7 @@ static struct i2c_client *attach_i2c_chip(int id, const char *name)
797 * Let i2c-core delete that device on driver removal.
798 * This is safe because i2c-core holds the core_lock mutex for us.
799 */
800 - list_add_tail(&clt->detected, &clt->driver->clients);
801 + list_add_tail(&clt->detected, &therm_pm72_driver.clients);
802 return clt;
803 }
804
805 diff --git a/drivers/macintosh/windfarm_lm75_sensor.c b/drivers/macintosh/windfarm_lm75_sensor.c
806 index 529886c..ed6426a 100644
807 --- a/drivers/macintosh/windfarm_lm75_sensor.c
808 +++ b/drivers/macintosh/windfarm_lm75_sensor.c
809 @@ -115,6 +115,8 @@ static int wf_lm75_probe(struct i2c_client *client,
810 return rc;
811 }
812
813 +static struct i2c_driver wf_lm75_driver;
814 +
815 static struct i2c_client *wf_lm75_create(struct i2c_adapter *adapter,
816 u8 addr, int ds1775,
817 const char *loc)
818 @@ -157,7 +159,7 @@ static struct i2c_client *wf_lm75_create(struct i2c_adapter *adapter,
819 * Let i2c-core delete that device on driver removal.
820 * This is safe because i2c-core holds the core_lock mutex for us.
821 */
822 - list_add_tail(&client->detected, &client->driver->clients);
823 + list_add_tail(&client->detected, &wf_lm75_driver.clients);
824 return client;
825 fail:
826 return NULL;
827 diff --git a/drivers/macintosh/windfarm_max6690_sensor.c b/drivers/macintosh/windfarm_max6690_sensor.c
828 index e2a55ec..a67b349 100644
829 --- a/drivers/macintosh/windfarm_max6690_sensor.c
830 +++ b/drivers/macintosh/windfarm_max6690_sensor.c
831 @@ -88,6 +88,8 @@ static int wf_max6690_probe(struct i2c_client *client,
832 return rc;
833 }
834
835 +static struct i2c_driver wf_max6690_driver;
836 +
837 static struct i2c_client *wf_max6690_create(struct i2c_adapter *adapter,
838 u8 addr, const char *loc)
839 {
840 @@ -119,7 +121,7 @@ static struct i2c_client *wf_max6690_create(struct i2c_adapter *adapter,
841 * Let i2c-core delete that device on driver removal.
842 * This is safe because i2c-core holds the core_lock mutex for us.
843 */
844 - list_add_tail(&client->detected, &client->driver->clients);
845 + list_add_tail(&client->detected, &wf_max6690_driver.clients);
846 return client;
847
848 fail:
849 diff --git a/drivers/macintosh/windfarm_smu_sat.c b/drivers/macintosh/windfarm_smu_sat.c
850 index 5da729e..e20330a 100644
851 --- a/drivers/macintosh/windfarm_smu_sat.c
852 +++ b/drivers/macintosh/windfarm_smu_sat.c
853 @@ -194,6 +194,8 @@ static struct wf_sensor_ops wf_sat_ops = {
854 .owner = THIS_MODULE,
855 };
856
857 +static struct i2c_driver wf_sat_driver;
858 +
859 static void wf_sat_create(struct i2c_adapter *adapter, struct device_node *dev)
860 {
861 struct i2c_board_info info;
862 @@ -222,7 +224,7 @@ static void wf_sat_create(struct i2c_adapter *adapter, struct device_node *dev)
863 * Let i2c-core delete that device on driver removal.
864 * This is safe because i2c-core holds the core_lock mutex for us.
865 */
866 - list_add_tail(&client->detected, &client->driver->clients);
867 + list_add_tail(&client->detected, &wf_sat_driver.clients);
868 }
869
870 static int wf_sat_probe(struct i2c_client *client,
871 diff --git a/drivers/md/dm-log-userspace-transfer.c b/drivers/md/dm-log-userspace-transfer.c
872 index ba0edad..54abf9e 100644
873 --- a/drivers/md/dm-log-userspace-transfer.c
874 +++ b/drivers/md/dm-log-userspace-transfer.c
875 @@ -129,11 +129,13 @@ static int fill_pkg(struct cn_msg *msg, struct dm_ulog_request *tfr)
876 * This is the connector callback that delivers data
877 * that was sent from userspace.
878 */
879 -static void cn_ulog_callback(void *data)
880 +static void cn_ulog_callback(struct cn_msg *msg, struct netlink_skb_parms *nsp)
881 {
882 - struct cn_msg *msg = (struct cn_msg *)data;
883 struct dm_ulog_request *tfr = (struct dm_ulog_request *)(msg + 1);
884
885 + if (!cap_raised(nsp->eff_cap, CAP_SYS_ADMIN))
886 + return;
887 +
888 spin_lock(&receiving_list_lock);
889 if (msg->len == 0)
890 fill_pkg(msg, NULL);
891 diff --git a/drivers/net/e1000e/82571.c b/drivers/net/e1000e/82571.c
892 index b53b40b..d1e0563 100644
893 --- a/drivers/net/e1000e/82571.c
894 +++ b/drivers/net/e1000e/82571.c
895 @@ -1803,7 +1803,7 @@ struct e1000_info e1000_82574_info = {
896 | FLAG_HAS_AMT
897 | FLAG_HAS_CTRLEXT_ON_LOAD,
898 .pba = 20,
899 - .max_hw_frame_size = ETH_FRAME_LEN + ETH_FCS_LEN,
900 + .max_hw_frame_size = DEFAULT_JUMBO,
901 .get_variants = e1000_get_variants_82571,
902 .mac_ops = &e82571_mac_ops,
903 .phy_ops = &e82_phy_ops_bm,
904 @@ -1820,7 +1820,7 @@ struct e1000_info e1000_82583_info = {
905 | FLAG_HAS_AMT
906 | FLAG_HAS_CTRLEXT_ON_LOAD,
907 .pba = 20,
908 - .max_hw_frame_size = DEFAULT_JUMBO,
909 + .max_hw_frame_size = ETH_FRAME_LEN + ETH_FCS_LEN,
910 .get_variants = e1000_get_variants_82571,
911 .mac_ops = &e82571_mac_ops,
912 .phy_ops = &e82_phy_ops_bm,
913 diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom.c b/drivers/net/wireless/iwlwifi/iwl-eeprom.c
914 index e8c0e82..eabe48a 100644
915 --- a/drivers/net/wireless/iwlwifi/iwl-eeprom.c
916 +++ b/drivers/net/wireless/iwlwifi/iwl-eeprom.c
917 @@ -335,7 +335,6 @@ static int iwl_find_otp_image(struct iwl_priv *priv,
918 u16 *validblockaddr)
919 {
920 u16 next_link_addr = 0, link_value = 0, valid_addr;
921 - int ret = 0;
922 int usedblocks = 0;
923
924 /* set addressing mode to absolute to traverse the link list */
925 @@ -355,29 +354,29 @@ static int iwl_find_otp_image(struct iwl_priv *priv,
926 * check for more block on the link list
927 */
928 valid_addr = next_link_addr;
929 - next_link_addr = link_value;
930 + next_link_addr = link_value * sizeof(u16);
931 IWL_DEBUG_INFO(priv, "OTP blocks %d addr 0x%x\n",
932 usedblocks, next_link_addr);
933 if (iwl_read_otp_word(priv, next_link_addr, &link_value))
934 return -EINVAL;
935 if (!link_value) {
936 /*
937 - * reach the end of link list,
938 + * reach the end of link list, return success and
939 * set address point to the starting address
940 * of the image
941 */
942 - goto done;
943 + *validblockaddr = valid_addr;
944 + /* skip first 2 bytes (link list pointer) */
945 + *validblockaddr += 2;
946 + return 0;
947 }
948 /* more in the link list, continue */
949 usedblocks++;
950 - } while (usedblocks < priv->cfg->max_ll_items);
951 - /* OTP full, use last block */
952 - IWL_DEBUG_INFO(priv, "OTP is full, use last block\n");
953 -done:
954 - *validblockaddr = valid_addr;
955 - /* skip first 2 bytes (link list pointer) */
956 - *validblockaddr += 2;
957 - return ret;
958 + } while (usedblocks <= priv->cfg->max_ll_items);
959 +
960 + /* OTP has no valid blocks */
961 + IWL_DEBUG_INFO(priv, "OTP has no valid blocks\n");
962 + return -EINVAL;
963 }
964
965 /**
966 diff --git a/drivers/pci/dmar.c b/drivers/pci/dmar.c
967 index 7b287cb..380b60e 100644
968 --- a/drivers/pci/dmar.c
969 +++ b/drivers/pci/dmar.c
970 @@ -632,20 +632,31 @@ int alloc_iommu(struct dmar_drhd_unit *drhd)
971 iommu->cap = dmar_readq(iommu->reg + DMAR_CAP_REG);
972 iommu->ecap = dmar_readq(iommu->reg + DMAR_ECAP_REG);
973
974 + if (iommu->cap == (uint64_t)-1 && iommu->ecap == (uint64_t)-1) {
975 + /* Promote an attitude of violence to a BIOS engineer today */
976 + WARN(1, "Your BIOS is broken; DMAR reported at address %llx returns all ones!\n"
977 + "BIOS vendor: %s; Ver: %s; Product Version: %s\n",
978 + drhd->reg_base_addr,
979 + dmi_get_system_info(DMI_BIOS_VENDOR),
980 + dmi_get_system_info(DMI_BIOS_VERSION),
981 + dmi_get_system_info(DMI_PRODUCT_VERSION));
982 + goto err_unmap;
983 + }
984 +
985 #ifdef CONFIG_DMAR
986 agaw = iommu_calculate_agaw(iommu);
987 if (agaw < 0) {
988 printk(KERN_ERR
989 "Cannot get a valid agaw for iommu (seq_id = %d)\n",
990 iommu->seq_id);
991 - goto error;
992 + goto err_unmap;
993 }
994 msagaw = iommu_calculate_max_sagaw(iommu);
995 if (msagaw < 0) {
996 printk(KERN_ERR
997 "Cannot get a valid max agaw for iommu (seq_id = %d)\n",
998 iommu->seq_id);
999 - goto error;
1000 + goto err_unmap;
1001 }
1002 #endif
1003 iommu->agaw = agaw;
1004 @@ -665,7 +676,7 @@ int alloc_iommu(struct dmar_drhd_unit *drhd)
1005 }
1006
1007 ver = readl(iommu->reg + DMAR_VER_REG);
1008 - pr_debug("IOMMU %llx: ver %d:%d cap %llx ecap %llx\n",
1009 + pr_info("IOMMU %llx: ver %d:%d cap %llx ecap %llx\n",
1010 (unsigned long long)drhd->reg_base_addr,
1011 DMAR_VER_MAJOR(ver), DMAR_VER_MINOR(ver),
1012 (unsigned long long)iommu->cap,
1013 @@ -675,7 +686,10 @@ int alloc_iommu(struct dmar_drhd_unit *drhd)
1014
1015 drhd->iommu = iommu;
1016 return 0;
1017 -error:
1018 +
1019 + err_unmap:
1020 + iounmap(iommu->reg);
1021 + error:
1022 kfree(iommu);
1023 return -1;
1024 }
1025 diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
1026 index 2de5f3a..69397bb 100644
1027 --- a/drivers/scsi/scsi.c
1028 +++ b/drivers/scsi/scsi.c
1029 @@ -241,10 +241,7 @@ scsi_host_alloc_command(struct Scsi_Host *shost, gfp_t gfp_mask)
1030 */
1031 struct scsi_cmnd *__scsi_get_command(struct Scsi_Host *shost, gfp_t gfp_mask)
1032 {
1033 - struct scsi_cmnd *cmd;
1034 - unsigned char *buf;
1035 -
1036 - cmd = scsi_host_alloc_command(shost, gfp_mask);
1037 + struct scsi_cmnd *cmd = scsi_host_alloc_command(shost, gfp_mask);
1038
1039 if (unlikely(!cmd)) {
1040 unsigned long flags;
1041 @@ -258,9 +255,15 @@ struct scsi_cmnd *__scsi_get_command(struct Scsi_Host *shost, gfp_t gfp_mask)
1042 spin_unlock_irqrestore(&shost->free_list_lock, flags);
1043
1044 if (cmd) {
1045 + void *buf, *prot;
1046 +
1047 buf = cmd->sense_buffer;
1048 + prot = cmd->prot_sdb;
1049 +
1050 memset(cmd, 0, sizeof(*cmd));
1051 +
1052 cmd->sense_buffer = buf;
1053 + cmd->prot_sdb = prot;
1054 }
1055 }
1056
1057 diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
1058 index a168935..c253e9c 100644
1059 --- a/drivers/scsi/scsi_error.c
1060 +++ b/drivers/scsi/scsi_error.c
1061 @@ -721,6 +721,9 @@ static int scsi_send_eh_cmnd(struct scsi_cmnd *scmd, unsigned char *cmnd,
1062 case NEEDS_RETRY:
1063 case FAILED:
1064 break;
1065 + case ADD_TO_MLQUEUE:
1066 + rtn = NEEDS_RETRY;
1067 + break;
1068 default:
1069 rtn = FAILED;
1070 break;
1071 diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
1072 index 4968c4c..dc0e3d4 100644
1073 --- a/drivers/scsi/sg.c
1074 +++ b/drivers/scsi/sg.c
1075 @@ -1708,11 +1708,6 @@ static int sg_finish_rem_req(Sg_request * srp)
1076 Sg_scatter_hold *req_schp = &srp->data;
1077
1078 SCSI_LOG_TIMEOUT(4, printk("sg_finish_rem_req: res_used=%d\n", (int) srp->res_used));
1079 - if (srp->res_used)
1080 - sg_unlink_reserve(sfp, srp);
1081 - else
1082 - sg_remove_scat(req_schp);
1083 -
1084 if (srp->rq) {
1085 if (srp->bio)
1086 ret = blk_rq_unmap_user(srp->bio);
1087 @@ -1720,6 +1715,11 @@ static int sg_finish_rem_req(Sg_request * srp)
1088 blk_put_request(srp->rq);
1089 }
1090
1091 + if (srp->res_used)
1092 + sg_unlink_reserve(sfp, srp);
1093 + else
1094 + sg_remove_scat(req_schp);
1095 +
1096 sg_remove_request(sfp, srp);
1097
1098 return ret;
1099 diff --git a/drivers/staging/dst/dcore.c b/drivers/staging/dst/dcore.c
1100 index fad25b7..5546898 100644
1101 --- a/drivers/staging/dst/dcore.c
1102 +++ b/drivers/staging/dst/dcore.c
1103 @@ -846,15 +846,19 @@ static dst_command_func dst_commands[] = {
1104 /*
1105 * Configuration parser.
1106 */
1107 -static void cn_dst_callback(void *data)
1108 +static void cn_dst_callback(struct cn_msg *msg, struct netlink_skb_parms *nsp)
1109 {
1110 struct dst_ctl *ctl;
1111 - struct cn_msg *msg = data;
1112 int err;
1113 struct dst_ctl_ack ack;
1114 struct dst_node *n = NULL, *tmp;
1115 unsigned int hash;
1116
1117 + if (!cap_raised(nsp->eff_cap, CAP_SYS_ADMIN)) {
1118 + err = -EPERM;
1119 + goto out;
1120 + }
1121 +
1122 if (msg->len < sizeof(struct dst_ctl)) {
1123 err = -EBADMSG;
1124 goto out;
1125 diff --git a/drivers/staging/pohmelfs/config.c b/drivers/staging/pohmelfs/config.c
1126 index a6eaa42..d8ec47a 100644
1127 --- a/drivers/staging/pohmelfs/config.c
1128 +++ b/drivers/staging/pohmelfs/config.c
1129 @@ -446,11 +446,13 @@ out_unlock:
1130 return err;
1131 }
1132
1133 -static void pohmelfs_cn_callback(void *data)
1134 +static void pohmelfs_cn_callback(struct cn_msg *msg, struct netlink_skb_parms *nsp)
1135 {
1136 - struct cn_msg *msg = data;
1137 int err;
1138
1139 + if (!cap_raised(nsp->eff_cap, CAP_SYS_ADMIN))
1140 + return;
1141 +
1142 switch (msg->flags) {
1143 case POHMELFS_FLAGS_ADD:
1144 case POHMELFS_FLAGS_DEL:
1145 diff --git a/drivers/staging/rt2860/common/cmm_data_2860.c b/drivers/staging/rt2860/common/cmm_data_2860.c
1146 index fb17355..857ff45 100644
1147 --- a/drivers/staging/rt2860/common/cmm_data_2860.c
1148 +++ b/drivers/staging/rt2860/common/cmm_data_2860.c
1149 @@ -363,6 +363,8 @@ int RtmpPCIMgmtKickOut(
1150 ULONG SwIdx = pAd->MgmtRing.TxCpuIdx;
1151
1152 pTxD = (PTXD_STRUC) pAd->MgmtRing.Cell[SwIdx].AllocVa;
1153 + if (!pTxD)
1154 + return 0;
1155
1156 pAd->MgmtRing.Cell[SwIdx].pNdisPacket = pPacket;
1157 pAd->MgmtRing.Cell[SwIdx].pNextNdisPacket = NULL;
1158 diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
1159 index b5275c4..a69457f 100644
1160 --- a/drivers/usb/serial/cp210x.c
1161 +++ b/drivers/usb/serial/cp210x.c
1162 @@ -114,6 +114,7 @@ static struct usb_device_id id_table [] = {
1163 { USB_DEVICE(0x166A, 0x0303) }, /* Clipsal 5500PCU C-Bus USB interface */
1164 { USB_DEVICE(0x16D6, 0x0001) }, /* Jablotron serial interface */
1165 { USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */
1166 + { USB_DEVICE(0x413C, 0x9500) }, /* DW700 GPS USB interface */
1167 { } /* Terminating Entry */
1168 };
1169
1170 diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c
1171 index f480809..9bd82b4 100644
1172 --- a/drivers/usb/serial/digi_acceleport.c
1173 +++ b/drivers/usb/serial/digi_acceleport.c
1174 @@ -899,16 +899,16 @@ static void digi_rx_unthrottle(struct tty_struct *tty)
1175
1176 spin_lock_irqsave(&priv->dp_port_lock, flags);
1177
1178 - /* turn throttle off */
1179 - priv->dp_throttled = 0;
1180 - priv->dp_throttle_restart = 0;
1181 -
1182 /* restart read chain */
1183 if (priv->dp_throttle_restart) {
1184 port->read_urb->dev = port->serial->dev;
1185 ret = usb_submit_urb(port->read_urb, GFP_ATOMIC);
1186 }
1187
1188 + /* turn throttle off */
1189 + priv->dp_throttled = 0;
1190 + priv->dp_throttle_restart = 0;
1191 +
1192 spin_unlock_irqrestore(&priv->dp_port_lock, flags);
1193
1194 if (ret)
1195 diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
1196 index 0cc78f9..048b563 100644
1197 --- a/drivers/usb/serial/ftdi_sio.c
1198 +++ b/drivers/usb/serial/ftdi_sio.c
1199 @@ -76,13 +76,7 @@ struct ftdi_private {
1200 unsigned long last_dtr_rts; /* saved modem control outputs */
1201 wait_queue_head_t delta_msr_wait; /* Used for TIOCMIWAIT */
1202 char prev_status, diff_status; /* Used for TIOCMIWAIT */
1203 - __u8 rx_flags; /* receive state flags (throttling) */
1204 - spinlock_t rx_lock; /* spinlock for receive state */
1205 - struct delayed_work rx_work;
1206 struct usb_serial_port *port;
1207 - int rx_processed;
1208 - unsigned long rx_bytes;
1209 -
1210 __u16 interface; /* FT2232C, FT2232H or FT4232H port interface
1211 (0 for FT232/245) */
1212
1213 @@ -737,10 +731,6 @@ static const char *ftdi_chip_name[] = {
1214 /* Constants for read urb and write urb */
1215 #define BUFSZ 512
1216
1217 -/* rx_flags */
1218 -#define THROTTLED 0x01
1219 -#define ACTUALLY_THROTTLED 0x02
1220 -
1221 /* Used for TIOCMIWAIT */
1222 #define FTDI_STATUS_B0_MASK (FTDI_RS0_CTS | FTDI_RS0_DSR | FTDI_RS0_RI | FTDI_RS0_RLSD)
1223 #define FTDI_STATUS_B1_MASK (FTDI_RS_BI)
1224 @@ -764,7 +754,7 @@ static int ftdi_write_room(struct tty_struct *tty);
1225 static int ftdi_chars_in_buffer(struct tty_struct *tty);
1226 static void ftdi_write_bulk_callback(struct urb *urb);
1227 static void ftdi_read_bulk_callback(struct urb *urb);
1228 -static void ftdi_process_read(struct work_struct *work);
1229 +static void ftdi_process_read(struct usb_serial_port *port);
1230 static void ftdi_set_termios(struct tty_struct *tty,
1231 struct usb_serial_port *port, struct ktermios *old);
1232 static int ftdi_tiocmget(struct tty_struct *tty, struct file *file);
1233 @@ -1235,7 +1225,6 @@ static int set_serial_info(struct tty_struct *tty,
1234 (new_serial.flags & ASYNC_FLAGS));
1235 priv->custom_divisor = new_serial.custom_divisor;
1236
1237 - tty->low_latency = (priv->flags & ASYNC_LOW_LATENCY) ? 1 : 0;
1238 write_latency_timer(port);
1239
1240 check_and_exit:
1241 @@ -1528,7 +1517,6 @@ static int ftdi_sio_port_probe(struct usb_serial_port *port)
1242 }
1243
1244 kref_init(&priv->kref);
1245 - spin_lock_init(&priv->rx_lock);
1246 spin_lock_init(&priv->tx_lock);
1247 init_waitqueue_head(&priv->delta_msr_wait);
1248 /* This will push the characters through immediately rather
1249 @@ -1550,7 +1538,6 @@ static int ftdi_sio_port_probe(struct usb_serial_port *port)
1250 port->read_urb->transfer_buffer_length = BUFSZ;
1251 }
1252
1253 - INIT_DELAYED_WORK(&priv->rx_work, ftdi_process_read);
1254 priv->port = port;
1255
1256 /* Free port's existing write urb and transfer buffer. */
1257 @@ -1687,6 +1674,26 @@ static int ftdi_sio_port_remove(struct usb_serial_port *port)
1258 return 0;
1259 }
1260
1261 +static int ftdi_submit_read_urb(struct usb_serial_port *port, gfp_t mem_flags)
1262 +{
1263 + struct urb *urb = port->read_urb;
1264 + struct usb_serial *serial = port->serial;
1265 + int result;
1266 +
1267 + usb_fill_bulk_urb(urb, serial->dev,
1268 + usb_rcvbulkpipe(serial->dev,
1269 + port->bulk_in_endpointAddress),
1270 + urb->transfer_buffer,
1271 + urb->transfer_buffer_length,
1272 + ftdi_read_bulk_callback, port);
1273 + result = usb_submit_urb(urb, mem_flags);
1274 + if (result)
1275 + dev_err(&port->dev,
1276 + "%s - failed submitting read urb, error %d\n",
1277 + __func__, result);
1278 + return result;
1279 +}
1280 +
1281 static int ftdi_open(struct tty_struct *tty,
1282 struct usb_serial_port *port, struct file *filp)
1283 { /* ftdi_open */
1284 @@ -1702,12 +1709,6 @@ static int ftdi_open(struct tty_struct *tty,
1285 spin_lock_irqsave(&priv->tx_lock, flags);
1286 priv->tx_bytes = 0;
1287 spin_unlock_irqrestore(&priv->tx_lock, flags);
1288 - spin_lock_irqsave(&priv->rx_lock, flags);
1289 - priv->rx_bytes = 0;
1290 - spin_unlock_irqrestore(&priv->rx_lock, flags);
1291 -
1292 - if (tty)
1293 - tty->low_latency = (priv->flags & ASYNC_LOW_LATENCY) ? 1 : 0;
1294
1295 write_latency_timer(port);
1296
1297 @@ -1727,23 +1728,14 @@ static int ftdi_open(struct tty_struct *tty,
1298 ftdi_set_termios(tty, port, tty->termios);
1299
1300 /* Not throttled */
1301 - spin_lock_irqsave(&priv->rx_lock, flags);
1302 - priv->rx_flags &= ~(THROTTLED | ACTUALLY_THROTTLED);
1303 - spin_unlock_irqrestore(&priv->rx_lock, flags);
1304 + spin_lock_irqsave(&port->lock, flags);
1305 + port->throttled = 0;
1306 + port->throttle_req = 0;
1307 + spin_unlock_irqrestore(&port->lock, flags);
1308
1309 /* Start reading from the device */
1310 - priv->rx_processed = 0;
1311 - usb_fill_bulk_urb(port->read_urb, dev,
1312 - usb_rcvbulkpipe(dev, port->bulk_in_endpointAddress),
1313 - port->read_urb->transfer_buffer,
1314 - port->read_urb->transfer_buffer_length,
1315 - ftdi_read_bulk_callback, port);
1316 - result = usb_submit_urb(port->read_urb, GFP_KERNEL);
1317 - if (result)
1318 - dev_err(&port->dev,
1319 - "%s - failed submitting read urb, error %d\n",
1320 - __func__, result);
1321 - else
1322 + result = ftdi_submit_read_urb(port, GFP_KERNEL);
1323 + if (!result)
1324 kref_get(&priv->kref);
1325
1326 return result;
1327 @@ -1789,10 +1781,6 @@ static void ftdi_close(struct usb_serial_port *port)
1328
1329 dbg("%s", __func__);
1330
1331 -
1332 - /* cancel any scheduled reading */
1333 - cancel_delayed_work_sync(&priv->rx_work);
1334 -
1335 /* shutdown our bulk read */
1336 usb_kill_urb(port->read_urb);
1337 kref_put(&priv->kref, ftdi_sio_priv_release);
1338 @@ -2015,271 +2003,121 @@ static int ftdi_chars_in_buffer(struct tty_struct *tty)
1339 return buffered;
1340 }
1341
1342 -static void ftdi_read_bulk_callback(struct urb *urb)
1343 +static int ftdi_process_packet(struct tty_struct *tty,
1344 + struct usb_serial_port *port, struct ftdi_private *priv,
1345 + char *packet, int len)
1346 {
1347 - struct usb_serial_port *port = urb->context;
1348 - struct tty_struct *tty;
1349 - struct ftdi_private *priv;
1350 - unsigned long countread;
1351 - unsigned long flags;
1352 - int status = urb->status;
1353 -
1354 - if (urb->number_of_packets > 0) {
1355 - dev_err(&port->dev, "%s transfer_buffer_length %d "
1356 - "actual_length %d number of packets %d\n", __func__,
1357 - urb->transfer_buffer_length,
1358 - urb->actual_length, urb->number_of_packets);
1359 - dev_err(&port->dev, "%s transfer_flags %x\n", __func__,
1360 - urb->transfer_flags);
1361 - }
1362 + int i;
1363 + char status;
1364 + char flag;
1365 + char *ch;
1366
1367 dbg("%s - port %d", __func__, port->number);
1368
1369 - if (port->port.count <= 0)
1370 - return;
1371 -
1372 - tty = tty_port_tty_get(&port->port);
1373 - if (!tty) {
1374 - dbg("%s - bad tty pointer - exiting", __func__);
1375 - return;
1376 + if (len < 2) {
1377 + dbg("malformed packet");
1378 + return 0;
1379 }
1380
1381 - priv = usb_get_serial_port_data(port);
1382 - if (!priv) {
1383 - dbg("%s - bad port private data pointer - exiting", __func__);
1384 - goto out;
1385 + /* Compare new line status to the old one, signal if different/
1386 + N.B. packet may be processed more than once, but differences
1387 + are only processed once. */
1388 + status = packet[0] & FTDI_STATUS_B0_MASK;
1389 + if (status != priv->prev_status) {
1390 + priv->diff_status |= status ^ priv->prev_status;
1391 + wake_up_interruptible(&priv->delta_msr_wait);
1392 + priv->prev_status = status;
1393 }
1394
1395 - if (urb != port->read_urb)
1396 - dev_err(&port->dev, "%s - Not my urb!\n", __func__);
1397 -
1398 - if (status) {
1399 - /* This will happen at close every time so it is a dbg not an
1400 - err */
1401 - dbg("(this is ok on close) nonzero read bulk status received: %d", status);
1402 - goto out;
1403 + /*
1404 + * Although the device uses a bitmask and hence can have multiple
1405 + * errors on a packet - the order here sets the priority the error is
1406 + * returned to the tty layer.
1407 + */
1408 + flag = TTY_NORMAL;
1409 + if (packet[1] & FTDI_RS_OE) {
1410 + flag = TTY_OVERRUN;
1411 + dbg("OVERRRUN error");
1412 + }
1413 + if (packet[1] & FTDI_RS_BI) {
1414 + flag = TTY_BREAK;
1415 + dbg("BREAK received");
1416 + usb_serial_handle_break(port);
1417 + }
1418 + if (packet[1] & FTDI_RS_PE) {
1419 + flag = TTY_PARITY;
1420 + dbg("PARITY error");
1421 + }
1422 + if (packet[1] & FTDI_RS_FE) {
1423 + flag = TTY_FRAME;
1424 + dbg("FRAMING error");
1425 }
1426
1427 - /* count data bytes, but not status bytes */
1428 - countread = urb->actual_length;
1429 - countread -= 2 * DIV_ROUND_UP(countread, priv->max_packet_size);
1430 - spin_lock_irqsave(&priv->rx_lock, flags);
1431 - priv->rx_bytes += countread;
1432 - spin_unlock_irqrestore(&priv->rx_lock, flags);
1433 -
1434 - ftdi_process_read(&priv->rx_work.work);
1435 -out:
1436 - tty_kref_put(tty);
1437 -} /* ftdi_read_bulk_callback */
1438 -
1439 + len -= 2;
1440 + if (!len)
1441 + return 0; /* status only */
1442 + ch = packet + 2;
1443 +
1444 + if (!(port->console && port->sysrq) && flag == TTY_NORMAL)
1445 + tty_insert_flip_string(tty, ch, len);
1446 + else {
1447 + for (i = 0; i < len; i++, ch++) {
1448 + if (!usb_serial_handle_sysrq_char(tty, port, *ch))
1449 + tty_insert_flip_char(tty, *ch, flag);
1450 + }
1451 + }
1452 + return len;
1453 +}
1454
1455 -static void ftdi_process_read(struct work_struct *work)
1456 -{ /* ftdi_process_read */
1457 - struct ftdi_private *priv =
1458 - container_of(work, struct ftdi_private, rx_work.work);
1459 - struct usb_serial_port *port = priv->port;
1460 - struct urb *urb;
1461 +static void ftdi_process_read(struct usb_serial_port *port)
1462 +{
1463 + struct urb *urb = port->read_urb;
1464 struct tty_struct *tty;
1465 - char error_flag;
1466 - unsigned char *data;
1467 -
1468 + struct ftdi_private *priv = usb_get_serial_port_data(port);
1469 + char *data = (char *)urb->transfer_buffer;
1470 int i;
1471 - int result;
1472 - int need_flip;
1473 - int packet_offset;
1474 - unsigned long flags;
1475 -
1476 - dbg("%s - port %d", __func__, port->number);
1477 -
1478 - if (port->port.count <= 0)
1479 - return;
1480 + int len;
1481 + int count = 0;
1482
1483 tty = tty_port_tty_get(&port->port);
1484 - if (!tty) {
1485 - dbg("%s - bad tty pointer - exiting", __func__);
1486 + if (!tty)
1487 return;
1488 - }
1489 -
1490 - priv = usb_get_serial_port_data(port);
1491 - if (!priv) {
1492 - dbg("%s - bad port private data pointer - exiting", __func__);
1493 - goto out;
1494 - }
1495 -
1496 - urb = port->read_urb;
1497 - if (!urb) {
1498 - dbg("%s - bad read_urb pointer - exiting", __func__);
1499 - goto out;
1500 - }
1501 -
1502 - data = urb->transfer_buffer;
1503
1504 - if (priv->rx_processed) {
1505 - dbg("%s - already processed: %d bytes, %d remain", __func__,
1506 - priv->rx_processed,
1507 - urb->actual_length - priv->rx_processed);
1508 - } else {
1509 - /* The first two bytes of every read packet are status */
1510 - if (urb->actual_length > 2)
1511 - usb_serial_debug_data(debug, &port->dev, __func__,
1512 - urb->actual_length, data);
1513 - else
1514 - dbg("Status only: %03oo %03oo", data[0], data[1]);
1515 + for (i = 0; i < urb->actual_length; i += priv->max_packet_size) {
1516 + len = min_t(int, urb->actual_length - i, priv->max_packet_size);
1517 + count += ftdi_process_packet(tty, port, priv, &data[i], len);
1518 }
1519
1520 -
1521 - /* TO DO -- check for hung up line and handle appropriately: */
1522 - /* send hangup */
1523 - /* See acm.c - you do a tty_hangup - eg tty_hangup(tty) */
1524 - /* if CD is dropped and the line is not CLOCAL then we should hangup */
1525 -
1526 - need_flip = 0;
1527 - for (packet_offset = priv->rx_processed;
1528 - packet_offset < urb->actual_length; packet_offset += priv->max_packet_size) {
1529 - int length;
1530 -
1531 - /* Compare new line status to the old one, signal if different/
1532 - N.B. packet may be processed more than once, but differences
1533 - are only processed once. */
1534 - char new_status = data[packet_offset + 0] &
1535 - FTDI_STATUS_B0_MASK;
1536 - if (new_status != priv->prev_status) {
1537 - priv->diff_status |=
1538 - new_status ^ priv->prev_status;
1539 - wake_up_interruptible(&priv->delta_msr_wait);
1540 - priv->prev_status = new_status;
1541 - }
1542 -
1543 - length = min_t(u32, priv->max_packet_size, urb->actual_length-packet_offset)-2;
1544 - if (length < 0) {
1545 - dev_err(&port->dev, "%s - bad packet length: %d\n",
1546 - __func__, length+2);
1547 - length = 0;
1548 - }
1549 -
1550 - if (priv->rx_flags & THROTTLED) {
1551 - dbg("%s - throttled", __func__);
1552 - break;
1553 - }
1554 - if (tty_buffer_request_room(tty, length) < length) {
1555 - /* break out & wait for throttling/unthrottling to
1556 - happen */
1557 - dbg("%s - receive room low", __func__);
1558 - break;
1559 - }
1560 -
1561 - /* Handle errors and break */
1562 - error_flag = TTY_NORMAL;
1563 - /* Although the device uses a bitmask and hence can have
1564 - multiple errors on a packet - the order here sets the
1565 - priority the error is returned to the tty layer */
1566 -
1567 - if (data[packet_offset+1] & FTDI_RS_OE) {
1568 - error_flag = TTY_OVERRUN;
1569 - dbg("OVERRRUN error");
1570 - }
1571 - if (data[packet_offset+1] & FTDI_RS_BI) {
1572 - error_flag = TTY_BREAK;
1573 - dbg("BREAK received");
1574 - usb_serial_handle_break(port);
1575 - }
1576 - if (data[packet_offset+1] & FTDI_RS_PE) {
1577 - error_flag = TTY_PARITY;
1578 - dbg("PARITY error");
1579 - }
1580 - if (data[packet_offset+1] & FTDI_RS_FE) {
1581 - error_flag = TTY_FRAME;
1582 - dbg("FRAMING error");
1583 - }
1584 - if (length > 0) {
1585 - for (i = 2; i < length+2; i++) {
1586 - /* Note that the error flag is duplicated for
1587 - every character received since we don't know
1588 - which character it applied to */
1589 - if (!usb_serial_handle_sysrq_char(tty, port,
1590 - data[packet_offset + i]))
1591 - tty_insert_flip_char(tty,
1592 - data[packet_offset + i],
1593 - error_flag);
1594 - }
1595 - need_flip = 1;
1596 - }
1597 -
1598 -#ifdef NOT_CORRECT_BUT_KEEPING_IT_FOR_NOW
1599 - /* if a parity error is detected you get status packets forever
1600 - until a character is sent without a parity error.
1601 - This doesn't work well since the application receives a
1602 - never ending stream of bad data - even though new data
1603 - hasn't been sent. Therefore I (bill) have taken this out.
1604 - However - this might make sense for framing errors and so on
1605 - so I am leaving the code in for now.
1606 - */
1607 - else {
1608 - if (error_flag != TTY_NORMAL) {
1609 - dbg("error_flag is not normal");
1610 - /* In this case it is just status - if that is
1611 - an error send a bad character */
1612 - if (tty->flip.count >= TTY_FLIPBUF_SIZE)
1613 - tty_flip_buffer_push(tty);
1614 - tty_insert_flip_char(tty, 0xff, error_flag);
1615 - need_flip = 1;
1616 - }
1617 - }
1618 -#endif
1619 - } /* "for(packet_offset=0..." */
1620 -
1621 - /* Low latency */
1622 - if (need_flip)
1623 + if (count)
1624 tty_flip_buffer_push(tty);
1625 + tty_kref_put(tty);
1626 +}
1627
1628 - if (packet_offset < urb->actual_length) {
1629 - /* not completely processed - record progress */
1630 - priv->rx_processed = packet_offset;
1631 - dbg("%s - incomplete, %d bytes processed, %d remain",
1632 - __func__, packet_offset,
1633 - urb->actual_length - packet_offset);
1634 - /* check if we were throttled while processing */
1635 - spin_lock_irqsave(&priv->rx_lock, flags);
1636 - if (priv->rx_flags & THROTTLED) {
1637 - priv->rx_flags |= ACTUALLY_THROTTLED;
1638 - spin_unlock_irqrestore(&priv->rx_lock, flags);
1639 - dbg("%s - deferring remainder until unthrottled",
1640 - __func__);
1641 - goto out;
1642 - }
1643 - spin_unlock_irqrestore(&priv->rx_lock, flags);
1644 - /* if the port is closed stop trying to read */
1645 - if (port->port.count > 0)
1646 - /* delay processing of remainder */
1647 - schedule_delayed_work(&priv->rx_work, 1);
1648 - else
1649 - dbg("%s - port is closed", __func__);
1650 - goto out;
1651 - }
1652 -
1653 - /* urb is completely processed */
1654 - priv->rx_processed = 0;
1655 +static void ftdi_read_bulk_callback(struct urb *urb)
1656 +{
1657 + struct usb_serial_port *port = urb->context;
1658 + unsigned long flags;
1659
1660 - /* if the port is closed stop trying to read */
1661 - if (port->port.count > 0) {
1662 - /* Continue trying to always read */
1663 - usb_fill_bulk_urb(port->read_urb, port->serial->dev,
1664 - usb_rcvbulkpipe(port->serial->dev,
1665 - port->bulk_in_endpointAddress),
1666 - port->read_urb->transfer_buffer,
1667 - port->read_urb->transfer_buffer_length,
1668 - ftdi_read_bulk_callback, port);
1669 + dbg("%s - port %d", __func__, port->number);
1670
1671 - result = usb_submit_urb(port->read_urb, GFP_ATOMIC);
1672 - if (result)
1673 - dev_err(&port->dev,
1674 - "%s - failed resubmitting read urb, error %d\n",
1675 - __func__, result);
1676 + if (urb->status) {
1677 + dbg("%s - nonzero read bulk status received: %d",
1678 + __func__, urb->status);
1679 + return;
1680 }
1681 -out:
1682 - tty_kref_put(tty);
1683 -} /* ftdi_process_read */
1684
1685 + usb_serial_debug_data(debug, &port->dev, __func__,
1686 + urb->actual_length, urb->transfer_buffer);
1687 + ftdi_process_read(port);
1688 +
1689 + spin_lock_irqsave(&port->lock, flags);
1690 + port->throttled = port->throttle_req;
1691 + if (!port->throttled) {
1692 + spin_unlock_irqrestore(&port->lock, flags);
1693 + ftdi_submit_read_urb(port, GFP_ATOMIC);
1694 + } else
1695 + spin_unlock_irqrestore(&port->lock, flags);
1696 +}
1697
1698 static void ftdi_break_ctl(struct tty_struct *tty, int break_state)
1699 {
1700 @@ -2611,33 +2449,31 @@ static int ftdi_ioctl(struct tty_struct *tty, struct file *file,
1701 static void ftdi_throttle(struct tty_struct *tty)
1702 {
1703 struct usb_serial_port *port = tty->driver_data;
1704 - struct ftdi_private *priv = usb_get_serial_port_data(port);
1705 unsigned long flags;
1706
1707 dbg("%s - port %d", __func__, port->number);
1708
1709 - spin_lock_irqsave(&priv->rx_lock, flags);
1710 - priv->rx_flags |= THROTTLED;
1711 - spin_unlock_irqrestore(&priv->rx_lock, flags);
1712 + spin_lock_irqsave(&port->lock, flags);
1713 + port->throttle_req = 1;
1714 + spin_unlock_irqrestore(&port->lock, flags);
1715 }
1716
1717 -
1718 -static void ftdi_unthrottle(struct tty_struct *tty)
1719 +void ftdi_unthrottle(struct tty_struct *tty)
1720 {
1721 struct usb_serial_port *port = tty->driver_data;
1722 - struct ftdi_private *priv = usb_get_serial_port_data(port);
1723 - int actually_throttled;
1724 + int was_throttled;
1725 unsigned long flags;
1726
1727 dbg("%s - port %d", __func__, port->number);
1728
1729 - spin_lock_irqsave(&priv->rx_lock, flags);
1730 - actually_throttled = priv->rx_flags & ACTUALLY_THROTTLED;
1731 - priv->rx_flags &= ~(THROTTLED | ACTUALLY_THROTTLED);
1732 - spin_unlock_irqrestore(&priv->rx_lock, flags);
1733 + spin_lock_irqsave(&port->lock, flags);
1734 + was_throttled = port->throttled;
1735 + port->throttled = port->throttle_req = 0;
1736 + spin_unlock_irqrestore(&port->lock, flags);
1737
1738 - if (actually_throttled)
1739 - schedule_delayed_work(&priv->rx_work, 0);
1740 + /* Resubmit urb if throttled and open. */
1741 + if (was_throttled && test_bit(ASYNCB_INITIALIZED, &port->port.flags))
1742 + ftdi_submit_read_urb(port, GFP_KERNEL);
1743 }
1744
1745 static int __init ftdi_init(void)
1746 diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c
1747 index ce57f6a..7170b69 100644
1748 --- a/drivers/usb/serial/generic.c
1749 +++ b/drivers/usb/serial/generic.c
1750 @@ -530,7 +530,7 @@ void usb_serial_generic_unthrottle(struct tty_struct *tty)
1751
1752 if (was_throttled) {
1753 /* Resume reading from device */
1754 - usb_serial_generic_resubmit_read_urb(port, GFP_KERNEL);
1755 + flush_and_resubmit_read_urb(port);
1756 }
1757 }
1758
1759 diff --git a/drivers/usb/serial/ipaq.c b/drivers/usb/serial/ipaq.c
1760 index 2545d45..c4d0206 100644
1761 --- a/drivers/usb/serial/ipaq.c
1762 +++ b/drivers/usb/serial/ipaq.c
1763 @@ -971,6 +971,15 @@ static int ipaq_calc_num_ports(struct usb_serial *serial)
1764 static int ipaq_startup(struct usb_serial *serial)
1765 {
1766 dbg("%s", __func__);
1767 +
1768 + /* Some of the devices in ipaq_id_table[] are composite, and we
1769 + * shouldn't bind to all the interfaces. This test will rule out
1770 + * some obviously invalid possibilities.
1771 + */
1772 + if (serial->num_bulk_in < serial->num_ports ||
1773 + serial->num_bulk_out < serial->num_ports)
1774 + return -ENODEV;
1775 +
1776 if (serial->dev->actconfig->desc.bConfigurationValue != 1) {
1777 /*
1778 * FIXME: HP iPaq rx3715, possibly others, have 1 config that
1779 diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
1780 index 0101548..20b0788 100644
1781 --- a/drivers/usb/serial/option.c
1782 +++ b/drivers/usb/serial/option.c
1783 @@ -319,6 +319,7 @@ static int option_resume(struct usb_serial *serial);
1784 /* TOSHIBA PRODUCTS */
1785 #define TOSHIBA_VENDOR_ID 0x0930
1786 #define TOSHIBA_PRODUCT_HSDPA_MINICARD 0x1302
1787 +#define TOSHIBA_PRODUCT_G450 0x0d45
1788
1789 #define ALINK_VENDOR_ID 0x1e0e
1790 #define ALINK_PRODUCT_3GU 0x9200
1791 @@ -582,6 +583,7 @@ static struct usb_device_id option_ids[] = {
1792 { USB_DEVICE(QISDA_VENDOR_ID, QISDA_PRODUCT_H21_4523) },
1793 { USB_DEVICE(QISDA_VENDOR_ID, QISDA_PRODUCT_H20_4515) },
1794 { USB_DEVICE(QISDA_VENDOR_ID, QISDA_PRODUCT_H20_4519) },
1795 + { USB_DEVICE(TOSHIBA_VENDOR_ID, TOSHIBA_PRODUCT_G450) },
1796 { USB_DEVICE(TOSHIBA_VENDOR_ID, TOSHIBA_PRODUCT_HSDPA_MINICARD ) }, /* Toshiba 3G HSDPA == Novatel Expedite EU870D MiniCard */
1797 { USB_DEVICE(ALINK_VENDOR_ID, 0x9000) },
1798 { USB_DEVICE_AND_INTERFACE_INFO(ALINK_VENDOR_ID, ALINK_PRODUCT_3GU, 0xff, 0xff, 0xff) },
1799 diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
1800 index 124d5ae..600097d 100644
1801 --- a/drivers/usb/serial/pl2303.c
1802 +++ b/drivers/usb/serial/pl2303.c
1803 @@ -995,13 +995,15 @@ static void pl2303_push_data(struct tty_struct *tty,
1804 /* overrun is special, not associated with a char */
1805 if (line_status & UART_OVERRUN_ERROR)
1806 tty_insert_flip_char(tty, 0, TTY_OVERRUN);
1807 - if (port->console && port->sysrq) {
1808 +
1809 + if (tty_flag == TTY_NORMAL && !(port->console && port->sysrq))
1810 + tty_insert_flip_string(tty, data, urb->actual_length);
1811 + else {
1812 int i;
1813 for (i = 0; i < urb->actual_length; ++i)
1814 if (!usb_serial_handle_sysrq_char(tty, port, data[i]))
1815 tty_insert_flip_char(tty, data[i], tty_flag);
1816 - } else
1817 - tty_insert_flip_string(tty, data, urb->actual_length);
1818 + }
1819 tty_flip_buffer_push(tty);
1820 }
1821
1822 diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
1823 index a0702db..3292e03 100644
1824 --- a/drivers/usb/serial/usb-serial.c
1825 +++ b/drivers/usb/serial/usb-serial.c
1826 @@ -155,7 +155,8 @@ static void destroy_serial(struct kref *kref)
1827 if (serial->minor != SERIAL_TTY_NO_MINOR)
1828 return_serial(serial);
1829
1830 - serial->type->release(serial);
1831 + if (serial->attached)
1832 + serial->type->release(serial);
1833
1834 /* Now that nothing is using the ports, they can be freed */
1835 for (i = 0; i < serial->num_port_pointers; ++i) {
1836 @@ -1060,12 +1061,15 @@ int usb_serial_probe(struct usb_interface *interface,
1837 module_put(type->driver.owner);
1838 if (retval < 0)
1839 goto probe_error;
1840 + serial->attached = 1;
1841 if (retval > 0) {
1842 /* quietly accept this device, but don't bind to a
1843 serial port as it's about to disappear */
1844 serial->num_ports = 0;
1845 goto exit;
1846 }
1847 + } else {
1848 + serial->attached = 1;
1849 }
1850
1851 if (get_free_serial(serial, num_ports, &minor) == NULL) {
1852 diff --git a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c
1853 index e20dc52..589f6b4 100644
1854 --- a/drivers/usb/storage/transport.c
1855 +++ b/drivers/usb/storage/transport.c
1856 @@ -696,7 +696,7 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us)
1857 /* device supports and needs bigger sense buffer */
1858 if (us->fflags & US_FL_SANE_SENSE)
1859 sense_size = ~0;
1860 -
1861 +Retry_Sense:
1862 US_DEBUGP("Issuing auto-REQUEST_SENSE\n");
1863
1864 scsi_eh_prep_cmnd(srb, &ses, NULL, 0, sense_size);
1865 @@ -720,6 +720,21 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us)
1866 srb->result = DID_ABORT << 16;
1867 goto Handle_Errors;
1868 }
1869 +
1870 + /* Some devices claim to support larger sense but fail when
1871 + * trying to request it. When a transport failure happens
1872 + * using US_FS_SANE_SENSE, we always retry with a standard
1873 + * (small) sense request. This fixes some USB GSM modems
1874 + */
1875 + if (temp_result == USB_STOR_TRANSPORT_FAILED &&
1876 + (us->fflags & US_FL_SANE_SENSE) &&
1877 + sense_size != US_SENSE_SIZE) {
1878 + US_DEBUGP("-- auto-sense failure, retry small sense\n");
1879 + sense_size = US_SENSE_SIZE;
1880 + goto Retry_Sense;
1881 + }
1882 +
1883 + /* Other failures */
1884 if (temp_result != USB_STOR_TRANSPORT_GOOD) {
1885 US_DEBUGP("-- auto-sense failure\n");
1886
1887 @@ -768,17 +783,32 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us)
1888 /* set the result so the higher layers expect this data */
1889 srb->result = SAM_STAT_CHECK_CONDITION;
1890
1891 - /* If things are really okay, then let's show that. Zero
1892 - * out the sense buffer so the higher layers won't realize
1893 - * we did an unsolicited auto-sense. */
1894 - if (result == USB_STOR_TRANSPORT_GOOD &&
1895 - /* Filemark 0, ignore EOM, ILI 0, no sense */
1896 + /* We often get empty sense data. This could indicate that
1897 + * everything worked or that there was an unspecified
1898 + * problem. We have to decide which.
1899 + */
1900 + if ( /* Filemark 0, ignore EOM, ILI 0, no sense */
1901 (srb->sense_buffer[2] & 0xaf) == 0 &&
1902 /* No ASC or ASCQ */
1903 srb->sense_buffer[12] == 0 &&
1904 srb->sense_buffer[13] == 0) {
1905 - srb->result = SAM_STAT_GOOD;
1906 - srb->sense_buffer[0] = 0x0;
1907 +
1908 + /* If things are really okay, then let's show that.
1909 + * Zero out the sense buffer so the higher layers
1910 + * won't realize we did an unsolicited auto-sense.
1911 + */
1912 + if (result == USB_STOR_TRANSPORT_GOOD) {
1913 + srb->result = SAM_STAT_GOOD;
1914 + srb->sense_buffer[0] = 0x0;
1915 +
1916 + /* If there was a problem, report an unspecified
1917 + * hardware error to prevent the higher layers from
1918 + * entering an infinite retry loop.
1919 + */
1920 + } else {
1921 + srb->result = DID_ERROR << 16;
1922 + srb->sense_buffer[2] = HARDWARE_ERROR;
1923 + }
1924 }
1925 }
1926
1927 diff --git a/drivers/video/uvesafb.c b/drivers/video/uvesafb.c
1928 index ca5b464..e35232a 100644
1929 --- a/drivers/video/uvesafb.c
1930 +++ b/drivers/video/uvesafb.c
1931 @@ -67,12 +67,14 @@ static DEFINE_MUTEX(uvfb_lock);
1932 * find the kernel part of the task struct, copy the registers and
1933 * the buffer contents and then complete the task.
1934 */
1935 -static void uvesafb_cn_callback(void *data)
1936 +static void uvesafb_cn_callback(struct cn_msg *msg, struct netlink_skb_parms *nsp)
1937 {
1938 - struct cn_msg *msg = data;
1939 struct uvesafb_task *utask;
1940 struct uvesafb_ktask *task;
1941
1942 + if (!cap_raised(nsp->eff_cap, CAP_SYS_ADMIN))
1943 + return;
1944 +
1945 if (msg->seq >= UVESAFB_TASKS_MAX)
1946 return;
1947
1948 diff --git a/drivers/w1/w1_netlink.c b/drivers/w1/w1_netlink.c
1949 index fdf7285..45c126f 100644
1950 --- a/drivers/w1/w1_netlink.c
1951 +++ b/drivers/w1/w1_netlink.c
1952 @@ -306,9 +306,8 @@ static int w1_netlink_send_error(struct cn_msg *rcmsg, struct w1_netlink_msg *rm
1953 return error;
1954 }
1955
1956 -static void w1_cn_callback(void *data)
1957 +static void w1_cn_callback(struct cn_msg *msg, struct netlink_skb_parms *nsp)
1958 {
1959 - struct cn_msg *msg = data;
1960 struct w1_netlink_msg *m = (struct w1_netlink_msg *)(msg + 1);
1961 struct w1_netlink_cmd *cmd;
1962 struct w1_slave *sl;
1963 diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
1964 index 561a9c0..f5ea468 100644
1965 --- a/fs/sysfs/file.c
1966 +++ b/fs/sysfs/file.c
1967 @@ -268,7 +268,7 @@ static int sysfs_get_open_dirent(struct sysfs_dirent *sd,
1968 struct sysfs_open_dirent *od, *new_od = NULL;
1969
1970 retry:
1971 - spin_lock(&sysfs_open_dirent_lock);
1972 + spin_lock_irq(&sysfs_open_dirent_lock);
1973
1974 if (!sd->s_attr.open && new_od) {
1975 sd->s_attr.open = new_od;
1976 @@ -281,7 +281,7 @@ static int sysfs_get_open_dirent(struct sysfs_dirent *sd,
1977 list_add_tail(&buffer->list, &od->buffers);
1978 }
1979
1980 - spin_unlock(&sysfs_open_dirent_lock);
1981 + spin_unlock_irq(&sysfs_open_dirent_lock);
1982
1983 if (od) {
1984 kfree(new_od);
1985 @@ -315,8 +315,9 @@ static void sysfs_put_open_dirent(struct sysfs_dirent *sd,
1986 struct sysfs_buffer *buffer)
1987 {
1988 struct sysfs_open_dirent *od = sd->s_attr.open;
1989 + unsigned long flags;
1990
1991 - spin_lock(&sysfs_open_dirent_lock);
1992 + spin_lock_irqsave(&sysfs_open_dirent_lock, flags);
1993
1994 list_del(&buffer->list);
1995 if (atomic_dec_and_test(&od->refcnt))
1996 @@ -324,7 +325,7 @@ static void sysfs_put_open_dirent(struct sysfs_dirent *sd,
1997 else
1998 od = NULL;
1999
2000 - spin_unlock(&sysfs_open_dirent_lock);
2001 + spin_unlock_irqrestore(&sysfs_open_dirent_lock, flags);
2002
2003 kfree(od);
2004 }
2005 @@ -456,8 +457,9 @@ static unsigned int sysfs_poll(struct file *filp, poll_table *wait)
2006 void sysfs_notify_dirent(struct sysfs_dirent *sd)
2007 {
2008 struct sysfs_open_dirent *od;
2009 + unsigned long flags;
2010
2011 - spin_lock(&sysfs_open_dirent_lock);
2012 + spin_lock_irqsave(&sysfs_open_dirent_lock, flags);
2013
2014 od = sd->s_attr.open;
2015 if (od) {
2016 @@ -465,7 +467,7 @@ void sysfs_notify_dirent(struct sysfs_dirent *sd)
2017 wake_up_interruptible(&od->poll);
2018 }
2019
2020 - spin_unlock(&sysfs_open_dirent_lock);
2021 + spin_unlock_irqrestore(&sysfs_open_dirent_lock, flags);
2022 }
2023 EXPORT_SYMBOL_GPL(sysfs_notify_dirent);
2024
2025 diff --git a/include/linux/connector.h b/include/linux/connector.h
2026 index b68d278..3a14615 100644
2027 --- a/include/linux/connector.h
2028 +++ b/include/linux/connector.h
2029 @@ -132,11 +132,8 @@ struct cn_callback_id {
2030 };
2031
2032 struct cn_callback_data {
2033 - void (*destruct_data) (void *);
2034 - void *ddata;
2035 -
2036 - void *callback_priv;
2037 - void (*callback) (void *);
2038 + struct sk_buff *skb;
2039 + void (*callback) (struct cn_msg *, struct netlink_skb_parms *);
2040
2041 void *free;
2042 };
2043 @@ -167,11 +164,11 @@ struct cn_dev {
2044 struct cn_queue_dev *cbdev;
2045 };
2046
2047 -int cn_add_callback(struct cb_id *, char *, void (*callback) (void *));
2048 +int cn_add_callback(struct cb_id *, char *, void (*callback) (struct cn_msg *, struct netlink_skb_parms *));
2049 void cn_del_callback(struct cb_id *);
2050 int cn_netlink_send(struct cn_msg *, u32, gfp_t);
2051
2052 -int cn_queue_add_callback(struct cn_queue_dev *dev, char *name, struct cb_id *id, void (*callback)(void *));
2053 +int cn_queue_add_callback(struct cn_queue_dev *dev, char *name, struct cb_id *id, void (*callback)(struct cn_msg *, struct netlink_skb_parms *));
2054 void cn_queue_del_callback(struct cn_queue_dev *dev, struct cb_id *id);
2055
2056 int queue_cn_work(struct cn_callback_entry *cbq, struct work_struct *work);
2057 diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
2058 index 73f121e..20b12f3 100644
2059 --- a/include/linux/usb/serial.h
2060 +++ b/include/linux/usb/serial.h
2061 @@ -148,6 +148,7 @@ struct usb_serial {
2062 struct usb_interface *interface;
2063 unsigned char disconnected:1;
2064 unsigned char suspending:1;
2065 + unsigned char attached:1;
2066 unsigned char minor;
2067 unsigned char num_ports;
2068 unsigned char num_port_pointers;
2069 diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
2070 index c4ca422..25b8a03 100644
2071 --- a/include/net/bluetooth/hci_core.h
2072 +++ b/include/net/bluetooth/hci_core.h
2073 @@ -187,6 +187,7 @@ struct hci_conn {
2074 struct work_struct work_del;
2075
2076 struct device dev;
2077 + atomic_t devref;
2078
2079 struct hci_dev *hdev;
2080 void *l2cap_data;
2081 @@ -339,6 +340,9 @@ int hci_conn_switch_role(struct hci_conn *conn, __u8 role);
2082 void hci_conn_enter_active_mode(struct hci_conn *conn);
2083 void hci_conn_enter_sniff_mode(struct hci_conn *conn);
2084
2085 +void hci_conn_hold_device(struct hci_conn *conn);
2086 +void hci_conn_put_device(struct hci_conn *conn);
2087 +
2088 static inline void hci_conn_hold(struct hci_conn *conn)
2089 {
2090 atomic_inc(&conn->refcnt);
2091 diff --git a/kernel/acct.c b/kernel/acct.c
2092 index 9f33910..9a4715a 100644
2093 --- a/kernel/acct.c
2094 +++ b/kernel/acct.c
2095 @@ -491,13 +491,17 @@ static void do_acct_process(struct bsd_acct_struct *acct,
2096 u64 run_time;
2097 struct timespec uptime;
2098 struct tty_struct *tty;
2099 + const struct cred *orig_cred;
2100 +
2101 + /* Perform file operations on behalf of whoever enabled accounting */
2102 + orig_cred = override_creds(file->f_cred);
2103
2104 /*
2105 * First check to see if there is enough free_space to continue
2106 * the process accounting system.
2107 */
2108 if (!check_free_space(acct, file))
2109 - return;
2110 + goto out;
2111
2112 /*
2113 * Fill the accounting struct with the needed info as recorded
2114 @@ -578,6 +582,8 @@ static void do_acct_process(struct bsd_acct_struct *acct,
2115 sizeof(acct_t), &file->f_pos);
2116 current->signal->rlim[RLIMIT_FSIZE].rlim_cur = flim;
2117 set_fs(fs);
2118 +out:
2119 + revert_creds(orig_cred);
2120 }
2121
2122 /**
2123 diff --git a/kernel/futex.c b/kernel/futex.c
2124 index 2362d06..59a2f4d 100644
2125 --- a/kernel/futex.c
2126 +++ b/kernel/futex.c
2127 @@ -115,6 +115,9 @@ struct futex_q {
2128 /* rt_waiter storage for requeue_pi: */
2129 struct rt_mutex_waiter *rt_waiter;
2130
2131 + /* The expected requeue pi target futex key: */
2132 + union futex_key *requeue_pi_key;
2133 +
2134 /* Bitset for the optional bitmasked wakeup */
2135 u32 bitset;
2136 };
2137 @@ -1089,6 +1092,10 @@ static int futex_proxy_trylock_atomic(u32 __user *pifutex,
2138 if (!top_waiter)
2139 return 0;
2140
2141 + /* Ensure we requeue to the expected futex. */
2142 + if (!match_futex(top_waiter->requeue_pi_key, key2))
2143 + return -EINVAL;
2144 +
2145 /*
2146 * Try to take the lock for top_waiter. Set the FUTEX_WAITERS bit in
2147 * the contended case or if set_waiters is 1. The pi_state is returned
2148 @@ -1276,6 +1283,12 @@ retry_private:
2149 continue;
2150 }
2151
2152 + /* Ensure we requeue to the expected futex for requeue_pi. */
2153 + if (requeue_pi && !match_futex(this->requeue_pi_key, &key2)) {
2154 + ret = -EINVAL;
2155 + break;
2156 + }
2157 +
2158 /*
2159 * Requeue nr_requeue waiters and possibly one more in the case
2160 * of requeue_pi if we couldn't acquire the lock atomically.
2161 @@ -1625,17 +1638,8 @@ out:
2162 static void futex_wait_queue_me(struct futex_hash_bucket *hb, struct futex_q *q,
2163 struct hrtimer_sleeper *timeout)
2164 {
2165 - queue_me(q, hb);
2166 -
2167 - /*
2168 - * There might have been scheduling since the queue_me(), as we
2169 - * cannot hold a spinlock across the get_user() in case it
2170 - * faults, and we cannot just set TASK_INTERRUPTIBLE state when
2171 - * queueing ourselves into the futex hash. This code thus has to
2172 - * rely on the futex_wake() code removing us from hash when it
2173 - * wakes us up.
2174 - */
2175 set_current_state(TASK_INTERRUPTIBLE);
2176 + queue_me(q, hb);
2177
2178 /* Arm the timer */
2179 if (timeout) {
2180 @@ -1645,8 +1649,8 @@ static void futex_wait_queue_me(struct futex_hash_bucket *hb, struct futex_q *q,
2181 }
2182
2183 /*
2184 - * !plist_node_empty() is safe here without any lock.
2185 - * q.lock_ptr != 0 is not safe, because of ordering against wakeup.
2186 + * If we have been removed from the hash list, then another task
2187 + * has tried to wake us, and we can skip the call to schedule().
2188 */
2189 if (likely(!plist_node_empty(&q->list))) {
2190 /*
2191 @@ -1751,6 +1755,7 @@ static int futex_wait(u32 __user *uaddr, int fshared,
2192 q.pi_state = NULL;
2193 q.bitset = bitset;
2194 q.rt_waiter = NULL;
2195 + q.requeue_pi_key = NULL;
2196
2197 if (abs_time) {
2198 to = &timeout;
2199 @@ -1858,6 +1863,7 @@ static int futex_lock_pi(u32 __user *uaddr, int fshared,
2200
2201 q.pi_state = NULL;
2202 q.rt_waiter = NULL;
2203 + q.requeue_pi_key = NULL;
2204 retry:
2205 q.key = FUTEX_KEY_INIT;
2206 ret = get_futex_key(uaddr, fshared, &q.key, VERIFY_WRITE);
2207 @@ -2168,15 +2174,16 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, int fshared,
2208 debug_rt_mutex_init_waiter(&rt_waiter);
2209 rt_waiter.task = NULL;
2210
2211 - q.pi_state = NULL;
2212 - q.bitset = bitset;
2213 - q.rt_waiter = &rt_waiter;
2214 -
2215 key2 = FUTEX_KEY_INIT;
2216 ret = get_futex_key(uaddr2, fshared, &key2, VERIFY_WRITE);
2217 if (unlikely(ret != 0))
2218 goto out;
2219
2220 + q.pi_state = NULL;
2221 + q.bitset = bitset;
2222 + q.rt_waiter = &rt_waiter;
2223 + q.requeue_pi_key = &key2;
2224 +
2225 /* Prepare to wait on uaddr. */
2226 ret = futex_wait_setup(uaddr, val, fshared, &q, &hb);
2227 if (ret)
2228 diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
2229 index f32dc9d..a6b0d73 100644
2230 --- a/kernel/trace/trace_events_filter.c
2231 +++ b/kernel/trace/trace_events_filter.c
2232 @@ -844,8 +844,9 @@ static void postfix_clear(struct filter_parse_state *ps)
2233
2234 while (!list_empty(&ps->postfix)) {
2235 elt = list_first_entry(&ps->postfix, struct postfix_elt, list);
2236 - kfree(elt->operand);
2237 list_del(&elt->list);
2238 + kfree(elt->operand);
2239 + kfree(elt);
2240 }
2241 }
2242
2243 diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
2244 index fa47d5d..a975098 100644
2245 --- a/net/bluetooth/hci_conn.c
2246 +++ b/net/bluetooth/hci_conn.c
2247 @@ -246,6 +246,8 @@ struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst)
2248 if (hdev->notify)
2249 hdev->notify(hdev, HCI_NOTIFY_CONN_ADD);
2250
2251 + atomic_set(&conn->devref, 0);
2252 +
2253 hci_conn_init_sysfs(conn);
2254
2255 tasklet_enable(&hdev->tx_task);
2256 @@ -288,7 +290,7 @@ int hci_conn_del(struct hci_conn *conn)
2257
2258 skb_queue_purge(&conn->data_q);
2259
2260 - hci_conn_del_sysfs(conn);
2261 + hci_conn_put_device(conn);
2262
2263 hci_dev_put(hdev);
2264
2265 @@ -583,6 +585,19 @@ void hci_conn_check_pending(struct hci_dev *hdev)
2266 hci_dev_unlock(hdev);
2267 }
2268
2269 +void hci_conn_hold_device(struct hci_conn *conn)
2270 +{
2271 + atomic_inc(&conn->devref);
2272 +}
2273 +EXPORT_SYMBOL(hci_conn_hold_device);
2274 +
2275 +void hci_conn_put_device(struct hci_conn *conn)
2276 +{
2277 + if (atomic_dec_and_test(&conn->devref))
2278 + hci_conn_del_sysfs(conn);
2279 +}
2280 +EXPORT_SYMBOL(hci_conn_put_device);
2281 +
2282 int hci_get_conn_list(void __user *arg)
2283 {
2284 struct hci_conn_list_req req, *cl;
2285 diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
2286 index 184ba0a..e99fe38 100644
2287 --- a/net/bluetooth/hci_event.c
2288 +++ b/net/bluetooth/hci_event.c
2289 @@ -887,6 +887,7 @@ static inline void hci_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *s
2290 } else
2291 conn->state = BT_CONNECTED;
2292
2293 + hci_conn_hold_device(conn);
2294 hci_conn_add_sysfs(conn);
2295
2296 if (test_bit(HCI_AUTH, &hdev->flags))
2297 @@ -1693,6 +1694,7 @@ static inline void hci_sync_conn_complete_evt(struct hci_dev *hdev, struct sk_bu
2298 conn->handle = __le16_to_cpu(ev->handle);
2299 conn->state = BT_CONNECTED;
2300
2301 + hci_conn_hold_device(conn);
2302 hci_conn_add_sysfs(conn);
2303 break;
2304
2305 diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c
2306 index b186768..9f1e765 100644
2307 --- a/net/bluetooth/hidp/core.c
2308 +++ b/net/bluetooth/hidp/core.c
2309 @@ -40,6 +40,7 @@
2310
2311 #include <linux/input.h>
2312 #include <linux/hid.h>
2313 +#include <linux/hidraw.h>
2314
2315 #include <net/bluetooth/bluetooth.h>
2316 #include <net/bluetooth/hci_core.h>
2317 @@ -92,10 +93,14 @@ static void __hidp_link_session(struct hidp_session *session)
2318 {
2319 __module_get(THIS_MODULE);
2320 list_add(&session->list, &hidp_session_list);
2321 +
2322 + hci_conn_hold_device(session->conn);
2323 }
2324
2325 static void __hidp_unlink_session(struct hidp_session *session)
2326 {
2327 + hci_conn_put_device(session->conn);
2328 +
2329 list_del(&session->list);
2330 module_put(THIS_MODULE);
2331 }
2332 @@ -573,7 +578,11 @@ static int hidp_session(void *arg)
2333 if (session->hid) {
2334 if (session->hid->claimed & HID_CLAIMED_INPUT)
2335 hidinput_disconnect(session->hid);
2336 + if (session->hid->claimed & HID_CLAIMED_HIDRAW)
2337 + hidraw_disconnect(session->hid);
2338 +
2339 hid_destroy_device(session->hid);
2340 + session->hid = NULL;
2341 }
2342
2343 /* Wakeup user-space polling for socket errors */
2344 @@ -601,25 +610,27 @@ static struct device *hidp_get_device(struct hidp_session *session)
2345 {
2346 bdaddr_t *src = &bt_sk(session->ctrl_sock->sk)->src;
2347 bdaddr_t *dst = &bt_sk(session->ctrl_sock->sk)->dst;
2348 + struct device *device = NULL;
2349 struct hci_dev *hdev;
2350 - struct hci_conn *conn;
2351
2352 hdev = hci_get_route(dst, src);
2353 if (!hdev)
2354 return NULL;
2355
2356 - conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, dst);
2357 + session->conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, dst);
2358 + if (session->conn)
2359 + device = &session->conn->dev;
2360
2361 hci_dev_put(hdev);
2362
2363 - return conn ? &conn->dev : NULL;
2364 + return device;
2365 }
2366
2367 static int hidp_setup_input(struct hidp_session *session,
2368 struct hidp_connadd_req *req)
2369 {
2370 struct input_dev *input;
2371 - int i;
2372 + int err, i;
2373
2374 input = input_allocate_device();
2375 if (!input)
2376 @@ -666,7 +677,13 @@ static int hidp_setup_input(struct hidp_session *session,
2377
2378 input->event = hidp_input_event;
2379
2380 - return input_register_device(input);
2381 + err = input_register_device(input);
2382 + if (err < 0) {
2383 + hci_conn_put_device(session->conn);
2384 + return err;
2385 + }
2386 +
2387 + return 0;
2388 }
2389
2390 static int hidp_open(struct hid_device *hid)
2391 @@ -748,13 +765,11 @@ static int hidp_setup_hid(struct hidp_session *session,
2392 {
2393 struct hid_device *hid;
2394 bdaddr_t src, dst;
2395 - int ret;
2396 + int err;
2397
2398 hid = hid_allocate_device();
2399 - if (IS_ERR(hid)) {
2400 - ret = PTR_ERR(session->hid);
2401 - goto err;
2402 - }
2403 + if (IS_ERR(hid))
2404 + return PTR_ERR(session->hid);
2405
2406 session->hid = hid;
2407 session->req = req;
2408 @@ -776,16 +791,17 @@ static int hidp_setup_hid(struct hidp_session *session,
2409 hid->dev.parent = hidp_get_device(session);
2410 hid->ll_driver = &hidp_hid_driver;
2411
2412 - ret = hid_add_device(hid);
2413 - if (ret)
2414 - goto err_hid;
2415 + err = hid_add_device(hid);
2416 + if (err < 0)
2417 + goto failed;
2418
2419 return 0;
2420 -err_hid:
2421 +
2422 +failed:
2423 hid_destroy_device(hid);
2424 session->hid = NULL;
2425 -err:
2426 - return ret;
2427 +
2428 + return err;
2429 }
2430
2431 int hidp_add_connection(struct hidp_connadd_req *req, struct socket *ctrl_sock, struct socket *intr_sock)
2432 @@ -835,13 +851,13 @@ int hidp_add_connection(struct hidp_connadd_req *req, struct socket *ctrl_sock,
2433 if (req->rd_size > 0) {
2434 err = hidp_setup_hid(session, req);
2435 if (err && err != -ENODEV)
2436 - goto err_skb;
2437 + goto purge;
2438 }
2439
2440 if (!session->hid) {
2441 err = hidp_setup_input(session, req);
2442 if (err < 0)
2443 - goto err_skb;
2444 + goto purge;
2445 }
2446
2447 __hidp_link_session(session);
2448 @@ -869,13 +885,20 @@ unlink:
2449
2450 __hidp_unlink_session(session);
2451
2452 - if (session->input)
2453 + if (session->input) {
2454 input_unregister_device(session->input);
2455 - if (session->hid)
2456 + session->input = NULL;
2457 + }
2458 +
2459 + if (session->hid) {
2460 hid_destroy_device(session->hid);
2461 -err_skb:
2462 + session->hid = NULL;
2463 + }
2464 +
2465 +purge:
2466 skb_queue_purge(&session->ctrl_transmit);
2467 skb_queue_purge(&session->intr_transmit);
2468 +
2469 failed:
2470 up_write(&hidp_session_sem);
2471
2472 diff --git a/net/bluetooth/hidp/hidp.h b/net/bluetooth/hidp/hidp.h
2473 index e503c89..faf3d74 100644
2474 --- a/net/bluetooth/hidp/hidp.h
2475 +++ b/net/bluetooth/hidp/hidp.h
2476 @@ -126,6 +126,8 @@ int hidp_get_conninfo(struct hidp_conninfo *ci);
2477 struct hidp_session {
2478 struct list_head list;
2479
2480 + struct hci_conn *conn;
2481 +
2482 struct socket *ctrl_sock;
2483 struct socket *intr_sock;
2484
2485 diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
2486 index 0936fc2..9e50fdb 100644
2487 --- a/net/mac80211/rx.c
2488 +++ b/net/mac80211/rx.c
2489 @@ -2155,11 +2155,17 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
2490
2491 skb = rx.skb;
2492
2493 - list_for_each_entry_rcu(sdata, &local->interfaces, list) {
2494 + if (rx.sdata && ieee80211_is_data(hdr->frame_control)) {
2495 + rx.flags |= IEEE80211_RX_RA_MATCH;
2496 + prepares = prepare_for_handlers(rx.sdata, &rx, hdr);
2497 + if (prepares)
2498 + prev = rx.sdata;
2499 + } else list_for_each_entry_rcu(sdata, &local->interfaces, list) {
2500 if (!netif_running(sdata->dev))
2501 continue;
2502
2503 - if (sdata->vif.type == NL80211_IFTYPE_MONITOR)
2504 + if (sdata->vif.type == NL80211_IFTYPE_MONITOR ||
2505 + sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
2506 continue;
2507
2508 rx.flags |= IEEE80211_RX_RA_MATCH;
2509 diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
2510 index a360bce..5ccfd10 100644
2511 --- a/net/mac80211/sta_info.c
2512 +++ b/net/mac80211/sta_info.c
2513 @@ -360,6 +360,7 @@ int sta_info_insert(struct sta_info *sta)
2514 u.ap);
2515
2516 drv_sta_notify(local, &sdata->vif, STA_NOTIFY_ADD, &sta->sta);
2517 + sdata = sta->sdata;
2518 }
2519
2520 #ifdef CONFIG_MAC80211_VERBOSE_DEBUG
2521 @@ -494,6 +495,7 @@ static void __sta_info_unlink(struct sta_info **sta)
2522
2523 drv_sta_notify(local, &sdata->vif, STA_NOTIFY_REMOVE,
2524 &(*sta)->sta);
2525 + sdata = (*sta)->sdata;
2526 }
2527
2528 if (ieee80211_vif_is_mesh(&sdata->vif)) {
2529 diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
2530 index 3a8922c..98576d4 100644
2531 --- a/net/mac80211/tx.c
2532 +++ b/net/mac80211/tx.c
2533 @@ -1736,7 +1736,8 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb,
2534 if (!is_multicast_ether_addr(hdr.addr1)) {
2535 rcu_read_lock();
2536 sta = sta_info_get(local, hdr.addr1);
2537 - if (sta)
2538 + /* XXX: in the future, use sdata to look up the sta */
2539 + if (sta && sta->sdata == sdata)
2540 sta_flags = get_sta_flags(sta);
2541 rcu_read_unlock();
2542 }
2543 diff --git a/scripts/Makefile.build b/scripts/Makefile.build
2544 index 5c4b7a4..98112d0 100644
2545 --- a/scripts/Makefile.build
2546 +++ b/scripts/Makefile.build
2547 @@ -269,7 +269,8 @@ targets += $(extra-y) $(MAKECMDGOALS) $(always)
2548 # Linker scripts preprocessor (.lds.S -> .lds)
2549 # ---------------------------------------------------------------------------
2550 quiet_cmd_cpp_lds_S = LDS $@
2551 - cmd_cpp_lds_S = $(CPP) $(cpp_flags) -D__ASSEMBLY__ -o $@ $<
2552 + cmd_cpp_lds_S = $(CPP) $(cpp_flags) -P -C -U$(ARCH) \
2553 + -D__ASSEMBLY__ -o $@ $<
2554
2555 $(obj)/%.lds: $(src)/%.lds.S FORCE
2556 $(call if_changed_dep,cpp_lds_S)
2557 diff --git a/sound/aoa/codecs/tas.c b/sound/aoa/codecs/tas.c
2558 index f0ebc97..1dd66dd 100644
2559 --- a/sound/aoa/codecs/tas.c
2560 +++ b/sound/aoa/codecs/tas.c
2561 @@ -897,6 +897,15 @@ static int tas_create(struct i2c_adapter *adapter,
2562 client = i2c_new_device(adapter, &info);
2563 if (!client)
2564 return -ENODEV;
2565 + /*
2566 + * We know the driver is already loaded, so the device should be
2567 + * already bound. If not it means binding failed, and then there
2568 + * is no point in keeping the device instantiated.
2569 + */
2570 + if (!client->driver) {
2571 + i2c_unregister_device(client);
2572 + return -ENODEV;
2573 + }
2574
2575 /*
2576 * Let i2c-core delete that device on driver removal.
2577 diff --git a/sound/ppc/keywest.c b/sound/ppc/keywest.c
2578 index 835fa19..bb6819a 100644
2579 --- a/sound/ppc/keywest.c
2580 +++ b/sound/ppc/keywest.c
2581 @@ -59,6 +59,18 @@ static int keywest_attach_adapter(struct i2c_adapter *adapter)
2582 strlcpy(info.type, "keywest", I2C_NAME_SIZE);
2583 info.addr = keywest_ctx->addr;
2584 keywest_ctx->client = i2c_new_device(adapter, &info);
2585 + if (!keywest_ctx->client)
2586 + return -ENODEV;
2587 + /*
2588 + * We know the driver is already loaded, so the device should be
2589 + * already bound. If not it means binding failed, and then there
2590 + * is no point in keeping the device instantiated.
2591 + */
2592 + if (!keywest_ctx->client->driver) {
2593 + i2c_unregister_device(keywest_ctx->client);
2594 + keywest_ctx->client = NULL;
2595 + return -ENODEV;
2596 + }
2597
2598 /*
2599 * Let i2c-core delete that device on driver removal.