/[linux-patches]/genpatches-2.6/tags/2.6.31-8/1004_linux-2.6.31.5.patch
Gentoo

Contents of /genpatches-2.6/tags/2.6.31-8/1004_linux-2.6.31.5.patch

Parent Directory Parent Directory | Revision Log Revision Log


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

  ViewVC Help
Powered by ViewVC 1.1.20