diff options
155 files changed, 1662 insertions, 1065 deletions
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt index b959659c5df4..b3f35e5f9c95 100644 --- a/Documentation/feature-removal-schedule.txt +++ b/Documentation/feature-removal-schedule.txt | |||
@@ -603,3 +603,19 @@ Why: The adm9240, w83792d and w83793 hardware monitoring drivers have | |||
603 | Who: Jean Delvare <khali@linux-fr.org> | 603 | Who: Jean Delvare <khali@linux-fr.org> |
604 | 604 | ||
605 | ---------------------------- | 605 | ---------------------------- |
606 | |||
607 | What: noswapaccount kernel command line parameter | ||
608 | When: 2.6.40 | ||
609 | Why: The original implementation of memsw feature enabled by | ||
610 | CONFIG_CGROUP_MEM_RES_CTLR_SWAP could be disabled by the noswapaccount | ||
611 | kernel parameter (introduced in 2.6.29-rc1). Later on, this decision | ||
612 | turned out to be not ideal because we cannot have the feature compiled | ||
613 | in and disabled by default and let only interested to enable it | ||
614 | (e.g. general distribution kernels might need it). Therefore we have | ||
615 | added swapaccount[=0|1] parameter (introduced in 2.6.37) which provides | ||
616 | the both possibilities. If we remove noswapaccount we will have | ||
617 | less command line parameters with the same functionality and we | ||
618 | can also cleanup the parameter handling a bit (). | ||
619 | Who: Michal Hocko <mhocko@suse.cz> | ||
620 | |||
621 | ---------------------------- | ||
diff --git a/MAINTAINERS b/MAINTAINERS index 9d12977b6baf..9511bff301c9 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -978,6 +978,8 @@ S: Maintained | |||
978 | F: arch/arm/plat-samsung/ | 978 | F: arch/arm/plat-samsung/ |
979 | F: arch/arm/plat-s3c24xx/ | 979 | F: arch/arm/plat-s3c24xx/ |
980 | F: arch/arm/plat-s5p/ | 980 | F: arch/arm/plat-s5p/ |
981 | F: drivers/*/*s3c2410* | ||
982 | F: drivers/*/*/*s3c2410* | ||
981 | 983 | ||
982 | ARM/S3C2410 ARM ARCHITECTURE | 984 | ARM/S3C2410 ARM ARCHITECTURE |
983 | M: Ben Dooks <ben-linux@fluff.org> | 985 | M: Ben Dooks <ben-linux@fluff.org> |
@@ -3139,6 +3141,12 @@ S: Maintained | |||
3139 | F: net/ieee802154/ | 3141 | F: net/ieee802154/ |
3140 | F: drivers/ieee802154/ | 3142 | F: drivers/ieee802154/ |
3141 | 3143 | ||
3144 | IKANOS/ADI EAGLE ADSL USB DRIVER | ||
3145 | M: Matthieu Castet <castet.matthieu@free.fr> | ||
3146 | M: Stanislaw Gruszka <stf_xl@wp.pl> | ||
3147 | S: Maintained | ||
3148 | F: drivers/usb/atm/ueagle-atm.c | ||
3149 | |||
3142 | INTEGRITY MEASUREMENT ARCHITECTURE (IMA) | 3150 | INTEGRITY MEASUREMENT ARCHITECTURE (IMA) |
3143 | M: Mimi Zohar <zohar@us.ibm.com> | 3151 | M: Mimi Zohar <zohar@us.ibm.com> |
3144 | S: Supported | 3152 | S: Supported |
@@ -5608,18 +5616,20 @@ F: include/linux/sfi*.h | |||
5608 | 5616 | ||
5609 | SIMTEC EB110ATX (Chalice CATS) | 5617 | SIMTEC EB110ATX (Chalice CATS) |
5610 | P: Ben Dooks | 5618 | P: Ben Dooks |
5611 | M: Vincent Sanders <support@simtec.co.uk> | 5619 | P: Vincent Sanders <vince@simtec.co.uk> |
5620 | M: Simtec Linux Team <linux@simtec.co.uk> | ||
5612 | W: http://www.simtec.co.uk/products/EB110ATX/ | 5621 | W: http://www.simtec.co.uk/products/EB110ATX/ |
5613 | S: Supported | 5622 | S: Supported |
5614 | 5623 | ||
5615 | SIMTEC EB2410ITX (BAST) | 5624 | SIMTEC EB2410ITX (BAST) |
5616 | P: Ben Dooks | 5625 | P: Ben Dooks |
5617 | M: Vincent Sanders <support@simtec.co.uk> | 5626 | P: Vincent Sanders <vince@simtec.co.uk> |
5627 | M: Simtec Linux Team <linux@simtec.co.uk> | ||
5618 | W: http://www.simtec.co.uk/products/EB2410ITX/ | 5628 | W: http://www.simtec.co.uk/products/EB2410ITX/ |
5619 | S: Supported | 5629 | S: Supported |
5620 | F: arch/arm/mach-s3c2410/ | 5630 | F: arch/arm/mach-s3c2410/mach-bast.c |
5621 | F: drivers/*/*s3c2410* | 5631 | F: arch/arm/mach-s3c2410/bast-ide.c |
5622 | F: drivers/*/*/*s3c2410* | 5632 | F: arch/arm/mach-s3c2410/bast-irq.c |
5623 | 5633 | ||
5624 | TI DAVINCI MACHINE SUPPORT | 5634 | TI DAVINCI MACHINE SUPPORT |
5625 | M: Kevin Hilman <khilman@deeprootsystems.com> | 5635 | M: Kevin Hilman <khilman@deeprootsystems.com> |
@@ -6594,6 +6604,16 @@ S: Maintained | |||
6594 | F: drivers/char/virtio_console.c | 6604 | F: drivers/char/virtio_console.c |
6595 | F: include/linux/virtio_console.h | 6605 | F: include/linux/virtio_console.h |
6596 | 6606 | ||
6607 | VIRTIO CORE, NET AND BLOCK DRIVERS | ||
6608 | M: Rusty Russell <rusty@rustcorp.com.au> | ||
6609 | M: "Michael S. Tsirkin" <mst@redhat.com> | ||
6610 | L: virtualization@lists.linux-foundation.org | ||
6611 | S: Maintained | ||
6612 | F: drivers/virtio/ | ||
6613 | F: drivers/net/virtio_net.c | ||
6614 | F: drivers/block/virtio_blk.c | ||
6615 | F: include/linux/virtio_*.h | ||
6616 | |||
6597 | VIRTIO HOST (VHOST) | 6617 | VIRTIO HOST (VHOST) |
6598 | M: "Michael S. Tsirkin" <mst@redhat.com> | 6618 | M: "Michael S. Tsirkin" <mst@redhat.com> |
6599 | L: kvm@vger.kernel.org | 6619 | L: kvm@vger.kernel.org |
@@ -1,7 +1,7 @@ | |||
1 | VERSION = 2 | 1 | VERSION = 2 |
2 | PATCHLEVEL = 6 | 2 | PATCHLEVEL = 6 |
3 | SUBLEVEL = 38 | 3 | SUBLEVEL = 38 |
4 | EXTRAVERSION = -rc2 | 4 | EXTRAVERSION = -rc3 |
5 | NAME = Flesh-Eating Bats with Fangs | 5 | NAME = Flesh-Eating Bats with Fangs |
6 | 6 | ||
7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h index 20e0f7c9e03e..d66605dea55a 100644 --- a/arch/arm/include/asm/io.h +++ b/arch/arm/include/asm/io.h | |||
@@ -95,6 +95,15 @@ static inline void __iomem *__typesafe_io(unsigned long addr) | |||
95 | return (void __iomem *)addr; | 95 | return (void __iomem *)addr; |
96 | } | 96 | } |
97 | 97 | ||
98 | /* IO barriers */ | ||
99 | #ifdef CONFIG_ARM_DMA_MEM_BUFFERABLE | ||
100 | #define __iormb() rmb() | ||
101 | #define __iowmb() wmb() | ||
102 | #else | ||
103 | #define __iormb() do { } while (0) | ||
104 | #define __iowmb() do { } while (0) | ||
105 | #endif | ||
106 | |||
98 | /* | 107 | /* |
99 | * Now, pick up the machine-defined IO definitions | 108 | * Now, pick up the machine-defined IO definitions |
100 | */ | 109 | */ |
@@ -125,17 +134,17 @@ static inline void __iomem *__typesafe_io(unsigned long addr) | |||
125 | * The {in,out}[bwl] macros are for emulating x86-style PCI/ISA IO space. | 134 | * The {in,out}[bwl] macros are for emulating x86-style PCI/ISA IO space. |
126 | */ | 135 | */ |
127 | #ifdef __io | 136 | #ifdef __io |
128 | #define outb(v,p) __raw_writeb(v,__io(p)) | 137 | #define outb(v,p) ({ __iowmb(); __raw_writeb(v,__io(p)); }) |
129 | #define outw(v,p) __raw_writew((__force __u16) \ | 138 | #define outw(v,p) ({ __iowmb(); __raw_writew((__force __u16) \ |
130 | cpu_to_le16(v),__io(p)) | 139 | cpu_to_le16(v),__io(p)); }) |
131 | #define outl(v,p) __raw_writel((__force __u32) \ | 140 | #define outl(v,p) ({ __iowmb(); __raw_writel((__force __u32) \ |
132 | cpu_to_le32(v),__io(p)) | 141 | cpu_to_le32(v),__io(p)); }) |
133 | 142 | ||
134 | #define inb(p) ({ __u8 __v = __raw_readb(__io(p)); __v; }) | 143 | #define inb(p) ({ __u8 __v = __raw_readb(__io(p)); __iormb(); __v; }) |
135 | #define inw(p) ({ __u16 __v = le16_to_cpu((__force __le16) \ | 144 | #define inw(p) ({ __u16 __v = le16_to_cpu((__force __le16) \ |
136 | __raw_readw(__io(p))); __v; }) | 145 | __raw_readw(__io(p))); __iormb(); __v; }) |
137 | #define inl(p) ({ __u32 __v = le32_to_cpu((__force __le32) \ | 146 | #define inl(p) ({ __u32 __v = le32_to_cpu((__force __le32) \ |
138 | __raw_readl(__io(p))); __v; }) | 147 | __raw_readl(__io(p))); __iormb(); __v; }) |
139 | 148 | ||
140 | #define outsb(p,d,l) __raw_writesb(__io(p),d,l) | 149 | #define outsb(p,d,l) __raw_writesb(__io(p),d,l) |
141 | #define outsw(p,d,l) __raw_writesw(__io(p),d,l) | 150 | #define outsw(p,d,l) __raw_writesw(__io(p),d,l) |
@@ -192,14 +201,6 @@ extern void _memset_io(volatile void __iomem *, int, size_t); | |||
192 | #define writel_relaxed(v,c) ((void)__raw_writel((__force u32) \ | 201 | #define writel_relaxed(v,c) ((void)__raw_writel((__force u32) \ |
193 | cpu_to_le32(v),__mem_pci(c))) | 202 | cpu_to_le32(v),__mem_pci(c))) |
194 | 203 | ||
195 | #ifdef CONFIG_ARM_DMA_MEM_BUFFERABLE | ||
196 | #define __iormb() rmb() | ||
197 | #define __iowmb() wmb() | ||
198 | #else | ||
199 | #define __iormb() do { } while (0) | ||
200 | #define __iowmb() do { } while (0) | ||
201 | #endif | ||
202 | |||
203 | #define readb(c) ({ u8 __v = readb_relaxed(c); __iormb(); __v; }) | 204 | #define readb(c) ({ u8 __v = readb_relaxed(c); __iormb(); __v; }) |
204 | #define readw(c) ({ u16 __v = readw_relaxed(c); __iormb(); __v; }) | 205 | #define readw(c) ({ u16 __v = readw_relaxed(c); __iormb(); __v; }) |
205 | #define readl(c) ({ u32 __v = readl_relaxed(c); __iormb(); __v; }) | 206 | #define readl(c) ({ u32 __v = readl_relaxed(c); __iormb(); __v; }) |
diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S index f17d9a09e8fb..c0225da3fb21 100644 --- a/arch/arm/kernel/head.S +++ b/arch/arm/kernel/head.S | |||
@@ -392,24 +392,22 @@ ENDPROC(__turn_mmu_on) | |||
392 | 392 | ||
393 | #ifdef CONFIG_SMP_ON_UP | 393 | #ifdef CONFIG_SMP_ON_UP |
394 | __fixup_smp: | 394 | __fixup_smp: |
395 | mov r4, #0x00070000 | 395 | and r3, r9, #0x000f0000 @ architecture version |
396 | orr r3, r4, #0xff000000 @ mask 0xff070000 | 396 | teq r3, #0x000f0000 @ CPU ID supported? |
397 | orr r4, r4, #0x41000000 @ val 0x41070000 | ||
398 | and r0, r9, r3 | ||
399 | teq r0, r4 @ ARM CPU and ARMv6/v7? | ||
400 | bne __fixup_smp_on_up @ no, assume UP | 397 | bne __fixup_smp_on_up @ no, assume UP |
401 | 398 | ||
402 | orr r3, r3, #0x0000ff00 | 399 | bic r3, r9, #0x00ff0000 |
403 | orr r3, r3, #0x000000f0 @ mask 0xff07fff0 | 400 | bic r3, r3, #0x0000000f @ mask 0xff00fff0 |
401 | mov r4, #0x41000000 | ||
404 | orr r4, r4, #0x0000b000 | 402 | orr r4, r4, #0x0000b000 |
405 | orr r4, r4, #0x00000020 @ val 0x4107b020 | 403 | orr r4, r4, #0x00000020 @ val 0x4100b020 |
406 | and r0, r9, r3 | 404 | teq r3, r4 @ ARM 11MPCore? |
407 | teq r0, r4 @ ARM 11MPCore? | ||
408 | moveq pc, lr @ yes, assume SMP | 405 | moveq pc, lr @ yes, assume SMP |
409 | 406 | ||
410 | mrc p15, 0, r0, c0, c0, 5 @ read MPIDR | 407 | mrc p15, 0, r0, c0, c0, 5 @ read MPIDR |
411 | tst r0, #1 << 31 | 408 | and r0, r0, #0xc0000000 @ multiprocessing extensions and |
412 | movne pc, lr @ bit 31 => SMP | 409 | teq r0, #0x80000000 @ not part of a uniprocessor system? |
410 | moveq pc, lr @ yes, assume SMP | ||
413 | 411 | ||
414 | __fixup_smp_on_up: | 412 | __fixup_smp_on_up: |
415 | adr r0, 1f | 413 | adr r0, 1f |
diff --git a/arch/arm/mach-footbridge/include/mach/debug-macro.S b/arch/arm/mach-footbridge/include/mach/debug-macro.S index 3c9e0c40c679..30b971d65815 100644 --- a/arch/arm/mach-footbridge/include/mach/debug-macro.S +++ b/arch/arm/mach-footbridge/include/mach/debug-macro.S | |||
@@ -17,8 +17,8 @@ | |||
17 | /* For NetWinder debugging */ | 17 | /* For NetWinder debugging */ |
18 | .macro addruart, rp, rv | 18 | .macro addruart, rp, rv |
19 | mov \rp, #0x000003f8 | 19 | mov \rp, #0x000003f8 |
20 | orr \rv, \rp, #0x7c000000 @ physical | 20 | orr \rv, \rp, #0xff000000 @ virtual |
21 | orr \rp, \rp, #0xff000000 @ virtual | 21 | orr \rp, \rp, #0x7c000000 @ physical |
22 | .endm | 22 | .endm |
23 | 23 | ||
24 | #define UART_SHIFT 0 | 24 | #define UART_SHIFT 0 |
diff --git a/arch/arm/mach-omap1/include/mach/entry-macro.S b/arch/arm/mach-omap1/include/mach/entry-macro.S index c9be6d4d83e2..bfb4fb1d7382 100644 --- a/arch/arm/mach-omap1/include/mach/entry-macro.S +++ b/arch/arm/mach-omap1/include/mach/entry-macro.S | |||
@@ -14,19 +14,6 @@ | |||
14 | #include <mach/irqs.h> | 14 | #include <mach/irqs.h> |
15 | #include <asm/hardware/gic.h> | 15 | #include <asm/hardware/gic.h> |
16 | 16 | ||
17 | /* | ||
18 | * We use __glue to avoid errors with multiple definitions of | ||
19 | * .globl omap_irq_flags as it's included from entry-armv.S but not | ||
20 | * from entry-common.S. | ||
21 | */ | ||
22 | #ifdef __glue | ||
23 | .pushsection .data | ||
24 | .globl omap_irq_flags | ||
25 | omap_irq_flags: | ||
26 | .word 0 | ||
27 | .popsection | ||
28 | #endif | ||
29 | |||
30 | .macro disable_fiq | 17 | .macro disable_fiq |
31 | .endm | 18 | .endm |
32 | 19 | ||
diff --git a/arch/arm/mach-omap1/irq.c b/arch/arm/mach-omap1/irq.c index 47701584df35..731dd33bff51 100644 --- a/arch/arm/mach-omap1/irq.c +++ b/arch/arm/mach-omap1/irq.c | |||
@@ -57,6 +57,7 @@ struct omap_irq_bank { | |||
57 | unsigned long wake_enable; | 57 | unsigned long wake_enable; |
58 | }; | 58 | }; |
59 | 59 | ||
60 | u32 omap_irq_flags; | ||
60 | static unsigned int irq_bank_count; | 61 | static unsigned int irq_bank_count; |
61 | static struct omap_irq_bank *irq_banks; | 62 | static struct omap_irq_bank *irq_banks; |
62 | 63 | ||
@@ -176,7 +177,6 @@ static struct irq_chip omap_irq_chip = { | |||
176 | 177 | ||
177 | void __init omap_init_irq(void) | 178 | void __init omap_init_irq(void) |
178 | { | 179 | { |
179 | extern unsigned int omap_irq_flags; | ||
180 | int i, j; | 180 | int i, j; |
181 | 181 | ||
182 | #if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850) | 182 | #if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850) |
diff --git a/arch/arm/mach-omap2/dma.c b/arch/arm/mach-omap2/dma.c index d2f15f5cfd36..34922b2d2e3f 100644 --- a/arch/arm/mach-omap2/dma.c +++ b/arch/arm/mach-omap2/dma.c | |||
@@ -264,7 +264,7 @@ static int __init omap2_system_dma_init_dev(struct omap_hwmod *oh, void *unused) | |||
264 | if (IS_ERR(od)) { | 264 | if (IS_ERR(od)) { |
265 | pr_err("%s: Cant build omap_device for %s:%s.\n", | 265 | pr_err("%s: Cant build omap_device for %s:%s.\n", |
266 | __func__, name, oh->name); | 266 | __func__, name, oh->name); |
267 | return IS_ERR(od); | 267 | return PTR_ERR(od); |
268 | } | 268 | } |
269 | 269 | ||
270 | mem = platform_get_resource(&od->pdev, IORESOURCE_MEM, 0); | 270 | mem = platform_get_resource(&od->pdev, IORESOURCE_MEM, 0); |
diff --git a/arch/arm/mach-omap2/include/mach/entry-macro.S b/arch/arm/mach-omap2/include/mach/entry-macro.S index befa321c4c13..81985a665cb3 100644 --- a/arch/arm/mach-omap2/include/mach/entry-macro.S +++ b/arch/arm/mach-omap2/include/mach/entry-macro.S | |||
@@ -38,20 +38,6 @@ | |||
38 | */ | 38 | */ |
39 | 39 | ||
40 | #ifdef MULTI_OMAP2 | 40 | #ifdef MULTI_OMAP2 |
41 | |||
42 | /* | ||
43 | * We use __glue to avoid errors with multiple definitions of | ||
44 | * .globl omap_irq_base as it's included from entry-armv.S but not | ||
45 | * from entry-common.S. | ||
46 | */ | ||
47 | #ifdef __glue | ||
48 | .pushsection .data | ||
49 | .globl omap_irq_base | ||
50 | omap_irq_base: | ||
51 | .word 0 | ||
52 | .popsection | ||
53 | #endif | ||
54 | |||
55 | /* | 41 | /* |
56 | * Configure the interrupt base on the first interrupt. | 42 | * Configure the interrupt base on the first interrupt. |
57 | * See also omap_irq_base_init for setting omap_irq_base. | 43 | * See also omap_irq_base_init for setting omap_irq_base. |
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c index e66687b0b9de..c2032041d26f 100644 --- a/arch/arm/mach-omap2/io.c +++ b/arch/arm/mach-omap2/io.c | |||
@@ -314,14 +314,13 @@ static int _set_hwmod_postsetup_state(struct omap_hwmod *oh, void *data) | |||
314 | return omap_hwmod_set_postsetup_state(oh, *(u8 *)data); | 314 | return omap_hwmod_set_postsetup_state(oh, *(u8 *)data); |
315 | } | 315 | } |
316 | 316 | ||
317 | void __iomem *omap_irq_base; | ||
318 | |||
317 | /* | 319 | /* |
318 | * Initialize asm_irq_base for entry-macro.S | 320 | * Initialize asm_irq_base for entry-macro.S |
319 | */ | 321 | */ |
320 | static inline void omap_irq_base_init(void) | 322 | static inline void omap_irq_base_init(void) |
321 | { | 323 | { |
322 | extern void __iomem *omap_irq_base; | ||
323 | |||
324 | #ifdef MULTI_OMAP2 | ||
325 | if (cpu_is_omap24xx()) | 324 | if (cpu_is_omap24xx()) |
326 | omap_irq_base = OMAP2_L4_IO_ADDRESS(OMAP24XX_IC_BASE); | 325 | omap_irq_base = OMAP2_L4_IO_ADDRESS(OMAP24XX_IC_BASE); |
327 | else if (cpu_is_omap34xx()) | 326 | else if (cpu_is_omap34xx()) |
@@ -330,7 +329,6 @@ static inline void omap_irq_base_init(void) | |||
330 | omap_irq_base = OMAP2_L4_IO_ADDRESS(OMAP44XX_GIC_CPU_BASE); | 329 | omap_irq_base = OMAP2_L4_IO_ADDRESS(OMAP44XX_GIC_CPU_BASE); |
331 | else | 330 | else |
332 | pr_err("Could not initialize omap_irq_base\n"); | 331 | pr_err("Could not initialize omap_irq_base\n"); |
333 | #endif | ||
334 | } | 332 | } |
335 | 333 | ||
336 | void __init omap2_init_common_infrastructure(void) | 334 | void __init omap2_init_common_infrastructure(void) |
diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c index df8d2f2872c6..fae49d12bc76 100644 --- a/arch/arm/mach-omap2/mux.c +++ b/arch/arm/mach-omap2/mux.c | |||
@@ -160,7 +160,7 @@ static int __init _omap_mux_get_by_name(struct omap_mux_partition *partition, | |||
160 | struct omap_mux *mux = NULL; | 160 | struct omap_mux *mux = NULL; |
161 | struct omap_mux_entry *e; | 161 | struct omap_mux_entry *e; |
162 | const char *mode_name; | 162 | const char *mode_name; |
163 | int found = 0, found_mode, mode0_len = 0; | 163 | int found = 0, found_mode = 0, mode0_len = 0; |
164 | struct list_head *muxmodes = &partition->muxmodes; | 164 | struct list_head *muxmodes = &partition->muxmodes; |
165 | 165 | ||
166 | mode_name = strchr(muxname, '.'); | 166 | mode_name = strchr(muxname, '.'); |
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c index 5164069ced42..cddd684364da 100644 --- a/arch/arm/mm/init.c +++ b/arch/arm/mm/init.c | |||
@@ -297,6 +297,12 @@ void __init arm_memblock_init(struct meminfo *mi, struct machine_desc *mdesc) | |||
297 | memblock_reserve(__pa(_stext), _end - _stext); | 297 | memblock_reserve(__pa(_stext), _end - _stext); |
298 | #endif | 298 | #endif |
299 | #ifdef CONFIG_BLK_DEV_INITRD | 299 | #ifdef CONFIG_BLK_DEV_INITRD |
300 | if (phys_initrd_size && | ||
301 | memblock_is_region_reserved(phys_initrd_start, phys_initrd_size)) { | ||
302 | pr_err("INITRD: 0x%08lx+0x%08lx overlaps in-use memory region - disabling initrd\n", | ||
303 | phys_initrd_start, phys_initrd_size); | ||
304 | phys_initrd_start = phys_initrd_size = 0; | ||
305 | } | ||
300 | if (phys_initrd_size) { | 306 | if (phys_initrd_size) { |
301 | memblock_reserve(phys_initrd_start, phys_initrd_size); | 307 | memblock_reserve(phys_initrd_start, phys_initrd_size); |
302 | 308 | ||
diff --git a/arch/microblaze/kernel/head.S b/arch/microblaze/kernel/head.S index 42434008209e..0db20b5abb54 100644 --- a/arch/microblaze/kernel/head.S +++ b/arch/microblaze/kernel/head.S | |||
@@ -77,8 +77,18 @@ real_start: | |||
77 | We ensure r7 points to a valid FDT, just in case the bootloader | 77 | We ensure r7 points to a valid FDT, just in case the bootloader |
78 | is broken or non-existent */ | 78 | is broken or non-existent */ |
79 | beqi r7, no_fdt_arg /* NULL pointer? don't copy */ | 79 | beqi r7, no_fdt_arg /* NULL pointer? don't copy */ |
80 | lw r11, r0, r7 /* Does r7 point to a */ | 80 | /* Does r7 point to a valid FDT? Load HEADER magic number */ |
81 | rsubi r11, r11, OF_DT_HEADER /* valid FDT? */ | 81 | /* Run time Big/Little endian platform */ |
82 | /* Save 1 as word and load byte - 0 - BIG, 1 - LITTLE */ | ||
83 | addik r11, r0, 0x1 /* BIG/LITTLE checking value */ | ||
84 | /* __bss_start will be zeroed later - it is just temp location */ | ||
85 | swi r11, r0, TOPHYS(__bss_start) | ||
86 | lbui r11, r0, TOPHYS(__bss_start) | ||
87 | beqid r11, big_endian /* DO NOT break delay stop dependency */ | ||
88 | lw r11, r0, r7 /* Big endian load in delay slot */ | ||
89 | lwr r11, r0, r7 /* Little endian load */ | ||
90 | big_endian: | ||
91 | rsubi r11, r11, OF_DT_HEADER /* Check FDT header */ | ||
82 | beqi r11, _prepare_copy_fdt | 92 | beqi r11, _prepare_copy_fdt |
83 | or r7, r0, r0 /* clear R7 when not valid DTB */ | 93 | or r7, r0, r0 /* clear R7 when not valid DTB */ |
84 | bnei r11, no_fdt_arg /* No - get out of here */ | 94 | bnei r11, no_fdt_arg /* No - get out of here */ |
diff --git a/arch/microblaze/kernel/hw_exception_handler.S b/arch/microblaze/kernel/hw_exception_handler.S index 25f6e07d8de8..782680de3121 100644 --- a/arch/microblaze/kernel/hw_exception_handler.S +++ b/arch/microblaze/kernel/hw_exception_handler.S | |||
@@ -147,10 +147,6 @@ | |||
147 | #if CONFIG_XILINX_MICROBLAZE0_USE_BARREL > 0 | 147 | #if CONFIG_XILINX_MICROBLAZE0_USE_BARREL > 0 |
148 | #define BSRLI(rD, rA, imm) \ | 148 | #define BSRLI(rD, rA, imm) \ |
149 | bsrli rD, rA, imm | 149 | bsrli rD, rA, imm |
150 | #elif CONFIG_XILINX_MICROBLAZE0_USE_DIV > 0 | ||
151 | #define BSRLI(rD, rA, imm) \ | ||
152 | ori rD, r0, (1 << imm); \ | ||
153 | idivu rD, rD, rA | ||
154 | #else | 150 | #else |
155 | #define BSRLI(rD, rA, imm) BSRLI ## imm (rD, rA) | 151 | #define BSRLI(rD, rA, imm) BSRLI ## imm (rD, rA) |
156 | /* Only the used shift constants defined here - add more if needed */ | 152 | /* Only the used shift constants defined here - add more if needed */ |
diff --git a/arch/microblaze/lib/fastcopy.S b/arch/microblaze/lib/fastcopy.S index fdc48bb065d8..62021d7e249e 100644 --- a/arch/microblaze/lib/fastcopy.S +++ b/arch/microblaze/lib/fastcopy.S | |||
@@ -29,6 +29,10 @@ | |||
29 | * between mem locations with size of xfer spec'd in bytes | 29 | * between mem locations with size of xfer spec'd in bytes |
30 | */ | 30 | */ |
31 | 31 | ||
32 | #ifdef __MICROBLAZEEL__ | ||
33 | #error Microblaze LE not support ASM optimized lib func. Disable OPT_LIB_ASM. | ||
34 | #endif | ||
35 | |||
32 | #include <linux/linkage.h> | 36 | #include <linux/linkage.h> |
33 | .text | 37 | .text |
34 | .globl memcpy | 38 | .globl memcpy |
diff --git a/drivers/gpu/stub/Kconfig b/drivers/gpu/stub/Kconfig index 09aea5f1556d..70e60a4bb678 100644 --- a/drivers/gpu/stub/Kconfig +++ b/drivers/gpu/stub/Kconfig | |||
@@ -1,11 +1,13 @@ | |||
1 | config STUB_POULSBO | 1 | config STUB_POULSBO |
2 | tristate "Intel GMA500 Stub Driver" | 2 | tristate "Intel GMA500 Stub Driver" |
3 | depends on PCI | 3 | depends on PCI |
4 | depends on NET # for THERMAL | ||
4 | # Poulsbo stub depends on ACPI_VIDEO when ACPI is enabled | 5 | # Poulsbo stub depends on ACPI_VIDEO when ACPI is enabled |
5 | # but for select to work, need to select ACPI_VIDEO's dependencies, ick | 6 | # but for select to work, need to select ACPI_VIDEO's dependencies, ick |
6 | select BACKLIGHT_CLASS_DEVICE if ACPI | 7 | select BACKLIGHT_CLASS_DEVICE if ACPI |
7 | select INPUT if ACPI | 8 | select INPUT if ACPI |
8 | select ACPI_VIDEO if ACPI | 9 | select ACPI_VIDEO if ACPI |
10 | select THERMAL if ACPI | ||
9 | help | 11 | help |
10 | Choose this option if you have a system that has Intel GMA500 | 12 | Choose this option if you have a system that has Intel GMA500 |
11 | (Poulsbo) integrated graphics. If M is selected, the module will | 13 | (Poulsbo) integrated graphics. If M is selected, the module will |
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index 4b8dcd5b2a01..2d6de3e03e2d 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/ioport.h> | 14 | #include <linux/ioport.h> |
15 | #include <linux/device.h> | 15 | #include <linux/device.h> |
16 | #include <linux/interrupt.h> | 16 | #include <linux/interrupt.h> |
17 | #include <linux/kernel.h> | ||
17 | #include <linux/delay.h> | 18 | #include <linux/delay.h> |
18 | #include <linux/err.h> | 19 | #include <linux/err.h> |
19 | #include <linux/highmem.h> | 20 | #include <linux/highmem.h> |
@@ -283,19 +284,19 @@ mmci_data_irq(struct mmci_host *host, struct mmc_data *data, | |||
283 | u32 remain, success; | 284 | u32 remain, success; |
284 | 285 | ||
285 | /* Calculate how far we are into the transfer */ | 286 | /* Calculate how far we are into the transfer */ |
286 | remain = readl(host->base + MMCIDATACNT) << 2; | 287 | remain = readl(host->base + MMCIDATACNT); |
287 | success = data->blksz * data->blocks - remain; | 288 | success = data->blksz * data->blocks - remain; |
288 | 289 | ||
289 | dev_dbg(mmc_dev(host->mmc), "MCI ERROR IRQ (status %08x)\n", status); | 290 | dev_dbg(mmc_dev(host->mmc), "MCI ERROR IRQ (status %08x)\n", status); |
290 | if (status & MCI_DATACRCFAIL) { | 291 | if (status & MCI_DATACRCFAIL) { |
291 | /* Last block was not successful */ | 292 | /* Last block was not successful */ |
292 | host->data_xfered = ((success / data->blksz) - 1 * data->blksz); | 293 | host->data_xfered = round_down(success - 1, data->blksz); |
293 | data->error = -EILSEQ; | 294 | data->error = -EILSEQ; |
294 | } else if (status & MCI_DATATIMEOUT) { | 295 | } else if (status & MCI_DATATIMEOUT) { |
295 | host->data_xfered = success; | 296 | host->data_xfered = round_down(success, data->blksz); |
296 | data->error = -ETIMEDOUT; | 297 | data->error = -ETIMEDOUT; |
297 | } else if (status & (MCI_TXUNDERRUN|MCI_RXOVERRUN)) { | 298 | } else if (status & (MCI_TXUNDERRUN|MCI_RXOVERRUN)) { |
298 | host->data_xfered = success; | 299 | host->data_xfered = round_down(success, data->blksz); |
299 | data->error = -EIO; | 300 | data->error = -EIO; |
300 | } | 301 | } |
301 | 302 | ||
@@ -319,7 +320,7 @@ mmci_data_irq(struct mmci_host *host, struct mmc_data *data, | |||
319 | if (status & MCI_DATABLOCKEND) | 320 | if (status & MCI_DATABLOCKEND) |
320 | dev_err(mmc_dev(host->mmc), "stray MCI_DATABLOCKEND interrupt\n"); | 321 | dev_err(mmc_dev(host->mmc), "stray MCI_DATABLOCKEND interrupt\n"); |
321 | 322 | ||
322 | if (status & MCI_DATAEND) { | 323 | if (status & MCI_DATAEND || data->error) { |
323 | mmci_stop_data(host); | 324 | mmci_stop_data(host); |
324 | 325 | ||
325 | if (!data->error) | 326 | if (!data->error) |
diff --git a/drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsconfig.c b/drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsconfig.c index 0e298dba9fc8..29b8ab44ea47 100644 --- a/drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsconfig.c +++ b/drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsconfig.c | |||
@@ -360,8 +360,8 @@ int PSSendOps(void *arg) | |||
360 | status = 1; | 360 | status = 1; |
361 | goto complete; | 361 | goto complete; |
362 | } | 362 | } |
363 | len = (firmware->size > MAX_BDADDR_FORMAT_LENGTH)? MAX_BDADDR_FORMAT_LENGTH: firmware->size; | 363 | len = min(firmware->size, MAX_BDADDR_FORMAT_LENGTH - 1); |
364 | memcpy(config_bdaddr, firmware->data,len); | 364 | memcpy(config_bdaddr, firmware->data, len); |
365 | config_bdaddr[len] = '\0'; | 365 | config_bdaddr[len] = '\0'; |
366 | write_bdaddr(hdev,config_bdaddr,BDADDR_TYPE_STRING); | 366 | write_bdaddr(hdev,config_bdaddr,BDADDR_TYPE_STRING); |
367 | A_RELEASE_FIRMWARE(firmware); | 367 | A_RELEASE_FIRMWARE(firmware); |
diff --git a/drivers/staging/brcm80211/sys/wl_mac80211.c b/drivers/staging/brcm80211/sys/wl_mac80211.c index bdd629d72a75..f1235884cc5d 100644 --- a/drivers/staging/brcm80211/sys/wl_mac80211.c +++ b/drivers/staging/brcm80211/sys/wl_mac80211.c | |||
@@ -209,11 +209,8 @@ static void wl_ops_stop(struct ieee80211_hw *hw) | |||
209 | struct wl_info *wl = hw->priv; | 209 | struct wl_info *wl = hw->priv; |
210 | ASSERT(wl); | 210 | ASSERT(wl); |
211 | WL_LOCK(wl); | 211 | WL_LOCK(wl); |
212 | wl_down(wl); | ||
213 | ieee80211_stop_queues(hw); | 212 | ieee80211_stop_queues(hw); |
214 | WL_UNLOCK(wl); | 213 | WL_UNLOCK(wl); |
215 | |||
216 | return; | ||
217 | } | 214 | } |
218 | 215 | ||
219 | static int | 216 | static int |
@@ -246,7 +243,14 @@ wl_ops_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) | |||
246 | static void | 243 | static void |
247 | wl_ops_remove_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) | 244 | wl_ops_remove_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) |
248 | { | 245 | { |
249 | return; | 246 | struct wl_info *wl; |
247 | |||
248 | wl = HW_TO_WL(hw); | ||
249 | |||
250 | /* put driver in down state */ | ||
251 | WL_LOCK(wl); | ||
252 | wl_down(wl); | ||
253 | WL_UNLOCK(wl); | ||
250 | } | 254 | } |
251 | 255 | ||
252 | static int | 256 | static int |
@@ -779,7 +783,7 @@ static struct wl_info *wl_attach(u16 vendor, u16 device, unsigned long regs, | |||
779 | wl_found++; | 783 | wl_found++; |
780 | return wl; | 784 | return wl; |
781 | 785 | ||
782 | fail: | 786 | fail: |
783 | wl_free(wl); | 787 | wl_free(wl); |
784 | fail1: | 788 | fail1: |
785 | return NULL; | 789 | return NULL; |
@@ -1090,7 +1094,6 @@ wl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1090 | return 0; | 1094 | return 0; |
1091 | } | 1095 | } |
1092 | 1096 | ||
1093 | #ifdef LINUXSTA_PS | ||
1094 | static int wl_suspend(struct pci_dev *pdev, pm_message_t state) | 1097 | static int wl_suspend(struct pci_dev *pdev, pm_message_t state) |
1095 | { | 1098 | { |
1096 | struct wl_info *wl; | 1099 | struct wl_info *wl; |
@@ -1105,11 +1108,12 @@ static int wl_suspend(struct pci_dev *pdev, pm_message_t state) | |||
1105 | return -ENODEV; | 1108 | return -ENODEV; |
1106 | } | 1109 | } |
1107 | 1110 | ||
1111 | /* only need to flag hw is down for proper resume */ | ||
1108 | WL_LOCK(wl); | 1112 | WL_LOCK(wl); |
1109 | wl_down(wl); | ||
1110 | wl->pub->hw_up = false; | 1113 | wl->pub->hw_up = false; |
1111 | WL_UNLOCK(wl); | 1114 | WL_UNLOCK(wl); |
1112 | pci_save_state(pdev, wl->pci_psstate); | 1115 | |
1116 | pci_save_state(pdev); | ||
1113 | pci_disable_device(pdev); | 1117 | pci_disable_device(pdev); |
1114 | return pci_set_power_state(pdev, PCI_D3hot); | 1118 | return pci_set_power_state(pdev, PCI_D3hot); |
1115 | } | 1119 | } |
@@ -1133,7 +1137,7 @@ static int wl_resume(struct pci_dev *pdev) | |||
1133 | if (err) | 1137 | if (err) |
1134 | return err; | 1138 | return err; |
1135 | 1139 | ||
1136 | pci_restore_state(pdev, wl->pci_psstate); | 1140 | pci_restore_state(pdev); |
1137 | 1141 | ||
1138 | err = pci_enable_device(pdev); | 1142 | err = pci_enable_device(pdev); |
1139 | if (err) | 1143 | if (err) |
@@ -1145,13 +1149,12 @@ static int wl_resume(struct pci_dev *pdev) | |||
1145 | if ((val & 0x0000ff00) != 0) | 1149 | if ((val & 0x0000ff00) != 0) |
1146 | pci_write_config_dword(pdev, 0x40, val & 0xffff00ff); | 1150 | pci_write_config_dword(pdev, 0x40, val & 0xffff00ff); |
1147 | 1151 | ||
1148 | WL_LOCK(wl); | 1152 | /* |
1149 | err = wl_up(wl); | 1153 | * done. driver will be put in up state |
1150 | WL_UNLOCK(wl); | 1154 | * in wl_ops_add_interface() call. |
1151 | 1155 | */ | |
1152 | return err; | 1156 | return err; |
1153 | } | 1157 | } |
1154 | #endif /* LINUXSTA_PS */ | ||
1155 | 1158 | ||
1156 | static void wl_remove(struct pci_dev *pdev) | 1159 | static void wl_remove(struct pci_dev *pdev) |
1157 | { | 1160 | { |
@@ -1184,14 +1187,12 @@ static void wl_remove(struct pci_dev *pdev) | |||
1184 | } | 1187 | } |
1185 | 1188 | ||
1186 | static struct pci_driver wl_pci_driver = { | 1189 | static struct pci_driver wl_pci_driver = { |
1187 | .name = "brcm80211", | 1190 | .name = "brcm80211", |
1188 | .probe = wl_pci_probe, | 1191 | .probe = wl_pci_probe, |
1189 | #ifdef LINUXSTA_PS | 1192 | .suspend = wl_suspend, |
1190 | .suspend = wl_suspend, | 1193 | .resume = wl_resume, |
1191 | .resume = wl_resume, | 1194 | .remove = __devexit_p(wl_remove), |
1192 | #endif /* LINUXSTA_PS */ | 1195 | .id_table = wl_id_table, |
1193 | .remove = __devexit_p(wl_remove), | ||
1194 | .id_table = wl_id_table, | ||
1195 | }; | 1196 | }; |
1196 | 1197 | ||
1197 | /** | 1198 | /** |
diff --git a/drivers/staging/brcm80211/sys/wlc_mac80211.c b/drivers/staging/brcm80211/sys/wlc_mac80211.c index 1d5d01ac0a9b..a1303863686c 100644 --- a/drivers/staging/brcm80211/sys/wlc_mac80211.c +++ b/drivers/staging/brcm80211/sys/wlc_mac80211.c | |||
@@ -5126,7 +5126,6 @@ wlc_sendpkt_mac80211(struct wlc_info *wlc, struct sk_buff *sdu, | |||
5126 | fifo = prio2fifo[prio]; | 5126 | fifo = prio2fifo[prio]; |
5127 | 5127 | ||
5128 | ASSERT((uint) skb_headroom(sdu) >= TXOFF); | 5128 | ASSERT((uint) skb_headroom(sdu) >= TXOFF); |
5129 | ASSERT(!(sdu->cloned)); | ||
5130 | ASSERT(!(sdu->next)); | 5129 | ASSERT(!(sdu->next)); |
5131 | ASSERT(!(sdu->prev)); | 5130 | ASSERT(!(sdu->prev)); |
5132 | ASSERT(fifo < NFIFO); | 5131 | ASSERT(fifo < NFIFO); |
diff --git a/drivers/staging/comedi/drivers/ni_labpc.c b/drivers/staging/comedi/drivers/ni_labpc.c index 4d1868d04bac..0728c3c0cb0e 100644 --- a/drivers/staging/comedi/drivers/ni_labpc.c +++ b/drivers/staging/comedi/drivers/ni_labpc.c | |||
@@ -575,7 +575,8 @@ int labpc_common_attach(struct comedi_device *dev, unsigned long iobase, | |||
575 | /* grab our IRQ */ | 575 | /* grab our IRQ */ |
576 | if (irq) { | 576 | if (irq) { |
577 | isr_flags = 0; | 577 | isr_flags = 0; |
578 | if (thisboard->bustype == pci_bustype) | 578 | if (thisboard->bustype == pci_bustype |
579 | || thisboard->bustype == pcmcia_bustype) | ||
579 | isr_flags |= IRQF_SHARED; | 580 | isr_flags |= IRQF_SHARED; |
580 | if (request_irq(irq, labpc_interrupt, isr_flags, | 581 | if (request_irq(irq, labpc_interrupt, isr_flags, |
581 | driver_labpc.driver_name, dev)) { | 582 | driver_labpc.driver_name, dev)) { |
diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c index b3d05fcfe6d2..4fb809485d9e 100644 --- a/drivers/staging/hv/blkvsc_drv.c +++ b/drivers/staging/hv/blkvsc_drv.c | |||
@@ -368,6 +368,7 @@ static int blkvsc_probe(struct device *device) | |||
368 | blkdev->gd->first_minor = 0; | 368 | blkdev->gd->first_minor = 0; |
369 | blkdev->gd->fops = &block_ops; | 369 | blkdev->gd->fops = &block_ops; |
370 | blkdev->gd->private_data = blkdev; | 370 | blkdev->gd->private_data = blkdev; |
371 | blkdev->gd->driverfs_dev = &(blkdev->device_ctx->device); | ||
371 | sprintf(blkdev->gd->disk_name, "hd%c", 'a' + devnum); | 372 | sprintf(blkdev->gd->disk_name, "hd%c", 'a' + devnum); |
372 | 373 | ||
373 | blkvsc_do_inquiry(blkdev); | 374 | blkvsc_do_inquiry(blkdev); |
diff --git a/drivers/staging/hv/netvsc.c b/drivers/staging/hv/netvsc.c index df9cd131e953..0edbe7483a4c 100644 --- a/drivers/staging/hv/netvsc.c +++ b/drivers/staging/hv/netvsc.c | |||
@@ -1279,7 +1279,7 @@ static void netvsc_channel_cb(void *context) | |||
1279 | /* ASSERT(device); */ | 1279 | /* ASSERT(device); */ |
1280 | 1280 | ||
1281 | packet = kzalloc(NETVSC_PACKET_SIZE * sizeof(unsigned char), | 1281 | packet = kzalloc(NETVSC_PACKET_SIZE * sizeof(unsigned char), |
1282 | GFP_KERNEL); | 1282 | GFP_ATOMIC); |
1283 | if (!packet) | 1283 | if (!packet) |
1284 | return; | 1284 | return; |
1285 | buffer = packet; | 1285 | buffer = packet; |
diff --git a/drivers/staging/hv/netvsc_drv.c b/drivers/staging/hv/netvsc_drv.c index 0147b407512c..54706a16dc0a 100644 --- a/drivers/staging/hv/netvsc_drv.c +++ b/drivers/staging/hv/netvsc_drv.c | |||
@@ -358,7 +358,6 @@ static int netvsc_probe(struct device *device) | |||
358 | 358 | ||
359 | /* Set initial state */ | 359 | /* Set initial state */ |
360 | netif_carrier_off(net); | 360 | netif_carrier_off(net); |
361 | netif_stop_queue(net); | ||
362 | 361 | ||
363 | net_device_ctx = netdev_priv(net); | 362 | net_device_ctx = netdev_priv(net); |
364 | net_device_ctx->device_ctx = device_ctx; | 363 | net_device_ctx->device_ctx = device_ctx; |
diff --git a/drivers/staging/iio/adc/ad7476_core.c b/drivers/staging/iio/adc/ad7476_core.c index deb68c8a6e18..b8b54da67c63 100644 --- a/drivers/staging/iio/adc/ad7476_core.c +++ b/drivers/staging/iio/adc/ad7476_core.c | |||
@@ -68,7 +68,7 @@ static ssize_t ad7476_show_scale(struct device *dev, | |||
68 | /* Corresponds to Vref / 2^(bits) */ | 68 | /* Corresponds to Vref / 2^(bits) */ |
69 | unsigned int scale_uv = (st->int_vref_mv * 1000) >> st->chip_info->bits; | 69 | unsigned int scale_uv = (st->int_vref_mv * 1000) >> st->chip_info->bits; |
70 | 70 | ||
71 | return sprintf(buf, "%d.%d\n", scale_uv / 1000, scale_uv % 1000); | 71 | return sprintf(buf, "%d.%03d\n", scale_uv / 1000, scale_uv % 1000); |
72 | } | 72 | } |
73 | static IIO_DEVICE_ATTR(in_scale, S_IRUGO, ad7476_show_scale, NULL, 0); | 73 | static IIO_DEVICE_ATTR(in_scale, S_IRUGO, ad7476_show_scale, NULL, 0); |
74 | 74 | ||
diff --git a/drivers/staging/iio/adc/ad7887_core.c b/drivers/staging/iio/adc/ad7887_core.c index 685908995d49..5d85efab658c 100644 --- a/drivers/staging/iio/adc/ad7887_core.c +++ b/drivers/staging/iio/adc/ad7887_core.c | |||
@@ -68,7 +68,7 @@ static ssize_t ad7887_show_scale(struct device *dev, | |||
68 | /* Corresponds to Vref / 2^(bits) */ | 68 | /* Corresponds to Vref / 2^(bits) */ |
69 | unsigned int scale_uv = (st->int_vref_mv * 1000) >> st->chip_info->bits; | 69 | unsigned int scale_uv = (st->int_vref_mv * 1000) >> st->chip_info->bits; |
70 | 70 | ||
71 | return sprintf(buf, "%d.%d\n", scale_uv / 1000, scale_uv % 1000); | 71 | return sprintf(buf, "%d.%03d\n", scale_uv / 1000, scale_uv % 1000); |
72 | } | 72 | } |
73 | static IIO_DEVICE_ATTR(in_scale, S_IRUGO, ad7887_show_scale, NULL, 0); | 73 | static IIO_DEVICE_ATTR(in_scale, S_IRUGO, ad7887_show_scale, NULL, 0); |
74 | 74 | ||
diff --git a/drivers/staging/iio/adc/ad799x_core.c b/drivers/staging/iio/adc/ad799x_core.c index 6309d521a864..89ccf375a188 100644 --- a/drivers/staging/iio/adc/ad799x_core.c +++ b/drivers/staging/iio/adc/ad799x_core.c | |||
@@ -432,7 +432,7 @@ static ssize_t ad799x_show_scale(struct device *dev, | |||
432 | /* Corresponds to Vref / 2^(bits) */ | 432 | /* Corresponds to Vref / 2^(bits) */ |
433 | unsigned int scale_uv = (st->int_vref_mv * 1000) >> st->chip_info->bits; | 433 | unsigned int scale_uv = (st->int_vref_mv * 1000) >> st->chip_info->bits; |
434 | 434 | ||
435 | return sprintf(buf, "%d.%d\n", scale_uv / 1000, scale_uv % 1000); | 435 | return sprintf(buf, "%d.%03d\n", scale_uv / 1000, scale_uv % 1000); |
436 | } | 436 | } |
437 | 437 | ||
438 | static IIO_DEVICE_ATTR(in_scale, S_IRUGO, ad799x_show_scale, NULL, 0); | 438 | static IIO_DEVICE_ATTR(in_scale, S_IRUGO, ad799x_show_scale, NULL, 0); |
diff --git a/drivers/staging/iio/dac/ad5446.c b/drivers/staging/iio/dac/ad5446.c index e3387cd31145..0f87ecac82fc 100644 --- a/drivers/staging/iio/dac/ad5446.c +++ b/drivers/staging/iio/dac/ad5446.c | |||
@@ -87,7 +87,7 @@ static ssize_t ad5446_show_scale(struct device *dev, | |||
87 | /* Corresponds to Vref / 2^(bits) */ | 87 | /* Corresponds to Vref / 2^(bits) */ |
88 | unsigned int scale_uv = (st->vref_mv * 1000) >> st->chip_info->bits; | 88 | unsigned int scale_uv = (st->vref_mv * 1000) >> st->chip_info->bits; |
89 | 89 | ||
90 | return sprintf(buf, "%d.%d\n", scale_uv / 1000, scale_uv % 1000); | 90 | return sprintf(buf, "%d.%03d\n", scale_uv / 1000, scale_uv % 1000); |
91 | } | 91 | } |
92 | static IIO_DEVICE_ATTR(out_scale, S_IRUGO, ad5446_show_scale, NULL, 0); | 92 | static IIO_DEVICE_ATTR(out_scale, S_IRUGO, ad5446_show_scale, NULL, 0); |
93 | 93 | ||
diff --git a/drivers/staging/rt2860/rt_main_dev.c b/drivers/staging/rt2860/rt_main_dev.c index 701561d6b6fd..236dd36d349a 100644 --- a/drivers/staging/rt2860/rt_main_dev.c +++ b/drivers/staging/rt2860/rt_main_dev.c | |||
@@ -484,8 +484,6 @@ struct net_device *RtmpPhyNetDevInit(struct rt_rtmp_adapter *pAd, | |||
484 | net_dev->ml_priv = (void *)pAd; | 484 | net_dev->ml_priv = (void *)pAd; |
485 | pAd->net_dev = net_dev; | 485 | pAd->net_dev = net_dev; |
486 | 486 | ||
487 | netif_stop_queue(net_dev); | ||
488 | |||
489 | return net_dev; | 487 | return net_dev; |
490 | 488 | ||
491 | } | 489 | } |
diff --git a/drivers/staging/rt2860/usb_main_dev.c b/drivers/staging/rt2860/usb_main_dev.c index ee68d51caa4e..322bf49ee906 100644 --- a/drivers/staging/rt2860/usb_main_dev.c +++ b/drivers/staging/rt2860/usb_main_dev.c | |||
@@ -106,6 +106,7 @@ struct usb_device_id rtusb_usb_id[] = { | |||
106 | {USB_DEVICE(0x0411, 0x016f)}, /* MelCo.,Inc. WLI-UC-G301N */ | 106 | {USB_DEVICE(0x0411, 0x016f)}, /* MelCo.,Inc. WLI-UC-G301N */ |
107 | {USB_DEVICE(0x1737, 0x0070)}, /* Linksys WUSB100 */ | 107 | {USB_DEVICE(0x1737, 0x0070)}, /* Linksys WUSB100 */ |
108 | {USB_DEVICE(0x1737, 0x0071)}, /* Linksys WUSB600N */ | 108 | {USB_DEVICE(0x1737, 0x0071)}, /* Linksys WUSB600N */ |
109 | {USB_DEVICE(0x1737, 0x0078)}, /* Linksys WUSB100v2 */ | ||
109 | {USB_DEVICE(0x0411, 0x00e8)}, /* Buffalo WLI-UC-G300N */ | 110 | {USB_DEVICE(0x0411, 0x00e8)}, /* Buffalo WLI-UC-G300N */ |
110 | {USB_DEVICE(0x050d, 0x815c)}, /* Belkin F5D8053 */ | 111 | {USB_DEVICE(0x050d, 0x815c)}, /* Belkin F5D8053 */ |
111 | {USB_DEVICE(0x100D, 0x9031)}, /* Motorola 2770 */ | 112 | {USB_DEVICE(0x100D, 0x9031)}, /* Motorola 2770 */ |
diff --git a/drivers/staging/rtl8712/hal_init.c b/drivers/staging/rtl8712/hal_init.c index 32088a641eba..84be383abec3 100644 --- a/drivers/staging/rtl8712/hal_init.c +++ b/drivers/staging/rtl8712/hal_init.c | |||
@@ -128,12 +128,13 @@ static u8 rtl8712_dl_fw(struct _adapter *padapter) | |||
128 | u8 *ptmpchar = NULL, *ppayload, *ptr; | 128 | u8 *ptmpchar = NULL, *ppayload, *ptr; |
129 | struct tx_desc *ptx_desc; | 129 | struct tx_desc *ptx_desc; |
130 | u32 txdscp_sz = sizeof(struct tx_desc); | 130 | u32 txdscp_sz = sizeof(struct tx_desc); |
131 | u8 ret = _FAIL; | ||
131 | 132 | ||
132 | ulfilelength = rtl871x_open_fw(padapter, &phfwfile_hdl, &pmappedfw); | 133 | ulfilelength = rtl871x_open_fw(padapter, &phfwfile_hdl, &pmappedfw); |
133 | if (pmappedfw && (ulfilelength > 0)) { | 134 | if (pmappedfw && (ulfilelength > 0)) { |
134 | update_fwhdr(&fwhdr, pmappedfw); | 135 | update_fwhdr(&fwhdr, pmappedfw); |
135 | if (chk_fwhdr(&fwhdr, ulfilelength) == _FAIL) | 136 | if (chk_fwhdr(&fwhdr, ulfilelength) == _FAIL) |
136 | goto exit_fail; | 137 | goto firmware_rel; |
137 | fill_fwpriv(padapter, &fwhdr.fwpriv); | 138 | fill_fwpriv(padapter, &fwhdr.fwpriv); |
138 | /* firmware check ok */ | 139 | /* firmware check ok */ |
139 | maxlen = (fwhdr.img_IMEM_size > fwhdr.img_SRAM_size) ? | 140 | maxlen = (fwhdr.img_IMEM_size > fwhdr.img_SRAM_size) ? |
@@ -141,7 +142,7 @@ static u8 rtl8712_dl_fw(struct _adapter *padapter) | |||
141 | maxlen += txdscp_sz; | 142 | maxlen += txdscp_sz; |
142 | ptmpchar = _malloc(maxlen + FWBUFF_ALIGN_SZ); | 143 | ptmpchar = _malloc(maxlen + FWBUFF_ALIGN_SZ); |
143 | if (ptmpchar == NULL) | 144 | if (ptmpchar == NULL) |
144 | return _FAIL; | 145 | goto firmware_rel; |
145 | 146 | ||
146 | ptx_desc = (struct tx_desc *)(ptmpchar + FWBUFF_ALIGN_SZ - | 147 | ptx_desc = (struct tx_desc *)(ptmpchar + FWBUFF_ALIGN_SZ - |
147 | ((addr_t)(ptmpchar) & (FWBUFF_ALIGN_SZ - 1))); | 148 | ((addr_t)(ptmpchar) & (FWBUFF_ALIGN_SZ - 1))); |
@@ -273,11 +274,13 @@ static u8 rtl8712_dl_fw(struct _adapter *padapter) | |||
273 | goto exit_fail; | 274 | goto exit_fail; |
274 | } else | 275 | } else |
275 | goto exit_fail; | 276 | goto exit_fail; |
276 | return _SUCCESS; | 277 | ret = _SUCCESS; |
277 | 278 | ||
278 | exit_fail: | 279 | exit_fail: |
279 | kfree(ptmpchar); | 280 | kfree(ptmpchar); |
280 | return _FAIL; | 281 | firmware_rel: |
282 | release_firmware((struct firmware *)phfwfile_hdl); | ||
283 | return ret; | ||
281 | } | 284 | } |
282 | 285 | ||
283 | uint rtl8712_hal_init(struct _adapter *padapter) | 286 | uint rtl8712_hal_init(struct _adapter *padapter) |
diff --git a/drivers/staging/rtl8712/usb_intf.c b/drivers/staging/rtl8712/usb_intf.c index a692ee88b9e9..21ce2af447b5 100644 --- a/drivers/staging/rtl8712/usb_intf.c +++ b/drivers/staging/rtl8712/usb_intf.c | |||
@@ -47,54 +47,123 @@ static int r871xu_drv_init(struct usb_interface *pusb_intf, | |||
47 | static void r871xu_dev_remove(struct usb_interface *pusb_intf); | 47 | static void r871xu_dev_remove(struct usb_interface *pusb_intf); |
48 | 48 | ||
49 | static struct usb_device_id rtl871x_usb_id_tbl[] = { | 49 | static struct usb_device_id rtl871x_usb_id_tbl[] = { |
50 | /*92SU | 50 | |
51 | * Realtek */ | 51 | /* RTL8188SU */ |
52 | {USB_DEVICE(0x0bda, 0x8171)}, | 52 | /* Realtek */ |
53 | {USB_DEVICE(0x0bda, 0x8172)}, | 53 | {USB_DEVICE(0x0BDA, 0x8171)}, |
54 | {USB_DEVICE(0x0bda, 0x8173)}, | 54 | {USB_DEVICE(0x0bda, 0x8173)}, |
55 | {USB_DEVICE(0x0bda, 0x8174)}, | ||
56 | {USB_DEVICE(0x0bda, 0x8712)}, | 55 | {USB_DEVICE(0x0bda, 0x8712)}, |
57 | {USB_DEVICE(0x0bda, 0x8713)}, | 56 | {USB_DEVICE(0x0bda, 0x8713)}, |
58 | {USB_DEVICE(0x0bda, 0xC512)}, | 57 | {USB_DEVICE(0x0bda, 0xC512)}, |
59 | /* Abocom */ | 58 | /* Abocom */ |
60 | {USB_DEVICE(0x07B8, 0x8188)}, | 59 | {USB_DEVICE(0x07B8, 0x8188)}, |
60 | /* ASUS */ | ||
61 | {USB_DEVICE(0x0B05, 0x1786)}, | ||
62 | {USB_DEVICE(0x0B05, 0x1791)}, /* 11n mode disable */ | ||
63 | /* Belkin */ | ||
64 | {USB_DEVICE(0x050D, 0x945A)}, | ||
61 | /* Corega */ | 65 | /* Corega */ |
62 | {USB_DEVICE(0x07aa, 0x0047)}, | 66 | {USB_DEVICE(0x07AA, 0x0047)}, |
63 | /* Dlink */ | 67 | /* D-Link */ |
64 | {USB_DEVICE(0x07d1, 0x3303)}, | 68 | {USB_DEVICE(0x2001, 0x3306)}, |
65 | {USB_DEVICE(0x07d1, 0x3302)}, | 69 | {USB_DEVICE(0x07D1, 0x3306)}, /* 11n mode disable */ |
66 | {USB_DEVICE(0x07d1, 0x3300)}, | 70 | /* Edimax */ |
67 | /* Dlink for Skyworth */ | 71 | {USB_DEVICE(0x7392, 0x7611)}, |
68 | {USB_DEVICE(0x14b2, 0x3300)}, | ||
69 | {USB_DEVICE(0x14b2, 0x3301)}, | ||
70 | {USB_DEVICE(0x14b2, 0x3302)}, | ||
71 | /* EnGenius */ | 72 | /* EnGenius */ |
72 | {USB_DEVICE(0x1740, 0x9603)}, | 73 | {USB_DEVICE(0x1740, 0x9603)}, |
73 | {USB_DEVICE(0x1740, 0x9605)}, | 74 | /* Hawking */ |
75 | {USB_DEVICE(0x0E66, 0x0016)}, | ||
76 | /* Hercules */ | ||
77 | {USB_DEVICE(0x06F8, 0xE034)}, | ||
78 | {USB_DEVICE(0x06F8, 0xE032)}, | ||
79 | /* Logitec */ | ||
80 | {USB_DEVICE(0x0789, 0x0167)}, | ||
81 | /* PCI */ | ||
82 | {USB_DEVICE(0x2019, 0xAB28)}, | ||
83 | {USB_DEVICE(0x2019, 0xED16)}, | ||
84 | /* Sitecom */ | ||
85 | {USB_DEVICE(0x0DF6, 0x0057)}, | ||
86 | {USB_DEVICE(0x0DF6, 0x0045)}, | ||
87 | {USB_DEVICE(0x0DF6, 0x0059)}, /* 11n mode disable */ | ||
88 | {USB_DEVICE(0x0DF6, 0x004B)}, | ||
89 | {USB_DEVICE(0x0DF6, 0x0063)}, | ||
90 | /* Sweex */ | ||
91 | {USB_DEVICE(0x177F, 0x0154)}, | ||
92 | /* Thinkware */ | ||
93 | {USB_DEVICE(0x0BDA, 0x5077)}, | ||
94 | /* Toshiba */ | ||
95 | {USB_DEVICE(0x1690, 0x0752)}, | ||
96 | /* - */ | ||
97 | {USB_DEVICE(0x20F4, 0x646B)}, | ||
98 | {USB_DEVICE(0x083A, 0xC512)}, | ||
99 | |||
100 | /* RTL8191SU */ | ||
101 | /* Realtek */ | ||
102 | {USB_DEVICE(0x0BDA, 0x8172)}, | ||
103 | /* Amigo */ | ||
104 | {USB_DEVICE(0x0EB0, 0x9061)}, | ||
105 | /* ASUS/EKB */ | ||
106 | {USB_DEVICE(0x0BDA, 0x8172)}, | ||
107 | {USB_DEVICE(0x13D3, 0x3323)}, | ||
108 | {USB_DEVICE(0x13D3, 0x3311)}, /* 11n mode disable */ | ||
109 | {USB_DEVICE(0x13D3, 0x3342)}, | ||
110 | /* ASUS/EKBLenovo */ | ||
111 | {USB_DEVICE(0x13D3, 0x3333)}, | ||
112 | {USB_DEVICE(0x13D3, 0x3334)}, | ||
113 | {USB_DEVICE(0x13D3, 0x3335)}, /* 11n mode disable */ | ||
114 | {USB_DEVICE(0x13D3, 0x3336)}, /* 11n mode disable */ | ||
115 | /* ASUS/Media BOX */ | ||
116 | {USB_DEVICE(0x13D3, 0x3309)}, | ||
74 | /* Belkin */ | 117 | /* Belkin */ |
75 | {USB_DEVICE(0x050d, 0x815F)}, | 118 | {USB_DEVICE(0x050D, 0x815F)}, |
76 | {USB_DEVICE(0x050d, 0x945A)}, | 119 | /* D-Link */ |
77 | {USB_DEVICE(0x050d, 0x845A)}, | 120 | {USB_DEVICE(0x07D1, 0x3302)}, |
78 | /* Guillemot */ | 121 | {USB_DEVICE(0x07D1, 0x3300)}, |
79 | {USB_DEVICE(0x06f8, 0xe031)}, | 122 | {USB_DEVICE(0x07D1, 0x3303)}, |
80 | /* Edimax */ | 123 | /* Edimax */ |
81 | {USB_DEVICE(0x7392, 0x7611)}, | ||
82 | {USB_DEVICE(0x7392, 0x7612)}, | 124 | {USB_DEVICE(0x7392, 0x7612)}, |
83 | {USB_DEVICE(0x7392, 0x7622)}, | 125 | /* EnGenius */ |
84 | /* Sitecom */ | 126 | {USB_DEVICE(0x1740, 0x9605)}, |
85 | {USB_DEVICE(0x0DF6, 0x0045)}, | 127 | /* Guillemot */ |
128 | {USB_DEVICE(0x06F8, 0xE031)}, | ||
86 | /* Hawking */ | 129 | /* Hawking */ |
87 | {USB_DEVICE(0x0E66, 0x0015)}, | 130 | {USB_DEVICE(0x0E66, 0x0015)}, |
88 | {USB_DEVICE(0x0E66, 0x0016)}, | 131 | /* Mediao */ |
89 | {USB_DEVICE(0x0b05, 0x1786)}, | ||
90 | {USB_DEVICE(0x0b05, 0x1791)}, /* 11n mode disable */ | ||
91 | |||
92 | {USB_DEVICE(0x13D3, 0x3306)}, | 132 | {USB_DEVICE(0x13D3, 0x3306)}, |
93 | {USB_DEVICE(0x13D3, 0x3309)}, | 133 | /* PCI */ |
134 | {USB_DEVICE(0x2019, 0xED18)}, | ||
135 | {USB_DEVICE(0x2019, 0x4901)}, | ||
136 | /* Sitecom */ | ||
137 | {USB_DEVICE(0x0DF6, 0x0058)}, | ||
138 | {USB_DEVICE(0x0DF6, 0x0049)}, | ||
139 | {USB_DEVICE(0x0DF6, 0x004C)}, | ||
140 | {USB_DEVICE(0x0DF6, 0x0064)}, | ||
141 | /* Skyworth */ | ||
142 | {USB_DEVICE(0x14b2, 0x3300)}, | ||
143 | {USB_DEVICE(0x14b2, 0x3301)}, | ||
144 | {USB_DEVICE(0x14B2, 0x3302)}, | ||
145 | /* - */ | ||
146 | {USB_DEVICE(0x04F2, 0xAFF2)}, | ||
147 | {USB_DEVICE(0x04F2, 0xAFF5)}, | ||
148 | {USB_DEVICE(0x04F2, 0xAFF6)}, | ||
149 | {USB_DEVICE(0x13D3, 0x3339)}, | ||
150 | {USB_DEVICE(0x13D3, 0x3340)}, /* 11n mode disable */ | ||
151 | {USB_DEVICE(0x13D3, 0x3341)}, /* 11n mode disable */ | ||
94 | {USB_DEVICE(0x13D3, 0x3310)}, | 152 | {USB_DEVICE(0x13D3, 0x3310)}, |
95 | {USB_DEVICE(0x13D3, 0x3311)}, /* 11n mode disable */ | ||
96 | {USB_DEVICE(0x13D3, 0x3325)}, | 153 | {USB_DEVICE(0x13D3, 0x3325)}, |
97 | {USB_DEVICE(0x083A, 0xC512)}, | 154 | |
155 | /* RTL8192SU */ | ||
156 | /* Realtek */ | ||
157 | {USB_DEVICE(0x0BDA, 0x8174)}, | ||
158 | {USB_DEVICE(0x0BDA, 0x8174)}, | ||
159 | /* Belkin */ | ||
160 | {USB_DEVICE(0x050D, 0x845A)}, | ||
161 | /* Corega */ | ||
162 | {USB_DEVICE(0x07AA, 0x0051)}, | ||
163 | /* Edimax */ | ||
164 | {USB_DEVICE(0x7392, 0x7622)}, | ||
165 | /* NEC */ | ||
166 | {USB_DEVICE(0x0409, 0x02B6)}, | ||
98 | {} | 167 | {} |
99 | }; | 168 | }; |
100 | 169 | ||
@@ -103,8 +172,20 @@ MODULE_DEVICE_TABLE(usb, rtl871x_usb_id_tbl); | |||
103 | static struct specific_device_id specific_device_id_tbl[] = { | 172 | static struct specific_device_id specific_device_id_tbl[] = { |
104 | {.idVendor = 0x0b05, .idProduct = 0x1791, | 173 | {.idVendor = 0x0b05, .idProduct = 0x1791, |
105 | .flags = SPEC_DEV_ID_DISABLE_HT}, | 174 | .flags = SPEC_DEV_ID_DISABLE_HT}, |
175 | {.idVendor = 0x0df6, .idProduct = 0x0059, | ||
176 | .flags = SPEC_DEV_ID_DISABLE_HT}, | ||
177 | {.idVendor = 0x13d3, .idProduct = 0x3306, | ||
178 | .flags = SPEC_DEV_ID_DISABLE_HT}, | ||
106 | {.idVendor = 0x13D3, .idProduct = 0x3311, | 179 | {.idVendor = 0x13D3, .idProduct = 0x3311, |
107 | .flags = SPEC_DEV_ID_DISABLE_HT}, | 180 | .flags = SPEC_DEV_ID_DISABLE_HT}, |
181 | {.idVendor = 0x13d3, .idProduct = 0x3335, | ||
182 | .flags = SPEC_DEV_ID_DISABLE_HT}, | ||
183 | {.idVendor = 0x13d3, .idProduct = 0x3336, | ||
184 | .flags = SPEC_DEV_ID_DISABLE_HT}, | ||
185 | {.idVendor = 0x13d3, .idProduct = 0x3340, | ||
186 | .flags = SPEC_DEV_ID_DISABLE_HT}, | ||
187 | {.idVendor = 0x13d3, .idProduct = 0x3341, | ||
188 | .flags = SPEC_DEV_ID_DISABLE_HT}, | ||
108 | {} | 189 | {} |
109 | }; | 190 | }; |
110 | 191 | ||
diff --git a/drivers/staging/speakup/kobjects.c b/drivers/staging/speakup/kobjects.c index 408bb9b3303e..07a7f5432597 100644 --- a/drivers/staging/speakup/kobjects.c +++ b/drivers/staging/speakup/kobjects.c | |||
@@ -332,7 +332,7 @@ static ssize_t silent_store(struct kobject *kobj, struct kobj_attribute *attr, | |||
332 | unsigned long flags; | 332 | unsigned long flags; |
333 | 333 | ||
334 | len = strlen(buf); | 334 | len = strlen(buf); |
335 | if (len > 0 || len < 3) { | 335 | if (len > 0 && len < 3) { |
336 | ch = buf[0]; | 336 | ch = buf[0]; |
337 | if (ch == '\n') | 337 | if (ch == '\n') |
338 | ch = '0'; | 338 | ch = '0'; |
diff --git a/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c b/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c index e8f047e86a32..80183a7e6624 100644 --- a/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c +++ b/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c | |||
@@ -986,12 +986,6 @@ static int __devinit synaptics_rmi4_probe | |||
986 | input_set_abs_params(rmi4_data->input_dev, ABS_MT_TOUCH_MAJOR, 0, | 986 | input_set_abs_params(rmi4_data->input_dev, ABS_MT_TOUCH_MAJOR, 0, |
987 | MAX_TOUCH_MAJOR, 0, 0); | 987 | MAX_TOUCH_MAJOR, 0, 0); |
988 | 988 | ||
989 | retval = input_register_device(rmi4_data->input_dev); | ||
990 | if (retval) { | ||
991 | dev_err(&client->dev, "%s:input register failed\n", __func__); | ||
992 | goto err_input_register; | ||
993 | } | ||
994 | |||
995 | /* Clear interrupts */ | 989 | /* Clear interrupts */ |
996 | synaptics_rmi4_i2c_block_read(rmi4_data, | 990 | synaptics_rmi4_i2c_block_read(rmi4_data, |
997 | rmi4_data->fn01_data_base_addr + 1, intr_status, | 991 | rmi4_data->fn01_data_base_addr + 1, intr_status, |
@@ -1003,15 +997,20 @@ static int __devinit synaptics_rmi4_probe | |||
1003 | if (retval) { | 997 | if (retval) { |
1004 | dev_err(&client->dev, "%s:Unable to get attn irq %d\n", | 998 | dev_err(&client->dev, "%s:Unable to get attn irq %d\n", |
1005 | __func__, platformdata->irq_number); | 999 | __func__, platformdata->irq_number); |
1006 | goto err_request_irq; | 1000 | goto err_unset_clientdata; |
1001 | } | ||
1002 | |||
1003 | retval = input_register_device(rmi4_data->input_dev); | ||
1004 | if (retval) { | ||
1005 | dev_err(&client->dev, "%s:input register failed\n", __func__); | ||
1006 | goto err_free_irq; | ||
1007 | } | 1007 | } |
1008 | 1008 | ||
1009 | return retval; | 1009 | return retval; |
1010 | 1010 | ||
1011 | err_request_irq: | 1011 | err_free_irq: |
1012 | free_irq(platformdata->irq_number, rmi4_data); | 1012 | free_irq(platformdata->irq_number, rmi4_data); |
1013 | input_unregister_device(rmi4_data->input_dev); | 1013 | err_unset_clientdata: |
1014 | err_input_register: | ||
1015 | i2c_set_clientdata(client, NULL); | 1014 | i2c_set_clientdata(client, NULL); |
1016 | err_query_dev: | 1015 | err_query_dev: |
1017 | if (platformdata->regulator_en) { | 1016 | if (platformdata->regulator_en) { |
diff --git a/drivers/staging/tidspbridge/core/io_sm.c b/drivers/staging/tidspbridge/core/io_sm.c index 571864555ddd..27e0aa81a584 100644 --- a/drivers/staging/tidspbridge/core/io_sm.c +++ b/drivers/staging/tidspbridge/core/io_sm.c | |||
@@ -949,7 +949,7 @@ func_end: | |||
949 | * Calls the Bridge's CHNL_ISR to determine if this interrupt is ours, then | 949 | * Calls the Bridge's CHNL_ISR to determine if this interrupt is ours, then |
950 | * schedules a DPC to dispatch I/O. | 950 | * schedules a DPC to dispatch I/O. |
951 | */ | 951 | */ |
952 | void io_mbox_msg(u32 msg) | 952 | int io_mbox_msg(struct notifier_block *self, unsigned long len, void *msg) |
953 | { | 953 | { |
954 | struct io_mgr *pio_mgr; | 954 | struct io_mgr *pio_mgr; |
955 | struct dev_object *dev_obj; | 955 | struct dev_object *dev_obj; |
@@ -959,9 +959,9 @@ void io_mbox_msg(u32 msg) | |||
959 | dev_get_io_mgr(dev_obj, &pio_mgr); | 959 | dev_get_io_mgr(dev_obj, &pio_mgr); |
960 | 960 | ||
961 | if (!pio_mgr) | 961 | if (!pio_mgr) |
962 | return; | 962 | return NOTIFY_BAD; |
963 | 963 | ||
964 | pio_mgr->intr_val = (u16)msg; | 964 | pio_mgr->intr_val = (u16)((u32)msg); |
965 | if (pio_mgr->intr_val & MBX_PM_CLASS) | 965 | if (pio_mgr->intr_val & MBX_PM_CLASS) |
966 | io_dispatch_pm(pio_mgr); | 966 | io_dispatch_pm(pio_mgr); |
967 | 967 | ||
@@ -973,7 +973,7 @@ void io_mbox_msg(u32 msg) | |||
973 | spin_unlock_irqrestore(&pio_mgr->dpc_lock, flags); | 973 | spin_unlock_irqrestore(&pio_mgr->dpc_lock, flags); |
974 | tasklet_schedule(&pio_mgr->dpc_tasklet); | 974 | tasklet_schedule(&pio_mgr->dpc_tasklet); |
975 | } | 975 | } |
976 | return; | 976 | return NOTIFY_OK; |
977 | } | 977 | } |
978 | 978 | ||
979 | /* | 979 | /* |
diff --git a/drivers/staging/tidspbridge/core/tiomap3430.c b/drivers/staging/tidspbridge/core/tiomap3430.c index a3b0a183d570..a3f69f6f505f 100644 --- a/drivers/staging/tidspbridge/core/tiomap3430.c +++ b/drivers/staging/tidspbridge/core/tiomap3430.c | |||
@@ -223,6 +223,10 @@ static struct bridge_drv_interface drv_interface_fxns = { | |||
223 | bridge_msg_set_queue_id, | 223 | bridge_msg_set_queue_id, |
224 | }; | 224 | }; |
225 | 225 | ||
226 | static struct notifier_block dsp_mbox_notifier = { | ||
227 | .notifier_call = io_mbox_msg, | ||
228 | }; | ||
229 | |||
226 | static inline void flush_all(struct bridge_dev_context *dev_context) | 230 | static inline void flush_all(struct bridge_dev_context *dev_context) |
227 | { | 231 | { |
228 | if (dev_context->dw_brd_state == BRD_DSP_HIBERNATION || | 232 | if (dev_context->dw_brd_state == BRD_DSP_HIBERNATION || |
@@ -553,7 +557,7 @@ static int bridge_brd_start(struct bridge_dev_context *dev_ctxt, | |||
553 | * Enable Mailbox events and also drain any pending | 557 | * Enable Mailbox events and also drain any pending |
554 | * stale messages. | 558 | * stale messages. |
555 | */ | 559 | */ |
556 | dev_context->mbox = omap_mbox_get("dsp"); | 560 | dev_context->mbox = omap_mbox_get("dsp", &dsp_mbox_notifier); |
557 | if (IS_ERR(dev_context->mbox)) { | 561 | if (IS_ERR(dev_context->mbox)) { |
558 | dev_context->mbox = NULL; | 562 | dev_context->mbox = NULL; |
559 | pr_err("%s: Failed to get dsp mailbox handle\n", | 563 | pr_err("%s: Failed to get dsp mailbox handle\n", |
@@ -563,8 +567,6 @@ static int bridge_brd_start(struct bridge_dev_context *dev_ctxt, | |||
563 | 567 | ||
564 | } | 568 | } |
565 | if (!status) { | 569 | if (!status) { |
566 | dev_context->mbox->rxq->callback = (int (*)(void *))io_mbox_msg; | ||
567 | |||
568 | /*PM_IVA2GRPSEL_PER = 0xC0;*/ | 570 | /*PM_IVA2GRPSEL_PER = 0xC0;*/ |
569 | temp = readl(resources->dw_per_pm_base + 0xA8); | 571 | temp = readl(resources->dw_per_pm_base + 0xA8); |
570 | temp = (temp & 0xFFFFFF30) | 0xC0; | 572 | temp = (temp & 0xFFFFFF30) | 0xC0; |
@@ -685,7 +687,7 @@ static int bridge_brd_stop(struct bridge_dev_context *dev_ctxt) | |||
685 | /* Disable the mailbox interrupts */ | 687 | /* Disable the mailbox interrupts */ |
686 | if (dev_context->mbox) { | 688 | if (dev_context->mbox) { |
687 | omap_mbox_disable_irq(dev_context->mbox, IRQ_RX); | 689 | omap_mbox_disable_irq(dev_context->mbox, IRQ_RX); |
688 | omap_mbox_put(dev_context->mbox); | 690 | omap_mbox_put(dev_context->mbox, &dsp_mbox_notifier); |
689 | dev_context->mbox = NULL; | 691 | dev_context->mbox = NULL; |
690 | } | 692 | } |
691 | /* Reset IVA2 clocks*/ | 693 | /* Reset IVA2 clocks*/ |
@@ -786,10 +788,7 @@ static int bridge_dev_create(struct bridge_dev_context | |||
786 | 788 | ||
787 | pt_attrs = kzalloc(sizeof(struct pg_table_attrs), GFP_KERNEL); | 789 | pt_attrs = kzalloc(sizeof(struct pg_table_attrs), GFP_KERNEL); |
788 | if (pt_attrs != NULL) { | 790 | if (pt_attrs != NULL) { |
789 | /* Assuming that we use only DSP's memory map | 791 | pt_attrs->l1_size = SZ_16K; /* 4096 entries of 32 bits */ |
790 | * until 0x4000:0000 , we would need only 1024 | ||
791 | * L1 enties i.e L1 size = 4K */ | ||
792 | pt_attrs->l1_size = 0x1000; | ||
793 | align_size = pt_attrs->l1_size; | 792 | align_size = pt_attrs->l1_size; |
794 | /* Align sizes are expected to be power of 2 */ | 793 | /* Align sizes are expected to be power of 2 */ |
795 | /* we like to get aligned on L1 table size */ | 794 | /* we like to get aligned on L1 table size */ |
diff --git a/drivers/staging/tidspbridge/include/dspbridge/io_sm.h b/drivers/staging/tidspbridge/include/dspbridge/io_sm.h index 18aec55d8647..8242c70e09dd 100644 --- a/drivers/staging/tidspbridge/include/dspbridge/io_sm.h +++ b/drivers/staging/tidspbridge/include/dspbridge/io_sm.h | |||
@@ -72,22 +72,17 @@ extern void io_dpc(unsigned long ref_data); | |||
72 | /* | 72 | /* |
73 | * ======== io_mbox_msg ======== | 73 | * ======== io_mbox_msg ======== |
74 | * Purpose: | 74 | * Purpose: |
75 | * Main interrupt handler for the shared memory Bridge channel manager. | 75 | * Main message handler for the shared memory Bridge channel manager. |
76 | * Calls the Bridge's chnlsm_isr to determine if this interrupt is ours, | 76 | * Determine if this message is ours, then schedules a DPC to |
77 | * then schedules a DPC to dispatch I/O. | 77 | * dispatch I/O. |
78 | * Parameters: | 78 | * Parameters: |
79 | * ref_data: Pointer to the channel manager object for this board. | 79 | * self: Pointer to its own notifier_block struct. |
80 | * Set in an initial call to ISR_Install(). | 80 | * len: Length of message. |
81 | * msg: Message code received. | ||
81 | * Returns: | 82 | * Returns: |
82 | * TRUE if interrupt handled; FALSE otherwise. | 83 | * NOTIFY_OK if handled; NOTIFY_BAD otherwise. |
83 | * Requires: | ||
84 | * Must be in locked memory if executing in kernel mode. | ||
85 | * Must only call functions which are in locked memory if Kernel mode. | ||
86 | * Must only call asynchronous services. | ||
87 | * Interrupts are disabled and EOI for this interrupt has been sent. | ||
88 | * Ensures: | ||
89 | */ | 84 | */ |
90 | void io_mbox_msg(u32 msg); | 85 | int io_mbox_msg(struct notifier_block *self, unsigned long len, void *msg); |
91 | 86 | ||
92 | /* | 87 | /* |
93 | * ======== io_request_chnl ======== | 88 | * ======== io_request_chnl ======== |
diff --git a/drivers/staging/usbip/stub.h b/drivers/staging/usbip/stub.h index 30dbfb6d16f2..d73267961ef4 100644 --- a/drivers/staging/usbip/stub.h +++ b/drivers/staging/usbip/stub.h | |||
@@ -32,6 +32,7 @@ | |||
32 | 32 | ||
33 | struct stub_device { | 33 | struct stub_device { |
34 | struct usb_interface *interface; | 34 | struct usb_interface *interface; |
35 | struct usb_device *udev; | ||
35 | struct list_head list; | 36 | struct list_head list; |
36 | 37 | ||
37 | struct usbip_device ud; | 38 | struct usbip_device ud; |
diff --git a/drivers/staging/usbip/stub_dev.c b/drivers/staging/usbip/stub_dev.c index b186b5fed2b9..a7ce51cc8909 100644 --- a/drivers/staging/usbip/stub_dev.c +++ b/drivers/staging/usbip/stub_dev.c | |||
@@ -258,10 +258,11 @@ static void stub_shutdown_connection(struct usbip_device *ud) | |||
258 | static void stub_device_reset(struct usbip_device *ud) | 258 | static void stub_device_reset(struct usbip_device *ud) |
259 | { | 259 | { |
260 | struct stub_device *sdev = container_of(ud, struct stub_device, ud); | 260 | struct stub_device *sdev = container_of(ud, struct stub_device, ud); |
261 | struct usb_device *udev = interface_to_usbdev(sdev->interface); | 261 | struct usb_device *udev = sdev->udev; |
262 | int ret; | 262 | int ret; |
263 | 263 | ||
264 | usbip_udbg("device reset"); | 264 | usbip_udbg("device reset"); |
265 | |||
265 | ret = usb_lock_device_for_reset(udev, sdev->interface); | 266 | ret = usb_lock_device_for_reset(udev, sdev->interface); |
266 | if (ret < 0) { | 267 | if (ret < 0) { |
267 | dev_err(&udev->dev, "lock for reset\n"); | 268 | dev_err(&udev->dev, "lock for reset\n"); |
@@ -309,7 +310,8 @@ static void stub_device_unusable(struct usbip_device *ud) | |||
309 | * | 310 | * |
310 | * Allocates and initializes a new stub_device struct. | 311 | * Allocates and initializes a new stub_device struct. |
311 | */ | 312 | */ |
312 | static struct stub_device *stub_device_alloc(struct usb_interface *interface) | 313 | static struct stub_device *stub_device_alloc(struct usb_device *udev, |
314 | struct usb_interface *interface) | ||
313 | { | 315 | { |
314 | struct stub_device *sdev; | 316 | struct stub_device *sdev; |
315 | int busnum = interface_to_busnum(interface); | 317 | int busnum = interface_to_busnum(interface); |
@@ -324,7 +326,8 @@ static struct stub_device *stub_device_alloc(struct usb_interface *interface) | |||
324 | return NULL; | 326 | return NULL; |
325 | } | 327 | } |
326 | 328 | ||
327 | sdev->interface = interface; | 329 | sdev->interface = usb_get_intf(interface); |
330 | sdev->udev = usb_get_dev(udev); | ||
328 | 331 | ||
329 | /* | 332 | /* |
330 | * devid is defined with devnum when this driver is first allocated. | 333 | * devid is defined with devnum when this driver is first allocated. |
@@ -450,11 +453,12 @@ static int stub_probe(struct usb_interface *interface, | |||
450 | return err; | 453 | return err; |
451 | } | 454 | } |
452 | 455 | ||
456 | usb_get_intf(interface); | ||
453 | return 0; | 457 | return 0; |
454 | } | 458 | } |
455 | 459 | ||
456 | /* ok. this is my device. */ | 460 | /* ok. this is my device. */ |
457 | sdev = stub_device_alloc(interface); | 461 | sdev = stub_device_alloc(udev, interface); |
458 | if (!sdev) | 462 | if (!sdev) |
459 | return -ENOMEM; | 463 | return -ENOMEM; |
460 | 464 | ||
@@ -476,6 +480,8 @@ static int stub_probe(struct usb_interface *interface, | |||
476 | dev_err(&interface->dev, "create sysfs files for %s\n", | 480 | dev_err(&interface->dev, "create sysfs files for %s\n", |
477 | udev_busid); | 481 | udev_busid); |
478 | usb_set_intfdata(interface, NULL); | 482 | usb_set_intfdata(interface, NULL); |
483 | usb_put_intf(interface); | ||
484 | |||
479 | busid_priv->interf_count = 0; | 485 | busid_priv->interf_count = 0; |
480 | 486 | ||
481 | busid_priv->sdev = NULL; | 487 | busid_priv->sdev = NULL; |
@@ -545,6 +551,7 @@ static void stub_disconnect(struct usb_interface *interface) | |||
545 | if (busid_priv->interf_count > 1) { | 551 | if (busid_priv->interf_count > 1) { |
546 | busid_priv->interf_count--; | 552 | busid_priv->interf_count--; |
547 | shutdown_busid(busid_priv); | 553 | shutdown_busid(busid_priv); |
554 | usb_put_intf(interface); | ||
548 | return; | 555 | return; |
549 | } | 556 | } |
550 | 557 | ||
@@ -554,6 +561,9 @@ static void stub_disconnect(struct usb_interface *interface) | |||
554 | /* 1. shutdown the current connection */ | 561 | /* 1. shutdown the current connection */ |
555 | shutdown_busid(busid_priv); | 562 | shutdown_busid(busid_priv); |
556 | 563 | ||
564 | usb_put_dev(sdev->udev); | ||
565 | usb_put_intf(interface); | ||
566 | |||
557 | /* 3. free sdev */ | 567 | /* 3. free sdev */ |
558 | busid_priv->sdev = NULL; | 568 | busid_priv->sdev = NULL; |
559 | stub_device_free(sdev); | 569 | stub_device_free(sdev); |
diff --git a/drivers/staging/usbip/stub_rx.c b/drivers/staging/usbip/stub_rx.c index 3de6fd2539dc..ae6ac82754a4 100644 --- a/drivers/staging/usbip/stub_rx.c +++ b/drivers/staging/usbip/stub_rx.c | |||
@@ -364,7 +364,7 @@ static struct stub_priv *stub_priv_alloc(struct stub_device *sdev, | |||
364 | 364 | ||
365 | static int get_pipe(struct stub_device *sdev, int epnum, int dir) | 365 | static int get_pipe(struct stub_device *sdev, int epnum, int dir) |
366 | { | 366 | { |
367 | struct usb_device *udev = interface_to_usbdev(sdev->interface); | 367 | struct usb_device *udev = sdev->udev; |
368 | struct usb_host_endpoint *ep; | 368 | struct usb_host_endpoint *ep; |
369 | struct usb_endpoint_descriptor *epd = NULL; | 369 | struct usb_endpoint_descriptor *epd = NULL; |
370 | 370 | ||
@@ -484,7 +484,7 @@ static void stub_recv_cmd_submit(struct stub_device *sdev, | |||
484 | int ret; | 484 | int ret; |
485 | struct stub_priv *priv; | 485 | struct stub_priv *priv; |
486 | struct usbip_device *ud = &sdev->ud; | 486 | struct usbip_device *ud = &sdev->ud; |
487 | struct usb_device *udev = interface_to_usbdev(sdev->interface); | 487 | struct usb_device *udev = sdev->udev; |
488 | int pipe = get_pipe(sdev, pdu->base.ep, pdu->base.direction); | 488 | int pipe = get_pipe(sdev, pdu->base.ep, pdu->base.direction); |
489 | 489 | ||
490 | 490 | ||
diff --git a/drivers/staging/usbip/vhci.h b/drivers/staging/usbip/vhci.h index 41a1fe5138f4..afc3b1a71881 100644 --- a/drivers/staging/usbip/vhci.h +++ b/drivers/staging/usbip/vhci.h | |||
@@ -100,9 +100,6 @@ struct vhci_hcd { | |||
100 | * But, the index of this array begins from 0. | 100 | * But, the index of this array begins from 0. |
101 | */ | 101 | */ |
102 | struct vhci_device vdev[VHCI_NPORTS]; | 102 | struct vhci_device vdev[VHCI_NPORTS]; |
103 | |||
104 | /* vhci_device which has not been assiged its address yet */ | ||
105 | int pending_port; | ||
106 | }; | 103 | }; |
107 | 104 | ||
108 | 105 | ||
@@ -119,6 +116,9 @@ void rh_port_disconnect(int rhport); | |||
119 | void vhci_rx_loop(struct usbip_task *ut); | 116 | void vhci_rx_loop(struct usbip_task *ut); |
120 | void vhci_tx_loop(struct usbip_task *ut); | 117 | void vhci_tx_loop(struct usbip_task *ut); |
121 | 118 | ||
119 | struct urb *pickup_urb_and_free_priv(struct vhci_device *vdev, | ||
120 | __u32 seqnum); | ||
121 | |||
122 | #define hardware (&the_controller->pdev.dev) | 122 | #define hardware (&the_controller->pdev.dev) |
123 | 123 | ||
124 | static inline struct vhci_device *port_to_vdev(__u32 port) | 124 | static inline struct vhci_device *port_to_vdev(__u32 port) |
diff --git a/drivers/staging/usbip/vhci_hcd.c b/drivers/staging/usbip/vhci_hcd.c index 08bd26a245d5..a35fe61268de 100644 --- a/drivers/staging/usbip/vhci_hcd.c +++ b/drivers/staging/usbip/vhci_hcd.c | |||
@@ -138,8 +138,6 @@ void rh_port_connect(int rhport, enum usb_device_speed speed) | |||
138 | * the_controller->vdev[rhport].ud.status = VDEV_CONNECT; | 138 | * the_controller->vdev[rhport].ud.status = VDEV_CONNECT; |
139 | * spin_unlock(&the_controller->vdev[rhport].ud.lock); */ | 139 | * spin_unlock(&the_controller->vdev[rhport].ud.lock); */ |
140 | 140 | ||
141 | the_controller->pending_port = rhport; | ||
142 | |||
143 | spin_unlock_irqrestore(&the_controller->lock, flags); | 141 | spin_unlock_irqrestore(&the_controller->lock, flags); |
144 | 142 | ||
145 | usb_hcd_poll_rh_status(vhci_to_hcd(the_controller)); | 143 | usb_hcd_poll_rh_status(vhci_to_hcd(the_controller)); |
@@ -559,6 +557,7 @@ static int vhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, | |||
559 | struct device *dev = &urb->dev->dev; | 557 | struct device *dev = &urb->dev->dev; |
560 | int ret = 0; | 558 | int ret = 0; |
561 | unsigned long flags; | 559 | unsigned long flags; |
560 | struct vhci_device *vdev; | ||
562 | 561 | ||
563 | usbip_dbg_vhci_hc("enter, usb_hcd %p urb %p mem_flags %d\n", | 562 | usbip_dbg_vhci_hc("enter, usb_hcd %p urb %p mem_flags %d\n", |
564 | hcd, urb, mem_flags); | 563 | hcd, urb, mem_flags); |
@@ -574,6 +573,18 @@ static int vhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, | |||
574 | return urb->status; | 573 | return urb->status; |
575 | } | 574 | } |
576 | 575 | ||
576 | vdev = port_to_vdev(urb->dev->portnum-1); | ||
577 | |||
578 | /* refuse enqueue for dead connection */ | ||
579 | spin_lock(&vdev->ud.lock); | ||
580 | if (vdev->ud.status == VDEV_ST_NULL || vdev->ud.status == VDEV_ST_ERROR) { | ||
581 | usbip_uerr("enqueue for inactive port %d\n", vdev->rhport); | ||
582 | spin_unlock(&vdev->ud.lock); | ||
583 | spin_unlock_irqrestore(&the_controller->lock, flags); | ||
584 | return -ENODEV; | ||
585 | } | ||
586 | spin_unlock(&vdev->ud.lock); | ||
587 | |||
577 | ret = usb_hcd_link_urb_to_ep(hcd, urb); | 588 | ret = usb_hcd_link_urb_to_ep(hcd, urb); |
578 | if (ret) | 589 | if (ret) |
579 | goto no_need_unlink; | 590 | goto no_need_unlink; |
@@ -592,8 +603,6 @@ static int vhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, | |||
592 | __u8 type = usb_pipetype(urb->pipe); | 603 | __u8 type = usb_pipetype(urb->pipe); |
593 | struct usb_ctrlrequest *ctrlreq = | 604 | struct usb_ctrlrequest *ctrlreq = |
594 | (struct usb_ctrlrequest *) urb->setup_packet; | 605 | (struct usb_ctrlrequest *) urb->setup_packet; |
595 | struct vhci_device *vdev = | ||
596 | port_to_vdev(the_controller->pending_port); | ||
597 | 606 | ||
598 | if (type != PIPE_CONTROL || !ctrlreq) { | 607 | if (type != PIPE_CONTROL || !ctrlreq) { |
599 | dev_err(dev, "invalid request to devnum 0\n"); | 608 | dev_err(dev, "invalid request to devnum 0\n"); |
@@ -607,7 +616,9 @@ static int vhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, | |||
607 | dev_info(dev, "SetAddress Request (%d) to port %d\n", | 616 | dev_info(dev, "SetAddress Request (%d) to port %d\n", |
608 | ctrlreq->wValue, vdev->rhport); | 617 | ctrlreq->wValue, vdev->rhport); |
609 | 618 | ||
610 | vdev->udev = urb->dev; | 619 | if (vdev->udev) |
620 | usb_put_dev(vdev->udev); | ||
621 | vdev->udev = usb_get_dev(urb->dev); | ||
611 | 622 | ||
612 | spin_lock(&vdev->ud.lock); | 623 | spin_lock(&vdev->ud.lock); |
613 | vdev->ud.status = VDEV_ST_USED; | 624 | vdev->ud.status = VDEV_ST_USED; |
@@ -627,8 +638,9 @@ static int vhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, | |||
627 | "Get_Descriptor to device 0 " | 638 | "Get_Descriptor to device 0 " |
628 | "(get max pipe size)\n"); | 639 | "(get max pipe size)\n"); |
629 | 640 | ||
630 | /* FIXME: reference count? (usb_get_dev()) */ | 641 | if (vdev->udev) |
631 | vdev->udev = urb->dev; | 642 | usb_put_dev(vdev->udev); |
643 | vdev->udev = usb_get_dev(urb->dev); | ||
632 | goto out; | 644 | goto out; |
633 | 645 | ||
634 | default: | 646 | default: |
@@ -805,7 +817,6 @@ static int vhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) | |||
805 | return 0; | 817 | return 0; |
806 | } | 818 | } |
807 | 819 | ||
808 | |||
809 | static void vhci_device_unlink_cleanup(struct vhci_device *vdev) | 820 | static void vhci_device_unlink_cleanup(struct vhci_device *vdev) |
810 | { | 821 | { |
811 | struct vhci_unlink *unlink, *tmp; | 822 | struct vhci_unlink *unlink, *tmp; |
@@ -813,11 +824,34 @@ static void vhci_device_unlink_cleanup(struct vhci_device *vdev) | |||
813 | spin_lock(&vdev->priv_lock); | 824 | spin_lock(&vdev->priv_lock); |
814 | 825 | ||
815 | list_for_each_entry_safe(unlink, tmp, &vdev->unlink_tx, list) { | 826 | list_for_each_entry_safe(unlink, tmp, &vdev->unlink_tx, list) { |
827 | usbip_uinfo("unlink cleanup tx %lu\n", unlink->unlink_seqnum); | ||
816 | list_del(&unlink->list); | 828 | list_del(&unlink->list); |
817 | kfree(unlink); | 829 | kfree(unlink); |
818 | } | 830 | } |
819 | 831 | ||
820 | list_for_each_entry_safe(unlink, tmp, &vdev->unlink_rx, list) { | 832 | list_for_each_entry_safe(unlink, tmp, &vdev->unlink_rx, list) { |
833 | struct urb *urb; | ||
834 | |||
835 | /* give back URB of unanswered unlink request */ | ||
836 | usbip_uinfo("unlink cleanup rx %lu\n", unlink->unlink_seqnum); | ||
837 | |||
838 | urb = pickup_urb_and_free_priv(vdev, unlink->unlink_seqnum); | ||
839 | if (!urb) { | ||
840 | usbip_uinfo("the urb (seqnum %lu) was already given back\n", | ||
841 | unlink->unlink_seqnum); | ||
842 | list_del(&unlink->list); | ||
843 | kfree(unlink); | ||
844 | continue; | ||
845 | } | ||
846 | |||
847 | urb->status = -ENODEV; | ||
848 | |||
849 | spin_lock(&the_controller->lock); | ||
850 | usb_hcd_unlink_urb_from_ep(vhci_to_hcd(the_controller), urb); | ||
851 | spin_unlock(&the_controller->lock); | ||
852 | |||
853 | usb_hcd_giveback_urb(vhci_to_hcd(the_controller), urb, urb->status); | ||
854 | |||
821 | list_del(&unlink->list); | 855 | list_del(&unlink->list); |
822 | kfree(unlink); | 856 | kfree(unlink); |
823 | } | 857 | } |
@@ -887,6 +921,10 @@ static void vhci_device_reset(struct usbip_device *ud) | |||
887 | vdev->speed = 0; | 921 | vdev->speed = 0; |
888 | vdev->devid = 0; | 922 | vdev->devid = 0; |
889 | 923 | ||
924 | if (vdev->udev) | ||
925 | usb_put_dev(vdev->udev); | ||
926 | vdev->udev = NULL; | ||
927 | |||
890 | ud->tcp_socket = NULL; | 928 | ud->tcp_socket = NULL; |
891 | 929 | ||
892 | ud->status = VDEV_ST_NULL; | 930 | ud->status = VDEV_ST_NULL; |
diff --git a/drivers/staging/usbip/vhci_rx.c b/drivers/staging/usbip/vhci_rx.c index 8147d7202b2d..bf6991470941 100644 --- a/drivers/staging/usbip/vhci_rx.c +++ b/drivers/staging/usbip/vhci_rx.c | |||
@@ -23,16 +23,14 @@ | |||
23 | #include "vhci.h" | 23 | #include "vhci.h" |
24 | 24 | ||
25 | 25 | ||
26 | /* get URB from transmitted urb queue */ | 26 | /* get URB from transmitted urb queue. caller must hold vdev->priv_lock */ |
27 | static struct urb *pickup_urb_and_free_priv(struct vhci_device *vdev, | 27 | struct urb *pickup_urb_and_free_priv(struct vhci_device *vdev, |
28 | __u32 seqnum) | 28 | __u32 seqnum) |
29 | { | 29 | { |
30 | struct vhci_priv *priv, *tmp; | 30 | struct vhci_priv *priv, *tmp; |
31 | struct urb *urb = NULL; | 31 | struct urb *urb = NULL; |
32 | int status; | 32 | int status; |
33 | 33 | ||
34 | spin_lock(&vdev->priv_lock); | ||
35 | |||
36 | list_for_each_entry_safe(priv, tmp, &vdev->priv_rx, list) { | 34 | list_for_each_entry_safe(priv, tmp, &vdev->priv_rx, list) { |
37 | if (priv->seqnum == seqnum) { | 35 | if (priv->seqnum == seqnum) { |
38 | urb = priv->urb; | 36 | urb = priv->urb; |
@@ -63,8 +61,6 @@ static struct urb *pickup_urb_and_free_priv(struct vhci_device *vdev, | |||
63 | } | 61 | } |
64 | } | 62 | } |
65 | 63 | ||
66 | spin_unlock(&vdev->priv_lock); | ||
67 | |||
68 | return urb; | 64 | return urb; |
69 | } | 65 | } |
70 | 66 | ||
@@ -74,9 +70,11 @@ static void vhci_recv_ret_submit(struct vhci_device *vdev, | |||
74 | struct usbip_device *ud = &vdev->ud; | 70 | struct usbip_device *ud = &vdev->ud; |
75 | struct urb *urb; | 71 | struct urb *urb; |
76 | 72 | ||
73 | spin_lock(&vdev->priv_lock); | ||
77 | 74 | ||
78 | urb = pickup_urb_and_free_priv(vdev, pdu->base.seqnum); | 75 | urb = pickup_urb_and_free_priv(vdev, pdu->base.seqnum); |
79 | 76 | ||
77 | spin_unlock(&vdev->priv_lock); | ||
80 | 78 | ||
81 | if (!urb) { | 79 | if (!urb) { |
82 | usbip_uerr("cannot find a urb of seqnum %u\n", | 80 | usbip_uerr("cannot find a urb of seqnum %u\n", |
@@ -161,7 +159,12 @@ static void vhci_recv_ret_unlink(struct vhci_device *vdev, | |||
161 | return; | 159 | return; |
162 | } | 160 | } |
163 | 161 | ||
162 | spin_lock(&vdev->priv_lock); | ||
163 | |||
164 | urb = pickup_urb_and_free_priv(vdev, unlink->unlink_seqnum); | 164 | urb = pickup_urb_and_free_priv(vdev, unlink->unlink_seqnum); |
165 | |||
166 | spin_unlock(&vdev->priv_lock); | ||
167 | |||
165 | if (!urb) { | 168 | if (!urb) { |
166 | /* | 169 | /* |
167 | * I get the result of a unlink request. But, it seems that I | 170 | * I get the result of a unlink request. But, it seems that I |
@@ -190,6 +193,19 @@ static void vhci_recv_ret_unlink(struct vhci_device *vdev, | |||
190 | return; | 193 | return; |
191 | } | 194 | } |
192 | 195 | ||
196 | static int vhci_priv_tx_empty(struct vhci_device *vdev) | ||
197 | { | ||
198 | int empty = 0; | ||
199 | |||
200 | spin_lock(&vdev->priv_lock); | ||
201 | |||
202 | empty = list_empty(&vdev->priv_rx); | ||
203 | |||
204 | spin_unlock(&vdev->priv_lock); | ||
205 | |||
206 | return empty; | ||
207 | } | ||
208 | |||
193 | /* recv a pdu */ | 209 | /* recv a pdu */ |
194 | static void vhci_rx_pdu(struct usbip_device *ud) | 210 | static void vhci_rx_pdu(struct usbip_device *ud) |
195 | { | 211 | { |
@@ -202,11 +218,29 @@ static void vhci_rx_pdu(struct usbip_device *ud) | |||
202 | 218 | ||
203 | memset(&pdu, 0, sizeof(pdu)); | 219 | memset(&pdu, 0, sizeof(pdu)); |
204 | 220 | ||
205 | |||
206 | /* 1. receive a pdu header */ | 221 | /* 1. receive a pdu header */ |
207 | ret = usbip_xmit(0, ud->tcp_socket, (char *) &pdu, sizeof(pdu), 0); | 222 | ret = usbip_xmit(0, ud->tcp_socket, (char *) &pdu, sizeof(pdu), 0); |
223 | if (ret < 0) { | ||
224 | if (ret == -ECONNRESET) | ||
225 | usbip_uinfo("connection reset by peer\n"); | ||
226 | else if (ret == -EAGAIN) { | ||
227 | /* ignore if connection was idle */ | ||
228 | if (vhci_priv_tx_empty(vdev)) | ||
229 | return; | ||
230 | usbip_uinfo("connection timed out with pending urbs\n"); | ||
231 | } else if (ret != -ERESTARTSYS) | ||
232 | usbip_uinfo("xmit failed %d\n", ret); | ||
233 | |||
234 | usbip_event_add(ud, VDEV_EVENT_ERROR_TCP); | ||
235 | return; | ||
236 | } | ||
237 | if (ret == 0) { | ||
238 | usbip_uinfo("connection closed"); | ||
239 | usbip_event_add(ud, VDEV_EVENT_DOWN); | ||
240 | return; | ||
241 | } | ||
208 | if (ret != sizeof(pdu)) { | 242 | if (ret != sizeof(pdu)) { |
209 | usbip_uerr("receiving pdu failed! size is %d, should be %d\n", | 243 | usbip_uerr("received pdu size is %d, should be %d\n", |
210 | ret, (unsigned int)sizeof(pdu)); | 244 | ret, (unsigned int)sizeof(pdu)); |
211 | usbip_event_add(ud, VDEV_EVENT_ERROR_TCP); | 245 | usbip_event_add(ud, VDEV_EVENT_ERROR_TCP); |
212 | return; | 246 | return; |
diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c index 7016fdd2509f..e19b932492e1 100644 --- a/drivers/staging/xgifb/vb_setmode.c +++ b/drivers/staging/xgifb/vb_setmode.c | |||
@@ -3954,8 +3954,8 @@ void XGI_GetCRT2ResInfo(unsigned short ModeNo, unsigned short ModeIdIndex, | |||
3954 | unsigned char XGI_IsLCDDualLink(struct vb_device_info *pVBInfo) | 3954 | unsigned char XGI_IsLCDDualLink(struct vb_device_info *pVBInfo) |
3955 | { | 3955 | { |
3956 | 3956 | ||
3957 | if ((((pVBInfo->VBInfo & SetCRT2ToLCD) | SetCRT2ToLCDA)) | 3957 | if ((pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) && |
3958 | && (pVBInfo->LCDInfo & SetLCDDualLink)) /* shampoo0129 */ | 3958 | (pVBInfo->LCDInfo & SetLCDDualLink)) /* shampoo0129 */ |
3959 | return 1; | 3959 | return 1; |
3960 | 3960 | ||
3961 | return 0; | 3961 | return 0; |
@@ -8773,7 +8773,7 @@ unsigned short XGI_GetVCLK2Ptr(unsigned short ModeNo, | |||
8773 | 8773 | ||
8774 | if (pVBInfo->IF_DEF_LVDS == 0) { | 8774 | if (pVBInfo->IF_DEF_LVDS == 0) { |
8775 | CRT2Index = CRT2Index >> 6; /* for LCD */ | 8775 | CRT2Index = CRT2Index >> 6; /* for LCD */ |
8776 | if (((pVBInfo->VBInfo & SetCRT2ToLCD) | SetCRT2ToLCDA)) { /*301b*/ | 8776 | if (pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) { /*301b*/ |
8777 | if (pVBInfo->LCDResInfo != Panel1024x768) | 8777 | if (pVBInfo->LCDResInfo != Panel1024x768) |
8778 | VCLKIndex = LCDXlat2VCLK[CRT2Index]; | 8778 | VCLKIndex = LCDXlat2VCLK[CRT2Index]; |
8779 | else | 8779 | else |
diff --git a/drivers/tty/n_hdlc.c b/drivers/tty/n_hdlc.c index 47d32281032c..52fc0c9a6364 100644 --- a/drivers/tty/n_hdlc.c +++ b/drivers/tty/n_hdlc.c | |||
@@ -581,8 +581,9 @@ static ssize_t n_hdlc_tty_read(struct tty_struct *tty, struct file *file, | |||
581 | __u8 __user *buf, size_t nr) | 581 | __u8 __user *buf, size_t nr) |
582 | { | 582 | { |
583 | struct n_hdlc *n_hdlc = tty2n_hdlc(tty); | 583 | struct n_hdlc *n_hdlc = tty2n_hdlc(tty); |
584 | int ret; | 584 | int ret = 0; |
585 | struct n_hdlc_buf *rbuf; | 585 | struct n_hdlc_buf *rbuf; |
586 | DECLARE_WAITQUEUE(wait, current); | ||
586 | 587 | ||
587 | if (debuglevel >= DEBUG_LEVEL_INFO) | 588 | if (debuglevel >= DEBUG_LEVEL_INFO) |
588 | printk("%s(%d)n_hdlc_tty_read() called\n",__FILE__,__LINE__); | 589 | printk("%s(%d)n_hdlc_tty_read() called\n",__FILE__,__LINE__); |
@@ -598,57 +599,55 @@ static ssize_t n_hdlc_tty_read(struct tty_struct *tty, struct file *file, | |||
598 | return -EFAULT; | 599 | return -EFAULT; |
599 | } | 600 | } |
600 | 601 | ||
601 | tty_lock(); | 602 | add_wait_queue(&tty->read_wait, &wait); |
602 | 603 | ||
603 | for (;;) { | 604 | for (;;) { |
604 | if (test_bit(TTY_OTHER_CLOSED, &tty->flags)) { | 605 | if (test_bit(TTY_OTHER_CLOSED, &tty->flags)) { |
605 | tty_unlock(); | 606 | ret = -EIO; |
606 | return -EIO; | 607 | break; |
607 | } | 608 | } |
609 | if (tty_hung_up_p(file)) | ||
610 | break; | ||
608 | 611 | ||
609 | n_hdlc = tty2n_hdlc (tty); | 612 | set_current_state(TASK_INTERRUPTIBLE); |
610 | if (!n_hdlc || n_hdlc->magic != HDLC_MAGIC || | ||
611 | tty != n_hdlc->tty) { | ||
612 | tty_unlock(); | ||
613 | return 0; | ||
614 | } | ||
615 | 613 | ||
616 | rbuf = n_hdlc_buf_get(&n_hdlc->rx_buf_list); | 614 | rbuf = n_hdlc_buf_get(&n_hdlc->rx_buf_list); |
617 | if (rbuf) | 615 | if (rbuf) { |
616 | if (rbuf->count > nr) { | ||
617 | /* too large for caller's buffer */ | ||
618 | ret = -EOVERFLOW; | ||
619 | } else { | ||
620 | if (copy_to_user(buf, rbuf->buf, rbuf->count)) | ||
621 | ret = -EFAULT; | ||
622 | else | ||
623 | ret = rbuf->count; | ||
624 | } | ||
625 | |||
626 | if (n_hdlc->rx_free_buf_list.count > | ||
627 | DEFAULT_RX_BUF_COUNT) | ||
628 | kfree(rbuf); | ||
629 | else | ||
630 | n_hdlc_buf_put(&n_hdlc->rx_free_buf_list, rbuf); | ||
618 | break; | 631 | break; |
632 | } | ||
619 | 633 | ||
620 | /* no data */ | 634 | /* no data */ |
621 | if (file->f_flags & O_NONBLOCK) { | 635 | if (file->f_flags & O_NONBLOCK) { |
622 | tty_unlock(); | 636 | ret = -EAGAIN; |
623 | return -EAGAIN; | 637 | break; |
624 | } | 638 | } |
625 | 639 | ||
626 | interruptible_sleep_on (&tty->read_wait); | 640 | schedule(); |
641 | |||
627 | if (signal_pending(current)) { | 642 | if (signal_pending(current)) { |
628 | tty_unlock(); | 643 | ret = -EINTR; |
629 | return -EINTR; | 644 | break; |
630 | } | 645 | } |
631 | } | 646 | } |
632 | 647 | ||
633 | if (rbuf->count > nr) | 648 | remove_wait_queue(&tty->read_wait, &wait); |
634 | /* frame too large for caller's buffer (discard frame) */ | 649 | __set_current_state(TASK_RUNNING); |
635 | ret = -EOVERFLOW; | 650 | |
636 | else { | ||
637 | /* Copy the data to the caller's buffer */ | ||
638 | if (copy_to_user(buf, rbuf->buf, rbuf->count)) | ||
639 | ret = -EFAULT; | ||
640 | else | ||
641 | ret = rbuf->count; | ||
642 | } | ||
643 | |||
644 | /* return HDLC buffer to free list unless the free list */ | ||
645 | /* count has exceeded the default value, in which case the */ | ||
646 | /* buffer is freed back to the OS to conserve memory */ | ||
647 | if (n_hdlc->rx_free_buf_list.count > DEFAULT_RX_BUF_COUNT) | ||
648 | kfree(rbuf); | ||
649 | else | ||
650 | n_hdlc_buf_put(&n_hdlc->rx_free_buf_list,rbuf); | ||
651 | tty_unlock(); | ||
652 | return ret; | 651 | return ret; |
653 | 652 | ||
654 | } /* end of n_hdlc_tty_read() */ | 653 | } /* end of n_hdlc_tty_read() */ |
@@ -691,14 +690,15 @@ static ssize_t n_hdlc_tty_write(struct tty_struct *tty, struct file *file, | |||
691 | count = maxframe; | 690 | count = maxframe; |
692 | } | 691 | } |
693 | 692 | ||
694 | tty_lock(); | ||
695 | |||
696 | add_wait_queue(&tty->write_wait, &wait); | 693 | add_wait_queue(&tty->write_wait, &wait); |
697 | set_current_state(TASK_INTERRUPTIBLE); | 694 | |
695 | for (;;) { | ||
696 | set_current_state(TASK_INTERRUPTIBLE); | ||
698 | 697 | ||
699 | /* Allocate transmit buffer */ | 698 | tbuf = n_hdlc_buf_get(&n_hdlc->tx_free_buf_list); |
700 | /* sleep until transmit buffer available */ | 699 | if (tbuf) |
701 | while (!(tbuf = n_hdlc_buf_get(&n_hdlc->tx_free_buf_list))) { | 700 | break; |
701 | |||
702 | if (file->f_flags & O_NONBLOCK) { | 702 | if (file->f_flags & O_NONBLOCK) { |
703 | error = -EAGAIN; | 703 | error = -EAGAIN; |
704 | break; | 704 | break; |
@@ -719,7 +719,7 @@ static ssize_t n_hdlc_tty_write(struct tty_struct *tty, struct file *file, | |||
719 | } | 719 | } |
720 | } | 720 | } |
721 | 721 | ||
722 | set_current_state(TASK_RUNNING); | 722 | __set_current_state(TASK_RUNNING); |
723 | remove_wait_queue(&tty->write_wait, &wait); | 723 | remove_wait_queue(&tty->write_wait, &wait); |
724 | 724 | ||
725 | if (!error) { | 725 | if (!error) { |
@@ -731,7 +731,7 @@ static ssize_t n_hdlc_tty_write(struct tty_struct *tty, struct file *file, | |||
731 | n_hdlc_buf_put(&n_hdlc->tx_buf_list,tbuf); | 731 | n_hdlc_buf_put(&n_hdlc->tx_buf_list,tbuf); |
732 | n_hdlc_send_frames(n_hdlc,tty); | 732 | n_hdlc_send_frames(n_hdlc,tty); |
733 | } | 733 | } |
734 | tty_unlock(); | 734 | |
735 | return error; | 735 | return error; |
736 | 736 | ||
737 | } /* end of n_hdlc_tty_write() */ | 737 | } /* end of n_hdlc_tty_write() */ |
diff --git a/drivers/tty/serial/8250.c b/drivers/tty/serial/8250.c index b25e6e490530..3975df6f7fdb 100644 --- a/drivers/tty/serial/8250.c +++ b/drivers/tty/serial/8250.c | |||
@@ -236,7 +236,8 @@ static const struct serial8250_config uart_config[] = { | |||
236 | .fifo_size = 128, | 236 | .fifo_size = 128, |
237 | .tx_loadsz = 128, | 237 | .tx_loadsz = 128, |
238 | .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10, | 238 | .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10, |
239 | .flags = UART_CAP_FIFO | UART_CAP_EFR | UART_CAP_SLEEP, | 239 | /* UART_CAP_EFR breaks billionon CF bluetooth card. */ |
240 | .flags = UART_CAP_FIFO | UART_CAP_SLEEP, | ||
240 | }, | 241 | }, |
241 | [PORT_16654] = { | 242 | [PORT_16654] = { |
242 | .name = "ST16654", | 243 | .name = "ST16654", |
diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig index b1682d7f1d8a..2b8334601c8b 100644 --- a/drivers/tty/serial/Kconfig +++ b/drivers/tty/serial/Kconfig | |||
@@ -1518,6 +1518,7 @@ config SERIAL_BCM63XX_CONSOLE | |||
1518 | config SERIAL_GRLIB_GAISLER_APBUART | 1518 | config SERIAL_GRLIB_GAISLER_APBUART |
1519 | tristate "GRLIB APBUART serial support" | 1519 | tristate "GRLIB APBUART serial support" |
1520 | depends on OF | 1520 | depends on OF |
1521 | select SERIAL_CORE | ||
1521 | ---help--- | 1522 | ---help--- |
1522 | Add support for the GRLIB APBUART serial port. | 1523 | Add support for the GRLIB APBUART serial port. |
1523 | 1524 | ||
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c index 6158eae0f64a..0065da4b11c1 100644 --- a/drivers/tty/tty_io.c +++ b/drivers/tty/tty_io.c | |||
@@ -3257,7 +3257,7 @@ static ssize_t show_cons_active(struct device *dev, | |||
3257 | ssize_t count = 0; | 3257 | ssize_t count = 0; |
3258 | 3258 | ||
3259 | console_lock(); | 3259 | console_lock(); |
3260 | for (c = console_drivers; c; c = c->next) { | 3260 | for_each_console(c) { |
3261 | if (!c->device) | 3261 | if (!c->device) |
3262 | continue; | 3262 | continue; |
3263 | if (!c->write) | 3263 | if (!c->write) |
@@ -3306,7 +3306,7 @@ int __init tty_init(void) | |||
3306 | if (IS_ERR(consdev)) | 3306 | if (IS_ERR(consdev)) |
3307 | consdev = NULL; | 3307 | consdev = NULL; |
3308 | else | 3308 | else |
3309 | device_create_file(consdev, &dev_attr_active); | 3309 | WARN_ON(device_create_file(consdev, &dev_attr_active) < 0); |
3310 | 3310 | ||
3311 | #ifdef CONFIG_VT | 3311 | #ifdef CONFIG_VT |
3312 | vty_init(&console_fops); | 3312 | vty_init(&console_fops); |
diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c index b230bd3f056f..147ede3423df 100644 --- a/drivers/tty/vt/vt.c +++ b/drivers/tty/vt/vt.c | |||
@@ -2994,7 +2994,7 @@ int __init vty_init(const struct file_operations *console_fops) | |||
2994 | if (IS_ERR(tty0dev)) | 2994 | if (IS_ERR(tty0dev)) |
2995 | tty0dev = NULL; | 2995 | tty0dev = NULL; |
2996 | else | 2996 | else |
2997 | device_create_file(tty0dev, &dev_attr_active); | 2997 | WARN_ON(device_create_file(tty0dev, &dev_attr_active) < 0); |
2998 | 2998 | ||
2999 | vcs_init(); | 2999 | vcs_init(); |
3000 | 3000 | ||
@@ -3545,7 +3545,7 @@ int register_con_driver(const struct consw *csw, int first, int last) | |||
3545 | 3545 | ||
3546 | /* already registered */ | 3546 | /* already registered */ |
3547 | if (con_driver->con == csw) | 3547 | if (con_driver->con == csw) |
3548 | retval = -EINVAL; | 3548 | retval = -EBUSY; |
3549 | } | 3549 | } |
3550 | 3550 | ||
3551 | if (retval) | 3551 | if (retval) |
@@ -3656,7 +3656,12 @@ int take_over_console(const struct consw *csw, int first, int last, int deflt) | |||
3656 | int err; | 3656 | int err; |
3657 | 3657 | ||
3658 | err = register_con_driver(csw, first, last); | 3658 | err = register_con_driver(csw, first, last); |
3659 | 3659 | /* if we get an busy error we still want to bind the console driver | |
3660 | * and return success, as we may have unbound the console driver | ||
3661 | Â * but not unregistered it. | ||
3662 | */ | ||
3663 | if (err == -EBUSY) | ||
3664 | err = 0; | ||
3660 | if (!err) | 3665 | if (!err) |
3661 | bind_con_driver(csw, first, last, deflt); | 3666 | bind_con_driver(csw, first, last, deflt); |
3662 | 3667 | ||
diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c index 6ee4451bfe2d..47085e5879ab 100644 --- a/drivers/usb/class/cdc-wdm.c +++ b/drivers/usb/class/cdc-wdm.c | |||
@@ -342,7 +342,7 @@ static ssize_t wdm_write | |||
342 | goto outnp; | 342 | goto outnp; |
343 | } | 343 | } |
344 | 344 | ||
345 | if (!file->f_flags && O_NONBLOCK) | 345 | if (!(file->f_flags & O_NONBLOCK)) |
346 | r = wait_event_interruptible(desc->wait, !test_bit(WDM_IN_USE, | 346 | r = wait_event_interruptible(desc->wait, !test_bit(WDM_IN_USE, |
347 | &desc->flags)); | 347 | &desc->flags)); |
348 | else | 348 | else |
diff --git a/drivers/usb/core/endpoint.c b/drivers/usb/core/endpoint.c index 9da250563027..df502a98d0df 100644 --- a/drivers/usb/core/endpoint.c +++ b/drivers/usb/core/endpoint.c | |||
@@ -192,12 +192,12 @@ int usb_create_ep_devs(struct device *parent, | |||
192 | ep_dev->dev.parent = parent; | 192 | ep_dev->dev.parent = parent; |
193 | ep_dev->dev.release = ep_device_release; | 193 | ep_dev->dev.release = ep_device_release; |
194 | dev_set_name(&ep_dev->dev, "ep_%02x", endpoint->desc.bEndpointAddress); | 194 | dev_set_name(&ep_dev->dev, "ep_%02x", endpoint->desc.bEndpointAddress); |
195 | device_enable_async_suspend(&ep_dev->dev); | ||
196 | 195 | ||
197 | retval = device_register(&ep_dev->dev); | 196 | retval = device_register(&ep_dev->dev); |
198 | if (retval) | 197 | if (retval) |
199 | goto error_register; | 198 | goto error_register; |
200 | 199 | ||
200 | device_enable_async_suspend(&ep_dev->dev); | ||
201 | endpoint->ep_dev = ep_dev; | 201 | endpoint->ep_dev = ep_dev; |
202 | return retval; | 202 | return retval; |
203 | 203 | ||
diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c index b55d46070a25..f71e8e307e0f 100644 --- a/drivers/usb/core/hcd-pci.c +++ b/drivers/usb/core/hcd-pci.c | |||
@@ -405,7 +405,12 @@ static int suspend_common(struct device *dev, bool do_wakeup) | |||
405 | return retval; | 405 | return retval; |
406 | } | 406 | } |
407 | 407 | ||
408 | synchronize_irq(pci_dev->irq); | 408 | /* If MSI-X is enabled, the driver will have synchronized all vectors |
409 | * in pci_suspend(). If MSI or legacy PCI is enabled, that will be | ||
410 | * synchronized here. | ||
411 | */ | ||
412 | if (!hcd->msix_enabled) | ||
413 | synchronize_irq(pci_dev->irq); | ||
409 | 414 | ||
410 | /* Downstream ports from this root hub should already be quiesced, so | 415 | /* Downstream ports from this root hub should already be quiesced, so |
411 | * there will be no DMA activity. Now we can shut down the upstream | 416 | * there will be no DMA activity. Now we can shut down the upstream |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index b98efae6a1cf..4310cc4b1cb5 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -676,6 +676,8 @@ static void hub_init_func3(struct work_struct *ws); | |||
676 | static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) | 676 | static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) |
677 | { | 677 | { |
678 | struct usb_device *hdev = hub->hdev; | 678 | struct usb_device *hdev = hub->hdev; |
679 | struct usb_hcd *hcd; | ||
680 | int ret; | ||
679 | int port1; | 681 | int port1; |
680 | int status; | 682 | int status; |
681 | bool need_debounce_delay = false; | 683 | bool need_debounce_delay = false; |
@@ -714,6 +716,25 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) | |||
714 | usb_autopm_get_interface_no_resume( | 716 | usb_autopm_get_interface_no_resume( |
715 | to_usb_interface(hub->intfdev)); | 717 | to_usb_interface(hub->intfdev)); |
716 | return; /* Continues at init2: below */ | 718 | return; /* Continues at init2: below */ |
719 | } else if (type == HUB_RESET_RESUME) { | ||
720 | /* The internal host controller state for the hub device | ||
721 | * may be gone after a host power loss on system resume. | ||
722 | * Update the device's info so the HW knows it's a hub. | ||
723 | */ | ||
724 | hcd = bus_to_hcd(hdev->bus); | ||
725 | if (hcd->driver->update_hub_device) { | ||
726 | ret = hcd->driver->update_hub_device(hcd, hdev, | ||
727 | &hub->tt, GFP_NOIO); | ||
728 | if (ret < 0) { | ||
729 | dev_err(hub->intfdev, "Host not " | ||
730 | "accepting hub info " | ||
731 | "update.\n"); | ||
732 | dev_err(hub->intfdev, "LS/FS devices " | ||
733 | "and hubs may not work " | ||
734 | "under this hub\n."); | ||
735 | } | ||
736 | } | ||
737 | hub_power_on(hub, true); | ||
717 | } else { | 738 | } else { |
718 | hub_power_on(hub, true); | 739 | hub_power_on(hub, true); |
719 | } | 740 | } |
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index 1dc9739277b4..06bb9d4587e9 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig | |||
@@ -509,7 +509,7 @@ config USB_LANGWELL | |||
509 | select USB_GADGET_SELECTED | 509 | select USB_GADGET_SELECTED |
510 | 510 | ||
511 | config USB_GADGET_EG20T | 511 | config USB_GADGET_EG20T |
512 | boolean "Intel EG20T(Topcliff) USB Device controller" | 512 | boolean "Intel EG20T PCH/OKI SEMICONDUCTOR ML7213 IOH UDC" |
513 | depends on PCI | 513 | depends on PCI |
514 | select USB_GADGET_DUALSPEED | 514 | select USB_GADGET_DUALSPEED |
515 | help | 515 | help |
@@ -525,6 +525,11 @@ config USB_GADGET_EG20T | |||
525 | This driver dose not support interrupt transfer or isochronous | 525 | This driver dose not support interrupt transfer or isochronous |
526 | transfer modes. | 526 | transfer modes. |
527 | 527 | ||
528 | This driver also can be used for OKI SEMICONDUCTOR's ML7213 which is | ||
529 | for IVI(In-Vehicle Infotainment) use. | ||
530 | ML7213 is companion chip for Intel Atom E6xx series. | ||
531 | ML7213 is completely compatible for Intel EG20T PCH. | ||
532 | |||
528 | config USB_EG20T | 533 | config USB_EG20T |
529 | tristate | 534 | tristate |
530 | depends on USB_GADGET_EG20T | 535 | depends on USB_GADGET_EG20T |
diff --git a/drivers/usb/gadget/ci13xxx_udc.c b/drivers/usb/gadget/ci13xxx_udc.c index 31656a2b4ab4..a1c67ae1572a 100644 --- a/drivers/usb/gadget/ci13xxx_udc.c +++ b/drivers/usb/gadget/ci13xxx_udc.c | |||
@@ -76,10 +76,21 @@ static DEFINE_SPINLOCK(udc_lock); | |||
76 | 76 | ||
77 | /* control endpoint description */ | 77 | /* control endpoint description */ |
78 | static const struct usb_endpoint_descriptor | 78 | static const struct usb_endpoint_descriptor |
79 | ctrl_endpt_desc = { | 79 | ctrl_endpt_out_desc = { |
80 | .bLength = USB_DT_ENDPOINT_SIZE, | 80 | .bLength = USB_DT_ENDPOINT_SIZE, |
81 | .bDescriptorType = USB_DT_ENDPOINT, | 81 | .bDescriptorType = USB_DT_ENDPOINT, |
82 | 82 | ||
83 | .bEndpointAddress = USB_DIR_OUT, | ||
84 | .bmAttributes = USB_ENDPOINT_XFER_CONTROL, | ||
85 | .wMaxPacketSize = cpu_to_le16(CTRL_PAYLOAD_MAX), | ||
86 | }; | ||
87 | |||
88 | static const struct usb_endpoint_descriptor | ||
89 | ctrl_endpt_in_desc = { | ||
90 | .bLength = USB_DT_ENDPOINT_SIZE, | ||
91 | .bDescriptorType = USB_DT_ENDPOINT, | ||
92 | |||
93 | .bEndpointAddress = USB_DIR_IN, | ||
83 | .bmAttributes = USB_ENDPOINT_XFER_CONTROL, | 94 | .bmAttributes = USB_ENDPOINT_XFER_CONTROL, |
84 | .wMaxPacketSize = cpu_to_le16(CTRL_PAYLOAD_MAX), | 95 | .wMaxPacketSize = cpu_to_le16(CTRL_PAYLOAD_MAX), |
85 | }; | 96 | }; |
@@ -265,10 +276,10 @@ static int hw_device_init(void __iomem *base) | |||
265 | hw_bank.size /= sizeof(u32); | 276 | hw_bank.size /= sizeof(u32); |
266 | 277 | ||
267 | reg = hw_aread(ABS_DCCPARAMS, DCCPARAMS_DEN) >> ffs_nr(DCCPARAMS_DEN); | 278 | reg = hw_aread(ABS_DCCPARAMS, DCCPARAMS_DEN) >> ffs_nr(DCCPARAMS_DEN); |
268 | if (reg == 0 || reg > ENDPT_MAX) | 279 | hw_ep_max = reg * 2; /* cache hw ENDPT_MAX */ |
269 | return -ENODEV; | ||
270 | 280 | ||
271 | hw_ep_max = reg; /* cache hw ENDPT_MAX */ | 281 | if (hw_ep_max == 0 || hw_ep_max > ENDPT_MAX) |
282 | return -ENODEV; | ||
272 | 283 | ||
273 | /* setup lock mode ? */ | 284 | /* setup lock mode ? */ |
274 | 285 | ||
@@ -1197,16 +1208,17 @@ static ssize_t show_qheads(struct device *dev, struct device_attribute *attr, | |||
1197 | } | 1208 | } |
1198 | 1209 | ||
1199 | spin_lock_irqsave(udc->lock, flags); | 1210 | spin_lock_irqsave(udc->lock, flags); |
1200 | for (i = 0; i < hw_ep_max; i++) { | 1211 | for (i = 0; i < hw_ep_max/2; i++) { |
1201 | struct ci13xxx_ep *mEp = &udc->ci13xxx_ep[i]; | 1212 | struct ci13xxx_ep *mEpRx = &udc->ci13xxx_ep[i]; |
1213 | struct ci13xxx_ep *mEpTx = &udc->ci13xxx_ep[i + hw_ep_max/2]; | ||
1202 | n += scnprintf(buf + n, PAGE_SIZE - n, | 1214 | n += scnprintf(buf + n, PAGE_SIZE - n, |
1203 | "EP=%02i: RX=%08X TX=%08X\n", | 1215 | "EP=%02i: RX=%08X TX=%08X\n", |
1204 | i, (u32)mEp->qh[RX].dma, (u32)mEp->qh[TX].dma); | 1216 | i, (u32)mEpRx->qh.dma, (u32)mEpTx->qh.dma); |
1205 | for (j = 0; j < (sizeof(struct ci13xxx_qh)/sizeof(u32)); j++) { | 1217 | for (j = 0; j < (sizeof(struct ci13xxx_qh)/sizeof(u32)); j++) { |
1206 | n += scnprintf(buf + n, PAGE_SIZE - n, | 1218 | n += scnprintf(buf + n, PAGE_SIZE - n, |
1207 | " %04X: %08X %08X\n", j, | 1219 | " %04X: %08X %08X\n", j, |
1208 | *((u32 *)mEp->qh[RX].ptr + j), | 1220 | *((u32 *)mEpRx->qh.ptr + j), |
1209 | *((u32 *)mEp->qh[TX].ptr + j)); | 1221 | *((u32 *)mEpTx->qh.ptr + j)); |
1210 | } | 1222 | } |
1211 | } | 1223 | } |
1212 | spin_unlock_irqrestore(udc->lock, flags); | 1224 | spin_unlock_irqrestore(udc->lock, flags); |
@@ -1293,7 +1305,7 @@ static ssize_t show_requests(struct device *dev, struct device_attribute *attr, | |||
1293 | unsigned long flags; | 1305 | unsigned long flags; |
1294 | struct list_head *ptr = NULL; | 1306 | struct list_head *ptr = NULL; |
1295 | struct ci13xxx_req *req = NULL; | 1307 | struct ci13xxx_req *req = NULL; |
1296 | unsigned i, j, k, n = 0, qSize = sizeof(struct ci13xxx_td)/sizeof(u32); | 1308 | unsigned i, j, n = 0, qSize = sizeof(struct ci13xxx_td)/sizeof(u32); |
1297 | 1309 | ||
1298 | dbg_trace("[%s] %p\n", __func__, buf); | 1310 | dbg_trace("[%s] %p\n", __func__, buf); |
1299 | if (attr == NULL || buf == NULL) { | 1311 | if (attr == NULL || buf == NULL) { |
@@ -1303,22 +1315,20 @@ static ssize_t show_requests(struct device *dev, struct device_attribute *attr, | |||
1303 | 1315 | ||
1304 | spin_lock_irqsave(udc->lock, flags); | 1316 | spin_lock_irqsave(udc->lock, flags); |
1305 | for (i = 0; i < hw_ep_max; i++) | 1317 | for (i = 0; i < hw_ep_max; i++) |
1306 | for (k = RX; k <= TX; k++) | 1318 | list_for_each(ptr, &udc->ci13xxx_ep[i].qh.queue) |
1307 | list_for_each(ptr, &udc->ci13xxx_ep[i].qh[k].queue) | 1319 | { |
1308 | { | 1320 | req = list_entry(ptr, struct ci13xxx_req, queue); |
1309 | req = list_entry(ptr, | 1321 | |
1310 | struct ci13xxx_req, queue); | 1322 | n += scnprintf(buf + n, PAGE_SIZE - n, |
1323 | "EP=%02i: TD=%08X %s\n", | ||
1324 | i % hw_ep_max/2, (u32)req->dma, | ||
1325 | ((i < hw_ep_max/2) ? "RX" : "TX")); | ||
1311 | 1326 | ||
1327 | for (j = 0; j < qSize; j++) | ||
1312 | n += scnprintf(buf + n, PAGE_SIZE - n, | 1328 | n += scnprintf(buf + n, PAGE_SIZE - n, |
1313 | "EP=%02i: TD=%08X %s\n", | 1329 | " %04X: %08X\n", j, |
1314 | i, (u32)req->dma, | 1330 | *((u32 *)req->ptr + j)); |
1315 | ((k == RX) ? "RX" : "TX")); | 1331 | } |
1316 | |||
1317 | for (j = 0; j < qSize; j++) | ||
1318 | n += scnprintf(buf + n, PAGE_SIZE - n, | ||
1319 | " %04X: %08X\n", j, | ||
1320 | *((u32 *)req->ptr + j)); | ||
1321 | } | ||
1322 | spin_unlock_irqrestore(udc->lock, flags); | 1332 | spin_unlock_irqrestore(udc->lock, flags); |
1323 | 1333 | ||
1324 | return n; | 1334 | return n; |
@@ -1467,12 +1477,12 @@ static int _hardware_enqueue(struct ci13xxx_ep *mEp, struct ci13xxx_req *mReq) | |||
1467 | * At this point it's guaranteed exclusive access to qhead | 1477 | * At this point it's guaranteed exclusive access to qhead |
1468 | * (endpt is not primed) so it's no need to use tripwire | 1478 | * (endpt is not primed) so it's no need to use tripwire |
1469 | */ | 1479 | */ |
1470 | mEp->qh[mEp->dir].ptr->td.next = mReq->dma; /* TERMINATE = 0 */ | 1480 | mEp->qh.ptr->td.next = mReq->dma; /* TERMINATE = 0 */ |
1471 | mEp->qh[mEp->dir].ptr->td.token &= ~TD_STATUS; /* clear status */ | 1481 | mEp->qh.ptr->td.token &= ~TD_STATUS; /* clear status */ |
1472 | if (mReq->req.zero == 0) | 1482 | if (mReq->req.zero == 0) |
1473 | mEp->qh[mEp->dir].ptr->cap |= QH_ZLT; | 1483 | mEp->qh.ptr->cap |= QH_ZLT; |
1474 | else | 1484 | else |
1475 | mEp->qh[mEp->dir].ptr->cap &= ~QH_ZLT; | 1485 | mEp->qh.ptr->cap &= ~QH_ZLT; |
1476 | 1486 | ||
1477 | wmb(); /* synchronize before ep prime */ | 1487 | wmb(); /* synchronize before ep prime */ |
1478 | 1488 | ||
@@ -1542,11 +1552,11 @@ __acquires(mEp->lock) | |||
1542 | 1552 | ||
1543 | hw_ep_flush(mEp->num, mEp->dir); | 1553 | hw_ep_flush(mEp->num, mEp->dir); |
1544 | 1554 | ||
1545 | while (!list_empty(&mEp->qh[mEp->dir].queue)) { | 1555 | while (!list_empty(&mEp->qh.queue)) { |
1546 | 1556 | ||
1547 | /* pop oldest request */ | 1557 | /* pop oldest request */ |
1548 | struct ci13xxx_req *mReq = \ | 1558 | struct ci13xxx_req *mReq = \ |
1549 | list_entry(mEp->qh[mEp->dir].queue.next, | 1559 | list_entry(mEp->qh.queue.next, |
1550 | struct ci13xxx_req, queue); | 1560 | struct ci13xxx_req, queue); |
1551 | list_del_init(&mReq->queue); | 1561 | list_del_init(&mReq->queue); |
1552 | mReq->req.status = -ESHUTDOWN; | 1562 | mReq->req.status = -ESHUTDOWN; |
@@ -1571,8 +1581,6 @@ static int _gadget_stop_activity(struct usb_gadget *gadget) | |||
1571 | { | 1581 | { |
1572 | struct usb_ep *ep; | 1582 | struct usb_ep *ep; |
1573 | struct ci13xxx *udc = container_of(gadget, struct ci13xxx, gadget); | 1583 | struct ci13xxx *udc = container_of(gadget, struct ci13xxx, gadget); |
1574 | struct ci13xxx_ep *mEp = container_of(gadget->ep0, | ||
1575 | struct ci13xxx_ep, ep); | ||
1576 | 1584 | ||
1577 | trace("%p", gadget); | 1585 | trace("%p", gadget); |
1578 | 1586 | ||
@@ -1583,7 +1591,8 @@ static int _gadget_stop_activity(struct usb_gadget *gadget) | |||
1583 | gadget_for_each_ep(ep, gadget) { | 1591 | gadget_for_each_ep(ep, gadget) { |
1584 | usb_ep_fifo_flush(ep); | 1592 | usb_ep_fifo_flush(ep); |
1585 | } | 1593 | } |
1586 | usb_ep_fifo_flush(gadget->ep0); | 1594 | usb_ep_fifo_flush(&udc->ep0out.ep); |
1595 | usb_ep_fifo_flush(&udc->ep0in.ep); | ||
1587 | 1596 | ||
1588 | udc->driver->disconnect(gadget); | 1597 | udc->driver->disconnect(gadget); |
1589 | 1598 | ||
@@ -1591,11 +1600,12 @@ static int _gadget_stop_activity(struct usb_gadget *gadget) | |||
1591 | gadget_for_each_ep(ep, gadget) { | 1600 | gadget_for_each_ep(ep, gadget) { |
1592 | usb_ep_disable(ep); | 1601 | usb_ep_disable(ep); |
1593 | } | 1602 | } |
1594 | usb_ep_disable(gadget->ep0); | 1603 | usb_ep_disable(&udc->ep0out.ep); |
1604 | usb_ep_disable(&udc->ep0in.ep); | ||
1595 | 1605 | ||
1596 | if (mEp->status != NULL) { | 1606 | if (udc->status != NULL) { |
1597 | usb_ep_free_request(gadget->ep0, mEp->status); | 1607 | usb_ep_free_request(&udc->ep0in.ep, udc->status); |
1598 | mEp->status = NULL; | 1608 | udc->status = NULL; |
1599 | } | 1609 | } |
1600 | 1610 | ||
1601 | return 0; | 1611 | return 0; |
@@ -1614,7 +1624,6 @@ static void isr_reset_handler(struct ci13xxx *udc) | |||
1614 | __releases(udc->lock) | 1624 | __releases(udc->lock) |
1615 | __acquires(udc->lock) | 1625 | __acquires(udc->lock) |
1616 | { | 1626 | { |
1617 | struct ci13xxx_ep *mEp = &udc->ci13xxx_ep[0]; | ||
1618 | int retval; | 1627 | int retval; |
1619 | 1628 | ||
1620 | trace("%p", udc); | 1629 | trace("%p", udc); |
@@ -1635,11 +1644,15 @@ __acquires(udc->lock) | |||
1635 | if (retval) | 1644 | if (retval) |
1636 | goto done; | 1645 | goto done; |
1637 | 1646 | ||
1638 | retval = usb_ep_enable(&mEp->ep, &ctrl_endpt_desc); | 1647 | retval = usb_ep_enable(&udc->ep0out.ep, &ctrl_endpt_out_desc); |
1648 | if (retval) | ||
1649 | goto done; | ||
1650 | |||
1651 | retval = usb_ep_enable(&udc->ep0in.ep, &ctrl_endpt_in_desc); | ||
1639 | if (!retval) { | 1652 | if (!retval) { |
1640 | mEp->status = usb_ep_alloc_request(&mEp->ep, GFP_ATOMIC); | 1653 | udc->status = usb_ep_alloc_request(&udc->ep0in.ep, GFP_ATOMIC); |
1641 | if (mEp->status == NULL) { | 1654 | if (udc->status == NULL) { |
1642 | usb_ep_disable(&mEp->ep); | 1655 | usb_ep_disable(&udc->ep0out.ep); |
1643 | retval = -ENOMEM; | 1656 | retval = -ENOMEM; |
1644 | } | 1657 | } |
1645 | } | 1658 | } |
@@ -1672,16 +1685,17 @@ static void isr_get_status_complete(struct usb_ep *ep, struct usb_request *req) | |||
1672 | 1685 | ||
1673 | /** | 1686 | /** |
1674 | * isr_get_status_response: get_status request response | 1687 | * isr_get_status_response: get_status request response |
1675 | * @ep: endpoint | 1688 | * @udc: udc struct |
1676 | * @setup: setup request packet | 1689 | * @setup: setup request packet |
1677 | * | 1690 | * |
1678 | * This function returns an error code | 1691 | * This function returns an error code |
1679 | */ | 1692 | */ |
1680 | static int isr_get_status_response(struct ci13xxx_ep *mEp, | 1693 | static int isr_get_status_response(struct ci13xxx *udc, |
1681 | struct usb_ctrlrequest *setup) | 1694 | struct usb_ctrlrequest *setup) |
1682 | __releases(mEp->lock) | 1695 | __releases(mEp->lock) |
1683 | __acquires(mEp->lock) | 1696 | __acquires(mEp->lock) |
1684 | { | 1697 | { |
1698 | struct ci13xxx_ep *mEp = &udc->ep0in; | ||
1685 | struct usb_request *req = NULL; | 1699 | struct usb_request *req = NULL; |
1686 | gfp_t gfp_flags = GFP_ATOMIC; | 1700 | gfp_t gfp_flags = GFP_ATOMIC; |
1687 | int dir, num, retval; | 1701 | int dir, num, retval; |
@@ -1736,27 +1750,23 @@ __acquires(mEp->lock) | |||
1736 | 1750 | ||
1737 | /** | 1751 | /** |
1738 | * isr_setup_status_phase: queues the status phase of a setup transation | 1752 | * isr_setup_status_phase: queues the status phase of a setup transation |
1739 | * @mEp: endpoint | 1753 | * @udc: udc struct |
1740 | * | 1754 | * |
1741 | * This function returns an error code | 1755 | * This function returns an error code |
1742 | */ | 1756 | */ |
1743 | static int isr_setup_status_phase(struct ci13xxx_ep *mEp) | 1757 | static int isr_setup_status_phase(struct ci13xxx *udc) |
1744 | __releases(mEp->lock) | 1758 | __releases(mEp->lock) |
1745 | __acquires(mEp->lock) | 1759 | __acquires(mEp->lock) |
1746 | { | 1760 | { |
1747 | int retval; | 1761 | int retval; |
1762 | struct ci13xxx_ep *mEp; | ||
1748 | 1763 | ||
1749 | trace("%p", mEp); | 1764 | trace("%p", udc); |
1750 | |||
1751 | /* mEp is always valid & configured */ | ||
1752 | |||
1753 | if (mEp->type == USB_ENDPOINT_XFER_CONTROL) | ||
1754 | mEp->dir = (mEp->dir == TX) ? RX : TX; | ||
1755 | 1765 | ||
1756 | mEp->status->no_interrupt = 1; | 1766 | mEp = (udc->ep0_dir == TX) ? &udc->ep0out : &udc->ep0in; |
1757 | 1767 | ||
1758 | spin_unlock(mEp->lock); | 1768 | spin_unlock(mEp->lock); |
1759 | retval = usb_ep_queue(&mEp->ep, mEp->status, GFP_ATOMIC); | 1769 | retval = usb_ep_queue(&mEp->ep, udc->status, GFP_ATOMIC); |
1760 | spin_lock(mEp->lock); | 1770 | spin_lock(mEp->lock); |
1761 | 1771 | ||
1762 | return retval; | 1772 | return retval; |
@@ -1778,11 +1788,11 @@ __acquires(mEp->lock) | |||
1778 | 1788 | ||
1779 | trace("%p", mEp); | 1789 | trace("%p", mEp); |
1780 | 1790 | ||
1781 | if (list_empty(&mEp->qh[mEp->dir].queue)) | 1791 | if (list_empty(&mEp->qh.queue)) |
1782 | return -EINVAL; | 1792 | return -EINVAL; |
1783 | 1793 | ||
1784 | /* pop oldest request */ | 1794 | /* pop oldest request */ |
1785 | mReq = list_entry(mEp->qh[mEp->dir].queue.next, | 1795 | mReq = list_entry(mEp->qh.queue.next, |
1786 | struct ci13xxx_req, queue); | 1796 | struct ci13xxx_req, queue); |
1787 | list_del_init(&mReq->queue); | 1797 | list_del_init(&mReq->queue); |
1788 | 1798 | ||
@@ -1794,10 +1804,10 @@ __acquires(mEp->lock) | |||
1794 | 1804 | ||
1795 | dbg_done(_usb_addr(mEp), mReq->ptr->token, retval); | 1805 | dbg_done(_usb_addr(mEp), mReq->ptr->token, retval); |
1796 | 1806 | ||
1797 | if (!list_empty(&mEp->qh[mEp->dir].queue)) { | 1807 | if (!list_empty(&mEp->qh.queue)) { |
1798 | struct ci13xxx_req* mReqEnq; | 1808 | struct ci13xxx_req* mReqEnq; |
1799 | 1809 | ||
1800 | mReqEnq = list_entry(mEp->qh[mEp->dir].queue.next, | 1810 | mReqEnq = list_entry(mEp->qh.queue.next, |
1801 | struct ci13xxx_req, queue); | 1811 | struct ci13xxx_req, queue); |
1802 | _hardware_enqueue(mEp, mReqEnq); | 1812 | _hardware_enqueue(mEp, mReqEnq); |
1803 | } | 1813 | } |
@@ -1836,16 +1846,14 @@ __acquires(udc->lock) | |||
1836 | int type, num, err = -EINVAL; | 1846 | int type, num, err = -EINVAL; |
1837 | struct usb_ctrlrequest req; | 1847 | struct usb_ctrlrequest req; |
1838 | 1848 | ||
1839 | |||
1840 | if (mEp->desc == NULL) | 1849 | if (mEp->desc == NULL) |
1841 | continue; /* not configured */ | 1850 | continue; /* not configured */ |
1842 | 1851 | ||
1843 | if ((mEp->dir == RX && hw_test_and_clear_complete(i)) || | 1852 | if (hw_test_and_clear_complete(i)) { |
1844 | (mEp->dir == TX && hw_test_and_clear_complete(i + 16))) { | ||
1845 | err = isr_tr_complete_low(mEp); | 1853 | err = isr_tr_complete_low(mEp); |
1846 | if (mEp->type == USB_ENDPOINT_XFER_CONTROL) { | 1854 | if (mEp->type == USB_ENDPOINT_XFER_CONTROL) { |
1847 | if (err > 0) /* needs status phase */ | 1855 | if (err > 0) /* needs status phase */ |
1848 | err = isr_setup_status_phase(mEp); | 1856 | err = isr_setup_status_phase(udc); |
1849 | if (err < 0) { | 1857 | if (err < 0) { |
1850 | dbg_event(_usb_addr(mEp), | 1858 | dbg_event(_usb_addr(mEp), |
1851 | "ERROR", err); | 1859 | "ERROR", err); |
@@ -1866,15 +1874,22 @@ __acquires(udc->lock) | |||
1866 | continue; | 1874 | continue; |
1867 | } | 1875 | } |
1868 | 1876 | ||
1877 | /* | ||
1878 | * Flush data and handshake transactions of previous | ||
1879 | * setup packet. | ||
1880 | */ | ||
1881 | _ep_nuke(&udc->ep0out); | ||
1882 | _ep_nuke(&udc->ep0in); | ||
1883 | |||
1869 | /* read_setup_packet */ | 1884 | /* read_setup_packet */ |
1870 | do { | 1885 | do { |
1871 | hw_test_and_set_setup_guard(); | 1886 | hw_test_and_set_setup_guard(); |
1872 | memcpy(&req, &mEp->qh[RX].ptr->setup, sizeof(req)); | 1887 | memcpy(&req, &mEp->qh.ptr->setup, sizeof(req)); |
1873 | } while (!hw_test_and_clear_setup_guard()); | 1888 | } while (!hw_test_and_clear_setup_guard()); |
1874 | 1889 | ||
1875 | type = req.bRequestType; | 1890 | type = req.bRequestType; |
1876 | 1891 | ||
1877 | mEp->dir = (type & USB_DIR_IN) ? TX : RX; | 1892 | udc->ep0_dir = (type & USB_DIR_IN) ? TX : RX; |
1878 | 1893 | ||
1879 | dbg_setup(_usb_addr(mEp), &req); | 1894 | dbg_setup(_usb_addr(mEp), &req); |
1880 | 1895 | ||
@@ -1895,7 +1910,7 @@ __acquires(udc->lock) | |||
1895 | if (err) | 1910 | if (err) |
1896 | break; | 1911 | break; |
1897 | } | 1912 | } |
1898 | err = isr_setup_status_phase(mEp); | 1913 | err = isr_setup_status_phase(udc); |
1899 | break; | 1914 | break; |
1900 | case USB_REQ_GET_STATUS: | 1915 | case USB_REQ_GET_STATUS: |
1901 | if (type != (USB_DIR_IN|USB_RECIP_DEVICE) && | 1916 | if (type != (USB_DIR_IN|USB_RECIP_DEVICE) && |
@@ -1905,7 +1920,7 @@ __acquires(udc->lock) | |||
1905 | if (le16_to_cpu(req.wLength) != 2 || | 1920 | if (le16_to_cpu(req.wLength) != 2 || |
1906 | le16_to_cpu(req.wValue) != 0) | 1921 | le16_to_cpu(req.wValue) != 0) |
1907 | break; | 1922 | break; |
1908 | err = isr_get_status_response(mEp, &req); | 1923 | err = isr_get_status_response(udc, &req); |
1909 | break; | 1924 | break; |
1910 | case USB_REQ_SET_ADDRESS: | 1925 | case USB_REQ_SET_ADDRESS: |
1911 | if (type != (USB_DIR_OUT|USB_RECIP_DEVICE)) | 1926 | if (type != (USB_DIR_OUT|USB_RECIP_DEVICE)) |
@@ -1916,7 +1931,7 @@ __acquires(udc->lock) | |||
1916 | err = hw_usb_set_address((u8)le16_to_cpu(req.wValue)); | 1931 | err = hw_usb_set_address((u8)le16_to_cpu(req.wValue)); |
1917 | if (err) | 1932 | if (err) |
1918 | break; | 1933 | break; |
1919 | err = isr_setup_status_phase(mEp); | 1934 | err = isr_setup_status_phase(udc); |
1920 | break; | 1935 | break; |
1921 | case USB_REQ_SET_FEATURE: | 1936 | case USB_REQ_SET_FEATURE: |
1922 | if (type != (USB_DIR_OUT|USB_RECIP_ENDPOINT) && | 1937 | if (type != (USB_DIR_OUT|USB_RECIP_ENDPOINT) && |
@@ -1932,12 +1947,12 @@ __acquires(udc->lock) | |||
1932 | spin_lock(udc->lock); | 1947 | spin_lock(udc->lock); |
1933 | if (err) | 1948 | if (err) |
1934 | break; | 1949 | break; |
1935 | err = isr_setup_status_phase(mEp); | 1950 | err = isr_setup_status_phase(udc); |
1936 | break; | 1951 | break; |
1937 | default: | 1952 | default: |
1938 | delegate: | 1953 | delegate: |
1939 | if (req.wLength == 0) /* no data phase */ | 1954 | if (req.wLength == 0) /* no data phase */ |
1940 | mEp->dir = TX; | 1955 | udc->ep0_dir = TX; |
1941 | 1956 | ||
1942 | spin_unlock(udc->lock); | 1957 | spin_unlock(udc->lock); |
1943 | err = udc->driver->setup(&udc->gadget, &req); | 1958 | err = udc->driver->setup(&udc->gadget, &req); |
@@ -1968,7 +1983,7 @@ static int ep_enable(struct usb_ep *ep, | |||
1968 | const struct usb_endpoint_descriptor *desc) | 1983 | const struct usb_endpoint_descriptor *desc) |
1969 | { | 1984 | { |
1970 | struct ci13xxx_ep *mEp = container_of(ep, struct ci13xxx_ep, ep); | 1985 | struct ci13xxx_ep *mEp = container_of(ep, struct ci13xxx_ep, ep); |
1971 | int direction, retval = 0; | 1986 | int retval = 0; |
1972 | unsigned long flags; | 1987 | unsigned long flags; |
1973 | 1988 | ||
1974 | trace("%p, %p", ep, desc); | 1989 | trace("%p, %p", ep, desc); |
@@ -1982,7 +1997,7 @@ static int ep_enable(struct usb_ep *ep, | |||
1982 | 1997 | ||
1983 | mEp->desc = desc; | 1998 | mEp->desc = desc; |
1984 | 1999 | ||
1985 | if (!list_empty(&mEp->qh[mEp->dir].queue)) | 2000 | if (!list_empty(&mEp->qh.queue)) |
1986 | warn("enabling a non-empty endpoint!"); | 2001 | warn("enabling a non-empty endpoint!"); |
1987 | 2002 | ||
1988 | mEp->dir = usb_endpoint_dir_in(desc) ? TX : RX; | 2003 | mEp->dir = usb_endpoint_dir_in(desc) ? TX : RX; |
@@ -1991,29 +2006,22 @@ static int ep_enable(struct usb_ep *ep, | |||
1991 | 2006 | ||
1992 | mEp->ep.maxpacket = __constant_le16_to_cpu(desc->wMaxPacketSize); | 2007 | mEp->ep.maxpacket = __constant_le16_to_cpu(desc->wMaxPacketSize); |
1993 | 2008 | ||
1994 | direction = mEp->dir; | 2009 | dbg_event(_usb_addr(mEp), "ENABLE", 0); |
1995 | do { | ||
1996 | dbg_event(_usb_addr(mEp), "ENABLE", 0); | ||
1997 | 2010 | ||
1998 | mEp->qh[mEp->dir].ptr->cap = 0; | 2011 | mEp->qh.ptr->cap = 0; |
1999 | 2012 | ||
2000 | if (mEp->type == USB_ENDPOINT_XFER_CONTROL) | 2013 | if (mEp->type == USB_ENDPOINT_XFER_CONTROL) |
2001 | mEp->qh[mEp->dir].ptr->cap |= QH_IOS; | 2014 | mEp->qh.ptr->cap |= QH_IOS; |
2002 | else if (mEp->type == USB_ENDPOINT_XFER_ISOC) | 2015 | else if (mEp->type == USB_ENDPOINT_XFER_ISOC) |
2003 | mEp->qh[mEp->dir].ptr->cap &= ~QH_MULT; | 2016 | mEp->qh.ptr->cap &= ~QH_MULT; |
2004 | else | 2017 | else |
2005 | mEp->qh[mEp->dir].ptr->cap &= ~QH_ZLT; | 2018 | mEp->qh.ptr->cap &= ~QH_ZLT; |
2006 | |||
2007 | mEp->qh[mEp->dir].ptr->cap |= | ||
2008 | (mEp->ep.maxpacket << ffs_nr(QH_MAX_PKT)) & QH_MAX_PKT; | ||
2009 | mEp->qh[mEp->dir].ptr->td.next |= TD_TERMINATE; /* needed? */ | ||
2010 | |||
2011 | retval |= hw_ep_enable(mEp->num, mEp->dir, mEp->type); | ||
2012 | 2019 | ||
2013 | if (mEp->type == USB_ENDPOINT_XFER_CONTROL) | 2020 | mEp->qh.ptr->cap |= |
2014 | mEp->dir = (mEp->dir == TX) ? RX : TX; | 2021 | (mEp->ep.maxpacket << ffs_nr(QH_MAX_PKT)) & QH_MAX_PKT; |
2022 | mEp->qh.ptr->td.next |= TD_TERMINATE; /* needed? */ | ||
2015 | 2023 | ||
2016 | } while (mEp->dir != direction); | 2024 | retval |= hw_ep_enable(mEp->num, mEp->dir, mEp->type); |
2017 | 2025 | ||
2018 | spin_unlock_irqrestore(mEp->lock, flags); | 2026 | spin_unlock_irqrestore(mEp->lock, flags); |
2019 | return retval; | 2027 | return retval; |
@@ -2146,7 +2154,7 @@ static int ep_queue(struct usb_ep *ep, struct usb_request *req, | |||
2146 | spin_lock_irqsave(mEp->lock, flags); | 2154 | spin_lock_irqsave(mEp->lock, flags); |
2147 | 2155 | ||
2148 | if (mEp->type == USB_ENDPOINT_XFER_CONTROL && | 2156 | if (mEp->type == USB_ENDPOINT_XFER_CONTROL && |
2149 | !list_empty(&mEp->qh[mEp->dir].queue)) { | 2157 | !list_empty(&mEp->qh.queue)) { |
2150 | _ep_nuke(mEp); | 2158 | _ep_nuke(mEp); |
2151 | retval = -EOVERFLOW; | 2159 | retval = -EOVERFLOW; |
2152 | warn("endpoint ctrl %X nuked", _usb_addr(mEp)); | 2160 | warn("endpoint ctrl %X nuked", _usb_addr(mEp)); |
@@ -2170,9 +2178,9 @@ static int ep_queue(struct usb_ep *ep, struct usb_request *req, | |||
2170 | /* push request */ | 2178 | /* push request */ |
2171 | mReq->req.status = -EINPROGRESS; | 2179 | mReq->req.status = -EINPROGRESS; |
2172 | mReq->req.actual = 0; | 2180 | mReq->req.actual = 0; |
2173 | list_add_tail(&mReq->queue, &mEp->qh[mEp->dir].queue); | 2181 | list_add_tail(&mReq->queue, &mEp->qh.queue); |
2174 | 2182 | ||
2175 | if (list_is_singular(&mEp->qh[mEp->dir].queue)) | 2183 | if (list_is_singular(&mEp->qh.queue)) |
2176 | retval = _hardware_enqueue(mEp, mReq); | 2184 | retval = _hardware_enqueue(mEp, mReq); |
2177 | 2185 | ||
2178 | if (retval == -EALREADY) { | 2186 | if (retval == -EALREADY) { |
@@ -2199,7 +2207,7 @@ static int ep_dequeue(struct usb_ep *ep, struct usb_request *req) | |||
2199 | trace("%p, %p", ep, req); | 2207 | trace("%p, %p", ep, req); |
2200 | 2208 | ||
2201 | if (ep == NULL || req == NULL || mEp->desc == NULL || | 2209 | if (ep == NULL || req == NULL || mEp->desc == NULL || |
2202 | list_empty(&mReq->queue) || list_empty(&mEp->qh[mEp->dir].queue)) | 2210 | list_empty(&mReq->queue) || list_empty(&mEp->qh.queue)) |
2203 | return -EINVAL; | 2211 | return -EINVAL; |
2204 | 2212 | ||
2205 | spin_lock_irqsave(mEp->lock, flags); | 2213 | spin_lock_irqsave(mEp->lock, flags); |
@@ -2244,7 +2252,7 @@ static int ep_set_halt(struct usb_ep *ep, int value) | |||
2244 | #ifndef STALL_IN | 2252 | #ifndef STALL_IN |
2245 | /* g_file_storage MS compliant but g_zero fails chapter 9 compliance */ | 2253 | /* g_file_storage MS compliant but g_zero fails chapter 9 compliance */ |
2246 | if (value && mEp->type == USB_ENDPOINT_XFER_BULK && mEp->dir == TX && | 2254 | if (value && mEp->type == USB_ENDPOINT_XFER_BULK && mEp->dir == TX && |
2247 | !list_empty(&mEp->qh[mEp->dir].queue)) { | 2255 | !list_empty(&mEp->qh.queue)) { |
2248 | spin_unlock_irqrestore(mEp->lock, flags); | 2256 | spin_unlock_irqrestore(mEp->lock, flags); |
2249 | return -EAGAIN; | 2257 | return -EAGAIN; |
2250 | } | 2258 | } |
@@ -2355,7 +2363,7 @@ static int ci13xxx_vbus_session(struct usb_gadget *_gadget, int is_active) | |||
2355 | if (is_active) { | 2363 | if (is_active) { |
2356 | pm_runtime_get_sync(&_gadget->dev); | 2364 | pm_runtime_get_sync(&_gadget->dev); |
2357 | hw_device_reset(udc); | 2365 | hw_device_reset(udc); |
2358 | hw_device_state(udc->ci13xxx_ep[0].qh[RX].dma); | 2366 | hw_device_state(udc->ep0out.qh.dma); |
2359 | } else { | 2367 | } else { |
2360 | hw_device_state(0); | 2368 | hw_device_state(0); |
2361 | if (udc->udc_driver->notify_event) | 2369 | if (udc->udc_driver->notify_event) |
@@ -2390,7 +2398,8 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver, | |||
2390 | int (*bind)(struct usb_gadget *)) | 2398 | int (*bind)(struct usb_gadget *)) |
2391 | { | 2399 | { |
2392 | struct ci13xxx *udc = _udc; | 2400 | struct ci13xxx *udc = _udc; |
2393 | unsigned long i, k, flags; | 2401 | unsigned long flags; |
2402 | int i, j; | ||
2394 | int retval = -ENOMEM; | 2403 | int retval = -ENOMEM; |
2395 | 2404 | ||
2396 | trace("%p", driver); | 2405 | trace("%p", driver); |
@@ -2427,45 +2436,46 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver, | |||
2427 | 2436 | ||
2428 | info("hw_ep_max = %d", hw_ep_max); | 2437 | info("hw_ep_max = %d", hw_ep_max); |
2429 | 2438 | ||
2430 | udc->driver = driver; | ||
2431 | udc->gadget.dev.driver = NULL; | 2439 | udc->gadget.dev.driver = NULL; |
2432 | 2440 | ||
2433 | retval = 0; | 2441 | retval = 0; |
2434 | for (i = 0; i < hw_ep_max; i++) { | 2442 | for (i = 0; i < hw_ep_max/2; i++) { |
2435 | struct ci13xxx_ep *mEp = &udc->ci13xxx_ep[i]; | 2443 | for (j = RX; j <= TX; j++) { |
2444 | int k = i + j * hw_ep_max/2; | ||
2445 | struct ci13xxx_ep *mEp = &udc->ci13xxx_ep[k]; | ||
2436 | 2446 | ||
2437 | scnprintf(mEp->name, sizeof(mEp->name), "ep%i", (int)i); | 2447 | scnprintf(mEp->name, sizeof(mEp->name), "ep%i%s", i, |
2448 | (j == TX) ? "in" : "out"); | ||
2438 | 2449 | ||
2439 | mEp->lock = udc->lock; | 2450 | mEp->lock = udc->lock; |
2440 | mEp->device = &udc->gadget.dev; | 2451 | mEp->device = &udc->gadget.dev; |
2441 | mEp->td_pool = udc->td_pool; | 2452 | mEp->td_pool = udc->td_pool; |
2442 | 2453 | ||
2443 | mEp->ep.name = mEp->name; | 2454 | mEp->ep.name = mEp->name; |
2444 | mEp->ep.ops = &usb_ep_ops; | 2455 | mEp->ep.ops = &usb_ep_ops; |
2445 | mEp->ep.maxpacket = CTRL_PAYLOAD_MAX; | 2456 | mEp->ep.maxpacket = CTRL_PAYLOAD_MAX; |
2446 | 2457 | ||
2447 | /* this allocation cannot be random */ | 2458 | INIT_LIST_HEAD(&mEp->qh.queue); |
2448 | for (k = RX; k <= TX; k++) { | ||
2449 | INIT_LIST_HEAD(&mEp->qh[k].queue); | ||
2450 | spin_unlock_irqrestore(udc->lock, flags); | 2459 | spin_unlock_irqrestore(udc->lock, flags); |
2451 | mEp->qh[k].ptr = dma_pool_alloc(udc->qh_pool, | 2460 | mEp->qh.ptr = dma_pool_alloc(udc->qh_pool, GFP_KERNEL, |
2452 | GFP_KERNEL, | 2461 | &mEp->qh.dma); |
2453 | &mEp->qh[k].dma); | ||
2454 | spin_lock_irqsave(udc->lock, flags); | 2462 | spin_lock_irqsave(udc->lock, flags); |
2455 | if (mEp->qh[k].ptr == NULL) | 2463 | if (mEp->qh.ptr == NULL) |
2456 | retval = -ENOMEM; | 2464 | retval = -ENOMEM; |
2457 | else | 2465 | else |
2458 | memset(mEp->qh[k].ptr, 0, | 2466 | memset(mEp->qh.ptr, 0, sizeof(*mEp->qh.ptr)); |
2459 | sizeof(*mEp->qh[k].ptr)); | 2467 | |
2460 | } | 2468 | /* skip ep0 out and in endpoints */ |
2461 | if (i == 0) | 2469 | if (i == 0) |
2462 | udc->gadget.ep0 = &mEp->ep; | 2470 | continue; |
2463 | else | 2471 | |
2464 | list_add_tail(&mEp->ep.ep_list, &udc->gadget.ep_list); | 2472 | list_add_tail(&mEp->ep.ep_list, &udc->gadget.ep_list); |
2473 | } | ||
2465 | } | 2474 | } |
2466 | if (retval) | 2475 | if (retval) |
2467 | goto done; | 2476 | goto done; |
2468 | 2477 | ||
2478 | udc->gadget.ep0 = &udc->ep0in.ep; | ||
2469 | /* bind gadget */ | 2479 | /* bind gadget */ |
2470 | driver->driver.bus = NULL; | 2480 | driver->driver.bus = NULL; |
2471 | udc->gadget.dev.driver = &driver->driver; | 2481 | udc->gadget.dev.driver = &driver->driver; |
@@ -2479,6 +2489,7 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver, | |||
2479 | goto done; | 2489 | goto done; |
2480 | } | 2490 | } |
2481 | 2491 | ||
2492 | udc->driver = driver; | ||
2482 | pm_runtime_get_sync(&udc->gadget.dev); | 2493 | pm_runtime_get_sync(&udc->gadget.dev); |
2483 | if (udc->udc_driver->flags & CI13XXX_PULLUP_ON_VBUS) { | 2494 | if (udc->udc_driver->flags & CI13XXX_PULLUP_ON_VBUS) { |
2484 | if (udc->vbus_active) { | 2495 | if (udc->vbus_active) { |
@@ -2490,14 +2501,12 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver, | |||
2490 | } | 2501 | } |
2491 | } | 2502 | } |
2492 | 2503 | ||
2493 | retval = hw_device_state(udc->ci13xxx_ep[0].qh[RX].dma); | 2504 | retval = hw_device_state(udc->ep0out.qh.dma); |
2494 | if (retval) | 2505 | if (retval) |
2495 | pm_runtime_put_sync(&udc->gadget.dev); | 2506 | pm_runtime_put_sync(&udc->gadget.dev); |
2496 | 2507 | ||
2497 | done: | 2508 | done: |
2498 | spin_unlock_irqrestore(udc->lock, flags); | 2509 | spin_unlock_irqrestore(udc->lock, flags); |
2499 | if (retval) | ||
2500 | usb_gadget_unregister_driver(driver); | ||
2501 | return retval; | 2510 | return retval; |
2502 | } | 2511 | } |
2503 | EXPORT_SYMBOL(usb_gadget_probe_driver); | 2512 | EXPORT_SYMBOL(usb_gadget_probe_driver); |
@@ -2510,7 +2519,7 @@ EXPORT_SYMBOL(usb_gadget_probe_driver); | |||
2510 | int usb_gadget_unregister_driver(struct usb_gadget_driver *driver) | 2519 | int usb_gadget_unregister_driver(struct usb_gadget_driver *driver) |
2511 | { | 2520 | { |
2512 | struct ci13xxx *udc = _udc; | 2521 | struct ci13xxx *udc = _udc; |
2513 | unsigned long i, k, flags; | 2522 | unsigned long i, flags; |
2514 | 2523 | ||
2515 | trace("%p", driver); | 2524 | trace("%p", driver); |
2516 | 2525 | ||
@@ -2546,17 +2555,14 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver) | |||
2546 | for (i = 0; i < hw_ep_max; i++) { | 2555 | for (i = 0; i < hw_ep_max; i++) { |
2547 | struct ci13xxx_ep *mEp = &udc->ci13xxx_ep[i]; | 2556 | struct ci13xxx_ep *mEp = &udc->ci13xxx_ep[i]; |
2548 | 2557 | ||
2549 | if (i == 0) | 2558 | if (!list_empty(&mEp->ep.ep_list)) |
2550 | udc->gadget.ep0 = NULL; | ||
2551 | else if (!list_empty(&mEp->ep.ep_list)) | ||
2552 | list_del_init(&mEp->ep.ep_list); | 2559 | list_del_init(&mEp->ep.ep_list); |
2553 | 2560 | ||
2554 | for (k = RX; k <= TX; k++) | 2561 | if (mEp->qh.ptr != NULL) |
2555 | if (mEp->qh[k].ptr != NULL) | 2562 | dma_pool_free(udc->qh_pool, mEp->qh.ptr, mEp->qh.dma); |
2556 | dma_pool_free(udc->qh_pool, | ||
2557 | mEp->qh[k].ptr, mEp->qh[k].dma); | ||
2558 | } | 2563 | } |
2559 | 2564 | ||
2565 | udc->gadget.ep0 = NULL; | ||
2560 | udc->driver = NULL; | 2566 | udc->driver = NULL; |
2561 | 2567 | ||
2562 | spin_unlock_irqrestore(udc->lock, flags); | 2568 | spin_unlock_irqrestore(udc->lock, flags); |
diff --git a/drivers/usb/gadget/ci13xxx_udc.h b/drivers/usb/gadget/ci13xxx_udc.h index f61fed07f76b..a2492b65f98c 100644 --- a/drivers/usb/gadget/ci13xxx_udc.h +++ b/drivers/usb/gadget/ci13xxx_udc.h | |||
@@ -20,7 +20,7 @@ | |||
20 | * DEFINE | 20 | * DEFINE |
21 | *****************************************************************************/ | 21 | *****************************************************************************/ |
22 | #define CI13XXX_PAGE_SIZE 4096ul /* page size for TD's */ | 22 | #define CI13XXX_PAGE_SIZE 4096ul /* page size for TD's */ |
23 | #define ENDPT_MAX (16) | 23 | #define ENDPT_MAX (32) |
24 | #define CTRL_PAYLOAD_MAX (64) | 24 | #define CTRL_PAYLOAD_MAX (64) |
25 | #define RX (0) /* similar to USB_DIR_OUT but can be used as an index */ | 25 | #define RX (0) /* similar to USB_DIR_OUT but can be used as an index */ |
26 | #define TX (1) /* similar to USB_DIR_IN but can be used as an index */ | 26 | #define TX (1) /* similar to USB_DIR_IN but can be used as an index */ |
@@ -88,8 +88,7 @@ struct ci13xxx_ep { | |||
88 | struct list_head queue; | 88 | struct list_head queue; |
89 | struct ci13xxx_qh *ptr; | 89 | struct ci13xxx_qh *ptr; |
90 | dma_addr_t dma; | 90 | dma_addr_t dma; |
91 | } qh[2]; | 91 | } qh; |
92 | struct usb_request *status; | ||
93 | int wedge; | 92 | int wedge; |
94 | 93 | ||
95 | /* global resources */ | 94 | /* global resources */ |
@@ -119,9 +118,13 @@ struct ci13xxx { | |||
119 | 118 | ||
120 | struct dma_pool *qh_pool; /* DMA pool for queue heads */ | 119 | struct dma_pool *qh_pool; /* DMA pool for queue heads */ |
121 | struct dma_pool *td_pool; /* DMA pool for transfer descs */ | 120 | struct dma_pool *td_pool; /* DMA pool for transfer descs */ |
121 | struct usb_request *status; /* ep0 status request */ | ||
122 | 122 | ||
123 | struct usb_gadget gadget; /* USB slave device */ | 123 | struct usb_gadget gadget; /* USB slave device */ |
124 | struct ci13xxx_ep ci13xxx_ep[ENDPT_MAX]; /* extended endpts */ | 124 | struct ci13xxx_ep ci13xxx_ep[ENDPT_MAX]; /* extended endpts */ |
125 | u32 ep0_dir; /* ep0 direction */ | ||
126 | #define ep0out ci13xxx_ep[0] | ||
127 | #define ep0in ci13xxx_ep[16] | ||
125 | 128 | ||
126 | struct usb_gadget_driver *driver; /* 3rd party gadget driver */ | 129 | struct usb_gadget_driver *driver; /* 3rd party gadget driver */ |
127 | struct ci13xxx_udc_driver *udc_driver; /* device controller driver */ | 130 | struct ci13xxx_udc_driver *udc_driver; /* device controller driver */ |
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index f6ff8456d52d..1ba4befe336b 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c | |||
@@ -928,8 +928,9 @@ unknown: | |||
928 | */ | 928 | */ |
929 | switch (ctrl->bRequestType & USB_RECIP_MASK) { | 929 | switch (ctrl->bRequestType & USB_RECIP_MASK) { |
930 | case USB_RECIP_INTERFACE: | 930 | case USB_RECIP_INTERFACE: |
931 | if (cdev->config) | 931 | if (!cdev->config || w_index >= MAX_CONFIG_INTERFACES) |
932 | f = cdev->config->interface[intf]; | 932 | break; |
933 | f = cdev->config->interface[intf]; | ||
933 | break; | 934 | break; |
934 | 935 | ||
935 | case USB_RECIP_ENDPOINT: | 936 | case USB_RECIP_ENDPOINT: |
diff --git a/drivers/usb/gadget/pch_udc.c b/drivers/usb/gadget/pch_udc.c index 0c8dd81dddca..b120dbb64d0f 100644 --- a/drivers/usb/gadget/pch_udc.c +++ b/drivers/usb/gadget/pch_udc.c | |||
@@ -198,10 +198,10 @@ | |||
198 | #define PCH_UDC_BRLEN 0x0F /* Burst length */ | 198 | #define PCH_UDC_BRLEN 0x0F /* Burst length */ |
199 | #define PCH_UDC_THLEN 0x1F /* Threshold length */ | 199 | #define PCH_UDC_THLEN 0x1F /* Threshold length */ |
200 | /* Value of EP Buffer Size */ | 200 | /* Value of EP Buffer Size */ |
201 | #define UDC_EP0IN_BUFF_SIZE 64 | 201 | #define UDC_EP0IN_BUFF_SIZE 16 |
202 | #define UDC_EPIN_BUFF_SIZE 512 | 202 | #define UDC_EPIN_BUFF_SIZE 256 |
203 | #define UDC_EP0OUT_BUFF_SIZE 64 | 203 | #define UDC_EP0OUT_BUFF_SIZE 16 |
204 | #define UDC_EPOUT_BUFF_SIZE 512 | 204 | #define UDC_EPOUT_BUFF_SIZE 256 |
205 | /* Value of EP maximum packet size */ | 205 | /* Value of EP maximum packet size */ |
206 | #define UDC_EP0IN_MAX_PKT_SIZE 64 | 206 | #define UDC_EP0IN_MAX_PKT_SIZE 64 |
207 | #define UDC_EP0OUT_MAX_PKT_SIZE 64 | 207 | #define UDC_EP0OUT_MAX_PKT_SIZE 64 |
@@ -351,7 +351,7 @@ struct pch_udc_dev { | |||
351 | struct pci_pool *data_requests; | 351 | struct pci_pool *data_requests; |
352 | struct pci_pool *stp_requests; | 352 | struct pci_pool *stp_requests; |
353 | dma_addr_t dma_addr; | 353 | dma_addr_t dma_addr; |
354 | unsigned long ep0out_buf[64]; | 354 | void *ep0out_buf; |
355 | struct usb_ctrlrequest setup_data; | 355 | struct usb_ctrlrequest setup_data; |
356 | unsigned long phys_addr; | 356 | unsigned long phys_addr; |
357 | void __iomem *base_addr; | 357 | void __iomem *base_addr; |
@@ -361,6 +361,8 @@ struct pch_udc_dev { | |||
361 | 361 | ||
362 | #define PCH_UDC_PCI_BAR 1 | 362 | #define PCH_UDC_PCI_BAR 1 |
363 | #define PCI_DEVICE_ID_INTEL_EG20T_UDC 0x8808 | 363 | #define PCI_DEVICE_ID_INTEL_EG20T_UDC 0x8808 |
364 | #define PCI_VENDOR_ID_ROHM 0x10DB | ||
365 | #define PCI_DEVICE_ID_ML7213_IOH_UDC 0x801D | ||
364 | 366 | ||
365 | static const char ep0_string[] = "ep0in"; | 367 | static const char ep0_string[] = "ep0in"; |
366 | static DEFINE_SPINLOCK(udc_stall_spinlock); /* stall spin lock */ | 368 | static DEFINE_SPINLOCK(udc_stall_spinlock); /* stall spin lock */ |
@@ -1219,11 +1221,11 @@ static void complete_req(struct pch_udc_ep *ep, struct pch_udc_request *req, | |||
1219 | dev = ep->dev; | 1221 | dev = ep->dev; |
1220 | if (req->dma_mapped) { | 1222 | if (req->dma_mapped) { |
1221 | if (ep->in) | 1223 | if (ep->in) |
1222 | pci_unmap_single(dev->pdev, req->req.dma, | 1224 | dma_unmap_single(&dev->pdev->dev, req->req.dma, |
1223 | req->req.length, PCI_DMA_TODEVICE); | 1225 | req->req.length, DMA_TO_DEVICE); |
1224 | else | 1226 | else |
1225 | pci_unmap_single(dev->pdev, req->req.dma, | 1227 | dma_unmap_single(&dev->pdev->dev, req->req.dma, |
1226 | req->req.length, PCI_DMA_FROMDEVICE); | 1228 | req->req.length, DMA_FROM_DEVICE); |
1227 | req->dma_mapped = 0; | 1229 | req->dma_mapped = 0; |
1228 | req->req.dma = DMA_ADDR_INVALID; | 1230 | req->req.dma = DMA_ADDR_INVALID; |
1229 | } | 1231 | } |
@@ -1414,7 +1416,6 @@ static void pch_udc_start_rxrequest(struct pch_udc_ep *ep, | |||
1414 | 1416 | ||
1415 | pch_udc_clear_dma(ep->dev, DMA_DIR_RX); | 1417 | pch_udc_clear_dma(ep->dev, DMA_DIR_RX); |
1416 | td_data = req->td_data; | 1418 | td_data = req->td_data; |
1417 | ep->td_data = req->td_data; | ||
1418 | /* Set the status bits for all descriptors */ | 1419 | /* Set the status bits for all descriptors */ |
1419 | while (1) { | 1420 | while (1) { |
1420 | td_data->status = (td_data->status & ~PCH_UDC_BUFF_STS) | | 1421 | td_data->status = (td_data->status & ~PCH_UDC_BUFF_STS) | |
@@ -1613,15 +1614,19 @@ static int pch_udc_pcd_queue(struct usb_ep *usbep, struct usb_request *usbreq, | |||
1613 | if (usbreq->length && | 1614 | if (usbreq->length && |
1614 | ((usbreq->dma == DMA_ADDR_INVALID) || !usbreq->dma)) { | 1615 | ((usbreq->dma == DMA_ADDR_INVALID) || !usbreq->dma)) { |
1615 | if (ep->in) | 1616 | if (ep->in) |
1616 | usbreq->dma = pci_map_single(dev->pdev, usbreq->buf, | 1617 | usbreq->dma = dma_map_single(&dev->pdev->dev, |
1617 | usbreq->length, PCI_DMA_TODEVICE); | 1618 | usbreq->buf, |
1619 | usbreq->length, | ||
1620 | DMA_TO_DEVICE); | ||
1618 | else | 1621 | else |
1619 | usbreq->dma = pci_map_single(dev->pdev, usbreq->buf, | 1622 | usbreq->dma = dma_map_single(&dev->pdev->dev, |
1620 | usbreq->length, PCI_DMA_FROMDEVICE); | 1623 | usbreq->buf, |
1624 | usbreq->length, | ||
1625 | DMA_FROM_DEVICE); | ||
1621 | req->dma_mapped = 1; | 1626 | req->dma_mapped = 1; |
1622 | } | 1627 | } |
1623 | if (usbreq->length > 0) { | 1628 | if (usbreq->length > 0) { |
1624 | retval = prepare_dma(ep, req, gfp); | 1629 | retval = prepare_dma(ep, req, GFP_ATOMIC); |
1625 | if (retval) | 1630 | if (retval) |
1626 | goto probe_end; | 1631 | goto probe_end; |
1627 | } | 1632 | } |
@@ -1646,7 +1651,6 @@ static int pch_udc_pcd_queue(struct usb_ep *usbep, struct usb_request *usbreq, | |||
1646 | pch_udc_wait_ep_stall(ep); | 1651 | pch_udc_wait_ep_stall(ep); |
1647 | pch_udc_ep_clear_nak(ep); | 1652 | pch_udc_ep_clear_nak(ep); |
1648 | pch_udc_enable_ep_interrupts(ep->dev, (1 << ep->num)); | 1653 | pch_udc_enable_ep_interrupts(ep->dev, (1 << ep->num)); |
1649 | pch_udc_set_dma(dev, DMA_DIR_TX); | ||
1650 | } | 1654 | } |
1651 | } | 1655 | } |
1652 | /* Now add this request to the ep's pending requests */ | 1656 | /* Now add this request to the ep's pending requests */ |
@@ -1926,6 +1930,7 @@ static void pch_udc_complete_receiver(struct pch_udc_ep *ep) | |||
1926 | PCH_UDC_BS_DMA_DONE) | 1930 | PCH_UDC_BS_DMA_DONE) |
1927 | return; | 1931 | return; |
1928 | pch_udc_clear_dma(ep->dev, DMA_DIR_RX); | 1932 | pch_udc_clear_dma(ep->dev, DMA_DIR_RX); |
1933 | pch_udc_ep_set_ddptr(ep, 0); | ||
1929 | if ((req->td_data_last->status & PCH_UDC_RXTX_STS) != | 1934 | if ((req->td_data_last->status & PCH_UDC_RXTX_STS) != |
1930 | PCH_UDC_RTS_SUCC) { | 1935 | PCH_UDC_RTS_SUCC) { |
1931 | dev_err(&dev->pdev->dev, "Invalid RXTX status (0x%08x) " | 1936 | dev_err(&dev->pdev->dev, "Invalid RXTX status (0x%08x) " |
@@ -1963,7 +1968,7 @@ static void pch_udc_svc_data_in(struct pch_udc_dev *dev, int ep_num) | |||
1963 | u32 epsts; | 1968 | u32 epsts; |
1964 | struct pch_udc_ep *ep; | 1969 | struct pch_udc_ep *ep; |
1965 | 1970 | ||
1966 | ep = &dev->ep[2*ep_num]; | 1971 | ep = &dev->ep[UDC_EPIN_IDX(ep_num)]; |
1967 | epsts = ep->epsts; | 1972 | epsts = ep->epsts; |
1968 | ep->epsts = 0; | 1973 | ep->epsts = 0; |
1969 | 1974 | ||
@@ -2008,7 +2013,7 @@ static void pch_udc_svc_data_out(struct pch_udc_dev *dev, int ep_num) | |||
2008 | struct pch_udc_ep *ep; | 2013 | struct pch_udc_ep *ep; |
2009 | struct pch_udc_request *req = NULL; | 2014 | struct pch_udc_request *req = NULL; |
2010 | 2015 | ||
2011 | ep = &dev->ep[2*ep_num + 1]; | 2016 | ep = &dev->ep[UDC_EPOUT_IDX(ep_num)]; |
2012 | epsts = ep->epsts; | 2017 | epsts = ep->epsts; |
2013 | ep->epsts = 0; | 2018 | ep->epsts = 0; |
2014 | 2019 | ||
@@ -2025,10 +2030,11 @@ static void pch_udc_svc_data_out(struct pch_udc_dev *dev, int ep_num) | |||
2025 | } | 2030 | } |
2026 | if (epsts & UDC_EPSTS_HE) | 2031 | if (epsts & UDC_EPSTS_HE) |
2027 | return; | 2032 | return; |
2028 | if (epsts & UDC_EPSTS_RSS) | 2033 | if (epsts & UDC_EPSTS_RSS) { |
2029 | pch_udc_ep_set_stall(ep); | 2034 | pch_udc_ep_set_stall(ep); |
2030 | pch_udc_enable_ep_interrupts(ep->dev, | 2035 | pch_udc_enable_ep_interrupts(ep->dev, |
2031 | PCH_UDC_EPINT(ep->in, ep->num)); | 2036 | PCH_UDC_EPINT(ep->in, ep->num)); |
2037 | } | ||
2032 | if (epsts & UDC_EPSTS_RCS) { | 2038 | if (epsts & UDC_EPSTS_RCS) { |
2033 | if (!dev->prot_stall) { | 2039 | if (!dev->prot_stall) { |
2034 | pch_udc_ep_clear_stall(ep); | 2040 | pch_udc_ep_clear_stall(ep); |
@@ -2060,8 +2066,10 @@ static void pch_udc_svc_control_in(struct pch_udc_dev *dev) | |||
2060 | { | 2066 | { |
2061 | u32 epsts; | 2067 | u32 epsts; |
2062 | struct pch_udc_ep *ep; | 2068 | struct pch_udc_ep *ep; |
2069 | struct pch_udc_ep *ep_out; | ||
2063 | 2070 | ||
2064 | ep = &dev->ep[UDC_EP0IN_IDX]; | 2071 | ep = &dev->ep[UDC_EP0IN_IDX]; |
2072 | ep_out = &dev->ep[UDC_EP0OUT_IDX]; | ||
2065 | epsts = ep->epsts; | 2073 | epsts = ep->epsts; |
2066 | ep->epsts = 0; | 2074 | ep->epsts = 0; |
2067 | 2075 | ||
@@ -2073,8 +2081,16 @@ static void pch_udc_svc_control_in(struct pch_udc_dev *dev) | |||
2073 | return; | 2081 | return; |
2074 | if (epsts & UDC_EPSTS_HE) | 2082 | if (epsts & UDC_EPSTS_HE) |
2075 | return; | 2083 | return; |
2076 | if ((epsts & UDC_EPSTS_TDC) && (!dev->stall)) | 2084 | if ((epsts & UDC_EPSTS_TDC) && (!dev->stall)) { |
2077 | pch_udc_complete_transfer(ep); | 2085 | pch_udc_complete_transfer(ep); |
2086 | pch_udc_clear_dma(dev, DMA_DIR_RX); | ||
2087 | ep_out->td_data->status = (ep_out->td_data->status & | ||
2088 | ~PCH_UDC_BUFF_STS) | | ||
2089 | PCH_UDC_BS_HST_RDY; | ||
2090 | pch_udc_ep_clear_nak(ep_out); | ||
2091 | pch_udc_set_dma(dev, DMA_DIR_RX); | ||
2092 | pch_udc_ep_set_rrdy(ep_out); | ||
2093 | } | ||
2078 | /* On IN interrupt, provide data if we have any */ | 2094 | /* On IN interrupt, provide data if we have any */ |
2079 | if ((epsts & UDC_EPSTS_IN) && !(epsts & UDC_EPSTS_TDC) && | 2095 | if ((epsts & UDC_EPSTS_IN) && !(epsts & UDC_EPSTS_TDC) && |
2080 | !(epsts & UDC_EPSTS_TXEMPTY)) | 2096 | !(epsts & UDC_EPSTS_TXEMPTY)) |
@@ -2102,11 +2118,9 @@ static void pch_udc_svc_control_out(struct pch_udc_dev *dev) | |||
2102 | dev->stall = 0; | 2118 | dev->stall = 0; |
2103 | dev->ep[UDC_EP0IN_IDX].halted = 0; | 2119 | dev->ep[UDC_EP0IN_IDX].halted = 0; |
2104 | dev->ep[UDC_EP0OUT_IDX].halted = 0; | 2120 | dev->ep[UDC_EP0OUT_IDX].halted = 0; |
2105 | /* In data not ready */ | ||
2106 | pch_udc_ep_set_nak(&(dev->ep[UDC_EP0IN_IDX])); | ||
2107 | dev->setup_data = ep->td_stp->request; | 2121 | dev->setup_data = ep->td_stp->request; |
2108 | pch_udc_init_setup_buff(ep->td_stp); | 2122 | pch_udc_init_setup_buff(ep->td_stp); |
2109 | pch_udc_clear_dma(dev, DMA_DIR_TX); | 2123 | pch_udc_clear_dma(dev, DMA_DIR_RX); |
2110 | pch_udc_ep_fifo_flush(&(dev->ep[UDC_EP0IN_IDX]), | 2124 | pch_udc_ep_fifo_flush(&(dev->ep[UDC_EP0IN_IDX]), |
2111 | dev->ep[UDC_EP0IN_IDX].in); | 2125 | dev->ep[UDC_EP0IN_IDX].in); |
2112 | if ((dev->setup_data.bRequestType & USB_DIR_IN)) | 2126 | if ((dev->setup_data.bRequestType & USB_DIR_IN)) |
@@ -2122,14 +2136,23 @@ static void pch_udc_svc_control_out(struct pch_udc_dev *dev) | |||
2122 | setup_supported = dev->driver->setup(&dev->gadget, | 2136 | setup_supported = dev->driver->setup(&dev->gadget, |
2123 | &dev->setup_data); | 2137 | &dev->setup_data); |
2124 | spin_lock(&dev->lock); | 2138 | spin_lock(&dev->lock); |
2139 | |||
2140 | if (dev->setup_data.bRequestType & USB_DIR_IN) { | ||
2141 | ep->td_data->status = (ep->td_data->status & | ||
2142 | ~PCH_UDC_BUFF_STS) | | ||
2143 | PCH_UDC_BS_HST_RDY; | ||
2144 | pch_udc_ep_set_ddptr(ep, ep->td_data_phys); | ||
2145 | } | ||
2125 | /* ep0 in returns data on IN phase */ | 2146 | /* ep0 in returns data on IN phase */ |
2126 | if (setup_supported >= 0 && setup_supported < | 2147 | if (setup_supported >= 0 && setup_supported < |
2127 | UDC_EP0IN_MAX_PKT_SIZE) { | 2148 | UDC_EP0IN_MAX_PKT_SIZE) { |
2128 | pch_udc_ep_clear_nak(&(dev->ep[UDC_EP0IN_IDX])); | 2149 | pch_udc_ep_clear_nak(&(dev->ep[UDC_EP0IN_IDX])); |
2129 | /* Gadget would have queued a request when | 2150 | /* Gadget would have queued a request when |
2130 | * we called the setup */ | 2151 | * we called the setup */ |
2131 | pch_udc_set_dma(dev, DMA_DIR_RX); | 2152 | if (!(dev->setup_data.bRequestType & USB_DIR_IN)) { |
2132 | pch_udc_ep_clear_nak(ep); | 2153 | pch_udc_set_dma(dev, DMA_DIR_RX); |
2154 | pch_udc_ep_clear_nak(ep); | ||
2155 | } | ||
2133 | } else if (setup_supported < 0) { | 2156 | } else if (setup_supported < 0) { |
2134 | /* if unsupported request, then stall */ | 2157 | /* if unsupported request, then stall */ |
2135 | pch_udc_ep_set_stall(&(dev->ep[UDC_EP0IN_IDX])); | 2158 | pch_udc_ep_set_stall(&(dev->ep[UDC_EP0IN_IDX])); |
@@ -2142,22 +2165,13 @@ static void pch_udc_svc_control_out(struct pch_udc_dev *dev) | |||
2142 | } | 2165 | } |
2143 | } else if ((((stat & UDC_EPSTS_OUT_MASK) >> UDC_EPSTS_OUT_SHIFT) == | 2166 | } else if ((((stat & UDC_EPSTS_OUT_MASK) >> UDC_EPSTS_OUT_SHIFT) == |
2144 | UDC_EPSTS_OUT_DATA) && !dev->stall) { | 2167 | UDC_EPSTS_OUT_DATA) && !dev->stall) { |
2145 | if (list_empty(&ep->queue)) { | 2168 | pch_udc_clear_dma(dev, DMA_DIR_RX); |
2146 | dev_err(&dev->pdev->dev, "%s: No request\n", __func__); | 2169 | pch_udc_ep_set_ddptr(ep, 0); |
2147 | ep->td_data->status = (ep->td_data->status & | 2170 | if (!list_empty(&ep->queue)) { |
2148 | ~PCH_UDC_BUFF_STS) | | ||
2149 | PCH_UDC_BS_HST_RDY; | ||
2150 | pch_udc_set_dma(dev, DMA_DIR_RX); | ||
2151 | } else { | ||
2152 | /* control write */ | ||
2153 | /* next function will pickuo an clear the status */ | ||
2154 | ep->epsts = stat; | 2171 | ep->epsts = stat; |
2155 | 2172 | pch_udc_svc_data_out(dev, PCH_UDC_EP0); | |
2156 | pch_udc_svc_data_out(dev, 0); | ||
2157 | /* re-program desc. pointer for possible ZLPs */ | ||
2158 | pch_udc_ep_set_ddptr(ep, ep->td_data_phys); | ||
2159 | pch_udc_set_dma(dev, DMA_DIR_RX); | ||
2160 | } | 2173 | } |
2174 | pch_udc_set_dma(dev, DMA_DIR_RX); | ||
2161 | } | 2175 | } |
2162 | pch_udc_ep_set_rrdy(ep); | 2176 | pch_udc_ep_set_rrdy(ep); |
2163 | } | 2177 | } |
@@ -2174,7 +2188,7 @@ static void pch_udc_postsvc_epinters(struct pch_udc_dev *dev, int ep_num) | |||
2174 | struct pch_udc_ep *ep; | 2188 | struct pch_udc_ep *ep; |
2175 | struct pch_udc_request *req; | 2189 | struct pch_udc_request *req; |
2176 | 2190 | ||
2177 | ep = &dev->ep[2*ep_num]; | 2191 | ep = &dev->ep[UDC_EPIN_IDX(ep_num)]; |
2178 | if (!list_empty(&ep->queue)) { | 2192 | if (!list_empty(&ep->queue)) { |
2179 | req = list_entry(ep->queue.next, struct pch_udc_request, queue); | 2193 | req = list_entry(ep->queue.next, struct pch_udc_request, queue); |
2180 | pch_udc_enable_ep_interrupts(ep->dev, | 2194 | pch_udc_enable_ep_interrupts(ep->dev, |
@@ -2196,13 +2210,13 @@ static void pch_udc_read_all_epstatus(struct pch_udc_dev *dev, u32 ep_intr) | |||
2196 | for (i = 0; i < PCH_UDC_USED_EP_NUM; i++) { | 2210 | for (i = 0; i < PCH_UDC_USED_EP_NUM; i++) { |
2197 | /* IN */ | 2211 | /* IN */ |
2198 | if (ep_intr & (0x1 << i)) { | 2212 | if (ep_intr & (0x1 << i)) { |
2199 | ep = &dev->ep[2*i]; | 2213 | ep = &dev->ep[UDC_EPIN_IDX(i)]; |
2200 | ep->epsts = pch_udc_read_ep_status(ep); | 2214 | ep->epsts = pch_udc_read_ep_status(ep); |
2201 | pch_udc_clear_ep_status(ep, ep->epsts); | 2215 | pch_udc_clear_ep_status(ep, ep->epsts); |
2202 | } | 2216 | } |
2203 | /* OUT */ | 2217 | /* OUT */ |
2204 | if (ep_intr & (0x10000 << i)) { | 2218 | if (ep_intr & (0x10000 << i)) { |
2205 | ep = &dev->ep[2*i+1]; | 2219 | ep = &dev->ep[UDC_EPOUT_IDX(i)]; |
2206 | ep->epsts = pch_udc_read_ep_status(ep); | 2220 | ep->epsts = pch_udc_read_ep_status(ep); |
2207 | pch_udc_clear_ep_status(ep, ep->epsts); | 2221 | pch_udc_clear_ep_status(ep, ep->epsts); |
2208 | } | 2222 | } |
@@ -2563,9 +2577,6 @@ static void pch_udc_pcd_reinit(struct pch_udc_dev *dev) | |||
2563 | dev->ep[UDC_EP0IN_IDX].ep.maxpacket = UDC_EP0IN_MAX_PKT_SIZE; | 2577 | dev->ep[UDC_EP0IN_IDX].ep.maxpacket = UDC_EP0IN_MAX_PKT_SIZE; |
2564 | dev->ep[UDC_EP0OUT_IDX].ep.maxpacket = UDC_EP0OUT_MAX_PKT_SIZE; | 2578 | dev->ep[UDC_EP0OUT_IDX].ep.maxpacket = UDC_EP0OUT_MAX_PKT_SIZE; |
2565 | 2579 | ||
2566 | dev->dma_addr = pci_map_single(dev->pdev, dev->ep0out_buf, 256, | ||
2567 | PCI_DMA_FROMDEVICE); | ||
2568 | |||
2569 | /* remove ep0 in and out from the list. They have own pointer */ | 2580 | /* remove ep0 in and out from the list. They have own pointer */ |
2570 | list_del_init(&dev->ep[UDC_EP0IN_IDX].ep.ep_list); | 2581 | list_del_init(&dev->ep[UDC_EP0IN_IDX].ep.ep_list); |
2571 | list_del_init(&dev->ep[UDC_EP0OUT_IDX].ep.ep_list); | 2582 | list_del_init(&dev->ep[UDC_EP0OUT_IDX].ep.ep_list); |
@@ -2637,6 +2648,13 @@ static int init_dma_pools(struct pch_udc_dev *dev) | |||
2637 | dev->ep[UDC_EP0IN_IDX].td_stp_phys = 0; | 2648 | dev->ep[UDC_EP0IN_IDX].td_stp_phys = 0; |
2638 | dev->ep[UDC_EP0IN_IDX].td_data = NULL; | 2649 | dev->ep[UDC_EP0IN_IDX].td_data = NULL; |
2639 | dev->ep[UDC_EP0IN_IDX].td_data_phys = 0; | 2650 | dev->ep[UDC_EP0IN_IDX].td_data_phys = 0; |
2651 | |||
2652 | dev->ep0out_buf = kzalloc(UDC_EP0OUT_BUFF_SIZE * 4, GFP_KERNEL); | ||
2653 | if (!dev->ep0out_buf) | ||
2654 | return -ENOMEM; | ||
2655 | dev->dma_addr = dma_map_single(&dev->pdev->dev, dev->ep0out_buf, | ||
2656 | UDC_EP0OUT_BUFF_SIZE * 4, | ||
2657 | DMA_FROM_DEVICE); | ||
2640 | return 0; | 2658 | return 0; |
2641 | } | 2659 | } |
2642 | 2660 | ||
@@ -2700,7 +2718,8 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver) | |||
2700 | 2718 | ||
2701 | pch_udc_disable_interrupts(dev, UDC_DEVINT_MSK); | 2719 | pch_udc_disable_interrupts(dev, UDC_DEVINT_MSK); |
2702 | 2720 | ||
2703 | /* Assues that there are no pending requets with this driver */ | 2721 | /* Assures that there are no pending requests with this driver */ |
2722 | driver->disconnect(&dev->gadget); | ||
2704 | driver->unbind(&dev->gadget); | 2723 | driver->unbind(&dev->gadget); |
2705 | dev->gadget.dev.driver = NULL; | 2724 | dev->gadget.dev.driver = NULL; |
2706 | dev->driver = NULL; | 2725 | dev->driver = NULL; |
@@ -2750,6 +2769,11 @@ static void pch_udc_remove(struct pci_dev *pdev) | |||
2750 | pci_pool_destroy(dev->stp_requests); | 2769 | pci_pool_destroy(dev->stp_requests); |
2751 | } | 2770 | } |
2752 | 2771 | ||
2772 | if (dev->dma_addr) | ||
2773 | dma_unmap_single(&dev->pdev->dev, dev->dma_addr, | ||
2774 | UDC_EP0OUT_BUFF_SIZE * 4, DMA_FROM_DEVICE); | ||
2775 | kfree(dev->ep0out_buf); | ||
2776 | |||
2753 | pch_udc_exit(dev); | 2777 | pch_udc_exit(dev); |
2754 | 2778 | ||
2755 | if (dev->irq_registered) | 2779 | if (dev->irq_registered) |
@@ -2792,11 +2816,7 @@ static int pch_udc_resume(struct pci_dev *pdev) | |||
2792 | int ret; | 2816 | int ret; |
2793 | 2817 | ||
2794 | pci_set_power_state(pdev, PCI_D0); | 2818 | pci_set_power_state(pdev, PCI_D0); |
2795 | ret = pci_restore_state(pdev); | 2819 | pci_restore_state(pdev); |
2796 | if (ret) { | ||
2797 | dev_err(&pdev->dev, "%s: pci_restore_state failed\n", __func__); | ||
2798 | return ret; | ||
2799 | } | ||
2800 | ret = pci_enable_device(pdev); | 2820 | ret = pci_enable_device(pdev); |
2801 | if (ret) { | 2821 | if (ret) { |
2802 | dev_err(&pdev->dev, "%s: pci_enable_device failed\n", __func__); | 2822 | dev_err(&pdev->dev, "%s: pci_enable_device failed\n", __func__); |
@@ -2914,6 +2934,11 @@ static DEFINE_PCI_DEVICE_TABLE(pch_udc_pcidev_id) = { | |||
2914 | .class = (PCI_CLASS_SERIAL_USB << 8) | 0xfe, | 2934 | .class = (PCI_CLASS_SERIAL_USB << 8) | 0xfe, |
2915 | .class_mask = 0xffffffff, | 2935 | .class_mask = 0xffffffff, |
2916 | }, | 2936 | }, |
2937 | { | ||
2938 | PCI_DEVICE(PCI_VENDOR_ID_ROHM, PCI_DEVICE_ID_ML7213_IOH_UDC), | ||
2939 | .class = (PCI_CLASS_SERIAL_USB << 8) | 0xfe, | ||
2940 | .class_mask = 0xffffffff, | ||
2941 | }, | ||
2917 | { 0 }, | 2942 | { 0 }, |
2918 | }; | 2943 | }; |
2919 | 2944 | ||
diff --git a/drivers/usb/gadget/printer.c b/drivers/usb/gadget/printer.c index 2fc8636316c5..12ff6cffedc9 100644 --- a/drivers/usb/gadget/printer.c +++ b/drivers/usb/gadget/printer.c | |||
@@ -131,31 +131,31 @@ static struct printer_dev usb_printer_gadget; | |||
131 | * parameters are in UTF-8 (superset of ASCII's 7 bit characters). | 131 | * parameters are in UTF-8 (superset of ASCII's 7 bit characters). |
132 | */ | 132 | */ |
133 | 133 | ||
134 | static ushort __initdata idVendor; | 134 | static ushort idVendor; |
135 | module_param(idVendor, ushort, S_IRUGO); | 135 | module_param(idVendor, ushort, S_IRUGO); |
136 | MODULE_PARM_DESC(idVendor, "USB Vendor ID"); | 136 | MODULE_PARM_DESC(idVendor, "USB Vendor ID"); |
137 | 137 | ||
138 | static ushort __initdata idProduct; | 138 | static ushort idProduct; |
139 | module_param(idProduct, ushort, S_IRUGO); | 139 | module_param(idProduct, ushort, S_IRUGO); |
140 | MODULE_PARM_DESC(idProduct, "USB Product ID"); | 140 | MODULE_PARM_DESC(idProduct, "USB Product ID"); |
141 | 141 | ||
142 | static ushort __initdata bcdDevice; | 142 | static ushort bcdDevice; |
143 | module_param(bcdDevice, ushort, S_IRUGO); | 143 | module_param(bcdDevice, ushort, S_IRUGO); |
144 | MODULE_PARM_DESC(bcdDevice, "USB Device version (BCD)"); | 144 | MODULE_PARM_DESC(bcdDevice, "USB Device version (BCD)"); |
145 | 145 | ||
146 | static char *__initdata iManufacturer; | 146 | static char *iManufacturer; |
147 | module_param(iManufacturer, charp, S_IRUGO); | 147 | module_param(iManufacturer, charp, S_IRUGO); |
148 | MODULE_PARM_DESC(iManufacturer, "USB Manufacturer string"); | 148 | MODULE_PARM_DESC(iManufacturer, "USB Manufacturer string"); |
149 | 149 | ||
150 | static char *__initdata iProduct; | 150 | static char *iProduct; |
151 | module_param(iProduct, charp, S_IRUGO); | 151 | module_param(iProduct, charp, S_IRUGO); |
152 | MODULE_PARM_DESC(iProduct, "USB Product string"); | 152 | MODULE_PARM_DESC(iProduct, "USB Product string"); |
153 | 153 | ||
154 | static char *__initdata iSerialNum; | 154 | static char *iSerialNum; |
155 | module_param(iSerialNum, charp, S_IRUGO); | 155 | module_param(iSerialNum, charp, S_IRUGO); |
156 | MODULE_PARM_DESC(iSerialNum, "1"); | 156 | MODULE_PARM_DESC(iSerialNum, "1"); |
157 | 157 | ||
158 | static char *__initdata iPNPstring; | 158 | static char *iPNPstring; |
159 | module_param(iPNPstring, charp, S_IRUGO); | 159 | module_param(iPNPstring, charp, S_IRUGO); |
160 | MODULE_PARM_DESC(iPNPstring, "MFG:linux;MDL:g_printer;CLS:PRINTER;SN:1;"); | 160 | MODULE_PARM_DESC(iPNPstring, "MFG:linux;MDL:g_printer;CLS:PRINTER;SN:1;"); |
161 | 161 | ||
@@ -1596,13 +1596,12 @@ cleanup(void) | |||
1596 | int status; | 1596 | int status; |
1597 | 1597 | ||
1598 | mutex_lock(&usb_printer_gadget.lock_printer_io); | 1598 | mutex_lock(&usb_printer_gadget.lock_printer_io); |
1599 | class_destroy(usb_gadget_class); | ||
1600 | unregister_chrdev_region(g_printer_devno, 2); | ||
1601 | |||
1602 | status = usb_gadget_unregister_driver(&printer_driver); | 1599 | status = usb_gadget_unregister_driver(&printer_driver); |
1603 | if (status) | 1600 | if (status) |
1604 | ERROR(dev, "usb_gadget_unregister_driver %x\n", status); | 1601 | ERROR(dev, "usb_gadget_unregister_driver %x\n", status); |
1605 | 1602 | ||
1603 | unregister_chrdev_region(g_printer_devno, 2); | ||
1604 | class_destroy(usb_gadget_class); | ||
1606 | mutex_unlock(&usb_printer_gadget.lock_printer_io); | 1605 | mutex_unlock(&usb_printer_gadget.lock_printer_io); |
1607 | } | 1606 | } |
1608 | module_exit(cleanup); | 1607 | module_exit(cleanup); |
diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c index 86e42892016d..5c761df7fa83 100644 --- a/drivers/usb/host/ehci-fsl.c +++ b/drivers/usb/host/ehci-fsl.c | |||
@@ -52,7 +52,6 @@ static int usb_hcd_fsl_probe(const struct hc_driver *driver, | |||
52 | struct resource *res; | 52 | struct resource *res; |
53 | int irq; | 53 | int irq; |
54 | int retval; | 54 | int retval; |
55 | unsigned int temp; | ||
56 | 55 | ||
57 | pr_debug("initializing FSL-SOC USB Controller\n"); | 56 | pr_debug("initializing FSL-SOC USB Controller\n"); |
58 | 57 | ||
@@ -126,18 +125,6 @@ static int usb_hcd_fsl_probe(const struct hc_driver *driver, | |||
126 | goto err3; | 125 | goto err3; |
127 | } | 126 | } |
128 | 127 | ||
129 | /* | ||
130 | * Check if it is MPC5121 SoC, otherwise set pdata->have_sysif_regs | ||
131 | * flag for 83xx or 8536 system interface registers. | ||
132 | */ | ||
133 | if (pdata->big_endian_mmio) | ||
134 | temp = in_be32(hcd->regs + FSL_SOC_USB_ID); | ||
135 | else | ||
136 | temp = in_le32(hcd->regs + FSL_SOC_USB_ID); | ||
137 | |||
138 | if ((temp & ID_MSK) != (~((temp & NID_MSK) >> 8) & ID_MSK)) | ||
139 | pdata->have_sysif_regs = 1; | ||
140 | |||
141 | /* Enable USB controller, 83xx or 8536 */ | 128 | /* Enable USB controller, 83xx or 8536 */ |
142 | if (pdata->have_sysif_regs) | 129 | if (pdata->have_sysif_regs) |
143 | setbits32(hcd->regs + FSL_SOC_USB_CTRL, 0x4); | 130 | setbits32(hcd->regs + FSL_SOC_USB_CTRL, 0x4); |
diff --git a/drivers/usb/host/ehci-fsl.h b/drivers/usb/host/ehci-fsl.h index 2c8353795226..3fabed33d940 100644 --- a/drivers/usb/host/ehci-fsl.h +++ b/drivers/usb/host/ehci-fsl.h | |||
@@ -19,9 +19,6 @@ | |||
19 | #define _EHCI_FSL_H | 19 | #define _EHCI_FSL_H |
20 | 20 | ||
21 | /* offsets for the non-ehci registers in the FSL SOC USB controller */ | 21 | /* offsets for the non-ehci registers in the FSL SOC USB controller */ |
22 | #define FSL_SOC_USB_ID 0x0 | ||
23 | #define ID_MSK 0x3f | ||
24 | #define NID_MSK 0x3f00 | ||
25 | #define FSL_SOC_USB_ULPIVP 0x170 | 22 | #define FSL_SOC_USB_ULPIVP 0x170 |
26 | #define FSL_SOC_USB_PORTSC1 0x184 | 23 | #define FSL_SOC_USB_PORTSC1 0x184 |
27 | #define PORT_PTS_MSK (3<<30) | 24 | #define PORT_PTS_MSK (3<<30) |
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 6fee3cd58efe..74dcf49bd015 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
@@ -572,6 +572,8 @@ static int ehci_init(struct usb_hcd *hcd) | |||
572 | ehci->iaa_watchdog.function = ehci_iaa_watchdog; | 572 | ehci->iaa_watchdog.function = ehci_iaa_watchdog; |
573 | ehci->iaa_watchdog.data = (unsigned long) ehci; | 573 | ehci->iaa_watchdog.data = (unsigned long) ehci; |
574 | 574 | ||
575 | hcc_params = ehci_readl(ehci, &ehci->caps->hcc_params); | ||
576 | |||
575 | /* | 577 | /* |
576 | * hw default: 1K periodic list heads, one per frame. | 578 | * hw default: 1K periodic list heads, one per frame. |
577 | * periodic_size can shrink by USBCMD update if hcc_params allows. | 579 | * periodic_size can shrink by USBCMD update if hcc_params allows. |
@@ -579,11 +581,20 @@ static int ehci_init(struct usb_hcd *hcd) | |||
579 | ehci->periodic_size = DEFAULT_I_TDPS; | 581 | ehci->periodic_size = DEFAULT_I_TDPS; |
580 | INIT_LIST_HEAD(&ehci->cached_itd_list); | 582 | INIT_LIST_HEAD(&ehci->cached_itd_list); |
581 | INIT_LIST_HEAD(&ehci->cached_sitd_list); | 583 | INIT_LIST_HEAD(&ehci->cached_sitd_list); |
584 | |||
585 | if (HCC_PGM_FRAMELISTLEN(hcc_params)) { | ||
586 | /* periodic schedule size can be smaller than default */ | ||
587 | switch (EHCI_TUNE_FLS) { | ||
588 | case 0: ehci->periodic_size = 1024; break; | ||
589 | case 1: ehci->periodic_size = 512; break; | ||
590 | case 2: ehci->periodic_size = 256; break; | ||
591 | default: BUG(); | ||
592 | } | ||
593 | } | ||
582 | if ((retval = ehci_mem_init(ehci, GFP_KERNEL)) < 0) | 594 | if ((retval = ehci_mem_init(ehci, GFP_KERNEL)) < 0) |
583 | return retval; | 595 | return retval; |
584 | 596 | ||
585 | /* controllers may cache some of the periodic schedule ... */ | 597 | /* controllers may cache some of the periodic schedule ... */ |
586 | hcc_params = ehci_readl(ehci, &ehci->caps->hcc_params); | ||
587 | if (HCC_ISOC_CACHE(hcc_params)) // full frame cache | 598 | if (HCC_ISOC_CACHE(hcc_params)) // full frame cache |
588 | ehci->i_thresh = 2 + 8; | 599 | ehci->i_thresh = 2 + 8; |
589 | else // N microframes cached | 600 | else // N microframes cached |
@@ -637,12 +648,6 @@ static int ehci_init(struct usb_hcd *hcd) | |||
637 | /* periodic schedule size can be smaller than default */ | 648 | /* periodic schedule size can be smaller than default */ |
638 | temp &= ~(3 << 2); | 649 | temp &= ~(3 << 2); |
639 | temp |= (EHCI_TUNE_FLS << 2); | 650 | temp |= (EHCI_TUNE_FLS << 2); |
640 | switch (EHCI_TUNE_FLS) { | ||
641 | case 0: ehci->periodic_size = 1024; break; | ||
642 | case 1: ehci->periodic_size = 512; break; | ||
643 | case 2: ehci->periodic_size = 256; break; | ||
644 | default: BUG(); | ||
645 | } | ||
646 | } | 651 | } |
647 | if (HCC_LPM(hcc_params)) { | 652 | if (HCC_LPM(hcc_params)) { |
648 | /* support link power management EHCI 1.1 addendum */ | 653 | /* support link power management EHCI 1.1 addendum */ |
diff --git a/drivers/usb/host/ehci-mxc.c b/drivers/usb/host/ehci-mxc.c index fa59b26fc5bc..c8e360d7d975 100644 --- a/drivers/usb/host/ehci-mxc.c +++ b/drivers/usb/host/ehci-mxc.c | |||
@@ -21,10 +21,13 @@ | |||
21 | #include <linux/clk.h> | 21 | #include <linux/clk.h> |
22 | #include <linux/delay.h> | 22 | #include <linux/delay.h> |
23 | #include <linux/usb/otg.h> | 23 | #include <linux/usb/otg.h> |
24 | #include <linux/usb/ulpi.h> | ||
24 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
25 | 26 | ||
26 | #include <mach/mxc_ehci.h> | 27 | #include <mach/mxc_ehci.h> |
27 | 28 | ||
29 | #include <asm/mach-types.h> | ||
30 | |||
28 | #define ULPI_VIEWPORT_OFFSET 0x170 | 31 | #define ULPI_VIEWPORT_OFFSET 0x170 |
29 | 32 | ||
30 | struct ehci_mxc_priv { | 33 | struct ehci_mxc_priv { |
@@ -114,6 +117,7 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev) | |||
114 | struct usb_hcd *hcd; | 117 | struct usb_hcd *hcd; |
115 | struct resource *res; | 118 | struct resource *res; |
116 | int irq, ret; | 119 | int irq, ret; |
120 | unsigned int flags; | ||
117 | struct ehci_mxc_priv *priv; | 121 | struct ehci_mxc_priv *priv; |
118 | struct device *dev = &pdev->dev; | 122 | struct device *dev = &pdev->dev; |
119 | struct ehci_hcd *ehci; | 123 | struct ehci_hcd *ehci; |
@@ -177,8 +181,8 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev) | |||
177 | clk_enable(priv->ahbclk); | 181 | clk_enable(priv->ahbclk); |
178 | } | 182 | } |
179 | 183 | ||
180 | /* "dr" device has its own clock */ | 184 | /* "dr" device has its own clock on i.MX51 */ |
181 | if (pdev->id == 0) { | 185 | if (cpu_is_mx51() && (pdev->id == 0)) { |
182 | priv->phy1clk = clk_get(dev, "usb_phy1"); | 186 | priv->phy1clk = clk_get(dev, "usb_phy1"); |
183 | if (IS_ERR(priv->phy1clk)) { | 187 | if (IS_ERR(priv->phy1clk)) { |
184 | ret = PTR_ERR(priv->phy1clk); | 188 | ret = PTR_ERR(priv->phy1clk); |
@@ -240,6 +244,23 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev) | |||
240 | if (ret) | 244 | if (ret) |
241 | goto err_add; | 245 | goto err_add; |
242 | 246 | ||
247 | if (pdata->otg) { | ||
248 | /* | ||
249 | * efikamx and efikasb have some hardware bug which is | ||
250 | * preventing usb to work unless CHRGVBUS is set. | ||
251 | * It's in violation of USB specs | ||
252 | */ | ||
253 | if (machine_is_mx51_efikamx() || machine_is_mx51_efikasb()) { | ||
254 | flags = otg_io_read(pdata->otg, ULPI_OTG_CTRL); | ||
255 | flags |= ULPI_OTG_CTRL_CHRGVBUS; | ||
256 | ret = otg_io_write(pdata->otg, flags, ULPI_OTG_CTRL); | ||
257 | if (ret) { | ||
258 | dev_err(dev, "unable to set CHRVBUS\n"); | ||
259 | goto err_add; | ||
260 | } | ||
261 | } | ||
262 | } | ||
263 | |||
243 | return 0; | 264 | return 0; |
244 | 265 | ||
245 | err_add: | 266 | err_add: |
diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c index 76179c39c0e3..bed07d4aab06 100644 --- a/drivers/usb/host/ehci-pci.c +++ b/drivers/usb/host/ehci-pci.c | |||
@@ -44,28 +44,35 @@ static int ehci_pci_reinit(struct ehci_hcd *ehci, struct pci_dev *pdev) | |||
44 | return 0; | 44 | return 0; |
45 | } | 45 | } |
46 | 46 | ||
47 | static int ehci_quirk_amd_SB800(struct ehci_hcd *ehci) | 47 | static int ehci_quirk_amd_hudson(struct ehci_hcd *ehci) |
48 | { | 48 | { |
49 | struct pci_dev *amd_smbus_dev; | 49 | struct pci_dev *amd_smbus_dev; |
50 | u8 rev = 0; | 50 | u8 rev = 0; |
51 | 51 | ||
52 | amd_smbus_dev = pci_get_device(PCI_VENDOR_ID_ATI, 0x4385, NULL); | 52 | amd_smbus_dev = pci_get_device(PCI_VENDOR_ID_ATI, 0x4385, NULL); |
53 | if (!amd_smbus_dev) | 53 | if (amd_smbus_dev) { |
54 | return 0; | 54 | pci_read_config_byte(amd_smbus_dev, PCI_REVISION_ID, &rev); |
55 | 55 | if (rev < 0x40) { | |
56 | pci_read_config_byte(amd_smbus_dev, PCI_REVISION_ID, &rev); | 56 | pci_dev_put(amd_smbus_dev); |
57 | if (rev < 0x40) { | 57 | amd_smbus_dev = NULL; |
58 | pci_dev_put(amd_smbus_dev); | 58 | return 0; |
59 | amd_smbus_dev = NULL; | 59 | } |
60 | return 0; | 60 | } else { |
61 | amd_smbus_dev = pci_get_device(PCI_VENDOR_ID_AMD, 0x780b, NULL); | ||
62 | if (!amd_smbus_dev) | ||
63 | return 0; | ||
64 | pci_read_config_byte(amd_smbus_dev, PCI_REVISION_ID, &rev); | ||
65 | if (rev < 0x11 || rev > 0x18) { | ||
66 | pci_dev_put(amd_smbus_dev); | ||
67 | amd_smbus_dev = NULL; | ||
68 | return 0; | ||
69 | } | ||
61 | } | 70 | } |
62 | 71 | ||
63 | if (!amd_nb_dev) | 72 | if (!amd_nb_dev) |
64 | amd_nb_dev = pci_get_device(PCI_VENDOR_ID_AMD, 0x1510, NULL); | 73 | amd_nb_dev = pci_get_device(PCI_VENDOR_ID_AMD, 0x1510, NULL); |
65 | if (!amd_nb_dev) | ||
66 | ehci_err(ehci, "QUIRK: unable to get AMD NB device\n"); | ||
67 | 74 | ||
68 | ehci_info(ehci, "QUIRK: Enable AMD SB800 L1 fix\n"); | 75 | ehci_info(ehci, "QUIRK: Enable exception for AMD Hudson ASPM\n"); |
69 | 76 | ||
70 | pci_dev_put(amd_smbus_dev); | 77 | pci_dev_put(amd_smbus_dev); |
71 | amd_smbus_dev = NULL; | 78 | amd_smbus_dev = NULL; |
@@ -131,7 +138,7 @@ static int ehci_pci_setup(struct usb_hcd *hcd) | |||
131 | /* cache this readonly data; minimize chip reads */ | 138 | /* cache this readonly data; minimize chip reads */ |
132 | ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params); | 139 | ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params); |
133 | 140 | ||
134 | if (ehci_quirk_amd_SB800(ehci)) | 141 | if (ehci_quirk_amd_hudson(ehci)) |
135 | ehci->amd_l1_fix = 1; | 142 | ehci->amd_l1_fix = 1; |
136 | 143 | ||
137 | retval = ehci_halt(ehci); | 144 | retval = ehci_halt(ehci); |
diff --git a/drivers/usb/host/fsl-mph-dr-of.c b/drivers/usb/host/fsl-mph-dr-of.c index 574b99ea0700..79a66d622f9c 100644 --- a/drivers/usb/host/fsl-mph-dr-of.c +++ b/drivers/usb/host/fsl-mph-dr-of.c | |||
@@ -262,19 +262,24 @@ static void fsl_usb2_mpc5121_exit(struct platform_device *pdev) | |||
262 | } | 262 | } |
263 | } | 263 | } |
264 | 264 | ||
265 | struct fsl_usb2_platform_data fsl_usb2_mpc5121_pd = { | 265 | static struct fsl_usb2_platform_data fsl_usb2_mpc5121_pd = { |
266 | .big_endian_desc = 1, | 266 | .big_endian_desc = 1, |
267 | .big_endian_mmio = 1, | 267 | .big_endian_mmio = 1, |
268 | .es = 1, | 268 | .es = 1, |
269 | .have_sysif_regs = 0, | ||
269 | .le_setup_buf = 1, | 270 | .le_setup_buf = 1, |
270 | .init = fsl_usb2_mpc5121_init, | 271 | .init = fsl_usb2_mpc5121_init, |
271 | .exit = fsl_usb2_mpc5121_exit, | 272 | .exit = fsl_usb2_mpc5121_exit, |
272 | }; | 273 | }; |
273 | #endif /* CONFIG_PPC_MPC512x */ | 274 | #endif /* CONFIG_PPC_MPC512x */ |
274 | 275 | ||
276 | static struct fsl_usb2_platform_data fsl_usb2_mpc8xxx_pd = { | ||
277 | .have_sysif_regs = 1, | ||
278 | }; | ||
279 | |||
275 | static const struct of_device_id fsl_usb2_mph_dr_of_match[] = { | 280 | static const struct of_device_id fsl_usb2_mph_dr_of_match[] = { |
276 | { .compatible = "fsl-usb2-mph", }, | 281 | { .compatible = "fsl-usb2-mph", .data = &fsl_usb2_mpc8xxx_pd, }, |
277 | { .compatible = "fsl-usb2-dr", }, | 282 | { .compatible = "fsl-usb2-dr", .data = &fsl_usb2_mpc8xxx_pd, }, |
278 | #ifdef CONFIG_PPC_MPC512x | 283 | #ifdef CONFIG_PPC_MPC512x |
279 | { .compatible = "fsl,mpc5121-usb2-dr", .data = &fsl_usb2_mpc5121_pd, }, | 284 | { .compatible = "fsl,mpc5121-usb2-dr", .data = &fsl_usb2_mpc5121_pd, }, |
280 | #endif | 285 | #endif |
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index df558f6f84e3..3e8211c1ce5a 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c | |||
@@ -308,11 +308,8 @@ static int room_on_ring(struct xhci_hcd *xhci, struct xhci_ring *ring, | |||
308 | /* Ring the host controller doorbell after placing a command on the ring */ | 308 | /* Ring the host controller doorbell after placing a command on the ring */ |
309 | void xhci_ring_cmd_db(struct xhci_hcd *xhci) | 309 | void xhci_ring_cmd_db(struct xhci_hcd *xhci) |
310 | { | 310 | { |
311 | u32 temp; | ||
312 | |||
313 | xhci_dbg(xhci, "// Ding dong!\n"); | 311 | xhci_dbg(xhci, "// Ding dong!\n"); |
314 | temp = xhci_readl(xhci, &xhci->dba->doorbell[0]) & DB_MASK; | 312 | xhci_writel(xhci, DB_VALUE_HOST, &xhci->dba->doorbell[0]); |
315 | xhci_writel(xhci, temp | DB_TARGET_HOST, &xhci->dba->doorbell[0]); | ||
316 | /* Flush PCI posted writes */ | 313 | /* Flush PCI posted writes */ |
317 | xhci_readl(xhci, &xhci->dba->doorbell[0]); | 314 | xhci_readl(xhci, &xhci->dba->doorbell[0]); |
318 | } | 315 | } |
@@ -322,26 +319,24 @@ void xhci_ring_ep_doorbell(struct xhci_hcd *xhci, | |||
322 | unsigned int ep_index, | 319 | unsigned int ep_index, |
323 | unsigned int stream_id) | 320 | unsigned int stream_id) |
324 | { | 321 | { |
325 | struct xhci_virt_ep *ep; | ||
326 | unsigned int ep_state; | ||
327 | u32 field; | ||
328 | __u32 __iomem *db_addr = &xhci->dba->doorbell[slot_id]; | 322 | __u32 __iomem *db_addr = &xhci->dba->doorbell[slot_id]; |
323 | struct xhci_virt_ep *ep = &xhci->devs[slot_id]->eps[ep_index]; | ||
324 | unsigned int ep_state = ep->ep_state; | ||
329 | 325 | ||
330 | ep = &xhci->devs[slot_id]->eps[ep_index]; | ||
331 | ep_state = ep->ep_state; | ||
332 | /* Don't ring the doorbell for this endpoint if there are pending | 326 | /* Don't ring the doorbell for this endpoint if there are pending |
333 | * cancellations because the we don't want to interrupt processing. | 327 | * cancellations because we don't want to interrupt processing. |
334 | * We don't want to restart any stream rings if there's a set dequeue | 328 | * We don't want to restart any stream rings if there's a set dequeue |
335 | * pointer command pending because the device can choose to start any | 329 | * pointer command pending because the device can choose to start any |
336 | * stream once the endpoint is on the HW schedule. | 330 | * stream once the endpoint is on the HW schedule. |
337 | * FIXME - check all the stream rings for pending cancellations. | 331 | * FIXME - check all the stream rings for pending cancellations. |
338 | */ | 332 | */ |
339 | if (!(ep_state & EP_HALT_PENDING) && !(ep_state & SET_DEQ_PENDING) | 333 | if ((ep_state & EP_HALT_PENDING) || (ep_state & SET_DEQ_PENDING) || |
340 | && !(ep_state & EP_HALTED)) { | 334 | (ep_state & EP_HALTED)) |
341 | field = xhci_readl(xhci, db_addr) & DB_MASK; | 335 | return; |
342 | field |= EPI_TO_DB(ep_index) | STREAM_ID_TO_DB(stream_id); | 336 | xhci_writel(xhci, DB_VALUE(ep_index, stream_id), db_addr); |
343 | xhci_writel(xhci, field, db_addr); | 337 | /* The CPU has better things to do at this point than wait for a |
344 | } | 338 | * write-posting flush. It'll get there soon enough. |
339 | */ | ||
345 | } | 340 | } |
346 | 341 | ||
347 | /* Ring the doorbell for any rings with pending URBs */ | 342 | /* Ring the doorbell for any rings with pending URBs */ |
@@ -1188,7 +1183,7 @@ static void handle_port_status(struct xhci_hcd *xhci, | |||
1188 | 1183 | ||
1189 | addr = &xhci->op_regs->port_status_base + NUM_PORT_REGS * (port_id - 1); | 1184 | addr = &xhci->op_regs->port_status_base + NUM_PORT_REGS * (port_id - 1); |
1190 | temp = xhci_readl(xhci, addr); | 1185 | temp = xhci_readl(xhci, addr); |
1191 | if ((temp & PORT_CONNECT) && (hcd->state == HC_STATE_SUSPENDED)) { | 1186 | if (hcd->state == HC_STATE_SUSPENDED) { |
1192 | xhci_dbg(xhci, "resume root hub\n"); | 1187 | xhci_dbg(xhci, "resume root hub\n"); |
1193 | usb_hcd_resume_root_hub(hcd); | 1188 | usb_hcd_resume_root_hub(hcd); |
1194 | } | 1189 | } |
@@ -1710,8 +1705,7 @@ static int process_bulk_intr_td(struct xhci_hcd *xhci, struct xhci_td *td, | |||
1710 | /* Others already handled above */ | 1705 | /* Others already handled above */ |
1711 | break; | 1706 | break; |
1712 | } | 1707 | } |
1713 | dev_dbg(&td->urb->dev->dev, | 1708 | xhci_dbg(xhci, "ep %#x - asked for %d bytes, " |
1714 | "ep %#x - asked for %d bytes, " | ||
1715 | "%d bytes untransferred\n", | 1709 | "%d bytes untransferred\n", |
1716 | td->urb->ep->desc.bEndpointAddress, | 1710 | td->urb->ep->desc.bEndpointAddress, |
1717 | td->urb->transfer_buffer_length, | 1711 | td->urb->transfer_buffer_length, |
@@ -2389,7 +2383,8 @@ static unsigned int count_sg_trbs_needed(struct xhci_hcd *xhci, struct urb *urb) | |||
2389 | } | 2383 | } |
2390 | xhci_dbg(xhci, "\n"); | 2384 | xhci_dbg(xhci, "\n"); |
2391 | if (!in_interrupt()) | 2385 | if (!in_interrupt()) |
2392 | dev_dbg(&urb->dev->dev, "ep %#x - urb len = %d, sglist used, num_trbs = %d\n", | 2386 | xhci_dbg(xhci, "ep %#x - urb len = %d, sglist used, " |
2387 | "num_trbs = %d\n", | ||
2393 | urb->ep->desc.bEndpointAddress, | 2388 | urb->ep->desc.bEndpointAddress, |
2394 | urb->transfer_buffer_length, | 2389 | urb->transfer_buffer_length, |
2395 | num_trbs); | 2390 | num_trbs); |
@@ -2414,14 +2409,17 @@ static void check_trb_math(struct urb *urb, int num_trbs, int running_total) | |||
2414 | 2409 | ||
2415 | static void giveback_first_trb(struct xhci_hcd *xhci, int slot_id, | 2410 | static void giveback_first_trb(struct xhci_hcd *xhci, int slot_id, |
2416 | unsigned int ep_index, unsigned int stream_id, int start_cycle, | 2411 | unsigned int ep_index, unsigned int stream_id, int start_cycle, |
2417 | struct xhci_generic_trb *start_trb, struct xhci_td *td) | 2412 | struct xhci_generic_trb *start_trb) |
2418 | { | 2413 | { |
2419 | /* | 2414 | /* |
2420 | * Pass all the TRBs to the hardware at once and make sure this write | 2415 | * Pass all the TRBs to the hardware at once and make sure this write |
2421 | * isn't reordered. | 2416 | * isn't reordered. |
2422 | */ | 2417 | */ |
2423 | wmb(); | 2418 | wmb(); |
2424 | start_trb->field[3] |= start_cycle; | 2419 | if (start_cycle) |
2420 | start_trb->field[3] |= start_cycle; | ||
2421 | else | ||
2422 | start_trb->field[3] &= ~0x1; | ||
2425 | xhci_ring_ep_doorbell(xhci, slot_id, ep_index, stream_id); | 2423 | xhci_ring_ep_doorbell(xhci, slot_id, ep_index, stream_id); |
2426 | } | 2424 | } |
2427 | 2425 | ||
@@ -2449,7 +2447,7 @@ int xhci_queue_intr_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2449 | * to set the polling interval (once the API is added). | 2447 | * to set the polling interval (once the API is added). |
2450 | */ | 2448 | */ |
2451 | if (xhci_interval != ep_interval) { | 2449 | if (xhci_interval != ep_interval) { |
2452 | if (!printk_ratelimit()) | 2450 | if (printk_ratelimit()) |
2453 | dev_dbg(&urb->dev->dev, "Driver uses different interval" | 2451 | dev_dbg(&urb->dev->dev, "Driver uses different interval" |
2454 | " (%d microframe%s) than xHCI " | 2452 | " (%d microframe%s) than xHCI " |
2455 | "(%d microframe%s)\n", | 2453 | "(%d microframe%s)\n", |
@@ -2551,9 +2549,11 @@ static int queue_bulk_sg_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2551 | u32 remainder = 0; | 2549 | u32 remainder = 0; |
2552 | 2550 | ||
2553 | /* Don't change the cycle bit of the first TRB until later */ | 2551 | /* Don't change the cycle bit of the first TRB until later */ |
2554 | if (first_trb) | 2552 | if (first_trb) { |
2555 | first_trb = false; | 2553 | first_trb = false; |
2556 | else | 2554 | if (start_cycle == 0) |
2555 | field |= 0x1; | ||
2556 | } else | ||
2557 | field |= ep_ring->cycle_state; | 2557 | field |= ep_ring->cycle_state; |
2558 | 2558 | ||
2559 | /* Chain all the TRBs together; clear the chain bit in the last | 2559 | /* Chain all the TRBs together; clear the chain bit in the last |
@@ -2625,7 +2625,7 @@ static int queue_bulk_sg_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2625 | 2625 | ||
2626 | check_trb_math(urb, num_trbs, running_total); | 2626 | check_trb_math(urb, num_trbs, running_total); |
2627 | giveback_first_trb(xhci, slot_id, ep_index, urb->stream_id, | 2627 | giveback_first_trb(xhci, slot_id, ep_index, urb->stream_id, |
2628 | start_cycle, start_trb, td); | 2628 | start_cycle, start_trb); |
2629 | return 0; | 2629 | return 0; |
2630 | } | 2630 | } |
2631 | 2631 | ||
@@ -2671,7 +2671,8 @@ int xhci_queue_bulk_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2671 | /* FIXME: this doesn't deal with URB_ZERO_PACKET - need one more */ | 2671 | /* FIXME: this doesn't deal with URB_ZERO_PACKET - need one more */ |
2672 | 2672 | ||
2673 | if (!in_interrupt()) | 2673 | if (!in_interrupt()) |
2674 | dev_dbg(&urb->dev->dev, "ep %#x - urb len = %#x (%d), addr = %#llx, num_trbs = %d\n", | 2674 | xhci_dbg(xhci, "ep %#x - urb len = %#x (%d), " |
2675 | "addr = %#llx, num_trbs = %d\n", | ||
2675 | urb->ep->desc.bEndpointAddress, | 2676 | urb->ep->desc.bEndpointAddress, |
2676 | urb->transfer_buffer_length, | 2677 | urb->transfer_buffer_length, |
2677 | urb->transfer_buffer_length, | 2678 | urb->transfer_buffer_length, |
@@ -2711,9 +2712,11 @@ int xhci_queue_bulk_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2711 | field = 0; | 2712 | field = 0; |
2712 | 2713 | ||
2713 | /* Don't change the cycle bit of the first TRB until later */ | 2714 | /* Don't change the cycle bit of the first TRB until later */ |
2714 | if (first_trb) | 2715 | if (first_trb) { |
2715 | first_trb = false; | 2716 | first_trb = false; |
2716 | else | 2717 | if (start_cycle == 0) |
2718 | field |= 0x1; | ||
2719 | } else | ||
2717 | field |= ep_ring->cycle_state; | 2720 | field |= ep_ring->cycle_state; |
2718 | 2721 | ||
2719 | /* Chain all the TRBs together; clear the chain bit in the last | 2722 | /* Chain all the TRBs together; clear the chain bit in the last |
@@ -2757,7 +2760,7 @@ int xhci_queue_bulk_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2757 | 2760 | ||
2758 | check_trb_math(urb, num_trbs, running_total); | 2761 | check_trb_math(urb, num_trbs, running_total); |
2759 | giveback_first_trb(xhci, slot_id, ep_index, urb->stream_id, | 2762 | giveback_first_trb(xhci, slot_id, ep_index, urb->stream_id, |
2760 | start_cycle, start_trb, td); | 2763 | start_cycle, start_trb); |
2761 | return 0; | 2764 | return 0; |
2762 | } | 2765 | } |
2763 | 2766 | ||
@@ -2818,13 +2821,17 @@ int xhci_queue_ctrl_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2818 | /* Queue setup TRB - see section 6.4.1.2.1 */ | 2821 | /* Queue setup TRB - see section 6.4.1.2.1 */ |
2819 | /* FIXME better way to translate setup_packet into two u32 fields? */ | 2822 | /* FIXME better way to translate setup_packet into two u32 fields? */ |
2820 | setup = (struct usb_ctrlrequest *) urb->setup_packet; | 2823 | setup = (struct usb_ctrlrequest *) urb->setup_packet; |
2824 | field = 0; | ||
2825 | field |= TRB_IDT | TRB_TYPE(TRB_SETUP); | ||
2826 | if (start_cycle == 0) | ||
2827 | field |= 0x1; | ||
2821 | queue_trb(xhci, ep_ring, false, true, | 2828 | queue_trb(xhci, ep_ring, false, true, |
2822 | /* FIXME endianness is probably going to bite my ass here. */ | 2829 | /* FIXME endianness is probably going to bite my ass here. */ |
2823 | setup->bRequestType | setup->bRequest << 8 | setup->wValue << 16, | 2830 | setup->bRequestType | setup->bRequest << 8 | setup->wValue << 16, |
2824 | setup->wIndex | setup->wLength << 16, | 2831 | setup->wIndex | setup->wLength << 16, |
2825 | TRB_LEN(8) | TRB_INTR_TARGET(0), | 2832 | TRB_LEN(8) | TRB_INTR_TARGET(0), |
2826 | /* Immediate data in pointer */ | 2833 | /* Immediate data in pointer */ |
2827 | TRB_IDT | TRB_TYPE(TRB_SETUP)); | 2834 | field); |
2828 | 2835 | ||
2829 | /* If there's data, queue data TRBs */ | 2836 | /* If there's data, queue data TRBs */ |
2830 | field = 0; | 2837 | field = 0; |
@@ -2859,7 +2866,7 @@ int xhci_queue_ctrl_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2859 | field | TRB_IOC | TRB_TYPE(TRB_STATUS) | ep_ring->cycle_state); | 2866 | field | TRB_IOC | TRB_TYPE(TRB_STATUS) | ep_ring->cycle_state); |
2860 | 2867 | ||
2861 | giveback_first_trb(xhci, slot_id, ep_index, 0, | 2868 | giveback_first_trb(xhci, slot_id, ep_index, 0, |
2862 | start_cycle, start_trb, td); | 2869 | start_cycle, start_trb); |
2863 | return 0; | 2870 | return 0; |
2864 | } | 2871 | } |
2865 | 2872 | ||
@@ -2900,6 +2907,7 @@ static int xhci_queue_isoc_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2900 | int running_total, trb_buff_len, td_len, td_remain_len, ret; | 2907 | int running_total, trb_buff_len, td_len, td_remain_len, ret; |
2901 | u64 start_addr, addr; | 2908 | u64 start_addr, addr; |
2902 | int i, j; | 2909 | int i, j; |
2910 | bool more_trbs_coming; | ||
2903 | 2911 | ||
2904 | ep_ring = xhci->devs[slot_id]->eps[ep_index].ring; | 2912 | ep_ring = xhci->devs[slot_id]->eps[ep_index].ring; |
2905 | 2913 | ||
@@ -2910,7 +2918,7 @@ static int xhci_queue_isoc_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2910 | } | 2918 | } |
2911 | 2919 | ||
2912 | if (!in_interrupt()) | 2920 | if (!in_interrupt()) |
2913 | dev_dbg(&urb->dev->dev, "ep %#x - urb len = %#x (%d)," | 2921 | xhci_dbg(xhci, "ep %#x - urb len = %#x (%d)," |
2914 | " addr = %#llx, num_tds = %d\n", | 2922 | " addr = %#llx, num_tds = %d\n", |
2915 | urb->ep->desc.bEndpointAddress, | 2923 | urb->ep->desc.bEndpointAddress, |
2916 | urb->transfer_buffer_length, | 2924 | urb->transfer_buffer_length, |
@@ -2950,7 +2958,10 @@ static int xhci_queue_isoc_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2950 | field |= TRB_TYPE(TRB_ISOC); | 2958 | field |= TRB_TYPE(TRB_ISOC); |
2951 | /* Assume URB_ISO_ASAP is set */ | 2959 | /* Assume URB_ISO_ASAP is set */ |
2952 | field |= TRB_SIA; | 2960 | field |= TRB_SIA; |
2953 | if (i > 0) | 2961 | if (i == 0) { |
2962 | if (start_cycle == 0) | ||
2963 | field |= 0x1; | ||
2964 | } else | ||
2954 | field |= ep_ring->cycle_state; | 2965 | field |= ep_ring->cycle_state; |
2955 | first_trb = false; | 2966 | first_trb = false; |
2956 | } else { | 2967 | } else { |
@@ -2965,9 +2976,11 @@ static int xhci_queue_isoc_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2965 | */ | 2976 | */ |
2966 | if (j < trbs_per_td - 1) { | 2977 | if (j < trbs_per_td - 1) { |
2967 | field |= TRB_CHAIN; | 2978 | field |= TRB_CHAIN; |
2979 | more_trbs_coming = true; | ||
2968 | } else { | 2980 | } else { |
2969 | td->last_trb = ep_ring->enqueue; | 2981 | td->last_trb = ep_ring->enqueue; |
2970 | field |= TRB_IOC; | 2982 | field |= TRB_IOC; |
2983 | more_trbs_coming = false; | ||
2971 | } | 2984 | } |
2972 | 2985 | ||
2973 | /* Calculate TRB length */ | 2986 | /* Calculate TRB length */ |
@@ -2980,7 +2993,7 @@ static int xhci_queue_isoc_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2980 | length_field = TRB_LEN(trb_buff_len) | | 2993 | length_field = TRB_LEN(trb_buff_len) | |
2981 | remainder | | 2994 | remainder | |
2982 | TRB_INTR_TARGET(0); | 2995 | TRB_INTR_TARGET(0); |
2983 | queue_trb(xhci, ep_ring, false, false, | 2996 | queue_trb(xhci, ep_ring, false, more_trbs_coming, |
2984 | lower_32_bits(addr), | 2997 | lower_32_bits(addr), |
2985 | upper_32_bits(addr), | 2998 | upper_32_bits(addr), |
2986 | length_field, | 2999 | length_field, |
@@ -3003,10 +3016,8 @@ static int xhci_queue_isoc_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
3003 | } | 3016 | } |
3004 | } | 3017 | } |
3005 | 3018 | ||
3006 | wmb(); | 3019 | giveback_first_trb(xhci, slot_id, ep_index, urb->stream_id, |
3007 | start_trb->field[3] |= start_cycle; | 3020 | start_cycle, start_trb); |
3008 | |||
3009 | xhci_ring_ep_doorbell(xhci, slot_id, ep_index, urb->stream_id); | ||
3010 | return 0; | 3021 | return 0; |
3011 | } | 3022 | } |
3012 | 3023 | ||
@@ -3064,7 +3075,7 @@ int xhci_queue_isoc_tx_prepare(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
3064 | * to set the polling interval (once the API is added). | 3075 | * to set the polling interval (once the API is added). |
3065 | */ | 3076 | */ |
3066 | if (xhci_interval != ep_interval) { | 3077 | if (xhci_interval != ep_interval) { |
3067 | if (!printk_ratelimit()) | 3078 | if (printk_ratelimit()) |
3068 | dev_dbg(&urb->dev->dev, "Driver uses different interval" | 3079 | dev_dbg(&urb->dev->dev, "Driver uses different interval" |
3069 | " (%d microframe%s) than xHCI " | 3080 | " (%d microframe%s) than xHCI " |
3070 | "(%d microframe%s)\n", | 3081 | "(%d microframe%s)\n", |
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 45e4a3108cc3..34cf4e165877 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
@@ -226,7 +226,8 @@ static int xhci_setup_msi(struct xhci_hcd *xhci) | |||
226 | static int xhci_setup_msix(struct xhci_hcd *xhci) | 226 | static int xhci_setup_msix(struct xhci_hcd *xhci) |
227 | { | 227 | { |
228 | int i, ret = 0; | 228 | int i, ret = 0; |
229 | struct pci_dev *pdev = to_pci_dev(xhci_to_hcd(xhci)->self.controller); | 229 | struct usb_hcd *hcd = xhci_to_hcd(xhci); |
230 | struct pci_dev *pdev = to_pci_dev(hcd->self.controller); | ||
230 | 231 | ||
231 | /* | 232 | /* |
232 | * calculate number of msi-x vectors supported. | 233 | * calculate number of msi-x vectors supported. |
@@ -265,6 +266,7 @@ static int xhci_setup_msix(struct xhci_hcd *xhci) | |||
265 | goto disable_msix; | 266 | goto disable_msix; |
266 | } | 267 | } |
267 | 268 | ||
269 | hcd->msix_enabled = 1; | ||
268 | return ret; | 270 | return ret; |
269 | 271 | ||
270 | disable_msix: | 272 | disable_msix: |
@@ -280,7 +282,8 @@ free_entries: | |||
280 | /* Free any IRQs and disable MSI-X */ | 282 | /* Free any IRQs and disable MSI-X */ |
281 | static void xhci_cleanup_msix(struct xhci_hcd *xhci) | 283 | static void xhci_cleanup_msix(struct xhci_hcd *xhci) |
282 | { | 284 | { |
283 | struct pci_dev *pdev = to_pci_dev(xhci_to_hcd(xhci)->self.controller); | 285 | struct usb_hcd *hcd = xhci_to_hcd(xhci); |
286 | struct pci_dev *pdev = to_pci_dev(hcd->self.controller); | ||
284 | 287 | ||
285 | xhci_free_irq(xhci); | 288 | xhci_free_irq(xhci); |
286 | 289 | ||
@@ -292,6 +295,7 @@ static void xhci_cleanup_msix(struct xhci_hcd *xhci) | |||
292 | pci_disable_msi(pdev); | 295 | pci_disable_msi(pdev); |
293 | } | 296 | } |
294 | 297 | ||
298 | hcd->msix_enabled = 0; | ||
295 | return; | 299 | return; |
296 | } | 300 | } |
297 | 301 | ||
@@ -508,9 +512,10 @@ void xhci_stop(struct usb_hcd *hcd) | |||
508 | spin_lock_irq(&xhci->lock); | 512 | spin_lock_irq(&xhci->lock); |
509 | xhci_halt(xhci); | 513 | xhci_halt(xhci); |
510 | xhci_reset(xhci); | 514 | xhci_reset(xhci); |
511 | xhci_cleanup_msix(xhci); | ||
512 | spin_unlock_irq(&xhci->lock); | 515 | spin_unlock_irq(&xhci->lock); |
513 | 516 | ||
517 | xhci_cleanup_msix(xhci); | ||
518 | |||
514 | #ifdef CONFIG_USB_XHCI_HCD_DEBUGGING | 519 | #ifdef CONFIG_USB_XHCI_HCD_DEBUGGING |
515 | /* Tell the event ring poll function not to reschedule */ | 520 | /* Tell the event ring poll function not to reschedule */ |
516 | xhci->zombie = 1; | 521 | xhci->zombie = 1; |
@@ -544,9 +549,10 @@ void xhci_shutdown(struct usb_hcd *hcd) | |||
544 | 549 | ||
545 | spin_lock_irq(&xhci->lock); | 550 | spin_lock_irq(&xhci->lock); |
546 | xhci_halt(xhci); | 551 | xhci_halt(xhci); |
547 | xhci_cleanup_msix(xhci); | ||
548 | spin_unlock_irq(&xhci->lock); | 552 | spin_unlock_irq(&xhci->lock); |
549 | 553 | ||
554 | xhci_cleanup_msix(xhci); | ||
555 | |||
550 | xhci_dbg(xhci, "xhci_shutdown completed - status = %x\n", | 556 | xhci_dbg(xhci, "xhci_shutdown completed - status = %x\n", |
551 | xhci_readl(xhci, &xhci->op_regs->status)); | 557 | xhci_readl(xhci, &xhci->op_regs->status)); |
552 | } | 558 | } |
@@ -647,6 +653,7 @@ int xhci_suspend(struct xhci_hcd *xhci) | |||
647 | int rc = 0; | 653 | int rc = 0; |
648 | struct usb_hcd *hcd = xhci_to_hcd(xhci); | 654 | struct usb_hcd *hcd = xhci_to_hcd(xhci); |
649 | u32 command; | 655 | u32 command; |
656 | int i; | ||
650 | 657 | ||
651 | spin_lock_irq(&xhci->lock); | 658 | spin_lock_irq(&xhci->lock); |
652 | clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); | 659 | clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); |
@@ -677,10 +684,15 @@ int xhci_suspend(struct xhci_hcd *xhci) | |||
677 | spin_unlock_irq(&xhci->lock); | 684 | spin_unlock_irq(&xhci->lock); |
678 | return -ETIMEDOUT; | 685 | return -ETIMEDOUT; |
679 | } | 686 | } |
680 | /* step 5: remove core well power */ | ||
681 | xhci_cleanup_msix(xhci); | ||
682 | spin_unlock_irq(&xhci->lock); | 687 | spin_unlock_irq(&xhci->lock); |
683 | 688 | ||
689 | /* step 5: remove core well power */ | ||
690 | /* synchronize irq when using MSI-X */ | ||
691 | if (xhci->msix_entries) { | ||
692 | for (i = 0; i < xhci->msix_count; i++) | ||
693 | synchronize_irq(xhci->msix_entries[i].vector); | ||
694 | } | ||
695 | |||
684 | return rc; | 696 | return rc; |
685 | } | 697 | } |
686 | 698 | ||
@@ -694,7 +706,6 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) | |||
694 | { | 706 | { |
695 | u32 command, temp = 0; | 707 | u32 command, temp = 0; |
696 | struct usb_hcd *hcd = xhci_to_hcd(xhci); | 708 | struct usb_hcd *hcd = xhci_to_hcd(xhci); |
697 | struct pci_dev *pdev = to_pci_dev(hcd->self.controller); | ||
698 | int old_state, retval; | 709 | int old_state, retval; |
699 | 710 | ||
700 | old_state = hcd->state; | 711 | old_state = hcd->state; |
@@ -729,9 +740,8 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) | |||
729 | xhci_dbg(xhci, "Stop HCD\n"); | 740 | xhci_dbg(xhci, "Stop HCD\n"); |
730 | xhci_halt(xhci); | 741 | xhci_halt(xhci); |
731 | xhci_reset(xhci); | 742 | xhci_reset(xhci); |
732 | if (hibernated) | ||
733 | xhci_cleanup_msix(xhci); | ||
734 | spin_unlock_irq(&xhci->lock); | 743 | spin_unlock_irq(&xhci->lock); |
744 | xhci_cleanup_msix(xhci); | ||
735 | 745 | ||
736 | #ifdef CONFIG_USB_XHCI_HCD_DEBUGGING | 746 | #ifdef CONFIG_USB_XHCI_HCD_DEBUGGING |
737 | /* Tell the event ring poll function not to reschedule */ | 747 | /* Tell the event ring poll function not to reschedule */ |
@@ -765,30 +775,6 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) | |||
765 | return retval; | 775 | return retval; |
766 | } | 776 | } |
767 | 777 | ||
768 | spin_unlock_irq(&xhci->lock); | ||
769 | /* Re-setup MSI-X */ | ||
770 | if (hcd->irq) | ||
771 | free_irq(hcd->irq, hcd); | ||
772 | hcd->irq = -1; | ||
773 | |||
774 | retval = xhci_setup_msix(xhci); | ||
775 | if (retval) | ||
776 | /* fall back to msi*/ | ||
777 | retval = xhci_setup_msi(xhci); | ||
778 | |||
779 | if (retval) { | ||
780 | /* fall back to legacy interrupt*/ | ||
781 | retval = request_irq(pdev->irq, &usb_hcd_irq, IRQF_SHARED, | ||
782 | hcd->irq_descr, hcd); | ||
783 | if (retval) { | ||
784 | xhci_err(xhci, "request interrupt %d failed\n", | ||
785 | pdev->irq); | ||
786 | return retval; | ||
787 | } | ||
788 | hcd->irq = pdev->irq; | ||
789 | } | ||
790 | |||
791 | spin_lock_irq(&xhci->lock); | ||
792 | /* step 4: set Run/Stop bit */ | 778 | /* step 4: set Run/Stop bit */ |
793 | command = xhci_readl(xhci, &xhci->op_regs->command); | 779 | command = xhci_readl(xhci, &xhci->op_regs->command); |
794 | command |= CMD_RUN; | 780 | command |= CMD_RUN; |
@@ -2445,8 +2431,12 @@ int xhci_alloc_dev(struct usb_hcd *hcd, struct usb_device *udev) | |||
2445 | xhci_err(xhci, "Error while assigning device slot ID\n"); | 2431 | xhci_err(xhci, "Error while assigning device slot ID\n"); |
2446 | return 0; | 2432 | return 0; |
2447 | } | 2433 | } |
2448 | /* xhci_alloc_virt_device() does not touch rings; no need to lock */ | 2434 | /* xhci_alloc_virt_device() does not touch rings; no need to lock. |
2449 | if (!xhci_alloc_virt_device(xhci, xhci->slot_id, udev, GFP_KERNEL)) { | 2435 | * Use GFP_NOIO, since this function can be called from |
2436 | * xhci_discover_or_reset_device(), which may be called as part of | ||
2437 | * mass storage driver error handling. | ||
2438 | */ | ||
2439 | if (!xhci_alloc_virt_device(xhci, xhci->slot_id, udev, GFP_NOIO)) { | ||
2450 | /* Disable slot, if we can do it without mem alloc */ | 2440 | /* Disable slot, if we can do it without mem alloc */ |
2451 | xhci_warn(xhci, "Could not allocate xHCI USB device data structures\n"); | 2441 | xhci_warn(xhci, "Could not allocate xHCI USB device data structures\n"); |
2452 | spin_lock_irqsave(&xhci->lock, flags); | 2442 | spin_lock_irqsave(&xhci->lock, flags); |
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index 170c367112d2..7f236fd22015 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h | |||
@@ -436,22 +436,18 @@ struct xhci_run_regs { | |||
436 | /** | 436 | /** |
437 | * struct doorbell_array | 437 | * struct doorbell_array |
438 | * | 438 | * |
439 | * Bits 0 - 7: Endpoint target | ||
440 | * Bits 8 - 15: RsvdZ | ||
441 | * Bits 16 - 31: Stream ID | ||
442 | * | ||
439 | * Section 5.6 | 443 | * Section 5.6 |
440 | */ | 444 | */ |
441 | struct xhci_doorbell_array { | 445 | struct xhci_doorbell_array { |
442 | u32 doorbell[256]; | 446 | u32 doorbell[256]; |
443 | }; | 447 | }; |
444 | 448 | ||
445 | #define DB_TARGET_MASK 0xFFFFFF00 | 449 | #define DB_VALUE(ep, stream) ((((ep) + 1) & 0xff) | ((stream) << 16)) |
446 | #define DB_STREAM_ID_MASK 0x0000FFFF | 450 | #define DB_VALUE_HOST 0x00000000 |
447 | #define DB_TARGET_HOST 0x0 | ||
448 | #define DB_STREAM_ID_HOST 0x0 | ||
449 | #define DB_MASK (0xff << 8) | ||
450 | |||
451 | /* Endpoint Target - bits 0:7 */ | ||
452 | #define EPI_TO_DB(p) (((p) + 1) & 0xff) | ||
453 | #define STREAM_ID_TO_DB(p) (((p) & 0xffff) << 16) | ||
454 | |||
455 | 451 | ||
456 | /** | 452 | /** |
457 | * struct xhci_protocol_caps | 453 | * struct xhci_protocol_caps |
diff --git a/drivers/usb/misc/usbled.c b/drivers/usb/misc/usbled.c index 1732d9bc097e..1616ad1793a4 100644 --- a/drivers/usb/misc/usbled.c +++ b/drivers/usb/misc/usbled.c | |||
@@ -45,7 +45,7 @@ struct usb_led { | |||
45 | 45 | ||
46 | static void change_color(struct usb_led *led) | 46 | static void change_color(struct usb_led *led) |
47 | { | 47 | { |
48 | int retval; | 48 | int retval = 0; |
49 | unsigned char *buffer; | 49 | unsigned char *buffer; |
50 | 50 | ||
51 | buffer = kmalloc(8, GFP_KERNEL); | 51 | buffer = kmalloc(8, GFP_KERNEL); |
diff --git a/drivers/usb/misc/uss720.c b/drivers/usb/misc/uss720.c index 4ff21587ab03..f7a205738032 100644 --- a/drivers/usb/misc/uss720.c +++ b/drivers/usb/misc/uss720.c | |||
@@ -776,7 +776,6 @@ static const struct usb_device_id uss720_table[] = { | |||
776 | { USB_DEVICE(0x0557, 0x2001) }, | 776 | { USB_DEVICE(0x0557, 0x2001) }, |
777 | { USB_DEVICE(0x0729, 0x1284) }, | 777 | { USB_DEVICE(0x0729, 0x1284) }, |
778 | { USB_DEVICE(0x1293, 0x0002) }, | 778 | { USB_DEVICE(0x1293, 0x0002) }, |
779 | { USB_DEVICE(0x1293, 0x0002) }, | ||
780 | { USB_DEVICE(0x050d, 0x0002) }, | 779 | { USB_DEVICE(0x050d, 0x0002) }, |
781 | { } /* Terminating entry */ | 780 | { } /* Terminating entry */ |
782 | }; | 781 | }; |
diff --git a/drivers/usb/otg/nop-usb-xceiv.c b/drivers/usb/otg/nop-usb-xceiv.c index e70014ab0976..8acf165fe13b 100644 --- a/drivers/usb/otg/nop-usb-xceiv.c +++ b/drivers/usb/otg/nop-usb-xceiv.c | |||
@@ -132,6 +132,8 @@ static int __devinit nop_usb_xceiv_probe(struct platform_device *pdev) | |||
132 | 132 | ||
133 | platform_set_drvdata(pdev, nop); | 133 | platform_set_drvdata(pdev, nop); |
134 | 134 | ||
135 | BLOCKING_INIT_NOTIFIER_HEAD(&nop->otg.notifier); | ||
136 | |||
135 | return 0; | 137 | return 0; |
136 | exit: | 138 | exit: |
137 | kfree(nop); | 139 | kfree(nop); |
diff --git a/drivers/usb/otg/ulpi.c b/drivers/usb/otg/ulpi.c index 059d9ac0ab5b..770d799d5afb 100644 --- a/drivers/usb/otg/ulpi.c +++ b/drivers/usb/otg/ulpi.c | |||
@@ -45,7 +45,7 @@ struct ulpi_info { | |||
45 | /* ULPI hardcoded IDs, used for probing */ | 45 | /* ULPI hardcoded IDs, used for probing */ |
46 | static struct ulpi_info ulpi_ids[] = { | 46 | static struct ulpi_info ulpi_ids[] = { |
47 | ULPI_INFO(ULPI_ID(0x04cc, 0x1504), "NXP ISP1504"), | 47 | ULPI_INFO(ULPI_ID(0x04cc, 0x1504), "NXP ISP1504"), |
48 | ULPI_INFO(ULPI_ID(0x0424, 0x0006), "SMSC USB3319"), | 48 | ULPI_INFO(ULPI_ID(0x0424, 0x0006), "SMSC USB331x"), |
49 | }; | 49 | }; |
50 | 50 | ||
51 | static int ulpi_set_otg_flags(struct otg_transceiver *otg) | 51 | static int ulpi_set_otg_flags(struct otg_transceiver *otg) |
diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c index 63f7cc45bcac..7b8815ddf368 100644 --- a/drivers/usb/serial/ch341.c +++ b/drivers/usb/serial/ch341.c | |||
@@ -486,12 +486,22 @@ static void ch341_read_int_callback(struct urb *urb) | |||
486 | if (actual_length >= 4) { | 486 | if (actual_length >= 4) { |
487 | struct ch341_private *priv = usb_get_serial_port_data(port); | 487 | struct ch341_private *priv = usb_get_serial_port_data(port); |
488 | unsigned long flags; | 488 | unsigned long flags; |
489 | u8 prev_line_status = priv->line_status; | ||
489 | 490 | ||
490 | spin_lock_irqsave(&priv->lock, flags); | 491 | spin_lock_irqsave(&priv->lock, flags); |
491 | priv->line_status = (~(data[2])) & CH341_BITS_MODEM_STAT; | 492 | priv->line_status = (~(data[2])) & CH341_BITS_MODEM_STAT; |
492 | if ((data[1] & CH341_MULT_STAT)) | 493 | if ((data[1] & CH341_MULT_STAT)) |
493 | priv->multi_status_change = 1; | 494 | priv->multi_status_change = 1; |
494 | spin_unlock_irqrestore(&priv->lock, flags); | 495 | spin_unlock_irqrestore(&priv->lock, flags); |
496 | |||
497 | if ((priv->line_status ^ prev_line_status) & CH341_BIT_DCD) { | ||
498 | struct tty_struct *tty = tty_port_tty_get(&port->port); | ||
499 | if (tty) | ||
500 | usb_serial_handle_dcd_change(port, tty, | ||
501 | priv->line_status & CH341_BIT_DCD); | ||
502 | tty_kref_put(tty); | ||
503 | } | ||
504 | |||
495 | wake_up_interruptible(&priv->delta_msr_wait); | 505 | wake_up_interruptible(&priv->delta_msr_wait); |
496 | } | 506 | } |
497 | 507 | ||
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c index 8d7731dbf478..735ea03157ab 100644 --- a/drivers/usb/serial/cp210x.c +++ b/drivers/usb/serial/cp210x.c | |||
@@ -49,7 +49,6 @@ static int cp210x_tiocmset_port(struct usb_serial_port *port, struct file *, | |||
49 | static void cp210x_break_ctl(struct tty_struct *, int); | 49 | static void cp210x_break_ctl(struct tty_struct *, int); |
50 | static int cp210x_startup(struct usb_serial *); | 50 | static int cp210x_startup(struct usb_serial *); |
51 | static void cp210x_dtr_rts(struct usb_serial_port *p, int on); | 51 | static void cp210x_dtr_rts(struct usb_serial_port *p, int on); |
52 | static int cp210x_carrier_raised(struct usb_serial_port *p); | ||
53 | 52 | ||
54 | static int debug; | 53 | static int debug; |
55 | 54 | ||
@@ -87,7 +86,6 @@ static const struct usb_device_id id_table[] = { | |||
87 | { USB_DEVICE(0x10C4, 0x8115) }, /* Arygon NFC/Mifare Reader */ | 86 | { USB_DEVICE(0x10C4, 0x8115) }, /* Arygon NFC/Mifare Reader */ |
88 | { USB_DEVICE(0x10C4, 0x813D) }, /* Burnside Telecom Deskmobile */ | 87 | { USB_DEVICE(0x10C4, 0x813D) }, /* Burnside Telecom Deskmobile */ |
89 | { USB_DEVICE(0x10C4, 0x813F) }, /* Tams Master Easy Control */ | 88 | { USB_DEVICE(0x10C4, 0x813F) }, /* Tams Master Easy Control */ |
90 | { USB_DEVICE(0x10C4, 0x8149) }, /* West Mountain Radio Computerized Battery Analyzer */ | ||
91 | { USB_DEVICE(0x10C4, 0x814A) }, /* West Mountain Radio RIGblaster P&P */ | 89 | { USB_DEVICE(0x10C4, 0x814A) }, /* West Mountain Radio RIGblaster P&P */ |
92 | { USB_DEVICE(0x10C4, 0x814B) }, /* West Mountain Radio RIGtalk */ | 90 | { USB_DEVICE(0x10C4, 0x814B) }, /* West Mountain Radio RIGtalk */ |
93 | { USB_DEVICE(0x10C4, 0x8156) }, /* B&G H3000 link cable */ | 91 | { USB_DEVICE(0x10C4, 0x8156) }, /* B&G H3000 link cable */ |
@@ -110,7 +108,9 @@ static const struct usb_device_id id_table[] = { | |||
110 | { USB_DEVICE(0x10C4, 0x8341) }, /* Siemens MC35PU GPRS Modem */ | 108 | { USB_DEVICE(0x10C4, 0x8341) }, /* Siemens MC35PU GPRS Modem */ |
111 | { USB_DEVICE(0x10C4, 0x8382) }, /* Cygnal Integrated Products, Inc. */ | 109 | { USB_DEVICE(0x10C4, 0x8382) }, /* Cygnal Integrated Products, Inc. */ |
112 | { USB_DEVICE(0x10C4, 0x83A8) }, /* Amber Wireless AMB2560 */ | 110 | { USB_DEVICE(0x10C4, 0x83A8) }, /* Amber Wireless AMB2560 */ |
111 | { USB_DEVICE(0x10C4, 0x83D8) }, /* DekTec DTA Plus VHF/UHF Booster/Attenuator */ | ||
113 | { USB_DEVICE(0x10C4, 0x8411) }, /* Kyocera GPS Module */ | 112 | { USB_DEVICE(0x10C4, 0x8411) }, /* Kyocera GPS Module */ |
113 | { USB_DEVICE(0x10C4, 0x8418) }, /* IRZ Automation Teleport SG-10 GSM/GPRS Modem */ | ||
114 | { USB_DEVICE(0x10C4, 0x846E) }, /* BEI USB Sensor Interface (VCP) */ | 114 | { USB_DEVICE(0x10C4, 0x846E) }, /* BEI USB Sensor Interface (VCP) */ |
115 | { USB_DEVICE(0x10C4, 0x8477) }, /* Balluff RFID */ | 115 | { USB_DEVICE(0x10C4, 0x8477) }, /* Balluff RFID */ |
116 | { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */ | 116 | { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */ |
@@ -165,8 +165,7 @@ static struct usb_serial_driver cp210x_device = { | |||
165 | .tiocmget = cp210x_tiocmget, | 165 | .tiocmget = cp210x_tiocmget, |
166 | .tiocmset = cp210x_tiocmset, | 166 | .tiocmset = cp210x_tiocmset, |
167 | .attach = cp210x_startup, | 167 | .attach = cp210x_startup, |
168 | .dtr_rts = cp210x_dtr_rts, | 168 | .dtr_rts = cp210x_dtr_rts |
169 | .carrier_raised = cp210x_carrier_raised | ||
170 | }; | 169 | }; |
171 | 170 | ||
172 | /* Config request types */ | 171 | /* Config request types */ |
@@ -765,15 +764,6 @@ static int cp210x_tiocmget (struct tty_struct *tty, struct file *file) | |||
765 | return result; | 764 | return result; |
766 | } | 765 | } |
767 | 766 | ||
768 | static int cp210x_carrier_raised(struct usb_serial_port *p) | ||
769 | { | ||
770 | unsigned int control; | ||
771 | cp210x_get_config(p, CP210X_GET_MDMSTS, &control, 1); | ||
772 | if (control & CONTROL_DCD) | ||
773 | return 1; | ||
774 | return 0; | ||
775 | } | ||
776 | |||
777 | static void cp210x_break_ctl (struct tty_struct *tty, int break_state) | 767 | static void cp210x_break_ctl (struct tty_struct *tty, int break_state) |
778 | { | 768 | { |
779 | struct usb_serial_port *port = tty->driver_data; | 769 | struct usb_serial_port *port = tty->driver_data; |
diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c index b92070c103cd..666e5a6edd82 100644 --- a/drivers/usb/serial/digi_acceleport.c +++ b/drivers/usb/serial/digi_acceleport.c | |||
@@ -455,7 +455,6 @@ static int digi_write_room(struct tty_struct *tty); | |||
455 | static int digi_chars_in_buffer(struct tty_struct *tty); | 455 | static int digi_chars_in_buffer(struct tty_struct *tty); |
456 | static int digi_open(struct tty_struct *tty, struct usb_serial_port *port); | 456 | static int digi_open(struct tty_struct *tty, struct usb_serial_port *port); |
457 | static void digi_close(struct usb_serial_port *port); | 457 | static void digi_close(struct usb_serial_port *port); |
458 | static int digi_carrier_raised(struct usb_serial_port *port); | ||
459 | static void digi_dtr_rts(struct usb_serial_port *port, int on); | 458 | static void digi_dtr_rts(struct usb_serial_port *port, int on); |
460 | static int digi_startup_device(struct usb_serial *serial); | 459 | static int digi_startup_device(struct usb_serial *serial); |
461 | static int digi_startup(struct usb_serial *serial); | 460 | static int digi_startup(struct usb_serial *serial); |
@@ -511,7 +510,6 @@ static struct usb_serial_driver digi_acceleport_2_device = { | |||
511 | .open = digi_open, | 510 | .open = digi_open, |
512 | .close = digi_close, | 511 | .close = digi_close, |
513 | .dtr_rts = digi_dtr_rts, | 512 | .dtr_rts = digi_dtr_rts, |
514 | .carrier_raised = digi_carrier_raised, | ||
515 | .write = digi_write, | 513 | .write = digi_write, |
516 | .write_room = digi_write_room, | 514 | .write_room = digi_write_room, |
517 | .write_bulk_callback = digi_write_bulk_callback, | 515 | .write_bulk_callback = digi_write_bulk_callback, |
@@ -1339,14 +1337,6 @@ static void digi_dtr_rts(struct usb_serial_port *port, int on) | |||
1339 | digi_set_modem_signals(port, on * (TIOCM_DTR|TIOCM_RTS), 1); | 1337 | digi_set_modem_signals(port, on * (TIOCM_DTR|TIOCM_RTS), 1); |
1340 | } | 1338 | } |
1341 | 1339 | ||
1342 | static int digi_carrier_raised(struct usb_serial_port *port) | ||
1343 | { | ||
1344 | struct digi_port *priv = usb_get_serial_port_data(port); | ||
1345 | if (priv->dp_modem_signals & TIOCM_CD) | ||
1346 | return 1; | ||
1347 | return 0; | ||
1348 | } | ||
1349 | |||
1350 | static int digi_open(struct tty_struct *tty, struct usb_serial_port *port) | 1340 | static int digi_open(struct tty_struct *tty, struct usb_serial_port *port) |
1351 | { | 1341 | { |
1352 | int ret; | 1342 | int ret; |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index a2668d089260..4787c0cd063f 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -676,7 +676,17 @@ static struct usb_device_id id_table_combined [] = { | |||
676 | { USB_DEVICE(FTDI_VID, FTDI_PCDJ_DAC2_PID) }, | 676 | { USB_DEVICE(FTDI_VID, FTDI_PCDJ_DAC2_PID) }, |
677 | { USB_DEVICE(FTDI_VID, FTDI_RRCIRKITS_LOCOBUFFER_PID) }, | 677 | { USB_DEVICE(FTDI_VID, FTDI_RRCIRKITS_LOCOBUFFER_PID) }, |
678 | { USB_DEVICE(FTDI_VID, FTDI_ASK_RDR400_PID) }, | 678 | { USB_DEVICE(FTDI_VID, FTDI_ASK_RDR400_PID) }, |
679 | { USB_DEVICE(ICOM_ID1_VID, ICOM_ID1_PID) }, | 679 | { USB_DEVICE(ICOM_VID, ICOM_ID_1_PID) }, |
680 | { USB_DEVICE(ICOM_VID, ICOM_OPC_U_UC_PID) }, | ||
681 | { USB_DEVICE(ICOM_VID, ICOM_ID_RP2C1_PID) }, | ||
682 | { USB_DEVICE(ICOM_VID, ICOM_ID_RP2C2_PID) }, | ||
683 | { USB_DEVICE(ICOM_VID, ICOM_ID_RP2D_PID) }, | ||
684 | { USB_DEVICE(ICOM_VID, ICOM_ID_RP2VT_PID) }, | ||
685 | { USB_DEVICE(ICOM_VID, ICOM_ID_RP2VR_PID) }, | ||
686 | { USB_DEVICE(ICOM_VID, ICOM_ID_RP4KVT_PID) }, | ||
687 | { USB_DEVICE(ICOM_VID, ICOM_ID_RP4KVR_PID) }, | ||
688 | { USB_DEVICE(ICOM_VID, ICOM_ID_RP2KVT_PID) }, | ||
689 | { USB_DEVICE(ICOM_VID, ICOM_ID_RP2KVR_PID) }, | ||
680 | { USB_DEVICE(FTDI_VID, FTDI_ACG_HFDUAL_PID) }, | 690 | { USB_DEVICE(FTDI_VID, FTDI_ACG_HFDUAL_PID) }, |
681 | { USB_DEVICE(FTDI_VID, FTDI_YEI_SERVOCENTER31_PID) }, | 691 | { USB_DEVICE(FTDI_VID, FTDI_YEI_SERVOCENTER31_PID) }, |
682 | { USB_DEVICE(FTDI_VID, FTDI_THORLABS_PID) }, | 692 | { USB_DEVICE(FTDI_VID, FTDI_THORLABS_PID) }, |
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h index bf0867285481..ed160def8584 100644 --- a/drivers/usb/serial/ftdi_sio_ids.h +++ b/drivers/usb/serial/ftdi_sio_ids.h | |||
@@ -569,11 +569,23 @@ | |||
569 | #define OCT_US101_PID 0x0421 /* OCT US101 USB to RS-232 */ | 569 | #define OCT_US101_PID 0x0421 /* OCT US101 USB to RS-232 */ |
570 | 570 | ||
571 | /* | 571 | /* |
572 | * Icom ID-1 digital transceiver | 572 | * Definitions for Icom Inc. devices |
573 | */ | 573 | */ |
574 | 574 | #define ICOM_VID 0x0C26 /* Icom vendor ID */ | |
575 | #define ICOM_ID1_VID 0x0C26 | 575 | /* Note: ID-1 is a communications tranceiver for HAM-radio operators */ |
576 | #define ICOM_ID1_PID 0x0004 | 576 | #define ICOM_ID_1_PID 0x0004 /* ID-1 USB to RS-232 */ |
577 | /* Note: OPC is an Optional cable to connect an Icom Tranceiver */ | ||
578 | #define ICOM_OPC_U_UC_PID 0x0018 /* OPC-478UC, OPC-1122U cloning cable */ | ||
579 | /* Note: ID-RP* devices are Icom Repeater Devices for HAM-radio */ | ||
580 | #define ICOM_ID_RP2C1_PID 0x0009 /* ID-RP2C Asset 1 to RS-232 */ | ||
581 | #define ICOM_ID_RP2C2_PID 0x000A /* ID-RP2C Asset 2 to RS-232 */ | ||
582 | #define ICOM_ID_RP2D_PID 0x000B /* ID-RP2D configuration port*/ | ||
583 | #define ICOM_ID_RP2VT_PID 0x000C /* ID-RP2V Transmit config port */ | ||
584 | #define ICOM_ID_RP2VR_PID 0x000D /* ID-RP2V Receive config port */ | ||
585 | #define ICOM_ID_RP4KVT_PID 0x0010 /* ID-RP4000V Transmit config port */ | ||
586 | #define ICOM_ID_RP4KVR_PID 0x0011 /* ID-RP4000V Receive config port */ | ||
587 | #define ICOM_ID_RP2KVT_PID 0x0012 /* ID-RP2000V Transmit config port */ | ||
588 | #define ICOM_ID_RP2KVR_PID 0x0013 /* ID-RP2000V Receive config port */ | ||
577 | 589 | ||
578 | /* | 590 | /* |
579 | * GN Otometrics (http://www.otometrics.com) | 591 | * GN Otometrics (http://www.otometrics.com) |
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c index e6833e216fc9..e4db5ad2bc55 100644 --- a/drivers/usb/serial/generic.c +++ b/drivers/usb/serial/generic.c | |||
@@ -479,6 +479,26 @@ int usb_serial_handle_break(struct usb_serial_port *port) | |||
479 | } | 479 | } |
480 | EXPORT_SYMBOL_GPL(usb_serial_handle_break); | 480 | EXPORT_SYMBOL_GPL(usb_serial_handle_break); |
481 | 481 | ||
482 | /** | ||
483 | * usb_serial_handle_dcd_change - handle a change of carrier detect state | ||
484 | * @port: usb_serial_port structure for the open port | ||
485 | * @tty: tty_struct structure for the port | ||
486 | * @status: new carrier detect status, nonzero if active | ||
487 | */ | ||
488 | void usb_serial_handle_dcd_change(struct usb_serial_port *usb_port, | ||
489 | struct tty_struct *tty, unsigned int status) | ||
490 | { | ||
491 | struct tty_port *port = &usb_port->port; | ||
492 | |||
493 | dbg("%s - port %d, status %d", __func__, usb_port->number, status); | ||
494 | |||
495 | if (status) | ||
496 | wake_up_interruptible(&port->open_wait); | ||
497 | else if (tty && !C_CLOCAL(tty)) | ||
498 | tty_hangup(tty); | ||
499 | } | ||
500 | EXPORT_SYMBOL_GPL(usb_serial_handle_dcd_change); | ||
501 | |||
482 | int usb_serial_generic_resume(struct usb_serial *serial) | 502 | int usb_serial_generic_resume(struct usb_serial *serial) |
483 | { | 503 | { |
484 | struct usb_serial_port *port; | 504 | struct usb_serial_port *port; |
diff --git a/drivers/usb/serial/io_tables.h b/drivers/usb/serial/io_tables.h index 6ab2a3f97fe8..178b22eb32b1 100644 --- a/drivers/usb/serial/io_tables.h +++ b/drivers/usb/serial/io_tables.h | |||
@@ -199,6 +199,7 @@ static struct usb_serial_driver epic_device = { | |||
199 | .name = "epic", | 199 | .name = "epic", |
200 | }, | 200 | }, |
201 | .description = "EPiC device", | 201 | .description = "EPiC device", |
202 | .usb_driver = &io_driver, | ||
202 | .id_table = Epic_port_id_table, | 203 | .id_table = Epic_port_id_table, |
203 | .num_ports = 1, | 204 | .num_ports = 1, |
204 | .open = edge_open, | 205 | .open = edge_open, |
diff --git a/drivers/usb/serial/iuu_phoenix.c b/drivers/usb/serial/iuu_phoenix.c index 12ed594f5f80..99b97c04896f 100644 --- a/drivers/usb/serial/iuu_phoenix.c +++ b/drivers/usb/serial/iuu_phoenix.c | |||
@@ -1275,6 +1275,7 @@ static struct usb_serial_driver iuu_device = { | |||
1275 | .name = "iuu_phoenix", | 1275 | .name = "iuu_phoenix", |
1276 | }, | 1276 | }, |
1277 | .id_table = id_table, | 1277 | .id_table = id_table, |
1278 | .usb_driver = &iuu_driver, | ||
1278 | .num_ports = 1, | 1279 | .num_ports = 1, |
1279 | .bulk_in_size = 512, | 1280 | .bulk_in_size = 512, |
1280 | .bulk_out_size = 512, | 1281 | .bulk_out_size = 512, |
diff --git a/drivers/usb/serial/keyspan.h b/drivers/usb/serial/keyspan.h index 2d8baf6ac472..ce134dc28ddf 100644 --- a/drivers/usb/serial/keyspan.h +++ b/drivers/usb/serial/keyspan.h | |||
@@ -546,6 +546,7 @@ static struct usb_serial_driver keyspan_pre_device = { | |||
546 | .name = "keyspan_no_firm", | 546 | .name = "keyspan_no_firm", |
547 | }, | 547 | }, |
548 | .description = "Keyspan - (without firmware)", | 548 | .description = "Keyspan - (without firmware)", |
549 | .usb_driver = &keyspan_driver, | ||
549 | .id_table = keyspan_pre_ids, | 550 | .id_table = keyspan_pre_ids, |
550 | .num_ports = 1, | 551 | .num_ports = 1, |
551 | .attach = keyspan_fake_startup, | 552 | .attach = keyspan_fake_startup, |
@@ -557,6 +558,7 @@ static struct usb_serial_driver keyspan_1port_device = { | |||
557 | .name = "keyspan_1", | 558 | .name = "keyspan_1", |
558 | }, | 559 | }, |
559 | .description = "Keyspan 1 port adapter", | 560 | .description = "Keyspan 1 port adapter", |
561 | .usb_driver = &keyspan_driver, | ||
560 | .id_table = keyspan_1port_ids, | 562 | .id_table = keyspan_1port_ids, |
561 | .num_ports = 1, | 563 | .num_ports = 1, |
562 | .open = keyspan_open, | 564 | .open = keyspan_open, |
@@ -579,6 +581,7 @@ static struct usb_serial_driver keyspan_2port_device = { | |||
579 | .name = "keyspan_2", | 581 | .name = "keyspan_2", |
580 | }, | 582 | }, |
581 | .description = "Keyspan 2 port adapter", | 583 | .description = "Keyspan 2 port adapter", |
584 | .usb_driver = &keyspan_driver, | ||
582 | .id_table = keyspan_2port_ids, | 585 | .id_table = keyspan_2port_ids, |
583 | .num_ports = 2, | 586 | .num_ports = 2, |
584 | .open = keyspan_open, | 587 | .open = keyspan_open, |
@@ -601,6 +604,7 @@ static struct usb_serial_driver keyspan_4port_device = { | |||
601 | .name = "keyspan_4", | 604 | .name = "keyspan_4", |
602 | }, | 605 | }, |
603 | .description = "Keyspan 4 port adapter", | 606 | .description = "Keyspan 4 port adapter", |
607 | .usb_driver = &keyspan_driver, | ||
604 | .id_table = keyspan_4port_ids, | 608 | .id_table = keyspan_4port_ids, |
605 | .num_ports = 4, | 609 | .num_ports = 4, |
606 | .open = keyspan_open, | 610 | .open = keyspan_open, |
diff --git a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c index a10dd5676ccc..554a8693a463 100644 --- a/drivers/usb/serial/keyspan_pda.c +++ b/drivers/usb/serial/keyspan_pda.c | |||
@@ -679,22 +679,6 @@ static void keyspan_pda_dtr_rts(struct usb_serial_port *port, int on) | |||
679 | } | 679 | } |
680 | } | 680 | } |
681 | 681 | ||
682 | static int keyspan_pda_carrier_raised(struct usb_serial_port *port) | ||
683 | { | ||
684 | struct usb_serial *serial = port->serial; | ||
685 | unsigned char modembits; | ||
686 | |||
687 | /* If we can read the modem status and the DCD is low then | ||
688 | carrier is not raised yet */ | ||
689 | if (keyspan_pda_get_modem_info(serial, &modembits) >= 0) { | ||
690 | if (!(modembits & (1>>6))) | ||
691 | return 0; | ||
692 | } | ||
693 | /* Carrier raised, or we failed (eg disconnected) so | ||
694 | progress accordingly */ | ||
695 | return 1; | ||
696 | } | ||
697 | |||
698 | 682 | ||
699 | static int keyspan_pda_open(struct tty_struct *tty, | 683 | static int keyspan_pda_open(struct tty_struct *tty, |
700 | struct usb_serial_port *port) | 684 | struct usb_serial_port *port) |
@@ -881,7 +865,6 @@ static struct usb_serial_driver keyspan_pda_device = { | |||
881 | .id_table = id_table_std, | 865 | .id_table = id_table_std, |
882 | .num_ports = 1, | 866 | .num_ports = 1, |
883 | .dtr_rts = keyspan_pda_dtr_rts, | 867 | .dtr_rts = keyspan_pda_dtr_rts, |
884 | .carrier_raised = keyspan_pda_carrier_raised, | ||
885 | .open = keyspan_pda_open, | 868 | .open = keyspan_pda_open, |
886 | .close = keyspan_pda_close, | 869 | .close = keyspan_pda_close, |
887 | .write = keyspan_pda_write, | 870 | .write = keyspan_pda_write, |
diff --git a/drivers/usb/serial/moto_modem.c b/drivers/usb/serial/moto_modem.c index cf1718394e18..653465f61d4a 100644 --- a/drivers/usb/serial/moto_modem.c +++ b/drivers/usb/serial/moto_modem.c | |||
@@ -44,6 +44,7 @@ static struct usb_serial_driver moto_device = { | |||
44 | .name = "moto-modem", | 44 | .name = "moto-modem", |
45 | }, | 45 | }, |
46 | .id_table = id_table, | 46 | .id_table = id_table, |
47 | .usb_driver = &moto_driver, | ||
47 | .num_ports = 1, | 48 | .num_ports = 1, |
48 | }; | 49 | }; |
49 | 50 | ||
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index 748778288d94..5f46838dfee5 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
@@ -382,7 +382,16 @@ static void option_instat_callback(struct urb *urb); | |||
382 | #define HAIER_VENDOR_ID 0x201e | 382 | #define HAIER_VENDOR_ID 0x201e |
383 | #define HAIER_PRODUCT_CE100 0x2009 | 383 | #define HAIER_PRODUCT_CE100 0x2009 |
384 | 384 | ||
385 | #define CINTERION_VENDOR_ID 0x0681 | 385 | /* Cinterion (formerly Siemens) products */ |
386 | #define SIEMENS_VENDOR_ID 0x0681 | ||
387 | #define CINTERION_VENDOR_ID 0x1e2d | ||
388 | #define CINTERION_PRODUCT_HC25_MDM 0x0047 | ||
389 | #define CINTERION_PRODUCT_HC25_MDMNET 0x0040 | ||
390 | #define CINTERION_PRODUCT_HC28_MDM 0x004C | ||
391 | #define CINTERION_PRODUCT_HC28_MDMNET 0x004A /* same for HC28J */ | ||
392 | #define CINTERION_PRODUCT_EU3_E 0x0051 | ||
393 | #define CINTERION_PRODUCT_EU3_P 0x0052 | ||
394 | #define CINTERION_PRODUCT_PH8 0x0053 | ||
386 | 395 | ||
387 | /* Olivetti products */ | 396 | /* Olivetti products */ |
388 | #define OLIVETTI_VENDOR_ID 0x0b3c | 397 | #define OLIVETTI_VENDOR_ID 0x0b3c |
@@ -944,7 +953,17 @@ static const struct usb_device_id option_ids[] = { | |||
944 | { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_100F) }, | 953 | { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_100F) }, |
945 | { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_1011)}, | 954 | { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_1011)}, |
946 | { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_1012)}, | 955 | { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_1012)}, |
947 | { USB_DEVICE(CINTERION_VENDOR_ID, 0x0047) }, | 956 | /* Cinterion */ |
957 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EU3_E) }, | ||
958 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EU3_P) }, | ||
959 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PH8) }, | ||
960 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDM) }, | ||
961 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDMNET) }, | ||
962 | { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC25_MDM) }, | ||
963 | { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC25_MDMNET) }, | ||
964 | { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC28_MDM) }, /* HC28 enumerates with Siemens or Cinterion VID depending on FW revision */ | ||
965 | { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC28_MDMNET) }, | ||
966 | |||
948 | { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD100) }, | 967 | { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD100) }, |
949 | { USB_DEVICE(CELOT_VENDOR_ID, CELOT_PRODUCT_CT680M) }, /* CT-650 CDMA 450 1xEVDO modem */ | 968 | { USB_DEVICE(CELOT_VENDOR_ID, CELOT_PRODUCT_CT680M) }, /* CT-650 CDMA 450 1xEVDO modem */ |
950 | { USB_DEVICE(ONDA_VENDOR_ID, ONDA_MT825UP) }, /* ONDA MT825UP modem */ | 969 | { USB_DEVICE(ONDA_VENDOR_ID, ONDA_MT825UP) }, /* ONDA MT825UP modem */ |
diff --git a/drivers/usb/serial/oti6858.c b/drivers/usb/serial/oti6858.c index 5be866bb7a41..73613205be7a 100644 --- a/drivers/usb/serial/oti6858.c +++ b/drivers/usb/serial/oti6858.c | |||
@@ -157,6 +157,7 @@ static struct usb_serial_driver oti6858_device = { | |||
157 | .name = "oti6858", | 157 | .name = "oti6858", |
158 | }, | 158 | }, |
159 | .id_table = id_table, | 159 | .id_table = id_table, |
160 | .usb_driver = &oti6858_driver, | ||
160 | .num_ports = 1, | 161 | .num_ports = 1, |
161 | .open = oti6858_open, | 162 | .open = oti6858_open, |
162 | .close = oti6858_close, | 163 | .close = oti6858_close, |
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index 8ae4c6cbc38a..08c9181b8e48 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c | |||
@@ -50,6 +50,7 @@ static const struct usb_device_id id_table[] = { | |||
50 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_MMX) }, | 50 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_MMX) }, |
51 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_GPRS) }, | 51 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_GPRS) }, |
52 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_HCR331) }, | 52 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_HCR331) }, |
53 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_MOTOROLA) }, | ||
53 | { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID) }, | 54 | { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID) }, |
54 | { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID_RSAQ5) }, | 55 | { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID_RSAQ5) }, |
55 | { USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID) }, | 56 | { USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID) }, |
@@ -677,9 +678,11 @@ static void pl2303_update_line_status(struct usb_serial_port *port, | |||
677 | { | 678 | { |
678 | 679 | ||
679 | struct pl2303_private *priv = usb_get_serial_port_data(port); | 680 | struct pl2303_private *priv = usb_get_serial_port_data(port); |
681 | struct tty_struct *tty; | ||
680 | unsigned long flags; | 682 | unsigned long flags; |
681 | u8 status_idx = UART_STATE; | 683 | u8 status_idx = UART_STATE; |
682 | u8 length = UART_STATE + 1; | 684 | u8 length = UART_STATE + 1; |
685 | u8 prev_line_status; | ||
683 | u16 idv, idp; | 686 | u16 idv, idp; |
684 | 687 | ||
685 | idv = le16_to_cpu(port->serial->dev->descriptor.idVendor); | 688 | idv = le16_to_cpu(port->serial->dev->descriptor.idVendor); |
@@ -701,11 +704,20 @@ static void pl2303_update_line_status(struct usb_serial_port *port, | |||
701 | 704 | ||
702 | /* Save off the uart status for others to look at */ | 705 | /* Save off the uart status for others to look at */ |
703 | spin_lock_irqsave(&priv->lock, flags); | 706 | spin_lock_irqsave(&priv->lock, flags); |
707 | prev_line_status = priv->line_status; | ||
704 | priv->line_status = data[status_idx]; | 708 | priv->line_status = data[status_idx]; |
705 | spin_unlock_irqrestore(&priv->lock, flags); | 709 | spin_unlock_irqrestore(&priv->lock, flags); |
706 | if (priv->line_status & UART_BREAK_ERROR) | 710 | if (priv->line_status & UART_BREAK_ERROR) |
707 | usb_serial_handle_break(port); | 711 | usb_serial_handle_break(port); |
708 | wake_up_interruptible(&priv->delta_msr_wait); | 712 | wake_up_interruptible(&priv->delta_msr_wait); |
713 | |||
714 | tty = tty_port_tty_get(&port->port); | ||
715 | if (!tty) | ||
716 | return; | ||
717 | if ((priv->line_status ^ prev_line_status) & UART_DCD) | ||
718 | usb_serial_handle_dcd_change(port, tty, | ||
719 | priv->line_status & UART_DCD); | ||
720 | tty_kref_put(tty); | ||
709 | } | 721 | } |
710 | 722 | ||
711 | static void pl2303_read_int_callback(struct urb *urb) | 723 | static void pl2303_read_int_callback(struct urb *urb) |
diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h index 43eb9bdad422..1b025f75dafd 100644 --- a/drivers/usb/serial/pl2303.h +++ b/drivers/usb/serial/pl2303.h | |||
@@ -21,6 +21,7 @@ | |||
21 | #define PL2303_PRODUCT_ID_MMX 0x0612 | 21 | #define PL2303_PRODUCT_ID_MMX 0x0612 |
22 | #define PL2303_PRODUCT_ID_GPRS 0x0609 | 22 | #define PL2303_PRODUCT_ID_GPRS 0x0609 |
23 | #define PL2303_PRODUCT_ID_HCR331 0x331a | 23 | #define PL2303_PRODUCT_ID_HCR331 0x331a |
24 | #define PL2303_PRODUCT_ID_MOTOROLA 0x0307 | ||
24 | 25 | ||
25 | #define ATEN_VENDOR_ID 0x0557 | 26 | #define ATEN_VENDOR_ID 0x0557 |
26 | #define ATEN_VENDOR_ID2 0x0547 | 27 | #define ATEN_VENDOR_ID2 0x0547 |
diff --git a/drivers/usb/serial/qcaux.c b/drivers/usb/serial/qcaux.c index 214a3e504292..30b73e68a904 100644 --- a/drivers/usb/serial/qcaux.c +++ b/drivers/usb/serial/qcaux.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #define UTSTARCOM_PRODUCT_UM175_V1 0x3712 | 36 | #define UTSTARCOM_PRODUCT_UM175_V1 0x3712 |
37 | #define UTSTARCOM_PRODUCT_UM175_V2 0x3714 | 37 | #define UTSTARCOM_PRODUCT_UM175_V2 0x3714 |
38 | #define UTSTARCOM_PRODUCT_UM175_ALLTEL 0x3715 | 38 | #define UTSTARCOM_PRODUCT_UM175_ALLTEL 0x3715 |
39 | #define PANTECH_PRODUCT_UML290_VZW 0x3718 | ||
39 | 40 | ||
40 | /* CMOTECH devices */ | 41 | /* CMOTECH devices */ |
41 | #define CMOTECH_VENDOR_ID 0x16d8 | 42 | #define CMOTECH_VENDOR_ID 0x16d8 |
@@ -66,6 +67,7 @@ static struct usb_device_id id_table[] = { | |||
66 | { USB_DEVICE_AND_INTERFACE_INFO(LG_VENDOR_ID, LG_PRODUCT_VX4400_6000, 0xff, 0xff, 0x00) }, | 67 | { USB_DEVICE_AND_INTERFACE_INFO(LG_VENDOR_ID, LG_PRODUCT_VX4400_6000, 0xff, 0xff, 0x00) }, |
67 | { USB_DEVICE_AND_INTERFACE_INFO(SANYO_VENDOR_ID, SANYO_PRODUCT_KATANA_LX, 0xff, 0xff, 0x00) }, | 68 | { USB_DEVICE_AND_INTERFACE_INFO(SANYO_VENDOR_ID, SANYO_PRODUCT_KATANA_LX, 0xff, 0xff, 0x00) }, |
68 | { USB_DEVICE_AND_INTERFACE_INFO(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_U520, 0xff, 0x00, 0x00) }, | 69 | { USB_DEVICE_AND_INTERFACE_INFO(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_U520, 0xff, 0x00, 0x00) }, |
70 | { USB_DEVICE_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, PANTECH_PRODUCT_UML290_VZW, 0xff, 0xff, 0xff) }, | ||
69 | { }, | 71 | { }, |
70 | }; | 72 | }; |
71 | MODULE_DEVICE_TABLE(usb, id_table); | 73 | MODULE_DEVICE_TABLE(usb, id_table); |
@@ -84,6 +86,7 @@ static struct usb_serial_driver qcaux_device = { | |||
84 | .name = "qcaux", | 86 | .name = "qcaux", |
85 | }, | 87 | }, |
86 | .id_table = id_table, | 88 | .id_table = id_table, |
89 | .usb_driver = &qcaux_driver, | ||
87 | .num_ports = 1, | 90 | .num_ports = 1, |
88 | }; | 91 | }; |
89 | 92 | ||
diff --git a/drivers/usb/serial/siemens_mpi.c b/drivers/usb/serial/siemens_mpi.c index cb8195cabfde..74cd4ccdb3fc 100644 --- a/drivers/usb/serial/siemens_mpi.c +++ b/drivers/usb/serial/siemens_mpi.c | |||
@@ -42,6 +42,7 @@ static struct usb_serial_driver siemens_usb_mpi_device = { | |||
42 | .name = "siemens_mpi", | 42 | .name = "siemens_mpi", |
43 | }, | 43 | }, |
44 | .id_table = id_table, | 44 | .id_table = id_table, |
45 | .usb_driver = &siemens_usb_mpi_driver, | ||
45 | .num_ports = 1, | 46 | .num_ports = 1, |
46 | }; | 47 | }; |
47 | 48 | ||
diff --git a/drivers/usb/serial/spcp8x5.c b/drivers/usb/serial/spcp8x5.c index 765aa983bf58..cbfb70bffdd0 100644 --- a/drivers/usb/serial/spcp8x5.c +++ b/drivers/usb/serial/spcp8x5.c | |||
@@ -133,7 +133,7 @@ struct spcp8x5_usb_ctrl_arg { | |||
133 | 133 | ||
134 | /* how come ??? */ | 134 | /* how come ??? */ |
135 | #define UART_STATE 0x08 | 135 | #define UART_STATE 0x08 |
136 | #define UART_STATE_TRANSIENT_MASK 0x74 | 136 | #define UART_STATE_TRANSIENT_MASK 0x75 |
137 | #define UART_DCD 0x01 | 137 | #define UART_DCD 0x01 |
138 | #define UART_DSR 0x02 | 138 | #define UART_DSR 0x02 |
139 | #define UART_BREAK_ERROR 0x04 | 139 | #define UART_BREAK_ERROR 0x04 |
@@ -525,6 +525,10 @@ static void spcp8x5_process_read_urb(struct urb *urb) | |||
525 | /* overrun is special, not associated with a char */ | 525 | /* overrun is special, not associated with a char */ |
526 | if (status & UART_OVERRUN_ERROR) | 526 | if (status & UART_OVERRUN_ERROR) |
527 | tty_insert_flip_char(tty, 0, TTY_OVERRUN); | 527 | tty_insert_flip_char(tty, 0, TTY_OVERRUN); |
528 | |||
529 | if (status & UART_DCD) | ||
530 | usb_serial_handle_dcd_change(port, tty, | ||
531 | priv->line_status & MSR_STATUS_LINE_DCD); | ||
528 | } | 532 | } |
529 | 533 | ||
530 | tty_insert_flip_string_fixed_flag(tty, data, tty_flag, | 534 | tty_insert_flip_string_fixed_flag(tty, data, tty_flag, |
@@ -645,6 +649,7 @@ static struct usb_serial_driver spcp8x5_device = { | |||
645 | .name = "SPCP8x5", | 649 | .name = "SPCP8x5", |
646 | }, | 650 | }, |
647 | .id_table = id_table, | 651 | .id_table = id_table, |
652 | .usb_driver = &spcp8x5_driver, | ||
648 | .num_ports = 1, | 653 | .num_ports = 1, |
649 | .open = spcp8x5_open, | 654 | .open = spcp8x5_open, |
650 | .dtr_rts = spcp8x5_dtr_rts, | 655 | .dtr_rts = spcp8x5_dtr_rts, |
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index 6954de50c0ff..546a52179bec 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c | |||
@@ -1344,11 +1344,15 @@ int usb_serial_register(struct usb_serial_driver *driver) | |||
1344 | return -ENODEV; | 1344 | return -ENODEV; |
1345 | 1345 | ||
1346 | fixup_generic(driver); | 1346 | fixup_generic(driver); |
1347 | if (driver->usb_driver) | ||
1348 | driver->usb_driver->supports_autosuspend = 1; | ||
1349 | 1347 | ||
1350 | if (!driver->description) | 1348 | if (!driver->description) |
1351 | driver->description = driver->driver.name; | 1349 | driver->description = driver->driver.name; |
1350 | if (!driver->usb_driver) { | ||
1351 | WARN(1, "Serial driver %s has no usb_driver\n", | ||
1352 | driver->description); | ||
1353 | return -EINVAL; | ||
1354 | } | ||
1355 | driver->usb_driver->supports_autosuspend = 1; | ||
1352 | 1356 | ||
1353 | /* Add this device to our list of devices */ | 1357 | /* Add this device to our list of devices */ |
1354 | mutex_lock(&table_lock); | 1358 | mutex_lock(&table_lock); |
diff --git a/drivers/usb/serial/usb_debug.c b/drivers/usb/serial/usb_debug.c index f2ed6a31be77..95a82148ee81 100644 --- a/drivers/usb/serial/usb_debug.c +++ b/drivers/usb/serial/usb_debug.c | |||
@@ -75,6 +75,7 @@ static struct usb_serial_driver debug_device = { | |||
75 | .name = "debug", | 75 | .name = "debug", |
76 | }, | 76 | }, |
77 | .id_table = id_table, | 77 | .id_table = id_table, |
78 | .usb_driver = &debug_driver, | ||
78 | .num_ports = 1, | 79 | .num_ports = 1, |
79 | .bulk_out_size = USB_DEBUG_MAX_PACKET_SIZE, | 80 | .bulk_out_size = USB_DEBUG_MAX_PACKET_SIZE, |
80 | .break_ctl = usb_debug_break_ctl, | 81 | .break_ctl = usb_debug_break_ctl, |
diff --git a/drivers/usb/storage/unusual_cypress.h b/drivers/usb/storage/unusual_cypress.h index c854fdebe0ae..2c8553026222 100644 --- a/drivers/usb/storage/unusual_cypress.h +++ b/drivers/usb/storage/unusual_cypress.h | |||
@@ -31,4 +31,9 @@ UNUSUAL_DEV( 0x04b4, 0x6831, 0x0000, 0x9999, | |||
31 | "Cypress ISD-300LP", | 31 | "Cypress ISD-300LP", |
32 | USB_SC_CYP_ATACB, USB_PR_DEVICE, NULL, 0), | 32 | USB_SC_CYP_ATACB, USB_PR_DEVICE, NULL, 0), |
33 | 33 | ||
34 | UNUSUAL_DEV( 0x14cd, 0x6116, 0x0000, 0x9999, | ||
35 | "Super Top", | ||
36 | "USB 2.0 SATA BRIDGE", | ||
37 | USB_SC_CYP_ATACB, USB_PR_DEVICE, NULL, 0), | ||
38 | |||
34 | #endif /* defined(CONFIG_USB_STORAGE_CYPRESS_ATACB) || ... */ | 39 | #endif /* defined(CONFIG_USB_STORAGE_CYPRESS_ATACB) || ... */ |
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index fcc1e32ce256..24bd5d7c3deb 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h | |||
@@ -1044,6 +1044,15 @@ UNUSUAL_DEV( 0x084d, 0x0011, 0x0110, 0x0110, | |||
1044 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | 1044 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
1045 | US_FL_BULK32), | 1045 | US_FL_BULK32), |
1046 | 1046 | ||
1047 | /* Reported by <ttkspam@free.fr> | ||
1048 | * The device reports a vendor-specific device class, requiring an | ||
1049 | * explicit vendor/product match. | ||
1050 | */ | ||
1051 | UNUSUAL_DEV( 0x0851, 0x1542, 0x0002, 0x0002, | ||
1052 | "MagicPixel", | ||
1053 | "FW_Omega2", | ||
1054 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, 0), | ||
1055 | |||
1047 | /* Andrew Lunn <andrew@lunn.ch> | 1056 | /* Andrew Lunn <andrew@lunn.ch> |
1048 | * PanDigital Digital Picture Frame. Does not like ALLOW_MEDIUM_REMOVAL | 1057 | * PanDigital Digital Picture Frame. Does not like ALLOW_MEDIUM_REMOVAL |
1049 | * on LUN 4. | 1058 | * on LUN 4. |
@@ -1872,6 +1881,15 @@ UNUSUAL_DEV( 0x1908, 0x3335, 0x0200, 0x0200, | |||
1872 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | 1881 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
1873 | US_FL_NO_READ_DISC_INFO ), | 1882 | US_FL_NO_READ_DISC_INFO ), |
1874 | 1883 | ||
1884 | /* Patch by Richard Schütz <r.schtz@t-online.de> | ||
1885 | * This external hard drive enclosure uses a JMicron chip which | ||
1886 | * needs the US_FL_IGNORE_RESIDUE flag to work properly. */ | ||
1887 | UNUSUAL_DEV( 0x1e68, 0x001b, 0x0000, 0x0000, | ||
1888 | "TrekStor GmbH & Co. KG", | ||
1889 | "DataStation maxi g.u", | ||
1890 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
1891 | US_FL_IGNORE_RESIDUE | US_FL_SANE_SENSE ), | ||
1892 | |||
1875 | UNUSUAL_DEV( 0x2116, 0x0320, 0x0001, 0x0001, | 1893 | UNUSUAL_DEV( 0x2116, 0x0320, 0x0001, 0x0001, |
1876 | "ST", | 1894 | "ST", |
1877 | "2A", | 1895 | "2A", |
diff --git a/fs/cifs/Kconfig b/fs/cifs/Kconfig index ee45648b0d1a..7cb0f7f847e4 100644 --- a/fs/cifs/Kconfig +++ b/fs/cifs/Kconfig | |||
@@ -3,6 +3,7 @@ config CIFS | |||
3 | depends on INET | 3 | depends on INET |
4 | select NLS | 4 | select NLS |
5 | select CRYPTO | 5 | select CRYPTO |
6 | select CRYPTO_MD4 | ||
6 | select CRYPTO_MD5 | 7 | select CRYPTO_MD5 |
7 | select CRYPTO_HMAC | 8 | select CRYPTO_HMAC |
8 | select CRYPTO_ARC4 | 9 | select CRYPTO_ARC4 |
diff --git a/fs/cifs/cifs_dfs_ref.c b/fs/cifs/cifs_dfs_ref.c index f1c68629f277..0a265ad9e426 100644 --- a/fs/cifs/cifs_dfs_ref.c +++ b/fs/cifs/cifs_dfs_ref.c | |||
@@ -282,8 +282,6 @@ static struct vfsmount *cifs_dfs_do_automount(struct dentry *mntpt) | |||
282 | cFYI(1, "in %s", __func__); | 282 | cFYI(1, "in %s", __func__); |
283 | BUG_ON(IS_ROOT(mntpt)); | 283 | BUG_ON(IS_ROOT(mntpt)); |
284 | 284 | ||
285 | xid = GetXid(); | ||
286 | |||
287 | /* | 285 | /* |
288 | * The MSDFS spec states that paths in DFS referral requests and | 286 | * The MSDFS spec states that paths in DFS referral requests and |
289 | * responses must be prefixed by a single '\' character instead of | 287 | * responses must be prefixed by a single '\' character instead of |
@@ -293,7 +291,7 @@ static struct vfsmount *cifs_dfs_do_automount(struct dentry *mntpt) | |||
293 | mnt = ERR_PTR(-ENOMEM); | 291 | mnt = ERR_PTR(-ENOMEM); |
294 | full_path = build_path_from_dentry(mntpt); | 292 | full_path = build_path_from_dentry(mntpt); |
295 | if (full_path == NULL) | 293 | if (full_path == NULL) |
296 | goto free_xid; | 294 | goto cdda_exit; |
297 | 295 | ||
298 | cifs_sb = CIFS_SB(mntpt->d_inode->i_sb); | 296 | cifs_sb = CIFS_SB(mntpt->d_inode->i_sb); |
299 | tlink = cifs_sb_tlink(cifs_sb); | 297 | tlink = cifs_sb_tlink(cifs_sb); |
@@ -303,9 +301,11 @@ static struct vfsmount *cifs_dfs_do_automount(struct dentry *mntpt) | |||
303 | } | 301 | } |
304 | ses = tlink_tcon(tlink)->ses; | 302 | ses = tlink_tcon(tlink)->ses; |
305 | 303 | ||
304 | xid = GetXid(); | ||
306 | rc = get_dfs_path(xid, ses, full_path + 1, cifs_sb->local_nls, | 305 | rc = get_dfs_path(xid, ses, full_path + 1, cifs_sb->local_nls, |
307 | &num_referrals, &referrals, | 306 | &num_referrals, &referrals, |
308 | cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); | 307 | cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); |
308 | FreeXid(xid); | ||
309 | 309 | ||
310 | cifs_put_tlink(tlink); | 310 | cifs_put_tlink(tlink); |
311 | 311 | ||
@@ -338,8 +338,7 @@ success: | |||
338 | free_dfs_info_array(referrals, num_referrals); | 338 | free_dfs_info_array(referrals, num_referrals); |
339 | free_full_path: | 339 | free_full_path: |
340 | kfree(full_path); | 340 | kfree(full_path); |
341 | free_xid: | 341 | cdda_exit: |
342 | FreeXid(xid); | ||
343 | cFYI(1, "leaving %s" , __func__); | 342 | cFYI(1, "leaving %s" , __func__); |
344 | return mnt; | 343 | return mnt; |
345 | } | 344 | } |
diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c index 0db5f1de0227..a51585f9852b 100644 --- a/fs/cifs/cifsencrypt.c +++ b/fs/cifs/cifsencrypt.c | |||
@@ -657,9 +657,10 @@ calc_seckey(struct cifsSesInfo *ses) | |||
657 | get_random_bytes(sec_key, CIFS_SESS_KEY_SIZE); | 657 | get_random_bytes(sec_key, CIFS_SESS_KEY_SIZE); |
658 | 658 | ||
659 | tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC); | 659 | tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC); |
660 | if (!tfm_arc4 || IS_ERR(tfm_arc4)) { | 660 | if (IS_ERR(tfm_arc4)) { |
661 | rc = PTR_ERR(tfm_arc4); | ||
661 | cERROR(1, "could not allocate crypto API arc4\n"); | 662 | cERROR(1, "could not allocate crypto API arc4\n"); |
662 | return PTR_ERR(tfm_arc4); | 663 | return rc; |
663 | } | 664 | } |
664 | 665 | ||
665 | desc.tfm = tfm_arc4; | 666 | desc.tfm = tfm_arc4; |
diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h index 14789a97304e..4a3330235d55 100644 --- a/fs/cifs/cifsfs.h +++ b/fs/cifs/cifsfs.h | |||
@@ -127,5 +127,5 @@ extern long cifs_ioctl(struct file *filep, unsigned int cmd, unsigned long arg); | |||
127 | extern const struct export_operations cifs_export_ops; | 127 | extern const struct export_operations cifs_export_ops; |
128 | #endif /* EXPERIMENTAL */ | 128 | #endif /* EXPERIMENTAL */ |
129 | 129 | ||
130 | #define CIFS_VERSION "1.69" | 130 | #define CIFS_VERSION "1.70" |
131 | #endif /* _CIFSFS_H */ | 131 | #endif /* _CIFSFS_H */ |
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index 3106f5e5c633..46c66ed01af4 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c | |||
@@ -4914,7 +4914,6 @@ CIFSSMBSetFileSize(const int xid, struct cifsTconInfo *tcon, __u64 size, | |||
4914 | __u16 fid, __u32 pid_of_opener, bool SetAllocation) | 4914 | __u16 fid, __u32 pid_of_opener, bool SetAllocation) |
4915 | { | 4915 | { |
4916 | struct smb_com_transaction2_sfi_req *pSMB = NULL; | 4916 | struct smb_com_transaction2_sfi_req *pSMB = NULL; |
4917 | char *data_offset; | ||
4918 | struct file_end_of_file_info *parm_data; | 4917 | struct file_end_of_file_info *parm_data; |
4919 | int rc = 0; | 4918 | int rc = 0; |
4920 | __u16 params, param_offset, offset, byte_count, count; | 4919 | __u16 params, param_offset, offset, byte_count, count; |
@@ -4938,8 +4937,6 @@ CIFSSMBSetFileSize(const int xid, struct cifsTconInfo *tcon, __u64 size, | |||
4938 | param_offset = offsetof(struct smb_com_transaction2_sfi_req, Fid) - 4; | 4937 | param_offset = offsetof(struct smb_com_transaction2_sfi_req, Fid) - 4; |
4939 | offset = param_offset + params; | 4938 | offset = param_offset + params; |
4940 | 4939 | ||
4941 | data_offset = (char *) (&pSMB->hdr.Protocol) + offset; | ||
4942 | |||
4943 | count = sizeof(struct file_end_of_file_info); | 4940 | count = sizeof(struct file_end_of_file_info); |
4944 | pSMB->MaxParameterCount = cpu_to_le16(2); | 4941 | pSMB->MaxParameterCount = cpu_to_le16(2); |
4945 | /* BB find exact max SMB PDU from sess structure BB */ | 4942 | /* BB find exact max SMB PDU from sess structure BB */ |
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 0de17c1db608..74c0a282d012 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -346,7 +346,6 @@ int cifs_open(struct inode *inode, struct file *file) | |||
346 | struct cifsTconInfo *tcon; | 346 | struct cifsTconInfo *tcon; |
347 | struct tcon_link *tlink; | 347 | struct tcon_link *tlink; |
348 | struct cifsFileInfo *pCifsFile = NULL; | 348 | struct cifsFileInfo *pCifsFile = NULL; |
349 | struct cifsInodeInfo *pCifsInode; | ||
350 | char *full_path = NULL; | 349 | char *full_path = NULL; |
351 | bool posix_open_ok = false; | 350 | bool posix_open_ok = false; |
352 | __u16 netfid; | 351 | __u16 netfid; |
@@ -361,8 +360,6 @@ int cifs_open(struct inode *inode, struct file *file) | |||
361 | } | 360 | } |
362 | tcon = tlink_tcon(tlink); | 361 | tcon = tlink_tcon(tlink); |
363 | 362 | ||
364 | pCifsInode = CIFS_I(file->f_path.dentry->d_inode); | ||
365 | |||
366 | full_path = build_path_from_dentry(file->f_path.dentry); | 363 | full_path = build_path_from_dentry(file->f_path.dentry); |
367 | if (full_path == NULL) { | 364 | if (full_path == NULL) { |
368 | rc = -ENOMEM; | 365 | rc = -ENOMEM; |
@@ -1146,7 +1143,6 @@ static int cifs_partialpagewrite(struct page *page, unsigned from, unsigned to) | |||
1146 | char *write_data; | 1143 | char *write_data; |
1147 | int rc = -EFAULT; | 1144 | int rc = -EFAULT; |
1148 | int bytes_written = 0; | 1145 | int bytes_written = 0; |
1149 | struct cifs_sb_info *cifs_sb; | ||
1150 | struct inode *inode; | 1146 | struct inode *inode; |
1151 | struct cifsFileInfo *open_file; | 1147 | struct cifsFileInfo *open_file; |
1152 | 1148 | ||
@@ -1154,7 +1150,6 @@ static int cifs_partialpagewrite(struct page *page, unsigned from, unsigned to) | |||
1154 | return -EFAULT; | 1150 | return -EFAULT; |
1155 | 1151 | ||
1156 | inode = page->mapping->host; | 1152 | inode = page->mapping->host; |
1157 | cifs_sb = CIFS_SB(inode->i_sb); | ||
1158 | 1153 | ||
1159 | offset += (loff_t)from; | 1154 | offset += (loff_t)from; |
1160 | write_data = kmap(page); | 1155 | write_data = kmap(page); |
@@ -1667,7 +1662,8 @@ static ssize_t | |||
1667 | cifs_iovec_write(struct file *file, const struct iovec *iov, | 1662 | cifs_iovec_write(struct file *file, const struct iovec *iov, |
1668 | unsigned long nr_segs, loff_t *poffset) | 1663 | unsigned long nr_segs, loff_t *poffset) |
1669 | { | 1664 | { |
1670 | size_t total_written = 0, written = 0; | 1665 | size_t total_written = 0; |
1666 | unsigned int written = 0; | ||
1671 | unsigned long num_pages, npages; | 1667 | unsigned long num_pages, npages; |
1672 | size_t copied, len, cur_len, i; | 1668 | size_t copied, len, cur_len, i; |
1673 | struct kvec *to_send; | 1669 | struct kvec *to_send; |
diff --git a/fs/cifs/link.c b/fs/cifs/link.c index 02cd60aefbff..e8804d373404 100644 --- a/fs/cifs/link.c +++ b/fs/cifs/link.c | |||
@@ -55,8 +55,9 @@ symlink_hash(unsigned int link_len, const char *link_str, u8 *md5_hash) | |||
55 | 55 | ||
56 | md5 = crypto_alloc_shash("md5", 0, 0); | 56 | md5 = crypto_alloc_shash("md5", 0, 0); |
57 | if (IS_ERR(md5)) { | 57 | if (IS_ERR(md5)) { |
58 | rc = PTR_ERR(md5); | ||
58 | cERROR(1, "%s: Crypto md5 allocation error %d\n", __func__, rc); | 59 | cERROR(1, "%s: Crypto md5 allocation error %d\n", __func__, rc); |
59 | return PTR_ERR(md5); | 60 | return rc; |
60 | } | 61 | } |
61 | size = sizeof(struct shash_desc) + crypto_shash_descsize(md5); | 62 | size = sizeof(struct shash_desc) + crypto_shash_descsize(md5); |
62 | sdescmd5 = kmalloc(size, GFP_KERNEL); | 63 | sdescmd5 = kmalloc(size, GFP_KERNEL); |
diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c index a09e077ba925..2a930a752a78 100644 --- a/fs/cifs/misc.c +++ b/fs/cifs/misc.c | |||
@@ -236,10 +236,7 @@ __u16 GetNextMid(struct TCP_Server_Info *server) | |||
236 | { | 236 | { |
237 | __u16 mid = 0; | 237 | __u16 mid = 0; |
238 | __u16 last_mid; | 238 | __u16 last_mid; |
239 | int collision; | 239 | bool collision; |
240 | |||
241 | if (server == NULL) | ||
242 | return mid; | ||
243 | 240 | ||
244 | spin_lock(&GlobalMid_Lock); | 241 | spin_lock(&GlobalMid_Lock); |
245 | last_mid = server->CurrentMid; /* we do not want to loop forever */ | 242 | last_mid = server->CurrentMid; /* we do not want to loop forever */ |
@@ -252,24 +249,38 @@ __u16 GetNextMid(struct TCP_Server_Info *server) | |||
252 | (and it would also have to have been a request that | 249 | (and it would also have to have been a request that |
253 | did not time out) */ | 250 | did not time out) */ |
254 | while (server->CurrentMid != last_mid) { | 251 | while (server->CurrentMid != last_mid) { |
255 | struct list_head *tmp; | ||
256 | struct mid_q_entry *mid_entry; | 252 | struct mid_q_entry *mid_entry; |
253 | unsigned int num_mids; | ||
257 | 254 | ||
258 | collision = 0; | 255 | collision = false; |
259 | if (server->CurrentMid == 0) | 256 | if (server->CurrentMid == 0) |
260 | server->CurrentMid++; | 257 | server->CurrentMid++; |
261 | 258 | ||
262 | list_for_each(tmp, &server->pending_mid_q) { | 259 | num_mids = 0; |
263 | mid_entry = list_entry(tmp, struct mid_q_entry, qhead); | 260 | list_for_each_entry(mid_entry, &server->pending_mid_q, qhead) { |
264 | 261 | ++num_mids; | |
265 | if ((mid_entry->mid == server->CurrentMid) && | 262 | if (mid_entry->mid == server->CurrentMid && |
266 | (mid_entry->midState == MID_REQUEST_SUBMITTED)) { | 263 | mid_entry->midState == MID_REQUEST_SUBMITTED) { |
267 | /* This mid is in use, try a different one */ | 264 | /* This mid is in use, try a different one */ |
268 | collision = 1; | 265 | collision = true; |
269 | break; | 266 | break; |
270 | } | 267 | } |
271 | } | 268 | } |
272 | if (collision == 0) { | 269 | |
270 | /* | ||
271 | * if we have more than 32k mids in the list, then something | ||
272 | * is very wrong. Possibly a local user is trying to DoS the | ||
273 | * box by issuing long-running calls and SIGKILL'ing them. If | ||
274 | * we get to 2^16 mids then we're in big trouble as this | ||
275 | * function could loop forever. | ||
276 | * | ||
277 | * Go ahead and assign out the mid in this situation, but force | ||
278 | * an eventual reconnect to clean out the pending_mid_q. | ||
279 | */ | ||
280 | if (num_mids > 32768) | ||
281 | server->tcpStatus = CifsNeedReconnect; | ||
282 | |||
283 | if (!collision) { | ||
273 | mid = server->CurrentMid; | 284 | mid = server->CurrentMid; |
274 | break; | 285 | break; |
275 | } | 286 | } |
@@ -381,29 +392,31 @@ header_assemble(struct smb_hdr *buffer, char smb_command /* command */ , | |||
381 | } | 392 | } |
382 | 393 | ||
383 | static int | 394 | static int |
384 | checkSMBhdr(struct smb_hdr *smb, __u16 mid) | 395 | check_smb_hdr(struct smb_hdr *smb, __u16 mid) |
385 | { | 396 | { |
386 | /* Make sure that this really is an SMB, that it is a response, | 397 | /* does it have the right SMB "signature" ? */ |
387 | and that the message ids match */ | 398 | if (*(__le32 *) smb->Protocol != cpu_to_le32(0x424d53ff)) { |
388 | if ((*(__le32 *) smb->Protocol == cpu_to_le32(0x424d53ff)) && | 399 | cERROR(1, "Bad protocol string signature header 0x%x", |
389 | (mid == smb->Mid)) { | 400 | *(unsigned int *)smb->Protocol); |
390 | if (smb->Flags & SMBFLG_RESPONSE) | 401 | return 1; |
391 | return 0; | 402 | } |
392 | else { | 403 | |
393 | /* only one valid case where server sends us request */ | 404 | /* Make sure that message ids match */ |
394 | if (smb->Command == SMB_COM_LOCKING_ANDX) | 405 | if (mid != smb->Mid) { |
395 | return 0; | 406 | cERROR(1, "Mids do not match. received=%u expected=%u", |
396 | else | 407 | smb->Mid, mid); |
397 | cERROR(1, "Received Request not response"); | 408 | return 1; |
398 | } | ||
399 | } else { /* bad signature or mid */ | ||
400 | if (*(__le32 *) smb->Protocol != cpu_to_le32(0x424d53ff)) | ||
401 | cERROR(1, "Bad protocol string signature header %x", | ||
402 | *(unsigned int *) smb->Protocol); | ||
403 | if (mid != smb->Mid) | ||
404 | cERROR(1, "Mids do not match"); | ||
405 | } | 409 | } |
406 | cERROR(1, "bad smb detected. The Mid=%d", smb->Mid); | 410 | |
411 | /* if it's a response then accept */ | ||
412 | if (smb->Flags & SMBFLG_RESPONSE) | ||
413 | return 0; | ||
414 | |||
415 | /* only one valid case where server sends us request */ | ||
416 | if (smb->Command == SMB_COM_LOCKING_ANDX) | ||
417 | return 0; | ||
418 | |||
419 | cERROR(1, "Server sent request, not response. mid=%u", smb->Mid); | ||
407 | return 1; | 420 | return 1; |
408 | } | 421 | } |
409 | 422 | ||
@@ -448,7 +461,7 @@ checkSMB(struct smb_hdr *smb, __u16 mid, unsigned int length) | |||
448 | return 1; | 461 | return 1; |
449 | } | 462 | } |
450 | 463 | ||
451 | if (checkSMBhdr(smb, mid)) | 464 | if (check_smb_hdr(smb, mid)) |
452 | return 1; | 465 | return 1; |
453 | clc_len = smbCalcSize_LE(smb); | 466 | clc_len = smbCalcSize_LE(smb); |
454 | 467 | ||
@@ -465,25 +478,26 @@ checkSMB(struct smb_hdr *smb, __u16 mid, unsigned int length) | |||
465 | if (((4 + len) & 0xFFFF) == (clc_len & 0xFFFF)) | 478 | if (((4 + len) & 0xFFFF) == (clc_len & 0xFFFF)) |
466 | return 0; /* bcc wrapped */ | 479 | return 0; /* bcc wrapped */ |
467 | } | 480 | } |
468 | cFYI(1, "Calculated size %d vs length %d mismatch for mid %d", | 481 | cFYI(1, "Calculated size %u vs length %u mismatch for mid=%u", |
469 | clc_len, 4 + len, smb->Mid); | 482 | clc_len, 4 + len, smb->Mid); |
470 | /* Windows XP can return a few bytes too much, presumably | 483 | |
471 | an illegal pad, at the end of byte range lock responses | 484 | if (4 + len < clc_len) { |
472 | so we allow for that three byte pad, as long as actual | 485 | cERROR(1, "RFC1001 size %u smaller than SMB for mid=%u", |
473 | received length is as long or longer than calculated length */ | ||
474 | /* We have now had to extend this more, since there is a | ||
475 | case in which it needs to be bigger still to handle a | ||
476 | malformed response to transact2 findfirst from WinXP when | ||
477 | access denied is returned and thus bcc and wct are zero | ||
478 | but server says length is 0x21 bytes too long as if the server | ||
479 | forget to reset the smb rfc1001 length when it reset the | ||
480 | wct and bcc to minimum size and drop the t2 parms and data */ | ||
481 | if ((4+len > clc_len) && (len <= clc_len + 512)) | ||
482 | return 0; | ||
483 | else { | ||
484 | cERROR(1, "RFC1001 size %d bigger than SMB for Mid=%d", | ||
485 | len, smb->Mid); | 486 | len, smb->Mid); |
486 | return 1; | 487 | return 1; |
488 | } else if (len > clc_len + 512) { | ||
489 | /* | ||
490 | * Some servers (Windows XP in particular) send more | ||
491 | * data than the lengths in the SMB packet would | ||
492 | * indicate on certain calls (byte range locks and | ||
493 | * trans2 find first calls in particular). While the | ||
494 | * client can handle such a frame by ignoring the | ||
495 | * trailing data, we choose limit the amount of extra | ||
496 | * data to 512 bytes. | ||
497 | */ | ||
498 | cERROR(1, "RFC1001 size %u more than 512 bytes larger " | ||
499 | "than SMB for mid=%u", len, smb->Mid); | ||
500 | return 1; | ||
487 | } | 501 | } |
488 | } | 502 | } |
489 | return 0; | 503 | return 0; |
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c index 7f25cc3d2256..f8e4cd2a7912 100644 --- a/fs/cifs/readdir.c +++ b/fs/cifs/readdir.c | |||
@@ -764,7 +764,6 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir) | |||
764 | { | 764 | { |
765 | int rc = 0; | 765 | int rc = 0; |
766 | int xid, i; | 766 | int xid, i; |
767 | struct cifs_sb_info *cifs_sb; | ||
768 | struct cifsTconInfo *pTcon; | 767 | struct cifsTconInfo *pTcon; |
769 | struct cifsFileInfo *cifsFile = NULL; | 768 | struct cifsFileInfo *cifsFile = NULL; |
770 | char *current_entry; | 769 | char *current_entry; |
@@ -775,8 +774,6 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir) | |||
775 | 774 | ||
776 | xid = GetXid(); | 775 | xid = GetXid(); |
777 | 776 | ||
778 | cifs_sb = CIFS_SB(file->f_path.dentry->d_sb); | ||
779 | |||
780 | /* | 777 | /* |
781 | * Ensure FindFirst doesn't fail before doing filldir() for '.' and | 778 | * Ensure FindFirst doesn't fail before doing filldir() for '.' and |
782 | * '..'. Otherwise we won't be able to notify VFS in case of failure. | 779 | * '..'. Otherwise we won't be able to notify VFS in case of failure. |
diff --git a/fs/cifs/smbencrypt.c b/fs/cifs/smbencrypt.c index b5450e9f40c0..b5041c849981 100644 --- a/fs/cifs/smbencrypt.c +++ b/fs/cifs/smbencrypt.c | |||
@@ -58,8 +58,9 @@ mdfour(unsigned char *md4_hash, unsigned char *link_str, int link_len) | |||
58 | 58 | ||
59 | md4 = crypto_alloc_shash("md4", 0, 0); | 59 | md4 = crypto_alloc_shash("md4", 0, 0); |
60 | if (IS_ERR(md4)) { | 60 | if (IS_ERR(md4)) { |
61 | rc = PTR_ERR(md4); | ||
61 | cERROR(1, "%s: Crypto md4 allocation error %d\n", __func__, rc); | 62 | cERROR(1, "%s: Crypto md4 allocation error %d\n", __func__, rc); |
62 | return PTR_ERR(md4); | 63 | return rc; |
63 | } | 64 | } |
64 | size = sizeof(struct shash_desc) + crypto_shash_descsize(md4); | 65 | size = sizeof(struct shash_desc) + crypto_shash_descsize(md4); |
65 | sdescmd4 = kmalloc(size, GFP_KERNEL); | 66 | sdescmd4 = kmalloc(size, GFP_KERNEL); |
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c index c1ccca1a933f..b8c5e2eb43d0 100644 --- a/fs/cifs/transport.c +++ b/fs/cifs/transport.c | |||
@@ -236,9 +236,9 @@ smb_sendv(struct TCP_Server_Info *server, struct kvec *iov, int n_vec) | |||
236 | server->tcpStatus = CifsNeedReconnect; | 236 | server->tcpStatus = CifsNeedReconnect; |
237 | } | 237 | } |
238 | 238 | ||
239 | if (rc < 0) { | 239 | if (rc < 0 && rc != -EINTR) |
240 | cERROR(1, "Error %d sending data on socket to server", rc); | 240 | cERROR(1, "Error %d sending data on socket to server", rc); |
241 | } else | 241 | else |
242 | rc = 0; | 242 | rc = 0; |
243 | 243 | ||
244 | /* Don't want to modify the buffer as a | 244 | /* Don't want to modify the buffer as a |
@@ -570,17 +570,33 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses, | |||
570 | #endif | 570 | #endif |
571 | 571 | ||
572 | mutex_unlock(&ses->server->srv_mutex); | 572 | mutex_unlock(&ses->server->srv_mutex); |
573 | cifs_small_buf_release(in_buf); | ||
574 | 573 | ||
575 | if (rc < 0) | 574 | if (rc < 0) { |
575 | cifs_small_buf_release(in_buf); | ||
576 | goto out; | 576 | goto out; |
577 | } | ||
577 | 578 | ||
578 | if (long_op == CIFS_ASYNC_OP) | 579 | if (long_op == CIFS_ASYNC_OP) { |
580 | cifs_small_buf_release(in_buf); | ||
579 | goto out; | 581 | goto out; |
582 | } | ||
580 | 583 | ||
581 | rc = wait_for_response(ses->server, midQ); | 584 | rc = wait_for_response(ses->server, midQ); |
582 | if (rc != 0) | 585 | if (rc != 0) { |
583 | goto out; | 586 | send_nt_cancel(ses->server, in_buf, midQ); |
587 | spin_lock(&GlobalMid_Lock); | ||
588 | if (midQ->midState == MID_REQUEST_SUBMITTED) { | ||
589 | midQ->callback = DeleteMidQEntry; | ||
590 | spin_unlock(&GlobalMid_Lock); | ||
591 | cifs_small_buf_release(in_buf); | ||
592 | atomic_dec(&ses->server->inFlight); | ||
593 | wake_up(&ses->server->request_q); | ||
594 | return rc; | ||
595 | } | ||
596 | spin_unlock(&GlobalMid_Lock); | ||
597 | } | ||
598 | |||
599 | cifs_small_buf_release(in_buf); | ||
584 | 600 | ||
585 | rc = sync_mid_result(midQ, ses->server); | 601 | rc = sync_mid_result(midQ, ses->server); |
586 | if (rc != 0) { | 602 | if (rc != 0) { |
@@ -724,8 +740,19 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses, | |||
724 | goto out; | 740 | goto out; |
725 | 741 | ||
726 | rc = wait_for_response(ses->server, midQ); | 742 | rc = wait_for_response(ses->server, midQ); |
727 | if (rc != 0) | 743 | if (rc != 0) { |
728 | goto out; | 744 | send_nt_cancel(ses->server, in_buf, midQ); |
745 | spin_lock(&GlobalMid_Lock); | ||
746 | if (midQ->midState == MID_REQUEST_SUBMITTED) { | ||
747 | /* no longer considered to be "in-flight" */ | ||
748 | midQ->callback = DeleteMidQEntry; | ||
749 | spin_unlock(&GlobalMid_Lock); | ||
750 | atomic_dec(&ses->server->inFlight); | ||
751 | wake_up(&ses->server->request_q); | ||
752 | return rc; | ||
753 | } | ||
754 | spin_unlock(&GlobalMid_Lock); | ||
755 | } | ||
729 | 756 | ||
730 | rc = sync_mid_result(midQ, ses->server); | 757 | rc = sync_mid_result(midQ, ses->server); |
731 | if (rc != 0) { | 758 | if (rc != 0) { |
@@ -922,10 +949,21 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifsTconInfo *tcon, | |||
922 | } | 949 | } |
923 | } | 950 | } |
924 | 951 | ||
925 | if (wait_for_response(ses->server, midQ) == 0) { | 952 | rc = wait_for_response(ses->server, midQ); |
926 | /* We got the response - restart system call. */ | 953 | if (rc) { |
927 | rstart = 1; | 954 | send_nt_cancel(ses->server, in_buf, midQ); |
955 | spin_lock(&GlobalMid_Lock); | ||
956 | if (midQ->midState == MID_REQUEST_SUBMITTED) { | ||
957 | /* no longer considered to be "in-flight" */ | ||
958 | midQ->callback = DeleteMidQEntry; | ||
959 | spin_unlock(&GlobalMid_Lock); | ||
960 | return rc; | ||
961 | } | ||
962 | spin_unlock(&GlobalMid_Lock); | ||
928 | } | 963 | } |
964 | |||
965 | /* We got the response - restart system call. */ | ||
966 | rstart = 1; | ||
929 | } | 967 | } |
930 | 968 | ||
931 | rc = sync_mid_result(midQ, ses->server); | 969 | rc = sync_mid_result(midQ, ses->server); |
diff --git a/fs/eventpoll.c b/fs/eventpoll.c index cc8a9b7d6064..267d0ada4541 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c | |||
@@ -1114,6 +1114,17 @@ static int ep_send_events(struct eventpoll *ep, | |||
1114 | return ep_scan_ready_list(ep, ep_send_events_proc, &esed); | 1114 | return ep_scan_ready_list(ep, ep_send_events_proc, &esed); |
1115 | } | 1115 | } |
1116 | 1116 | ||
1117 | static inline struct timespec ep_set_mstimeout(long ms) | ||
1118 | { | ||
1119 | struct timespec now, ts = { | ||
1120 | .tv_sec = ms / MSEC_PER_SEC, | ||
1121 | .tv_nsec = NSEC_PER_MSEC * (ms % MSEC_PER_SEC), | ||
1122 | }; | ||
1123 | |||
1124 | ktime_get_ts(&now); | ||
1125 | return timespec_add_safe(now, ts); | ||
1126 | } | ||
1127 | |||
1117 | static int ep_poll(struct eventpoll *ep, struct epoll_event __user *events, | 1128 | static int ep_poll(struct eventpoll *ep, struct epoll_event __user *events, |
1118 | int maxevents, long timeout) | 1129 | int maxevents, long timeout) |
1119 | { | 1130 | { |
@@ -1121,12 +1132,11 @@ static int ep_poll(struct eventpoll *ep, struct epoll_event __user *events, | |||
1121 | unsigned long flags; | 1132 | unsigned long flags; |
1122 | long slack; | 1133 | long slack; |
1123 | wait_queue_t wait; | 1134 | wait_queue_t wait; |
1124 | struct timespec end_time; | ||
1125 | ktime_t expires, *to = NULL; | 1135 | ktime_t expires, *to = NULL; |
1126 | 1136 | ||
1127 | if (timeout > 0) { | 1137 | if (timeout > 0) { |
1128 | ktime_get_ts(&end_time); | 1138 | struct timespec end_time = ep_set_mstimeout(timeout); |
1129 | timespec_add_ns(&end_time, (u64)timeout * NSEC_PER_MSEC); | 1139 | |
1130 | slack = select_estimate_accuracy(&end_time); | 1140 | slack = select_estimate_accuracy(&end_time); |
1131 | to = &expires; | 1141 | to = &expires; |
1132 | *to = timespec_to_ktime(end_time); | 1142 | *to = timespec_to_ktime(end_time); |
@@ -120,7 +120,7 @@ SYSCALL_DEFINE1(uselib, const char __user *, library) | |||
120 | goto out; | 120 | goto out; |
121 | 121 | ||
122 | file = do_filp_open(AT_FDCWD, tmp, | 122 | file = do_filp_open(AT_FDCWD, tmp, |
123 | O_LARGEFILE | O_RDONLY | FMODE_EXEC, 0, | 123 | O_LARGEFILE | O_RDONLY | __FMODE_EXEC, 0, |
124 | MAY_READ | MAY_EXEC | MAY_OPEN); | 124 | MAY_READ | MAY_EXEC | MAY_OPEN); |
125 | putname(tmp); | 125 | putname(tmp); |
126 | error = PTR_ERR(file); | 126 | error = PTR_ERR(file); |
@@ -723,7 +723,7 @@ struct file *open_exec(const char *name) | |||
723 | int err; | 723 | int err; |
724 | 724 | ||
725 | file = do_filp_open(AT_FDCWD, name, | 725 | file = do_filp_open(AT_FDCWD, name, |
726 | O_LARGEFILE | O_RDONLY | FMODE_EXEC, 0, | 726 | O_LARGEFILE | O_RDONLY | __FMODE_EXEC, 0, |
727 | MAY_EXEC | MAY_OPEN); | 727 | MAY_EXEC | MAY_OPEN); |
728 | if (IS_ERR(file)) | 728 | if (IS_ERR(file)) |
729 | goto out; | 729 | goto out; |
diff --git a/fs/fcntl.c b/fs/fcntl.c index ecc8b3954ed6..cb1026181bdc 100644 --- a/fs/fcntl.c +++ b/fs/fcntl.c | |||
@@ -815,7 +815,7 @@ static int __init fcntl_init(void) | |||
815 | __O_SYNC | O_DSYNC | FASYNC | | 815 | __O_SYNC | O_DSYNC | FASYNC | |
816 | O_DIRECT | O_LARGEFILE | O_DIRECTORY | | 816 | O_DIRECT | O_LARGEFILE | O_DIRECTORY | |
817 | O_NOFOLLOW | O_NOATIME | O_CLOEXEC | | 817 | O_NOFOLLOW | O_NOATIME | O_CLOEXEC | |
818 | FMODE_EXEC | 818 | __FMODE_EXEC |
819 | )); | 819 | )); |
820 | 820 | ||
821 | fasync_cache = kmem_cache_create("fasync_cache", | 821 | fasync_cache = kmem_cache_create("fasync_cache", |
diff --git a/fs/ioctl.c b/fs/ioctl.c index a59635e295fa..1eebeb72b202 100644 --- a/fs/ioctl.c +++ b/fs/ioctl.c | |||
@@ -273,6 +273,13 @@ int __generic_block_fiemap(struct inode *inode, | |||
273 | len = isize; | 273 | len = isize; |
274 | } | 274 | } |
275 | 275 | ||
276 | /* | ||
277 | * Some filesystems can't deal with being asked to map less than | ||
278 | * blocksize, so make sure our len is at least block length. | ||
279 | */ | ||
280 | if (logical_to_blk(inode, len) == 0) | ||
281 | len = blk_to_logical(inode, 1); | ||
282 | |||
276 | start_blk = logical_to_blk(inode, start); | 283 | start_blk = logical_to_blk(inode, start); |
277 | last_blk = logical_to_blk(inode, start + len - 1); | 284 | last_blk = logical_to_blk(inode, start + len - 1); |
278 | 285 | ||
diff --git a/fs/lockd/host.c b/fs/lockd/host.c index 5f1bcb2f06f3..b7c99bfb3da6 100644 --- a/fs/lockd/host.c +++ b/fs/lockd/host.c | |||
@@ -520,7 +520,7 @@ static struct nlm_host *next_host_state(struct hlist_head *cache, | |||
520 | struct nsm_handle *nsm, | 520 | struct nsm_handle *nsm, |
521 | const struct nlm_reboot *info) | 521 | const struct nlm_reboot *info) |
522 | { | 522 | { |
523 | struct nlm_host *host = NULL; | 523 | struct nlm_host *host; |
524 | struct hlist_head *chain; | 524 | struct hlist_head *chain; |
525 | struct hlist_node *pos; | 525 | struct hlist_node *pos; |
526 | 526 | ||
@@ -532,12 +532,13 @@ static struct nlm_host *next_host_state(struct hlist_head *cache, | |||
532 | host->h_state++; | 532 | host->h_state++; |
533 | 533 | ||
534 | nlm_get_host(host); | 534 | nlm_get_host(host); |
535 | goto out; | 535 | mutex_unlock(&nlm_host_mutex); |
536 | return host; | ||
536 | } | 537 | } |
537 | } | 538 | } |
538 | out: | 539 | |
539 | mutex_unlock(&nlm_host_mutex); | 540 | mutex_unlock(&nlm_host_mutex); |
540 | return host; | 541 | return NULL; |
541 | } | 542 | } |
542 | 543 | ||
543 | /** | 544 | /** |
diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c index 199016528fcb..e3d294269058 100644 --- a/fs/nfs/callback.c +++ b/fs/nfs/callback.c | |||
@@ -135,33 +135,6 @@ out_err: | |||
135 | 135 | ||
136 | #if defined(CONFIG_NFS_V4_1) | 136 | #if defined(CONFIG_NFS_V4_1) |
137 | /* | 137 | /* |
138 | * * CB_SEQUENCE operations will fail until the callback sessionid is set. | ||
139 | * */ | ||
140 | int nfs4_set_callback_sessionid(struct nfs_client *clp) | ||
141 | { | ||
142 | struct svc_serv *serv = clp->cl_rpcclient->cl_xprt->bc_serv; | ||
143 | struct nfs4_sessionid *bc_sid; | ||
144 | |||
145 | if (!serv->sv_bc_xprt) | ||
146 | return -EINVAL; | ||
147 | |||
148 | /* on success freed in xprt_free */ | ||
149 | bc_sid = kmalloc(sizeof(struct nfs4_sessionid), GFP_KERNEL); | ||
150 | if (!bc_sid) | ||
151 | return -ENOMEM; | ||
152 | memcpy(bc_sid->data, &clp->cl_session->sess_id.data, | ||
153 | NFS4_MAX_SESSIONID_LEN); | ||
154 | spin_lock_bh(&serv->sv_cb_lock); | ||
155 | serv->sv_bc_xprt->xpt_bc_sid = bc_sid; | ||
156 | spin_unlock_bh(&serv->sv_cb_lock); | ||
157 | dprintk("%s set xpt_bc_sid=%u:%u:%u:%u for sv_bc_xprt %p\n", __func__, | ||
158 | ((u32 *)bc_sid->data)[0], ((u32 *)bc_sid->data)[1], | ||
159 | ((u32 *)bc_sid->data)[2], ((u32 *)bc_sid->data)[3], | ||
160 | serv->sv_bc_xprt); | ||
161 | return 0; | ||
162 | } | ||
163 | |||
164 | /* | ||
165 | * The callback service for NFSv4.1 callbacks | 138 | * The callback service for NFSv4.1 callbacks |
166 | */ | 139 | */ |
167 | static int | 140 | static int |
@@ -266,10 +239,6 @@ static inline void nfs_callback_bc_serv(u32 minorversion, struct rpc_xprt *xprt, | |||
266 | struct nfs_callback_data *cb_info) | 239 | struct nfs_callback_data *cb_info) |
267 | { | 240 | { |
268 | } | 241 | } |
269 | int nfs4_set_callback_sessionid(struct nfs_client *clp) | ||
270 | { | ||
271 | return 0; | ||
272 | } | ||
273 | #endif /* CONFIG_NFS_V4_1 */ | 242 | #endif /* CONFIG_NFS_V4_1 */ |
274 | 243 | ||
275 | /* | 244 | /* |
@@ -359,78 +328,58 @@ void nfs_callback_down(int minorversion) | |||
359 | mutex_unlock(&nfs_callback_mutex); | 328 | mutex_unlock(&nfs_callback_mutex); |
360 | } | 329 | } |
361 | 330 | ||
362 | static int check_gss_callback_principal(struct nfs_client *clp, | 331 | /* Boolean check of RPC_AUTH_GSS principal */ |
363 | struct svc_rqst *rqstp) | 332 | int |
333 | check_gss_callback_principal(struct nfs_client *clp, struct svc_rqst *rqstp) | ||
364 | { | 334 | { |
365 | struct rpc_clnt *r = clp->cl_rpcclient; | 335 | struct rpc_clnt *r = clp->cl_rpcclient; |
366 | char *p = svc_gss_principal(rqstp); | 336 | char *p = svc_gss_principal(rqstp); |
367 | 337 | ||
338 | if (rqstp->rq_authop->flavour != RPC_AUTH_GSS) | ||
339 | return 1; | ||
340 | |||
368 | /* No RPC_AUTH_GSS on NFSv4.1 back channel yet */ | 341 | /* No RPC_AUTH_GSS on NFSv4.1 back channel yet */ |
369 | if (clp->cl_minorversion != 0) | 342 | if (clp->cl_minorversion != 0) |
370 | return SVC_DROP; | 343 | return 0; |
371 | /* | 344 | /* |
372 | * It might just be a normal user principal, in which case | 345 | * It might just be a normal user principal, in which case |
373 | * userspace won't bother to tell us the name at all. | 346 | * userspace won't bother to tell us the name at all. |
374 | */ | 347 | */ |
375 | if (p == NULL) | 348 | if (p == NULL) |
376 | return SVC_DENIED; | 349 | return 0; |
377 | 350 | ||
378 | /* Expect a GSS_C_NT_HOSTBASED_NAME like "nfs@serverhostname" */ | 351 | /* Expect a GSS_C_NT_HOSTBASED_NAME like "nfs@serverhostname" */ |
379 | 352 | ||
380 | if (memcmp(p, "nfs@", 4) != 0) | 353 | if (memcmp(p, "nfs@", 4) != 0) |
381 | return SVC_DENIED; | 354 | return 0; |
382 | p += 4; | 355 | p += 4; |
383 | if (strcmp(p, r->cl_server) != 0) | 356 | if (strcmp(p, r->cl_server) != 0) |
384 | return SVC_DENIED; | 357 | return 0; |
385 | return SVC_OK; | 358 | return 1; |
386 | } | 359 | } |
387 | 360 | ||
388 | /* pg_authenticate method helper */ | 361 | /* |
389 | static struct nfs_client *nfs_cb_find_client(struct svc_rqst *rqstp) | 362 | * pg_authenticate method for nfsv4 callback threads. |
390 | { | 363 | * |
391 | struct nfs4_sessionid *sessionid = bc_xprt_sid(rqstp); | 364 | * The authflavor has been negotiated, so an incorrect flavor is a server |
392 | int is_cb_compound = rqstp->rq_proc == CB_COMPOUND ? 1 : 0; | 365 | * bug. Drop packets with incorrect authflavor. |
393 | 366 | * | |
394 | dprintk("--> %s rq_proc %d\n", __func__, rqstp->rq_proc); | 367 | * All other checking done after NFS decoding where the nfs_client can be |
395 | if (svc_is_backchannel(rqstp)) | 368 | * found in nfs4_callback_compound |
396 | /* Sessionid (usually) set after CB_NULL ping */ | 369 | */ |
397 | return nfs4_find_client_sessionid(svc_addr(rqstp), sessionid, | ||
398 | is_cb_compound); | ||
399 | else | ||
400 | /* No callback identifier in pg_authenticate */ | ||
401 | return nfs4_find_client_no_ident(svc_addr(rqstp)); | ||
402 | } | ||
403 | |||
404 | /* pg_authenticate method for nfsv4 callback threads. */ | ||
405 | static int nfs_callback_authenticate(struct svc_rqst *rqstp) | 370 | static int nfs_callback_authenticate(struct svc_rqst *rqstp) |
406 | { | 371 | { |
407 | struct nfs_client *clp; | ||
408 | RPC_IFDEBUG(char buf[RPC_MAX_ADDRBUFLEN]); | ||
409 | int ret = SVC_OK; | ||
410 | |||
411 | /* Don't talk to strangers */ | ||
412 | clp = nfs_cb_find_client(rqstp); | ||
413 | if (clp == NULL) | ||
414 | return SVC_DROP; | ||
415 | |||
416 | dprintk("%s: %s NFSv4 callback!\n", __func__, | ||
417 | svc_print_addr(rqstp, buf, sizeof(buf))); | ||
418 | |||
419 | switch (rqstp->rq_authop->flavour) { | 372 | switch (rqstp->rq_authop->flavour) { |
420 | case RPC_AUTH_NULL: | 373 | case RPC_AUTH_NULL: |
421 | if (rqstp->rq_proc != CB_NULL) | 374 | if (rqstp->rq_proc != CB_NULL) |
422 | ret = SVC_DENIED; | 375 | return SVC_DROP; |
423 | break; | 376 | break; |
424 | case RPC_AUTH_UNIX: | 377 | case RPC_AUTH_GSS: |
425 | break; | 378 | /* No RPC_AUTH_GSS support yet in NFSv4.1 */ |
426 | case RPC_AUTH_GSS: | 379 | if (svc_is_backchannel(rqstp)) |
427 | ret = check_gss_callback_principal(clp, rqstp); | 380 | return SVC_DROP; |
428 | break; | ||
429 | default: | ||
430 | ret = SVC_DENIED; | ||
431 | } | 381 | } |
432 | nfs_put_client(clp); | 382 | return SVC_OK; |
433 | return ret; | ||
434 | } | 383 | } |
435 | 384 | ||
436 | /* | 385 | /* |
diff --git a/fs/nfs/callback.h b/fs/nfs/callback.h index d3b44f9bd747..46d93ce7311b 100644 --- a/fs/nfs/callback.h +++ b/fs/nfs/callback.h | |||
@@ -7,6 +7,7 @@ | |||
7 | */ | 7 | */ |
8 | #ifndef __LINUX_FS_NFS_CALLBACK_H | 8 | #ifndef __LINUX_FS_NFS_CALLBACK_H |
9 | #define __LINUX_FS_NFS_CALLBACK_H | 9 | #define __LINUX_FS_NFS_CALLBACK_H |
10 | #include <linux/sunrpc/svc.h> | ||
10 | 11 | ||
11 | #define NFS4_CALLBACK 0x40000000 | 12 | #define NFS4_CALLBACK 0x40000000 |
12 | #define NFS4_CALLBACK_XDRSIZE 2048 | 13 | #define NFS4_CALLBACK_XDRSIZE 2048 |
@@ -37,7 +38,6 @@ enum nfs4_callback_opnum { | |||
37 | struct cb_process_state { | 38 | struct cb_process_state { |
38 | __be32 drc_status; | 39 | __be32 drc_status; |
39 | struct nfs_client *clp; | 40 | struct nfs_client *clp; |
40 | struct nfs4_sessionid *svc_sid; /* v4.1 callback service sessionid */ | ||
41 | }; | 41 | }; |
42 | 42 | ||
43 | struct cb_compound_hdr_arg { | 43 | struct cb_compound_hdr_arg { |
@@ -168,7 +168,7 @@ extern unsigned nfs4_callback_layoutrecall( | |||
168 | extern void nfs4_check_drain_bc_complete(struct nfs4_session *ses); | 168 | extern void nfs4_check_drain_bc_complete(struct nfs4_session *ses); |
169 | extern void nfs4_cb_take_slot(struct nfs_client *clp); | 169 | extern void nfs4_cb_take_slot(struct nfs_client *clp); |
170 | #endif /* CONFIG_NFS_V4_1 */ | 170 | #endif /* CONFIG_NFS_V4_1 */ |
171 | 171 | extern int check_gss_callback_principal(struct nfs_client *, struct svc_rqst *); | |
172 | extern __be32 nfs4_callback_getattr(struct cb_getattrargs *args, | 172 | extern __be32 nfs4_callback_getattr(struct cb_getattrargs *args, |
173 | struct cb_getattrres *res, | 173 | struct cb_getattrres *res, |
174 | struct cb_process_state *cps); | 174 | struct cb_process_state *cps); |
diff --git a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c index 4bb91cb2620d..89587573fe50 100644 --- a/fs/nfs/callback_proc.c +++ b/fs/nfs/callback_proc.c | |||
@@ -373,17 +373,11 @@ __be32 nfs4_callback_sequence(struct cb_sequenceargs *args, | |||
373 | { | 373 | { |
374 | struct nfs_client *clp; | 374 | struct nfs_client *clp; |
375 | int i; | 375 | int i; |
376 | __be32 status; | 376 | __be32 status = htonl(NFS4ERR_BADSESSION); |
377 | 377 | ||
378 | cps->clp = NULL; | 378 | cps->clp = NULL; |
379 | 379 | ||
380 | status = htonl(NFS4ERR_BADSESSION); | 380 | clp = nfs4_find_client_sessionid(args->csa_addr, &args->csa_sessionid); |
381 | /* Incoming session must match the callback session */ | ||
382 | if (memcmp(&args->csa_sessionid, cps->svc_sid, NFS4_MAX_SESSIONID_LEN)) | ||
383 | goto out; | ||
384 | |||
385 | clp = nfs4_find_client_sessionid(args->csa_addr, | ||
386 | &args->csa_sessionid, 1); | ||
387 | if (clp == NULL) | 381 | if (clp == NULL) |
388 | goto out; | 382 | goto out; |
389 | 383 | ||
@@ -414,9 +408,9 @@ __be32 nfs4_callback_sequence(struct cb_sequenceargs *args, | |||
414 | res->csr_highestslotid = NFS41_BC_MAX_CALLBACKS - 1; | 408 | res->csr_highestslotid = NFS41_BC_MAX_CALLBACKS - 1; |
415 | res->csr_target_highestslotid = NFS41_BC_MAX_CALLBACKS - 1; | 409 | res->csr_target_highestslotid = NFS41_BC_MAX_CALLBACKS - 1; |
416 | nfs4_cb_take_slot(clp); | 410 | nfs4_cb_take_slot(clp); |
417 | cps->clp = clp; /* put in nfs4_callback_compound */ | ||
418 | 411 | ||
419 | out: | 412 | out: |
413 | cps->clp = clp; /* put in nfs4_callback_compound */ | ||
420 | for (i = 0; i < args->csa_nrclists; i++) | 414 | for (i = 0; i < args->csa_nrclists; i++) |
421 | kfree(args->csa_rclists[i].rcl_refcalls); | 415 | kfree(args->csa_rclists[i].rcl_refcalls); |
422 | kfree(args->csa_rclists); | 416 | kfree(args->csa_rclists); |
diff --git a/fs/nfs/callback_xdr.c b/fs/nfs/callback_xdr.c index 23112c263f81..14e0f9371d14 100644 --- a/fs/nfs/callback_xdr.c +++ b/fs/nfs/callback_xdr.c | |||
@@ -794,10 +794,9 @@ static __be32 nfs4_callback_compound(struct svc_rqst *rqstp, void *argp, void *r | |||
794 | 794 | ||
795 | if (hdr_arg.minorversion == 0) { | 795 | if (hdr_arg.minorversion == 0) { |
796 | cps.clp = nfs4_find_client_ident(hdr_arg.cb_ident); | 796 | cps.clp = nfs4_find_client_ident(hdr_arg.cb_ident); |
797 | if (!cps.clp) | 797 | if (!cps.clp || !check_gss_callback_principal(cps.clp, rqstp)) |
798 | return rpc_drop_reply; | 798 | return rpc_drop_reply; |
799 | } else | 799 | } |
800 | cps.svc_sid = bc_xprt_sid(rqstp); | ||
801 | 800 | ||
802 | hdr_res.taglen = hdr_arg.taglen; | 801 | hdr_res.taglen = hdr_arg.taglen; |
803 | hdr_res.tag = hdr_arg.tag; | 802 | hdr_res.tag = hdr_arg.tag; |
diff --git a/fs/nfs/client.c b/fs/nfs/client.c index 192f2f860265..bd3ca32879e7 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c | |||
@@ -1206,16 +1206,11 @@ nfs4_find_client_ident(int cb_ident) | |||
1206 | * For CB_COMPOUND calls, find a client by IP address, protocol version, | 1206 | * For CB_COMPOUND calls, find a client by IP address, protocol version, |
1207 | * minorversion, and sessionID | 1207 | * minorversion, and sessionID |
1208 | * | 1208 | * |
1209 | * CREATE_SESSION triggers a CB_NULL ping from servers. The callback service | ||
1210 | * sessionid can only be set after the CREATE_SESSION return, so a CB_NULL | ||
1211 | * can arrive before the callback sessionid is set. For CB_NULL calls, | ||
1212 | * find a client by IP address protocol version, and minorversion. | ||
1213 | * | ||
1214 | * Returns NULL if no such client | 1209 | * Returns NULL if no such client |
1215 | */ | 1210 | */ |
1216 | struct nfs_client * | 1211 | struct nfs_client * |
1217 | nfs4_find_client_sessionid(const struct sockaddr *addr, | 1212 | nfs4_find_client_sessionid(const struct sockaddr *addr, |
1218 | struct nfs4_sessionid *sid, int is_cb_compound) | 1213 | struct nfs4_sessionid *sid) |
1219 | { | 1214 | { |
1220 | struct nfs_client *clp; | 1215 | struct nfs_client *clp; |
1221 | 1216 | ||
@@ -1227,9 +1222,9 @@ nfs4_find_client_sessionid(const struct sockaddr *addr, | |||
1227 | if (!nfs4_has_session(clp)) | 1222 | if (!nfs4_has_session(clp)) |
1228 | continue; | 1223 | continue; |
1229 | 1224 | ||
1230 | /* Match sessionid unless cb_null call*/ | 1225 | /* Match sessionid*/ |
1231 | if (is_cb_compound && (memcmp(clp->cl_session->sess_id.data, | 1226 | if (memcmp(clp->cl_session->sess_id.data, |
1232 | sid->data, NFS4_MAX_SESSIONID_LEN) != 0)) | 1227 | sid->data, NFS4_MAX_SESSIONID_LEN) != 0) |
1233 | continue; | 1228 | continue; |
1234 | 1229 | ||
1235 | atomic_inc(&clp->cl_count); | 1230 | atomic_inc(&clp->cl_count); |
@@ -1244,7 +1239,7 @@ nfs4_find_client_sessionid(const struct sockaddr *addr, | |||
1244 | 1239 | ||
1245 | struct nfs_client * | 1240 | struct nfs_client * |
1246 | nfs4_find_client_sessionid(const struct sockaddr *addr, | 1241 | nfs4_find_client_sessionid(const struct sockaddr *addr, |
1247 | struct nfs4_sessionid *sid, int is_cb_compound) | 1242 | struct nfs4_sessionid *sid) |
1248 | { | 1243 | { |
1249 | return NULL; | 1244 | return NULL; |
1250 | } | 1245 | } |
diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c index 364e4328f392..bbbc6bf5cb2e 100644 --- a/fs/nfs/delegation.c +++ b/fs/nfs/delegation.c | |||
@@ -23,8 +23,6 @@ | |||
23 | 23 | ||
24 | static void nfs_do_free_delegation(struct nfs_delegation *delegation) | 24 | static void nfs_do_free_delegation(struct nfs_delegation *delegation) |
25 | { | 25 | { |
26 | if (delegation->cred) | ||
27 | put_rpccred(delegation->cred); | ||
28 | kfree(delegation); | 26 | kfree(delegation); |
29 | } | 27 | } |
30 | 28 | ||
@@ -37,6 +35,10 @@ static void nfs_free_delegation_callback(struct rcu_head *head) | |||
37 | 35 | ||
38 | static void nfs_free_delegation(struct nfs_delegation *delegation) | 36 | static void nfs_free_delegation(struct nfs_delegation *delegation) |
39 | { | 37 | { |
38 | if (delegation->cred) { | ||
39 | put_rpccred(delegation->cred); | ||
40 | delegation->cred = NULL; | ||
41 | } | ||
40 | call_rcu(&delegation->rcu, nfs_free_delegation_callback); | 42 | call_rcu(&delegation->rcu, nfs_free_delegation_callback); |
41 | } | 43 | } |
42 | 44 | ||
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c index e6ace0d93c71..9943a75bb6d1 100644 --- a/fs/nfs/direct.c +++ b/fs/nfs/direct.c | |||
@@ -407,15 +407,18 @@ static ssize_t nfs_direct_read_schedule_iovec(struct nfs_direct_req *dreq, | |||
407 | pos += vec->iov_len; | 407 | pos += vec->iov_len; |
408 | } | 408 | } |
409 | 409 | ||
410 | /* | ||
411 | * If no bytes were started, return the error, and let the | ||
412 | * generic layer handle the completion. | ||
413 | */ | ||
414 | if (requested_bytes == 0) { | ||
415 | nfs_direct_req_release(dreq); | ||
416 | return result < 0 ? result : -EIO; | ||
417 | } | ||
418 | |||
410 | if (put_dreq(dreq)) | 419 | if (put_dreq(dreq)) |
411 | nfs_direct_complete(dreq); | 420 | nfs_direct_complete(dreq); |
412 | 421 | return 0; | |
413 | if (requested_bytes != 0) | ||
414 | return 0; | ||
415 | |||
416 | if (result < 0) | ||
417 | return result; | ||
418 | return -EIO; | ||
419 | } | 422 | } |
420 | 423 | ||
421 | static ssize_t nfs_direct_read(struct kiocb *iocb, const struct iovec *iov, | 424 | static ssize_t nfs_direct_read(struct kiocb *iocb, const struct iovec *iov, |
@@ -841,15 +844,18 @@ static ssize_t nfs_direct_write_schedule_iovec(struct nfs_direct_req *dreq, | |||
841 | pos += vec->iov_len; | 844 | pos += vec->iov_len; |
842 | } | 845 | } |
843 | 846 | ||
847 | /* | ||
848 | * If no bytes were started, return the error, and let the | ||
849 | * generic layer handle the completion. | ||
850 | */ | ||
851 | if (requested_bytes == 0) { | ||
852 | nfs_direct_req_release(dreq); | ||
853 | return result < 0 ? result : -EIO; | ||
854 | } | ||
855 | |||
844 | if (put_dreq(dreq)) | 856 | if (put_dreq(dreq)) |
845 | nfs_direct_write_complete(dreq, dreq->inode); | 857 | nfs_direct_write_complete(dreq, dreq->inode); |
846 | 858 | return 0; | |
847 | if (requested_bytes != 0) | ||
848 | return 0; | ||
849 | |||
850 | if (result < 0) | ||
851 | return result; | ||
852 | return -EIO; | ||
853 | } | 859 | } |
854 | 860 | ||
855 | static ssize_t nfs_direct_write(struct kiocb *iocb, const struct iovec *iov, | 861 | static ssize_t nfs_direct_write(struct kiocb *iocb, const struct iovec *iov, |
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index d8512423ba72..1cc600e77bb4 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
@@ -881,9 +881,10 @@ out: | |||
881 | return ret; | 881 | return ret; |
882 | } | 882 | } |
883 | 883 | ||
884 | static void nfs_wcc_update_inode(struct inode *inode, struct nfs_fattr *fattr) | 884 | static unsigned long nfs_wcc_update_inode(struct inode *inode, struct nfs_fattr *fattr) |
885 | { | 885 | { |
886 | struct nfs_inode *nfsi = NFS_I(inode); | 886 | struct nfs_inode *nfsi = NFS_I(inode); |
887 | unsigned long ret = 0; | ||
887 | 888 | ||
888 | if ((fattr->valid & NFS_ATTR_FATTR_PRECHANGE) | 889 | if ((fattr->valid & NFS_ATTR_FATTR_PRECHANGE) |
889 | && (fattr->valid & NFS_ATTR_FATTR_CHANGE) | 890 | && (fattr->valid & NFS_ATTR_FATTR_CHANGE) |
@@ -891,25 +892,32 @@ static void nfs_wcc_update_inode(struct inode *inode, struct nfs_fattr *fattr) | |||
891 | nfsi->change_attr = fattr->change_attr; | 892 | nfsi->change_attr = fattr->change_attr; |
892 | if (S_ISDIR(inode->i_mode)) | 893 | if (S_ISDIR(inode->i_mode)) |
893 | nfsi->cache_validity |= NFS_INO_INVALID_DATA; | 894 | nfsi->cache_validity |= NFS_INO_INVALID_DATA; |
895 | ret |= NFS_INO_INVALID_ATTR; | ||
894 | } | 896 | } |
895 | /* If we have atomic WCC data, we may update some attributes */ | 897 | /* If we have atomic WCC data, we may update some attributes */ |
896 | if ((fattr->valid & NFS_ATTR_FATTR_PRECTIME) | 898 | if ((fattr->valid & NFS_ATTR_FATTR_PRECTIME) |
897 | && (fattr->valid & NFS_ATTR_FATTR_CTIME) | 899 | && (fattr->valid & NFS_ATTR_FATTR_CTIME) |
898 | && timespec_equal(&inode->i_ctime, &fattr->pre_ctime)) | 900 | && timespec_equal(&inode->i_ctime, &fattr->pre_ctime)) { |
899 | memcpy(&inode->i_ctime, &fattr->ctime, sizeof(inode->i_ctime)); | 901 | memcpy(&inode->i_ctime, &fattr->ctime, sizeof(inode->i_ctime)); |
902 | ret |= NFS_INO_INVALID_ATTR; | ||
903 | } | ||
900 | 904 | ||
901 | if ((fattr->valid & NFS_ATTR_FATTR_PREMTIME) | 905 | if ((fattr->valid & NFS_ATTR_FATTR_PREMTIME) |
902 | && (fattr->valid & NFS_ATTR_FATTR_MTIME) | 906 | && (fattr->valid & NFS_ATTR_FATTR_MTIME) |
903 | && timespec_equal(&inode->i_mtime, &fattr->pre_mtime)) { | 907 | && timespec_equal(&inode->i_mtime, &fattr->pre_mtime)) { |
904 | memcpy(&inode->i_mtime, &fattr->mtime, sizeof(inode->i_mtime)); | 908 | memcpy(&inode->i_mtime, &fattr->mtime, sizeof(inode->i_mtime)); |
905 | if (S_ISDIR(inode->i_mode)) | 909 | if (S_ISDIR(inode->i_mode)) |
906 | nfsi->cache_validity |= NFS_INO_INVALID_DATA; | 910 | nfsi->cache_validity |= NFS_INO_INVALID_DATA; |
911 | ret |= NFS_INO_INVALID_ATTR; | ||
907 | } | 912 | } |
908 | if ((fattr->valid & NFS_ATTR_FATTR_PRESIZE) | 913 | if ((fattr->valid & NFS_ATTR_FATTR_PRESIZE) |
909 | && (fattr->valid & NFS_ATTR_FATTR_SIZE) | 914 | && (fattr->valid & NFS_ATTR_FATTR_SIZE) |
910 | && i_size_read(inode) == nfs_size_to_loff_t(fattr->pre_size) | 915 | && i_size_read(inode) == nfs_size_to_loff_t(fattr->pre_size) |
911 | && nfsi->npages == 0) | 916 | && nfsi->npages == 0) { |
912 | i_size_write(inode, nfs_size_to_loff_t(fattr->size)); | 917 | i_size_write(inode, nfs_size_to_loff_t(fattr->size)); |
918 | ret |= NFS_INO_INVALID_ATTR; | ||
919 | } | ||
920 | return ret; | ||
913 | } | 921 | } |
914 | 922 | ||
915 | /** | 923 | /** |
@@ -1223,7 +1231,7 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr) | |||
1223 | | NFS_INO_REVAL_PAGECACHE); | 1231 | | NFS_INO_REVAL_PAGECACHE); |
1224 | 1232 | ||
1225 | /* Do atomic weak cache consistency updates */ | 1233 | /* Do atomic weak cache consistency updates */ |
1226 | nfs_wcc_update_inode(inode, fattr); | 1234 | invalid |= nfs_wcc_update_inode(inode, fattr); |
1227 | 1235 | ||
1228 | /* More cache consistency checks */ | 1236 | /* More cache consistency checks */ |
1229 | if (fattr->valid & NFS_ATTR_FATTR_CHANGE) { | 1237 | if (fattr->valid & NFS_ATTR_FATTR_CHANGE) { |
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h index 4644f04b4b46..cf9fdbdabc67 100644 --- a/fs/nfs/internal.h +++ b/fs/nfs/internal.h | |||
@@ -133,8 +133,7 @@ extern void nfs_put_client(struct nfs_client *); | |||
133 | extern struct nfs_client *nfs4_find_client_no_ident(const struct sockaddr *); | 133 | extern struct nfs_client *nfs4_find_client_no_ident(const struct sockaddr *); |
134 | extern struct nfs_client *nfs4_find_client_ident(int); | 134 | extern struct nfs_client *nfs4_find_client_ident(int); |
135 | extern struct nfs_client * | 135 | extern struct nfs_client * |
136 | nfs4_find_client_sessionid(const struct sockaddr *, struct nfs4_sessionid *, | 136 | nfs4_find_client_sessionid(const struct sockaddr *, struct nfs4_sessionid *); |
137 | int); | ||
138 | extern struct nfs_server *nfs_create_server( | 137 | extern struct nfs_server *nfs_create_server( |
139 | const struct nfs_parsed_mount_data *, | 138 | const struct nfs_parsed_mount_data *, |
140 | struct nfs_fh *); | 139 | struct nfs_fh *); |
diff --git a/fs/nfs/nfs3acl.c b/fs/nfs/nfs3acl.c index 9f88c5f4c7e2..274342771655 100644 --- a/fs/nfs/nfs3acl.c +++ b/fs/nfs/nfs3acl.c | |||
@@ -311,8 +311,8 @@ static int nfs3_proc_setacls(struct inode *inode, struct posix_acl *acl, | |||
311 | if (!nfs_server_capable(inode, NFS_CAP_ACLS)) | 311 | if (!nfs_server_capable(inode, NFS_CAP_ACLS)) |
312 | goto out; | 312 | goto out; |
313 | 313 | ||
314 | /* We are doing this here, because XDR marshalling can only | 314 | /* We are doing this here because XDR marshalling does not |
315 | return -ENOMEM. */ | 315 | * return any results, it BUGs. */ |
316 | status = -ENOSPC; | 316 | status = -ENOSPC; |
317 | if (acl != NULL && acl->a_count > NFS_ACL_MAX_ENTRIES) | 317 | if (acl != NULL && acl->a_count > NFS_ACL_MAX_ENTRIES) |
318 | goto out; | 318 | goto out; |
diff --git a/fs/nfs/nfs3xdr.c b/fs/nfs/nfs3xdr.c index 01c5e8b1941d..183c6b123d0f 100644 --- a/fs/nfs/nfs3xdr.c +++ b/fs/nfs/nfs3xdr.c | |||
@@ -1328,10 +1328,13 @@ static void nfs3_xdr_enc_setacl3args(struct rpc_rqst *req, | |||
1328 | 1328 | ||
1329 | encode_nfs_fh3(xdr, NFS_FH(args->inode)); | 1329 | encode_nfs_fh3(xdr, NFS_FH(args->inode)); |
1330 | encode_uint32(xdr, args->mask); | 1330 | encode_uint32(xdr, args->mask); |
1331 | |||
1332 | base = req->rq_slen; | ||
1331 | if (args->npages != 0) | 1333 | if (args->npages != 0) |
1332 | xdr_write_pages(xdr, args->pages, 0, args->len); | 1334 | xdr_write_pages(xdr, args->pages, 0, args->len); |
1335 | else | ||
1336 | xdr_reserve_space(xdr, NFS_ACL_INLINE_BUFSIZE); | ||
1333 | 1337 | ||
1334 | base = req->rq_slen; | ||
1335 | error = nfsacl_encode(xdr->buf, base, args->inode, | 1338 | error = nfsacl_encode(xdr->buf, base, args->inode, |
1336 | (args->mask & NFS_ACL) ? | 1339 | (args->mask & NFS_ACL) ? |
1337 | args->acl_access : NULL, 1, 0); | 1340 | args->acl_access : NULL, 1, 0); |
diff --git a/fs/nfs/nfs4filelayoutdev.c b/fs/nfs/nfs4filelayoutdev.c index 51fe64ace55a..f5c9b125e8cc 100644 --- a/fs/nfs/nfs4filelayoutdev.c +++ b/fs/nfs/nfs4filelayoutdev.c | |||
@@ -214,7 +214,7 @@ decode_and_add_ds(__be32 **pp, struct inode *inode) | |||
214 | 214 | ||
215 | /* ipv6 length plus port is legal */ | 215 | /* ipv6 length plus port is legal */ |
216 | if (rlen > INET6_ADDRSTRLEN + 8) { | 216 | if (rlen > INET6_ADDRSTRLEN + 8) { |
217 | dprintk("%s Invalid address, length %d\n", __func__, | 217 | dprintk("%s: Invalid address, length %d\n", __func__, |
218 | rlen); | 218 | rlen); |
219 | goto out_err; | 219 | goto out_err; |
220 | } | 220 | } |
@@ -225,6 +225,11 @@ decode_and_add_ds(__be32 **pp, struct inode *inode) | |||
225 | /* replace the port dots with dashes for the in4_pton() delimiter*/ | 225 | /* replace the port dots with dashes for the in4_pton() delimiter*/ |
226 | for (i = 0; i < 2; i++) { | 226 | for (i = 0; i < 2; i++) { |
227 | char *res = strrchr(buf, '.'); | 227 | char *res = strrchr(buf, '.'); |
228 | if (!res) { | ||
229 | dprintk("%s: Failed finding expected dots in port\n", | ||
230 | __func__); | ||
231 | goto out_free; | ||
232 | } | ||
228 | *res = '-'; | 233 | *res = '-'; |
229 | } | 234 | } |
230 | 235 | ||
@@ -240,7 +245,7 @@ decode_and_add_ds(__be32 **pp, struct inode *inode) | |||
240 | port = htons((tmp[0] << 8) | (tmp[1])); | 245 | port = htons((tmp[0] << 8) | (tmp[1])); |
241 | 246 | ||
242 | ds = nfs4_pnfs_ds_add(inode, ip_addr, port); | 247 | ds = nfs4_pnfs_ds_add(inode, ip_addr, port); |
243 | dprintk("%s Decoded address and port %s\n", __func__, buf); | 248 | dprintk("%s: Decoded address and port %s\n", __func__, buf); |
244 | out_free: | 249 | out_free: |
245 | kfree(buf); | 250 | kfree(buf); |
246 | out_err: | 251 | out_err: |
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 9d992b0346e3..78936a8f40ab 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -50,6 +50,7 @@ | |||
50 | #include <linux/module.h> | 50 | #include <linux/module.h> |
51 | #include <linux/sunrpc/bc_xprt.h> | 51 | #include <linux/sunrpc/bc_xprt.h> |
52 | #include <linux/xattr.h> | 52 | #include <linux/xattr.h> |
53 | #include <linux/utsname.h> | ||
53 | 54 | ||
54 | #include "nfs4_fs.h" | 55 | #include "nfs4_fs.h" |
55 | #include "delegation.h" | 56 | #include "delegation.h" |
@@ -4572,27 +4573,16 @@ int nfs4_proc_exchange_id(struct nfs_client *clp, struct rpc_cred *cred) | |||
4572 | *p = htonl((u32)clp->cl_boot_time.tv_nsec); | 4573 | *p = htonl((u32)clp->cl_boot_time.tv_nsec); |
4573 | args.verifier = &verifier; | 4574 | args.verifier = &verifier; |
4574 | 4575 | ||
4575 | while (1) { | 4576 | args.id_len = scnprintf(args.id, sizeof(args.id), |
4576 | args.id_len = scnprintf(args.id, sizeof(args.id), | 4577 | "%s/%s.%s/%u", |
4577 | "%s/%s %u", | 4578 | clp->cl_ipaddr, |
4578 | clp->cl_ipaddr, | 4579 | init_utsname()->nodename, |
4579 | rpc_peeraddr2str(clp->cl_rpcclient, | 4580 | init_utsname()->domainname, |
4580 | RPC_DISPLAY_ADDR), | 4581 | clp->cl_rpcclient->cl_auth->au_flavor); |
4581 | clp->cl_id_uniquifier); | ||
4582 | |||
4583 | status = rpc_call_sync(clp->cl_rpcclient, &msg, 0); | ||
4584 | |||
4585 | if (status != -NFS4ERR_CLID_INUSE) | ||
4586 | break; | ||
4587 | |||
4588 | if (signalled()) | ||
4589 | break; | ||
4590 | |||
4591 | if (++clp->cl_id_uniquifier == 0) | ||
4592 | break; | ||
4593 | } | ||
4594 | 4582 | ||
4595 | status = nfs4_check_cl_exchange_flags(clp->cl_exchange_flags); | 4583 | status = rpc_call_sync(clp->cl_rpcclient, &msg, 0); |
4584 | if (!status) | ||
4585 | status = nfs4_check_cl_exchange_flags(clp->cl_exchange_flags); | ||
4596 | dprintk("<-- %s status= %d\n", __func__, status); | 4586 | dprintk("<-- %s status= %d\n", __func__, status); |
4597 | return status; | 4587 | return status; |
4598 | } | 4588 | } |
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index 2336d532cf66..e6742b57a04c 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c | |||
@@ -232,12 +232,6 @@ int nfs41_init_clientid(struct nfs_client *clp, struct rpc_cred *cred) | |||
232 | status = nfs4_proc_create_session(clp); | 232 | status = nfs4_proc_create_session(clp); |
233 | if (status != 0) | 233 | if (status != 0) |
234 | goto out; | 234 | goto out; |
235 | status = nfs4_set_callback_sessionid(clp); | ||
236 | if (status != 0) { | ||
237 | printk(KERN_WARNING "Sessionid not set. No callback service\n"); | ||
238 | nfs_callback_down(1); | ||
239 | status = 0; | ||
240 | } | ||
241 | nfs41_setup_state_renewal(clp); | 235 | nfs41_setup_state_renewal(clp); |
242 | nfs_mark_client_ready(clp, NFS_CS_READY); | 236 | nfs_mark_client_ready(clp, NFS_CS_READY); |
243 | out: | 237 | out: |
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index 2ab8e5cb8f59..4e2c168b6ee9 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c | |||
@@ -6086,11 +6086,11 @@ int nfs4_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry, | |||
6086 | __be32 *p = xdr_inline_decode(xdr, 4); | 6086 | __be32 *p = xdr_inline_decode(xdr, 4); |
6087 | if (unlikely(!p)) | 6087 | if (unlikely(!p)) |
6088 | goto out_overflow; | 6088 | goto out_overflow; |
6089 | if (!ntohl(*p++)) { | 6089 | if (*p == xdr_zero) { |
6090 | p = xdr_inline_decode(xdr, 4); | 6090 | p = xdr_inline_decode(xdr, 4); |
6091 | if (unlikely(!p)) | 6091 | if (unlikely(!p)) |
6092 | goto out_overflow; | 6092 | goto out_overflow; |
6093 | if (!ntohl(*p++)) | 6093 | if (*p == xdr_zero) |
6094 | return -EAGAIN; | 6094 | return -EAGAIN; |
6095 | entry->eof = 1; | 6095 | entry->eof = 1; |
6096 | return -EBADCOOKIE; | 6096 | return -EBADCOOKIE; |
@@ -6101,7 +6101,7 @@ int nfs4_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry, | |||
6101 | goto out_overflow; | 6101 | goto out_overflow; |
6102 | entry->prev_cookie = entry->cookie; | 6102 | entry->prev_cookie = entry->cookie; |
6103 | p = xdr_decode_hyper(p, &entry->cookie); | 6103 | p = xdr_decode_hyper(p, &entry->cookie); |
6104 | entry->len = ntohl(*p++); | 6104 | entry->len = be32_to_cpup(p); |
6105 | 6105 | ||
6106 | p = xdr_inline_decode(xdr, entry->len); | 6106 | p = xdr_inline_decode(xdr, entry->len); |
6107 | if (unlikely(!p)) | 6107 | if (unlikely(!p)) |
@@ -6132,9 +6132,6 @@ int nfs4_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry, | |||
6132 | if (entry->fattr->valid & NFS_ATTR_FATTR_TYPE) | 6132 | if (entry->fattr->valid & NFS_ATTR_FATTR_TYPE) |
6133 | entry->d_type = nfs_umode_to_dtype(entry->fattr->mode); | 6133 | entry->d_type = nfs_umode_to_dtype(entry->fattr->mode); |
6134 | 6134 | ||
6135 | if (verify_attr_len(xdr, p, len) < 0) | ||
6136 | goto out_overflow; | ||
6137 | |||
6138 | return 0; | 6135 | return 0; |
6139 | 6136 | ||
6140 | out_overflow: | 6137 | out_overflow: |
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index bc4089769735..1b1bc1a0fb0a 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c | |||
@@ -951,7 +951,7 @@ pnfs_put_deviceid_cache(struct nfs_client *clp) | |||
951 | { | 951 | { |
952 | struct pnfs_deviceid_cache *local = clp->cl_devid_cache; | 952 | struct pnfs_deviceid_cache *local = clp->cl_devid_cache; |
953 | 953 | ||
954 | dprintk("--> %s cl_devid_cache %p\n", __func__, clp->cl_devid_cache); | 954 | dprintk("--> %s ({%d})\n", __func__, atomic_read(&local->dc_ref)); |
955 | if (atomic_dec_and_lock(&local->dc_ref, &clp->cl_lock)) { | 955 | if (atomic_dec_and_lock(&local->dc_ref, &clp->cl_lock)) { |
956 | int i; | 956 | int i; |
957 | /* Verify cache is empty */ | 957 | /* Verify cache is empty */ |
diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 10d648ea128b..c8278f4046cb 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c | |||
@@ -932,7 +932,7 @@ out_bad: | |||
932 | while (!list_empty(&list)) { | 932 | while (!list_empty(&list)) { |
933 | data = list_entry(list.next, struct nfs_write_data, pages); | 933 | data = list_entry(list.next, struct nfs_write_data, pages); |
934 | list_del(&data->pages); | 934 | list_del(&data->pages); |
935 | nfs_writedata_release(data); | 935 | nfs_writedata_free(data); |
936 | } | 936 | } |
937 | nfs_redirty_request(req); | 937 | nfs_redirty_request(req); |
938 | return -ENOMEM; | 938 | return -ENOMEM; |
diff --git a/fs/nfs_common/nfsacl.c b/fs/nfs_common/nfsacl.c index fc1c52571c03..84c27d69d421 100644 --- a/fs/nfs_common/nfsacl.c +++ b/fs/nfs_common/nfsacl.c | |||
@@ -42,6 +42,11 @@ struct nfsacl_encode_desc { | |||
42 | gid_t gid; | 42 | gid_t gid; |
43 | }; | 43 | }; |
44 | 44 | ||
45 | struct nfsacl_simple_acl { | ||
46 | struct posix_acl acl; | ||
47 | struct posix_acl_entry ace[4]; | ||
48 | }; | ||
49 | |||
45 | static int | 50 | static int |
46 | xdr_nfsace_encode(struct xdr_array2_desc *desc, void *elem) | 51 | xdr_nfsace_encode(struct xdr_array2_desc *desc, void *elem) |
47 | { | 52 | { |
@@ -72,9 +77,20 @@ xdr_nfsace_encode(struct xdr_array2_desc *desc, void *elem) | |||
72 | return 0; | 77 | return 0; |
73 | } | 78 | } |
74 | 79 | ||
75 | unsigned int | 80 | /** |
76 | nfsacl_encode(struct xdr_buf *buf, unsigned int base, struct inode *inode, | 81 | * nfsacl_encode - Encode an NFSv3 ACL |
77 | struct posix_acl *acl, int encode_entries, int typeflag) | 82 | * |
83 | * @buf: destination xdr_buf to contain XDR encoded ACL | ||
84 | * @base: byte offset in xdr_buf where XDR'd ACL begins | ||
85 | * @inode: inode of file whose ACL this is | ||
86 | * @acl: posix_acl to encode | ||
87 | * @encode_entries: whether to encode ACEs as well | ||
88 | * @typeflag: ACL type: NFS_ACL_DEFAULT or zero | ||
89 | * | ||
90 | * Returns size of encoded ACL in bytes or a negative errno value. | ||
91 | */ | ||
92 | int nfsacl_encode(struct xdr_buf *buf, unsigned int base, struct inode *inode, | ||
93 | struct posix_acl *acl, int encode_entries, int typeflag) | ||
78 | { | 94 | { |
79 | int entries = (acl && acl->a_count) ? max_t(int, acl->a_count, 4) : 0; | 95 | int entries = (acl && acl->a_count) ? max_t(int, acl->a_count, 4) : 0; |
80 | struct nfsacl_encode_desc nfsacl_desc = { | 96 | struct nfsacl_encode_desc nfsacl_desc = { |
@@ -88,17 +104,22 @@ nfsacl_encode(struct xdr_buf *buf, unsigned int base, struct inode *inode, | |||
88 | .uid = inode->i_uid, | 104 | .uid = inode->i_uid, |
89 | .gid = inode->i_gid, | 105 | .gid = inode->i_gid, |
90 | }; | 106 | }; |
107 | struct nfsacl_simple_acl aclbuf; | ||
91 | int err; | 108 | int err; |
92 | struct posix_acl *acl2 = NULL; | ||
93 | 109 | ||
94 | if (entries > NFS_ACL_MAX_ENTRIES || | 110 | if (entries > NFS_ACL_MAX_ENTRIES || |
95 | xdr_encode_word(buf, base, entries)) | 111 | xdr_encode_word(buf, base, entries)) |
96 | return -EINVAL; | 112 | return -EINVAL; |
97 | if (encode_entries && acl && acl->a_count == 3) { | 113 | if (encode_entries && acl && acl->a_count == 3) { |
98 | /* Fake up an ACL_MASK entry. */ | 114 | struct posix_acl *acl2 = &aclbuf.acl; |
99 | acl2 = posix_acl_alloc(4, GFP_KERNEL); | 115 | |
100 | if (!acl2) | 116 | /* Avoid the use of posix_acl_alloc(). nfsacl_encode() is |
101 | return -ENOMEM; | 117 | * invoked in contexts where a memory allocation failure is |
118 | * fatal. Fortunately this fake ACL is small enough to | ||
119 | * construct on the stack. */ | ||
120 | memset(acl2, 0, sizeof(acl2)); | ||
121 | posix_acl_init(acl2, 4); | ||
122 | |||
102 | /* Insert entries in canonical order: other orders seem | 123 | /* Insert entries in canonical order: other orders seem |
103 | to confuse Solaris VxFS. */ | 124 | to confuse Solaris VxFS. */ |
104 | acl2->a_entries[0] = acl->a_entries[0]; /* ACL_USER_OBJ */ | 125 | acl2->a_entries[0] = acl->a_entries[0]; /* ACL_USER_OBJ */ |
@@ -109,8 +130,6 @@ nfsacl_encode(struct xdr_buf *buf, unsigned int base, struct inode *inode, | |||
109 | nfsacl_desc.acl = acl2; | 130 | nfsacl_desc.acl = acl2; |
110 | } | 131 | } |
111 | err = xdr_encode_array2(buf, base + 4, &nfsacl_desc.desc); | 132 | err = xdr_encode_array2(buf, base + 4, &nfsacl_desc.desc); |
112 | if (acl2) | ||
113 | posix_acl_release(acl2); | ||
114 | if (!err) | 133 | if (!err) |
115 | err = 8 + nfsacl_desc.desc.elem_size * | 134 | err = 8 + nfsacl_desc.desc.elem_size * |
116 | nfsacl_desc.desc.array_len; | 135 | nfsacl_desc.desc.array_len; |
@@ -224,9 +243,18 @@ posix_acl_from_nfsacl(struct posix_acl *acl) | |||
224 | return 0; | 243 | return 0; |
225 | } | 244 | } |
226 | 245 | ||
227 | unsigned int | 246 | /** |
228 | nfsacl_decode(struct xdr_buf *buf, unsigned int base, unsigned int *aclcnt, | 247 | * nfsacl_decode - Decode an NFSv3 ACL |
229 | struct posix_acl **pacl) | 248 | * |
249 | * @buf: xdr_buf containing XDR'd ACL data to decode | ||
250 | * @base: byte offset in xdr_buf where XDR'd ACL begins | ||
251 | * @aclcnt: count of ACEs in decoded posix_acl | ||
252 | * @pacl: buffer in which to place decoded posix_acl | ||
253 | * | ||
254 | * Returns the length of the decoded ACL in bytes, or a negative errno value. | ||
255 | */ | ||
256 | int nfsacl_decode(struct xdr_buf *buf, unsigned int base, unsigned int *aclcnt, | ||
257 | struct posix_acl **pacl) | ||
230 | { | 258 | { |
231 | struct nfsacl_decode_desc nfsacl_desc = { | 259 | struct nfsacl_decode_desc nfsacl_desc = { |
232 | .desc = { | 260 | .desc = { |
diff --git a/fs/posix_acl.c b/fs/posix_acl.c index 39df95a0ec25..b1cf6bf4b41d 100644 --- a/fs/posix_acl.c +++ b/fs/posix_acl.c | |||
@@ -22,6 +22,7 @@ | |||
22 | 22 | ||
23 | #include <linux/errno.h> | 23 | #include <linux/errno.h> |
24 | 24 | ||
25 | EXPORT_SYMBOL(posix_acl_init); | ||
25 | EXPORT_SYMBOL(posix_acl_alloc); | 26 | EXPORT_SYMBOL(posix_acl_alloc); |
26 | EXPORT_SYMBOL(posix_acl_clone); | 27 | EXPORT_SYMBOL(posix_acl_clone); |
27 | EXPORT_SYMBOL(posix_acl_valid); | 28 | EXPORT_SYMBOL(posix_acl_valid); |
@@ -32,6 +33,16 @@ EXPORT_SYMBOL(posix_acl_chmod_masq); | |||
32 | EXPORT_SYMBOL(posix_acl_permission); | 33 | EXPORT_SYMBOL(posix_acl_permission); |
33 | 34 | ||
34 | /* | 35 | /* |
36 | * Init a fresh posix_acl | ||
37 | */ | ||
38 | void | ||
39 | posix_acl_init(struct posix_acl *acl, int count) | ||
40 | { | ||
41 | atomic_set(&acl->a_refcount, 1); | ||
42 | acl->a_count = count; | ||
43 | } | ||
44 | |||
45 | /* | ||
35 | * Allocate a new ACL with the specified number of entries. | 46 | * Allocate a new ACL with the specified number of entries. |
36 | */ | 47 | */ |
37 | struct posix_acl * | 48 | struct posix_acl * |
@@ -40,10 +51,8 @@ posix_acl_alloc(int count, gfp_t flags) | |||
40 | const size_t size = sizeof(struct posix_acl) + | 51 | const size_t size = sizeof(struct posix_acl) + |
41 | count * sizeof(struct posix_acl_entry); | 52 | count * sizeof(struct posix_acl_entry); |
42 | struct posix_acl *acl = kmalloc(size, flags); | 53 | struct posix_acl *acl = kmalloc(size, flags); |
43 | if (acl) { | 54 | if (acl) |
44 | atomic_set(&acl->a_refcount, 1); | 55 | posix_acl_init(acl, count); |
45 | acl->a_count = count; | ||
46 | } | ||
47 | return acl; | 56 | return acl; |
48 | } | 57 | } |
49 | 58 | ||
diff --git a/fs/xfs/linux-2.6/xfs_ioctl.c b/fs/xfs/linux-2.6/xfs_ioctl.c index b06ede1d0bed..f5e2a19e0f8e 100644 --- a/fs/xfs/linux-2.6/xfs_ioctl.c +++ b/fs/xfs/linux-2.6/xfs_ioctl.c | |||
@@ -985,10 +985,22 @@ xfs_ioctl_setattr( | |||
985 | 985 | ||
986 | /* | 986 | /* |
987 | * Extent size must be a multiple of the appropriate block | 987 | * Extent size must be a multiple of the appropriate block |
988 | * size, if set at all. | 988 | * size, if set at all. It must also be smaller than the |
989 | * maximum extent size supported by the filesystem. | ||
990 | * | ||
991 | * Also, for non-realtime files, limit the extent size hint to | ||
992 | * half the size of the AGs in the filesystem so alignment | ||
993 | * doesn't result in extents larger than an AG. | ||
989 | */ | 994 | */ |
990 | if (fa->fsx_extsize != 0) { | 995 | if (fa->fsx_extsize != 0) { |
991 | xfs_extlen_t size; | 996 | xfs_extlen_t size; |
997 | xfs_fsblock_t extsize_fsb; | ||
998 | |||
999 | extsize_fsb = XFS_B_TO_FSB(mp, fa->fsx_extsize); | ||
1000 | if (extsize_fsb > MAXEXTLEN) { | ||
1001 | code = XFS_ERROR(EINVAL); | ||
1002 | goto error_return; | ||
1003 | } | ||
992 | 1004 | ||
993 | if (XFS_IS_REALTIME_INODE(ip) || | 1005 | if (XFS_IS_REALTIME_INODE(ip) || |
994 | ((mask & FSX_XFLAGS) && | 1006 | ((mask & FSX_XFLAGS) && |
@@ -997,6 +1009,10 @@ xfs_ioctl_setattr( | |||
997 | mp->m_sb.sb_blocklog; | 1009 | mp->m_sb.sb_blocklog; |
998 | } else { | 1010 | } else { |
999 | size = mp->m_sb.sb_blocksize; | 1011 | size = mp->m_sb.sb_blocksize; |
1012 | if (extsize_fsb > mp->m_sb.sb_agblocks / 2) { | ||
1013 | code = XFS_ERROR(EINVAL); | ||
1014 | goto error_return; | ||
1015 | } | ||
1000 | } | 1016 | } |
1001 | 1017 | ||
1002 | if (fa->fsx_extsize % size) { | 1018 | if (fa->fsx_extsize % size) { |
diff --git a/fs/xfs/quota/xfs_qm.c b/fs/xfs/quota/xfs_qm.c index f8e854b4fde8..206a2815ced6 100644 --- a/fs/xfs/quota/xfs_qm.c +++ b/fs/xfs/quota/xfs_qm.c | |||
@@ -1863,12 +1863,14 @@ xfs_qm_dqreclaim_one(void) | |||
1863 | xfs_dquot_t *dqpout; | 1863 | xfs_dquot_t *dqpout; |
1864 | xfs_dquot_t *dqp; | 1864 | xfs_dquot_t *dqp; |
1865 | int restarts; | 1865 | int restarts; |
1866 | int startagain; | ||
1866 | 1867 | ||
1867 | restarts = 0; | 1868 | restarts = 0; |
1868 | dqpout = NULL; | 1869 | dqpout = NULL; |
1869 | 1870 | ||
1870 | /* lockorder: hashchainlock, freelistlock, mplistlock, dqlock, dqflock */ | 1871 | /* lockorder: hashchainlock, freelistlock, mplistlock, dqlock, dqflock */ |
1871 | startagain: | 1872 | again: |
1873 | startagain = 0; | ||
1872 | mutex_lock(&xfs_Gqm->qm_dqfrlist_lock); | 1874 | mutex_lock(&xfs_Gqm->qm_dqfrlist_lock); |
1873 | 1875 | ||
1874 | list_for_each_entry(dqp, &xfs_Gqm->qm_dqfrlist, q_freelist) { | 1876 | list_for_each_entry(dqp, &xfs_Gqm->qm_dqfrlist, q_freelist) { |
@@ -1885,13 +1887,10 @@ startagain: | |||
1885 | ASSERT(! (dqp->dq_flags & XFS_DQ_INACTIVE)); | 1887 | ASSERT(! (dqp->dq_flags & XFS_DQ_INACTIVE)); |
1886 | 1888 | ||
1887 | trace_xfs_dqreclaim_want(dqp); | 1889 | trace_xfs_dqreclaim_want(dqp); |
1888 | |||
1889 | xfs_dqunlock(dqp); | ||
1890 | mutex_unlock(&xfs_Gqm->qm_dqfrlist_lock); | ||
1891 | if (++restarts >= XFS_QM_RECLAIM_MAX_RESTARTS) | ||
1892 | return NULL; | ||
1893 | XQM_STATS_INC(xqmstats.xs_qm_dqwants); | 1890 | XQM_STATS_INC(xqmstats.xs_qm_dqwants); |
1894 | goto startagain; | 1891 | restarts++; |
1892 | startagain = 1; | ||
1893 | goto dqunlock; | ||
1895 | } | 1894 | } |
1896 | 1895 | ||
1897 | /* | 1896 | /* |
@@ -1906,23 +1905,20 @@ startagain: | |||
1906 | ASSERT(list_empty(&dqp->q_mplist)); | 1905 | ASSERT(list_empty(&dqp->q_mplist)); |
1907 | list_del_init(&dqp->q_freelist); | 1906 | list_del_init(&dqp->q_freelist); |
1908 | xfs_Gqm->qm_dqfrlist_cnt--; | 1907 | xfs_Gqm->qm_dqfrlist_cnt--; |
1909 | xfs_dqunlock(dqp); | ||
1910 | dqpout = dqp; | 1908 | dqpout = dqp; |
1911 | XQM_STATS_INC(xqmstats.xs_qm_dqinact_reclaims); | 1909 | XQM_STATS_INC(xqmstats.xs_qm_dqinact_reclaims); |
1912 | break; | 1910 | goto dqunlock; |
1913 | } | 1911 | } |
1914 | 1912 | ||
1915 | ASSERT(dqp->q_hash); | 1913 | ASSERT(dqp->q_hash); |
1916 | ASSERT(!list_empty(&dqp->q_mplist)); | 1914 | ASSERT(!list_empty(&dqp->q_mplist)); |
1917 | 1915 | ||
1918 | /* | 1916 | /* |
1919 | * Try to grab the flush lock. If this dquot is in the process of | 1917 | * Try to grab the flush lock. If this dquot is in the process |
1920 | * getting flushed to disk, we don't want to reclaim it. | 1918 | * of getting flushed to disk, we don't want to reclaim it. |
1921 | */ | 1919 | */ |
1922 | if (!xfs_dqflock_nowait(dqp)) { | 1920 | if (!xfs_dqflock_nowait(dqp)) |
1923 | xfs_dqunlock(dqp); | 1921 | goto dqunlock; |
1924 | continue; | ||
1925 | } | ||
1926 | 1922 | ||
1927 | /* | 1923 | /* |
1928 | * We have the flush lock so we know that this is not in the | 1924 | * We have the flush lock so we know that this is not in the |
@@ -1944,8 +1940,7 @@ startagain: | |||
1944 | xfs_fs_cmn_err(CE_WARN, mp, | 1940 | xfs_fs_cmn_err(CE_WARN, mp, |
1945 | "xfs_qm_dqreclaim: dquot %p flush failed", dqp); | 1941 | "xfs_qm_dqreclaim: dquot %p flush failed", dqp); |
1946 | } | 1942 | } |
1947 | xfs_dqunlock(dqp); /* dqflush unlocks dqflock */ | 1943 | goto dqunlock; |
1948 | continue; | ||
1949 | } | 1944 | } |
1950 | 1945 | ||
1951 | /* | 1946 | /* |
@@ -1967,13 +1962,8 @@ startagain: | |||
1967 | */ | 1962 | */ |
1968 | if (!mutex_trylock(&mp->m_quotainfo->qi_dqlist_lock)) { | 1963 | if (!mutex_trylock(&mp->m_quotainfo->qi_dqlist_lock)) { |
1969 | restarts++; | 1964 | restarts++; |
1970 | mutex_unlock(&dqp->q_hash->qh_lock); | 1965 | startagain = 1; |
1971 | xfs_dqfunlock(dqp); | 1966 | goto qhunlock; |
1972 | xfs_dqunlock(dqp); | ||
1973 | mutex_unlock(&xfs_Gqm->qm_dqfrlist_lock); | ||
1974 | if (restarts++ >= XFS_QM_RECLAIM_MAX_RESTARTS) | ||
1975 | return NULL; | ||
1976 | goto startagain; | ||
1977 | } | 1967 | } |
1978 | 1968 | ||
1979 | ASSERT(dqp->q_nrefs == 0); | 1969 | ASSERT(dqp->q_nrefs == 0); |
@@ -1986,14 +1976,20 @@ startagain: | |||
1986 | xfs_Gqm->qm_dqfrlist_cnt--; | 1976 | xfs_Gqm->qm_dqfrlist_cnt--; |
1987 | dqpout = dqp; | 1977 | dqpout = dqp; |
1988 | mutex_unlock(&mp->m_quotainfo->qi_dqlist_lock); | 1978 | mutex_unlock(&mp->m_quotainfo->qi_dqlist_lock); |
1979 | qhunlock: | ||
1989 | mutex_unlock(&dqp->q_hash->qh_lock); | 1980 | mutex_unlock(&dqp->q_hash->qh_lock); |
1990 | dqfunlock: | 1981 | dqfunlock: |
1991 | xfs_dqfunlock(dqp); | 1982 | xfs_dqfunlock(dqp); |
1983 | dqunlock: | ||
1992 | xfs_dqunlock(dqp); | 1984 | xfs_dqunlock(dqp); |
1993 | if (dqpout) | 1985 | if (dqpout) |
1994 | break; | 1986 | break; |
1995 | if (restarts >= XFS_QM_RECLAIM_MAX_RESTARTS) | 1987 | if (restarts >= XFS_QM_RECLAIM_MAX_RESTARTS) |
1996 | return NULL; | 1988 | break; |
1989 | if (startagain) { | ||
1990 | mutex_unlock(&xfs_Gqm->qm_dqfrlist_lock); | ||
1991 | goto again; | ||
1992 | } | ||
1997 | } | 1993 | } |
1998 | mutex_unlock(&xfs_Gqm->qm_dqfrlist_lock); | 1994 | mutex_unlock(&xfs_Gqm->qm_dqfrlist_lock); |
1999 | return dqpout; | 1995 | return dqpout; |
diff --git a/fs/xfs/xfs_alloc.h b/fs/xfs/xfs_alloc.h index 0ab56b32c7eb..d0b3bc72005b 100644 --- a/fs/xfs/xfs_alloc.h +++ b/fs/xfs/xfs_alloc.h | |||
@@ -75,6 +75,22 @@ typedef unsigned int xfs_alloctype_t; | |||
75 | #define XFS_ALLOC_SET_ASIDE(mp) (4 + ((mp)->m_sb.sb_agcount * 4)) | 75 | #define XFS_ALLOC_SET_ASIDE(mp) (4 + ((mp)->m_sb.sb_agcount * 4)) |
76 | 76 | ||
77 | /* | 77 | /* |
78 | * When deciding how much space to allocate out of an AG, we limit the | ||
79 | * allocation maximum size to the size the AG. However, we cannot use all the | ||
80 | * blocks in the AG - some are permanently used by metadata. These | ||
81 | * blocks are generally: | ||
82 | * - the AG superblock, AGF, AGI and AGFL | ||
83 | * - the AGF (bno and cnt) and AGI btree root blocks | ||
84 | * - 4 blocks on the AGFL according to XFS_ALLOC_SET_ASIDE() limits | ||
85 | * | ||
86 | * The AG headers are sector sized, so the amount of space they take up is | ||
87 | * dependent on filesystem geometry. The others are all single blocks. | ||
88 | */ | ||
89 | #define XFS_ALLOC_AG_MAX_USABLE(mp) \ | ||
90 | ((mp)->m_sb.sb_agblocks - XFS_BB_TO_FSB(mp, XFS_FSS_TO_BB(mp, 4)) - 7) | ||
91 | |||
92 | |||
93 | /* | ||
78 | * Argument structure for xfs_alloc routines. | 94 | * Argument structure for xfs_alloc routines. |
79 | * This is turned into a structure to avoid having 20 arguments passed | 95 | * This is turned into a structure to avoid having 20 arguments passed |
80 | * down several levels of the stack. | 96 | * down several levels of the stack. |
diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c index 4111cd3966c7..dc3afd7739ff 100644 --- a/fs/xfs/xfs_bmap.c +++ b/fs/xfs/xfs_bmap.c | |||
@@ -1038,17 +1038,34 @@ xfs_bmap_add_extent_delay_real( | |||
1038 | * Filling in the middle part of a previous delayed allocation. | 1038 | * Filling in the middle part of a previous delayed allocation. |
1039 | * Contiguity is impossible here. | 1039 | * Contiguity is impossible here. |
1040 | * This case is avoided almost all the time. | 1040 | * This case is avoided almost all the time. |
1041 | * | ||
1042 | * We start with a delayed allocation: | ||
1043 | * | ||
1044 | * +ddddddddddddddddddddddddddddddddddddddddddddddddddddddd+ | ||
1045 | * PREV @ idx | ||
1046 | * | ||
1047 | * and we are allocating: | ||
1048 | * +rrrrrrrrrrrrrrrrr+ | ||
1049 | * new | ||
1050 | * | ||
1051 | * and we set it up for insertion as: | ||
1052 | * +ddddddddddddddddddd+rrrrrrrrrrrrrrrrr+ddddddddddddddddd+ | ||
1053 | * new | ||
1054 | * PREV @ idx LEFT RIGHT | ||
1055 | * inserted at idx + 1 | ||
1041 | */ | 1056 | */ |
1042 | temp = new->br_startoff - PREV.br_startoff; | 1057 | temp = new->br_startoff - PREV.br_startoff; |
1043 | trace_xfs_bmap_pre_update(ip, idx, 0, _THIS_IP_); | ||
1044 | xfs_bmbt_set_blockcount(ep, temp); | ||
1045 | r[0] = *new; | ||
1046 | r[1].br_state = PREV.br_state; | ||
1047 | r[1].br_startblock = 0; | ||
1048 | r[1].br_startoff = new_endoff; | ||
1049 | temp2 = PREV.br_startoff + PREV.br_blockcount - new_endoff; | 1058 | temp2 = PREV.br_startoff + PREV.br_blockcount - new_endoff; |
1050 | r[1].br_blockcount = temp2; | 1059 | trace_xfs_bmap_pre_update(ip, idx, 0, _THIS_IP_); |
1051 | xfs_iext_insert(ip, idx + 1, 2, &r[0], state); | 1060 | xfs_bmbt_set_blockcount(ep, temp); /* truncate PREV */ |
1061 | LEFT = *new; | ||
1062 | RIGHT.br_state = PREV.br_state; | ||
1063 | RIGHT.br_startblock = nullstartblock( | ||
1064 | (int)xfs_bmap_worst_indlen(ip, temp2)); | ||
1065 | RIGHT.br_startoff = new_endoff; | ||
1066 | RIGHT.br_blockcount = temp2; | ||
1067 | /* insert LEFT (r[0]) and RIGHT (r[1]) at the same time */ | ||
1068 | xfs_iext_insert(ip, idx + 1, 2, &LEFT, state); | ||
1052 | ip->i_df.if_lastex = idx + 1; | 1069 | ip->i_df.if_lastex = idx + 1; |
1053 | ip->i_d.di_nextents++; | 1070 | ip->i_d.di_nextents++; |
1054 | if (cur == NULL) | 1071 | if (cur == NULL) |
@@ -2430,7 +2447,7 @@ xfs_bmap_btalloc_nullfb( | |||
2430 | startag = ag = 0; | 2447 | startag = ag = 0; |
2431 | 2448 | ||
2432 | pag = xfs_perag_get(mp, ag); | 2449 | pag = xfs_perag_get(mp, ag); |
2433 | while (*blen < ap->alen) { | 2450 | while (*blen < args->maxlen) { |
2434 | if (!pag->pagf_init) { | 2451 | if (!pag->pagf_init) { |
2435 | error = xfs_alloc_pagf_init(mp, args->tp, ag, | 2452 | error = xfs_alloc_pagf_init(mp, args->tp, ag, |
2436 | XFS_ALLOC_FLAG_TRYLOCK); | 2453 | XFS_ALLOC_FLAG_TRYLOCK); |
@@ -2452,7 +2469,7 @@ xfs_bmap_btalloc_nullfb( | |||
2452 | notinit = 1; | 2469 | notinit = 1; |
2453 | 2470 | ||
2454 | if (xfs_inode_is_filestream(ap->ip)) { | 2471 | if (xfs_inode_is_filestream(ap->ip)) { |
2455 | if (*blen >= ap->alen) | 2472 | if (*blen >= args->maxlen) |
2456 | break; | 2473 | break; |
2457 | 2474 | ||
2458 | if (ap->userdata) { | 2475 | if (ap->userdata) { |
@@ -2498,14 +2515,14 @@ xfs_bmap_btalloc_nullfb( | |||
2498 | * If the best seen length is less than the request | 2515 | * If the best seen length is less than the request |
2499 | * length, use the best as the minimum. | 2516 | * length, use the best as the minimum. |
2500 | */ | 2517 | */ |
2501 | else if (*blen < ap->alen) | 2518 | else if (*blen < args->maxlen) |
2502 | args->minlen = *blen; | 2519 | args->minlen = *blen; |
2503 | /* | 2520 | /* |
2504 | * Otherwise we've seen an extent as big as alen, | 2521 | * Otherwise we've seen an extent as big as maxlen, |
2505 | * use that as the minimum. | 2522 | * use that as the minimum. |
2506 | */ | 2523 | */ |
2507 | else | 2524 | else |
2508 | args->minlen = ap->alen; | 2525 | args->minlen = args->maxlen; |
2509 | 2526 | ||
2510 | /* | 2527 | /* |
2511 | * set the failure fallback case to look in the selected | 2528 | * set the failure fallback case to look in the selected |
@@ -2573,7 +2590,9 @@ xfs_bmap_btalloc( | |||
2573 | args.tp = ap->tp; | 2590 | args.tp = ap->tp; |
2574 | args.mp = mp; | 2591 | args.mp = mp; |
2575 | args.fsbno = ap->rval; | 2592 | args.fsbno = ap->rval; |
2576 | args.maxlen = MIN(ap->alen, mp->m_sb.sb_agblocks); | 2593 | |
2594 | /* Trim the allocation back to the maximum an AG can fit. */ | ||
2595 | args.maxlen = MIN(ap->alen, XFS_ALLOC_AG_MAX_USABLE(mp)); | ||
2577 | args.firstblock = ap->firstblock; | 2596 | args.firstblock = ap->firstblock; |
2578 | blen = 0; | 2597 | blen = 0; |
2579 | if (nullfb) { | 2598 | if (nullfb) { |
@@ -2621,7 +2640,7 @@ xfs_bmap_btalloc( | |||
2621 | /* | 2640 | /* |
2622 | * Adjust for alignment | 2641 | * Adjust for alignment |
2623 | */ | 2642 | */ |
2624 | if (blen > args.alignment && blen <= ap->alen) | 2643 | if (blen > args.alignment && blen <= args.maxlen) |
2625 | args.minlen = blen - args.alignment; | 2644 | args.minlen = blen - args.alignment; |
2626 | args.minalignslop = 0; | 2645 | args.minalignslop = 0; |
2627 | } else { | 2646 | } else { |
@@ -2640,7 +2659,7 @@ xfs_bmap_btalloc( | |||
2640 | * of minlen+alignment+slop doesn't go up | 2659 | * of minlen+alignment+slop doesn't go up |
2641 | * between the calls. | 2660 | * between the calls. |
2642 | */ | 2661 | */ |
2643 | if (blen > mp->m_dalign && blen <= ap->alen) | 2662 | if (blen > mp->m_dalign && blen <= args.maxlen) |
2644 | nextminlen = blen - mp->m_dalign; | 2663 | nextminlen = blen - mp->m_dalign; |
2645 | else | 2664 | else |
2646 | nextminlen = args.minlen; | 2665 | nextminlen = args.minlen; |
@@ -4485,6 +4504,16 @@ xfs_bmapi( | |||
4485 | /* Figure out the extent size, adjust alen */ | 4504 | /* Figure out the extent size, adjust alen */ |
4486 | extsz = xfs_get_extsz_hint(ip); | 4505 | extsz = xfs_get_extsz_hint(ip); |
4487 | if (extsz) { | 4506 | if (extsz) { |
4507 | /* | ||
4508 | * make sure we don't exceed a single | ||
4509 | * extent length when we align the | ||
4510 | * extent by reducing length we are | ||
4511 | * going to allocate by the maximum | ||
4512 | * amount extent size aligment may | ||
4513 | * require. | ||
4514 | */ | ||
4515 | alen = XFS_FILBLKS_MIN(len, | ||
4516 | MAXEXTLEN - (2 * extsz - 1)); | ||
4488 | error = xfs_bmap_extsize_align(mp, | 4517 | error = xfs_bmap_extsize_align(mp, |
4489 | &got, &prev, extsz, | 4518 | &got, &prev, extsz, |
4490 | rt, eof, | 4519 | rt, eof, |
diff --git a/fs/xfs/xfs_buf_item.c b/fs/xfs/xfs_buf_item.c index 98c6f73b6752..6f8c21ce0d6d 100644 --- a/fs/xfs/xfs_buf_item.c +++ b/fs/xfs/xfs_buf_item.c | |||
@@ -427,13 +427,15 @@ xfs_buf_item_unpin( | |||
427 | 427 | ||
428 | if (remove) { | 428 | if (remove) { |
429 | /* | 429 | /* |
430 | * We have to remove the log item from the transaction | 430 | * If we are in a transaction context, we have to |
431 | * as we are about to release our reference to the | 431 | * remove the log item from the transaction as we are |
432 | * buffer. If we don't, the unlock that occurs later | 432 | * about to release our reference to the buffer. If we |
433 | * in xfs_trans_uncommit() will ry to reference the | 433 | * don't, the unlock that occurs later in |
434 | * xfs_trans_uncommit() will try to reference the | ||
434 | * buffer which we no longer have a hold on. | 435 | * buffer which we no longer have a hold on. |
435 | */ | 436 | */ |
436 | xfs_trans_del_item(lip); | 437 | if (lip->li_desc) |
438 | xfs_trans_del_item(lip); | ||
437 | 439 | ||
438 | /* | 440 | /* |
439 | * Since the transaction no longer refers to the buffer, | 441 | * Since the transaction no longer refers to the buffer, |
diff --git a/fs/xfs/xfs_extfree_item.c b/fs/xfs/xfs_extfree_item.c index 75f2ef60e579..d22e62623437 100644 --- a/fs/xfs/xfs_extfree_item.c +++ b/fs/xfs/xfs_extfree_item.c | |||
@@ -138,7 +138,8 @@ xfs_efi_item_unpin( | |||
138 | 138 | ||
139 | if (remove) { | 139 | if (remove) { |
140 | ASSERT(!(lip->li_flags & XFS_LI_IN_AIL)); | 140 | ASSERT(!(lip->li_flags & XFS_LI_IN_AIL)); |
141 | xfs_trans_del_item(lip); | 141 | if (lip->li_desc) |
142 | xfs_trans_del_item(lip); | ||
142 | xfs_efi_item_free(efip); | 143 | xfs_efi_item_free(efip); |
143 | return; | 144 | return; |
144 | } | 145 | } |
diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c index 55582bd66659..8a0f044750c3 100644 --- a/fs/xfs/xfs_iomap.c +++ b/fs/xfs/xfs_iomap.c | |||
@@ -337,7 +337,12 @@ xfs_iomap_prealloc_size( | |||
337 | int shift = 0; | 337 | int shift = 0; |
338 | int64_t freesp; | 338 | int64_t freesp; |
339 | 339 | ||
340 | alloc_blocks = XFS_B_TO_FSB(mp, ip->i_size); | 340 | /* |
341 | * rounddown_pow_of_two() returns an undefined result | ||
342 | * if we pass in alloc_blocks = 0. Hence the "+ 1" to | ||
343 | * ensure we always pass in a non-zero value. | ||
344 | */ | ||
345 | alloc_blocks = XFS_B_TO_FSB(mp, ip->i_size) + 1; | ||
341 | alloc_blocks = XFS_FILEOFF_MIN(MAXEXTLEN, | 346 | alloc_blocks = XFS_FILEOFF_MIN(MAXEXTLEN, |
342 | rounddown_pow_of_two(alloc_blocks)); | 347 | rounddown_pow_of_two(alloc_blocks)); |
343 | 348 | ||
diff --git a/fs/xfs/xfs_log.h b/fs/xfs/xfs_log.h index 916eb7db14d9..3bd3291ef8d2 100644 --- a/fs/xfs/xfs_log.h +++ b/fs/xfs/xfs_log.h | |||
@@ -191,7 +191,7 @@ void xfs_log_ticket_put(struct xlog_ticket *ticket); | |||
191 | 191 | ||
192 | xlog_tid_t xfs_log_get_trans_ident(struct xfs_trans *tp); | 192 | xlog_tid_t xfs_log_get_trans_ident(struct xfs_trans *tp); |
193 | 193 | ||
194 | int xfs_log_commit_cil(struct xfs_mount *mp, struct xfs_trans *tp, | 194 | void xfs_log_commit_cil(struct xfs_mount *mp, struct xfs_trans *tp, |
195 | struct xfs_log_vec *log_vector, | 195 | struct xfs_log_vec *log_vector, |
196 | xfs_lsn_t *commit_lsn, int flags); | 196 | xfs_lsn_t *commit_lsn, int flags); |
197 | bool xfs_log_item_in_current_chkpt(struct xfs_log_item *lip); | 197 | bool xfs_log_item_in_current_chkpt(struct xfs_log_item *lip); |
diff --git a/fs/xfs/xfs_log_cil.c b/fs/xfs/xfs_log_cil.c index 9dc8125d04e5..9ca59be08977 100644 --- a/fs/xfs/xfs_log_cil.c +++ b/fs/xfs/xfs_log_cil.c | |||
@@ -543,7 +543,7 @@ xlog_cil_push( | |||
543 | 543 | ||
544 | error = xlog_write(log, &lvhdr, tic, &ctx->start_lsn, NULL, 0); | 544 | error = xlog_write(log, &lvhdr, tic, &ctx->start_lsn, NULL, 0); |
545 | if (error) | 545 | if (error) |
546 | goto out_abort; | 546 | goto out_abort_free_ticket; |
547 | 547 | ||
548 | /* | 548 | /* |
549 | * now that we've written the checkpoint into the log, strictly | 549 | * now that we've written the checkpoint into the log, strictly |
@@ -569,8 +569,9 @@ restart: | |||
569 | } | 569 | } |
570 | spin_unlock(&cil->xc_cil_lock); | 570 | spin_unlock(&cil->xc_cil_lock); |
571 | 571 | ||
572 | /* xfs_log_done always frees the ticket on error. */ | ||
572 | commit_lsn = xfs_log_done(log->l_mp, tic, &commit_iclog, 0); | 573 | commit_lsn = xfs_log_done(log->l_mp, tic, &commit_iclog, 0); |
573 | if (error || commit_lsn == -1) | 574 | if (commit_lsn == -1) |
574 | goto out_abort; | 575 | goto out_abort; |
575 | 576 | ||
576 | /* attach all the transactions w/ busy extents to iclog */ | 577 | /* attach all the transactions w/ busy extents to iclog */ |
@@ -600,6 +601,8 @@ out_free_ticket: | |||
600 | kmem_free(new_ctx); | 601 | kmem_free(new_ctx); |
601 | return 0; | 602 | return 0; |
602 | 603 | ||
604 | out_abort_free_ticket: | ||
605 | xfs_log_ticket_put(tic); | ||
603 | out_abort: | 606 | out_abort: |
604 | xlog_cil_committed(ctx, XFS_LI_ABORTED); | 607 | xlog_cil_committed(ctx, XFS_LI_ABORTED); |
605 | return XFS_ERROR(EIO); | 608 | return XFS_ERROR(EIO); |
@@ -622,7 +625,7 @@ out_abort: | |||
622 | * background commit, returns without it held once background commits are | 625 | * background commit, returns without it held once background commits are |
623 | * allowed again. | 626 | * allowed again. |
624 | */ | 627 | */ |
625 | int | 628 | void |
626 | xfs_log_commit_cil( | 629 | xfs_log_commit_cil( |
627 | struct xfs_mount *mp, | 630 | struct xfs_mount *mp, |
628 | struct xfs_trans *tp, | 631 | struct xfs_trans *tp, |
@@ -637,11 +640,6 @@ xfs_log_commit_cil( | |||
637 | if (flags & XFS_TRANS_RELEASE_LOG_RES) | 640 | if (flags & XFS_TRANS_RELEASE_LOG_RES) |
638 | log_flags = XFS_LOG_REL_PERM_RESERV; | 641 | log_flags = XFS_LOG_REL_PERM_RESERV; |
639 | 642 | ||
640 | if (XLOG_FORCED_SHUTDOWN(log)) { | ||
641 | xlog_cil_free_logvec(log_vector); | ||
642 | return XFS_ERROR(EIO); | ||
643 | } | ||
644 | |||
645 | /* | 643 | /* |
646 | * do all the hard work of formatting items (including memory | 644 | * do all the hard work of formatting items (including memory |
647 | * allocation) outside the CIL context lock. This prevents stalling CIL | 645 | * allocation) outside the CIL context lock. This prevents stalling CIL |
@@ -701,7 +699,6 @@ xfs_log_commit_cil( | |||
701 | */ | 699 | */ |
702 | if (push) | 700 | if (push) |
703 | xlog_cil_push(log, 0); | 701 | xlog_cil_push(log, 0); |
704 | return 0; | ||
705 | } | 702 | } |
706 | 703 | ||
707 | /* | 704 | /* |
diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c index 33dbc4e0ad62..76922793f64f 100644 --- a/fs/xfs/xfs_trans.c +++ b/fs/xfs/xfs_trans.c | |||
@@ -1446,6 +1446,14 @@ xfs_log_item_batch_insert( | |||
1446 | * Bulk operation version of xfs_trans_committed that takes a log vector of | 1446 | * Bulk operation version of xfs_trans_committed that takes a log vector of |
1447 | * items to insert into the AIL. This uses bulk AIL insertion techniques to | 1447 | * items to insert into the AIL. This uses bulk AIL insertion techniques to |
1448 | * minimise lock traffic. | 1448 | * minimise lock traffic. |
1449 | * | ||
1450 | * If we are called with the aborted flag set, it is because a log write during | ||
1451 | * a CIL checkpoint commit has failed. In this case, all the items in the | ||
1452 | * checkpoint have already gone through IOP_COMMITED and IOP_UNLOCK, which | ||
1453 | * means that checkpoint commit abort handling is treated exactly the same | ||
1454 | * as an iclog write error even though we haven't started any IO yet. Hence in | ||
1455 | * this case all we need to do is IOP_COMMITTED processing, followed by an | ||
1456 | * IOP_UNPIN(aborted) call. | ||
1449 | */ | 1457 | */ |
1450 | void | 1458 | void |
1451 | xfs_trans_committed_bulk( | 1459 | xfs_trans_committed_bulk( |
@@ -1472,6 +1480,16 @@ xfs_trans_committed_bulk( | |||
1472 | if (XFS_LSN_CMP(item_lsn, (xfs_lsn_t)-1) == 0) | 1480 | if (XFS_LSN_CMP(item_lsn, (xfs_lsn_t)-1) == 0) |
1473 | continue; | 1481 | continue; |
1474 | 1482 | ||
1483 | /* | ||
1484 | * if we are aborting the operation, no point in inserting the | ||
1485 | * object into the AIL as we are in a shutdown situation. | ||
1486 | */ | ||
1487 | if (aborted) { | ||
1488 | ASSERT(XFS_FORCED_SHUTDOWN(ailp->xa_mount)); | ||
1489 | IOP_UNPIN(lip, 1); | ||
1490 | continue; | ||
1491 | } | ||
1492 | |||
1475 | if (item_lsn != commit_lsn) { | 1493 | if (item_lsn != commit_lsn) { |
1476 | 1494 | ||
1477 | /* | 1495 | /* |
@@ -1503,20 +1521,24 @@ xfs_trans_committed_bulk( | |||
1503 | } | 1521 | } |
1504 | 1522 | ||
1505 | /* | 1523 | /* |
1506 | * Called from the trans_commit code when we notice that | 1524 | * Called from the trans_commit code when we notice that the filesystem is in |
1507 | * the filesystem is in the middle of a forced shutdown. | 1525 | * the middle of a forced shutdown. |
1526 | * | ||
1527 | * When we are called here, we have already pinned all the items in the | ||
1528 | * transaction. However, neither IOP_COMMITTING or IOP_UNLOCK has been called | ||
1529 | * so we can simply walk the items in the transaction, unpin them with an abort | ||
1530 | * flag and then free the items. Note that unpinning the items can result in | ||
1531 | * them being freed immediately, so we need to use a safe list traversal method | ||
1532 | * here. | ||
1508 | */ | 1533 | */ |
1509 | STATIC void | 1534 | STATIC void |
1510 | xfs_trans_uncommit( | 1535 | xfs_trans_uncommit( |
1511 | struct xfs_trans *tp, | 1536 | struct xfs_trans *tp, |
1512 | uint flags) | 1537 | uint flags) |
1513 | { | 1538 | { |
1514 | struct xfs_log_item_desc *lidp; | 1539 | struct xfs_log_item_desc *lidp, *n; |
1515 | 1540 | ||
1516 | list_for_each_entry(lidp, &tp->t_items, lid_trans) { | 1541 | list_for_each_entry_safe(lidp, n, &tp->t_items, lid_trans) { |
1517 | /* | ||
1518 | * Unpin all but those that aren't dirty. | ||
1519 | */ | ||
1520 | if (lidp->lid_flags & XFS_LID_DIRTY) | 1542 | if (lidp->lid_flags & XFS_LID_DIRTY) |
1521 | IOP_UNPIN(lidp->lid_item, 1); | 1543 | IOP_UNPIN(lidp->lid_item, 1); |
1522 | } | 1544 | } |
@@ -1733,7 +1755,6 @@ xfs_trans_commit_cil( | |||
1733 | int flags) | 1755 | int flags) |
1734 | { | 1756 | { |
1735 | struct xfs_log_vec *log_vector; | 1757 | struct xfs_log_vec *log_vector; |
1736 | int error; | ||
1737 | 1758 | ||
1738 | /* | 1759 | /* |
1739 | * Get each log item to allocate a vector structure for | 1760 | * Get each log item to allocate a vector structure for |
@@ -1744,9 +1765,7 @@ xfs_trans_commit_cil( | |||
1744 | if (!log_vector) | 1765 | if (!log_vector) |
1745 | return ENOMEM; | 1766 | return ENOMEM; |
1746 | 1767 | ||
1747 | error = xfs_log_commit_cil(mp, tp, log_vector, commit_lsn, flags); | 1768 | xfs_log_commit_cil(mp, tp, log_vector, commit_lsn, flags); |
1748 | if (error) | ||
1749 | return error; | ||
1750 | 1769 | ||
1751 | current_restore_flags_nested(&tp->t_pflags, PF_FSTRANS); | 1770 | current_restore_flags_nested(&tp->t_pflags, PF_FSTRANS); |
1752 | xfs_trans_free(tp); | 1771 | xfs_trans_free(tp); |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 32b38cd829d3..bd3215940c37 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -2555,9 +2555,12 @@ int proc_nr_inodes(struct ctl_table *table, int write, | |||
2555 | void __user *buffer, size_t *lenp, loff_t *ppos); | 2555 | void __user *buffer, size_t *lenp, loff_t *ppos); |
2556 | int __init get_filesystem_list(char *buf); | 2556 | int __init get_filesystem_list(char *buf); |
2557 | 2557 | ||
2558 | #define __FMODE_EXEC ((__force int) FMODE_EXEC) | ||
2559 | #define __FMODE_NONOTIFY ((__force int) FMODE_NONOTIFY) | ||
2560 | |||
2558 | #define ACC_MODE(x) ("\004\002\006\006"[(x)&O_ACCMODE]) | 2561 | #define ACC_MODE(x) ("\004\002\006\006"[(x)&O_ACCMODE]) |
2559 | #define OPEN_FMODE(flag) ((__force fmode_t)(((flag + 1) & O_ACCMODE) | \ | 2562 | #define OPEN_FMODE(flag) ((__force fmode_t)(((flag + 1) & O_ACCMODE) | \ |
2560 | (flag & FMODE_NONOTIFY))) | 2563 | (flag & __FMODE_NONOTIFY))) |
2561 | 2564 | ||
2562 | #endif /* __KERNEL__ */ | 2565 | #endif /* __KERNEL__ */ |
2563 | #endif /* _LINUX_FS_H */ | 2566 | #endif /* _LINUX_FS_H */ |
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index e2f4d6af2125..2fe6e84894a4 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
@@ -588,7 +588,7 @@ struct sysinfo { | |||
588 | 588 | ||
589 | /** | 589 | /** |
590 | * BUILD_BUG_ON - break compile if a condition is true. | 590 | * BUILD_BUG_ON - break compile if a condition is true. |
591 | * @cond: the condition which the compiler should know is false. | 591 | * @condition: the condition which the compiler should know is false. |
592 | * | 592 | * |
593 | * If you have some code which relies on certain constants being equal, or | 593 | * If you have some code which relies on certain constants being equal, or |
594 | * other compile-time-evaluated condition, you should use BUILD_BUG_ON to | 594 | * other compile-time-evaluated condition, you should use BUILD_BUG_ON to |
diff --git a/include/linux/nfsacl.h b/include/linux/nfsacl.h index f321b578edeb..fabcb1e5c460 100644 --- a/include/linux/nfsacl.h +++ b/include/linux/nfsacl.h | |||
@@ -51,10 +51,10 @@ nfsacl_size(struct posix_acl *acl_access, struct posix_acl *acl_default) | |||
51 | return w; | 51 | return w; |
52 | } | 52 | } |
53 | 53 | ||
54 | extern unsigned int | 54 | extern int |
55 | nfsacl_encode(struct xdr_buf *buf, unsigned int base, struct inode *inode, | 55 | nfsacl_encode(struct xdr_buf *buf, unsigned int base, struct inode *inode, |
56 | struct posix_acl *acl, int encode_entries, int typeflag); | 56 | struct posix_acl *acl, int encode_entries, int typeflag); |
57 | extern unsigned int | 57 | extern int |
58 | nfsacl_decode(struct xdr_buf *buf, unsigned int base, unsigned int *aclcnt, | 58 | nfsacl_decode(struct xdr_buf *buf, unsigned int base, unsigned int *aclcnt, |
59 | struct posix_acl **pacl); | 59 | struct posix_acl **pacl); |
60 | 60 | ||
diff --git a/include/linux/posix_acl.h b/include/linux/posix_acl.h index d68283a898bb..54211c1cd926 100644 --- a/include/linux/posix_acl.h +++ b/include/linux/posix_acl.h | |||
@@ -71,6 +71,7 @@ posix_acl_release(struct posix_acl *acl) | |||
71 | 71 | ||
72 | /* posix_acl.c */ | 72 | /* posix_acl.c */ |
73 | 73 | ||
74 | extern void posix_acl_init(struct posix_acl *, int); | ||
74 | extern struct posix_acl *posix_acl_alloc(int, gfp_t); | 75 | extern struct posix_acl *posix_acl_alloc(int, gfp_t); |
75 | extern struct posix_acl *posix_acl_clone(const struct posix_acl *, gfp_t); | 76 | extern struct posix_acl *posix_acl_clone(const struct posix_acl *, gfp_t); |
76 | extern int posix_acl_valid(const struct posix_acl *); | 77 | extern int posix_acl_valid(const struct posix_acl *); |
diff --git a/include/linux/res_counter.h b/include/linux/res_counter.h index fcb9884df618..a5930cb66145 100644 --- a/include/linux/res_counter.h +++ b/include/linux/res_counter.h | |||
@@ -182,6 +182,26 @@ static inline bool res_counter_check_under_limit(struct res_counter *cnt) | |||
182 | return ret; | 182 | return ret; |
183 | } | 183 | } |
184 | 184 | ||
185 | /** | ||
186 | * res_counter_check_margin - check if the counter allows charging | ||
187 | * @cnt: the resource counter to check | ||
188 | * @bytes: the number of bytes to check the remaining space against | ||
189 | * | ||
190 | * Returns a boolean value on whether the counter can be charged | ||
191 | * @bytes or whether this would exceed the limit. | ||
192 | */ | ||
193 | static inline bool res_counter_check_margin(struct res_counter *cnt, | ||
194 | unsigned long bytes) | ||
195 | { | ||
196 | bool ret; | ||
197 | unsigned long flags; | ||
198 | |||
199 | spin_lock_irqsave(&cnt->lock, flags); | ||
200 | ret = cnt->limit - cnt->usage >= bytes; | ||
201 | spin_unlock_irqrestore(&cnt->lock, flags); | ||
202 | return ret; | ||
203 | } | ||
204 | |||
185 | static inline bool res_counter_check_under_soft_limit(struct res_counter *cnt) | 205 | static inline bool res_counter_check_under_soft_limit(struct res_counter *cnt) |
186 | { | 206 | { |
187 | bool ret; | 207 | bool ret; |
diff --git a/include/linux/sunrpc/bc_xprt.h b/include/linux/sunrpc/bc_xprt.h index c50b458b8a3f..082884295f80 100644 --- a/include/linux/sunrpc/bc_xprt.h +++ b/include/linux/sunrpc/bc_xprt.h | |||
@@ -47,14 +47,6 @@ static inline int svc_is_backchannel(const struct svc_rqst *rqstp) | |||
47 | return 1; | 47 | return 1; |
48 | return 0; | 48 | return 0; |
49 | } | 49 | } |
50 | static inline struct nfs4_sessionid *bc_xprt_sid(struct svc_rqst *rqstp) | ||
51 | { | ||
52 | if (svc_is_backchannel(rqstp)) | ||
53 | return (struct nfs4_sessionid *) | ||
54 | rqstp->rq_server->sv_bc_xprt->xpt_bc_sid; | ||
55 | return NULL; | ||
56 | } | ||
57 | |||
58 | #else /* CONFIG_NFS_V4_1 */ | 50 | #else /* CONFIG_NFS_V4_1 */ |
59 | static inline int xprt_setup_backchannel(struct rpc_xprt *xprt, | 51 | static inline int xprt_setup_backchannel(struct rpc_xprt *xprt, |
60 | unsigned int min_reqs) | 52 | unsigned int min_reqs) |
@@ -67,11 +59,6 @@ static inline int svc_is_backchannel(const struct svc_rqst *rqstp) | |||
67 | return 0; | 59 | return 0; |
68 | } | 60 | } |
69 | 61 | ||
70 | static inline struct nfs4_sessionid *bc_xprt_sid(struct svc_rqst *rqstp) | ||
71 | { | ||
72 | return NULL; | ||
73 | } | ||
74 | |||
75 | static inline void xprt_free_bc_request(struct rpc_rqst *req) | 62 | static inline void xprt_free_bc_request(struct rpc_rqst *req) |
76 | { | 63 | { |
77 | } | 64 | } |
diff --git a/include/linux/sunrpc/svc_xprt.h b/include/linux/sunrpc/svc_xprt.h index 059877b4d85b..7ad9751a0d87 100644 --- a/include/linux/sunrpc/svc_xprt.h +++ b/include/linux/sunrpc/svc_xprt.h | |||
@@ -77,7 +77,6 @@ struct svc_xprt { | |||
77 | size_t xpt_remotelen; /* length of address */ | 77 | size_t xpt_remotelen; /* length of address */ |
78 | struct rpc_wait_queue xpt_bc_pending; /* backchannel wait queue */ | 78 | struct rpc_wait_queue xpt_bc_pending; /* backchannel wait queue */ |
79 | struct list_head xpt_users; /* callbacks on free */ | 79 | struct list_head xpt_users; /* callbacks on free */ |
80 | void *xpt_bc_sid; /* back channel session ID */ | ||
81 | 80 | ||
82 | struct net *xpt_net; | 81 | struct net *xpt_net; |
83 | struct rpc_xprt *xpt_bc_xprt; /* NFSv4.1 backchannel */ | 82 | struct rpc_xprt *xpt_bc_xprt; /* NFSv4.1 backchannel */ |
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h index dd6ee49a0844..a854fe89484e 100644 --- a/include/linux/usb/hcd.h +++ b/include/linux/usb/hcd.h | |||
@@ -112,6 +112,7 @@ struct usb_hcd { | |||
112 | /* Flags that get set only during HCD registration or removal. */ | 112 | /* Flags that get set only during HCD registration or removal. */ |
113 | unsigned rh_registered:1;/* is root hub registered? */ | 113 | unsigned rh_registered:1;/* is root hub registered? */ |
114 | unsigned rh_pollable:1; /* may we poll the root hub? */ | 114 | unsigned rh_pollable:1; /* may we poll the root hub? */ |
115 | unsigned msix_enabled:1; /* driver has MSI-X enabled? */ | ||
115 | 116 | ||
116 | /* The next flag is a stopgap, to be removed when all the HCDs | 117 | /* The next flag is a stopgap, to be removed when all the HCDs |
117 | * support the new root-hub polling mechanism. */ | 118 | * support the new root-hub polling mechanism. */ |
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h index 16d682f4f7c3..c9049139a7a5 100644 --- a/include/linux/usb/serial.h +++ b/include/linux/usb/serial.h | |||
@@ -347,6 +347,9 @@ extern int usb_serial_generic_prepare_write_buffer(struct usb_serial_port *port, | |||
347 | extern int usb_serial_handle_sysrq_char(struct usb_serial_port *port, | 347 | extern int usb_serial_handle_sysrq_char(struct usb_serial_port *port, |
348 | unsigned int ch); | 348 | unsigned int ch); |
349 | extern int usb_serial_handle_break(struct usb_serial_port *port); | 349 | extern int usb_serial_handle_break(struct usb_serial_port *port); |
350 | extern void usb_serial_handle_dcd_change(struct usb_serial_port *usb_port, | ||
351 | struct tty_struct *tty, | ||
352 | unsigned int status); | ||
350 | 353 | ||
351 | 354 | ||
352 | extern int usb_serial_bus_register(struct usb_serial_driver *device); | 355 | extern int usb_serial_bus_register(struct usb_serial_driver *device); |
diff --git a/mm/huge_memory.c b/mm/huge_memory.c index e187454d82f6..b6c1ce3c53b5 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c | |||
@@ -1162,7 +1162,12 @@ static void __split_huge_page_refcount(struct page *page) | |||
1162 | /* after clearing PageTail the gup refcount can be released */ | 1162 | /* after clearing PageTail the gup refcount can be released */ |
1163 | smp_mb(); | 1163 | smp_mb(); |
1164 | 1164 | ||
1165 | page_tail->flags &= ~PAGE_FLAGS_CHECK_AT_PREP; | 1165 | /* |
1166 | * retain hwpoison flag of the poisoned tail page: | ||
1167 | * fix for the unsuitable process killed on Guest Machine(KVM) | ||
1168 | * by the memory-failure. | ||
1169 | */ | ||
1170 | page_tail->flags &= ~PAGE_FLAGS_CHECK_AT_PREP | __PG_HWPOISON; | ||
1166 | page_tail->flags |= (page->flags & | 1171 | page_tail->flags |= (page->flags & |
1167 | ((1L << PG_referenced) | | 1172 | ((1L << PG_referenced) | |
1168 | (1L << PG_swapbacked) | | 1173 | (1L << PG_swapbacked) | |
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 3878cfe399dc..da53a252b259 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -612,8 +612,10 @@ static void mem_cgroup_charge_statistics(struct mem_cgroup *mem, | |||
612 | /* pagein of a big page is an event. So, ignore page size */ | 612 | /* pagein of a big page is an event. So, ignore page size */ |
613 | if (nr_pages > 0) | 613 | if (nr_pages > 0) |
614 | __this_cpu_inc(mem->stat->count[MEM_CGROUP_STAT_PGPGIN_COUNT]); | 614 | __this_cpu_inc(mem->stat->count[MEM_CGROUP_STAT_PGPGIN_COUNT]); |
615 | else | 615 | else { |
616 | __this_cpu_inc(mem->stat->count[MEM_CGROUP_STAT_PGPGOUT_COUNT]); | 616 | __this_cpu_inc(mem->stat->count[MEM_CGROUP_STAT_PGPGOUT_COUNT]); |
617 | nr_pages = -nr_pages; /* for event */ | ||
618 | } | ||
617 | 619 | ||
618 | __this_cpu_add(mem->stat->count[MEM_CGROUP_EVENTS], nr_pages); | 620 | __this_cpu_add(mem->stat->count[MEM_CGROUP_EVENTS], nr_pages); |
619 | 621 | ||
@@ -1111,6 +1113,23 @@ static bool mem_cgroup_check_under_limit(struct mem_cgroup *mem) | |||
1111 | return false; | 1113 | return false; |
1112 | } | 1114 | } |
1113 | 1115 | ||
1116 | /** | ||
1117 | * mem_cgroup_check_margin - check if the memory cgroup allows charging | ||
1118 | * @mem: memory cgroup to check | ||
1119 | * @bytes: the number of bytes the caller intends to charge | ||
1120 | * | ||
1121 | * Returns a boolean value on whether @mem can be charged @bytes or | ||
1122 | * whether this would exceed the limit. | ||
1123 | */ | ||
1124 | static bool mem_cgroup_check_margin(struct mem_cgroup *mem, unsigned long bytes) | ||
1125 | { | ||
1126 | if (!res_counter_check_margin(&mem->res, bytes)) | ||
1127 | return false; | ||
1128 | if (do_swap_account && !res_counter_check_margin(&mem->memsw, bytes)) | ||
1129 | return false; | ||
1130 | return true; | ||
1131 | } | ||
1132 | |||
1114 | static unsigned int get_swappiness(struct mem_cgroup *memcg) | 1133 | static unsigned int get_swappiness(struct mem_cgroup *memcg) |
1115 | { | 1134 | { |
1116 | struct cgroup *cgrp = memcg->css.cgroup; | 1135 | struct cgroup *cgrp = memcg->css.cgroup; |
@@ -1837,23 +1856,34 @@ static int __mem_cgroup_do_charge(struct mem_cgroup *mem, gfp_t gfp_mask, | |||
1837 | flags |= MEM_CGROUP_RECLAIM_NOSWAP; | 1856 | flags |= MEM_CGROUP_RECLAIM_NOSWAP; |
1838 | } else | 1857 | } else |
1839 | mem_over_limit = mem_cgroup_from_res_counter(fail_res, res); | 1858 | mem_over_limit = mem_cgroup_from_res_counter(fail_res, res); |
1840 | 1859 | /* | |
1841 | if (csize > PAGE_SIZE) /* change csize and retry */ | 1860 | * csize can be either a huge page (HPAGE_SIZE), a batch of |
1861 | * regular pages (CHARGE_SIZE), or a single regular page | ||
1862 | * (PAGE_SIZE). | ||
1863 | * | ||
1864 | * Never reclaim on behalf of optional batching, retry with a | ||
1865 | * single page instead. | ||
1866 | */ | ||
1867 | if (csize == CHARGE_SIZE) | ||
1842 | return CHARGE_RETRY; | 1868 | return CHARGE_RETRY; |
1843 | 1869 | ||
1844 | if (!(gfp_mask & __GFP_WAIT)) | 1870 | if (!(gfp_mask & __GFP_WAIT)) |
1845 | return CHARGE_WOULDBLOCK; | 1871 | return CHARGE_WOULDBLOCK; |
1846 | 1872 | ||
1847 | ret = mem_cgroup_hierarchical_reclaim(mem_over_limit, NULL, | 1873 | ret = mem_cgroup_hierarchical_reclaim(mem_over_limit, NULL, |
1848 | gfp_mask, flags); | 1874 | gfp_mask, flags); |
1875 | if (mem_cgroup_check_margin(mem_over_limit, csize)) | ||
1876 | return CHARGE_RETRY; | ||
1849 | /* | 1877 | /* |
1850 | * try_to_free_mem_cgroup_pages() might not give us a full | 1878 | * Even though the limit is exceeded at this point, reclaim |
1851 | * picture of reclaim. Some pages are reclaimed and might be | 1879 | * may have been able to free some pages. Retry the charge |
1852 | * moved to swap cache or just unmapped from the cgroup. | 1880 | * before killing the task. |
1853 | * Check the limit again to see if the reclaim reduced the | 1881 | * |
1854 | * current usage of the cgroup before giving up | 1882 | * Only for regular pages, though: huge pages are rather |
1883 | * unlikely to succeed so close to the limit, and we fall back | ||
1884 | * to regular pages anyway in case of failure. | ||
1855 | */ | 1885 | */ |
1856 | if (ret || mem_cgroup_check_under_limit(mem_over_limit)) | 1886 | if (csize == PAGE_SIZE && ret) |
1857 | return CHARGE_RETRY; | 1887 | return CHARGE_RETRY; |
1858 | 1888 | ||
1859 | /* | 1889 | /* |
@@ -2323,13 +2353,19 @@ static int mem_cgroup_charge_common(struct page *page, struct mm_struct *mm, | |||
2323 | gfp_t gfp_mask, enum charge_type ctype) | 2353 | gfp_t gfp_mask, enum charge_type ctype) |
2324 | { | 2354 | { |
2325 | struct mem_cgroup *mem = NULL; | 2355 | struct mem_cgroup *mem = NULL; |
2356 | int page_size = PAGE_SIZE; | ||
2326 | struct page_cgroup *pc; | 2357 | struct page_cgroup *pc; |
2358 | bool oom = true; | ||
2327 | int ret; | 2359 | int ret; |
2328 | int page_size = PAGE_SIZE; | ||
2329 | 2360 | ||
2330 | if (PageTransHuge(page)) { | 2361 | if (PageTransHuge(page)) { |
2331 | page_size <<= compound_order(page); | 2362 | page_size <<= compound_order(page); |
2332 | VM_BUG_ON(!PageTransHuge(page)); | 2363 | VM_BUG_ON(!PageTransHuge(page)); |
2364 | /* | ||
2365 | * Never OOM-kill a process for a huge page. The | ||
2366 | * fault handler will fall back to regular pages. | ||
2367 | */ | ||
2368 | oom = false; | ||
2333 | } | 2369 | } |
2334 | 2370 | ||
2335 | pc = lookup_page_cgroup(page); | 2371 | pc = lookup_page_cgroup(page); |
@@ -2338,7 +2374,7 @@ static int mem_cgroup_charge_common(struct page *page, struct mm_struct *mm, | |||
2338 | return 0; | 2374 | return 0; |
2339 | prefetchw(pc); | 2375 | prefetchw(pc); |
2340 | 2376 | ||
2341 | ret = __mem_cgroup_try_charge(mm, gfp_mask, &mem, true, page_size); | 2377 | ret = __mem_cgroup_try_charge(mm, gfp_mask, &mem, oom, page_size); |
2342 | if (ret || !mem) | 2378 | if (ret || !mem) |
2343 | return ret; | 2379 | return ret; |
2344 | 2380 | ||
@@ -5024,9 +5060,9 @@ struct cgroup_subsys mem_cgroup_subsys = { | |||
5024 | static int __init enable_swap_account(char *s) | 5060 | static int __init enable_swap_account(char *s) |
5025 | { | 5061 | { |
5026 | /* consider enabled if no parameter or 1 is given */ | 5062 | /* consider enabled if no parameter or 1 is given */ |
5027 | if (!s || !strcmp(s, "1")) | 5063 | if (!(*s) || !strcmp(s, "=1")) |
5028 | really_do_swap_account = 1; | 5064 | really_do_swap_account = 1; |
5029 | else if (!strcmp(s, "0")) | 5065 | else if (!strcmp(s, "=0")) |
5030 | really_do_swap_account = 0; | 5066 | really_do_swap_account = 0; |
5031 | return 1; | 5067 | return 1; |
5032 | } | 5068 | } |
@@ -5034,7 +5070,8 @@ __setup("swapaccount", enable_swap_account); | |||
5034 | 5070 | ||
5035 | static int __init disable_swap_account(char *s) | 5071 | static int __init disable_swap_account(char *s) |
5036 | { | 5072 | { |
5037 | enable_swap_account("0"); | 5073 | printk_once("noswapaccount is deprecated and will be removed in 2.6.40. Use swapaccount=0 instead\n"); |
5074 | enable_swap_account("=0"); | ||
5038 | return 1; | 5075 | return 1; |
5039 | } | 5076 | } |
5040 | __setup("noswapaccount", disable_swap_account); | 5077 | __setup("noswapaccount", disable_swap_account); |
diff --git a/mm/memory-failure.c b/mm/memory-failure.c index 548fbd70f026..0207c2f6f8bd 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c | |||
@@ -233,8 +233,8 @@ void shake_page(struct page *p, int access) | |||
233 | } | 233 | } |
234 | 234 | ||
235 | /* | 235 | /* |
236 | * Only all shrink_slab here (which would also | 236 | * Only call shrink_slab here (which would also shrink other caches) if |
237 | * shrink other caches) if access is not potentially fatal. | 237 | * access is not potentially fatal. |
238 | */ | 238 | */ |
239 | if (access) { | 239 | if (access) { |
240 | int nr; | 240 | int nr; |
@@ -386,8 +386,6 @@ static void collect_procs_anon(struct page *page, struct list_head *to_kill, | |||
386 | struct task_struct *tsk; | 386 | struct task_struct *tsk; |
387 | struct anon_vma *av; | 387 | struct anon_vma *av; |
388 | 388 | ||
389 | if (!PageHuge(page) && unlikely(split_huge_page(page))) | ||
390 | return; | ||
391 | read_lock(&tasklist_lock); | 389 | read_lock(&tasklist_lock); |
392 | av = page_lock_anon_vma(page); | 390 | av = page_lock_anon_vma(page); |
393 | if (av == NULL) /* Not actually mapped anymore */ | 391 | if (av == NULL) /* Not actually mapped anymore */ |
@@ -856,6 +854,7 @@ static int hwpoison_user_mappings(struct page *p, unsigned long pfn, | |||
856 | int ret; | 854 | int ret; |
857 | int kill = 1; | 855 | int kill = 1; |
858 | struct page *hpage = compound_head(p); | 856 | struct page *hpage = compound_head(p); |
857 | struct page *ppage; | ||
859 | 858 | ||
860 | if (PageReserved(p) || PageSlab(p)) | 859 | if (PageReserved(p) || PageSlab(p)) |
861 | return SWAP_SUCCESS; | 860 | return SWAP_SUCCESS; |
@@ -897,6 +896,44 @@ static int hwpoison_user_mappings(struct page *p, unsigned long pfn, | |||
897 | } | 896 | } |
898 | 897 | ||
899 | /* | 898 | /* |
899 | * ppage: poisoned page | ||
900 | * if p is regular page(4k page) | ||
901 | * ppage == real poisoned page; | ||
902 | * else p is hugetlb or THP, ppage == head page. | ||
903 | */ | ||
904 | ppage = hpage; | ||
905 | |||
906 | if (PageTransHuge(hpage)) { | ||
907 | /* | ||
908 | * Verify that this isn't a hugetlbfs head page, the check for | ||
909 | * PageAnon is just for avoid tripping a split_huge_page | ||
910 | * internal debug check, as split_huge_page refuses to deal with | ||
911 | * anything that isn't an anon page. PageAnon can't go away fro | ||
912 | * under us because we hold a refcount on the hpage, without a | ||
913 | * refcount on the hpage. split_huge_page can't be safely called | ||
914 | * in the first place, having a refcount on the tail isn't | ||
915 | * enough * to be safe. | ||
916 | */ | ||
917 | if (!PageHuge(hpage) && PageAnon(hpage)) { | ||
918 | if (unlikely(split_huge_page(hpage))) { | ||
919 | /* | ||
920 | * FIXME: if splitting THP is failed, it is | ||
921 | * better to stop the following operation rather | ||
922 | * than causing panic by unmapping. System might | ||
923 | * survive if the page is freed later. | ||
924 | */ | ||
925 | printk(KERN_INFO | ||
926 | "MCE %#lx: failed to split THP\n", pfn); | ||
927 | |||
928 | BUG_ON(!PageHWPoison(p)); | ||
929 | return SWAP_FAIL; | ||
930 | } | ||
931 | /* THP is split, so ppage should be the real poisoned page. */ | ||
932 | ppage = p; | ||
933 | } | ||
934 | } | ||
935 | |||
936 | /* | ||
900 | * First collect all the processes that have the page | 937 | * First collect all the processes that have the page |
901 | * mapped in dirty form. This has to be done before try_to_unmap, | 938 | * mapped in dirty form. This has to be done before try_to_unmap, |
902 | * because ttu takes the rmap data structures down. | 939 | * because ttu takes the rmap data structures down. |
@@ -905,12 +942,18 @@ static int hwpoison_user_mappings(struct page *p, unsigned long pfn, | |||
905 | * there's nothing that can be done. | 942 | * there's nothing that can be done. |
906 | */ | 943 | */ |
907 | if (kill) | 944 | if (kill) |
908 | collect_procs(hpage, &tokill); | 945 | collect_procs(ppage, &tokill); |
946 | |||
947 | if (hpage != ppage) | ||
948 | lock_page_nosync(ppage); | ||
909 | 949 | ||
910 | ret = try_to_unmap(hpage, ttu); | 950 | ret = try_to_unmap(ppage, ttu); |
911 | if (ret != SWAP_SUCCESS) | 951 | if (ret != SWAP_SUCCESS) |
912 | printk(KERN_ERR "MCE %#lx: failed to unmap page (mapcount=%d)\n", | 952 | printk(KERN_ERR "MCE %#lx: failed to unmap page (mapcount=%d)\n", |
913 | pfn, page_mapcount(hpage)); | 953 | pfn, page_mapcount(ppage)); |
954 | |||
955 | if (hpage != ppage) | ||
956 | unlock_page(ppage); | ||
914 | 957 | ||
915 | /* | 958 | /* |
916 | * Now that the dirty bit has been propagated to the | 959 | * Now that the dirty bit has been propagated to the |
@@ -921,7 +964,7 @@ static int hwpoison_user_mappings(struct page *p, unsigned long pfn, | |||
921 | * use a more force-full uncatchable kill to prevent | 964 | * use a more force-full uncatchable kill to prevent |
922 | * any accesses to the poisoned memory. | 965 | * any accesses to the poisoned memory. |
923 | */ | 966 | */ |
924 | kill_procs_ao(&tokill, !!PageDirty(hpage), trapno, | 967 | kill_procs_ao(&tokill, !!PageDirty(ppage), trapno, |
925 | ret != SWAP_SUCCESS, p, pfn); | 968 | ret != SWAP_SUCCESS, p, pfn); |
926 | 969 | ||
927 | return ret; | 970 | return ret; |
@@ -1022,19 +1065,22 @@ int __memory_failure(unsigned long pfn, int trapno, int flags) | |||
1022 | * The check (unnecessarily) ignores LRU pages being isolated and | 1065 | * The check (unnecessarily) ignores LRU pages being isolated and |
1023 | * walked by the page reclaim code, however that's not a big loss. | 1066 | * walked by the page reclaim code, however that's not a big loss. |
1024 | */ | 1067 | */ |
1025 | if (!PageLRU(p) && !PageHuge(p)) | 1068 | if (!PageHuge(p) && !PageTransCompound(p)) { |
1026 | shake_page(p, 0); | 1069 | if (!PageLRU(p)) |
1027 | if (!PageLRU(p) && !PageHuge(p)) { | 1070 | shake_page(p, 0); |
1028 | /* | 1071 | if (!PageLRU(p)) { |
1029 | * shake_page could have turned it free. | 1072 | /* |
1030 | */ | 1073 | * shake_page could have turned it free. |
1031 | if (is_free_buddy_page(p)) { | 1074 | */ |
1032 | action_result(pfn, "free buddy, 2nd try", DELAYED); | 1075 | if (is_free_buddy_page(p)) { |
1033 | return 0; | 1076 | action_result(pfn, "free buddy, 2nd try", |
1077 | DELAYED); | ||
1078 | return 0; | ||
1079 | } | ||
1080 | action_result(pfn, "non LRU", IGNORED); | ||
1081 | put_page(p); | ||
1082 | return -EBUSY; | ||
1034 | } | 1083 | } |
1035 | action_result(pfn, "non LRU", IGNORED); | ||
1036 | put_page(p); | ||
1037 | return -EBUSY; | ||
1038 | } | 1084 | } |
1039 | 1085 | ||
1040 | /* | 1086 | /* |
@@ -1064,7 +1110,7 @@ int __memory_failure(unsigned long pfn, int trapno, int flags) | |||
1064 | * For error on the tail page, we should set PG_hwpoison | 1110 | * For error on the tail page, we should set PG_hwpoison |
1065 | * on the head page to show that the hugepage is hwpoisoned | 1111 | * on the head page to show that the hugepage is hwpoisoned |
1066 | */ | 1112 | */ |
1067 | if (PageTail(p) && TestSetPageHWPoison(hpage)) { | 1113 | if (PageHuge(p) && PageTail(p) && TestSetPageHWPoison(hpage)) { |
1068 | action_result(pfn, "hugepage already hardware poisoned", | 1114 | action_result(pfn, "hugepage already hardware poisoned", |
1069 | IGNORED); | 1115 | IGNORED); |
1070 | unlock_page(hpage); | 1116 | unlock_page(hpage); |
@@ -1295,7 +1341,10 @@ static int soft_offline_huge_page(struct page *page, int flags) | |||
1295 | ret = migrate_huge_pages(&pagelist, new_page, MPOL_MF_MOVE_ALL, 0, | 1341 | ret = migrate_huge_pages(&pagelist, new_page, MPOL_MF_MOVE_ALL, 0, |
1296 | true); | 1342 | true); |
1297 | if (ret) { | 1343 | if (ret) { |
1298 | putback_lru_pages(&pagelist); | 1344 | struct page *page1, *page2; |
1345 | list_for_each_entry_safe(page1, page2, &pagelist, lru) | ||
1346 | put_page(page1); | ||
1347 | |||
1299 | pr_debug("soft offline: %#lx: migration failed %d, type %lx\n", | 1348 | pr_debug("soft offline: %#lx: migration failed %d, type %lx\n", |
1300 | pfn, ret, page->flags); | 1349 | pfn, ret, page->flags); |
1301 | if (ret > 0) | 1350 | if (ret > 0) |
@@ -1419,6 +1468,7 @@ int soft_offline_page(struct page *page, int flags) | |||
1419 | ret = migrate_pages(&pagelist, new_page, MPOL_MF_MOVE_ALL, | 1468 | ret = migrate_pages(&pagelist, new_page, MPOL_MF_MOVE_ALL, |
1420 | 0, true); | 1469 | 0, true); |
1421 | if (ret) { | 1470 | if (ret) { |
1471 | putback_lru_pages(&pagelist); | ||
1422 | pr_info("soft offline: %#lx: migration failed %d, type %lx\n", | 1472 | pr_info("soft offline: %#lx: migration failed %d, type %lx\n", |
1423 | pfn, ret, page->flags); | 1473 | pfn, ret, page->flags); |
1424 | if (ret > 0) | 1474 | if (ret > 0) |
diff --git a/mm/migrate.c b/mm/migrate.c index 9f29a3b7aac2..766115253807 100644 --- a/mm/migrate.c +++ b/mm/migrate.c | |||
@@ -772,6 +772,7 @@ uncharge: | |||
772 | unlock: | 772 | unlock: |
773 | unlock_page(page); | 773 | unlock_page(page); |
774 | 774 | ||
775 | move_newpage: | ||
775 | if (rc != -EAGAIN) { | 776 | if (rc != -EAGAIN) { |
776 | /* | 777 | /* |
777 | * A page that has been migrated has all references | 778 | * A page that has been migrated has all references |
@@ -785,8 +786,6 @@ unlock: | |||
785 | putback_lru_page(page); | 786 | putback_lru_page(page); |
786 | } | 787 | } |
787 | 788 | ||
788 | move_newpage: | ||
789 | |||
790 | /* | 789 | /* |
791 | * Move the new page to the LRU. If migration was not successful | 790 | * Move the new page to the LRU. If migration was not successful |
792 | * then this will free the page. | 791 | * then this will free the page. |
@@ -981,10 +980,6 @@ int migrate_huge_pages(struct list_head *from, | |||
981 | } | 980 | } |
982 | rc = 0; | 981 | rc = 0; |
983 | out: | 982 | out: |
984 | |||
985 | list_for_each_entry_safe(page, page2, from, lru) | ||
986 | put_page(page); | ||
987 | |||
988 | if (rc) | 983 | if (rc) |
989 | return rc; | 984 | return rc; |
990 | 985 | ||
diff --git a/mm/mlock.c b/mm/mlock.c index 13e81ee8be9d..c3924c7f00be 100644 --- a/mm/mlock.c +++ b/mm/mlock.c | |||
@@ -178,6 +178,13 @@ static long __mlock_vma_pages_range(struct vm_area_struct *vma, | |||
178 | if ((vma->vm_flags & (VM_WRITE | VM_SHARED)) == VM_WRITE) | 178 | if ((vma->vm_flags & (VM_WRITE | VM_SHARED)) == VM_WRITE) |
179 | gup_flags |= FOLL_WRITE; | 179 | gup_flags |= FOLL_WRITE; |
180 | 180 | ||
181 | /* | ||
182 | * We want mlock to succeed for regions that have any permissions | ||
183 | * other than PROT_NONE. | ||
184 | */ | ||
185 | if (vma->vm_flags & (VM_READ | VM_WRITE | VM_EXEC)) | ||
186 | gup_flags |= FOLL_FORCE; | ||
187 | |||
181 | if (vma->vm_flags & VM_LOCKED) | 188 | if (vma->vm_flags & VM_LOCKED) |
182 | gup_flags |= FOLL_MLOCK; | 189 | gup_flags |= FOLL_MLOCK; |
183 | 190 | ||
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c index 7bd3bbba4710..d802e941d365 100644 --- a/net/sunrpc/svcsock.c +++ b/net/sunrpc/svcsock.c | |||
@@ -1609,9 +1609,7 @@ static struct svc_xprt *svc_bc_create_socket(struct svc_serv *serv, | |||
1609 | */ | 1609 | */ |
1610 | static void svc_bc_sock_free(struct svc_xprt *xprt) | 1610 | static void svc_bc_sock_free(struct svc_xprt *xprt) |
1611 | { | 1611 | { |
1612 | if (xprt) { | 1612 | if (xprt) |
1613 | kfree(xprt->xpt_bc_sid); | ||
1614 | kfree(container_of(xprt, struct svc_sock, sk_xprt)); | 1613 | kfree(container_of(xprt, struct svc_sock, sk_xprt)); |
1615 | } | ||
1616 | } | 1614 | } |
1617 | #endif /* CONFIG_NFS_V4_1 */ | 1615 | #endif /* CONFIG_NFS_V4_1 */ |