Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 297292 | Differences between
and this patch

Collapse All | Expand All

(-)a/Documentation/connector/cn_test.c (-3 / +1 lines)
Lines 32-41 static char cn_test_name[] = "cn_test"; Link Here
32
static struct sock *nls;
32
static struct sock *nls;
33
static struct timer_list cn_test_timer;
33
static struct timer_list cn_test_timer;
34
34
35
void cn_test_callback(void *data)
35
static void cn_test_callback(struct cn_msg *msg, struct netlink_skb_parms *nsp)
36
{
36
{
37
	struct cn_msg *msg = (struct cn_msg *)data;
38
39
	printk("%s: %lu: idx=%x, val=%x, seq=%u, ack=%u, len=%d: %s.\n",
37
	printk("%s: %lu: idx=%x, val=%x, seq=%u, ack=%u, len=%d: %s.\n",
40
	       __func__, jiffies, msg->id.idx, msg->id.val,
38
	       __func__, jiffies, msg->id.idx, msg->id.val,
41
	       msg->seq, msg->ack, msg->len, (char *)msg->data);
39
	       msg->seq, msg->ack, msg->len, (char *)msg->data);
(-)a/Documentation/connector/connector.txt (-4 / +4 lines)
Lines 23-29 handling... Connector allows any kernelspace agents to use netlink Link Here
23
based networking for inter-process communication in a significantly
23
based networking for inter-process communication in a significantly
24
easier way:
24
easier way:
25
25
26
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);
27
void cn_netlink_send(struct cn_msg *msg, u32 __group, int gfp_mask);
28
28
29
struct cb_id
29
struct cb_id
Lines 53-67 struct cn_msg Link Here
53
Connector interfaces.
53
Connector interfaces.
54
/*****************************************/
54
/*****************************************/
55
55
56
int cn_add_callback(struct cb_id *id, char *name, void (*callback) (void *));
56
int cn_add_callback(struct cb_id *id, char *name, void (*callback) (struct cn_msg *, struct netlink_skb_parms *));
57
57
58
Registers new callback with connector core.
58
Registers new callback with connector core.
59
59
60
struct cb_id *id 		- unique connector's user identifier.
60
struct cb_id *id 		- unique connector's user identifier.
61
			  	  It must be registered in connector.h for legal in-kernel users.
61
			  	  It must be registered in connector.h for legal in-kernel users.
62
char *name 			- connector's callback symbolic name.
62
char *name 			- connector's callback symbolic name.
63
void (*callback) (void *)	- connector's callback.
63
void (*callback) (struct cn..)	- connector's callback.
64
				  Argument must be dereferenced to struct cn_msg *.
64
				  cn_msg and the sender's credentials
65
65
66
void cn_del_callback(struct cb_id *id);
66
void cn_del_callback(struct cb_id *id);
67
67
(-)a/MAINTAINERS (-1 / +1 lines)
Lines 1992-1998 S: Maintained Link Here
1992
F:	fs/*
1992
F:	fs/*
1993
1993
1994
FINTEK F75375S HARDWARE MONITOR AND FAN CONTROLLER DRIVER
1994
FINTEK F75375S HARDWARE MONITOR AND FAN CONTROLLER DRIVER
1995
M:	Riku Voipio <riku.vipio@iki.fi>
1995
M:	Riku Voipio <riku.voipio@iki.fi>
1996
L:	lm-sensors@lm-sensors.org
1996
L:	lm-sensors@lm-sensors.org
1997
S:	Maintained
1997
S:	Maintained
1998
F:	drivers/hwmon/f75375s.c
1998
F:	drivers/hwmon/f75375s.c
(-)a/Makefile (-5 lines)
Lines 980-990 prepare0: archprepare FORCE Link Here
980
# All the preparing..
980
# All the preparing..
981
prepare: prepare0
981
prepare: prepare0
982
982
983
# Leave this as default for preprocessing vmlinux.lds.S, which is now
984
# done in arch/$(ARCH)/kernel/Makefile
985
986
export CPPFLAGS_vmlinux.lds += -P -C -U$(ARCH)
987
988
# The asm symlink changes when $(ARCH) changes.
983
# The asm symlink changes when $(ARCH) changes.
989
# Detect this and ask user to run make mrproper
984
# Detect this and ask user to run make mrproper
990
# If asm is a stale symlink (point to dir that does not exist) remove it
985
# If asm is a stale symlink (point to dir that does not exist) remove it
(-)a/arch/arm/Makefile (-1 / +1 lines)
Lines 14-20 LDFLAGS_vmlinux :=-p --no-undefined -X Link Here
14
ifeq ($(CONFIG_CPU_ENDIAN_BE8),y)
14
ifeq ($(CONFIG_CPU_ENDIAN_BE8),y)
15
LDFLAGS_vmlinux	+= --be8
15
LDFLAGS_vmlinux	+= --be8
16
endif
16
endif
17
CPPFLAGS_vmlinux.lds = -DTEXT_OFFSET=$(TEXT_OFFSET)
17
18
OBJCOPYFLAGS	:=-O binary -R .note -R .note.gnu.build-id -R .comment -S
18
OBJCOPYFLAGS	:=-O binary -R .note -R .note.gnu.build-id -R .comment -S
19
GZFLAGS		:=-9
19
GZFLAGS		:=-9
20
#KBUILD_CFLAGS	+=-pipe
20
#KBUILD_CFLAGS	+=-pipe
(-)a/arch/arm/kernel/Makefile (-1 / +2 lines)
Lines 2-8 Link Here
2
# Makefile for the linux kernel.
2
# Makefile for the linux kernel.
3
#
3
#
4
4
5
AFLAGS_head.o := -DTEXT_OFFSET=$(TEXT_OFFSET)
5
CPPFLAGS_vmlinux.lds := -DTEXT_OFFSET=$(TEXT_OFFSET)
6
AFLAGS_head.o        := -DTEXT_OFFSET=$(TEXT_OFFSET)
6
7
7
ifdef CONFIG_DYNAMIC_FTRACE
8
ifdef CONFIG_DYNAMIC_FTRACE
8
CFLAGS_REMOVE_ftrace.o = -pg
9
CFLAGS_REMOVE_ftrace.o = -pg
(-)a/arch/arm/mach-pxa/cpufreq-pxa2xx.c (-1 / +1 lines)
Lines 155-161 MODULE_PARM_DESC(pxa255_turbo_table, "Selects the frequency table (0 = run table Link Here
155
155
156
static pxa_freqs_t pxa27x_freqs[] = {
156
static pxa_freqs_t pxa27x_freqs[] = {
157
	{104000, 104000, PXA27x_CCCR(1,	 8, 2), 0, CCLKCFG2(1, 0, 1),  900000, 1705000 },
157
	{104000, 104000, PXA27x_CCCR(1,	 8, 2), 0, CCLKCFG2(1, 0, 1),  900000, 1705000 },
158
	{156000, 104000, PXA27x_CCCR(1,	 8, 6), 0, CCLKCFG2(1, 1, 1), 1000000, 1705000 },
158
	{156000, 104000, PXA27x_CCCR(1,	 8, 3), 0, CCLKCFG2(1, 0, 1), 1000000, 1705000 },
159
	{208000, 208000, PXA27x_CCCR(0, 16, 2), 1, CCLKCFG2(0, 0, 1), 1180000, 1705000 },
159
	{208000, 208000, PXA27x_CCCR(0, 16, 2), 1, CCLKCFG2(0, 0, 1), 1180000, 1705000 },
160
	{312000, 208000, PXA27x_CCCR(1, 16, 3), 1, CCLKCFG2(1, 0, 1), 1250000, 1705000 },
160
	{312000, 208000, PXA27x_CCCR(1, 16, 3), 1, CCLKCFG2(1, 0, 1), 1250000, 1705000 },
161
	{416000, 208000, PXA27x_CCCR(1, 16, 4), 1, CCLKCFG2(1, 0, 1), 1350000, 1705000 },
161
	{416000, 208000, PXA27x_CCCR(1, 16, 4), 1, CCLKCFG2(1, 0, 1), 1350000, 1705000 },
(-)a/arch/cris/Makefile (-2 lines)
Lines 42-49 LD = $(CROSS_COMPILE)ld -mcrislinux Link Here
42
42
43
OBJCOPYFLAGS := -O binary -R .note -R .comment -S
43
OBJCOPYFLAGS := -O binary -R .note -R .comment -S
44
44
45
CPPFLAGS_vmlinux.lds = -DDRAM_VIRTUAL_BASE=0x$(CONFIG_ETRAX_DRAM_VIRTUAL_BASE)
46
47
KBUILD_AFLAGS += -mlinux -march=$(arch-y) $(inc)
45
KBUILD_AFLAGS += -mlinux -march=$(arch-y) $(inc)
48
KBUILD_CFLAGS += -mlinux -march=$(arch-y) -pipe $(inc)
46
KBUILD_CFLAGS += -mlinux -march=$(arch-y) -pipe $(inc)
49
KBUILD_CPPFLAGS += $(inc)
47
KBUILD_CPPFLAGS += $(inc)
(-)a/arch/cris/kernel/Makefile (+1 lines)
Lines 3-8 Link Here
3
# Makefile for the linux kernel.
3
# Makefile for the linux kernel.
4
#
4
#
5
5
6
CPPFLAGS_vmlinux.lds := -DDRAM_VIRTUAL_BASE=0x$(CONFIG_ETRAX_DRAM_VIRTUAL_BASE)
6
extra-y	:= vmlinux.lds
7
extra-y	:= vmlinux.lds
7
8
8
obj-y   := process.o traps.o irq.o ptrace.o setup.o time.o sys_cris.o
9
obj-y   := process.o traps.o irq.o ptrace.o setup.o time.o sys_cris.o
(-)a/arch/mips/Makefile (-24 / +3 lines)
Lines 615-630 endif Link Here
615
cflags-y			+= -I$(srctree)/arch/mips/include/asm/mach-generic
615
cflags-y			+= -I$(srctree)/arch/mips/include/asm/mach-generic
616
drivers-$(CONFIG_PCI)		+= arch/mips/pci/
616
drivers-$(CONFIG_PCI)		+= arch/mips/pci/
617
617
618
ifdef CONFIG_32BIT
619
ifdef CONFIG_CPU_LITTLE_ENDIAN
620
JIFFIES			= jiffies_64
621
else
622
JIFFIES			= jiffies_64 + 4
623
endif
624
else
625
JIFFIES			= jiffies_64
626
endif
627
628
#
618
#
629
# Automatically detect the build format. By default we choose
619
# Automatically detect the build format. By default we choose
630
# the elf format according to the load address.
620
# the elf format according to the load address.
Lines 648-655 ifdef CONFIG_64BIT Link Here
648
endif
638
endif
649
639
650
KBUILD_AFLAGS	+= $(cflags-y)
640
KBUILD_AFLAGS	+= $(cflags-y)
651
KBUILD_CFLAGS	+= $(cflags-y) \
641
KBUILD_CFLAGS	+= $(cflags-y)
652
			-D"VMLINUX_LOAD_ADDRESS=$(load-y)"
642
KBUILD_CPPFLAGS += -D"VMLINUX_LOAD_ADDRESS=$(load-y)"
643
KBUILD_CPPFLAGS += -D"DATAOFFSET=$(if $(dataoffset-y),$(dataoffset-y),0)"
653
644
654
LDFLAGS			+= -m $(ld-emul)
645
LDFLAGS			+= -m $(ld-emul)
655
646
Lines 664-681 endif Link Here
664
655
665
OBJCOPYFLAGS		+= --remove-section=.reginfo
656
OBJCOPYFLAGS		+= --remove-section=.reginfo
666
657
667
#
668
# Choosing incompatible machines durings configuration will result in
669
# error messages during linking.  Select a default linkscript if
670
# none has been choosen above.
671
#
672
673
CPPFLAGS_vmlinux.lds := \
674
	$(KBUILD_CFLAGS) \
675
	-D"LOADADDR=$(load-y)" \
676
	-D"JIFFIES=$(JIFFIES)" \
677
	-D"DATAOFFSET=$(if $(dataoffset-y),$(dataoffset-y),0)"
678
679
head-y := arch/mips/kernel/head.o arch/mips/kernel/init_task.o
658
head-y := arch/mips/kernel/head.o arch/mips/kernel/init_task.o
680
659
681
libs-y			+= arch/mips/lib/
660
libs-y			+= arch/mips/lib/
(-)a/arch/mips/kernel/vmlinux.lds.S (-2 / +11 lines)
Lines 9-15 PHDRS { Link Here
9
	text PT_LOAD FLAGS(7);	/* RWX */
9
	text PT_LOAD FLAGS(7);	/* RWX */
10
	note PT_NOTE FLAGS(4);	/* R__ */
10
	note PT_NOTE FLAGS(4);	/* R__ */
11
}
11
}
12
jiffies = JIFFIES;
12
13
ifdef CONFIG_32BIT
14
	ifdef CONFIG_CPU_LITTLE_ENDIAN
15
		jiffies  = jiffies_64;
16
	else
17
		jiffies  = jiffies_64 + 4;
18
	endif
19
else
20
	jiffies  = jiffies_64;
21
endif
13
22
14
SECTIONS
23
SECTIONS
15
{
24
{
Lines 28-34 SECTIONS Link Here
28
	/* . = 0xa800000000300000; */
37
	/* . = 0xa800000000300000; */
29
	. = 0xffffffff80300000;
38
	. = 0xffffffff80300000;
30
#endif
39
#endif
31
	. = LOADADDR;
40
	. = VMLINUX_LOAD_ADDRESS;
32
	/* read-only */
41
	/* read-only */
33
	_text = .;	/* Text and read-only data */
42
	_text = .;	/* Text and read-only data */
34
	.text : {
43
	.text : {
(-)a/arch/powerpc/Makefile (-2 lines)
Lines 158-165 drivers-$(CONFIG_OPROFILE) += arch/powerpc/oprofile/ Link Here
158
# Default to zImage, override when needed
158
# Default to zImage, override when needed
159
all: zImage
159
all: zImage
160
160
161
CPPFLAGS_vmlinux.lds	:= -Upowerpc
162
163
BOOT_TARGETS = zImage zImage.initrd uImage zImage% dtbImage% treeImage.% cuImage.% simpleImage.%
161
BOOT_TARGETS = zImage zImage.initrd uImage zImage% dtbImage% treeImage.% cuImage.% simpleImage.%
164
162
165
PHONY += $(BOOT_TARGETS)
163
PHONY += $(BOOT_TARGETS)
(-)a/arch/sparc/Makefile (-4 lines)
Lines 31-37 export BITS := 32 Link Here
31
#KBUILD_CFLAGS += -g -pipe -fcall-used-g5 -fcall-used-g7
31
#KBUILD_CFLAGS += -g -pipe -fcall-used-g5 -fcall-used-g7
32
KBUILD_CFLAGS += -m32 -pipe -mno-fpu -fcall-used-g5 -fcall-used-g7
32
KBUILD_CFLAGS += -m32 -pipe -mno-fpu -fcall-used-g5 -fcall-used-g7
33
KBUILD_AFLAGS += -m32
33
KBUILD_AFLAGS += -m32
34
CPPFLAGS_vmlinux.lds += -m32
35
34
36
#LDFLAGS_vmlinux = -N -Ttext 0xf0004000
35
#LDFLAGS_vmlinux = -N -Ttext 0xf0004000
37
#  Since 2.5.40, the first stage is left not btfix-ed.
36
#  Since 2.5.40, the first stage is left not btfix-ed.
Lines 49-57 else Link Here
49
48
50
CHECKFLAGS      += -D__sparc__ -D__sparc_v9__ -D__arch64__ -m64
49
CHECKFLAGS      += -D__sparc__ -D__sparc_v9__ -D__arch64__ -m64
51
50
52
# Undefine sparc when processing vmlinux.lds - it is used
53
# And teach CPP we are doing 64 bit builds (for this case)
54
CPPFLAGS_vmlinux.lds += -m64 -Usparc
55
LDFLAGS              := -m elf64_sparc
51
LDFLAGS              := -m elf64_sparc
56
export BITS          := 64
52
export BITS          := 64
57
53
(-)a/arch/sparc/kernel/Makefile (-1 / +5 lines)
Lines 7-13 ccflags-y := -Werror Link Here
7
7
8
extra-y     := head_$(BITS).o
8
extra-y     := head_$(BITS).o
9
extra-y     += init_task.o
9
extra-y     += init_task.o
10
extra-y     += vmlinux.lds
10
11
# Undefine sparc when processing vmlinux.lds - it is used
12
# And teach CPP we are doing $(BITS) builds (for this case)
13
CPPFLAGS_vmlinux.lds := -Usparc -m$(BITS)
14
extra-y              += vmlinux.lds
11
15
12
obj-$(CONFIG_SPARC32)   += entry.o wof.o wuf.o
16
obj-$(CONFIG_SPARC32)   += entry.o wof.o wuf.o
13
obj-$(CONFIG_SPARC32)   += etrap_32.o
17
obj-$(CONFIG_SPARC32)   += etrap_32.o
(-)a/arch/um/Makefile (-5 / +4 lines)
Lines 96-106 CFLAGS_NO_HARDENING := $(call cc-option, -fno-PIC,) $(call cc-option, -fno-pic,) Link Here
96
	$(call cc-option, -fno-stack-protector,) \
96
	$(call cc-option, -fno-stack-protector,) \
97
	$(call cc-option, -fno-stack-protector-all,)
97
	$(call cc-option, -fno-stack-protector-all,)
98
98
99
CONFIG_KERNEL_STACK_ORDER ?= 2
99
# Options used by linker script
100
STACK_SIZE := $(shell echo $$[ 4096 * (1 << $(CONFIG_KERNEL_STACK_ORDER)) ] )
100
export LDS_START      := $(START)
101
101
export LDS_ELF_ARCH   := $(ELF_ARCH)
102
CPPFLAGS_vmlinux.lds = -U$(SUBARCH) -DSTART=$(START) -DELF_ARCH=$(ELF_ARCH) \
102
export LDS_ELF_FORMAT := $(ELF_FORMAT)
103
	-DELF_FORMAT="$(ELF_FORMAT)" -DKERNEL_STACK_SIZE=$(STACK_SIZE)
104
103
105
# The wrappers will select whether using "malloc" or the kernel allocator.
104
# The wrappers will select whether using "malloc" or the kernel allocator.
106
LINK_WRAPS = -Wl,--wrap,malloc -Wl,--wrap,free -Wl,--wrap,calloc
105
LINK_WRAPS = -Wl,--wrap,malloc -Wl,--wrap,free -Wl,--wrap,calloc
(-)a/arch/um/kernel/Makefile (+3 lines)
Lines 3-8 Link Here
3
# Licensed under the GPL
3
# Licensed under the GPL
4
#
4
#
5
5
6
CPPFLAGS_vmlinux.lds := -U$(SUBARCH) -DSTART=$(LDS_START) \
7
                        -DELF_ARCH=$(LDS_ELF_ARCH)        \
8
                        -DELF_FORMAT=$(LDS_ELF_FORMAT)
6
extra-y := vmlinux.lds
9
extra-y := vmlinux.lds
7
clean-files :=
10
clean-files :=
8
11
(-)a/arch/um/kernel/vmlinux.lds.S (+3 lines)
Lines 1-3 Link Here
1
2
KERNEL_STACK_SIZE = 4096 * (1 << CONFIG_KERNEL_STACK_ORDER);
3
1
#ifdef CONFIG_LD_SCRIPT_STATIC
4
#ifdef CONFIG_LD_SCRIPT_STATIC
2
#include "uml.lds.S"
5
#include "uml.lds.S"
3
#else
6
#else
(-)a/arch/x86/include/asm/paravirt.h (-28 / +10 lines)
Lines 528-537 int paravirt_disable_iospace(void); Link Here
528
#define EXTRA_CLOBBERS
528
#define EXTRA_CLOBBERS
529
#define VEXTRA_CLOBBERS
529
#define VEXTRA_CLOBBERS
530
#else  /* CONFIG_X86_64 */
530
#else  /* CONFIG_X86_64 */
531
/* [re]ax isn't an arg, but the return val */
531
#define PVOP_VCALL_ARGS					\
532
#define PVOP_VCALL_ARGS					\
532
	unsigned long __edi = __edi, __esi = __esi,	\
533
	unsigned long __edi = __edi, __esi = __esi,	\
533
		__edx = __edx, __ecx = __ecx
534
		__edx = __edx, __ecx = __ecx, __eax = __eax
534
#define PVOP_CALL_ARGS		PVOP_VCALL_ARGS, __eax
535
#define PVOP_CALL_ARGS		PVOP_VCALL_ARGS
535
536
536
#define PVOP_CALL_ARG1(x)		"D" ((unsigned long)(x))
537
#define PVOP_CALL_ARG1(x)		"D" ((unsigned long)(x))
537
#define PVOP_CALL_ARG2(x)		"S" ((unsigned long)(x))
538
#define PVOP_CALL_ARG2(x)		"S" ((unsigned long)(x))
Lines 543-548 int paravirt_disable_iospace(void); Link Here
543
				"=c" (__ecx)
544
				"=c" (__ecx)
544
#define PVOP_CALL_CLOBBERS	PVOP_VCALL_CLOBBERS, "=a" (__eax)
545
#define PVOP_CALL_CLOBBERS	PVOP_VCALL_CLOBBERS, "=a" (__eax)
545
546
547
/* void functions are still allowed [re]ax for scratch */
546
#define PVOP_VCALLEE_CLOBBERS	"=a" (__eax)
548
#define PVOP_VCALLEE_CLOBBERS	"=a" (__eax)
547
#define PVOP_CALLEE_CLOBBERS	PVOP_VCALLEE_CLOBBERS
549
#define PVOP_CALLEE_CLOBBERS	PVOP_VCALLEE_CLOBBERS
548
550
Lines 617-624 int paravirt_disable_iospace(void); Link Here
617
		       VEXTRA_CLOBBERS,					\
619
		       VEXTRA_CLOBBERS,					\
618
		       pre, post, ##__VA_ARGS__)
620
		       pre, post, ##__VA_ARGS__)
619
621
620
#define __PVOP_VCALLEESAVE(rettype, op, pre, post, ...)			\
622
#define __PVOP_VCALLEESAVE(op, pre, post, ...)				\
621
	____PVOP_CALL(rettype, op.func, CLBR_RET_REG,			\
623
	____PVOP_VCALL(op.func, CLBR_RET_REG,				\
622
		      PVOP_VCALLEE_CLOBBERS, ,				\
624
		      PVOP_VCALLEE_CLOBBERS, ,				\
623
		      pre, post, ##__VA_ARGS__)
625
		      pre, post, ##__VA_ARGS__)
624
626
Lines 1565-1606 extern struct paravirt_patch_site __parainstructions[], Link Here
1565
1567
1566
static inline unsigned long __raw_local_save_flags(void)
1568
static inline unsigned long __raw_local_save_flags(void)
1567
{
1569
{
1568
	unsigned long f;
1570
	return PVOP_CALLEE0(unsigned long, pv_irq_ops.save_fl);
1569
1570
	asm volatile(paravirt_alt(PARAVIRT_CALL)
1571
		     : "=a"(f)
1572
		     : paravirt_type(pv_irq_ops.save_fl),
1573
		       paravirt_clobber(CLBR_EAX)
1574
		     : "memory", "cc");
1575
	return f;
1576
}
1571
}
1577
1572
1578
static inline void raw_local_irq_restore(unsigned long f)
1573
static inline void raw_local_irq_restore(unsigned long f)
1579
{
1574
{
1580
	asm volatile(paravirt_alt(PARAVIRT_CALL)
1575
	PVOP_VCALLEE1(pv_irq_ops.restore_fl, f);
1581
		     : "=a"(f)
1582
		     : PV_FLAGS_ARG(f),
1583
		       paravirt_type(pv_irq_ops.restore_fl),
1584
		       paravirt_clobber(CLBR_EAX)
1585
		     : "memory", "cc");
1586
}
1576
}
1587
1577
1588
static inline void raw_local_irq_disable(void)
1578
static inline void raw_local_irq_disable(void)
1589
{
1579
{
1590
	asm volatile(paravirt_alt(PARAVIRT_CALL)
1580
	PVOP_VCALLEE0(pv_irq_ops.irq_disable);
1591
		     :
1592
		     : paravirt_type(pv_irq_ops.irq_disable),
1593
		       paravirt_clobber(CLBR_EAX)
1594
		     : "memory", "eax", "cc");
1595
}
1581
}
1596
1582
1597
static inline void raw_local_irq_enable(void)
1583
static inline void raw_local_irq_enable(void)
1598
{
1584
{
1599
	asm volatile(paravirt_alt(PARAVIRT_CALL)
1585
	PVOP_VCALLEE0(pv_irq_ops.irq_enable);
1600
		     :
1601
		     : paravirt_type(pv_irq_ops.irq_enable),
1602
		       paravirt_clobber(CLBR_EAX)
1603
		     : "memory", "eax", "cc");
1604
}
1586
}
1605
1587
1606
static inline unsigned long __raw_local_irq_save(void)
1588
static inline unsigned long __raw_local_irq_save(void)
(-)a/arch/xtensa/kernel/Makefile (-1 / +2 lines)
Lines 27-33 sed-y = -e 's/(\(\.[a-z]*it\|\.ref\|\)\.text)/(\1.literal \1.text)/g' \ Link Here
27
	-e 's/(\(\.text\.[a-z]*\))/(\1.literal \1)/g'
27
	-e 's/(\(\.text\.[a-z]*\))/(\1.literal \1)/g'
28
28
29
quiet_cmd__cpp_lds_S = LDS     $@
29
quiet_cmd__cpp_lds_S = LDS     $@
30
      cmd__cpp_lds_S = $(CPP) $(cpp_flags) -D__ASSEMBLY__ $< | sed $(sed-y) >$@
30
      cmd__cpp_lds_S = $(CPP) $(cpp_flags) -P -C -Uxtensa -D__ASSEMBLY__ $< \
31
                       | sed $(sed-y) >$@
31
32
32
$(obj)/vmlinux.lds: $(src)/vmlinux.lds.S FORCE
33
$(obj)/vmlinux.lds: $(src)/vmlinux.lds.S FORCE
33
	$(call if_changed_dep,_cpp_lds_S)
34
	$(call if_changed_dep,_cpp_lds_S)
(-)a/drivers/char/tpm/tpm.c (-5 / +3 lines)
Lines 696-703 int __tpm_pcr_read(struct tpm_chip *chip, int pcr_idx, u8 *res_buf) Link Here
696
696
697
	cmd.header.in = pcrread_header;
697
	cmd.header.in = pcrread_header;
698
	cmd.params.pcrread_in.pcr_idx = cpu_to_be32(pcr_idx);
698
	cmd.params.pcrread_in.pcr_idx = cpu_to_be32(pcr_idx);
699
	BUILD_BUG_ON(cmd.header.in.length > READ_PCR_RESULT_SIZE);
699
	rc = transmit_cmd(chip, &cmd, READ_PCR_RESULT_SIZE,
700
	rc = transmit_cmd(chip, &cmd, cmd.header.in.length,
701
			  "attempting to read a pcr value");
700
			  "attempting to read a pcr value");
702
701
703
	if (rc == 0)
702
	if (rc == 0)
Lines 742-748 EXPORT_SYMBOL_GPL(tpm_pcr_read); Link Here
742
 * the module usage count.
741
 * the module usage count.
743
 */
742
 */
744
#define TPM_ORD_PCR_EXTEND cpu_to_be32(20)
743
#define TPM_ORD_PCR_EXTEND cpu_to_be32(20)
745
#define EXTEND_PCR_SIZE 34
744
#define EXTEND_PCR_RESULT_SIZE 34
746
static struct tpm_input_header pcrextend_header = {
745
static struct tpm_input_header pcrextend_header = {
747
	.tag = TPM_TAG_RQU_COMMAND,
746
	.tag = TPM_TAG_RQU_COMMAND,
748
	.length = cpu_to_be32(34),
747
	.length = cpu_to_be32(34),
Lines 760-769 int tpm_pcr_extend(u32 chip_num, int pcr_idx, const u8 *hash) Link Here
760
		return -ENODEV;
759
		return -ENODEV;
761
760
762
	cmd.header.in = pcrextend_header;
761
	cmd.header.in = pcrextend_header;
763
	BUILD_BUG_ON(be32_to_cpu(cmd.header.in.length) > EXTEND_PCR_SIZE);
764
	cmd.params.pcrextend_in.pcr_idx = cpu_to_be32(pcr_idx);
762
	cmd.params.pcrextend_in.pcr_idx = cpu_to_be32(pcr_idx);
765
	memcpy(cmd.params.pcrextend_in.hash, hash, TPM_DIGEST_SIZE);
763
	memcpy(cmd.params.pcrextend_in.hash, hash, TPM_DIGEST_SIZE);
766
	rc = transmit_cmd(chip, &cmd, cmd.header.in.length,
764
	rc = transmit_cmd(chip, &cmd, EXTEND_PCR_RESULT_SIZE,
767
			  "attempting extend a PCR value");
765
			  "attempting extend a PCR value");
768
766
769
	module_put(chip->dev->driver->owner);
767
	module_put(chip->dev->driver->owner);
(-)a/drivers/char/tty_buffer.c (-16 / +13 lines)
Lines 402-429 static void flush_to_ldisc(struct work_struct *work) Link Here
402
		container_of(work, struct tty_struct, buf.work.work);
402
		container_of(work, struct tty_struct, buf.work.work);
403
	unsigned long 	flags;
403
	unsigned long 	flags;
404
	struct tty_ldisc *disc;
404
	struct tty_ldisc *disc;
405
	struct tty_buffer *tbuf, *head;
406
	char *char_buf;
407
	unsigned char *flag_buf;
408
405
409
	disc = tty_ldisc_ref(tty);
406
	disc = tty_ldisc_ref(tty);
410
	if (disc == NULL)	/*  !TTY_LDISC */
407
	if (disc == NULL)	/*  !TTY_LDISC */
411
		return;
408
		return;
412
409
413
	spin_lock_irqsave(&tty->buf.lock, flags);
410
	spin_lock_irqsave(&tty->buf.lock, flags);
414
	/* So we know a flush is running */
411
415
	set_bit(TTY_FLUSHING, &tty->flags);
412
	if (!test_and_set_bit(TTY_FLUSHING, &tty->flags)) {
416
	head = tty->buf.head;
413
		struct tty_buffer *head;
417
	if (head != NULL) {
414
		while ((head = tty->buf.head) != NULL) {
418
		tty->buf.head = NULL;
415
			int count;
419
		for (;;) {
416
			char *char_buf;
420
			int count = head->commit - head->read;
417
			unsigned char *flag_buf;
418
419
			count = head->commit - head->read;
421
			if (!count) {
420
			if (!count) {
422
				if (head->next == NULL)
421
				if (head->next == NULL)
423
					break;
422
					break;
424
				tbuf = head;
423
				tty->buf.head = head->next;
425
				head = head->next;
424
				tty_buffer_free(tty, head);
426
				tty_buffer_free(tty, tbuf);
427
				continue;
425
				continue;
428
			}
426
			}
429
			/* Ldisc or user is trying to flush the buffers
427
			/* Ldisc or user is trying to flush the buffers
Lines 445-453 static void flush_to_ldisc(struct work_struct *work) Link Here
445
							flag_buf, count);
443
							flag_buf, count);
446
			spin_lock_irqsave(&tty->buf.lock, flags);
444
			spin_lock_irqsave(&tty->buf.lock, flags);
447
		}
445
		}
448
		/* Restore the queue head */
446
		clear_bit(TTY_FLUSHING, &tty->flags);
449
		tty->buf.head = head;
450
	}
447
	}
448
451
	/* We may have a deferred request to flush the input buffer,
449
	/* We may have a deferred request to flush the input buffer,
452
	   if so pull the chain under the lock and empty the queue */
450
	   if so pull the chain under the lock and empty the queue */
453
	if (test_bit(TTY_FLUSHPENDING, &tty->flags)) {
451
	if (test_bit(TTY_FLUSHPENDING, &tty->flags)) {
Lines 455-461 static void flush_to_ldisc(struct work_struct *work) Link Here
455
		clear_bit(TTY_FLUSHPENDING, &tty->flags);
453
		clear_bit(TTY_FLUSHPENDING, &tty->flags);
456
		wake_up(&tty->read_wait);
454
		wake_up(&tty->read_wait);
457
	}
455
	}
458
	clear_bit(TTY_FLUSHING, &tty->flags);
459
	spin_unlock_irqrestore(&tty->buf.lock, flags);
456
	spin_unlock_irqrestore(&tty->buf.lock, flags);
460
457
461
	tty_ldisc_deref(disc);
458
	tty_ldisc_deref(disc);
(-)a/drivers/connector/cn_proc.c (-2 / +1 lines)
Lines 202-210 static void cn_proc_ack(int err, int rcvd_seq, int rcvd_ack) Link Here
202
 * cn_proc_mcast_ctl
202
 * cn_proc_mcast_ctl
203
 * @data: message sent from userspace via the connector
203
 * @data: message sent from userspace via the connector
204
 */
204
 */
205
static void cn_proc_mcast_ctl(void *data)
205
static void cn_proc_mcast_ctl(struct cn_msg *msg, struct netlink_skb_parms *nsp)
206
{
206
{
207
	struct cn_msg *msg = data;
208
	enum proc_cn_mcast_op *mc_op = NULL;
207
	enum proc_cn_mcast_op *mc_op = NULL;
209
	int err = 0;
208
	int err = 0;
210
209
(-)a/drivers/connector/cn_queue.c (-5 / +10 lines)
Lines 78-93 void cn_queue_wrapper(struct work_struct *work) Link Here
78
	struct cn_callback_entry *cbq =
78
	struct cn_callback_entry *cbq =
79
		container_of(work, struct cn_callback_entry, work);
79
		container_of(work, struct cn_callback_entry, work);
80
	struct cn_callback_data *d = &cbq->data;
80
	struct cn_callback_data *d = &cbq->data;
81
	struct cn_msg *msg = NLMSG_DATA(nlmsg_hdr(d->skb));
82
	struct netlink_skb_parms *nsp = &NETLINK_CB(d->skb);
81
83
82
	d->callback(d->callback_priv);
84
	d->callback(msg, nsp);
83
85
84
	d->destruct_data(d->ddata);
86
	kfree_skb(d->skb);
85
	d->ddata = NULL;
87
	d->skb = NULL;
86
88
87
	kfree(d->free);
89
	kfree(d->free);
88
}
90
}
89
91
90
static struct cn_callback_entry *cn_queue_alloc_callback_entry(char *name, struct cb_id *id, void (*callback)(void *))
92
static struct cn_callback_entry *
93
cn_queue_alloc_callback_entry(char *name, struct cb_id *id,
94
			      void (*callback)(struct cn_msg *, struct netlink_skb_parms *))
91
{
95
{
92
	struct cn_callback_entry *cbq;
96
	struct cn_callback_entry *cbq;
93
97
Lines 120-126 int cn_cb_equal(struct cb_id *i1, struct cb_id *i2) Link Here
120
	return ((i1->idx == i2->idx) && (i1->val == i2->val));
124
	return ((i1->idx == i2->idx) && (i1->val == i2->val));
121
}
125
}
122
126
123
int cn_queue_add_callback(struct cn_queue_dev *dev, char *name, struct cb_id *id, void (*callback)(void *))
127
int cn_queue_add_callback(struct cn_queue_dev *dev, char *name, struct cb_id *id,
128
			  void (*callback)(struct cn_msg *, struct netlink_skb_parms *))
124
{
129
{
125
	struct cn_callback_entry *cbq, *__cbq;
130
	struct cn_callback_entry *cbq, *__cbq;
126
	int found = 0;
131
	int found = 0;
(-)a/drivers/connector/connector.c (-15 / +9 lines)
Lines 129-149 EXPORT_SYMBOL_GPL(cn_netlink_send); Link Here
129
/*
129
/*
130
 * Callback helper - queues work and setup destructor for given data.
130
 * Callback helper - queues work and setup destructor for given data.
131
 */
131
 */
132
static int cn_call_callback(struct cn_msg *msg, void (*destruct_data)(void *), void *data)
132
static int cn_call_callback(struct sk_buff *skb)
133
{
133
{
134
	struct cn_callback_entry *__cbq, *__new_cbq;
134
	struct cn_callback_entry *__cbq, *__new_cbq;
135
	struct cn_dev *dev = &cdev;
135
	struct cn_dev *dev = &cdev;
136
	struct cn_msg *msg = NLMSG_DATA(nlmsg_hdr(skb));
136
	int err = -ENODEV;
137
	int err = -ENODEV;
137
138
138
	spin_lock_bh(&dev->cbdev->queue_lock);
139
	spin_lock_bh(&dev->cbdev->queue_lock);
139
	list_for_each_entry(__cbq, &dev->cbdev->queue_list, callback_entry) {
140
	list_for_each_entry(__cbq, &dev->cbdev->queue_list, callback_entry) {
140
		if (cn_cb_equal(&__cbq->id.id, &msg->id)) {
141
		if (cn_cb_equal(&__cbq->id.id, &msg->id)) {
141
			if (likely(!work_pending(&__cbq->work) &&
142
			if (likely(!work_pending(&__cbq->work) &&
142
					__cbq->data.ddata == NULL)) {
143
					__cbq->data.skb == NULL)) {
143
				__cbq->data.callback_priv = msg;
144
				__cbq->data.skb = skb;
144
145
				__cbq->data.ddata = data;
146
				__cbq->data.destruct_data = destruct_data;
147
145
148
				if (queue_cn_work(__cbq, &__cbq->work))
146
				if (queue_cn_work(__cbq, &__cbq->work))
149
					err = 0;
147
					err = 0;
Lines 156-165 static int cn_call_callback(struct cn_msg *msg, void (*destruct_data)(void *), v Link Here
156
				__new_cbq = kzalloc(sizeof(struct cn_callback_entry), GFP_ATOMIC);
154
				__new_cbq = kzalloc(sizeof(struct cn_callback_entry), GFP_ATOMIC);
157
				if (__new_cbq) {
155
				if (__new_cbq) {
158
					d = &__new_cbq->data;
156
					d = &__new_cbq->data;
159
					d->callback_priv = msg;
157
					d->skb = skb;
160
					d->callback = __cbq->data.callback;
158
					d->callback = __cbq->data.callback;
161
					d->ddata = data;
162
					d->destruct_data = destruct_data;
163
					d->free = __new_cbq;
159
					d->free = __new_cbq;
164
160
165
					__new_cbq->pdev = __cbq->pdev;
161
					__new_cbq->pdev = __cbq->pdev;
Lines 191-197 static int cn_call_callback(struct cn_msg *msg, void (*destruct_data)(void *), v Link Here
191
 */
187
 */
192
static void cn_rx_skb(struct sk_buff *__skb)
188
static void cn_rx_skb(struct sk_buff *__skb)
193
{
189
{
194
	struct cn_msg *msg;
195
	struct nlmsghdr *nlh;
190
	struct nlmsghdr *nlh;
196
	int err;
191
	int err;
197
	struct sk_buff *skb;
192
	struct sk_buff *skb;
Lines 208-215 static void cn_rx_skb(struct sk_buff *__skb) Link Here
208
			return;
203
			return;
209
		}
204
		}
210
205
211
		msg = NLMSG_DATA(nlh);
206
		err = cn_call_callback(skb);
212
		err = cn_call_callback(msg, (void (*)(void *))kfree_skb, skb);
213
		if (err < 0)
207
		if (err < 0)
214
			kfree_skb(skb);
208
			kfree_skb(skb);
215
	}
209
	}
Lines 269-275 static void cn_notify(struct cb_id *id, u32 notify_event) Link Here
269
 *
263
 *
270
 * May sleep.
264
 * May sleep.
271
 */
265
 */
272
int cn_add_callback(struct cb_id *id, char *name, void (*callback)(void *))
266
int cn_add_callback(struct cb_id *id, char *name,
267
		    void (*callback)(struct cn_msg *, struct netlink_skb_parms *))
273
{
268
{
274
	int err;
269
	int err;
275
	struct cn_dev *dev = &cdev;
270
	struct cn_dev *dev = &cdev;
Lines 351-359 static int cn_ctl_msg_equals(struct cn_ctl_msg *m1, struct cn_ctl_msg *m2) Link Here
351
 *
346
 *
352
 * Used for notification of a request's processing.
347
 * Used for notification of a request's processing.
353
 */
348
 */
354
static void cn_callback(void *data)
349
static void cn_callback(struct cn_msg *msg, struct netlink_skb_parms *nsp)
355
{
350
{
356
	struct cn_msg *msg = data;
357
	struct cn_ctl_msg *ctl;
351
	struct cn_ctl_msg *ctl;
358
	struct cn_ctl_entry *ent;
352
	struct cn_ctl_entry *ent;
359
	u32 size;
353
	u32 size;
(-)a/drivers/i2c/busses/i2c-amd756.c (-1 / +1 lines)
Lines 364-370 static int __devinit amd756_probe(struct pci_dev *pdev, Link Here
364
	error = acpi_check_region(amd756_ioport, SMB_IOSIZE,
364
	error = acpi_check_region(amd756_ioport, SMB_IOSIZE,
365
				  amd756_driver.name);
365
				  amd756_driver.name);
366
	if (error)
366
	if (error)
367
		return error;
367
		return -ENODEV;
368
368
369
	if (!request_region(amd756_ioport, SMB_IOSIZE, amd756_driver.name)) {
369
	if (!request_region(amd756_ioport, SMB_IOSIZE, amd756_driver.name)) {
370
		dev_err(&pdev->dev, "SMB region 0x%x already in use!\n",
370
		dev_err(&pdev->dev, "SMB region 0x%x already in use!\n",
(-)a/drivers/i2c/busses/i2c-amd8111.c (-1 / +3 lines)
Lines 376-383 static int __devinit amd8111_probe(struct pci_dev *dev, Link Here
376
	smbus->size = pci_resource_len(dev, 0);
376
	smbus->size = pci_resource_len(dev, 0);
377
377
378
	error = acpi_check_resource_conflict(&dev->resource[0]);
378
	error = acpi_check_resource_conflict(&dev->resource[0]);
379
	if (error)
379
	if (error) {
380
		error = -ENODEV;
380
		goto out_kfree;
381
		goto out_kfree;
382
	}
381
383
382
	if (!request_region(smbus->base, smbus->size, amd8111_driver.name)) {
384
	if (!request_region(smbus->base, smbus->size, amd8111_driver.name)) {
383
		error = -EBUSY;
385
		error = -EBUSY;
(-)a/drivers/i2c/busses/i2c-i801.c (-1 / +3 lines)
Lines 732-739 static int __devinit i801_probe(struct pci_dev *dev, const struct pci_device_id Link Here
732
	}
732
	}
733
733
734
	err = acpi_check_resource_conflict(&dev->resource[SMBBAR]);
734
	err = acpi_check_resource_conflict(&dev->resource[SMBBAR]);
735
	if (err)
735
	if (err) {
736
		err = -ENODEV;
736
		goto exit;
737
		goto exit;
738
	}
737
739
738
	err = pci_request_region(dev, SMBBAR, i801_driver.name);
740
	err = pci_request_region(dev, SMBBAR, i801_driver.name);
739
	if (err) {
741
	if (err) {
(-)a/drivers/i2c/busses/i2c-isch.c (-1 / +1 lines)
Lines 281-287 static int __devinit sch_probe(struct pci_dev *dev, Link Here
281
		return -ENODEV;
281
		return -ENODEV;
282
	}
282
	}
283
	if (acpi_check_region(sch_smba, SMBIOSIZE, sch_driver.name))
283
	if (acpi_check_region(sch_smba, SMBIOSIZE, sch_driver.name))
284
		return -EBUSY;
284
		return -ENODEV;
285
	if (!request_region(sch_smba, SMBIOSIZE, sch_driver.name)) {
285
	if (!request_region(sch_smba, SMBIOSIZE, sch_driver.name)) {
286
		dev_err(&dev->dev, "SMBus region 0x%x already in use!\n",
286
		dev_err(&dev->dev, "SMBus region 0x%x already in use!\n",
287
			sch_smba);
287
			sch_smba);
(-)a/drivers/i2c/busses/i2c-piix4.c (-2 / +2 lines)
Lines 168-174 static int __devinit piix4_setup(struct pci_dev *PIIX4_dev, Link Here
168
	}
168
	}
169
169
170
	if (acpi_check_region(piix4_smba, SMBIOSIZE, piix4_driver.name))
170
	if (acpi_check_region(piix4_smba, SMBIOSIZE, piix4_driver.name))
171
		return -EBUSY;
171
		return -ENODEV;
172
172
173
	if (!request_region(piix4_smba, SMBIOSIZE, piix4_driver.name)) {
173
	if (!request_region(piix4_smba, SMBIOSIZE, piix4_driver.name)) {
174
		dev_err(&PIIX4_dev->dev, "SMBus region 0x%x already in use!\n",
174
		dev_err(&PIIX4_dev->dev, "SMBus region 0x%x already in use!\n",
Lines 259-265 static int __devinit piix4_setup_sb800(struct pci_dev *PIIX4_dev, Link Here
259
259
260
	piix4_smba = ((smba_en_hi << 8) | smba_en_lo) & 0xffe0;
260
	piix4_smba = ((smba_en_hi << 8) | smba_en_lo) & 0xffe0;
261
	if (acpi_check_region(piix4_smba, SMBIOSIZE, piix4_driver.name))
261
	if (acpi_check_region(piix4_smba, SMBIOSIZE, piix4_driver.name))
262
		return -EBUSY;
262
		return -ENODEV;
263
263
264
	if (!request_region(piix4_smba, SMBIOSIZE, piix4_driver.name)) {
264
	if (!request_region(piix4_smba, SMBIOSIZE, piix4_driver.name)) {
265
		dev_err(&PIIX4_dev->dev, "SMBus region 0x%x already in use!\n",
265
		dev_err(&PIIX4_dev->dev, "SMBus region 0x%x already in use!\n",
(-)a/drivers/i2c/busses/i2c-sis96x.c (-1 / +1 lines)
Lines 280-286 static int __devinit sis96x_probe(struct pci_dev *dev, Link Here
280
280
281
	retval = acpi_check_resource_conflict(&dev->resource[SIS96x_BAR]);
281
	retval = acpi_check_resource_conflict(&dev->resource[SIS96x_BAR]);
282
	if (retval)
282
	if (retval)
283
		return retval;
283
		return -ENODEV;
284
284
285
	/* Everything is happy, let's grab the memory and set things up. */
285
	/* Everything is happy, let's grab the memory and set things up. */
286
	if (!request_region(sis96x_smbus_base, SMB_IOSIZE,
286
	if (!request_region(sis96x_smbus_base, SMB_IOSIZE,
(-)a/drivers/i2c/busses/i2c-viapro.c (-1 / +1 lines)
Lines 365-371 static int __devinit vt596_probe(struct pci_dev *pdev, Link Here
365
found:
365
found:
366
	error = acpi_check_region(vt596_smba, 8, vt596_driver.name);
366
	error = acpi_check_region(vt596_smba, 8, vt596_driver.name);
367
	if (error)
367
	if (error)
368
		return error;
368
		return -ENODEV;
369
369
370
	if (!request_region(vt596_smba, 8, vt596_driver.name)) {
370
	if (!request_region(vt596_smba, 8, vt596_driver.name)) {
371
		dev_err(&pdev->dev, "SMBus region 0x%x already in use!\n",
371
		dev_err(&pdev->dev, "SMBus region 0x%x already in use!\n",
(-)a/drivers/macintosh/therm_adt746x.c (-1 / +3 lines)
Lines 124-129 read_reg(struct thermostat* th, int reg) Link Here
124
	return data;
124
	return data;
125
}
125
}
126
126
127
static struct i2c_driver thermostat_driver;
128
127
static int
129
static int
128
attach_thermostat(struct i2c_adapter *adapter)
130
attach_thermostat(struct i2c_adapter *adapter)
129
{
131
{
Lines 148-154 attach_thermostat(struct i2c_adapter *adapter) Link Here
148
	 * Let i2c-core delete that device on driver removal.
150
	 * Let i2c-core delete that device on driver removal.
149
	 * This is safe because i2c-core holds the core_lock mutex for us.
151
	 * This is safe because i2c-core holds the core_lock mutex for us.
150
	 */
152
	 */
151
	list_add_tail(&client->detected, &client->driver->clients);
153
	list_add_tail(&client->detected, &thermostat_driver.clients);
152
	return 0;
154
	return 0;
153
}
155
}
154
156
(-)a/drivers/macintosh/therm_pm72.c (-1 / +3 lines)
Lines 286-291 struct fcu_fan_table fcu_fans[] = { Link Here
286
	},
286
	},
287
};
287
};
288
288
289
static struct i2c_driver therm_pm72_driver;
290
289
/*
291
/*
290
 * Utility function to create an i2c_client structure and
292
 * Utility function to create an i2c_client structure and
291
 * attach it to one of u3 adapters
293
 * attach it to one of u3 adapters
Lines 318-324 static struct i2c_client *attach_i2c_chip(int id, const char *name) Link Here
318
	 * Let i2c-core delete that device on driver removal.
320
	 * Let i2c-core delete that device on driver removal.
319
	 * This is safe because i2c-core holds the core_lock mutex for us.
321
	 * This is safe because i2c-core holds the core_lock mutex for us.
320
	 */
322
	 */
321
	list_add_tail(&clt->detected, &clt->driver->clients);
323
	list_add_tail(&clt->detected, &therm_pm72_driver.clients);
322
	return clt;
324
	return clt;
323
}
325
}
324
326
(-)a/drivers/macintosh/windfarm_lm75_sensor.c (-1 / +3 lines)
Lines 115-120 static int wf_lm75_probe(struct i2c_client *client, Link Here
115
	return rc;
115
	return rc;
116
}
116
}
117
117
118
static struct i2c_driver wf_lm75_driver;
119
118
static struct i2c_client *wf_lm75_create(struct i2c_adapter *adapter,
120
static struct i2c_client *wf_lm75_create(struct i2c_adapter *adapter,
119
					     u8 addr, int ds1775,
121
					     u8 addr, int ds1775,
120
					     const char *loc)
122
					     const char *loc)
Lines 157-163 static struct i2c_client *wf_lm75_create(struct i2c_adapter *adapter, Link Here
157
	 * Let i2c-core delete that device on driver removal.
159
	 * Let i2c-core delete that device on driver removal.
158
	 * This is safe because i2c-core holds the core_lock mutex for us.
160
	 * This is safe because i2c-core holds the core_lock mutex for us.
159
	 */
161
	 */
160
	list_add_tail(&client->detected, &client->driver->clients);
162
	list_add_tail(&client->detected, &wf_lm75_driver.clients);
161
	return client;
163
	return client;
162
 fail:
164
 fail:
163
	return NULL;
165
	return NULL;
(-)a/drivers/macintosh/windfarm_max6690_sensor.c (-1 / +3 lines)
Lines 88-93 static int wf_max6690_probe(struct i2c_client *client, Link Here
88
	return rc;
88
	return rc;
89
}
89
}
90
90
91
static struct i2c_driver wf_max6690_driver;
92
91
static struct i2c_client *wf_max6690_create(struct i2c_adapter *adapter,
93
static struct i2c_client *wf_max6690_create(struct i2c_adapter *adapter,
92
					    u8 addr, const char *loc)
94
					    u8 addr, const char *loc)
93
{
95
{
Lines 119-125 static struct i2c_client *wf_max6690_create(struct i2c_adapter *adapter, Link Here
119
	 * Let i2c-core delete that device on driver removal.
121
	 * Let i2c-core delete that device on driver removal.
120
	 * This is safe because i2c-core holds the core_lock mutex for us.
122
	 * This is safe because i2c-core holds the core_lock mutex for us.
121
	 */
123
	 */
122
	list_add_tail(&client->detected, &client->driver->clients);
124
	list_add_tail(&client->detected, &wf_max6690_driver.clients);
123
	return client;
125
	return client;
124
126
125
 fail:
127
 fail:
(-)a/drivers/macintosh/windfarm_smu_sat.c (-1 / +3 lines)
Lines 194-199 static struct wf_sensor_ops wf_sat_ops = { Link Here
194
	.owner		= THIS_MODULE,
194
	.owner		= THIS_MODULE,
195
};
195
};
196
196
197
static struct i2c_driver wf_sat_driver;
198
197
static void wf_sat_create(struct i2c_adapter *adapter, struct device_node *dev)
199
static void wf_sat_create(struct i2c_adapter *adapter, struct device_node *dev)
198
{
200
{
199
	struct i2c_board_info info;
201
	struct i2c_board_info info;
Lines 222-228 static void wf_sat_create(struct i2c_adapter *adapter, struct device_node *dev) Link Here
222
	 * Let i2c-core delete that device on driver removal.
224
	 * Let i2c-core delete that device on driver removal.
223
	 * This is safe because i2c-core holds the core_lock mutex for us.
225
	 * This is safe because i2c-core holds the core_lock mutex for us.
224
	 */
226
	 */
225
	list_add_tail(&client->detected, &client->driver->clients);
227
	list_add_tail(&client->detected, &wf_sat_driver.clients);
226
}
228
}
227
229
228
static int wf_sat_probe(struct i2c_client *client,
230
static int wf_sat_probe(struct i2c_client *client,
(-)a/drivers/md/dm-log-userspace-transfer.c (-2 / +4 lines)
Lines 129-139 static int fill_pkg(struct cn_msg *msg, struct dm_ulog_request *tfr) Link Here
129
 * This is the connector callback that delivers data
129
 * This is the connector callback that delivers data
130
 * that was sent from userspace.
130
 * that was sent from userspace.
131
 */
131
 */
132
static void cn_ulog_callback(void *data)
132
static void cn_ulog_callback(struct cn_msg *msg, struct netlink_skb_parms *nsp)
133
{
133
{
134
	struct cn_msg *msg = (struct cn_msg *)data;
135
	struct dm_ulog_request *tfr = (struct dm_ulog_request *)(msg + 1);
134
	struct dm_ulog_request *tfr = (struct dm_ulog_request *)(msg + 1);
136
135
136
	if (!cap_raised(nsp->eff_cap, CAP_SYS_ADMIN))
137
		return;
138
137
	spin_lock(&receiving_list_lock);
139
	spin_lock(&receiving_list_lock);
138
	if (msg->len == 0)
140
	if (msg->len == 0)
139
		fill_pkg(msg, NULL);
141
		fill_pkg(msg, NULL);
(-)a/drivers/net/e1000e/82571.c (-2 / +2 lines)
Lines 1803-1809 struct e1000_info e1000_82574_info = { Link Here
1803
				  | FLAG_HAS_AMT
1803
				  | FLAG_HAS_AMT
1804
				  | FLAG_HAS_CTRLEXT_ON_LOAD,
1804
				  | FLAG_HAS_CTRLEXT_ON_LOAD,
1805
	.pba			= 20,
1805
	.pba			= 20,
1806
	.max_hw_frame_size	= ETH_FRAME_LEN + ETH_FCS_LEN,
1806
	.max_hw_frame_size	= DEFAULT_JUMBO,
1807
	.get_variants		= e1000_get_variants_82571,
1807
	.get_variants		= e1000_get_variants_82571,
1808
	.mac_ops		= &e82571_mac_ops,
1808
	.mac_ops		= &e82571_mac_ops,
1809
	.phy_ops		= &e82_phy_ops_bm,
1809
	.phy_ops		= &e82_phy_ops_bm,
Lines 1820-1826 struct e1000_info e1000_82583_info = { Link Here
1820
				  | FLAG_HAS_AMT
1820
				  | FLAG_HAS_AMT
1821
				  | FLAG_HAS_CTRLEXT_ON_LOAD,
1821
				  | FLAG_HAS_CTRLEXT_ON_LOAD,
1822
	.pba			= 20,
1822
	.pba			= 20,
1823
	.max_hw_frame_size	= DEFAULT_JUMBO,
1823
	.max_hw_frame_size	= ETH_FRAME_LEN + ETH_FCS_LEN,
1824
	.get_variants		= e1000_get_variants_82571,
1824
	.get_variants		= e1000_get_variants_82571,
1825
	.mac_ops		= &e82571_mac_ops,
1825
	.mac_ops		= &e82571_mac_ops,
1826
	.phy_ops		= &e82_phy_ops_bm,
1826
	.phy_ops		= &e82_phy_ops_bm,
(-)a/drivers/net/wireless/iwlwifi/iwl-eeprom.c (-12 / +11 lines)
Lines 335-341 static int iwl_find_otp_image(struct iwl_priv *priv, Link Here
335
					u16 *validblockaddr)
335
					u16 *validblockaddr)
336
{
336
{
337
	u16 next_link_addr = 0, link_value = 0, valid_addr;
337
	u16 next_link_addr = 0, link_value = 0, valid_addr;
338
	int ret = 0;
339
	int usedblocks = 0;
338
	int usedblocks = 0;
340
339
341
	/* set addressing mode to absolute to traverse the link list */
340
	/* set addressing mode to absolute to traverse the link list */
Lines 355-383 static int iwl_find_otp_image(struct iwl_priv *priv, Link Here
355
		 * check for more block on the link list
354
		 * check for more block on the link list
356
		 */
355
		 */
357
		valid_addr = next_link_addr;
356
		valid_addr = next_link_addr;
358
		next_link_addr = link_value;
357
		next_link_addr = link_value * sizeof(u16);
359
		IWL_DEBUG_INFO(priv, "OTP blocks %d addr 0x%x\n",
358
		IWL_DEBUG_INFO(priv, "OTP blocks %d addr 0x%x\n",
360
			       usedblocks, next_link_addr);
359
			       usedblocks, next_link_addr);
361
		if (iwl_read_otp_word(priv, next_link_addr, &link_value))
360
		if (iwl_read_otp_word(priv, next_link_addr, &link_value))
362
			return -EINVAL;
361
			return -EINVAL;
363
		if (!link_value) {
362
		if (!link_value) {
364
			/*
363
			/*
365
			 * reach the end of link list,
364
			 * reach the end of link list, return success and
366
			 * set address point to the starting address
365
			 * set address point to the starting address
367
			 * of the image
366
			 * of the image
368
			 */
367
			 */
369
			goto done;
368
			*validblockaddr = valid_addr;
369
			/* skip first 2 bytes (link list pointer) */
370
			*validblockaddr += 2;
371
			return 0;
370
		}
372
		}
371
		/* more in the link list, continue */
373
		/* more in the link list, continue */
372
		usedblocks++;
374
		usedblocks++;
373
	} while (usedblocks < priv->cfg->max_ll_items);
375
	} while (usedblocks <= priv->cfg->max_ll_items);
374
	/* OTP full, use last block */
376
375
	IWL_DEBUG_INFO(priv, "OTP is full, use last block\n");
377
	/* OTP has no valid blocks */
376
done:
378
	IWL_DEBUG_INFO(priv, "OTP has no valid blocks\n");
377
	*validblockaddr = valid_addr;
379
	return -EINVAL;
378
	/* skip first 2 bytes (link list pointer) */
379
	*validblockaddr += 2;
380
	return ret;
381
}
380
}
382
381
383
/**
382
/**
(-)a/drivers/pci/dmar.c (-4 / +18 lines)
Lines 632-651 int alloc_iommu(struct dmar_drhd_unit *drhd) Link Here
632
	iommu->cap = dmar_readq(iommu->reg + DMAR_CAP_REG);
632
	iommu->cap = dmar_readq(iommu->reg + DMAR_CAP_REG);
633
	iommu->ecap = dmar_readq(iommu->reg + DMAR_ECAP_REG);
633
	iommu->ecap = dmar_readq(iommu->reg + DMAR_ECAP_REG);
634
634
635
	if (iommu->cap == (uint64_t)-1 && iommu->ecap == (uint64_t)-1) {
636
		/* Promote an attitude of violence to a BIOS engineer today */
637
		WARN(1, "Your BIOS is broken; DMAR reported at address %llx returns all ones!\n"
638
		     "BIOS vendor: %s; Ver: %s; Product Version: %s\n",
639
		     drhd->reg_base_addr,
640
		     dmi_get_system_info(DMI_BIOS_VENDOR),
641
		     dmi_get_system_info(DMI_BIOS_VERSION),
642
		     dmi_get_system_info(DMI_PRODUCT_VERSION));
643
		goto err_unmap;
644
	}
645
635
#ifdef CONFIG_DMAR
646
#ifdef CONFIG_DMAR
636
	agaw = iommu_calculate_agaw(iommu);
647
	agaw = iommu_calculate_agaw(iommu);
637
	if (agaw < 0) {
648
	if (agaw < 0) {
638
		printk(KERN_ERR
649
		printk(KERN_ERR
639
		       "Cannot get a valid agaw for iommu (seq_id = %d)\n",
650
		       "Cannot get a valid agaw for iommu (seq_id = %d)\n",
640
		       iommu->seq_id);
651
		       iommu->seq_id);
641
		goto error;
652
		goto err_unmap;
642
	}
653
	}
643
	msagaw = iommu_calculate_max_sagaw(iommu);
654
	msagaw = iommu_calculate_max_sagaw(iommu);
644
	if (msagaw < 0) {
655
	if (msagaw < 0) {
645
		printk(KERN_ERR
656
		printk(KERN_ERR
646
			"Cannot get a valid max agaw for iommu (seq_id = %d)\n",
657
			"Cannot get a valid max agaw for iommu (seq_id = %d)\n",
647
			iommu->seq_id);
658
			iommu->seq_id);
648
		goto error;
659
		goto err_unmap;
649
	}
660
	}
650
#endif
661
#endif
651
	iommu->agaw = agaw;
662
	iommu->agaw = agaw;
Lines 665-671 int alloc_iommu(struct dmar_drhd_unit *drhd) Link Here
665
	}
676
	}
666
677
667
	ver = readl(iommu->reg + DMAR_VER_REG);
678
	ver = readl(iommu->reg + DMAR_VER_REG);
668
	pr_debug("IOMMU %llx: ver %d:%d cap %llx ecap %llx\n",
679
	pr_info("IOMMU %llx: ver %d:%d cap %llx ecap %llx\n",
669
		(unsigned long long)drhd->reg_base_addr,
680
		(unsigned long long)drhd->reg_base_addr,
670
		DMAR_VER_MAJOR(ver), DMAR_VER_MINOR(ver),
681
		DMAR_VER_MAJOR(ver), DMAR_VER_MINOR(ver),
671
		(unsigned long long)iommu->cap,
682
		(unsigned long long)iommu->cap,
Lines 675-681 int alloc_iommu(struct dmar_drhd_unit *drhd) Link Here
675
686
676
	drhd->iommu = iommu;
687
	drhd->iommu = iommu;
677
	return 0;
688
	return 0;
678
error:
689
690
 err_unmap:
691
	iounmap(iommu->reg);
692
 error:
679
	kfree(iommu);
693
	kfree(iommu);
680
	return -1;
694
	return -1;
681
}
695
}
(-)a/drivers/scsi/scsi.c (-4 / +7 lines)
Lines 241-250 scsi_host_alloc_command(struct Scsi_Host *shost, gfp_t gfp_mask) Link Here
241
 */
241
 */
242
struct scsi_cmnd *__scsi_get_command(struct Scsi_Host *shost, gfp_t gfp_mask)
242
struct scsi_cmnd *__scsi_get_command(struct Scsi_Host *shost, gfp_t gfp_mask)
243
{
243
{
244
	struct scsi_cmnd *cmd;
244
	struct scsi_cmnd *cmd = scsi_host_alloc_command(shost, gfp_mask);
245
	unsigned char *buf;
246
247
	cmd = scsi_host_alloc_command(shost, gfp_mask);
248
245
249
	if (unlikely(!cmd)) {
246
	if (unlikely(!cmd)) {
250
		unsigned long flags;
247
		unsigned long flags;
Lines 258-266 struct scsi_cmnd *__scsi_get_command(struct Scsi_Host *shost, gfp_t gfp_mask) Link Here
258
		spin_unlock_irqrestore(&shost->free_list_lock, flags);
255
		spin_unlock_irqrestore(&shost->free_list_lock, flags);
259
256
260
		if (cmd) {
257
		if (cmd) {
258
			void *buf, *prot;
259
261
			buf = cmd->sense_buffer;
260
			buf = cmd->sense_buffer;
261
			prot = cmd->prot_sdb;
262
262
			memset(cmd, 0, sizeof(*cmd));
263
			memset(cmd, 0, sizeof(*cmd));
264
263
			cmd->sense_buffer = buf;
265
			cmd->sense_buffer = buf;
266
			cmd->prot_sdb = prot;
264
		}
267
		}
265
	}
268
	}
266
269
(-)a/drivers/scsi/scsi_error.c (+3 lines)
Lines 721-726 static int scsi_send_eh_cmnd(struct scsi_cmnd *scmd, unsigned char *cmnd, Link Here
721
		case NEEDS_RETRY:
721
		case NEEDS_RETRY:
722
		case FAILED:
722
		case FAILED:
723
			break;
723
			break;
724
		case ADD_TO_MLQUEUE:
725
			rtn = NEEDS_RETRY;
726
			break;
724
		default:
727
		default:
725
			rtn = FAILED;
728
			rtn = FAILED;
726
			break;
729
			break;
(-)a/drivers/scsi/sg.c (-5 / +5 lines)
Lines 1708-1718 static int sg_finish_rem_req(Sg_request * srp) Link Here
1708
	Sg_scatter_hold *req_schp = &srp->data;
1708
	Sg_scatter_hold *req_schp = &srp->data;
1709
1709
1710
	SCSI_LOG_TIMEOUT(4, printk("sg_finish_rem_req: res_used=%d\n", (int) srp->res_used));
1710
	SCSI_LOG_TIMEOUT(4, printk("sg_finish_rem_req: res_used=%d\n", (int) srp->res_used));
1711
	if (srp->res_used)
1712
		sg_unlink_reserve(sfp, srp);
1713
	else
1714
		sg_remove_scat(req_schp);
1715
1716
	if (srp->rq) {
1711
	if (srp->rq) {
1717
		if (srp->bio)
1712
		if (srp->bio)
1718
			ret = blk_rq_unmap_user(srp->bio);
1713
			ret = blk_rq_unmap_user(srp->bio);
Lines 1720-1725 static int sg_finish_rem_req(Sg_request * srp) Link Here
1720
		blk_put_request(srp->rq);
1715
		blk_put_request(srp->rq);
1721
	}
1716
	}
1722
1717
1718
	if (srp->res_used)
1719
		sg_unlink_reserve(sfp, srp);
1720
	else
1721
		sg_remove_scat(req_schp);
1722
1723
	sg_remove_request(sfp, srp);
1723
	sg_remove_request(sfp, srp);
1724
1724
1725
	return ret;
1725
	return ret;
(-)a/drivers/staging/dst/dcore.c (-2 / +6 lines)
Lines 846-860 static dst_command_func dst_commands[] = { Link Here
846
/*
846
/*
847
 * Configuration parser.
847
 * Configuration parser.
848
 */
848
 */
849
static void cn_dst_callback(void *data)
849
static void cn_dst_callback(struct cn_msg *msg, struct netlink_skb_parms *nsp)
850
{
850
{
851
	struct dst_ctl *ctl;
851
	struct dst_ctl *ctl;
852
	struct cn_msg *msg = data;
853
	int err;
852
	int err;
854
	struct dst_ctl_ack ack;
853
	struct dst_ctl_ack ack;
855
	struct dst_node *n = NULL, *tmp;
854
	struct dst_node *n = NULL, *tmp;
856
	unsigned int hash;
855
	unsigned int hash;
857
856
857
	if (!cap_raised(nsp->eff_cap, CAP_SYS_ADMIN)) {
858
		err = -EPERM;
859
		goto out;
860
	}
861
858
	if (msg->len < sizeof(struct dst_ctl)) {
862
	if (msg->len < sizeof(struct dst_ctl)) {
859
		err = -EBADMSG;
863
		err = -EBADMSG;
860
		goto out;
864
		goto out;
(-)a/drivers/staging/pohmelfs/config.c (-2 / +4 lines)
Lines 446-456 out_unlock: Link Here
446
	return err;
446
	return err;
447
}
447
}
448
448
449
static void pohmelfs_cn_callback(void *data)
449
static void pohmelfs_cn_callback(struct cn_msg *msg, struct netlink_skb_parms *nsp)
450
{
450
{
451
	struct cn_msg *msg = data;
452
	int err;
451
	int err;
453
452
453
	if (!cap_raised(nsp->eff_cap, CAP_SYS_ADMIN))
454
		return;
455
454
	switch (msg->flags) {
456
	switch (msg->flags) {
455
		case POHMELFS_FLAGS_ADD:
457
		case POHMELFS_FLAGS_ADD:
456
		case POHMELFS_FLAGS_DEL:
458
		case POHMELFS_FLAGS_DEL:
(-)a/drivers/staging/rt2860/common/cmm_data_2860.c (+2 lines)
Lines 363-368 int RtmpPCIMgmtKickOut( Link Here
363
	ULONG			SwIdx = pAd->MgmtRing.TxCpuIdx;
363
	ULONG			SwIdx = pAd->MgmtRing.TxCpuIdx;
364
364
365
	pTxD  = (PTXD_STRUC) pAd->MgmtRing.Cell[SwIdx].AllocVa;
365
	pTxD  = (PTXD_STRUC) pAd->MgmtRing.Cell[SwIdx].AllocVa;
366
	if (!pTxD)
367
		return 0;
366
368
367
	pAd->MgmtRing.Cell[SwIdx].pNdisPacket = pPacket;
369
	pAd->MgmtRing.Cell[SwIdx].pNdisPacket = pPacket;
368
	pAd->MgmtRing.Cell[SwIdx].pNextNdisPacket = NULL;
370
	pAd->MgmtRing.Cell[SwIdx].pNextNdisPacket = NULL;
(-)a/drivers/usb/serial/cp210x.c (+1 lines)
Lines 114-119 static struct usb_device_id id_table [] = { Link Here
114
	{ USB_DEVICE(0x166A, 0x0303) }, /* Clipsal 5500PCU C-Bus USB interface */
114
	{ USB_DEVICE(0x166A, 0x0303) }, /* Clipsal 5500PCU C-Bus USB interface */
115
	{ USB_DEVICE(0x16D6, 0x0001) }, /* Jablotron serial interface */
115
	{ USB_DEVICE(0x16D6, 0x0001) }, /* Jablotron serial interface */
116
	{ USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */
116
	{ USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */
117
	{ USB_DEVICE(0x413C, 0x9500) }, /* DW700 GPS USB interface */
117
	{ } /* Terminating Entry */
118
	{ } /* Terminating Entry */
118
};
119
};
119
120
(-)a/drivers/usb/serial/digi_acceleport.c (-4 / +4 lines)
Lines 899-914 static void digi_rx_unthrottle(struct tty_struct *tty) Link Here
899
899
900
	spin_lock_irqsave(&priv->dp_port_lock, flags);
900
	spin_lock_irqsave(&priv->dp_port_lock, flags);
901
901
902
	/* turn throttle off */
903
	priv->dp_throttled = 0;
904
	priv->dp_throttle_restart = 0;
905
906
	/* restart read chain */
902
	/* restart read chain */
907
	if (priv->dp_throttle_restart) {
903
	if (priv->dp_throttle_restart) {
908
		port->read_urb->dev = port->serial->dev;
904
		port->read_urb->dev = port->serial->dev;
909
		ret = usb_submit_urb(port->read_urb, GFP_ATOMIC);
905
		ret = usb_submit_urb(port->read_urb, GFP_ATOMIC);
910
	}
906
	}
911
907
908
	/* turn throttle off */
909
	priv->dp_throttled = 0;
910
	priv->dp_throttle_restart = 0;
911
912
	spin_unlock_irqrestore(&priv->dp_port_lock, flags);
912
	spin_unlock_irqrestore(&priv->dp_port_lock, flags);
913
913
914
	if (ret)
914
	if (ret)
(-)a/drivers/usb/serial/ftdi_sio.c (-293 / +129 lines)
Lines 76-88 struct ftdi_private { Link Here
76
	unsigned long last_dtr_rts;	/* saved modem control outputs */
76
	unsigned long last_dtr_rts;	/* saved modem control outputs */
77
	wait_queue_head_t delta_msr_wait; /* Used for TIOCMIWAIT */
77
	wait_queue_head_t delta_msr_wait; /* Used for TIOCMIWAIT */
78
	char prev_status, diff_status;        /* Used for TIOCMIWAIT */
78
	char prev_status, diff_status;        /* Used for TIOCMIWAIT */
79
	__u8 rx_flags;		/* receive state flags (throttling) */
80
	spinlock_t rx_lock;	/* spinlock for receive state */
81
	struct delayed_work rx_work;
82
	struct usb_serial_port *port;
79
	struct usb_serial_port *port;
83
	int rx_processed;
84
	unsigned long rx_bytes;
85
86
	__u16 interface;	/* FT2232C, FT2232H or FT4232H port interface
80
	__u16 interface;	/* FT2232C, FT2232H or FT4232H port interface
87
				   (0 for FT232/245) */
81
				   (0 for FT232/245) */
88
82
Lines 737-746 static const char *ftdi_chip_name[] = { Link Here
737
/* Constants for read urb and write urb */
731
/* Constants for read urb and write urb */
738
#define BUFSZ 512
732
#define BUFSZ 512
739
733
740
/* rx_flags */
741
#define THROTTLED		0x01
742
#define ACTUALLY_THROTTLED	0x02
743
744
/* Used for TIOCMIWAIT */
734
/* Used for TIOCMIWAIT */
745
#define FTDI_STATUS_B0_MASK	(FTDI_RS0_CTS | FTDI_RS0_DSR | FTDI_RS0_RI | FTDI_RS0_RLSD)
735
#define FTDI_STATUS_B0_MASK	(FTDI_RS0_CTS | FTDI_RS0_DSR | FTDI_RS0_RI | FTDI_RS0_RLSD)
746
#define FTDI_STATUS_B1_MASK	(FTDI_RS_BI)
736
#define FTDI_STATUS_B1_MASK	(FTDI_RS_BI)
Lines 764-770 static int ftdi_write_room(struct tty_struct *tty); Link Here
764
static int  ftdi_chars_in_buffer(struct tty_struct *tty);
754
static int  ftdi_chars_in_buffer(struct tty_struct *tty);
765
static void ftdi_write_bulk_callback(struct urb *urb);
755
static void ftdi_write_bulk_callback(struct urb *urb);
766
static void ftdi_read_bulk_callback(struct urb *urb);
756
static void ftdi_read_bulk_callback(struct urb *urb);
767
static void ftdi_process_read(struct work_struct *work);
757
static void ftdi_process_read(struct usb_serial_port *port);
768
static void ftdi_set_termios(struct tty_struct *tty,
758
static void ftdi_set_termios(struct tty_struct *tty,
769
			struct usb_serial_port *port, struct ktermios *old);
759
			struct usb_serial_port *port, struct ktermios *old);
770
static int  ftdi_tiocmget(struct tty_struct *tty, struct file *file);
760
static int  ftdi_tiocmget(struct tty_struct *tty, struct file *file);
Lines 1235-1241 static int set_serial_info(struct tty_struct *tty, Link Here
1235
					(new_serial.flags & ASYNC_FLAGS));
1225
					(new_serial.flags & ASYNC_FLAGS));
1236
	priv->custom_divisor = new_serial.custom_divisor;
1226
	priv->custom_divisor = new_serial.custom_divisor;
1237
1227
1238
	tty->low_latency = (priv->flags & ASYNC_LOW_LATENCY) ? 1 : 0;
1239
	write_latency_timer(port);
1228
	write_latency_timer(port);
1240
1229
1241
check_and_exit:
1230
check_and_exit:
Lines 1528-1534 static int ftdi_sio_port_probe(struct usb_serial_port *port) Link Here
1528
	}
1517
	}
1529
1518
1530
	kref_init(&priv->kref);
1519
	kref_init(&priv->kref);
1531
	spin_lock_init(&priv->rx_lock);
1532
	spin_lock_init(&priv->tx_lock);
1520
	spin_lock_init(&priv->tx_lock);
1533
	init_waitqueue_head(&priv->delta_msr_wait);
1521
	init_waitqueue_head(&priv->delta_msr_wait);
1534
	/* This will push the characters through immediately rather
1522
	/* This will push the characters through immediately rather
Lines 1550-1556 static int ftdi_sio_port_probe(struct usb_serial_port *port) Link Here
1550
		port->read_urb->transfer_buffer_length = BUFSZ;
1538
		port->read_urb->transfer_buffer_length = BUFSZ;
1551
	}
1539
	}
1552
1540
1553
	INIT_DELAYED_WORK(&priv->rx_work, ftdi_process_read);
1554
	priv->port = port;
1541
	priv->port = port;
1555
1542
1556
	/* Free port's existing write urb and transfer buffer. */
1543
	/* Free port's existing write urb and transfer buffer. */
Lines 1687-1692 static int ftdi_sio_port_remove(struct usb_serial_port *port) Link Here
1687
	return 0;
1674
	return 0;
1688
}
1675
}
1689
1676
1677
static int ftdi_submit_read_urb(struct usb_serial_port *port, gfp_t mem_flags)
1678
{
1679
	struct urb *urb = port->read_urb;
1680
	struct usb_serial *serial = port->serial;
1681
	int result;
1682
1683
	usb_fill_bulk_urb(urb, serial->dev,
1684
			   usb_rcvbulkpipe(serial->dev,
1685
					port->bulk_in_endpointAddress),
1686
			   urb->transfer_buffer,
1687
			   urb->transfer_buffer_length,
1688
			   ftdi_read_bulk_callback, port);
1689
	result = usb_submit_urb(urb, mem_flags);
1690
	if (result)
1691
		dev_err(&port->dev,
1692
			"%s - failed submitting read urb, error %d\n",
1693
							__func__, result);
1694
	return result;
1695
}
1696
1690
static int ftdi_open(struct tty_struct *tty,
1697
static int ftdi_open(struct tty_struct *tty,
1691
			struct usb_serial_port *port, struct file *filp)
1698
			struct usb_serial_port *port, struct file *filp)
1692
{ /* ftdi_open */
1699
{ /* ftdi_open */
Lines 1702-1713 static int ftdi_open(struct tty_struct *tty, Link Here
1702
	spin_lock_irqsave(&priv->tx_lock, flags);
1709
	spin_lock_irqsave(&priv->tx_lock, flags);
1703
	priv->tx_bytes = 0;
1710
	priv->tx_bytes = 0;
1704
	spin_unlock_irqrestore(&priv->tx_lock, flags);
1711
	spin_unlock_irqrestore(&priv->tx_lock, flags);
1705
	spin_lock_irqsave(&priv->rx_lock, flags);
1706
	priv->rx_bytes = 0;
1707
	spin_unlock_irqrestore(&priv->rx_lock, flags);
1708
1709
	if (tty)
1710
		tty->low_latency = (priv->flags & ASYNC_LOW_LATENCY) ? 1 : 0;
1711
1712
1712
	write_latency_timer(port);
1713
	write_latency_timer(port);
1713
1714
Lines 1727-1749 static int ftdi_open(struct tty_struct *tty, Link Here
1727
		ftdi_set_termios(tty, port, tty->termios);
1728
		ftdi_set_termios(tty, port, tty->termios);
1728
1729
1729
	/* Not throttled */
1730
	/* Not throttled */
1730
	spin_lock_irqsave(&priv->rx_lock, flags);
1731
	spin_lock_irqsave(&port->lock, flags);
1731
	priv->rx_flags &= ~(THROTTLED | ACTUALLY_THROTTLED);
1732
	port->throttled = 0;
1732
	spin_unlock_irqrestore(&priv->rx_lock, flags);
1733
	port->throttle_req = 0;
1734
	spin_unlock_irqrestore(&port->lock, flags);
1733
1735
1734
	/* Start reading from the device */
1736
	/* Start reading from the device */
1735
	priv->rx_processed = 0;
1737
	result = ftdi_submit_read_urb(port, GFP_KERNEL);
1736
	usb_fill_bulk_urb(port->read_urb, dev,
1738
	if (!result)
1737
			usb_rcvbulkpipe(dev, port->bulk_in_endpointAddress),
1738
			port->read_urb->transfer_buffer,
1739
				port->read_urb->transfer_buffer_length,
1740
			ftdi_read_bulk_callback, port);
1741
	result = usb_submit_urb(port->read_urb, GFP_KERNEL);
1742
	if (result)
1743
		dev_err(&port->dev,
1744
			"%s - failed submitting read urb, error %d\n",
1745
			__func__, result);
1746
	else
1747
		kref_get(&priv->kref);
1739
		kref_get(&priv->kref);
1748
1740
1749
	return result;
1741
	return result;
Lines 1789-1798 static void ftdi_close(struct usb_serial_port *port) Link Here
1789
1781
1790
	dbg("%s", __func__);
1782
	dbg("%s", __func__);
1791
1783
1792
1793
	/* cancel any scheduled reading */
1794
	cancel_delayed_work_sync(&priv->rx_work);
1795
1796
	/* shutdown our bulk read */
1784
	/* shutdown our bulk read */
1797
	usb_kill_urb(port->read_urb);
1785
	usb_kill_urb(port->read_urb);
1798
	kref_put(&priv->kref, ftdi_sio_priv_release);
1786
	kref_put(&priv->kref, ftdi_sio_priv_release);
Lines 2015-2285 static int ftdi_chars_in_buffer(struct tty_struct *tty) Link Here
2015
	return buffered;
2003
	return buffered;
2016
}
2004
}
2017
2005
2018
static void ftdi_read_bulk_callback(struct urb *urb)
2006
static int ftdi_process_packet(struct tty_struct *tty,
2007
		struct usb_serial_port *port, struct ftdi_private *priv,
2008
		char *packet, int len)
2019
{
2009
{
2020
	struct usb_serial_port *port = urb->context;
2010
	int i;
2021
	struct tty_struct *tty;
2011
	char status;
2022
	struct ftdi_private *priv;
2012
	char flag;
2023
	unsigned long countread;
2013
	char *ch;
2024
	unsigned long flags;
2025
	int status = urb->status;
2026
2027
	if (urb->number_of_packets > 0) {
2028
		dev_err(&port->dev, "%s transfer_buffer_length %d "
2029
			"actual_length %d number of packets %d\n", __func__,
2030
			urb->transfer_buffer_length,
2031
			urb->actual_length, urb->number_of_packets);
2032
		dev_err(&port->dev, "%s transfer_flags %x\n", __func__,
2033
			urb->transfer_flags);
2034
	}
2035
2014
2036
	dbg("%s - port %d", __func__, port->number);
2015
	dbg("%s - port %d", __func__, port->number);
2037
2016
2038
	if (port->port.count <= 0)
2017
	if (len < 2) {
2039
		return;
2018
		dbg("malformed packet");
2040
2019
		return 0;
2041
	tty = tty_port_tty_get(&port->port);
2042
	if (!tty) {
2043
		dbg("%s - bad tty pointer - exiting", __func__);
2044
		return;
2045
	}
2020
	}
2046
2021
2047
	priv = usb_get_serial_port_data(port);
2022
	/* Compare new line status to the old one, signal if different/
2048
	if (!priv) {
2023
	   N.B. packet may be processed more than once, but differences
2049
		dbg("%s - bad port private data pointer - exiting", __func__);
2024
	   are only processed once.  */
2050
		goto out;
2025
	status = packet[0] & FTDI_STATUS_B0_MASK;
2026
	if (status != priv->prev_status) {
2027
		priv->diff_status |= status ^ priv->prev_status;
2028
		wake_up_interruptible(&priv->delta_msr_wait);
2029
		priv->prev_status = status;
2051
	}
2030
	}
2052
2031
2053
	if (urb != port->read_urb)
2032
	/*
2054
		dev_err(&port->dev, "%s - Not my urb!\n", __func__);
2033
	 * Although the device uses a bitmask and hence can have multiple
2055
2034
	 * errors on a packet - the order here sets the priority the error is
2056
	if (status) {
2035
	 * returned to the tty layer.
2057
		/* This will happen at close every time so it is a dbg not an
2036
	 */
2058
		   err */
2037
	flag = TTY_NORMAL;
2059
		dbg("(this is ok on close) nonzero read bulk status received: %d", status);
2038
	if (packet[1] & FTDI_RS_OE) {
2060
		goto out;
2039
		flag = TTY_OVERRUN;
2040
		dbg("OVERRRUN error");
2041
	}
2042
	if (packet[1] & FTDI_RS_BI) {
2043
		flag = TTY_BREAK;
2044
		dbg("BREAK received");
2045
		usb_serial_handle_break(port);
2046
	}
2047
	if (packet[1] & FTDI_RS_PE) {
2048
		flag = TTY_PARITY;
2049
		dbg("PARITY error");
2050
	}
2051
	if (packet[1] & FTDI_RS_FE) {
2052
		flag = TTY_FRAME;
2053
		dbg("FRAMING error");
2061
	}
2054
	}
2062
2055
2063
	/* count data bytes, but not status bytes */
2056
	len -= 2;
2064
	countread = urb->actual_length;
2057
	if (!len)
2065
	countread -= 2 * DIV_ROUND_UP(countread, priv->max_packet_size);
2058
		return 0;	/* status only */
2066
	spin_lock_irqsave(&priv->rx_lock, flags);
2059
	ch = packet + 2;
2067
	priv->rx_bytes += countread;
2060
2068
	spin_unlock_irqrestore(&priv->rx_lock, flags);
2061
	if (!(port->console && port->sysrq) && flag == TTY_NORMAL)
2069
2062
		tty_insert_flip_string(tty, ch, len);
2070
	ftdi_process_read(&priv->rx_work.work);
2063
	else {
2071
out:
2064
		for (i = 0; i < len; i++, ch++) {
2072
	tty_kref_put(tty);
2065
			if (!usb_serial_handle_sysrq_char(tty, port, *ch))
2073
} /* ftdi_read_bulk_callback */
2066
				tty_insert_flip_char(tty, *ch, flag);
2074
2067
		}
2068
	}
2069
	return len;
2070
}
2075
2071
2076
static void ftdi_process_read(struct work_struct *work)
2072
static void ftdi_process_read(struct usb_serial_port *port)
2077
{ /* ftdi_process_read */
2073
{
2078
	struct ftdi_private *priv =
2074
	struct urb *urb = port->read_urb;
2079
		container_of(work, struct ftdi_private, rx_work.work);
2080
	struct usb_serial_port *port = priv->port;
2081
	struct urb *urb;
2082
	struct tty_struct *tty;
2075
	struct tty_struct *tty;
2083
	char error_flag;
2076
	struct ftdi_private *priv = usb_get_serial_port_data(port);
2084
	unsigned char *data;
2077
	char *data = (char *)urb->transfer_buffer;
2085
2086
	int i;
2078
	int i;
2087
	int result;
2079
	int len;
2088
	int need_flip;
2080
	int count = 0;
2089
	int packet_offset;
2090
	unsigned long flags;
2091
2092
	dbg("%s - port %d", __func__, port->number);
2093
2094
	if (port->port.count <= 0)
2095
		return;
2096
2081
2097
	tty = tty_port_tty_get(&port->port);
2082
	tty = tty_port_tty_get(&port->port);
2098
	if (!tty) {
2083
	if (!tty)
2099
		dbg("%s - bad tty pointer - exiting", __func__);
2100
		return;
2084
		return;
2101
	}
2102
2103
	priv = usb_get_serial_port_data(port);
2104
	if (!priv) {
2105
		dbg("%s - bad port private data pointer - exiting", __func__);
2106
		goto out;
2107
	}
2108
2109
	urb = port->read_urb;
2110
	if (!urb) {
2111
		dbg("%s - bad read_urb pointer - exiting", __func__);
2112
		goto out;
2113
	}
2114
2115
	data = urb->transfer_buffer;
2116
2085
2117
	if (priv->rx_processed) {
2086
	for (i = 0; i < urb->actual_length; i += priv->max_packet_size) {
2118
		dbg("%s - already processed: %d bytes, %d remain", __func__,
2087
		len = min_t(int, urb->actual_length - i, priv->max_packet_size);
2119
				priv->rx_processed,
2088
		count += ftdi_process_packet(tty, port, priv, &data[i], len);
2120
				urb->actual_length - priv->rx_processed);
2121
	} else {
2122
		/* The first two bytes of every read packet are status */
2123
		if (urb->actual_length > 2)
2124
			usb_serial_debug_data(debug, &port->dev, __func__,
2125
						urb->actual_length, data);
2126
		else
2127
			dbg("Status only: %03oo %03oo", data[0], data[1]);
2128
	}
2089
	}
2129
2090
2130
2091
	if (count)
2131
	/* TO DO -- check for hung up line and handle appropriately: */
2132
	/*   send hangup  */
2133
	/* See acm.c - you do a tty_hangup  - eg tty_hangup(tty) */
2134
	/* if CD is dropped and the line is not CLOCAL then we should hangup */
2135
2136
	need_flip = 0;
2137
	for (packet_offset = priv->rx_processed;
2138
		packet_offset < urb->actual_length; packet_offset += priv->max_packet_size) {
2139
		int length;
2140
2141
		/* Compare new line status to the old one, signal if different/
2142
		   N.B. packet may be processed more than once, but differences
2143
		   are only processed once.  */
2144
		char new_status = data[packet_offset + 0] &
2145
						FTDI_STATUS_B0_MASK;
2146
		if (new_status != priv->prev_status) {
2147
			priv->diff_status |=
2148
				new_status ^ priv->prev_status;
2149
			wake_up_interruptible(&priv->delta_msr_wait);
2150
			priv->prev_status = new_status;
2151
		}
2152
2153
		length = min_t(u32, priv->max_packet_size, urb->actual_length-packet_offset)-2;
2154
		if (length < 0) {
2155
			dev_err(&port->dev, "%s - bad packet length: %d\n",
2156
				__func__, length+2);
2157
			length = 0;
2158
		}
2159
2160
		if (priv->rx_flags & THROTTLED) {
2161
			dbg("%s - throttled", __func__);
2162
			break;
2163
		}
2164
		if (tty_buffer_request_room(tty, length) < length) {
2165
			/* break out & wait for throttling/unthrottling to
2166
			   happen */
2167
			dbg("%s - receive room low", __func__);
2168
			break;
2169
		}
2170
2171
		/* Handle errors and break */
2172
		error_flag = TTY_NORMAL;
2173
		/* Although the device uses a bitmask and hence can have
2174
		   multiple errors on a packet - the order here sets the
2175
		   priority the error is returned to the tty layer  */
2176
2177
		if (data[packet_offset+1] & FTDI_RS_OE) {
2178
			error_flag = TTY_OVERRUN;
2179
			dbg("OVERRRUN error");
2180
		}
2181
		if (data[packet_offset+1] & FTDI_RS_BI) {
2182
			error_flag = TTY_BREAK;
2183
			dbg("BREAK received");
2184
			usb_serial_handle_break(port);
2185
		}
2186
		if (data[packet_offset+1] & FTDI_RS_PE) {
2187
			error_flag = TTY_PARITY;
2188
			dbg("PARITY error");
2189
		}
2190
		if (data[packet_offset+1] & FTDI_RS_FE) {
2191
			error_flag = TTY_FRAME;
2192
			dbg("FRAMING error");
2193
		}
2194
		if (length > 0) {
2195
			for (i = 2; i < length+2; i++) {
2196
				/* Note that the error flag is duplicated for
2197
				   every character received since we don't know
2198
				   which character it applied to */
2199
				if (!usb_serial_handle_sysrq_char(tty, port,
2200
						data[packet_offset + i]))
2201
					tty_insert_flip_char(tty,
2202
						data[packet_offset + i],
2203
						error_flag);
2204
			}
2205
			need_flip = 1;
2206
		}
2207
2208
#ifdef NOT_CORRECT_BUT_KEEPING_IT_FOR_NOW
2209
		/* if a parity error is detected you get status packets forever
2210
		   until a character is sent without a parity error.
2211
		   This doesn't work well since the application receives a
2212
		   never ending stream of bad data - even though new data
2213
		   hasn't been sent. Therefore I (bill) have taken this out.
2214
		   However - this might make sense for framing errors and so on
2215
		   so I am leaving the code in for now.
2216
		*/
2217
		else {
2218
			if (error_flag != TTY_NORMAL) {
2219
				dbg("error_flag is not normal");
2220
				/* In this case it is just status - if that is
2221
				   an error send a bad character */
2222
				if (tty->flip.count >= TTY_FLIPBUF_SIZE)
2223
					tty_flip_buffer_push(tty);
2224
				tty_insert_flip_char(tty, 0xff, error_flag);
2225
				need_flip = 1;
2226
			}
2227
		}
2228
#endif
2229
	} /* "for(packet_offset=0..." */
2230
2231
	/* Low latency */
2232
	if (need_flip)
2233
		tty_flip_buffer_push(tty);
2092
		tty_flip_buffer_push(tty);
2093
	tty_kref_put(tty);
2094
}
2234
2095
2235
	if (packet_offset < urb->actual_length) {
2096
static void ftdi_read_bulk_callback(struct urb *urb)
2236
		/* not completely processed - record progress */
2097
{
2237
		priv->rx_processed = packet_offset;
2098
	struct usb_serial_port *port = urb->context;
2238
		dbg("%s - incomplete, %d bytes processed, %d remain",
2099
	unsigned long flags;
2239
				__func__, packet_offset,
2240
				urb->actual_length - packet_offset);
2241
		/* check if we were throttled while processing */
2242
		spin_lock_irqsave(&priv->rx_lock, flags);
2243
		if (priv->rx_flags & THROTTLED) {
2244
			priv->rx_flags |= ACTUALLY_THROTTLED;
2245
			spin_unlock_irqrestore(&priv->rx_lock, flags);
2246
			dbg("%s - deferring remainder until unthrottled",
2247
					__func__);
2248
			goto out;
2249
		}
2250
		spin_unlock_irqrestore(&priv->rx_lock, flags);
2251
		/* if the port is closed stop trying to read */
2252
		if (port->port.count > 0)
2253
			/* delay processing of remainder */
2254
			schedule_delayed_work(&priv->rx_work, 1);
2255
		else
2256
			dbg("%s - port is closed", __func__);
2257
		goto out;
2258
	}
2259
2260
	/* urb is completely processed */
2261
	priv->rx_processed = 0;
2262
2100
2263
	/* if the port is closed stop trying to read */
2101
	dbg("%s - port %d", __func__, port->number);
2264
	if (port->port.count > 0) {
2265
		/* Continue trying to always read  */
2266
		usb_fill_bulk_urb(port->read_urb, port->serial->dev,
2267
			usb_rcvbulkpipe(port->serial->dev,
2268
					port->bulk_in_endpointAddress),
2269
			port->read_urb->transfer_buffer,
2270
			port->read_urb->transfer_buffer_length,
2271
			ftdi_read_bulk_callback, port);
2272
2102
2273
		result = usb_submit_urb(port->read_urb, GFP_ATOMIC);
2103
	if (urb->status) {
2274
		if (result)
2104
		dbg("%s - nonzero read bulk status received: %d",
2275
			dev_err(&port->dev,
2105
						__func__, urb->status);
2276
				"%s - failed resubmitting read urb, error %d\n",
2106
		return;
2277
				__func__, result);
2278
	}
2107
	}
2279
out:
2280
	tty_kref_put(tty);
2281
} /* ftdi_process_read */
2282
2108
2109
	usb_serial_debug_data(debug, &port->dev, __func__,
2110
				urb->actual_length, urb->transfer_buffer);
2111
	ftdi_process_read(port);
2112
2113
	spin_lock_irqsave(&port->lock, flags);
2114
	port->throttled = port->throttle_req;
2115
	if (!port->throttled) {
2116
		spin_unlock_irqrestore(&port->lock, flags);
2117
		ftdi_submit_read_urb(port, GFP_ATOMIC);
2118
	} else
2119
		spin_unlock_irqrestore(&port->lock, flags);
2120
}
2283
2121
2284
static void ftdi_break_ctl(struct tty_struct *tty, int break_state)
2122
static void ftdi_break_ctl(struct tty_struct *tty, int break_state)
2285
{
2123
{
Lines 2611-2643 static int ftdi_ioctl(struct tty_struct *tty, struct file *file, Link Here
2611
static void ftdi_throttle(struct tty_struct *tty)
2449
static void ftdi_throttle(struct tty_struct *tty)
2612
{
2450
{
2613
	struct usb_serial_port *port = tty->driver_data;
2451
	struct usb_serial_port *port = tty->driver_data;
2614
	struct ftdi_private *priv = usb_get_serial_port_data(port);
2615
	unsigned long flags;
2452
	unsigned long flags;
2616
2453
2617
	dbg("%s - port %d", __func__, port->number);
2454
	dbg("%s - port %d", __func__, port->number);
2618
2455
2619
	spin_lock_irqsave(&priv->rx_lock, flags);
2456
	spin_lock_irqsave(&port->lock, flags);
2620
	priv->rx_flags |= THROTTLED;
2457
	port->throttle_req = 1;
2621
	spin_unlock_irqrestore(&priv->rx_lock, flags);
2458
	spin_unlock_irqrestore(&port->lock, flags);
2622
}
2459
}
2623
2460
2624
2461
void ftdi_unthrottle(struct tty_struct *tty)
2625
static void ftdi_unthrottle(struct tty_struct *tty)
2626
{
2462
{
2627
	struct usb_serial_port *port = tty->driver_data;
2463
	struct usb_serial_port *port = tty->driver_data;
2628
	struct ftdi_private *priv = usb_get_serial_port_data(port);
2464
	int was_throttled;
2629
	int actually_throttled;
2630
	unsigned long flags;
2465
	unsigned long flags;
2631
2466
2632
	dbg("%s - port %d", __func__, port->number);
2467
	dbg("%s - port %d", __func__, port->number);
2633
2468
2634
	spin_lock_irqsave(&priv->rx_lock, flags);
2469
	spin_lock_irqsave(&port->lock, flags);
2635
	actually_throttled = priv->rx_flags & ACTUALLY_THROTTLED;
2470
	was_throttled = port->throttled;
2636
	priv->rx_flags &= ~(THROTTLED | ACTUALLY_THROTTLED);
2471
	port->throttled = port->throttle_req = 0;
2637
	spin_unlock_irqrestore(&priv->rx_lock, flags);
2472
	spin_unlock_irqrestore(&port->lock, flags);
2638
2473
2639
	if (actually_throttled)
2474
	/* Resubmit urb if throttled and open. */
2640
		schedule_delayed_work(&priv->rx_work, 0);
2475
	if (was_throttled && test_bit(ASYNCB_INITIALIZED, &port->port.flags))
2476
		ftdi_submit_read_urb(port, GFP_KERNEL);
2641
}
2477
}
2642
2478
2643
static int __init ftdi_init(void)
2479
static int __init ftdi_init(void)
(-)a/drivers/usb/serial/generic.c (-1 / +1 lines)
Lines 530-536 void usb_serial_generic_unthrottle(struct tty_struct *tty) Link Here
530
530
531
	if (was_throttled) {
531
	if (was_throttled) {
532
		/* Resume reading from device */
532
		/* Resume reading from device */
533
		usb_serial_generic_resubmit_read_urb(port, GFP_KERNEL);
533
		flush_and_resubmit_read_urb(port);
534
	}
534
	}
535
}
535
}
536
536
(-)a/drivers/usb/serial/ipaq.c (+9 lines)
Lines 971-976 static int ipaq_calc_num_ports(struct usb_serial *serial) Link Here
971
static int ipaq_startup(struct usb_serial *serial)
971
static int ipaq_startup(struct usb_serial *serial)
972
{
972
{
973
	dbg("%s", __func__);
973
	dbg("%s", __func__);
974
975
	/* Some of the devices in ipaq_id_table[] are composite, and we
976
	 * shouldn't bind to all the interfaces.  This test will rule out
977
	 * some obviously invalid possibilities.
978
	 */
979
	if (serial->num_bulk_in < serial->num_ports ||
980
			serial->num_bulk_out < serial->num_ports)
981
		return -ENODEV;
982
974
	if (serial->dev->actconfig->desc.bConfigurationValue != 1) {
983
	if (serial->dev->actconfig->desc.bConfigurationValue != 1) {
975
		/*
984
		/*
976
		 * FIXME: HP iPaq rx3715, possibly others, have 1 config that
985
		 * FIXME: HP iPaq rx3715, possibly others, have 1 config that
(-)a/drivers/usb/serial/option.c (+2 lines)
Lines 319-324 static int option_resume(struct usb_serial *serial); Link Here
319
/* TOSHIBA PRODUCTS */
319
/* TOSHIBA PRODUCTS */
320
#define TOSHIBA_VENDOR_ID			0x0930
320
#define TOSHIBA_VENDOR_ID			0x0930
321
#define TOSHIBA_PRODUCT_HSDPA_MINICARD		0x1302
321
#define TOSHIBA_PRODUCT_HSDPA_MINICARD		0x1302
322
#define TOSHIBA_PRODUCT_G450			0x0d45
322
323
323
#define ALINK_VENDOR_ID				0x1e0e
324
#define ALINK_VENDOR_ID				0x1e0e
324
#define ALINK_PRODUCT_3GU			0x9200
325
#define ALINK_PRODUCT_3GU			0x9200
Lines 582-587 static struct usb_device_id option_ids[] = { Link Here
582
	{ USB_DEVICE(QISDA_VENDOR_ID, QISDA_PRODUCT_H21_4523) },
583
	{ USB_DEVICE(QISDA_VENDOR_ID, QISDA_PRODUCT_H21_4523) },
583
	{ USB_DEVICE(QISDA_VENDOR_ID, QISDA_PRODUCT_H20_4515) },
584
	{ USB_DEVICE(QISDA_VENDOR_ID, QISDA_PRODUCT_H20_4515) },
584
	{ USB_DEVICE(QISDA_VENDOR_ID, QISDA_PRODUCT_H20_4519) },
585
	{ USB_DEVICE(QISDA_VENDOR_ID, QISDA_PRODUCT_H20_4519) },
586
	{ USB_DEVICE(TOSHIBA_VENDOR_ID, TOSHIBA_PRODUCT_G450) },
585
	{ USB_DEVICE(TOSHIBA_VENDOR_ID, TOSHIBA_PRODUCT_HSDPA_MINICARD ) }, /* Toshiba 3G HSDPA == Novatel Expedite EU870D MiniCard */
587
	{ USB_DEVICE(TOSHIBA_VENDOR_ID, TOSHIBA_PRODUCT_HSDPA_MINICARD ) }, /* Toshiba 3G HSDPA == Novatel Expedite EU870D MiniCard */
586
	{ USB_DEVICE(ALINK_VENDOR_ID, 0x9000) },
588
	{ USB_DEVICE(ALINK_VENDOR_ID, 0x9000) },
587
	{ USB_DEVICE_AND_INTERFACE_INFO(ALINK_VENDOR_ID, ALINK_PRODUCT_3GU, 0xff, 0xff, 0xff) },
589
	{ USB_DEVICE_AND_INTERFACE_INFO(ALINK_VENDOR_ID, ALINK_PRODUCT_3GU, 0xff, 0xff, 0xff) },
(-)a/drivers/usb/serial/pl2303.c (-3 / +5 lines)
Lines 995-1007 static void pl2303_push_data(struct tty_struct *tty, Link Here
995
	/* overrun is special, not associated with a char */
995
	/* overrun is special, not associated with a char */
996
	if (line_status & UART_OVERRUN_ERROR)
996
	if (line_status & UART_OVERRUN_ERROR)
997
		tty_insert_flip_char(tty, 0, TTY_OVERRUN);
997
		tty_insert_flip_char(tty, 0, TTY_OVERRUN);
998
	if (port->console && port->sysrq) {
998
999
	if (tty_flag == TTY_NORMAL && !(port->console && port->sysrq))
1000
		tty_insert_flip_string(tty, data, urb->actual_length);
1001
	else {
999
		int i;
1002
		int i;
1000
		for (i = 0; i < urb->actual_length; ++i)
1003
		for (i = 0; i < urb->actual_length; ++i)
1001
			if (!usb_serial_handle_sysrq_char(tty, port, data[i]))
1004
			if (!usb_serial_handle_sysrq_char(tty, port, data[i]))
1002
				tty_insert_flip_char(tty, data[i], tty_flag);
1005
				tty_insert_flip_char(tty, data[i], tty_flag);
1003
	} else
1006
	}
1004
		tty_insert_flip_string(tty, data, urb->actual_length);
1005
	tty_flip_buffer_push(tty);
1007
	tty_flip_buffer_push(tty);
1006
}
1008
}
1007
1009
(-)a/drivers/usb/serial/usb-serial.c (-1 / +5 lines)
Lines 155-161 static void destroy_serial(struct kref *kref) Link Here
155
	if (serial->minor != SERIAL_TTY_NO_MINOR)
155
	if (serial->minor != SERIAL_TTY_NO_MINOR)
156
		return_serial(serial);
156
		return_serial(serial);
157
157
158
	serial->type->release(serial);
158
	if (serial->attached)
159
		serial->type->release(serial);
159
160
160
	/* Now that nothing is using the ports, they can be freed */
161
	/* Now that nothing is using the ports, they can be freed */
161
	for (i = 0; i < serial->num_port_pointers; ++i) {
162
	for (i = 0; i < serial->num_port_pointers; ++i) {
Lines 1060-1071 int usb_serial_probe(struct usb_interface *interface, Link Here
1060
		module_put(type->driver.owner);
1061
		module_put(type->driver.owner);
1061
		if (retval < 0)
1062
		if (retval < 0)
1062
			goto probe_error;
1063
			goto probe_error;
1064
		serial->attached = 1;
1063
		if (retval > 0) {
1065
		if (retval > 0) {
1064
			/* quietly accept this device, but don't bind to a
1066
			/* quietly accept this device, but don't bind to a
1065
			   serial port as it's about to disappear */
1067
			   serial port as it's about to disappear */
1066
			serial->num_ports = 0;
1068
			serial->num_ports = 0;
1067
			goto exit;
1069
			goto exit;
1068
		}
1070
		}
1071
	} else {
1072
		serial->attached = 1;
1069
	}
1073
	}
1070
1074
1071
	if (get_free_serial(serial, num_ports, &minor) == NULL) {
1075
	if (get_free_serial(serial, num_ports, &minor) == NULL) {
(-)a/drivers/usb/storage/transport.c (-8 / +38 lines)
Lines 696-702 void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us) Link Here
696
		/* device supports and needs bigger sense buffer */
696
		/* device supports and needs bigger sense buffer */
697
		if (us->fflags & US_FL_SANE_SENSE)
697
		if (us->fflags & US_FL_SANE_SENSE)
698
			sense_size = ~0;
698
			sense_size = ~0;
699
699
Retry_Sense:
700
		US_DEBUGP("Issuing auto-REQUEST_SENSE\n");
700
		US_DEBUGP("Issuing auto-REQUEST_SENSE\n");
701
701
702
		scsi_eh_prep_cmnd(srb, &ses, NULL, 0, sense_size);
702
		scsi_eh_prep_cmnd(srb, &ses, NULL, 0, sense_size);
Lines 720-725 void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us) Link Here
720
			srb->result = DID_ABORT << 16;
720
			srb->result = DID_ABORT << 16;
721
			goto Handle_Errors;
721
			goto Handle_Errors;
722
		}
722
		}
723
724
		/* Some devices claim to support larger sense but fail when
725
		 * trying to request it. When a transport failure happens
726
		 * using US_FS_SANE_SENSE, we always retry with a standard
727
		 * (small) sense request. This fixes some USB GSM modems
728
		 */
729
		if (temp_result == USB_STOR_TRANSPORT_FAILED &&
730
		    (us->fflags & US_FL_SANE_SENSE) &&
731
		    sense_size != US_SENSE_SIZE) {
732
			US_DEBUGP("-- auto-sense failure, retry small sense\n");
733
			sense_size = US_SENSE_SIZE;
734
			goto Retry_Sense;
735
		}
736
737
		/* Other failures */
723
		if (temp_result != USB_STOR_TRANSPORT_GOOD) {
738
		if (temp_result != USB_STOR_TRANSPORT_GOOD) {
724
			US_DEBUGP("-- auto-sense failure\n");
739
			US_DEBUGP("-- auto-sense failure\n");
725
740
Lines 768-784 void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us) Link Here
768
		/* set the result so the higher layers expect this data */
783
		/* set the result so the higher layers expect this data */
769
		srb->result = SAM_STAT_CHECK_CONDITION;
784
		srb->result = SAM_STAT_CHECK_CONDITION;
770
785
771
		/* If things are really okay, then let's show that.  Zero
786
		/* We often get empty sense data.  This could indicate that
772
		 * out the sense buffer so the higher layers won't realize
787
		 * everything worked or that there was an unspecified
773
		 * we did an unsolicited auto-sense. */
788
		 * problem.  We have to decide which.
774
		if (result == USB_STOR_TRANSPORT_GOOD &&
789
		 */
775
			/* Filemark 0, ignore EOM, ILI 0, no sense */
790
		if (	/* Filemark 0, ignore EOM, ILI 0, no sense */
776
				(srb->sense_buffer[2] & 0xaf) == 0 &&
791
				(srb->sense_buffer[2] & 0xaf) == 0 &&
777
			/* No ASC or ASCQ */
792
			/* No ASC or ASCQ */
778
				srb->sense_buffer[12] == 0 &&
793
				srb->sense_buffer[12] == 0 &&
779
				srb->sense_buffer[13] == 0) {
794
				srb->sense_buffer[13] == 0) {
780
			srb->result = SAM_STAT_GOOD;
795
781
			srb->sense_buffer[0] = 0x0;
796
			/* If things are really okay, then let's show that.
797
			 * Zero out the sense buffer so the higher layers
798
			 * won't realize we did an unsolicited auto-sense.
799
			 */
800
			if (result == USB_STOR_TRANSPORT_GOOD) {
801
				srb->result = SAM_STAT_GOOD;
802
				srb->sense_buffer[0] = 0x0;
803
804
			/* If there was a problem, report an unspecified
805
			 * hardware error to prevent the higher layers from
806
			 * entering an infinite retry loop.
807
			 */
808
			} else {
809
				srb->result = DID_ERROR << 16;
810
				srb->sense_buffer[2] = HARDWARE_ERROR;
811
			}
782
		}
812
		}
783
	}
813
	}
784
814
(-)a/drivers/video/uvesafb.c (-2 / +4 lines)
Lines 67-78 static DEFINE_MUTEX(uvfb_lock); Link Here
67
 * find the kernel part of the task struct, copy the registers and
67
 * find the kernel part of the task struct, copy the registers and
68
 * the buffer contents and then complete the task.
68
 * the buffer contents and then complete the task.
69
 */
69
 */
70
static void uvesafb_cn_callback(void *data)
70
static void uvesafb_cn_callback(struct cn_msg *msg, struct netlink_skb_parms *nsp)
71
{
71
{
72
	struct cn_msg *msg = data;
73
	struct uvesafb_task *utask;
72
	struct uvesafb_task *utask;
74
	struct uvesafb_ktask *task;
73
	struct uvesafb_ktask *task;
75
74
75
	if (!cap_raised(nsp->eff_cap, CAP_SYS_ADMIN))
76
		return;
77
76
	if (msg->seq >= UVESAFB_TASKS_MAX)
78
	if (msg->seq >= UVESAFB_TASKS_MAX)
77
		return;
79
		return;
78
80
(-)a/drivers/w1/w1_netlink.c (-2 / +1 lines)
Lines 306-314 static int w1_netlink_send_error(struct cn_msg *rcmsg, struct w1_netlink_msg *rm Link Here
306
	return error;
306
	return error;
307
}
307
}
308
308
309
static void w1_cn_callback(void *data)
309
static void w1_cn_callback(struct cn_msg *msg, struct netlink_skb_parms *nsp)
310
{
310
{
311
	struct cn_msg *msg = data;
312
	struct w1_netlink_msg *m = (struct w1_netlink_msg *)(msg + 1);
311
	struct w1_netlink_msg *m = (struct w1_netlink_msg *)(msg + 1);
313
	struct w1_netlink_cmd *cmd;
312
	struct w1_netlink_cmd *cmd;
314
	struct w1_slave *sl;
313
	struct w1_slave *sl;
(-)a/fs/sysfs/file.c (-6 / +8 lines)
Lines 268-274 static int sysfs_get_open_dirent(struct sysfs_dirent *sd, Link Here
268
	struct sysfs_open_dirent *od, *new_od = NULL;
268
	struct sysfs_open_dirent *od, *new_od = NULL;
269
269
270
 retry:
270
 retry:
271
	spin_lock(&sysfs_open_dirent_lock);
271
	spin_lock_irq(&sysfs_open_dirent_lock);
272
272
273
	if (!sd->s_attr.open && new_od) {
273
	if (!sd->s_attr.open && new_od) {
274
		sd->s_attr.open = new_od;
274
		sd->s_attr.open = new_od;
Lines 281-287 static int sysfs_get_open_dirent(struct sysfs_dirent *sd, Link Here
281
		list_add_tail(&buffer->list, &od->buffers);
281
		list_add_tail(&buffer->list, &od->buffers);
282
	}
282
	}
283
283
284
	spin_unlock(&sysfs_open_dirent_lock);
284
	spin_unlock_irq(&sysfs_open_dirent_lock);
285
285
286
	if (od) {
286
	if (od) {
287
		kfree(new_od);
287
		kfree(new_od);
Lines 315-322 static void sysfs_put_open_dirent(struct sysfs_dirent *sd, Link Here
315
				  struct sysfs_buffer *buffer)
315
				  struct sysfs_buffer *buffer)
316
{
316
{
317
	struct sysfs_open_dirent *od = sd->s_attr.open;
317
	struct sysfs_open_dirent *od = sd->s_attr.open;
318
	unsigned long flags;
318
319
319
	spin_lock(&sysfs_open_dirent_lock);
320
	spin_lock_irqsave(&sysfs_open_dirent_lock, flags);
320
321
321
	list_del(&buffer->list);
322
	list_del(&buffer->list);
322
	if (atomic_dec_and_test(&od->refcnt))
323
	if (atomic_dec_and_test(&od->refcnt))
Lines 324-330 static void sysfs_put_open_dirent(struct sysfs_dirent *sd, Link Here
324
	else
325
	else
325
		od = NULL;
326
		od = NULL;
326
327
327
	spin_unlock(&sysfs_open_dirent_lock);
328
	spin_unlock_irqrestore(&sysfs_open_dirent_lock, flags);
328
329
329
	kfree(od);
330
	kfree(od);
330
}
331
}
Lines 456-463 static unsigned int sysfs_poll(struct file *filp, poll_table *wait) Link Here
456
void sysfs_notify_dirent(struct sysfs_dirent *sd)
457
void sysfs_notify_dirent(struct sysfs_dirent *sd)
457
{
458
{
458
	struct sysfs_open_dirent *od;
459
	struct sysfs_open_dirent *od;
460
	unsigned long flags;
459
461
460
	spin_lock(&sysfs_open_dirent_lock);
462
	spin_lock_irqsave(&sysfs_open_dirent_lock, flags);
461
463
462
	od = sd->s_attr.open;
464
	od = sd->s_attr.open;
463
	if (od) {
465
	if (od) {
Lines 465-471 void sysfs_notify_dirent(struct sysfs_dirent *sd) Link Here
465
		wake_up_interruptible(&od->poll);
467
		wake_up_interruptible(&od->poll);
466
	}
468
	}
467
469
468
	spin_unlock(&sysfs_open_dirent_lock);
470
	spin_unlock_irqrestore(&sysfs_open_dirent_lock, flags);
469
}
471
}
470
EXPORT_SYMBOL_GPL(sysfs_notify_dirent);
472
EXPORT_SYMBOL_GPL(sysfs_notify_dirent);
471
473
(-)a/include/linux/connector.h (-7 / +4 lines)
Lines 132-142 struct cn_callback_id { Link Here
132
};
132
};
133
133
134
struct cn_callback_data {
134
struct cn_callback_data {
135
	void (*destruct_data) (void *);
135
	struct sk_buff *skb;
136
	void *ddata;
136
	void (*callback) (struct cn_msg *, struct netlink_skb_parms *);
137
	
138
	void *callback_priv;
139
	void (*callback) (void *);
140
137
141
	void *free;
138
	void *free;
142
};
139
};
Lines 167-177 struct cn_dev { Link Here
167
	struct cn_queue_dev *cbdev;
164
	struct cn_queue_dev *cbdev;
168
};
165
};
169
166
170
int cn_add_callback(struct cb_id *, char *, void (*callback) (void *));
167
int cn_add_callback(struct cb_id *, char *, void (*callback) (struct cn_msg *, struct netlink_skb_parms *));
171
void cn_del_callback(struct cb_id *);
168
void cn_del_callback(struct cb_id *);
172
int cn_netlink_send(struct cn_msg *, u32, gfp_t);
169
int cn_netlink_send(struct cn_msg *, u32, gfp_t);
173
170
174
int cn_queue_add_callback(struct cn_queue_dev *dev, char *name, struct cb_id *id, void (*callback)(void *));
171
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 *));
175
void cn_queue_del_callback(struct cn_queue_dev *dev, struct cb_id *id);
172
void cn_queue_del_callback(struct cn_queue_dev *dev, struct cb_id *id);
176
173
177
int queue_cn_work(struct cn_callback_entry *cbq, struct work_struct *work);
174
int queue_cn_work(struct cn_callback_entry *cbq, struct work_struct *work);
(-)a/include/linux/usb/serial.h (+1 lines)
Lines 148-153 struct usb_serial { Link Here
148
	struct usb_interface		*interface;
148
	struct usb_interface		*interface;
149
	unsigned char			disconnected:1;
149
	unsigned char			disconnected:1;
150
	unsigned char			suspending:1;
150
	unsigned char			suspending:1;
151
	unsigned char			attached:1;
151
	unsigned char			minor;
152
	unsigned char			minor;
152
	unsigned char			num_ports;
153
	unsigned char			num_ports;
153
	unsigned char			num_port_pointers;
154
	unsigned char			num_port_pointers;
(-)a/include/net/bluetooth/hci_core.h (+4 lines)
Lines 187-192 struct hci_conn { Link Here
187
	struct work_struct work_del;
187
	struct work_struct work_del;
188
188
189
	struct device	dev;
189
	struct device	dev;
190
	atomic_t	devref;
190
191
191
	struct hci_dev	*hdev;
192
	struct hci_dev	*hdev;
192
	void		*l2cap_data;
193
	void		*l2cap_data;
Lines 339-344 int hci_conn_switch_role(struct hci_conn *conn, __u8 role); Link Here
339
void hci_conn_enter_active_mode(struct hci_conn *conn);
340
void hci_conn_enter_active_mode(struct hci_conn *conn);
340
void hci_conn_enter_sniff_mode(struct hci_conn *conn);
341
void hci_conn_enter_sniff_mode(struct hci_conn *conn);
341
342
343
void hci_conn_hold_device(struct hci_conn *conn);
344
void hci_conn_put_device(struct hci_conn *conn);
345
342
static inline void hci_conn_hold(struct hci_conn *conn)
346
static inline void hci_conn_hold(struct hci_conn *conn)
343
{
347
{
344
	atomic_inc(&conn->refcnt);
348
	atomic_inc(&conn->refcnt);
(-)a/kernel/acct.c (-1 / +7 lines)
Lines 491-503 static void do_acct_process(struct bsd_acct_struct *acct, Link Here
491
	u64 run_time;
491
	u64 run_time;
492
	struct timespec uptime;
492
	struct timespec uptime;
493
	struct tty_struct *tty;
493
	struct tty_struct *tty;
494
	const struct cred *orig_cred;
495
496
	/* Perform file operations on behalf of whoever enabled accounting */
497
	orig_cred = override_creds(file->f_cred);
494
498
495
	/*
499
	/*
496
	 * First check to see if there is enough free_space to continue
500
	 * First check to see if there is enough free_space to continue
497
	 * the process accounting system.
501
	 * the process accounting system.
498
	 */
502
	 */
499
	if (!check_free_space(acct, file))
503
	if (!check_free_space(acct, file))
500
		return;
504
		goto out;
501
505
502
	/*
506
	/*
503
	 * Fill the accounting struct with the needed info as recorded
507
	 * Fill the accounting struct with the needed info as recorded
Lines 578-583 static void do_acct_process(struct bsd_acct_struct *acct, Link Here
578
			       sizeof(acct_t), &file->f_pos);
582
			       sizeof(acct_t), &file->f_pos);
579
	current->signal->rlim[RLIMIT_FSIZE].rlim_cur = flim;
583
	current->signal->rlim[RLIMIT_FSIZE].rlim_cur = flim;
580
	set_fs(fs);
584
	set_fs(fs);
585
out:
586
	revert_creds(orig_cred);
581
}
587
}
582
588
583
/**
589
/**
(-)a/kernel/futex.c (-16 / +23 lines)
Lines 115-120 struct futex_q { Link Here
115
	/* rt_waiter storage for requeue_pi: */
115
	/* rt_waiter storage for requeue_pi: */
116
	struct rt_mutex_waiter *rt_waiter;
116
	struct rt_mutex_waiter *rt_waiter;
117
117
118
	/* The expected requeue pi target futex key: */
119
	union futex_key *requeue_pi_key;
120
118
	/* Bitset for the optional bitmasked wakeup */
121
	/* Bitset for the optional bitmasked wakeup */
119
	u32 bitset;
122
	u32 bitset;
120
};
123
};
Lines 1089-1094 static int futex_proxy_trylock_atomic(u32 __user *pifutex, Link Here
1089
	if (!top_waiter)
1092
	if (!top_waiter)
1090
		return 0;
1093
		return 0;
1091
1094
1095
	/* Ensure we requeue to the expected futex. */
1096
	if (!match_futex(top_waiter->requeue_pi_key, key2))
1097
		return -EINVAL;
1098
1092
	/*
1099
	/*
1093
	 * Try to take the lock for top_waiter.  Set the FUTEX_WAITERS bit in
1100
	 * Try to take the lock for top_waiter.  Set the FUTEX_WAITERS bit in
1094
	 * the contended case or if set_waiters is 1.  The pi_state is returned
1101
	 * the contended case or if set_waiters is 1.  The pi_state is returned
Lines 1276-1281 retry_private: Link Here
1276
			continue;
1283
			continue;
1277
		}
1284
		}
1278
1285
1286
		/* Ensure we requeue to the expected futex for requeue_pi. */
1287
		if (requeue_pi && !match_futex(this->requeue_pi_key, &key2)) {
1288
			ret = -EINVAL;
1289
			break;
1290
		}
1291
1279
		/*
1292
		/*
1280
		 * Requeue nr_requeue waiters and possibly one more in the case
1293
		 * Requeue nr_requeue waiters and possibly one more in the case
1281
		 * of requeue_pi if we couldn't acquire the lock atomically.
1294
		 * of requeue_pi if we couldn't acquire the lock atomically.
Lines 1625-1641 out: Link Here
1625
static void futex_wait_queue_me(struct futex_hash_bucket *hb, struct futex_q *q,
1638
static void futex_wait_queue_me(struct futex_hash_bucket *hb, struct futex_q *q,
1626
				struct hrtimer_sleeper *timeout)
1639
				struct hrtimer_sleeper *timeout)
1627
{
1640
{
1628
	queue_me(q, hb);
1629
1630
	/*
1631
	 * There might have been scheduling since the queue_me(), as we
1632
	 * cannot hold a spinlock across the get_user() in case it
1633
	 * faults, and we cannot just set TASK_INTERRUPTIBLE state when
1634
	 * queueing ourselves into the futex hash. This code thus has to
1635
	 * rely on the futex_wake() code removing us from hash when it
1636
	 * wakes us up.
1637
	 */
1638
	set_current_state(TASK_INTERRUPTIBLE);
1641
	set_current_state(TASK_INTERRUPTIBLE);
1642
	queue_me(q, hb);
1639
1643
1640
	/* Arm the timer */
1644
	/* Arm the timer */
1641
	if (timeout) {
1645
	if (timeout) {
Lines 1645-1652 static void futex_wait_queue_me(struct futex_hash_bucket *hb, struct futex_q *q, Link Here
1645
	}
1649
	}
1646
1650
1647
	/*
1651
	/*
1648
	 * !plist_node_empty() is safe here without any lock.
1652
	 * If we have been removed from the hash list, then another task
1649
	 * q.lock_ptr != 0 is not safe, because of ordering against wakeup.
1653
	 * has tried to wake us, and we can skip the call to schedule().
1650
	 */
1654
	 */
1651
	if (likely(!plist_node_empty(&q->list))) {
1655
	if (likely(!plist_node_empty(&q->list))) {
1652
		/*
1656
		/*
Lines 1751-1756 static int futex_wait(u32 __user *uaddr, int fshared, Link Here
1751
	q.pi_state = NULL;
1755
	q.pi_state = NULL;
1752
	q.bitset = bitset;
1756
	q.bitset = bitset;
1753
	q.rt_waiter = NULL;
1757
	q.rt_waiter = NULL;
1758
	q.requeue_pi_key = NULL;
1754
1759
1755
	if (abs_time) {
1760
	if (abs_time) {
1756
		to = &timeout;
1761
		to = &timeout;
Lines 1858-1863 static int futex_lock_pi(u32 __user *uaddr, int fshared, Link Here
1858
1863
1859
	q.pi_state = NULL;
1864
	q.pi_state = NULL;
1860
	q.rt_waiter = NULL;
1865
	q.rt_waiter = NULL;
1866
	q.requeue_pi_key = NULL;
1861
retry:
1867
retry:
1862
	q.key = FUTEX_KEY_INIT;
1868
	q.key = FUTEX_KEY_INIT;
1863
	ret = get_futex_key(uaddr, fshared, &q.key, VERIFY_WRITE);
1869
	ret = get_futex_key(uaddr, fshared, &q.key, VERIFY_WRITE);
Lines 2168-2182 static int futex_wait_requeue_pi(u32 __user *uaddr, int fshared, Link Here
2168
	debug_rt_mutex_init_waiter(&rt_waiter);
2174
	debug_rt_mutex_init_waiter(&rt_waiter);
2169
	rt_waiter.task = NULL;
2175
	rt_waiter.task = NULL;
2170
2176
2171
	q.pi_state = NULL;
2172
	q.bitset = bitset;
2173
	q.rt_waiter = &rt_waiter;
2174
2175
	key2 = FUTEX_KEY_INIT;
2177
	key2 = FUTEX_KEY_INIT;
2176
	ret = get_futex_key(uaddr2, fshared, &key2, VERIFY_WRITE);
2178
	ret = get_futex_key(uaddr2, fshared, &key2, VERIFY_WRITE);
2177
	if (unlikely(ret != 0))
2179
	if (unlikely(ret != 0))
2178
		goto out;
2180
		goto out;
2179
2181
2182
	q.pi_state = NULL;
2183
	q.bitset = bitset;
2184
	q.rt_waiter = &rt_waiter;
2185
	q.requeue_pi_key = &key2;
2186
2180
	/* Prepare to wait on uaddr. */
2187
	/* Prepare to wait on uaddr. */
2181
	ret = futex_wait_setup(uaddr, val, fshared, &q, &hb);
2188
	ret = futex_wait_setup(uaddr, val, fshared, &q, &hb);
2182
	if (ret)
2189
	if (ret)
(-)a/kernel/trace/trace_events_filter.c (-1 / +2 lines)
Lines 844-851 static void postfix_clear(struct filter_parse_state *ps) Link Here
844
844
845
	while (!list_empty(&ps->postfix)) {
845
	while (!list_empty(&ps->postfix)) {
846
		elt = list_first_entry(&ps->postfix, struct postfix_elt, list);
846
		elt = list_first_entry(&ps->postfix, struct postfix_elt, list);
847
		kfree(elt->operand);
848
		list_del(&elt->list);
847
		list_del(&elt->list);
848
		kfree(elt->operand);
849
		kfree(elt);
849
	}
850
	}
850
}
851
}
851
852
(-)a/net/bluetooth/hci_conn.c (-1 / +16 lines)
Lines 246-251 struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst) Link Here
246
	if (hdev->notify)
246
	if (hdev->notify)
247
		hdev->notify(hdev, HCI_NOTIFY_CONN_ADD);
247
		hdev->notify(hdev, HCI_NOTIFY_CONN_ADD);
248
248
249
	atomic_set(&conn->devref, 0);
250
249
	hci_conn_init_sysfs(conn);
251
	hci_conn_init_sysfs(conn);
250
252
251
	tasklet_enable(&hdev->tx_task);
253
	tasklet_enable(&hdev->tx_task);
Lines 288-294 int hci_conn_del(struct hci_conn *conn) Link Here
288
290
289
	skb_queue_purge(&conn->data_q);
291
	skb_queue_purge(&conn->data_q);
290
292
291
	hci_conn_del_sysfs(conn);
293
	hci_conn_put_device(conn);
292
294
293
	hci_dev_put(hdev);
295
	hci_dev_put(hdev);
294
296
Lines 583-588 void hci_conn_check_pending(struct hci_dev *hdev) Link Here
583
	hci_dev_unlock(hdev);
585
	hci_dev_unlock(hdev);
584
}
586
}
585
587
588
void hci_conn_hold_device(struct hci_conn *conn)
589
{
590
	atomic_inc(&conn->devref);
591
}
592
EXPORT_SYMBOL(hci_conn_hold_device);
593
594
void hci_conn_put_device(struct hci_conn *conn)
595
{
596
	if (atomic_dec_and_test(&conn->devref))
597
		hci_conn_del_sysfs(conn);
598
}
599
EXPORT_SYMBOL(hci_conn_put_device);
600
586
int hci_get_conn_list(void __user *arg)
601
int hci_get_conn_list(void __user *arg)
587
{
602
{
588
	struct hci_conn_list_req req, *cl;
603
	struct hci_conn_list_req req, *cl;
(-)a/net/bluetooth/hci_event.c (+2 lines)
Lines 887-892 static inline void hci_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *s Link Here
887
		} else
887
		} else
888
			conn->state = BT_CONNECTED;
888
			conn->state = BT_CONNECTED;
889
889
890
		hci_conn_hold_device(conn);
890
		hci_conn_add_sysfs(conn);
891
		hci_conn_add_sysfs(conn);
891
892
892
		if (test_bit(HCI_AUTH, &hdev->flags))
893
		if (test_bit(HCI_AUTH, &hdev->flags))
Lines 1693-1698 static inline void hci_sync_conn_complete_evt(struct hci_dev *hdev, struct sk_bu Link Here
1693
		conn->handle = __le16_to_cpu(ev->handle);
1694
		conn->handle = __le16_to_cpu(ev->handle);
1694
		conn->state  = BT_CONNECTED;
1695
		conn->state  = BT_CONNECTED;
1695
1696
1697
		hci_conn_hold_device(conn);
1696
		hci_conn_add_sysfs(conn);
1698
		hci_conn_add_sysfs(conn);
1697
		break;
1699
		break;
1698
1700
(-)a/net/bluetooth/hidp/core.c (-21 / +44 lines)
Lines 40-45 Link Here
40
40
41
#include <linux/input.h>
41
#include <linux/input.h>
42
#include <linux/hid.h>
42
#include <linux/hid.h>
43
#include <linux/hidraw.h>
43
44
44
#include <net/bluetooth/bluetooth.h>
45
#include <net/bluetooth/bluetooth.h>
45
#include <net/bluetooth/hci_core.h>
46
#include <net/bluetooth/hci_core.h>
Lines 92-101 static void __hidp_link_session(struct hidp_session *session) Link Here
92
{
93
{
93
	__module_get(THIS_MODULE);
94
	__module_get(THIS_MODULE);
94
	list_add(&session->list, &hidp_session_list);
95
	list_add(&session->list, &hidp_session_list);
96
97
	hci_conn_hold_device(session->conn);
95
}
98
}
96
99
97
static void __hidp_unlink_session(struct hidp_session *session)
100
static void __hidp_unlink_session(struct hidp_session *session)
98
{
101
{
102
	hci_conn_put_device(session->conn);
103
99
	list_del(&session->list);
104
	list_del(&session->list);
100
	module_put(THIS_MODULE);
105
	module_put(THIS_MODULE);
101
}
106
}
Lines 573-579 static int hidp_session(void *arg) Link Here
573
	if (session->hid) {
578
	if (session->hid) {
574
		if (session->hid->claimed & HID_CLAIMED_INPUT)
579
		if (session->hid->claimed & HID_CLAIMED_INPUT)
575
			hidinput_disconnect(session->hid);
580
			hidinput_disconnect(session->hid);
581
		if (session->hid->claimed & HID_CLAIMED_HIDRAW)
582
			hidraw_disconnect(session->hid);
583
576
		hid_destroy_device(session->hid);
584
		hid_destroy_device(session->hid);
585
		session->hid = NULL;
577
	}
586
	}
578
587
579
	/* Wakeup user-space polling for socket errors */
588
	/* Wakeup user-space polling for socket errors */
Lines 601-625 static struct device *hidp_get_device(struct hidp_session *session) Link Here
601
{
610
{
602
	bdaddr_t *src = &bt_sk(session->ctrl_sock->sk)->src;
611
	bdaddr_t *src = &bt_sk(session->ctrl_sock->sk)->src;
603
	bdaddr_t *dst = &bt_sk(session->ctrl_sock->sk)->dst;
612
	bdaddr_t *dst = &bt_sk(session->ctrl_sock->sk)->dst;
613
	struct device *device = NULL;
604
	struct hci_dev *hdev;
614
	struct hci_dev *hdev;
605
	struct hci_conn *conn;
606
615
607
	hdev = hci_get_route(dst, src);
616
	hdev = hci_get_route(dst, src);
608
	if (!hdev)
617
	if (!hdev)
609
		return NULL;
618
		return NULL;
610
619
611
	conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, dst);
620
	session->conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, dst);
621
	if (session->conn)
622
		device = &session->conn->dev;
612
623
613
	hci_dev_put(hdev);
624
	hci_dev_put(hdev);
614
625
615
	return conn ? &conn->dev : NULL;
626
	return device;
616
}
627
}
617
628
618
static int hidp_setup_input(struct hidp_session *session,
629
static int hidp_setup_input(struct hidp_session *session,
619
				struct hidp_connadd_req *req)
630
				struct hidp_connadd_req *req)
620
{
631
{
621
	struct input_dev *input;
632
	struct input_dev *input;
622
	int i;
633
	int err, i;
623
634
624
	input = input_allocate_device();
635
	input = input_allocate_device();
625
	if (!input)
636
	if (!input)
Lines 666-672 static int hidp_setup_input(struct hidp_session *session, Link Here
666
677
667
	input->event = hidp_input_event;
678
	input->event = hidp_input_event;
668
679
669
	return input_register_device(input);
680
	err = input_register_device(input);
681
	if (err < 0) {
682
		hci_conn_put_device(session->conn);
683
		return err;
684
	}
685
686
	return 0;
670
}
687
}
671
688
672
static int hidp_open(struct hid_device *hid)
689
static int hidp_open(struct hid_device *hid)
Lines 748-760 static int hidp_setup_hid(struct hidp_session *session, Link Here
748
{
765
{
749
	struct hid_device *hid;
766
	struct hid_device *hid;
750
	bdaddr_t src, dst;
767
	bdaddr_t src, dst;
751
	int ret;
768
	int err;
752
769
753
	hid = hid_allocate_device();
770
	hid = hid_allocate_device();
754
	if (IS_ERR(hid)) {
771
	if (IS_ERR(hid))
755
		ret = PTR_ERR(session->hid);
772
		return PTR_ERR(session->hid);
756
		goto err;
757
	}
758
773
759
	session->hid = hid;
774
	session->hid = hid;
760
	session->req = req;
775
	session->req = req;
Lines 776-791 static int hidp_setup_hid(struct hidp_session *session, Link Here
776
	hid->dev.parent = hidp_get_device(session);
791
	hid->dev.parent = hidp_get_device(session);
777
	hid->ll_driver = &hidp_hid_driver;
792
	hid->ll_driver = &hidp_hid_driver;
778
793
779
	ret = hid_add_device(hid);
794
	err = hid_add_device(hid);
780
	if (ret)
795
	if (err < 0)
781
		goto err_hid;
796
		goto failed;
782
797
783
	return 0;
798
	return 0;
784
err_hid:
799
800
failed:
785
	hid_destroy_device(hid);
801
	hid_destroy_device(hid);
786
	session->hid = NULL;
802
	session->hid = NULL;
787
err:
803
788
	return ret;
804
	return err;
789
}
805
}
790
806
791
int hidp_add_connection(struct hidp_connadd_req *req, struct socket *ctrl_sock, struct socket *intr_sock)
807
int hidp_add_connection(struct hidp_connadd_req *req, struct socket *ctrl_sock, struct socket *intr_sock)
Lines 835-847 int hidp_add_connection(struct hidp_connadd_req *req, struct socket *ctrl_sock, Link Here
835
	if (req->rd_size > 0) {
851
	if (req->rd_size > 0) {
836
		err = hidp_setup_hid(session, req);
852
		err = hidp_setup_hid(session, req);
837
		if (err && err != -ENODEV)
853
		if (err && err != -ENODEV)
838
			goto err_skb;
854
			goto purge;
839
	}
855
	}
840
856
841
	if (!session->hid) {
857
	if (!session->hid) {
842
		err = hidp_setup_input(session, req);
858
		err = hidp_setup_input(session, req);
843
		if (err < 0)
859
		if (err < 0)
844
			goto err_skb;
860
			goto purge;
845
	}
861
	}
846
862
847
	__hidp_link_session(session);
863
	__hidp_link_session(session);
Lines 869-881 unlink: Link Here
869
885
870
	__hidp_unlink_session(session);
886
	__hidp_unlink_session(session);
871
887
872
	if (session->input)
888
	if (session->input) {
873
		input_unregister_device(session->input);
889
		input_unregister_device(session->input);
874
	if (session->hid)
890
		session->input = NULL;
891
	}
892
893
	if (session->hid) {
875
		hid_destroy_device(session->hid);
894
		hid_destroy_device(session->hid);
876
err_skb:
895
		session->hid = NULL;
896
	}
897
898
purge:
877
	skb_queue_purge(&session->ctrl_transmit);
899
	skb_queue_purge(&session->ctrl_transmit);
878
	skb_queue_purge(&session->intr_transmit);
900
	skb_queue_purge(&session->intr_transmit);
901
879
failed:
902
failed:
880
	up_write(&hidp_session_sem);
903
	up_write(&hidp_session_sem);
881
904
(-)a/net/bluetooth/hidp/hidp.h (+2 lines)
Lines 126-131 int hidp_get_conninfo(struct hidp_conninfo *ci); Link Here
126
struct hidp_session {
126
struct hidp_session {
127
	struct list_head list;
127
	struct list_head list;
128
128
129
	struct hci_conn *conn;
130
129
	struct socket *ctrl_sock;
131
	struct socket *ctrl_sock;
130
	struct socket *intr_sock;
132
	struct socket *intr_sock;
131
133
(-)a/net/mac80211/rx.c (-2 / +8 lines)
Lines 2155-2165 static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw, Link Here
2155
2155
2156
	skb = rx.skb;
2156
	skb = rx.skb;
2157
2157
2158
	list_for_each_entry_rcu(sdata, &local->interfaces, list) {
2158
	if (rx.sdata && ieee80211_is_data(hdr->frame_control)) {
2159
		rx.flags |= IEEE80211_RX_RA_MATCH;
2160
		prepares = prepare_for_handlers(rx.sdata, &rx, hdr);
2161
		if (prepares)
2162
			prev = rx.sdata;
2163
	} else list_for_each_entry_rcu(sdata, &local->interfaces, list) {
2159
		if (!netif_running(sdata->dev))
2164
		if (!netif_running(sdata->dev))
2160
			continue;
2165
			continue;
2161
2166
2162
		if (sdata->vif.type == NL80211_IFTYPE_MONITOR)
2167
		if (sdata->vif.type == NL80211_IFTYPE_MONITOR ||
2168
		    sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
2163
			continue;
2169
			continue;
2164
2170
2165
		rx.flags |= IEEE80211_RX_RA_MATCH;
2171
		rx.flags |= IEEE80211_RX_RA_MATCH;
(-)a/net/mac80211/sta_info.c (+2 lines)
Lines 360-365 int sta_info_insert(struct sta_info *sta) Link Here
360
					     u.ap);
360
					     u.ap);
361
361
362
		drv_sta_notify(local, &sdata->vif, STA_NOTIFY_ADD, &sta->sta);
362
		drv_sta_notify(local, &sdata->vif, STA_NOTIFY_ADD, &sta->sta);
363
		sdata = sta->sdata;
363
	}
364
	}
364
365
365
#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
366
#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
Lines 494-499 static void __sta_info_unlink(struct sta_info **sta) Link Here
494
495
495
		drv_sta_notify(local, &sdata->vif, STA_NOTIFY_REMOVE,
496
		drv_sta_notify(local, &sdata->vif, STA_NOTIFY_REMOVE,
496
			       &(*sta)->sta);
497
			       &(*sta)->sta);
498
		sdata = (*sta)->sdata;
497
	}
499
	}
498
500
499
	if (ieee80211_vif_is_mesh(&sdata->vif)) {
501
	if (ieee80211_vif_is_mesh(&sdata->vif)) {
(-)a/net/mac80211/tx.c (-1 / +2 lines)
Lines 1736-1742 int ieee80211_subif_start_xmit(struct sk_buff *skb, Link Here
1736
	if (!is_multicast_ether_addr(hdr.addr1)) {
1736
	if (!is_multicast_ether_addr(hdr.addr1)) {
1737
		rcu_read_lock();
1737
		rcu_read_lock();
1738
		sta = sta_info_get(local, hdr.addr1);
1738
		sta = sta_info_get(local, hdr.addr1);
1739
		if (sta)
1739
		/* XXX: in the future, use sdata to look up the sta */
1740
		if (sta && sta->sdata == sdata)
1740
			sta_flags = get_sta_flags(sta);
1741
			sta_flags = get_sta_flags(sta);
1741
		rcu_read_unlock();
1742
		rcu_read_unlock();
1742
	}
1743
	}
(-)a/scripts/Makefile.build (-1 / +2 lines)
Lines 269-275 targets += $(extra-y) $(MAKECMDGOALS) $(always) Link Here
269
# Linker scripts preprocessor (.lds.S -> .lds)
269
# Linker scripts preprocessor (.lds.S -> .lds)
270
# ---------------------------------------------------------------------------
270
# ---------------------------------------------------------------------------
271
quiet_cmd_cpp_lds_S = LDS     $@
271
quiet_cmd_cpp_lds_S = LDS     $@
272
      cmd_cpp_lds_S = $(CPP) $(cpp_flags) -D__ASSEMBLY__ -o $@ $<
272
      cmd_cpp_lds_S = $(CPP) $(cpp_flags) -P -C -U$(ARCH) \
273
	                     -D__ASSEMBLY__ -o $@ $<
273
274
274
$(obj)/%.lds: $(src)/%.lds.S FORCE
275
$(obj)/%.lds: $(src)/%.lds.S FORCE
275
	$(call if_changed_dep,cpp_lds_S)
276
	$(call if_changed_dep,cpp_lds_S)
(-)a/sound/aoa/codecs/tas.c (+9 lines)
Lines 897-902 static int tas_create(struct i2c_adapter *adapter, Link Here
897
	client = i2c_new_device(adapter, &info);
897
	client = i2c_new_device(adapter, &info);
898
	if (!client)
898
	if (!client)
899
		return -ENODEV;
899
		return -ENODEV;
900
	/*
901
	 * We know the driver is already loaded, so the device should be
902
	 * already bound. If not it means binding failed, and then there
903
	 * is no point in keeping the device instantiated.
904
	 */
905
	if (!client->driver) {
906
		i2c_unregister_device(client);
907
		return -ENODEV;
908
	}
900
909
901
	/*
910
	/*
902
	 * Let i2c-core delete that device on driver removal.
911
	 * Let i2c-core delete that device on driver removal.
(-)a/sound/ppc/keywest.c (+12 lines)
Lines 59-64 static int keywest_attach_adapter(struct i2c_adapter *adapter) Link Here
59
	strlcpy(info.type, "keywest", I2C_NAME_SIZE);
59
	strlcpy(info.type, "keywest", I2C_NAME_SIZE);
60
	info.addr = keywest_ctx->addr;
60
	info.addr = keywest_ctx->addr;
61
	keywest_ctx->client = i2c_new_device(adapter, &info);
61
	keywest_ctx->client = i2c_new_device(adapter, &info);
62
	if (!keywest_ctx->client)
63
		return -ENODEV;
64
	/*
65
	 * We know the driver is already loaded, so the device should be
66
	 * already bound. If not it means binding failed, and then there
67
	 * is no point in keeping the device instantiated.
68
	 */
69
	if (!keywest_ctx->client->driver) {
70
		i2c_unregister_device(keywest_ctx->client);
71
		keywest_ctx->client = NULL;
72
		return -ENODEV;
73
	}
62
	
74
	
63
	/*
75
	/*
64
	 * Let i2c-core delete that device on driver removal.
76
	 * Let i2c-core delete that device on driver removal.

Return to bug 297292