diff options
97 files changed, 1097 insertions, 701 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index c2238cd474c7..4c33ca82f9b1 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
| @@ -729,14 +729,26 @@ config ARCH_U8500 | |||
| 729 | 729 | ||
| 730 | endchoice | 730 | endchoice |
| 731 | 731 | ||
| 732 | source "arch/arm/mach-aaec2000/Kconfig" | ||
| 733 | |||
| 734 | source "arch/arm/mach-at91/Kconfig" | ||
| 735 | |||
| 736 | source "arch/arm/mach-bcmring/Kconfig" | ||
| 737 | |||
| 732 | source "arch/arm/mach-clps711x/Kconfig" | 738 | source "arch/arm/mach-clps711x/Kconfig" |
| 733 | 739 | ||
| 740 | source "arch/arm/mach-davinci/Kconfig" | ||
| 741 | |||
| 742 | source "arch/arm/mach-dove/Kconfig" | ||
| 743 | |||
| 734 | source "arch/arm/mach-ep93xx/Kconfig" | 744 | source "arch/arm/mach-ep93xx/Kconfig" |
| 735 | 745 | ||
| 736 | source "arch/arm/mach-footbridge/Kconfig" | 746 | source "arch/arm/mach-footbridge/Kconfig" |
| 737 | 747 | ||
| 738 | source "arch/arm/mach-gemini/Kconfig" | 748 | source "arch/arm/mach-gemini/Kconfig" |
| 739 | 749 | ||
| 750 | source "arch/arm/mach-h720x/Kconfig" | ||
| 751 | |||
| 740 | source "arch/arm/mach-integrator/Kconfig" | 752 | source "arch/arm/mach-integrator/Kconfig" |
| 741 | 753 | ||
| 742 | source "arch/arm/mach-iop32x/Kconfig" | 754 | source "arch/arm/mach-iop32x/Kconfig" |
| @@ -751,16 +763,26 @@ source "arch/arm/mach-ixp2000/Kconfig" | |||
| 751 | 763 | ||
| 752 | source "arch/arm/mach-ixp23xx/Kconfig" | 764 | source "arch/arm/mach-ixp23xx/Kconfig" |
| 753 | 765 | ||
| 766 | source "arch/arm/mach-kirkwood/Kconfig" | ||
| 767 | |||
| 768 | source "arch/arm/mach-ks8695/Kconfig" | ||
| 769 | |||
| 770 | source "arch/arm/mach-lh7a40x/Kconfig" | ||
| 771 | |||
| 754 | source "arch/arm/mach-loki/Kconfig" | 772 | source "arch/arm/mach-loki/Kconfig" |
| 755 | 773 | ||
| 774 | source "arch/arm/mach-msm/Kconfig" | ||
| 775 | |||
| 756 | source "arch/arm/mach-mv78xx0/Kconfig" | 776 | source "arch/arm/mach-mv78xx0/Kconfig" |
| 757 | 777 | ||
| 758 | source "arch/arm/mach-pxa/Kconfig" | 778 | source "arch/arm/plat-mxc/Kconfig" |
| 759 | source "arch/arm/plat-pxa/Kconfig" | ||
| 760 | 779 | ||
| 761 | source "arch/arm/mach-mmp/Kconfig" | 780 | source "arch/arm/mach-netx/Kconfig" |
| 762 | 781 | ||
| 763 | source "arch/arm/mach-sa1100/Kconfig" | 782 | source "arch/arm/mach-nomadik/Kconfig" |
| 783 | source "arch/arm/plat-nomadik/Kconfig" | ||
| 784 | |||
| 785 | source "arch/arm/mach-ns9xxx/Kconfig" | ||
| 764 | 786 | ||
| 765 | source "arch/arm/plat-omap/Kconfig" | 787 | source "arch/arm/plat-omap/Kconfig" |
| 766 | 788 | ||
| @@ -770,9 +792,14 @@ source "arch/arm/mach-omap2/Kconfig" | |||
| 770 | 792 | ||
| 771 | source "arch/arm/mach-orion5x/Kconfig" | 793 | source "arch/arm/mach-orion5x/Kconfig" |
| 772 | 794 | ||
| 773 | source "arch/arm/mach-kirkwood/Kconfig" | 795 | source "arch/arm/mach-pxa/Kconfig" |
| 796 | source "arch/arm/plat-pxa/Kconfig" | ||
| 774 | 797 | ||
| 775 | source "arch/arm/mach-dove/Kconfig" | 798 | source "arch/arm/mach-mmp/Kconfig" |
| 799 | |||
| 800 | source "arch/arm/mach-realview/Kconfig" | ||
| 801 | |||
| 802 | source "arch/arm/mach-sa1100/Kconfig" | ||
| 776 | 803 | ||
| 777 | source "arch/arm/plat-samsung/Kconfig" | 804 | source "arch/arm/plat-samsung/Kconfig" |
| 778 | source "arch/arm/plat-s3c24xx/Kconfig" | 805 | source "arch/arm/plat-s3c24xx/Kconfig" |
| @@ -800,41 +827,14 @@ if ARCH_S5PC1XX | |||
| 800 | source "arch/arm/mach-s5pc100/Kconfig" | 827 | source "arch/arm/mach-s5pc100/Kconfig" |
| 801 | endif | 828 | endif |
| 802 | 829 | ||
| 803 | source "arch/arm/mach-lh7a40x/Kconfig" | 830 | source "arch/arm/mach-u300/Kconfig" |
| 804 | 831 | ||
| 805 | source "arch/arm/mach-h720x/Kconfig" | 832 | source "arch/arm/mach-ux500/Kconfig" |
| 806 | 833 | ||
| 807 | source "arch/arm/mach-versatile/Kconfig" | 834 | source "arch/arm/mach-versatile/Kconfig" |
| 808 | 835 | ||
| 809 | source "arch/arm/mach-aaec2000/Kconfig" | ||
| 810 | |||
| 811 | source "arch/arm/mach-realview/Kconfig" | ||
| 812 | |||
| 813 | source "arch/arm/mach-at91/Kconfig" | ||
| 814 | |||
| 815 | source "arch/arm/plat-mxc/Kconfig" | ||
| 816 | |||
| 817 | source "arch/arm/mach-nomadik/Kconfig" | ||
| 818 | source "arch/arm/plat-nomadik/Kconfig" | ||
| 819 | |||
| 820 | source "arch/arm/mach-netx/Kconfig" | ||
| 821 | |||
| 822 | source "arch/arm/mach-ns9xxx/Kconfig" | ||
| 823 | |||
| 824 | source "arch/arm/mach-davinci/Kconfig" | ||
| 825 | |||
| 826 | source "arch/arm/mach-ks8695/Kconfig" | ||
| 827 | |||
| 828 | source "arch/arm/mach-msm/Kconfig" | ||
| 829 | |||
| 830 | source "arch/arm/mach-u300/Kconfig" | ||
| 831 | |||
| 832 | source "arch/arm/mach-w90x900/Kconfig" | 836 | source "arch/arm/mach-w90x900/Kconfig" |
| 833 | 837 | ||
| 834 | source "arch/arm/mach-bcmring/Kconfig" | ||
| 835 | |||
| 836 | source "arch/arm/mach-ux500/Kconfig" | ||
| 837 | |||
| 838 | # Definitions to make life easier | 838 | # Definitions to make life easier |
| 839 | config ARCH_ACORN | 839 | config ARCH_ACORN |
| 840 | bool | 840 | bool |
diff --git a/arch/arm/Makefile b/arch/arm/Makefile index e9da08483b3c..9e7582572741 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile | |||
| @@ -146,6 +146,7 @@ machine-$(CONFIG_ARCH_MX1) := mx1 | |||
| 146 | machine-$(CONFIG_ARCH_MX2) := mx2 | 146 | machine-$(CONFIG_ARCH_MX2) := mx2 |
| 147 | machine-$(CONFIG_ARCH_MX25) := mx25 | 147 | machine-$(CONFIG_ARCH_MX25) := mx25 |
| 148 | machine-$(CONFIG_ARCH_MX3) := mx3 | 148 | machine-$(CONFIG_ARCH_MX3) := mx3 |
| 149 | machine-$(CONFIG_ARCH_MXC91231) := mxc91231 | ||
| 149 | machine-$(CONFIG_ARCH_NETX) := netx | 150 | machine-$(CONFIG_ARCH_NETX) := netx |
| 150 | machine-$(CONFIG_ARCH_NOMADIK) := nomadik | 151 | machine-$(CONFIG_ARCH_NOMADIK) := nomadik |
| 151 | machine-$(CONFIG_ARCH_NS9XXX) := ns9xxx | 152 | machine-$(CONFIG_ARCH_NS9XXX) := ns9xxx |
| @@ -171,12 +172,12 @@ machine-$(CONFIG_ARCH_U8500) := ux500 | |||
| 171 | machine-$(CONFIG_ARCH_VERSATILE) := versatile | 172 | machine-$(CONFIG_ARCH_VERSATILE) := versatile |
| 172 | machine-$(CONFIG_ARCH_W90X900) := w90x900 | 173 | machine-$(CONFIG_ARCH_W90X900) := w90x900 |
| 173 | machine-$(CONFIG_FOOTBRIDGE) := footbridge | 174 | machine-$(CONFIG_FOOTBRIDGE) := footbridge |
| 174 | machine-$(CONFIG_ARCH_MXC91231) := mxc91231 | ||
| 175 | 175 | ||
| 176 | # Platform directory name. This list is sorted alphanumerically | 176 | # Platform directory name. This list is sorted alphanumerically |
| 177 | # by CONFIG_* macro name. | 177 | # by CONFIG_* macro name. |
| 178 | plat-$(CONFIG_ARCH_MXC) := mxc | 178 | plat-$(CONFIG_ARCH_MXC) := mxc |
| 179 | plat-$(CONFIG_ARCH_OMAP) := omap | 179 | plat-$(CONFIG_ARCH_OMAP) := omap |
| 180 | plat-$(CONFIG_ARCH_STMP3XXX) := stmp3xxx | ||
| 180 | plat-$(CONFIG_PLAT_IOP) := iop | 181 | plat-$(CONFIG_PLAT_IOP) := iop |
| 181 | plat-$(CONFIG_PLAT_NOMADIK) := nomadik | 182 | plat-$(CONFIG_PLAT_NOMADIK) := nomadik |
| 182 | plat-$(CONFIG_PLAT_ORION) := orion | 183 | plat-$(CONFIG_PLAT_ORION) := orion |
| @@ -184,7 +185,6 @@ plat-$(CONFIG_PLAT_PXA) := pxa | |||
| 184 | plat-$(CONFIG_PLAT_S3C24XX) := s3c24xx s3c samsung | 185 | plat-$(CONFIG_PLAT_S3C24XX) := s3c24xx s3c samsung |
| 185 | plat-$(CONFIG_PLAT_S3C64XX) := s3c64xx s3c samsung | 186 | plat-$(CONFIG_PLAT_S3C64XX) := s3c64xx s3c samsung |
| 186 | plat-$(CONFIG_PLAT_S5PC1XX) := s5pc1xx s3c samsung | 187 | plat-$(CONFIG_PLAT_S5PC1XX) := s5pc1xx s3c samsung |
| 187 | plat-$(CONFIG_ARCH_STMP3XXX) := stmp3xxx | ||
| 188 | 188 | ||
| 189 | ifeq ($(CONFIG_ARCH_EBSA110),y) | 189 | ifeq ($(CONFIG_ARCH_EBSA110),y) |
| 190 | # This is what happens if you forget the IOCS16 line. | 190 | # This is what happens if you forget the IOCS16 line. |
diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S index d356af7cef82..4fddc509e78e 100644 --- a/arch/arm/boot/compressed/head.S +++ b/arch/arm/boot/compressed/head.S | |||
| @@ -27,6 +27,14 @@ | |||
| 27 | .macro writeb, ch, rb | 27 | .macro writeb, ch, rb |
| 28 | mcr p14, 0, \ch, c0, c5, 0 | 28 | mcr p14, 0, \ch, c0, c5, 0 |
| 29 | .endm | 29 | .endm |
| 30 | #elif defined(CONFIG_CPU_V7) | ||
| 31 | .macro loadsp, rb | ||
| 32 | .endm | ||
| 33 | .macro writeb, ch, rb | ||
| 34 | wait: mrc p14, 0, pc, c0, c1, 0 | ||
| 35 | bcs wait | ||
| 36 | mcr p14, 0, \ch, c0, c5, 0 | ||
| 37 | .endm | ||
| 30 | #elif defined(CONFIG_CPU_XSCALE) | 38 | #elif defined(CONFIG_CPU_XSCALE) |
| 31 | .macro loadsp, rb | 39 | .macro loadsp, rb |
| 32 | .endm | 40 | .endm |
diff --git a/arch/arm/boot/compressed/misc.c b/arch/arm/boot/compressed/misc.c index 7e0fe4d42c7b..56a0d116d271 100644 --- a/arch/arm/boot/compressed/misc.c +++ b/arch/arm/boot/compressed/misc.c | |||
| @@ -53,6 +53,18 @@ static void icedcc_putc(int ch) | |||
| 53 | 53 | ||
| 54 | asm("mcr p14, 0, %0, c0, c5, 0" : : "r" (ch)); | 54 | asm("mcr p14, 0, %0, c0, c5, 0" : : "r" (ch)); |
| 55 | } | 55 | } |
| 56 | |||
| 57 | #elif defined(CONFIG_CPU_V7) | ||
| 58 | |||
| 59 | static void icedcc_putc(int ch) | ||
| 60 | { | ||
| 61 | asm( | ||
| 62 | "wait: mrc p14, 0, pc, c0, c1, 0 \n\ | ||
| 63 | bcs wait \n\ | ||
| 64 | mcr p14, 0, %0, c0, c5, 0 " | ||
| 65 | : : "r" (ch)); | ||
| 66 | } | ||
| 67 | |||
| 56 | #elif defined(CONFIG_CPU_XSCALE) | 68 | #elif defined(CONFIG_CPU_XSCALE) |
| 57 | 69 | ||
| 58 | static void icedcc_putc(int ch) | 70 | static void icedcc_putc(int ch) |
| @@ -88,7 +100,6 @@ static void icedcc_putc(int ch) | |||
| 88 | #endif | 100 | #endif |
| 89 | 101 | ||
| 90 | #define putc(ch) icedcc_putc(ch) | 102 | #define putc(ch) icedcc_putc(ch) |
| 91 | #define flush() do { } while (0) | ||
| 92 | #endif | 103 | #endif |
| 93 | 104 | ||
| 94 | static void putstr(const char *ptr) | 105 | static void putstr(const char *ptr) |
diff --git a/arch/arm/include/asm/cacheflush.h b/arch/arm/include/asm/cacheflush.h index 730aefcfbee3..c77d2fa1f6e5 100644 --- a/arch/arm/include/asm/cacheflush.h +++ b/arch/arm/include/asm/cacheflush.h | |||
| @@ -154,16 +154,16 @@ | |||
| 154 | * Please note that the implementation of these, and the required | 154 | * Please note that the implementation of these, and the required |
| 155 | * effects are cache-type (VIVT/VIPT/PIPT) specific. | 155 | * effects are cache-type (VIVT/VIPT/PIPT) specific. |
| 156 | * | 156 | * |
| 157 | * flush_cache_kern_all() | 157 | * flush_kern_all() |
| 158 | * | 158 | * |
| 159 | * Unconditionally clean and invalidate the entire cache. | 159 | * Unconditionally clean and invalidate the entire cache. |
| 160 | * | 160 | * |
| 161 | * flush_cache_user_mm(mm) | 161 | * flush_user_all() |
| 162 | * | 162 | * |
| 163 | * Clean and invalidate all user space cache entries | 163 | * Clean and invalidate all user space cache entries |
| 164 | * before a change of page tables. | 164 | * before a change of page tables. |
| 165 | * | 165 | * |
| 166 | * flush_cache_user_range(start, end, flags) | 166 | * flush_user_range(start, end, flags) |
| 167 | * | 167 | * |
| 168 | * Clean and invalidate a range of cache entries in the | 168 | * Clean and invalidate a range of cache entries in the |
| 169 | * specified address space before a change of page tables. | 169 | * specified address space before a change of page tables. |
| @@ -179,6 +179,20 @@ | |||
| 179 | * - start - virtual start address | 179 | * - start - virtual start address |
| 180 | * - end - virtual end address | 180 | * - end - virtual end address |
| 181 | * | 181 | * |
| 182 | * coherent_user_range(start, end) | ||
| 183 | * | ||
| 184 | * Ensure coherency between the Icache and the Dcache in the | ||
| 185 | * region described by start, end. If you have non-snooping | ||
| 186 | * Harvard caches, you need to implement this function. | ||
| 187 | * - start - virtual start address | ||
| 188 | * - end - virtual end address | ||
| 189 | * | ||
| 190 | * flush_kern_dcache_area(kaddr, size) | ||
| 191 | * | ||
| 192 | * Ensure that the data held in page is written back. | ||
| 193 | * - kaddr - page address | ||
| 194 | * - size - region size | ||
| 195 | * | ||
| 182 | * DMA Cache Coherency | 196 | * DMA Cache Coherency |
| 183 | * =================== | 197 | * =================== |
| 184 | * | 198 | * |
diff --git a/arch/arm/kernel/debug.S b/arch/arm/kernel/debug.S index b121b6053cce..5c91addcaebc 100644 --- a/arch/arm/kernel/debug.S +++ b/arch/arm/kernel/debug.S | |||
| @@ -49,6 +49,26 @@ | |||
| 49 | 1002: | 49 | 1002: |
| 50 | .endm | 50 | .endm |
| 51 | 51 | ||
| 52 | #elif defined(CONFIG_CPU_V7) | ||
| 53 | |||
| 54 | .macro addruart, rx | ||
| 55 | .endm | ||
| 56 | |||
| 57 | .macro senduart, rd, rx | ||
| 58 | mcr p14, 0, \rd, c0, c5, 0 | ||
| 59 | .endm | ||
| 60 | |||
| 61 | .macro busyuart, rd, rx | ||
| 62 | busy: mrc p14, 0, pc, c0, c1, 0 | ||
| 63 | bcs busy | ||
| 64 | .endm | ||
| 65 | |||
| 66 | .macro waituart, rd, rx | ||
| 67 | wait: mrc p14, 0, pc, c0, c1, 0 | ||
| 68 | bcs wait | ||
| 69 | |||
| 70 | .endm | ||
| 71 | |||
| 52 | #elif defined(CONFIG_CPU_XSCALE) | 72 | #elif defined(CONFIG_CPU_XSCALE) |
| 53 | 73 | ||
| 54 | .macro addruart, rx | 74 | .macro addruart, rx |
diff --git a/arch/arm/kernel/elf.c b/arch/arm/kernel/elf.c index 950391f194c4..d4a0da1e48f4 100644 --- a/arch/arm/kernel/elf.c +++ b/arch/arm/kernel/elf.c | |||
| @@ -78,15 +78,6 @@ int arm_elf_read_implies_exec(const struct elf32_hdr *x, int executable_stack) | |||
| 78 | return 1; | 78 | return 1; |
| 79 | if (cpu_architecture() < CPU_ARCH_ARMv6) | 79 | if (cpu_architecture() < CPU_ARCH_ARMv6) |
| 80 | return 1; | 80 | return 1; |
| 81 | #if !defined(CONFIG_AEABI) || defined(CONFIG_OABI_COMPAT) | ||
| 82 | /* | ||
| 83 | * If we have support for OABI programs, we can never allow NX | ||
| 84 | * support - our signal syscall restart mechanism relies upon | ||
| 85 | * being able to execute code placed on the user stack. | ||
| 86 | */ | ||
| 87 | return 1; | ||
| 88 | #else | ||
| 89 | return 0; | 81 | return 0; |
| 90 | #endif | ||
| 91 | } | 82 | } |
| 92 | EXPORT_SYMBOL(arm_elf_read_implies_exec); | 83 | EXPORT_SYMBOL(arm_elf_read_implies_exec); |
diff --git a/arch/arm/mach-gemini/include/mach/uncompress.h b/arch/arm/mach-gemini/include/mach/uncompress.h index 59c5df7e716c..5483f61a8061 100644 --- a/arch/arm/mach-gemini/include/mach/uncompress.h +++ b/arch/arm/mach-gemini/include/mach/uncompress.h | |||
| @@ -30,7 +30,9 @@ static inline void putc(char c) | |||
| 30 | UART[UART_TX] = c; | 30 | UART[UART_TX] = c; |
| 31 | } | 31 | } |
| 32 | 32 | ||
| 33 | #define flush() do { } while (0) | 33 | static inline void flush(void) |
| 34 | { | ||
| 35 | } | ||
| 34 | 36 | ||
| 35 | /* | 37 | /* |
| 36 | * nothing to do | 38 | * nothing to do |
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index 1708da82da96..761ffede6a23 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c | |||
| @@ -1067,4 +1067,6 @@ void setup_mm_for_reboot(char mode) | |||
| 1067 | pmd[1] = __pmd(pmdval + (1 << (PGDIR_SHIFT - 1))); | 1067 | pmd[1] = __pmd(pmdval + (1 << (PGDIR_SHIFT - 1))); |
| 1068 | flush_pmd_entry(pmd); | 1068 | flush_pmd_entry(pmd); |
| 1069 | } | 1069 | } |
| 1070 | |||
| 1071 | local_flush_tlb_all(); | ||
| 1070 | } | 1072 | } |
diff --git a/arch/arm/mm/proc-v6.S b/arch/arm/mm/proc-v6.S index 395cc90c6613..7a5337ed7d68 100644 --- a/arch/arm/mm/proc-v6.S +++ b/arch/arm/mm/proc-v6.S | |||
| @@ -59,8 +59,6 @@ ENTRY(cpu_v6_proc_fin) | |||
| 59 | * to what would be the reset vector. | 59 | * to what would be the reset vector. |
| 60 | * | 60 | * |
| 61 | * - loc - location to jump to for soft reset | 61 | * - loc - location to jump to for soft reset |
| 62 | * | ||
| 63 | * It is assumed that: | ||
| 64 | */ | 62 | */ |
| 65 | .align 5 | 63 | .align 5 |
| 66 | ENTRY(cpu_v6_reset) | 64 | ENTRY(cpu_v6_reset) |
diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S index 3a285218fd15..7aaf88a3b7aa 100644 --- a/arch/arm/mm/proc-v7.S +++ b/arch/arm/mm/proc-v7.S | |||
| @@ -45,7 +45,14 @@ ENTRY(cpu_v7_proc_init) | |||
| 45 | ENDPROC(cpu_v7_proc_init) | 45 | ENDPROC(cpu_v7_proc_init) |
| 46 | 46 | ||
| 47 | ENTRY(cpu_v7_proc_fin) | 47 | ENTRY(cpu_v7_proc_fin) |
| 48 | mov pc, lr | 48 | stmfd sp!, {lr} |
| 49 | cpsid if @ disable interrupts | ||
| 50 | bl v7_flush_kern_cache_all | ||
| 51 | mrc p15, 0, r0, c1, c0, 0 @ ctrl register | ||
| 52 | bic r0, r0, #0x1000 @ ...i............ | ||
| 53 | bic r0, r0, #0x0006 @ .............ca. | ||
| 54 | mcr p15, 0, r0, c1, c0, 0 @ disable caches | ||
| 55 | ldmfd sp!, {pc} | ||
| 49 | ENDPROC(cpu_v7_proc_fin) | 56 | ENDPROC(cpu_v7_proc_fin) |
| 50 | 57 | ||
| 51 | /* | 58 | /* |
| @@ -56,8 +63,6 @@ ENDPROC(cpu_v7_proc_fin) | |||
| 56 | * to what would be the reset vector. | 63 | * to what would be the reset vector. |
| 57 | * | 64 | * |
| 58 | * - loc - location to jump to for soft reset | 65 | * - loc - location to jump to for soft reset |
| 59 | * | ||
| 60 | * It is assumed that: | ||
| 61 | */ | 66 | */ |
| 62 | .align 5 | 67 | .align 5 |
| 63 | ENTRY(cpu_v7_reset) | 68 | ENTRY(cpu_v7_reset) |
diff --git a/arch/arm/plat-mxc/include/mach/uncompress.h b/arch/arm/plat-mxc/include/mach/uncompress.h index 4d5d395ad63b..d49384cb1e97 100644 --- a/arch/arm/plat-mxc/include/mach/uncompress.h +++ b/arch/arm/plat-mxc/include/mach/uncompress.h | |||
| @@ -60,7 +60,9 @@ static void putc(int ch) | |||
| 60 | UART(TXR) = ch; | 60 | UART(TXR) = ch; |
| 61 | } | 61 | } |
| 62 | 62 | ||
| 63 | #define flush() do { } while (0) | 63 | static inline void flush(void) |
| 64 | { | ||
| 65 | } | ||
| 64 | 66 | ||
| 65 | #define MX1_UART1_BASE_ADDR 0x00206000 | 67 | #define MX1_UART1_BASE_ADDR 0x00206000 |
| 66 | #define MX25_UART1_BASE_ADDR 0x43f90000 | 68 | #define MX25_UART1_BASE_ADDR 0x43f90000 |
diff --git a/arch/sh/boards/mach-se/7724/setup.c b/arch/sh/boards/mach-se/7724/setup.c index 5d0f70b46c97..858ecb25d469 100644 --- a/arch/sh/boards/mach-se/7724/setup.c +++ b/arch/sh/boards/mach-se/7724/setup.c | |||
| @@ -533,7 +533,7 @@ static int __init sh_eth_is_eeprom_ready(void) | |||
| 533 | while (t--) { | 533 | while (t--) { |
| 534 | if (!ctrl_inw(EEPROM_STAT)) | 534 | if (!ctrl_inw(EEPROM_STAT)) |
| 535 | return 1; | 535 | return 1; |
| 536 | cpu_relax(); | 536 | udelay(1); |
| 537 | } | 537 | } |
| 538 | 538 | ||
| 539 | printk(KERN_ERR "ms7724se can not access to eeprom\n"); | 539 | printk(KERN_ERR "ms7724se can not access to eeprom\n"); |
diff --git a/arch/sh/include/asm/unistd_32.h b/arch/sh/include/asm/unistd_32.h index f18c4f9baf27..365744b05269 100644 --- a/arch/sh/include/asm/unistd_32.h +++ b/arch/sh/include/asm/unistd_32.h | |||
| @@ -345,12 +345,13 @@ | |||
| 345 | #define __NR_pwritev 334 | 345 | #define __NR_pwritev 334 |
| 346 | #define __NR_rt_tgsigqueueinfo 335 | 346 | #define __NR_rt_tgsigqueueinfo 335 |
| 347 | #define __NR_perf_event_open 336 | 347 | #define __NR_perf_event_open 336 |
| 348 | #define __NR_recvmmsg 337 | ||
| 349 | 348 | ||
| 350 | #define NR_syscalls 338 | 349 | #define NR_syscalls 337 |
| 351 | 350 | ||
| 352 | #ifdef __KERNEL__ | 351 | #ifdef __KERNEL__ |
| 353 | 352 | ||
| 353 | #define __IGNORE_recvmmsg | ||
| 354 | |||
| 354 | #define __ARCH_WANT_IPC_PARSE_VERSION | 355 | #define __ARCH_WANT_IPC_PARSE_VERSION |
| 355 | #define __ARCH_WANT_OLD_READDIR | 356 | #define __ARCH_WANT_OLD_READDIR |
| 356 | #define __ARCH_WANT_OLD_STAT | 357 | #define __ARCH_WANT_OLD_STAT |
diff --git a/arch/sh/include/asm/unistd_64.h b/arch/sh/include/asm/unistd_64.h index 3e7645d11130..25de158aac3a 100644 --- a/arch/sh/include/asm/unistd_64.h +++ b/arch/sh/include/asm/unistd_64.h | |||
| @@ -386,10 +386,11 @@ | |||
| 386 | #define __NR_rt_tgsigqueueinfo 363 | 386 | #define __NR_rt_tgsigqueueinfo 363 |
| 387 | #define __NR_perf_event_open 364 | 387 | #define __NR_perf_event_open 364 |
| 388 | #define __NR_recvmmsg 365 | 388 | #define __NR_recvmmsg 365 |
| 389 | #define __NR_accept4 366 | ||
| 389 | 390 | ||
| 390 | #ifdef __KERNEL__ | 391 | #ifdef __KERNEL__ |
| 391 | 392 | ||
| 392 | #define NR_syscalls 366 | 393 | #define NR_syscalls 367 |
| 393 | 394 | ||
| 394 | #define __ARCH_WANT_IPC_PARSE_VERSION | 395 | #define __ARCH_WANT_IPC_PARSE_VERSION |
| 395 | #define __ARCH_WANT_OLD_READDIR | 396 | #define __ARCH_WANT_OLD_READDIR |
diff --git a/arch/sh/kernel/syscalls_32.S b/arch/sh/kernel/syscalls_32.S index 4bd5a1146956..19fd11dd9871 100644 --- a/arch/sh/kernel/syscalls_32.S +++ b/arch/sh/kernel/syscalls_32.S | |||
| @@ -353,4 +353,3 @@ ENTRY(sys_call_table) | |||
| 353 | .long sys_pwritev | 353 | .long sys_pwritev |
| 354 | .long sys_rt_tgsigqueueinfo /* 335 */ | 354 | .long sys_rt_tgsigqueueinfo /* 335 */ |
| 355 | .long sys_perf_event_open | 355 | .long sys_perf_event_open |
| 356 | .long sys_recvmmsg | ||
diff --git a/arch/sh/kernel/syscalls_64.S b/arch/sh/kernel/syscalls_64.S index 07d2aaea9ae8..2048a20d7c80 100644 --- a/arch/sh/kernel/syscalls_64.S +++ b/arch/sh/kernel/syscalls_64.S | |||
| @@ -392,3 +392,4 @@ sys_call_table: | |||
| 392 | .long sys_rt_tgsigqueueinfo | 392 | .long sys_rt_tgsigqueueinfo |
| 393 | .long sys_perf_event_open | 393 | .long sys_perf_event_open |
| 394 | .long sys_recvmmsg /* 365 */ | 394 | .long sys_recvmmsg /* 365 */ |
| 395 | .long sys_accept4 | ||
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index fb1035cd9a6a..036d28adf59d 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c | |||
| @@ -1529,16 +1529,10 @@ static struct dmi_system_id __initdata acpi_dmi_table_late[] = { | |||
| 1529 | * if acpi_blacklisted() acpi_disabled = 1; | 1529 | * if acpi_blacklisted() acpi_disabled = 1; |
| 1530 | * acpi_irq_model=... | 1530 | * acpi_irq_model=... |
| 1531 | * ... | 1531 | * ... |
| 1532 | * | ||
| 1533 | * return value: (currently ignored) | ||
| 1534 | * 0: success | ||
| 1535 | * !0: failure | ||
| 1536 | */ | 1532 | */ |
| 1537 | 1533 | ||
| 1538 | int __init acpi_boot_table_init(void) | 1534 | void __init acpi_boot_table_init(void) |
| 1539 | { | 1535 | { |
| 1540 | int error; | ||
| 1541 | |||
| 1542 | dmi_check_system(acpi_dmi_table); | 1536 | dmi_check_system(acpi_dmi_table); |
| 1543 | 1537 | ||
| 1544 | /* | 1538 | /* |
| @@ -1546,15 +1540,14 @@ int __init acpi_boot_table_init(void) | |||
| 1546 | * One exception: acpi=ht continues far enough to enumerate LAPICs | 1540 | * One exception: acpi=ht continues far enough to enumerate LAPICs |
| 1547 | */ | 1541 | */ |
| 1548 | if (acpi_disabled && !acpi_ht) | 1542 | if (acpi_disabled && !acpi_ht) |
| 1549 | return 1; | 1543 | return; |
| 1550 | 1544 | ||
| 1551 | /* | 1545 | /* |
| 1552 | * Initialize the ACPI boot-time table parser. | 1546 | * Initialize the ACPI boot-time table parser. |
| 1553 | */ | 1547 | */ |
| 1554 | error = acpi_table_init(); | 1548 | if (acpi_table_init()) { |
| 1555 | if (error) { | ||
| 1556 | disable_acpi(); | 1549 | disable_acpi(); |
| 1557 | return error; | 1550 | return; |
| 1558 | } | 1551 | } |
| 1559 | 1552 | ||
| 1560 | acpi_table_parse(ACPI_SIG_BOOT, acpi_parse_sbf); | 1553 | acpi_table_parse(ACPI_SIG_BOOT, acpi_parse_sbf); |
| @@ -1562,18 +1555,15 @@ int __init acpi_boot_table_init(void) | |||
| 1562 | /* | 1555 | /* |
| 1563 | * blacklist may disable ACPI entirely | 1556 | * blacklist may disable ACPI entirely |
| 1564 | */ | 1557 | */ |
| 1565 | error = acpi_blacklisted(); | 1558 | if (acpi_blacklisted()) { |
| 1566 | if (error) { | ||
| 1567 | if (acpi_force) { | 1559 | if (acpi_force) { |
| 1568 | printk(KERN_WARNING PREFIX "acpi=force override\n"); | 1560 | printk(KERN_WARNING PREFIX "acpi=force override\n"); |
| 1569 | } else { | 1561 | } else { |
| 1570 | printk(KERN_WARNING PREFIX "Disabling ACPI support\n"); | 1562 | printk(KERN_WARNING PREFIX "Disabling ACPI support\n"); |
| 1571 | disable_acpi(); | 1563 | disable_acpi(); |
| 1572 | return error; | 1564 | return; |
| 1573 | } | 1565 | } |
| 1574 | } | 1566 | } |
| 1575 | |||
| 1576 | return 0; | ||
| 1577 | } | 1567 | } |
| 1578 | 1568 | ||
| 1579 | int __init early_acpi_boot_init(void) | 1569 | int __init early_acpi_boot_init(void) |
diff --git a/block/blk-ioc.c b/block/blk-ioc.c index cbdabb0dd6d7..98e6bf61b0ac 100644 --- a/block/blk-ioc.c +++ b/block/blk-ioc.c | |||
| @@ -39,8 +39,6 @@ int put_io_context(struct io_context *ioc) | |||
| 39 | 39 | ||
| 40 | if (atomic_long_dec_and_test(&ioc->refcount)) { | 40 | if (atomic_long_dec_and_test(&ioc->refcount)) { |
| 41 | rcu_read_lock(); | 41 | rcu_read_lock(); |
| 42 | if (ioc->aic && ioc->aic->dtor) | ||
| 43 | ioc->aic->dtor(ioc->aic); | ||
| 44 | cfq_dtor(ioc); | 42 | cfq_dtor(ioc); |
| 45 | rcu_read_unlock(); | 43 | rcu_read_unlock(); |
| 46 | 44 | ||
| @@ -76,8 +74,6 @@ void exit_io_context(struct task_struct *task) | |||
| 76 | task_unlock(task); | 74 | task_unlock(task); |
| 77 | 75 | ||
| 78 | if (atomic_dec_and_test(&ioc->nr_tasks)) { | 76 | if (atomic_dec_and_test(&ioc->nr_tasks)) { |
| 79 | if (ioc->aic && ioc->aic->exit) | ||
| 80 | ioc->aic->exit(ioc->aic); | ||
| 81 | cfq_exit(ioc); | 77 | cfq_exit(ioc); |
| 82 | 78 | ||
| 83 | } | 79 | } |
| @@ -97,7 +93,6 @@ struct io_context *alloc_io_context(gfp_t gfp_flags, int node) | |||
| 97 | ret->ioprio = 0; | 93 | ret->ioprio = 0; |
| 98 | ret->last_waited = jiffies; /* doesn't matter... */ | 94 | ret->last_waited = jiffies; /* doesn't matter... */ |
| 99 | ret->nr_batch_requests = 0; /* because this is 0 */ | 95 | ret->nr_batch_requests = 0; /* because this is 0 */ |
| 100 | ret->aic = NULL; | ||
| 101 | INIT_RADIX_TREE(&ret->radix_root, GFP_ATOMIC | __GFP_HIGH); | 96 | INIT_RADIX_TREE(&ret->radix_root, GFP_ATOMIC | __GFP_HIGH); |
| 102 | INIT_HLIST_HEAD(&ret->cic_list); | 97 | INIT_HLIST_HEAD(&ret->cic_list); |
| 103 | ret->ioc_data = NULL; | 98 | ret->ioc_data = NULL; |
diff --git a/block/blk-settings.c b/block/blk-settings.c index d52d4adc440b..5eeb9e0d256e 100644 --- a/block/blk-settings.c +++ b/block/blk-settings.c | |||
| @@ -528,7 +528,7 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, | |||
| 528 | sector_t offset) | 528 | sector_t offset) |
| 529 | { | 529 | { |
| 530 | sector_t alignment; | 530 | sector_t alignment; |
| 531 | unsigned int top, bottom; | 531 | unsigned int top, bottom, ret = 0; |
| 532 | 532 | ||
| 533 | t->max_sectors = min_not_zero(t->max_sectors, b->max_sectors); | 533 | t->max_sectors = min_not_zero(t->max_sectors, b->max_sectors); |
| 534 | t->max_hw_sectors = min_not_zero(t->max_hw_sectors, b->max_hw_sectors); | 534 | t->max_hw_sectors = min_not_zero(t->max_hw_sectors, b->max_hw_sectors); |
| @@ -546,6 +546,8 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, | |||
| 546 | t->max_segment_size = min_not_zero(t->max_segment_size, | 546 | t->max_segment_size = min_not_zero(t->max_segment_size, |
| 547 | b->max_segment_size); | 547 | b->max_segment_size); |
| 548 | 548 | ||
| 549 | t->misaligned |= b->misaligned; | ||
| 550 | |||
| 549 | alignment = queue_limit_alignment_offset(b, offset); | 551 | alignment = queue_limit_alignment_offset(b, offset); |
| 550 | 552 | ||
| 551 | /* Bottom device has different alignment. Check that it is | 553 | /* Bottom device has different alignment. Check that it is |
| @@ -558,8 +560,10 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, | |||
| 558 | bottom = max(b->physical_block_size, b->io_min) + alignment; | 560 | bottom = max(b->physical_block_size, b->io_min) + alignment; |
| 559 | 561 | ||
| 560 | /* Verify that top and bottom intervals line up */ | 562 | /* Verify that top and bottom intervals line up */ |
| 561 | if (max(top, bottom) & (min(top, bottom) - 1)) | 563 | if (max(top, bottom) & (min(top, bottom) - 1)) { |
| 562 | t->misaligned = 1; | 564 | t->misaligned = 1; |
| 565 | ret = -1; | ||
| 566 | } | ||
| 563 | } | 567 | } |
| 564 | 568 | ||
| 565 | t->logical_block_size = max(t->logical_block_size, | 569 | t->logical_block_size = max(t->logical_block_size, |
| @@ -578,18 +582,21 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, | |||
| 578 | if (t->physical_block_size & (t->logical_block_size - 1)) { | 582 | if (t->physical_block_size & (t->logical_block_size - 1)) { |
| 579 | t->physical_block_size = t->logical_block_size; | 583 | t->physical_block_size = t->logical_block_size; |
| 580 | t->misaligned = 1; | 584 | t->misaligned = 1; |
| 585 | ret = -1; | ||
| 581 | } | 586 | } |
| 582 | 587 | ||
| 583 | /* Minimum I/O a multiple of the physical block size? */ | 588 | /* Minimum I/O a multiple of the physical block size? */ |
| 584 | if (t->io_min & (t->physical_block_size - 1)) { | 589 | if (t->io_min & (t->physical_block_size - 1)) { |
| 585 | t->io_min = t->physical_block_size; | 590 | t->io_min = t->physical_block_size; |
| 586 | t->misaligned = 1; | 591 | t->misaligned = 1; |
| 592 | ret = -1; | ||
| 587 | } | 593 | } |
| 588 | 594 | ||
| 589 | /* Optimal I/O a multiple of the physical block size? */ | 595 | /* Optimal I/O a multiple of the physical block size? */ |
| 590 | if (t->io_opt & (t->physical_block_size - 1)) { | 596 | if (t->io_opt & (t->physical_block_size - 1)) { |
| 591 | t->io_opt = 0; | 597 | t->io_opt = 0; |
| 592 | t->misaligned = 1; | 598 | t->misaligned = 1; |
| 599 | ret = -1; | ||
| 593 | } | 600 | } |
| 594 | 601 | ||
| 595 | /* Find lowest common alignment_offset */ | 602 | /* Find lowest common alignment_offset */ |
| @@ -597,8 +604,10 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, | |||
| 597 | & (max(t->physical_block_size, t->io_min) - 1); | 604 | & (max(t->physical_block_size, t->io_min) - 1); |
| 598 | 605 | ||
| 599 | /* Verify that new alignment_offset is on a logical block boundary */ | 606 | /* Verify that new alignment_offset is on a logical block boundary */ |
| 600 | if (t->alignment_offset & (t->logical_block_size - 1)) | 607 | if (t->alignment_offset & (t->logical_block_size - 1)) { |
| 601 | t->misaligned = 1; | 608 | t->misaligned = 1; |
| 609 | ret = -1; | ||
| 610 | } | ||
| 602 | 611 | ||
| 603 | /* Discard alignment and granularity */ | 612 | /* Discard alignment and granularity */ |
| 604 | if (b->discard_granularity) { | 613 | if (b->discard_granularity) { |
| @@ -626,11 +635,33 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, | |||
| 626 | (t->discard_granularity - 1); | 635 | (t->discard_granularity - 1); |
| 627 | } | 636 | } |
| 628 | 637 | ||
| 629 | return t->misaligned ? -1 : 0; | 638 | return ret; |
| 630 | } | 639 | } |
| 631 | EXPORT_SYMBOL(blk_stack_limits); | 640 | EXPORT_SYMBOL(blk_stack_limits); |
| 632 | 641 | ||
| 633 | /** | 642 | /** |
| 643 | * bdev_stack_limits - adjust queue limits for stacked drivers | ||
| 644 | * @t: the stacking driver limits (top device) | ||
| 645 | * @bdev: the component block_device (bottom) | ||
| 646 | * @start: first data sector within component device | ||
| 647 | * | ||
| 648 | * Description: | ||
| 649 | * Merges queue limits for a top device and a block_device. Returns | ||
| 650 | * 0 if alignment didn't change. Returns -1 if adding the bottom | ||
| 651 | * device caused misalignment. | ||
| 652 | */ | ||
| 653 | int bdev_stack_limits(struct queue_limits *t, struct block_device *bdev, | ||
| 654 | sector_t start) | ||
| 655 | { | ||
| 656 | struct request_queue *bq = bdev_get_queue(bdev); | ||
| 657 | |||
| 658 | start += get_start_sect(bdev); | ||
| 659 | |||
| 660 | return blk_stack_limits(t, &bq->limits, start << 9); | ||
| 661 | } | ||
| 662 | EXPORT_SYMBOL(bdev_stack_limits); | ||
| 663 | |||
| 664 | /** | ||
| 634 | * disk_stack_limits - adjust queue limits for stacked drivers | 665 | * disk_stack_limits - adjust queue limits for stacked drivers |
| 635 | * @disk: MD/DM gendisk (top) | 666 | * @disk: MD/DM gendisk (top) |
| 636 | * @bdev: the underlying block device (bottom) | 667 | * @bdev: the underlying block device (bottom) |
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index 918c7fd9aeb1..ee130f14d1fc 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c | |||
| @@ -3077,6 +3077,12 @@ cfq_should_preempt(struct cfq_data *cfqd, struct cfq_queue *new_cfqq, | |||
| 3077 | return true; | 3077 | return true; |
| 3078 | 3078 | ||
| 3079 | /* | 3079 | /* |
| 3080 | * Don't allow a non-RT request to preempt an ongoing RT cfqq timeslice. | ||
| 3081 | */ | ||
| 3082 | if (cfq_class_rt(cfqq) && !cfq_class_rt(new_cfqq)) | ||
| 3083 | return false; | ||
| 3084 | |||
| 3085 | /* | ||
| 3080 | * if the new request is sync, but the currently running queue is | 3086 | * if the new request is sync, but the currently running queue is |
| 3081 | * not, let the sync request have priority. | 3087 | * not, let the sync request have priority. |
| 3082 | */ | 3088 | */ |
diff --git a/block/genhd.c b/block/genhd.c index b11a4ad7d571..d13ba76a169c 100644 --- a/block/genhd.c +++ b/block/genhd.c | |||
| @@ -867,7 +867,7 @@ static ssize_t disk_discard_alignment_show(struct device *dev, | |||
| 867 | { | 867 | { |
| 868 | struct gendisk *disk = dev_to_disk(dev); | 868 | struct gendisk *disk = dev_to_disk(dev); |
| 869 | 869 | ||
| 870 | return sprintf(buf, "%u\n", queue_discard_alignment(disk->queue)); | 870 | return sprintf(buf, "%d\n", queue_discard_alignment(disk->queue)); |
| 871 | } | 871 | } |
| 872 | 872 | ||
| 873 | static DEVICE_ATTR(range, S_IRUGO, disk_range_show, NULL); | 873 | static DEVICE_ATTR(range, S_IRUGO, disk_range_show, NULL); |
diff --git a/drivers/acpi/acpi_pad.c b/drivers/acpi/acpi_pad.c index 97991ac6f5fc..7e52295f1ecc 100644 --- a/drivers/acpi/acpi_pad.c +++ b/drivers/acpi/acpi_pad.c | |||
| @@ -208,7 +208,7 @@ static int power_saving_thread(void *data) | |||
| 208 | * the mechanism only works when all CPUs have RT task running, | 208 | * the mechanism only works when all CPUs have RT task running, |
| 209 | * as if one CPU hasn't RT task, RT task from other CPUs will | 209 | * as if one CPU hasn't RT task, RT task from other CPUs will |
| 210 | * borrow CPU time from this CPU and cause RT task use > 95% | 210 | * borrow CPU time from this CPU and cause RT task use > 95% |
| 211 | * CPU time. To make 'avoid staration' work, takes a nap here. | 211 | * CPU time. To make 'avoid starvation' work, takes a nap here. |
| 212 | */ | 212 | */ |
| 213 | if (do_sleep) | 213 | if (do_sleep) |
| 214 | schedule_timeout_killable(HZ * idle_pct / 100); | 214 | schedule_timeout_killable(HZ * idle_pct / 100); |
| @@ -222,14 +222,18 @@ static struct task_struct *ps_tsks[NR_CPUS]; | |||
| 222 | static unsigned int ps_tsk_num; | 222 | static unsigned int ps_tsk_num; |
| 223 | static int create_power_saving_task(void) | 223 | static int create_power_saving_task(void) |
| 224 | { | 224 | { |
| 225 | int rc = -ENOMEM; | ||
| 226 | |||
| 225 | ps_tsks[ps_tsk_num] = kthread_run(power_saving_thread, | 227 | ps_tsks[ps_tsk_num] = kthread_run(power_saving_thread, |
| 226 | (void *)(unsigned long)ps_tsk_num, | 228 | (void *)(unsigned long)ps_tsk_num, |
| 227 | "power_saving/%d", ps_tsk_num); | 229 | "power_saving/%d", ps_tsk_num); |
| 228 | if (ps_tsks[ps_tsk_num]) { | 230 | rc = IS_ERR(ps_tsks[ps_tsk_num]) ? PTR_ERR(ps_tsks[ps_tsk_num]) : 0; |
| 231 | if (!rc) | ||
| 229 | ps_tsk_num++; | 232 | ps_tsk_num++; |
| 230 | return 0; | 233 | else |
| 231 | } | 234 | ps_tsks[ps_tsk_num] = NULL; |
| 232 | return -EINVAL; | 235 | |
| 236 | return rc; | ||
| 233 | } | 237 | } |
| 234 | 238 | ||
| 235 | static void destroy_power_saving_task(void) | 239 | static void destroy_power_saving_task(void) |
| @@ -237,6 +241,7 @@ static void destroy_power_saving_task(void) | |||
| 237 | if (ps_tsk_num > 0) { | 241 | if (ps_tsk_num > 0) { |
| 238 | ps_tsk_num--; | 242 | ps_tsk_num--; |
| 239 | kthread_stop(ps_tsks[ps_tsk_num]); | 243 | kthread_stop(ps_tsks[ps_tsk_num]); |
| 244 | ps_tsks[ps_tsk_num] = NULL; | ||
| 240 | } | 245 | } |
| 241 | } | 246 | } |
| 242 | 247 | ||
| @@ -253,7 +258,7 @@ static void set_power_saving_task_num(unsigned int num) | |||
| 253 | } | 258 | } |
| 254 | } | 259 | } |
| 255 | 260 | ||
| 256 | static int acpi_pad_idle_cpus(unsigned int num_cpus) | 261 | static void acpi_pad_idle_cpus(unsigned int num_cpus) |
| 257 | { | 262 | { |
| 258 | get_online_cpus(); | 263 | get_online_cpus(); |
| 259 | 264 | ||
| @@ -261,7 +266,6 @@ static int acpi_pad_idle_cpus(unsigned int num_cpus) | |||
| 261 | set_power_saving_task_num(num_cpus); | 266 | set_power_saving_task_num(num_cpus); |
| 262 | 267 | ||
| 263 | put_online_cpus(); | 268 | put_online_cpus(); |
| 264 | return 0; | ||
| 265 | } | 269 | } |
| 266 | 270 | ||
| 267 | static uint32_t acpi_pad_idle_cpus_num(void) | 271 | static uint32_t acpi_pad_idle_cpus_num(void) |
| @@ -369,19 +373,21 @@ static void acpi_pad_remove_sysfs(struct acpi_device *device) | |||
| 369 | static int acpi_pad_pur(acpi_handle handle, int *num_cpus) | 373 | static int acpi_pad_pur(acpi_handle handle, int *num_cpus) |
| 370 | { | 374 | { |
| 371 | struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; | 375 | struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; |
| 372 | acpi_status status; | ||
| 373 | union acpi_object *package; | 376 | union acpi_object *package; |
| 374 | int rev, num, ret = -EINVAL; | 377 | int rev, num, ret = -EINVAL; |
| 375 | 378 | ||
| 376 | status = acpi_evaluate_object(handle, "_PUR", NULL, &buffer); | 379 | if (ACPI_FAILURE(acpi_evaluate_object(handle, "_PUR", NULL, &buffer))) |
| 377 | if (ACPI_FAILURE(status)) | 380 | return -EINVAL; |
| 381 | |||
| 382 | if (!buffer.length || !buffer.pointer) | ||
| 378 | return -EINVAL; | 383 | return -EINVAL; |
| 384 | |||
| 379 | package = buffer.pointer; | 385 | package = buffer.pointer; |
| 380 | if (package->type != ACPI_TYPE_PACKAGE || package->package.count != 2) | 386 | if (package->type != ACPI_TYPE_PACKAGE || package->package.count != 2) |
| 381 | goto out; | 387 | goto out; |
| 382 | rev = package->package.elements[0].integer.value; | 388 | rev = package->package.elements[0].integer.value; |
| 383 | num = package->package.elements[1].integer.value; | 389 | num = package->package.elements[1].integer.value; |
| 384 | if (rev != 1) | 390 | if (rev != 1 || num < 0) |
| 385 | goto out; | 391 | goto out; |
| 386 | *num_cpus = num; | 392 | *num_cpus = num; |
| 387 | ret = 0; | 393 | ret = 0; |
| @@ -410,7 +416,7 @@ static void acpi_pad_ost(acpi_handle handle, int stat, | |||
| 410 | 416 | ||
| 411 | static void acpi_pad_handle_notify(acpi_handle handle) | 417 | static void acpi_pad_handle_notify(acpi_handle handle) |
| 412 | { | 418 | { |
| 413 | int num_cpus, ret; | 419 | int num_cpus; |
| 414 | uint32_t idle_cpus; | 420 | uint32_t idle_cpus; |
| 415 | 421 | ||
| 416 | mutex_lock(&isolated_cpus_lock); | 422 | mutex_lock(&isolated_cpus_lock); |
| @@ -418,12 +424,9 @@ static void acpi_pad_handle_notify(acpi_handle handle) | |||
| 418 | mutex_unlock(&isolated_cpus_lock); | 424 | mutex_unlock(&isolated_cpus_lock); |
| 419 | return; | 425 | return; |
| 420 | } | 426 | } |
| 421 | ret = acpi_pad_idle_cpus(num_cpus); | 427 | acpi_pad_idle_cpus(num_cpus); |
| 422 | idle_cpus = acpi_pad_idle_cpus_num(); | 428 | idle_cpus = acpi_pad_idle_cpus_num(); |
| 423 | if (!ret) | 429 | acpi_pad_ost(handle, 0, idle_cpus); |
| 424 | acpi_pad_ost(handle, 0, idle_cpus); | ||
| 425 | else | ||
| 426 | acpi_pad_ost(handle, 1, 0); | ||
| 427 | mutex_unlock(&isolated_cpus_lock); | 430 | mutex_unlock(&isolated_cpus_lock); |
| 428 | } | 431 | } |
| 429 | 432 | ||
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index cf761b904e4a..a52126e46307 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c | |||
| @@ -490,9 +490,14 @@ static void acpi_bus_osc_support(void) | |||
| 490 | 490 | ||
| 491 | capbuf[OSC_QUERY_TYPE] = OSC_QUERY_ENABLE; | 491 | capbuf[OSC_QUERY_TYPE] = OSC_QUERY_ENABLE; |
| 492 | capbuf[OSC_SUPPORT_TYPE] = OSC_SB_PR3_SUPPORT; /* _PR3 is in use */ | 492 | capbuf[OSC_SUPPORT_TYPE] = OSC_SB_PR3_SUPPORT; /* _PR3 is in use */ |
| 493 | #ifdef CONFIG_ACPI_PROCESSOR_AGGREGATOR | 493 | #if defined(CONFIG_ACPI_PROCESSOR_AGGREGATOR) ||\ |
| 494 | defined(CONFIG_ACPI_PROCESSOR_AGGREGATOR_MODULE) | ||
| 494 | capbuf[OSC_SUPPORT_TYPE] |= OSC_SB_PAD_SUPPORT; | 495 | capbuf[OSC_SUPPORT_TYPE] |= OSC_SB_PAD_SUPPORT; |
| 495 | #endif | 496 | #endif |
| 497 | |||
| 498 | #if defined(CONFIG_ACPI_PROCESSOR) || defined(CONFIG_ACPI_PROCESSOR_MODULE) | ||
| 499 | capbuf[OSC_SUPPORT_TYPE] |= OSC_SB_PPC_OST_SUPPORT; | ||
| 500 | #endif | ||
| 496 | if (ACPI_FAILURE(acpi_get_handle(NULL, "\\_SB", &handle))) | 501 | if (ACPI_FAILURE(acpi_get_handle(NULL, "\\_SB", &handle))) |
| 497 | return; | 502 | return; |
| 498 | if (ACPI_SUCCESS(acpi_run_osc(handle, &context))) | 503 | if (ACPI_SUCCESS(acpi_run_osc(handle, &context))) |
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index fd1801bdee66..d6471bb6852f 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
| @@ -201,14 +201,13 @@ unlock: | |||
| 201 | spin_unlock_irqrestore(&ec->curr_lock, flags); | 201 | spin_unlock_irqrestore(&ec->curr_lock, flags); |
| 202 | } | 202 | } |
| 203 | 203 | ||
| 204 | static void acpi_ec_gpe_query(void *ec_cxt); | 204 | static int acpi_ec_sync_query(struct acpi_ec *ec); |
| 205 | 205 | ||
| 206 | static int ec_check_sci(struct acpi_ec *ec, u8 state) | 206 | static int ec_check_sci_sync(struct acpi_ec *ec, u8 state) |
| 207 | { | 207 | { |
| 208 | if (state & ACPI_EC_FLAG_SCI) { | 208 | if (state & ACPI_EC_FLAG_SCI) { |
| 209 | if (!test_and_set_bit(EC_FLAGS_QUERY_PENDING, &ec->flags)) | 209 | if (!test_and_set_bit(EC_FLAGS_QUERY_PENDING, &ec->flags)) |
| 210 | return acpi_os_execute(OSL_EC_BURST_HANDLER, | 210 | return acpi_ec_sync_query(ec); |
| 211 | acpi_ec_gpe_query, ec); | ||
| 212 | } | 211 | } |
| 213 | return 0; | 212 | return 0; |
| 214 | } | 213 | } |
| @@ -249,11 +248,6 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, | |||
| 249 | { | 248 | { |
| 250 | unsigned long tmp; | 249 | unsigned long tmp; |
| 251 | int ret = 0; | 250 | int ret = 0; |
| 252 | pr_debug(PREFIX "transaction start\n"); | ||
| 253 | /* disable GPE during transaction if storm is detected */ | ||
| 254 | if (test_bit(EC_FLAGS_GPE_STORM, &ec->flags)) { | ||
| 255 | acpi_disable_gpe(NULL, ec->gpe); | ||
| 256 | } | ||
| 257 | if (EC_FLAGS_MSI) | 251 | if (EC_FLAGS_MSI) |
| 258 | udelay(ACPI_EC_MSI_UDELAY); | 252 | udelay(ACPI_EC_MSI_UDELAY); |
| 259 | /* start transaction */ | 253 | /* start transaction */ |
| @@ -265,20 +259,9 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, | |||
| 265 | clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags); | 259 | clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags); |
| 266 | spin_unlock_irqrestore(&ec->curr_lock, tmp); | 260 | spin_unlock_irqrestore(&ec->curr_lock, tmp); |
| 267 | ret = ec_poll(ec); | 261 | ret = ec_poll(ec); |
| 268 | pr_debug(PREFIX "transaction end\n"); | ||
| 269 | spin_lock_irqsave(&ec->curr_lock, tmp); | 262 | spin_lock_irqsave(&ec->curr_lock, tmp); |
| 270 | ec->curr = NULL; | 263 | ec->curr = NULL; |
| 271 | spin_unlock_irqrestore(&ec->curr_lock, tmp); | 264 | spin_unlock_irqrestore(&ec->curr_lock, tmp); |
| 272 | if (test_bit(EC_FLAGS_GPE_STORM, &ec->flags)) { | ||
| 273 | /* check if we received SCI during transaction */ | ||
| 274 | ec_check_sci(ec, acpi_ec_read_status(ec)); | ||
| 275 | /* it is safe to enable GPE outside of transaction */ | ||
| 276 | acpi_enable_gpe(NULL, ec->gpe); | ||
| 277 | } else if (t->irq_count > ACPI_EC_STORM_THRESHOLD) { | ||
| 278 | pr_info(PREFIX "GPE storm detected, " | ||
| 279 | "transactions will use polling mode\n"); | ||
| 280 | set_bit(EC_FLAGS_GPE_STORM, &ec->flags); | ||
| 281 | } | ||
| 282 | return ret; | 265 | return ret; |
| 283 | } | 266 | } |
| 284 | 267 | ||
| @@ -321,7 +304,26 @@ static int acpi_ec_transaction(struct acpi_ec *ec, struct transaction *t) | |||
| 321 | status = -ETIME; | 304 | status = -ETIME; |
| 322 | goto end; | 305 | goto end; |
| 323 | } | 306 | } |
| 307 | pr_debug(PREFIX "transaction start\n"); | ||
| 308 | /* disable GPE during transaction if storm is detected */ | ||
| 309 | if (test_bit(EC_FLAGS_GPE_STORM, &ec->flags)) { | ||
| 310 | acpi_disable_gpe(NULL, ec->gpe); | ||
| 311 | } | ||
| 312 | |||
| 324 | status = acpi_ec_transaction_unlocked(ec, t); | 313 | status = acpi_ec_transaction_unlocked(ec, t); |
| 314 | |||
| 315 | /* check if we received SCI during transaction */ | ||
| 316 | ec_check_sci_sync(ec, acpi_ec_read_status(ec)); | ||
| 317 | if (test_bit(EC_FLAGS_GPE_STORM, &ec->flags)) { | ||
| 318 | msleep(1); | ||
| 319 | /* it is safe to enable GPE outside of transaction */ | ||
| 320 | acpi_enable_gpe(NULL, ec->gpe); | ||
| 321 | } else if (t->irq_count > ACPI_EC_STORM_THRESHOLD) { | ||
| 322 | pr_info(PREFIX "GPE storm detected, " | ||
| 323 | "transactions will use polling mode\n"); | ||
| 324 | set_bit(EC_FLAGS_GPE_STORM, &ec->flags); | ||
| 325 | } | ||
| 326 | pr_debug(PREFIX "transaction end\n"); | ||
| 325 | end: | 327 | end: |
| 326 | if (ec->global_lock) | 328 | if (ec->global_lock) |
| 327 | acpi_release_global_lock(glk); | 329 | acpi_release_global_lock(glk); |
| @@ -443,7 +445,7 @@ int ec_transaction(u8 command, | |||
| 443 | 445 | ||
| 444 | EXPORT_SYMBOL(ec_transaction); | 446 | EXPORT_SYMBOL(ec_transaction); |
| 445 | 447 | ||
| 446 | static int acpi_ec_query(struct acpi_ec *ec, u8 * data) | 448 | static int acpi_ec_query_unlocked(struct acpi_ec *ec, u8 * data) |
| 447 | { | 449 | { |
| 448 | int result; | 450 | int result; |
| 449 | u8 d; | 451 | u8 d; |
| @@ -452,20 +454,16 @@ static int acpi_ec_query(struct acpi_ec *ec, u8 * data) | |||
| 452 | .wlen = 0, .rlen = 1}; | 454 | .wlen = 0, .rlen = 1}; |
| 453 | if (!ec || !data) | 455 | if (!ec || !data) |
| 454 | return -EINVAL; | 456 | return -EINVAL; |
| 455 | |||
| 456 | /* | 457 | /* |
| 457 | * Query the EC to find out which _Qxx method we need to evaluate. | 458 | * Query the EC to find out which _Qxx method we need to evaluate. |
| 458 | * Note that successful completion of the query causes the ACPI_EC_SCI | 459 | * Note that successful completion of the query causes the ACPI_EC_SCI |
| 459 | * bit to be cleared (and thus clearing the interrupt source). | 460 | * bit to be cleared (and thus clearing the interrupt source). |
| 460 | */ | 461 | */ |
| 461 | 462 | result = acpi_ec_transaction_unlocked(ec, &t); | |
| 462 | result = acpi_ec_transaction(ec, &t); | ||
| 463 | if (result) | 463 | if (result) |
| 464 | return result; | 464 | return result; |
| 465 | |||
| 466 | if (!d) | 465 | if (!d) |
| 467 | return -ENODATA; | 466 | return -ENODATA; |
| 468 | |||
| 469 | *data = d; | 467 | *data = d; |
| 470 | return 0; | 468 | return 0; |
| 471 | } | 469 | } |
| @@ -509,43 +507,79 @@ void acpi_ec_remove_query_handler(struct acpi_ec *ec, u8 query_bit) | |||
| 509 | 507 | ||
| 510 | EXPORT_SYMBOL_GPL(acpi_ec_remove_query_handler); | 508 | EXPORT_SYMBOL_GPL(acpi_ec_remove_query_handler); |
| 511 | 509 | ||
| 512 | static void acpi_ec_gpe_query(void *ec_cxt) | 510 | static void acpi_ec_run(void *cxt) |
| 513 | { | 511 | { |
| 514 | struct acpi_ec *ec = ec_cxt; | 512 | struct acpi_ec_query_handler *handler = cxt; |
| 515 | u8 value = 0; | 513 | if (!handler) |
| 516 | struct acpi_ec_query_handler *handler, copy; | ||
| 517 | |||
| 518 | if (!ec || acpi_ec_query(ec, &value)) | ||
| 519 | return; | 514 | return; |
| 520 | mutex_lock(&ec->lock); | 515 | pr_debug(PREFIX "start query execution\n"); |
| 516 | if (handler->func) | ||
| 517 | handler->func(handler->data); | ||
| 518 | else if (handler->handle) | ||
| 519 | acpi_evaluate_object(handler->handle, NULL, NULL, NULL); | ||
| 520 | pr_debug(PREFIX "stop query execution\n"); | ||
| 521 | kfree(handler); | ||
| 522 | } | ||
| 523 | |||
| 524 | static int acpi_ec_sync_query(struct acpi_ec *ec) | ||
| 525 | { | ||
| 526 | u8 value = 0; | ||
| 527 | int status; | ||
| 528 | struct acpi_ec_query_handler *handler, *copy; | ||
| 529 | if ((status = acpi_ec_query_unlocked(ec, &value))) | ||
| 530 | return status; | ||
| 521 | list_for_each_entry(handler, &ec->list, node) { | 531 | list_for_each_entry(handler, &ec->list, node) { |
| 522 | if (value == handler->query_bit) { | 532 | if (value == handler->query_bit) { |
| 523 | /* have custom handler for this bit */ | 533 | /* have custom handler for this bit */ |
| 524 | memcpy(©, handler, sizeof(copy)); | 534 | copy = kmalloc(sizeof(*handler), GFP_KERNEL); |
| 525 | mutex_unlock(&ec->lock); | 535 | if (!copy) |
| 526 | if (copy.func) { | 536 | return -ENOMEM; |
| 527 | copy.func(copy.data); | 537 | memcpy(copy, handler, sizeof(*copy)); |
| 528 | } else if (copy.handle) { | 538 | pr_debug(PREFIX "push query execution (0x%2x) on queue\n", value); |
| 529 | acpi_evaluate_object(copy.handle, NULL, NULL, NULL); | 539 | return acpi_os_execute((copy->func) ? |
| 530 | } | 540 | OSL_NOTIFY_HANDLER : OSL_GPE_HANDLER, |
| 531 | return; | 541 | acpi_ec_run, copy); |
| 532 | } | 542 | } |
| 533 | } | 543 | } |
| 544 | return 0; | ||
| 545 | } | ||
| 546 | |||
| 547 | static void acpi_ec_gpe_query(void *ec_cxt) | ||
| 548 | { | ||
| 549 | struct acpi_ec *ec = ec_cxt; | ||
| 550 | if (!ec) | ||
| 551 | return; | ||
| 552 | mutex_lock(&ec->lock); | ||
| 553 | acpi_ec_sync_query(ec); | ||
| 534 | mutex_unlock(&ec->lock); | 554 | mutex_unlock(&ec->lock); |
| 535 | } | 555 | } |
| 536 | 556 | ||
| 557 | static void acpi_ec_gpe_query(void *ec_cxt); | ||
| 558 | |||
| 559 | static int ec_check_sci(struct acpi_ec *ec, u8 state) | ||
| 560 | { | ||
| 561 | if (state & ACPI_EC_FLAG_SCI) { | ||
| 562 | if (!test_and_set_bit(EC_FLAGS_QUERY_PENDING, &ec->flags)) { | ||
| 563 | pr_debug(PREFIX "push gpe query to the queue\n"); | ||
| 564 | return acpi_os_execute(OSL_NOTIFY_HANDLER, | ||
| 565 | acpi_ec_gpe_query, ec); | ||
| 566 | } | ||
| 567 | } | ||
| 568 | return 0; | ||
| 569 | } | ||
| 570 | |||
| 537 | static u32 acpi_ec_gpe_handler(void *data) | 571 | static u32 acpi_ec_gpe_handler(void *data) |
| 538 | { | 572 | { |
| 539 | struct acpi_ec *ec = data; | 573 | struct acpi_ec *ec = data; |
| 540 | u8 status; | ||
| 541 | 574 | ||
| 542 | pr_debug(PREFIX "~~~> interrupt\n"); | 575 | pr_debug(PREFIX "~~~> interrupt\n"); |
| 543 | status = acpi_ec_read_status(ec); | ||
| 544 | 576 | ||
| 545 | advance_transaction(ec, status); | 577 | advance_transaction(ec, acpi_ec_read_status(ec)); |
| 546 | if (ec_transaction_done(ec) && (status & ACPI_EC_FLAG_IBF) == 0) | 578 | if (ec_transaction_done(ec) && |
| 579 | (acpi_ec_read_status(ec) & ACPI_EC_FLAG_IBF) == 0) { | ||
| 547 | wake_up(&ec->wait); | 580 | wake_up(&ec->wait); |
| 548 | ec_check_sci(ec, status); | 581 | ec_check_sci(ec, acpi_ec_read_status(ec)); |
| 582 | } | ||
| 549 | return ACPI_INTERRUPT_HANDLED; | 583 | return ACPI_INTERRUPT_HANDLED; |
| 550 | } | 584 | } |
| 551 | 585 | ||
diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c index 394ae89409c2..04b0f007c9b7 100644 --- a/drivers/acpi/pci_link.c +++ b/drivers/acpi/pci_link.c | |||
| @@ -56,7 +56,7 @@ ACPI_MODULE_NAME("pci_link"); | |||
| 56 | static int acpi_pci_link_add(struct acpi_device *device); | 56 | static int acpi_pci_link_add(struct acpi_device *device); |
| 57 | static int acpi_pci_link_remove(struct acpi_device *device, int type); | 57 | static int acpi_pci_link_remove(struct acpi_device *device, int type); |
| 58 | 58 | ||
| 59 | static struct acpi_device_id link_device_ids[] = { | 59 | static const struct acpi_device_id link_device_ids[] = { |
| 60 | {"PNP0C0F", 0}, | 60 | {"PNP0C0F", 0}, |
| 61 | {"", 0}, | 61 | {"", 0}, |
| 62 | }; | 62 | }; |
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index 101cce3681d1..64f55b6db73c 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c | |||
| @@ -46,7 +46,7 @@ static int acpi_pci_root_add(struct acpi_device *device); | |||
| 46 | static int acpi_pci_root_remove(struct acpi_device *device, int type); | 46 | static int acpi_pci_root_remove(struct acpi_device *device, int type); |
| 47 | static int acpi_pci_root_start(struct acpi_device *device); | 47 | static int acpi_pci_root_start(struct acpi_device *device); |
| 48 | 48 | ||
| 49 | static struct acpi_device_id root_device_ids[] = { | 49 | static const struct acpi_device_id root_device_ids[] = { |
| 50 | {"PNP0A03", 0}, | 50 | {"PNP0A03", 0}, |
| 51 | {"", 0}, | 51 | {"", 0}, |
| 52 | }; | 52 | }; |
diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c index 22b297916519..0f30c3c1eea4 100644 --- a/drivers/acpi/power.c +++ b/drivers/acpi/power.c | |||
| @@ -65,7 +65,7 @@ static int acpi_power_remove(struct acpi_device *device, int type); | |||
| 65 | static int acpi_power_resume(struct acpi_device *device); | 65 | static int acpi_power_resume(struct acpi_device *device); |
| 66 | static int acpi_power_open_fs(struct inode *inode, struct file *file); | 66 | static int acpi_power_open_fs(struct inode *inode, struct file *file); |
| 67 | 67 | ||
| 68 | static struct acpi_device_id power_device_ids[] = { | 68 | static const struct acpi_device_id power_device_ids[] = { |
| 69 | {ACPI_POWER_HID, 0}, | 69 | {ACPI_POWER_HID, 0}, |
| 70 | {"", 0}, | 70 | {"", 0}, |
| 71 | }; | 71 | }; |
diff --git a/drivers/acpi/power_meter.c b/drivers/acpi/power_meter.c index 2ef7030a0c28..dc4ffadf8122 100644 --- a/drivers/acpi/power_meter.c +++ b/drivers/acpi/power_meter.c | |||
| @@ -64,7 +64,7 @@ static int can_cap_in_hardware(void) | |||
| 64 | return force_cap_on || cap_in_hardware; | 64 | return force_cap_on || cap_in_hardware; |
| 65 | } | 65 | } |
| 66 | 66 | ||
| 67 | static struct acpi_device_id power_meter_ids[] = { | 67 | static const struct acpi_device_id power_meter_ids[] = { |
| 68 | {"ACPI000D", 0}, | 68 | {"ACPI000D", 0}, |
| 69 | {"", 0}, | 69 | {"", 0}, |
| 70 | }; | 70 | }; |
| @@ -534,6 +534,7 @@ static void remove_domain_devices(struct acpi_power_meter_resource *resource) | |||
| 534 | 534 | ||
| 535 | kfree(resource->domain_devices); | 535 | kfree(resource->domain_devices); |
| 536 | kobject_put(resource->holders_dir); | 536 | kobject_put(resource->holders_dir); |
| 537 | resource->num_domain_devices = 0; | ||
| 537 | } | 538 | } |
| 538 | 539 | ||
| 539 | static int read_domain_devices(struct acpi_power_meter_resource *resource) | 540 | static int read_domain_devices(struct acpi_power_meter_resource *resource) |
| @@ -740,7 +741,6 @@ skip_unsafe_cap: | |||
| 740 | 741 | ||
| 741 | return res; | 742 | return res; |
| 742 | error: | 743 | error: |
| 743 | remove_domain_devices(resource); | ||
| 744 | remove_attrs(resource); | 744 | remove_attrs(resource); |
| 745 | return res; | 745 | return res; |
| 746 | } | 746 | } |
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index d1676b1754d9..7c0441f63b39 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c | |||
| @@ -305,6 +305,28 @@ static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr) | |||
| 305 | pr->power.states[ACPI_STATE_C2].latency = acpi_gbl_FADT.C2latency; | 305 | pr->power.states[ACPI_STATE_C2].latency = acpi_gbl_FADT.C2latency; |
| 306 | pr->power.states[ACPI_STATE_C3].latency = acpi_gbl_FADT.C3latency; | 306 | pr->power.states[ACPI_STATE_C3].latency = acpi_gbl_FADT.C3latency; |
| 307 | 307 | ||
| 308 | /* | ||
| 309 | * FADT specified C2 latency must be less than or equal to | ||
| 310 | * 100 microseconds. | ||
| 311 | */ | ||
| 312 | if (acpi_gbl_FADT.C2latency > ACPI_PROCESSOR_MAX_C2_LATENCY) { | ||
| 313 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
| 314 | "C2 latency too large [%d]\n", acpi_gbl_FADT.C2latency)); | ||
| 315 | /* invalidate C2 */ | ||
| 316 | pr->power.states[ACPI_STATE_C2].address = 0; | ||
| 317 | } | ||
| 318 | |||
| 319 | /* | ||
| 320 | * FADT supplied C3 latency must be less than or equal to | ||
| 321 | * 1000 microseconds. | ||
| 322 | */ | ||
| 323 | if (acpi_gbl_FADT.C3latency > ACPI_PROCESSOR_MAX_C3_LATENCY) { | ||
| 324 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
| 325 | "C3 latency too large [%d]\n", acpi_gbl_FADT.C3latency)); | ||
| 326 | /* invalidate C3 */ | ||
| 327 | pr->power.states[ACPI_STATE_C3].address = 0; | ||
| 328 | } | ||
| 329 | |||
| 308 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 330 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
| 309 | "lvl2[0x%08x] lvl3[0x%08x]\n", | 331 | "lvl2[0x%08x] lvl3[0x%08x]\n", |
| 310 | pr->power.states[ACPI_STATE_C2].address, | 332 | pr->power.states[ACPI_STATE_C2].address, |
| @@ -494,33 +516,6 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr) | |||
| 494 | return status; | 516 | return status; |
| 495 | } | 517 | } |
| 496 | 518 | ||
| 497 | static void acpi_processor_power_verify_c2(struct acpi_processor_cx *cx) | ||
| 498 | { | ||
| 499 | |||
| 500 | if (!cx->address) | ||
| 501 | return; | ||
| 502 | |||
| 503 | /* | ||
| 504 | * C2 latency must be less than or equal to 100 | ||
| 505 | * microseconds. | ||
| 506 | */ | ||
| 507 | else if (cx->latency > ACPI_PROCESSOR_MAX_C2_LATENCY) { | ||
| 508 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
| 509 | "latency too large [%d]\n", cx->latency)); | ||
| 510 | return; | ||
| 511 | } | ||
| 512 | |||
| 513 | /* | ||
| 514 | * Otherwise we've met all of our C2 requirements. | ||
| 515 | * Normalize the C2 latency to expidite policy | ||
| 516 | */ | ||
| 517 | cx->valid = 1; | ||
| 518 | |||
| 519 | cx->latency_ticks = cx->latency; | ||
| 520 | |||
| 521 | return; | ||
| 522 | } | ||
| 523 | |||
| 524 | static void acpi_processor_power_verify_c3(struct acpi_processor *pr, | 519 | static void acpi_processor_power_verify_c3(struct acpi_processor *pr, |
| 525 | struct acpi_processor_cx *cx) | 520 | struct acpi_processor_cx *cx) |
| 526 | { | 521 | { |
| @@ -532,16 +527,6 @@ static void acpi_processor_power_verify_c3(struct acpi_processor *pr, | |||
| 532 | return; | 527 | return; |
| 533 | 528 | ||
| 534 | /* | 529 | /* |
| 535 | * C3 latency must be less than or equal to 1000 | ||
| 536 | * microseconds. | ||
| 537 | */ | ||
| 538 | else if (cx->latency > ACPI_PROCESSOR_MAX_C3_LATENCY) { | ||
| 539 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
| 540 | "latency too large [%d]\n", cx->latency)); | ||
| 541 | return; | ||
| 542 | } | ||
| 543 | |||
| 544 | /* | ||
| 545 | * PIIX4 Erratum #18: We don't support C3 when Type-F (fast) | 530 | * PIIX4 Erratum #18: We don't support C3 when Type-F (fast) |
| 546 | * DMA transfers are used by any ISA device to avoid livelock. | 531 | * DMA transfers are used by any ISA device to avoid livelock. |
| 547 | * Note that we could disable Type-F DMA (as recommended by | 532 | * Note that we could disable Type-F DMA (as recommended by |
| @@ -629,7 +614,10 @@ static int acpi_processor_power_verify(struct acpi_processor *pr) | |||
| 629 | break; | 614 | break; |
| 630 | 615 | ||
| 631 | case ACPI_STATE_C2: | 616 | case ACPI_STATE_C2: |
| 632 | acpi_processor_power_verify_c2(cx); | 617 | if (!cx->address) |
| 618 | break; | ||
| 619 | cx->valid = 1; | ||
| 620 | cx->latency_ticks = cx->latency; /* Normalize latency */ | ||
| 633 | break; | 621 | break; |
| 634 | 622 | ||
| 635 | case ACPI_STATE_C3: | 623 | case ACPI_STATE_C3: |
diff --git a/drivers/acpi/processor_pdc.c b/drivers/acpi/processor_pdc.c index 30e4dc0cdf30..7247819dbd80 100644 --- a/drivers/acpi/processor_pdc.c +++ b/drivers/acpi/processor_pdc.c | |||
| @@ -144,6 +144,29 @@ void acpi_processor_set_pdc(acpi_handle handle) | |||
| 144 | } | 144 | } |
| 145 | EXPORT_SYMBOL_GPL(acpi_processor_set_pdc); | 145 | EXPORT_SYMBOL_GPL(acpi_processor_set_pdc); |
| 146 | 146 | ||
| 147 | static int early_pdc_optin; | ||
| 148 | static int set_early_pdc_optin(const struct dmi_system_id *id) | ||
| 149 | { | ||
| 150 | early_pdc_optin = 1; | ||
| 151 | return 0; | ||
| 152 | } | ||
| 153 | |||
| 154 | static struct dmi_system_id __cpuinitdata early_pdc_optin_table[] = { | ||
| 155 | { | ||
| 156 | set_early_pdc_optin, "HP Envy", { | ||
| 157 | DMI_MATCH(DMI_BIOS_VENDOR, "Hewlett-Packard"), | ||
| 158 | DMI_MATCH(DMI_PRODUCT_NAME, "HP Envy") }, NULL}, | ||
| 159 | { | ||
| 160 | set_early_pdc_optin, "HP Pavilion dv6", { | ||
| 161 | DMI_MATCH(DMI_BIOS_VENDOR, "Hewlett-Packard"), | ||
| 162 | DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dv6") }, NULL}, | ||
| 163 | { | ||
| 164 | set_early_pdc_optin, "HP Pavilion dv7", { | ||
| 165 | DMI_MATCH(DMI_BIOS_VENDOR, "Hewlett-Packard"), | ||
| 166 | DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dv7") }, NULL}, | ||
| 167 | {}, | ||
| 168 | }; | ||
| 169 | |||
| 147 | static acpi_status | 170 | static acpi_status |
| 148 | early_init_pdc(acpi_handle handle, u32 lvl, void *context, void **rv) | 171 | early_init_pdc(acpi_handle handle, u32 lvl, void *context, void **rv) |
| 149 | { | 172 | { |
| @@ -151,7 +174,7 @@ early_init_pdc(acpi_handle handle, u32 lvl, void *context, void **rv) | |||
| 151 | return AE_OK; | 174 | return AE_OK; |
| 152 | } | 175 | } |
| 153 | 176 | ||
| 154 | void acpi_early_processor_set_pdc(void) | 177 | void __init acpi_early_processor_set_pdc(void) |
| 155 | { | 178 | { |
| 156 | /* | 179 | /* |
| 157 | * Check whether the system is DMI table. If yes, OSPM | 180 | * Check whether the system is DMI table. If yes, OSPM |
| @@ -159,6 +182,13 @@ void acpi_early_processor_set_pdc(void) | |||
| 159 | */ | 182 | */ |
| 160 | dmi_check_system(processor_idle_dmi_table); | 183 | dmi_check_system(processor_idle_dmi_table); |
| 161 | 184 | ||
| 185 | /* | ||
| 186 | * Allow systems to opt-in to early _PDC evaluation. | ||
| 187 | */ | ||
| 188 | dmi_check_system(early_pdc_optin_table); | ||
| 189 | if (!early_pdc_optin) | ||
| 190 | return; | ||
| 191 | |||
| 162 | acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT, | 192 | acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT, |
| 163 | ACPI_UINT32_MAX, | 193 | ACPI_UINT32_MAX, |
| 164 | early_init_pdc, NULL, NULL, NULL); | 194 | early_init_pdc, NULL, NULL, NULL); |
diff --git a/drivers/acpi/processor_thermal.c b/drivers/acpi/processor_thermal.c index 140c5c5b423c..6deafb4aa0da 100644 --- a/drivers/acpi/processor_thermal.c +++ b/drivers/acpi/processor_thermal.c | |||
| @@ -443,8 +443,7 @@ struct thermal_cooling_device_ops processor_cooling_ops = { | |||
| 443 | #ifdef CONFIG_ACPI_PROCFS | 443 | #ifdef CONFIG_ACPI_PROCFS |
| 444 | static int acpi_processor_limit_seq_show(struct seq_file *seq, void *offset) | 444 | static int acpi_processor_limit_seq_show(struct seq_file *seq, void *offset) |
| 445 | { | 445 | { |
| 446 | struct acpi_processor *pr = (struct acpi_processor *)seq->private; | 446 | struct acpi_processor *pr = seq->private; |
| 447 | |||
| 448 | 447 | ||
| 449 | if (!pr) | 448 | if (!pr) |
| 450 | goto end; | 449 | goto end; |
diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c index 52b9db8afc20..b16ddbf23a9c 100644 --- a/drivers/acpi/sbs.c +++ b/drivers/acpi/sbs.c | |||
| @@ -822,7 +822,10 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id) | |||
| 822 | 822 | ||
| 823 | static void acpi_battery_remove(struct acpi_sbs *sbs, int id) | 823 | static void acpi_battery_remove(struct acpi_sbs *sbs, int id) |
| 824 | { | 824 | { |
| 825 | #if defined(CONFIG_ACPI_SYSFS_POWER) || defined(CONFIG_ACPI_PROCFS_POWER) | ||
| 825 | struct acpi_battery *battery = &sbs->battery[id]; | 826 | struct acpi_battery *battery = &sbs->battery[id]; |
| 827 | #endif | ||
| 828 | |||
| 826 | #ifdef CONFIG_ACPI_SYSFS_POWER | 829 | #ifdef CONFIG_ACPI_SYSFS_POWER |
| 827 | if (battery->bat.dev) { | 830 | if (battery->bat.dev) { |
| 828 | if (battery->have_sysfs_alarm) | 831 | if (battery->have_sysfs_alarm) |
diff --git a/drivers/acpi/sbshc.c b/drivers/acpi/sbshc.c index d9339806df45..fd09229282ea 100644 --- a/drivers/acpi/sbshc.c +++ b/drivers/acpi/sbshc.c | |||
| @@ -242,7 +242,7 @@ static int smbus_alarm(void *context) | |||
| 242 | case ACPI_SBS_CHARGER: | 242 | case ACPI_SBS_CHARGER: |
| 243 | case ACPI_SBS_MANAGER: | 243 | case ACPI_SBS_MANAGER: |
| 244 | case ACPI_SBS_BATTERY: | 244 | case ACPI_SBS_BATTERY: |
| 245 | acpi_os_execute(OSL_GPE_HANDLER, | 245 | acpi_os_execute(OSL_NOTIFY_HANDLER, |
| 246 | acpi_smbus_callback, hc); | 246 | acpi_smbus_callback, hc); |
| 247 | default:; | 247 | default:; |
| 248 | } | 248 | } |
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 72e76b4b6538..b765790b32be 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
| @@ -78,6 +78,13 @@ MODULE_LICENSE("GPL"); | |||
| 78 | static int brightness_switch_enabled = 1; | 78 | static int brightness_switch_enabled = 1; |
| 79 | module_param(brightness_switch_enabled, bool, 0644); | 79 | module_param(brightness_switch_enabled, bool, 0644); |
| 80 | 80 | ||
| 81 | /* | ||
| 82 | * By default, we don't allow duplicate ACPI video bus devices | ||
| 83 | * under the same VGA controller | ||
| 84 | */ | ||
| 85 | static int allow_duplicates; | ||
| 86 | module_param(allow_duplicates, bool, 0644); | ||
| 87 | |||
| 81 | static int register_count = 0; | 88 | static int register_count = 0; |
| 82 | static int acpi_video_bus_add(struct acpi_device *device); | 89 | static int acpi_video_bus_add(struct acpi_device *device); |
| 83 | static int acpi_video_bus_remove(struct acpi_device *device, int type); | 90 | static int acpi_video_bus_remove(struct acpi_device *device, int type); |
| @@ -2239,11 +2246,47 @@ static int acpi_video_resume(struct acpi_device *device) | |||
| 2239 | return AE_OK; | 2246 | return AE_OK; |
| 2240 | } | 2247 | } |
| 2241 | 2248 | ||
| 2249 | static acpi_status | ||
| 2250 | acpi_video_bus_match(acpi_handle handle, u32 level, void *context, | ||
| 2251 | void **return_value) | ||
| 2252 | { | ||
| 2253 | struct acpi_device *device = context; | ||
| 2254 | struct acpi_device *sibling; | ||
| 2255 | int result; | ||
| 2256 | |||
| 2257 | if (handle == device->handle) | ||
| 2258 | return AE_CTRL_TERMINATE; | ||
| 2259 | |||
| 2260 | result = acpi_bus_get_device(handle, &sibling); | ||
| 2261 | if (result) | ||
| 2262 | return AE_OK; | ||
| 2263 | |||
| 2264 | if (!strcmp(acpi_device_name(sibling), ACPI_VIDEO_BUS_NAME)) | ||
| 2265 | return AE_ALREADY_EXISTS; | ||
| 2266 | |||
| 2267 | return AE_OK; | ||
| 2268 | } | ||
| 2269 | |||
| 2242 | static int acpi_video_bus_add(struct acpi_device *device) | 2270 | static int acpi_video_bus_add(struct acpi_device *device) |
| 2243 | { | 2271 | { |
| 2244 | struct acpi_video_bus *video; | 2272 | struct acpi_video_bus *video; |
| 2245 | struct input_dev *input; | 2273 | struct input_dev *input; |
| 2246 | int error; | 2274 | int error; |
| 2275 | acpi_status status; | ||
| 2276 | |||
| 2277 | status = acpi_walk_namespace(ACPI_TYPE_DEVICE, | ||
| 2278 | device->parent->handle, 1, | ||
| 2279 | acpi_video_bus_match, NULL, | ||
| 2280 | device, NULL); | ||
| 2281 | if (status == AE_ALREADY_EXISTS) { | ||
| 2282 | printk(KERN_WARNING FW_BUG | ||
| 2283 | "Duplicate ACPI video bus devices for the" | ||
| 2284 | " same VGA controller, please try module " | ||
| 2285 | "parameter \"video.allow_duplicates=1\"" | ||
| 2286 | "if the current driver doesn't work.\n"); | ||
| 2287 | if (!allow_duplicates) | ||
| 2288 | return -ENODEV; | ||
| 2289 | } | ||
| 2247 | 2290 | ||
| 2248 | video = kzalloc(sizeof(struct acpi_video_bus), GFP_KERNEL); | 2291 | video = kzalloc(sizeof(struct acpi_video_bus), GFP_KERNEL); |
| 2249 | if (!video) | 2292 | if (!video) |
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index 0ea97c942ced..9f6cfac0f2cc 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c | |||
| @@ -2028,8 +2028,9 @@ static void ata_eh_link_autopsy(struct ata_link *link) | |||
| 2028 | qc->err_mask &= ~(AC_ERR_DEV | AC_ERR_OTHER); | 2028 | qc->err_mask &= ~(AC_ERR_DEV | AC_ERR_OTHER); |
| 2029 | 2029 | ||
| 2030 | /* determine whether the command is worth retrying */ | 2030 | /* determine whether the command is worth retrying */ |
| 2031 | if (!(qc->err_mask & AC_ERR_INVALID) && | 2031 | if (qc->flags & ATA_QCFLAG_IO || |
| 2032 | ((qc->flags & ATA_QCFLAG_IO) || qc->err_mask != AC_ERR_DEV)) | 2032 | (!(qc->err_mask & AC_ERR_INVALID) && |
| 2033 | qc->err_mask != AC_ERR_DEV)) | ||
| 2033 | qc->flags |= ATA_QCFLAG_RETRY; | 2034 | qc->flags |= ATA_QCFLAG_RETRY; |
| 2034 | 2035 | ||
| 2035 | /* accumulate error info */ | 2036 | /* accumulate error info */ |
diff --git a/drivers/base/devtmpfs.c b/drivers/base/devtmpfs.c index 090dd4851301..42ae452b36b0 100644 --- a/drivers/base/devtmpfs.c +++ b/drivers/base/devtmpfs.c | |||
| @@ -354,6 +354,7 @@ int __init devtmpfs_init(void) | |||
| 354 | { | 354 | { |
| 355 | int err; | 355 | int err; |
| 356 | struct vfsmount *mnt; | 356 | struct vfsmount *mnt; |
| 357 | char options[] = "mode=0755"; | ||
| 357 | 358 | ||
| 358 | err = register_filesystem(&dev_fs_type); | 359 | err = register_filesystem(&dev_fs_type); |
| 359 | if (err) { | 360 | if (err) { |
| @@ -362,7 +363,7 @@ int __init devtmpfs_init(void) | |||
| 362 | return err; | 363 | return err; |
| 363 | } | 364 | } |
| 364 | 365 | ||
| 365 | mnt = kern_mount_data(&dev_fs_type, "mode=0755"); | 366 | mnt = kern_mount_data(&dev_fs_type, options); |
| 366 | if (IS_ERR(mnt)) { | 367 | if (IS_ERR(mnt)) { |
| 367 | err = PTR_ERR(mnt); | 368 | err = PTR_ERR(mnt); |
| 368 | printk(KERN_ERR "devtmpfs: unable to create devtmpfs %i\n", err); | 369 | printk(KERN_ERR "devtmpfs: unable to create devtmpfs %i\n", err); |
diff --git a/drivers/base/memory.c b/drivers/base/memory.c index ae6b6c43cff9..bd025059711f 100644 --- a/drivers/base/memory.c +++ b/drivers/base/memory.c | |||
| @@ -309,19 +309,17 @@ static SYSDEV_ATTR(removable, 0444, show_mem_removable, NULL); | |||
| 309 | * Block size attribute stuff | 309 | * Block size attribute stuff |
| 310 | */ | 310 | */ |
| 311 | static ssize_t | 311 | static ssize_t |
| 312 | print_block_size(struct sysdev_class *class, | 312 | print_block_size(struct class *class, char *buf) |
| 313 | struct sysdev_class_attribute *class_attr, | ||
| 314 | char *buf) | ||
| 315 | { | 313 | { |
| 316 | return sprintf(buf, "%#lx\n", (unsigned long)PAGES_PER_SECTION * PAGE_SIZE); | 314 | return sprintf(buf, "%#lx\n", (unsigned long)PAGES_PER_SECTION * PAGE_SIZE); |
| 317 | } | 315 | } |
| 318 | 316 | ||
| 319 | static SYSDEV_CLASS_ATTR(block_size_bytes, 0444, print_block_size, NULL); | 317 | static CLASS_ATTR(block_size_bytes, 0444, print_block_size, NULL); |
| 320 | 318 | ||
| 321 | static int block_size_init(void) | 319 | static int block_size_init(void) |
| 322 | { | 320 | { |
| 323 | return sysfs_create_file(&memory_sysdev_class.kset.kobj, | 321 | return sysfs_create_file(&memory_sysdev_class.kset.kobj, |
| 324 | &attr_block_size_bytes.attr); | 322 | &class_attr_block_size_bytes.attr); |
| 325 | } | 323 | } |
| 326 | 324 | ||
| 327 | /* | 325 | /* |
| @@ -332,9 +330,7 @@ static int block_size_init(void) | |||
| 332 | */ | 330 | */ |
| 333 | #ifdef CONFIG_ARCH_MEMORY_PROBE | 331 | #ifdef CONFIG_ARCH_MEMORY_PROBE |
| 334 | static ssize_t | 332 | static ssize_t |
| 335 | memory_probe_store(struct sysdev_class *class, | 333 | memory_probe_store(struct class *class, const char *buf, size_t count) |
| 336 | struct sysdev_class_attribute *class_attr, | ||
| 337 | const char *buf, size_t count) | ||
| 338 | { | 334 | { |
| 339 | u64 phys_addr; | 335 | u64 phys_addr; |
| 340 | int nid; | 336 | int nid; |
| @@ -350,12 +346,12 @@ memory_probe_store(struct sysdev_class *class, | |||
| 350 | 346 | ||
| 351 | return count; | 347 | return count; |
| 352 | } | 348 | } |
| 353 | static SYSDEV_CLASS_ATTR(probe, S_IWUSR, NULL, memory_probe_store); | 349 | static CLASS_ATTR(probe, S_IWUSR, NULL, memory_probe_store); |
| 354 | 350 | ||
| 355 | static int memory_probe_init(void) | 351 | static int memory_probe_init(void) |
| 356 | { | 352 | { |
| 357 | return sysfs_create_file(&memory_sysdev_class.kset.kobj, | 353 | return sysfs_create_file(&memory_sysdev_class.kset.kobj, |
| 358 | &attr_probe.attr); | 354 | &class_attr_probe.attr); |
| 359 | } | 355 | } |
| 360 | #else | 356 | #else |
| 361 | static inline int memory_probe_init(void) | 357 | static inline int memory_probe_init(void) |
| @@ -371,9 +367,7 @@ static inline int memory_probe_init(void) | |||
| 371 | 367 | ||
| 372 | /* Soft offline a page */ | 368 | /* Soft offline a page */ |
| 373 | static ssize_t | 369 | static ssize_t |
| 374 | store_soft_offline_page(struct sysdev_class *class, | 370 | store_soft_offline_page(struct class *class, const char *buf, size_t count) |
| 375 | struct sysdev_class_attribute *class_attr, | ||
| 376 | const char *buf, size_t count) | ||
| 377 | { | 371 | { |
| 378 | int ret; | 372 | int ret; |
| 379 | u64 pfn; | 373 | u64 pfn; |
| @@ -390,9 +384,7 @@ store_soft_offline_page(struct sysdev_class *class, | |||
| 390 | 384 | ||
| 391 | /* Forcibly offline a page, including killing processes. */ | 385 | /* Forcibly offline a page, including killing processes. */ |
| 392 | static ssize_t | 386 | static ssize_t |
| 393 | store_hard_offline_page(struct sysdev_class *class, | 387 | store_hard_offline_page(struct class *class, const char *buf, size_t count) |
| 394 | struct sysdev_class_attribute *class_attr, | ||
| 395 | const char *buf, size_t count) | ||
| 396 | { | 388 | { |
| 397 | int ret; | 389 | int ret; |
| 398 | u64 pfn; | 390 | u64 pfn; |
| @@ -405,18 +397,18 @@ store_hard_offline_page(struct sysdev_class *class, | |||
| 405 | return ret ? ret : count; | 397 | return ret ? ret : count; |
| 406 | } | 398 | } |
| 407 | 399 | ||
| 408 | static SYSDEV_CLASS_ATTR(soft_offline_page, 0644, NULL, store_soft_offline_page); | 400 | static CLASS_ATTR(soft_offline_page, 0644, NULL, store_soft_offline_page); |
| 409 | static SYSDEV_CLASS_ATTR(hard_offline_page, 0644, NULL, store_hard_offline_page); | 401 | static CLASS_ATTR(hard_offline_page, 0644, NULL, store_hard_offline_page); |
| 410 | 402 | ||
| 411 | static __init int memory_fail_init(void) | 403 | static __init int memory_fail_init(void) |
| 412 | { | 404 | { |
| 413 | int err; | 405 | int err; |
| 414 | 406 | ||
| 415 | err = sysfs_create_file(&memory_sysdev_class.kset.kobj, | 407 | err = sysfs_create_file(&memory_sysdev_class.kset.kobj, |
| 416 | &attr_soft_offline_page.attr); | 408 | &class_attr_soft_offline_page.attr); |
| 417 | if (!err) | 409 | if (!err) |
| 418 | err = sysfs_create_file(&memory_sysdev_class.kset.kobj, | 410 | err = sysfs_create_file(&memory_sysdev_class.kset.kobj, |
| 419 | &attr_hard_offline_page.attr); | 411 | &class_attr_hard_offline_page.attr); |
| 420 | return err; | 412 | return err; |
| 421 | } | 413 | } |
| 422 | #else | 414 | #else |
diff --git a/drivers/block/drbd/Kconfig b/drivers/block/drbd/Kconfig index f4acd04ebeef..df0983787390 100644 --- a/drivers/block/drbd/Kconfig +++ b/drivers/block/drbd/Kconfig | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | # | 3 | # |
| 4 | 4 | ||
| 5 | comment "DRBD disabled because PROC_FS, INET or CONNECTOR not selected" | 5 | comment "DRBD disabled because PROC_FS, INET or CONNECTOR not selected" |
| 6 | depends on !PROC_FS || !INET || !CONNECTOR | 6 | depends on PROC_FS='n' || INET='n' || CONNECTOR='n' |
| 7 | 7 | ||
| 8 | config BLK_DEV_DRBD | 8 | config BLK_DEV_DRBD |
| 9 | tristate "DRBD Distributed Replicated Block Device support" | 9 | tristate "DRBD Distributed Replicated Block Device support" |
diff --git a/drivers/block/drbd/drbd_int.h b/drivers/block/drbd/drbd_int.h index c97558763430..2bf3a6ef3684 100644 --- a/drivers/block/drbd/drbd_int.h +++ b/drivers/block/drbd/drbd_int.h | |||
| @@ -1275,7 +1275,7 @@ struct bm_extent { | |||
| 1275 | #if DRBD_MAX_SECTORS_BM < DRBD_MAX_SECTORS_32 | 1275 | #if DRBD_MAX_SECTORS_BM < DRBD_MAX_SECTORS_32 |
| 1276 | #define DRBD_MAX_SECTORS DRBD_MAX_SECTORS_BM | 1276 | #define DRBD_MAX_SECTORS DRBD_MAX_SECTORS_BM |
| 1277 | #define DRBD_MAX_SECTORS_FLEX DRBD_MAX_SECTORS_BM | 1277 | #define DRBD_MAX_SECTORS_FLEX DRBD_MAX_SECTORS_BM |
| 1278 | #elif !defined(CONFIG_LBD) && BITS_PER_LONG == 32 | 1278 | #elif !defined(CONFIG_LBDAF) && BITS_PER_LONG == 32 |
| 1279 | #define DRBD_MAX_SECTORS DRBD_MAX_SECTORS_32 | 1279 | #define DRBD_MAX_SECTORS DRBD_MAX_SECTORS_32 |
| 1280 | #define DRBD_MAX_SECTORS_FLEX DRBD_MAX_SECTORS_32 | 1280 | #define DRBD_MAX_SECTORS_FLEX DRBD_MAX_SECTORS_32 |
| 1281 | #else | 1281 | #else |
| @@ -1371,10 +1371,9 @@ extern int is_valid_ar_handle(struct drbd_request *, sector_t); | |||
| 1371 | extern void drbd_suspend_io(struct drbd_conf *mdev); | 1371 | extern void drbd_suspend_io(struct drbd_conf *mdev); |
| 1372 | extern void drbd_resume_io(struct drbd_conf *mdev); | 1372 | extern void drbd_resume_io(struct drbd_conf *mdev); |
| 1373 | extern char *ppsize(char *buf, unsigned long long size); | 1373 | extern char *ppsize(char *buf, unsigned long long size); |
| 1374 | extern sector_t drbd_new_dev_size(struct drbd_conf *, | 1374 | extern sector_t drbd_new_dev_size(struct drbd_conf *, struct drbd_backing_dev *, int); |
| 1375 | struct drbd_backing_dev *); | ||
| 1376 | enum determine_dev_size { dev_size_error = -1, unchanged = 0, shrunk = 1, grew = 2 }; | 1375 | enum determine_dev_size { dev_size_error = -1, unchanged = 0, shrunk = 1, grew = 2 }; |
| 1377 | extern enum determine_dev_size drbd_determin_dev_size(struct drbd_conf *) __must_hold(local); | 1376 | extern enum determine_dev_size drbd_determin_dev_size(struct drbd_conf *, int force) __must_hold(local); |
| 1378 | extern void resync_after_online_grow(struct drbd_conf *); | 1377 | extern void resync_after_online_grow(struct drbd_conf *); |
| 1379 | extern void drbd_setup_queue_param(struct drbd_conf *mdev, unsigned int) __must_hold(local); | 1378 | extern void drbd_setup_queue_param(struct drbd_conf *mdev, unsigned int) __must_hold(local); |
| 1380 | extern int drbd_set_role(struct drbd_conf *mdev, enum drbd_role new_role, | 1379 | extern int drbd_set_role(struct drbd_conf *mdev, enum drbd_role new_role, |
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c index 9348f33f6242..e898ad9eb1c3 100644 --- a/drivers/block/drbd/drbd_main.c +++ b/drivers/block/drbd/drbd_main.c | |||
| @@ -1298,6 +1298,7 @@ static void after_state_ch(struct drbd_conf *mdev, union drbd_state os, | |||
| 1298 | dev_err(DEV, "Sending state in drbd_io_error() failed\n"); | 1298 | dev_err(DEV, "Sending state in drbd_io_error() failed\n"); |
| 1299 | } | 1299 | } |
| 1300 | 1300 | ||
| 1301 | wait_event(mdev->misc_wait, !atomic_read(&mdev->local_cnt)); | ||
| 1301 | lc_destroy(mdev->resync); | 1302 | lc_destroy(mdev->resync); |
| 1302 | mdev->resync = NULL; | 1303 | mdev->resync = NULL; |
| 1303 | lc_destroy(mdev->act_log); | 1304 | lc_destroy(mdev->act_log); |
diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c index 4e0726aa53b0..1292e0620663 100644 --- a/drivers/block/drbd/drbd_nl.c +++ b/drivers/block/drbd/drbd_nl.c | |||
| @@ -510,7 +510,7 @@ void drbd_resume_io(struct drbd_conf *mdev) | |||
| 510 | * Returns 0 on success, negative return values indicate errors. | 510 | * Returns 0 on success, negative return values indicate errors. |
| 511 | * You should call drbd_md_sync() after calling this function. | 511 | * You should call drbd_md_sync() after calling this function. |
| 512 | */ | 512 | */ |
| 513 | enum determine_dev_size drbd_determin_dev_size(struct drbd_conf *mdev) __must_hold(local) | 513 | enum determine_dev_size drbd_determin_dev_size(struct drbd_conf *mdev, int force) __must_hold(local) |
| 514 | { | 514 | { |
| 515 | sector_t prev_first_sect, prev_size; /* previous meta location */ | 515 | sector_t prev_first_sect, prev_size; /* previous meta location */ |
| 516 | sector_t la_size; | 516 | sector_t la_size; |
| @@ -541,7 +541,7 @@ enum determine_dev_size drbd_determin_dev_size(struct drbd_conf *mdev) __must_ho | |||
| 541 | /* TODO: should only be some assert here, not (re)init... */ | 541 | /* TODO: should only be some assert here, not (re)init... */ |
| 542 | drbd_md_set_sector_offsets(mdev, mdev->ldev); | 542 | drbd_md_set_sector_offsets(mdev, mdev->ldev); |
| 543 | 543 | ||
| 544 | size = drbd_new_dev_size(mdev, mdev->ldev); | 544 | size = drbd_new_dev_size(mdev, mdev->ldev, force); |
| 545 | 545 | ||
| 546 | if (drbd_get_capacity(mdev->this_bdev) != size || | 546 | if (drbd_get_capacity(mdev->this_bdev) != size || |
| 547 | drbd_bm_capacity(mdev) != size) { | 547 | drbd_bm_capacity(mdev) != size) { |
| @@ -596,7 +596,7 @@ out: | |||
| 596 | } | 596 | } |
| 597 | 597 | ||
| 598 | sector_t | 598 | sector_t |
| 599 | drbd_new_dev_size(struct drbd_conf *mdev, struct drbd_backing_dev *bdev) | 599 | drbd_new_dev_size(struct drbd_conf *mdev, struct drbd_backing_dev *bdev, int assume_peer_has_space) |
| 600 | { | 600 | { |
| 601 | sector_t p_size = mdev->p_size; /* partner's disk size. */ | 601 | sector_t p_size = mdev->p_size; /* partner's disk size. */ |
| 602 | sector_t la_size = bdev->md.la_size_sect; /* last agreed size. */ | 602 | sector_t la_size = bdev->md.la_size_sect; /* last agreed size. */ |
| @@ -606,6 +606,11 @@ drbd_new_dev_size(struct drbd_conf *mdev, struct drbd_backing_dev *bdev) | |||
| 606 | 606 | ||
| 607 | m_size = drbd_get_max_capacity(bdev); | 607 | m_size = drbd_get_max_capacity(bdev); |
| 608 | 608 | ||
| 609 | if (mdev->state.conn < C_CONNECTED && assume_peer_has_space) { | ||
| 610 | dev_warn(DEV, "Resize while not connected was forced by the user!\n"); | ||
| 611 | p_size = m_size; | ||
| 612 | } | ||
| 613 | |||
| 609 | if (p_size && m_size) { | 614 | if (p_size && m_size) { |
| 610 | size = min_t(sector_t, p_size, m_size); | 615 | size = min_t(sector_t, p_size, m_size); |
| 611 | } else { | 616 | } else { |
| @@ -965,7 +970,7 @@ static int drbd_nl_disk_conf(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp | |||
| 965 | 970 | ||
| 966 | /* Prevent shrinking of consistent devices ! */ | 971 | /* Prevent shrinking of consistent devices ! */ |
| 967 | if (drbd_md_test_flag(nbc, MDF_CONSISTENT) && | 972 | if (drbd_md_test_flag(nbc, MDF_CONSISTENT) && |
| 968 | drbd_new_dev_size(mdev, nbc) < nbc->md.la_size_sect) { | 973 | drbd_new_dev_size(mdev, nbc, 0) < nbc->md.la_size_sect) { |
| 969 | dev_warn(DEV, "refusing to truncate a consistent device\n"); | 974 | dev_warn(DEV, "refusing to truncate a consistent device\n"); |
| 970 | retcode = ERR_DISK_TO_SMALL; | 975 | retcode = ERR_DISK_TO_SMALL; |
| 971 | goto force_diskless_dec; | 976 | goto force_diskless_dec; |
| @@ -1052,7 +1057,7 @@ static int drbd_nl_disk_conf(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp | |||
| 1052 | !drbd_md_test_flag(mdev->ldev, MDF_CONNECTED_IND)) | 1057 | !drbd_md_test_flag(mdev->ldev, MDF_CONNECTED_IND)) |
| 1053 | set_bit(USE_DEGR_WFC_T, &mdev->flags); | 1058 | set_bit(USE_DEGR_WFC_T, &mdev->flags); |
| 1054 | 1059 | ||
| 1055 | dd = drbd_determin_dev_size(mdev); | 1060 | dd = drbd_determin_dev_size(mdev, 0); |
| 1056 | if (dd == dev_size_error) { | 1061 | if (dd == dev_size_error) { |
| 1057 | retcode = ERR_NOMEM_BITMAP; | 1062 | retcode = ERR_NOMEM_BITMAP; |
| 1058 | goto force_diskless_dec; | 1063 | goto force_diskless_dec; |
| @@ -1271,7 +1276,7 @@ static int drbd_nl_net_conf(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp, | |||
| 1271 | goto fail; | 1276 | goto fail; |
| 1272 | } | 1277 | } |
| 1273 | 1278 | ||
| 1274 | if (crypto_tfm_alg_type(crypto_hash_tfm(tfm)) != CRYPTO_ALG_TYPE_SHASH) { | 1279 | if (!drbd_crypto_is_hash(crypto_hash_tfm(tfm))) { |
| 1275 | retcode = ERR_AUTH_ALG_ND; | 1280 | retcode = ERR_AUTH_ALG_ND; |
| 1276 | goto fail; | 1281 | goto fail; |
| 1277 | } | 1282 | } |
| @@ -1504,7 +1509,7 @@ static int drbd_nl_resize(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp, | |||
| 1504 | } | 1509 | } |
| 1505 | 1510 | ||
| 1506 | mdev->ldev->dc.disk_size = (sector_t)rs.resize_size; | 1511 | mdev->ldev->dc.disk_size = (sector_t)rs.resize_size; |
| 1507 | dd = drbd_determin_dev_size(mdev); | 1512 | dd = drbd_determin_dev_size(mdev, rs.resize_force); |
| 1508 | drbd_md_sync(mdev); | 1513 | drbd_md_sync(mdev); |
| 1509 | put_ldev(mdev); | 1514 | put_ldev(mdev); |
| 1510 | if (dd == dev_size_error) { | 1515 | if (dd == dev_size_error) { |
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c index 259c1351b152..f22a5283128a 100644 --- a/drivers/block/drbd/drbd_receiver.c +++ b/drivers/block/drbd/drbd_receiver.c | |||
| @@ -878,9 +878,13 @@ retry: | |||
| 878 | 878 | ||
| 879 | if (mdev->cram_hmac_tfm) { | 879 | if (mdev->cram_hmac_tfm) { |
| 880 | /* drbd_request_state(mdev, NS(conn, WFAuth)); */ | 880 | /* drbd_request_state(mdev, NS(conn, WFAuth)); */ |
| 881 | if (!drbd_do_auth(mdev)) { | 881 | switch (drbd_do_auth(mdev)) { |
| 882 | case -1: | ||
| 882 | dev_err(DEV, "Authentication of peer failed\n"); | 883 | dev_err(DEV, "Authentication of peer failed\n"); |
| 883 | return -1; | 884 | return -1; |
| 885 | case 0: | ||
| 886 | dev_err(DEV, "Authentication of peer failed, trying again.\n"); | ||
| 887 | return 0; | ||
| 884 | } | 888 | } |
| 885 | } | 889 | } |
| 886 | 890 | ||
| @@ -1201,10 +1205,11 @@ static int receive_Barrier(struct drbd_conf *mdev, struct p_header *h) | |||
| 1201 | 1205 | ||
| 1202 | case WO_bdev_flush: | 1206 | case WO_bdev_flush: |
| 1203 | case WO_drain_io: | 1207 | case WO_drain_io: |
| 1204 | D_ASSERT(rv == FE_STILL_LIVE); | 1208 | if (rv == FE_STILL_LIVE) { |
| 1205 | set_bit(DE_BARRIER_IN_NEXT_EPOCH_ISSUED, &mdev->current_epoch->flags); | 1209 | set_bit(DE_BARRIER_IN_NEXT_EPOCH_ISSUED, &mdev->current_epoch->flags); |
| 1206 | drbd_wait_ee_list_empty(mdev, &mdev->active_ee); | 1210 | drbd_wait_ee_list_empty(mdev, &mdev->active_ee); |
| 1207 | rv = drbd_flush_after_epoch(mdev, mdev->current_epoch); | 1211 | rv = drbd_flush_after_epoch(mdev, mdev->current_epoch); |
| 1212 | } | ||
| 1208 | if (rv == FE_RECYCLED) | 1213 | if (rv == FE_RECYCLED) |
| 1209 | return TRUE; | 1214 | return TRUE; |
| 1210 | 1215 | ||
| @@ -2865,7 +2870,7 @@ static int receive_sizes(struct drbd_conf *mdev, struct p_header *h) | |||
| 2865 | 2870 | ||
| 2866 | /* Never shrink a device with usable data during connect. | 2871 | /* Never shrink a device with usable data during connect. |
| 2867 | But allow online shrinking if we are connected. */ | 2872 | But allow online shrinking if we are connected. */ |
| 2868 | if (drbd_new_dev_size(mdev, mdev->ldev) < | 2873 | if (drbd_new_dev_size(mdev, mdev->ldev, 0) < |
| 2869 | drbd_get_capacity(mdev->this_bdev) && | 2874 | drbd_get_capacity(mdev->this_bdev) && |
| 2870 | mdev->state.disk >= D_OUTDATED && | 2875 | mdev->state.disk >= D_OUTDATED && |
| 2871 | mdev->state.conn < C_CONNECTED) { | 2876 | mdev->state.conn < C_CONNECTED) { |
| @@ -2880,7 +2885,7 @@ static int receive_sizes(struct drbd_conf *mdev, struct p_header *h) | |||
| 2880 | #undef min_not_zero | 2885 | #undef min_not_zero |
| 2881 | 2886 | ||
| 2882 | if (get_ldev(mdev)) { | 2887 | if (get_ldev(mdev)) { |
| 2883 | dd = drbd_determin_dev_size(mdev); | 2888 | dd = drbd_determin_dev_size(mdev, 0); |
| 2884 | put_ldev(mdev); | 2889 | put_ldev(mdev); |
| 2885 | if (dd == dev_size_error) | 2890 | if (dd == dev_size_error) |
| 2886 | return FALSE; | 2891 | return FALSE; |
| @@ -3830,10 +3835,17 @@ static int drbd_do_auth(struct drbd_conf *mdev) | |||
| 3830 | { | 3835 | { |
| 3831 | dev_err(DEV, "This kernel was build without CONFIG_CRYPTO_HMAC.\n"); | 3836 | dev_err(DEV, "This kernel was build without CONFIG_CRYPTO_HMAC.\n"); |
| 3832 | dev_err(DEV, "You need to disable 'cram-hmac-alg' in drbd.conf.\n"); | 3837 | dev_err(DEV, "You need to disable 'cram-hmac-alg' in drbd.conf.\n"); |
| 3833 | return 0; | 3838 | return -1; |
| 3834 | } | 3839 | } |
| 3835 | #else | 3840 | #else |
| 3836 | #define CHALLENGE_LEN 64 | 3841 | #define CHALLENGE_LEN 64 |
| 3842 | |||
| 3843 | /* Return value: | ||
| 3844 | 1 - auth succeeded, | ||
| 3845 | 0 - failed, try again (network error), | ||
| 3846 | -1 - auth failed, don't try again. | ||
| 3847 | */ | ||
| 3848 | |||
| 3837 | static int drbd_do_auth(struct drbd_conf *mdev) | 3849 | static int drbd_do_auth(struct drbd_conf *mdev) |
| 3838 | { | 3850 | { |
| 3839 | char my_challenge[CHALLENGE_LEN]; /* 64 Bytes... */ | 3851 | char my_challenge[CHALLENGE_LEN]; /* 64 Bytes... */ |
| @@ -3854,7 +3866,7 @@ static int drbd_do_auth(struct drbd_conf *mdev) | |||
| 3854 | (u8 *)mdev->net_conf->shared_secret, key_len); | 3866 | (u8 *)mdev->net_conf->shared_secret, key_len); |
| 3855 | if (rv) { | 3867 | if (rv) { |
| 3856 | dev_err(DEV, "crypto_hash_setkey() failed with %d\n", rv); | 3868 | dev_err(DEV, "crypto_hash_setkey() failed with %d\n", rv); |
| 3857 | rv = 0; | 3869 | rv = -1; |
| 3858 | goto fail; | 3870 | goto fail; |
| 3859 | } | 3871 | } |
| 3860 | 3872 | ||
| @@ -3877,14 +3889,14 @@ static int drbd_do_auth(struct drbd_conf *mdev) | |||
| 3877 | 3889 | ||
| 3878 | if (p.length > CHALLENGE_LEN*2) { | 3890 | if (p.length > CHALLENGE_LEN*2) { |
| 3879 | dev_err(DEV, "expected AuthChallenge payload too big.\n"); | 3891 | dev_err(DEV, "expected AuthChallenge payload too big.\n"); |
| 3880 | rv = 0; | 3892 | rv = -1; |
| 3881 | goto fail; | 3893 | goto fail; |
| 3882 | } | 3894 | } |
| 3883 | 3895 | ||
| 3884 | peers_ch = kmalloc(p.length, GFP_NOIO); | 3896 | peers_ch = kmalloc(p.length, GFP_NOIO); |
| 3885 | if (peers_ch == NULL) { | 3897 | if (peers_ch == NULL) { |
| 3886 | dev_err(DEV, "kmalloc of peers_ch failed\n"); | 3898 | dev_err(DEV, "kmalloc of peers_ch failed\n"); |
| 3887 | rv = 0; | 3899 | rv = -1; |
| 3888 | goto fail; | 3900 | goto fail; |
| 3889 | } | 3901 | } |
| 3890 | 3902 | ||
| @@ -3900,7 +3912,7 @@ static int drbd_do_auth(struct drbd_conf *mdev) | |||
| 3900 | response = kmalloc(resp_size, GFP_NOIO); | 3912 | response = kmalloc(resp_size, GFP_NOIO); |
| 3901 | if (response == NULL) { | 3913 | if (response == NULL) { |
| 3902 | dev_err(DEV, "kmalloc of response failed\n"); | 3914 | dev_err(DEV, "kmalloc of response failed\n"); |
| 3903 | rv = 0; | 3915 | rv = -1; |
| 3904 | goto fail; | 3916 | goto fail; |
| 3905 | } | 3917 | } |
| 3906 | 3918 | ||
| @@ -3910,7 +3922,7 @@ static int drbd_do_auth(struct drbd_conf *mdev) | |||
| 3910 | rv = crypto_hash_digest(&desc, &sg, sg.length, response); | 3922 | rv = crypto_hash_digest(&desc, &sg, sg.length, response); |
| 3911 | if (rv) { | 3923 | if (rv) { |
| 3912 | dev_err(DEV, "crypto_hash_digest() failed with %d\n", rv); | 3924 | dev_err(DEV, "crypto_hash_digest() failed with %d\n", rv); |
| 3913 | rv = 0; | 3925 | rv = -1; |
| 3914 | goto fail; | 3926 | goto fail; |
| 3915 | } | 3927 | } |
| 3916 | 3928 | ||
| @@ -3944,9 +3956,9 @@ static int drbd_do_auth(struct drbd_conf *mdev) | |||
| 3944 | } | 3956 | } |
| 3945 | 3957 | ||
| 3946 | right_response = kmalloc(resp_size, GFP_NOIO); | 3958 | right_response = kmalloc(resp_size, GFP_NOIO); |
| 3947 | if (response == NULL) { | 3959 | if (right_response == NULL) { |
| 3948 | dev_err(DEV, "kmalloc of right_response failed\n"); | 3960 | dev_err(DEV, "kmalloc of right_response failed\n"); |
| 3949 | rv = 0; | 3961 | rv = -1; |
| 3950 | goto fail; | 3962 | goto fail; |
| 3951 | } | 3963 | } |
| 3952 | 3964 | ||
| @@ -3955,7 +3967,7 @@ static int drbd_do_auth(struct drbd_conf *mdev) | |||
| 3955 | rv = crypto_hash_digest(&desc, &sg, sg.length, right_response); | 3967 | rv = crypto_hash_digest(&desc, &sg, sg.length, right_response); |
| 3956 | if (rv) { | 3968 | if (rv) { |
| 3957 | dev_err(DEV, "crypto_hash_digest() failed with %d\n", rv); | 3969 | dev_err(DEV, "crypto_hash_digest() failed with %d\n", rv); |
| 3958 | rv = 0; | 3970 | rv = -1; |
| 3959 | goto fail; | 3971 | goto fail; |
| 3960 | } | 3972 | } |
| 3961 | 3973 | ||
| @@ -3964,6 +3976,8 @@ static int drbd_do_auth(struct drbd_conf *mdev) | |||
| 3964 | if (rv) | 3976 | if (rv) |
| 3965 | dev_info(DEV, "Peer authenticated using %d bytes of '%s' HMAC\n", | 3977 | dev_info(DEV, "Peer authenticated using %d bytes of '%s' HMAC\n", |
| 3966 | resp_size, mdev->net_conf->cram_hmac_alg); | 3978 | resp_size, mdev->net_conf->cram_hmac_alg); |
| 3979 | else | ||
| 3980 | rv = -1; | ||
| 3967 | 3981 | ||
| 3968 | fail: | 3982 | fail: |
| 3969 | kfree(peers_ch); | 3983 | kfree(peers_ch); |
diff --git a/drivers/char/nozomi.c b/drivers/char/nozomi.c index 7d73cd430340..2ad7d37afbd0 100644 --- a/drivers/char/nozomi.c +++ b/drivers/char/nozomi.c | |||
| @@ -1651,10 +1651,10 @@ static void ntty_close(struct tty_struct *tty, struct file *file) | |||
| 1651 | 1651 | ||
| 1652 | dc->open_ttys--; | 1652 | dc->open_ttys--; |
| 1653 | port->count--; | 1653 | port->count--; |
| 1654 | tty_port_tty_set(port, NULL); | ||
| 1655 | 1654 | ||
| 1656 | if (port->count == 0) { | 1655 | if (port->count == 0) { |
| 1657 | DBG1("close: %d", nport->token_dl); | 1656 | DBG1("close: %d", nport->token_dl); |
| 1657 | tty_port_tty_set(port, NULL); | ||
| 1658 | spin_lock_irqsave(&dc->spin_mutex, flags); | 1658 | spin_lock_irqsave(&dc->spin_mutex, flags); |
| 1659 | dc->last_ier &= ~(nport->token_dl); | 1659 | dc->last_ier &= ~(nport->token_dl); |
| 1660 | writew(dc->last_ier, dc->reg_ier); | 1660 | writew(dc->last_ier, dc->reg_ier); |
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index f15df40bc318..c6f3b48be9dd 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c | |||
| @@ -1951,8 +1951,8 @@ static int tty_fasync(int fd, struct file *filp, int on) | |||
| 1951 | pid = task_pid(current); | 1951 | pid = task_pid(current); |
| 1952 | type = PIDTYPE_PID; | 1952 | type = PIDTYPE_PID; |
| 1953 | } | 1953 | } |
| 1954 | spin_unlock_irqrestore(&tty->ctrl_lock, flags); | ||
| 1955 | retval = __f_setown(filp, pid, type, 0); | 1954 | retval = __f_setown(filp, pid, type, 0); |
| 1955 | spin_unlock_irqrestore(&tty->ctrl_lock, flags); | ||
| 1956 | if (retval) | 1956 | if (retval) |
| 1957 | goto out; | 1957 | goto out; |
| 1958 | } else { | 1958 | } else { |
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index be625475cf6d..4b22feb01a0c 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c | |||
| @@ -503,16 +503,15 @@ int dm_set_device_limits(struct dm_target *ti, struct dm_dev *dev, | |||
| 503 | return 0; | 503 | return 0; |
| 504 | } | 504 | } |
| 505 | 505 | ||
| 506 | if (blk_stack_limits(limits, &q->limits, start << 9) < 0) | 506 | if (bdev_stack_limits(limits, bdev, start) < 0) |
| 507 | DMWARN("%s: target device %s is misaligned: " | 507 | DMWARN("%s: adding target device %s caused an alignment inconsistency: " |
| 508 | "physical_block_size=%u, logical_block_size=%u, " | 508 | "physical_block_size=%u, logical_block_size=%u, " |
| 509 | "alignment_offset=%u, start=%llu", | 509 | "alignment_offset=%u, start=%llu", |
| 510 | dm_device_name(ti->table->md), bdevname(bdev, b), | 510 | dm_device_name(ti->table->md), bdevname(bdev, b), |
| 511 | q->limits.physical_block_size, | 511 | q->limits.physical_block_size, |
| 512 | q->limits.logical_block_size, | 512 | q->limits.logical_block_size, |
| 513 | q->limits.alignment_offset, | 513 | q->limits.alignment_offset, |
| 514 | (unsigned long long) start << 9); | 514 | (unsigned long long) start << SECTOR_SHIFT); |
| 515 | |||
| 516 | 515 | ||
| 517 | /* | 516 | /* |
| 518 | * Check if merge fn is supported. | 517 | * Check if merge fn is supported. |
| @@ -1026,9 +1025,9 @@ combine_limits: | |||
| 1026 | * for the table. | 1025 | * for the table. |
| 1027 | */ | 1026 | */ |
| 1028 | if (blk_stack_limits(limits, &ti_limits, 0) < 0) | 1027 | if (blk_stack_limits(limits, &ti_limits, 0) < 0) |
| 1029 | DMWARN("%s: target device " | 1028 | DMWARN("%s: adding target device " |
| 1030 | "(start sect %llu len %llu) " | 1029 | "(start sect %llu len %llu) " |
| 1031 | "is misaligned", | 1030 | "caused an alignment inconsistency", |
| 1032 | dm_device_name(table->md), | 1031 | dm_device_name(table->md), |
| 1033 | (unsigned long long) ti->begin, | 1032 | (unsigned long long) ti->begin, |
| 1034 | (unsigned long long) ti->len); | 1033 | (unsigned long long) ti->len); |
| @@ -1080,15 +1079,6 @@ void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q, | |||
| 1080 | struct queue_limits *limits) | 1079 | struct queue_limits *limits) |
| 1081 | { | 1080 | { |
| 1082 | /* | 1081 | /* |
| 1083 | * Each target device in the table has a data area that should normally | ||
| 1084 | * be aligned such that the DM device's alignment_offset is 0. | ||
| 1085 | * FIXME: Propagate alignment_offsets up the stack and warn of | ||
| 1086 | * sub-optimal or inconsistent settings. | ||
| 1087 | */ | ||
| 1088 | limits->alignment_offset = 0; | ||
| 1089 | limits->misaligned = 0; | ||
| 1090 | |||
| 1091 | /* | ||
| 1092 | * Copy table's limits to the DM device's request_queue | 1082 | * Copy table's limits to the DM device's request_queue |
| 1093 | */ | 1083 | */ |
| 1094 | q->limits = *limits; | 1084 | q->limits = *limits; |
diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig index db32c25e3605..f526e735c5ab 100644 --- a/drivers/platform/x86/Kconfig +++ b/drivers/platform/x86/Kconfig | |||
| @@ -364,6 +364,7 @@ config EEEPC_LAPTOP | |||
| 364 | select HWMON | 364 | select HWMON |
| 365 | select LEDS_CLASS | 365 | select LEDS_CLASS |
| 366 | select NEW_LEDS | 366 | select NEW_LEDS |
| 367 | select INPUT_SPARSEKMAP | ||
| 367 | ---help--- | 368 | ---help--- |
| 368 | This driver supports the Fn-Fx keys on Eee PC laptops. | 369 | This driver supports the Fn-Fx keys on Eee PC laptops. |
| 369 | 370 | ||
diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c index 5838c69b2fb3..e2be6bb33d92 100644 --- a/drivers/platform/x86/eeepc-laptop.c +++ b/drivers/platform/x86/eeepc-laptop.c | |||
| @@ -31,10 +31,12 @@ | |||
| 31 | #include <acpi/acpi_bus.h> | 31 | #include <acpi/acpi_bus.h> |
| 32 | #include <linux/uaccess.h> | 32 | #include <linux/uaccess.h> |
| 33 | #include <linux/input.h> | 33 | #include <linux/input.h> |
| 34 | #include <linux/input/sparse-keymap.h> | ||
| 34 | #include <linux/rfkill.h> | 35 | #include <linux/rfkill.h> |
| 35 | #include <linux/pci.h> | 36 | #include <linux/pci.h> |
| 36 | #include <linux/pci_hotplug.h> | 37 | #include <linux/pci_hotplug.h> |
| 37 | #include <linux/leds.h> | 38 | #include <linux/leds.h> |
| 39 | #include <linux/dmi.h> | ||
| 38 | 40 | ||
| 39 | #define EEEPC_LAPTOP_VERSION "0.1" | 41 | #define EEEPC_LAPTOP_VERSION "0.1" |
| 40 | #define EEEPC_LAPTOP_NAME "Eee PC Hotkey Driver" | 42 | #define EEEPC_LAPTOP_NAME "Eee PC Hotkey Driver" |
| @@ -48,6 +50,14 @@ MODULE_AUTHOR("Corentin Chary, Eric Cooper"); | |||
| 48 | MODULE_DESCRIPTION(EEEPC_LAPTOP_NAME); | 50 | MODULE_DESCRIPTION(EEEPC_LAPTOP_NAME); |
| 49 | MODULE_LICENSE("GPL"); | 51 | MODULE_LICENSE("GPL"); |
| 50 | 52 | ||
| 53 | static bool hotplug_disabled; | ||
| 54 | |||
| 55 | module_param(hotplug_disabled, bool, 0644); | ||
| 56 | MODULE_PARM_DESC(hotplug_disabled, | ||
| 57 | "Disable hotplug for wireless device. " | ||
| 58 | "If your laptop need that, please report to " | ||
| 59 | "acpi4asus-user@lists.sourceforge.net."); | ||
| 60 | |||
| 51 | /* | 61 | /* |
| 52 | * Definitions for Asus EeePC | 62 | * Definitions for Asus EeePC |
| 53 | */ | 63 | */ |
| @@ -120,38 +130,28 @@ static const char *cm_setv[] = { | |||
| 120 | NULL, NULL, "PBPS", "TPDS" | 130 | NULL, NULL, "PBPS", "TPDS" |
| 121 | }; | 131 | }; |
| 122 | 132 | ||
| 123 | struct key_entry { | ||
| 124 | char type; | ||
| 125 | u8 code; | ||
| 126 | u16 keycode; | ||
| 127 | }; | ||
| 128 | |||
| 129 | enum { KE_KEY, KE_END }; | ||
| 130 | |||
| 131 | static const struct key_entry eeepc_keymap[] = { | 133 | static const struct key_entry eeepc_keymap[] = { |
| 132 | /* Sleep already handled via generic ACPI code */ | 134 | { KE_KEY, 0x10, { KEY_WLAN } }, |
| 133 | {KE_KEY, 0x10, KEY_WLAN }, | 135 | { KE_KEY, 0x11, { KEY_WLAN } }, |
| 134 | {KE_KEY, 0x11, KEY_WLAN }, | 136 | { KE_KEY, 0x12, { KEY_PROG1 } }, |
| 135 | {KE_KEY, 0x12, KEY_PROG1 }, | 137 | { KE_KEY, 0x13, { KEY_MUTE } }, |
| 136 | {KE_KEY, 0x13, KEY_MUTE }, | 138 | { KE_KEY, 0x14, { KEY_VOLUMEDOWN } }, |
| 137 | {KE_KEY, 0x14, KEY_VOLUMEDOWN }, | 139 | { KE_KEY, 0x15, { KEY_VOLUMEUP } }, |
| 138 | {KE_KEY, 0x15, KEY_VOLUMEUP }, | 140 | { KE_KEY, 0x16, { KEY_DISPLAY_OFF } }, |
| 139 | {KE_KEY, 0x16, KEY_DISPLAY_OFF }, | 141 | { KE_KEY, 0x1a, { KEY_COFFEE } }, |
| 140 | {KE_KEY, 0x1a, KEY_COFFEE }, | 142 | { KE_KEY, 0x1b, { KEY_ZOOM } }, |
| 141 | {KE_KEY, 0x1b, KEY_ZOOM }, | 143 | { KE_KEY, 0x1c, { KEY_PROG2 } }, |
| 142 | {KE_KEY, 0x1c, KEY_PROG2 }, | 144 | { KE_KEY, 0x1d, { KEY_PROG3 } }, |
| 143 | {KE_KEY, 0x1d, KEY_PROG3 }, | 145 | { KE_KEY, NOTIFY_BRN_MIN, { KEY_BRIGHTNESSDOWN } }, |
| 144 | {KE_KEY, NOTIFY_BRN_MIN, KEY_BRIGHTNESSDOWN }, | 146 | { KE_KEY, NOTIFY_BRN_MAX, { KEY_BRIGHTNESSUP } }, |
| 145 | {KE_KEY, NOTIFY_BRN_MAX, KEY_BRIGHTNESSUP }, | 147 | { KE_KEY, 0x30, { KEY_SWITCHVIDEOMODE } }, |
| 146 | {KE_KEY, 0x30, KEY_SWITCHVIDEOMODE }, | 148 | { KE_KEY, 0x31, { KEY_SWITCHVIDEOMODE } }, |
| 147 | {KE_KEY, 0x31, KEY_SWITCHVIDEOMODE }, | 149 | { KE_KEY, 0x32, { KEY_SWITCHVIDEOMODE } }, |
| 148 | {KE_KEY, 0x32, KEY_SWITCHVIDEOMODE }, | 150 | { KE_KEY, 0x37, { KEY_F13 } }, /* Disable Touchpad */ |
| 149 | {KE_KEY, 0x37, KEY_F13 }, /* Disable Touchpad */ | 151 | { KE_KEY, 0x38, { KEY_F14 } }, |
| 150 | {KE_KEY, 0x38, KEY_F14 }, | 152 | { KE_END, 0 }, |
| 151 | {KE_END, 0}, | ||
| 152 | }; | 153 | }; |
| 153 | 154 | ||
| 154 | |||
| 155 | /* | 155 | /* |
| 156 | * This is the main structure, we can use it to store useful information | 156 | * This is the main structure, we can use it to store useful information |
| 157 | */ | 157 | */ |
| @@ -159,6 +159,8 @@ struct eeepc_laptop { | |||
| 159 | acpi_handle handle; /* the handle of the acpi device */ | 159 | acpi_handle handle; /* the handle of the acpi device */ |
| 160 | u32 cm_supported; /* the control methods supported | 160 | u32 cm_supported; /* the control methods supported |
| 161 | by this BIOS */ | 161 | by this BIOS */ |
| 162 | bool cpufv_disabled; | ||
| 163 | bool hotplug_disabled; | ||
| 162 | u16 event_count[128]; /* count for each event */ | 164 | u16 event_count[128]; /* count for each event */ |
| 163 | 165 | ||
| 164 | struct platform_device *platform_device; | 166 | struct platform_device *platform_device; |
| @@ -378,6 +380,8 @@ static ssize_t store_cpufv(struct device *dev, | |||
| 378 | struct eeepc_cpufv c; | 380 | struct eeepc_cpufv c; |
| 379 | int rv, value; | 381 | int rv, value; |
| 380 | 382 | ||
| 383 | if (eeepc->cpufv_disabled) | ||
| 384 | return -EPERM; | ||
| 381 | if (get_cpufv(eeepc, &c)) | 385 | if (get_cpufv(eeepc, &c)) |
| 382 | return -ENODEV; | 386 | return -ENODEV; |
| 383 | rv = parse_arg(buf, count, &value); | 387 | rv = parse_arg(buf, count, &value); |
| @@ -389,6 +393,41 @@ static ssize_t store_cpufv(struct device *dev, | |||
| 389 | return rv; | 393 | return rv; |
| 390 | } | 394 | } |
| 391 | 395 | ||
| 396 | static ssize_t show_cpufv_disabled(struct device *dev, | ||
| 397 | struct device_attribute *attr, | ||
| 398 | char *buf) | ||
| 399 | { | ||
| 400 | struct eeepc_laptop *eeepc = dev_get_drvdata(dev); | ||
| 401 | |||
| 402 | return sprintf(buf, "%d\n", eeepc->cpufv_disabled); | ||
| 403 | } | ||
| 404 | |||
| 405 | static ssize_t store_cpufv_disabled(struct device *dev, | ||
| 406 | struct device_attribute *attr, | ||
| 407 | const char *buf, size_t count) | ||
| 408 | { | ||
| 409 | struct eeepc_laptop *eeepc = dev_get_drvdata(dev); | ||
| 410 | int rv, value; | ||
| 411 | |||
| 412 | rv = parse_arg(buf, count, &value); | ||
| 413 | if (rv < 0) | ||
| 414 | return rv; | ||
| 415 | |||
| 416 | switch (value) { | ||
| 417 | case 0: | ||
| 418 | if (eeepc->cpufv_disabled) | ||
| 419 | pr_warning("cpufv enabled (not officially supported " | ||
| 420 | "on this model)\n"); | ||
| 421 | eeepc->cpufv_disabled = false; | ||
| 422 | return rv; | ||
| 423 | case 1: | ||
| 424 | return -EPERM; | ||
| 425 | default: | ||
| 426 | return -EINVAL; | ||
| 427 | } | ||
| 428 | } | ||
| 429 | |||
| 430 | |||
| 392 | static struct device_attribute dev_attr_cpufv = { | 431 | static struct device_attribute dev_attr_cpufv = { |
| 393 | .attr = { | 432 | .attr = { |
| 394 | .name = "cpufv", | 433 | .name = "cpufv", |
| @@ -404,12 +443,22 @@ static struct device_attribute dev_attr_available_cpufv = { | |||
| 404 | .show = show_available_cpufv | 443 | .show = show_available_cpufv |
| 405 | }; | 444 | }; |
| 406 | 445 | ||
| 446 | static struct device_attribute dev_attr_cpufv_disabled = { | ||
| 447 | .attr = { | ||
| 448 | .name = "cpufv_disabled", | ||
| 449 | .mode = 0644 }, | ||
| 450 | .show = show_cpufv_disabled, | ||
| 451 | .store = store_cpufv_disabled | ||
| 452 | }; | ||
| 453 | |||
| 454 | |||
| 407 | static struct attribute *platform_attributes[] = { | 455 | static struct attribute *platform_attributes[] = { |
| 408 | &dev_attr_camera.attr, | 456 | &dev_attr_camera.attr, |
| 409 | &dev_attr_cardr.attr, | 457 | &dev_attr_cardr.attr, |
| 410 | &dev_attr_disp.attr, | 458 | &dev_attr_disp.attr, |
| 411 | &dev_attr_cpufv.attr, | 459 | &dev_attr_cpufv.attr, |
| 412 | &dev_attr_available_cpufv.attr, | 460 | &dev_attr_available_cpufv.attr, |
| 461 | &dev_attr_cpufv_disabled.attr, | ||
| 413 | NULL | 462 | NULL |
| 414 | }; | 463 | }; |
| 415 | 464 | ||
| @@ -796,6 +845,9 @@ static int eeepc_rfkill_init(struct eeepc_laptop *eeepc) | |||
| 796 | if (result && result != -ENODEV) | 845 | if (result && result != -ENODEV) |
| 797 | goto exit; | 846 | goto exit; |
| 798 | 847 | ||
| 848 | if (eeepc->hotplug_disabled) | ||
| 849 | return 0; | ||
| 850 | |||
| 799 | result = eeepc_setup_pci_hotplug(eeepc); | 851 | result = eeepc_setup_pci_hotplug(eeepc); |
| 800 | /* | 852 | /* |
| 801 | * If we get -EBUSY then something else is handling the PCI hotplug - | 853 | * If we get -EBUSY then something else is handling the PCI hotplug - |
| @@ -1090,120 +1142,42 @@ static void eeepc_backlight_exit(struct eeepc_laptop *eeepc) | |||
| 1090 | /* | 1142 | /* |
| 1091 | * Input device (i.e. hotkeys) | 1143 | * Input device (i.e. hotkeys) |
| 1092 | */ | 1144 | */ |
| 1093 | static struct key_entry *eeepc_get_entry_by_scancode( | 1145 | static int eeepc_input_init(struct eeepc_laptop *eeepc) |
| 1094 | struct eeepc_laptop *eeepc, | ||
| 1095 | int code) | ||
| 1096 | { | 1146 | { |
| 1097 | struct key_entry *key; | 1147 | struct input_dev *input; |
| 1148 | int error; | ||
| 1098 | 1149 | ||
| 1099 | for (key = eeepc->keymap; key->type != KE_END; key++) | 1150 | input = input_allocate_device(); |
| 1100 | if (code == key->code) | 1151 | if (!input) { |
| 1101 | return key; | 1152 | pr_info("Unable to allocate input device\n"); |
| 1102 | 1153 | return -ENOMEM; | |
| 1103 | return NULL; | ||
| 1104 | } | ||
| 1105 | |||
| 1106 | static void eeepc_input_notify(struct eeepc_laptop *eeepc, int event) | ||
| 1107 | { | ||
| 1108 | static struct key_entry *key; | ||
| 1109 | |||
| 1110 | key = eeepc_get_entry_by_scancode(eeepc, event); | ||
| 1111 | if (key) { | ||
| 1112 | switch (key->type) { | ||
| 1113 | case KE_KEY: | ||
| 1114 | input_report_key(eeepc->inputdev, key->keycode, | ||
| 1115 | 1); | ||
| 1116 | input_sync(eeepc->inputdev); | ||
| 1117 | input_report_key(eeepc->inputdev, key->keycode, | ||
| 1118 | 0); | ||
| 1119 | input_sync(eeepc->inputdev); | ||
| 1120 | break; | ||
| 1121 | } | ||
| 1122 | } | 1154 | } |
| 1123 | } | ||
| 1124 | |||
| 1125 | static struct key_entry *eeepc_get_entry_by_keycode( | ||
| 1126 | struct eeepc_laptop *eeepc, int code) | ||
| 1127 | { | ||
| 1128 | struct key_entry *key; | ||
| 1129 | |||
| 1130 | for (key = eeepc->keymap; key->type != KE_END; key++) | ||
| 1131 | if (code == key->keycode && key->type == KE_KEY) | ||
| 1132 | return key; | ||
| 1133 | 1155 | ||
| 1134 | return NULL; | 1156 | input->name = "Asus EeePC extra buttons"; |
| 1135 | } | 1157 | input->phys = EEEPC_LAPTOP_FILE "/input0"; |
| 1158 | input->id.bustype = BUS_HOST; | ||
| 1159 | input->dev.parent = &eeepc->platform_device->dev; | ||
| 1136 | 1160 | ||
| 1137 | static int eeepc_getkeycode(struct input_dev *dev, int scancode, int *keycode) | 1161 | error = sparse_keymap_setup(input, eeepc_keymap, NULL); |
| 1138 | { | 1162 | if (error) { |
| 1139 | struct eeepc_laptop *eeepc = input_get_drvdata(dev); | 1163 | pr_err("Unable to setup input device keymap\n"); |
| 1140 | struct key_entry *key = eeepc_get_entry_by_scancode(eeepc, scancode); | 1164 | goto err_free_dev; |
| 1141 | |||
| 1142 | if (key && key->type == KE_KEY) { | ||
| 1143 | *keycode = key->keycode; | ||
| 1144 | return 0; | ||
| 1145 | } | 1165 | } |
| 1146 | 1166 | ||
| 1147 | return -EINVAL; | 1167 | error = input_register_device(input); |
| 1148 | } | 1168 | if (error) { |
| 1149 | 1169 | pr_err("Unable to register input device\n"); | |
| 1150 | static int eeepc_setkeycode(struct input_dev *dev, int scancode, int keycode) | 1170 | goto err_free_keymap; |
| 1151 | { | ||
| 1152 | struct eeepc_laptop *eeepc = input_get_drvdata(dev); | ||
| 1153 | struct key_entry *key; | ||
| 1154 | int old_keycode; | ||
| 1155 | |||
| 1156 | if (keycode < 0 || keycode > KEY_MAX) | ||
| 1157 | return -EINVAL; | ||
| 1158 | |||
| 1159 | key = eeepc_get_entry_by_scancode(eeepc, scancode); | ||
| 1160 | if (key && key->type == KE_KEY) { | ||
| 1161 | old_keycode = key->keycode; | ||
| 1162 | key->keycode = keycode; | ||
| 1163 | set_bit(keycode, dev->keybit); | ||
| 1164 | if (!eeepc_get_entry_by_keycode(eeepc, old_keycode)) | ||
| 1165 | clear_bit(old_keycode, dev->keybit); | ||
| 1166 | return 0; | ||
| 1167 | } | 1171 | } |
| 1168 | 1172 | ||
| 1169 | return -EINVAL; | 1173 | eeepc->inputdev = input; |
| 1170 | } | ||
| 1171 | |||
| 1172 | static int eeepc_input_init(struct eeepc_laptop *eeepc) | ||
| 1173 | { | ||
| 1174 | const struct key_entry *key; | ||
| 1175 | int result; | ||
| 1176 | |||
| 1177 | eeepc->inputdev = input_allocate_device(); | ||
| 1178 | if (!eeepc->inputdev) { | ||
| 1179 | pr_info("Unable to allocate input device\n"); | ||
| 1180 | return -ENOMEM; | ||
| 1181 | } | ||
| 1182 | eeepc->inputdev->name = "Asus EeePC extra buttons"; | ||
| 1183 | eeepc->inputdev->dev.parent = &eeepc->platform_device->dev; | ||
| 1184 | eeepc->inputdev->phys = EEEPC_LAPTOP_FILE "/input0"; | ||
| 1185 | eeepc->inputdev->id.bustype = BUS_HOST; | ||
| 1186 | eeepc->inputdev->getkeycode = eeepc_getkeycode; | ||
| 1187 | eeepc->inputdev->setkeycode = eeepc_setkeycode; | ||
| 1188 | input_set_drvdata(eeepc->inputdev, eeepc); | ||
| 1189 | |||
| 1190 | eeepc->keymap = kmemdup(eeepc_keymap, sizeof(eeepc_keymap), | ||
| 1191 | GFP_KERNEL); | ||
| 1192 | for (key = eeepc_keymap; key->type != KE_END; key++) { | ||
| 1193 | switch (key->type) { | ||
| 1194 | case KE_KEY: | ||
| 1195 | set_bit(EV_KEY, eeepc->inputdev->evbit); | ||
| 1196 | set_bit(key->keycode, eeepc->inputdev->keybit); | ||
| 1197 | break; | ||
| 1198 | } | ||
| 1199 | } | ||
| 1200 | result = input_register_device(eeepc->inputdev); | ||
| 1201 | if (result) { | ||
| 1202 | pr_info("Unable to register input device\n"); | ||
| 1203 | input_free_device(eeepc->inputdev); | ||
| 1204 | return result; | ||
| 1205 | } | ||
| 1206 | return 0; | 1174 | return 0; |
| 1175 | |||
| 1176 | err_free_keymap: | ||
| 1177 | sparse_keymap_free(input); | ||
| 1178 | err_free_dev: | ||
| 1179 | input_free_device(input); | ||
| 1180 | return error; | ||
| 1207 | } | 1181 | } |
| 1208 | 1182 | ||
| 1209 | static void eeepc_input_exit(struct eeepc_laptop *eeepc) | 1183 | static void eeepc_input_exit(struct eeepc_laptop *eeepc) |
| @@ -1253,11 +1227,59 @@ static void eeepc_acpi_notify(struct acpi_device *device, u32 event) | |||
| 1253 | * event will be desired value (or else ignored) | 1227 | * event will be desired value (or else ignored) |
| 1254 | */ | 1228 | */ |
| 1255 | } | 1229 | } |
| 1256 | eeepc_input_notify(eeepc, event); | 1230 | sparse_keymap_report_event(eeepc->inputdev, event, |
| 1231 | 1, true); | ||
| 1257 | } | 1232 | } |
| 1258 | } else { | 1233 | } else { |
| 1259 | /* Everything else is a bona-fide keypress event */ | 1234 | /* Everything else is a bona-fide keypress event */ |
| 1260 | eeepc_input_notify(eeepc, event); | 1235 | sparse_keymap_report_event(eeepc->inputdev, event, 1, true); |
| 1236 | } | ||
| 1237 | } | ||
| 1238 | |||
| 1239 | static void eeepc_dmi_check(struct eeepc_laptop *eeepc) | ||
| 1240 | { | ||
| 1241 | const char *model; | ||
| 1242 | |||
| 1243 | model = dmi_get_system_info(DMI_PRODUCT_NAME); | ||
| 1244 | if (!model) | ||
| 1245 | return; | ||
| 1246 | |||
| 1247 | /* | ||
| 1248 | * Blacklist for setting cpufv (cpu speed). | ||
| 1249 | * | ||
| 1250 | * EeePC 4G ("701") implements CFVS, but it is not supported | ||
| 1251 | * by the pre-installed OS, and the original option to change it | ||
| 1252 | * in the BIOS setup screen was removed in later versions. | ||
| 1253 | * | ||
| 1254 | * Judging by the lack of "Super Hybrid Engine" on Asus product pages, | ||
| 1255 | * this applies to all "701" models (4G/4G Surf/2G Surf). | ||
| 1256 | * | ||
| 1257 | * So Asus made a deliberate decision not to support it on this model. | ||
| 1258 | * We have several reports that using it can cause the system to hang | ||
| 1259 | * | ||
| 1260 | * The hang has also been reported on a "702" (Model name "8G"?). | ||
| 1261 | * | ||
| 1262 | * We avoid dmi_check_system() / dmi_match(), because they use | ||
| 1263 | * substring matching. We don't want to affect the "701SD" | ||
| 1264 | * and "701SDX" models, because they do support S.H.E. | ||
| 1265 | */ | ||
| 1266 | if (strcmp(model, "701") == 0 || strcmp(model, "702") == 0) { | ||
| 1267 | eeepc->cpufv_disabled = true; | ||
| 1268 | pr_info("model %s does not officially support setting cpu " | ||
| 1269 | "speed\n", model); | ||
| 1270 | pr_info("cpufv disabled to avoid instability\n"); | ||
| 1271 | } | ||
| 1272 | |||
| 1273 | /* | ||
| 1274 | * Blacklist for wlan hotplug | ||
| 1275 | * | ||
| 1276 | * Eeepc 1005HA doesn't work like others models and don't need the | ||
| 1277 | * hotplug code. In fact, current hotplug code seems to unplug another | ||
| 1278 | * device... | ||
| 1279 | */ | ||
| 1280 | if (strcmp(model, "1005HA") == 0 || strcmp(model, "1201N") == 0) { | ||
| 1281 | eeepc->hotplug_disabled = true; | ||
| 1282 | pr_info("wlan hotplug disabled\n"); | ||
| 1261 | } | 1283 | } |
| 1262 | } | 1284 | } |
| 1263 | 1285 | ||
| @@ -1342,6 +1364,10 @@ static int __devinit eeepc_acpi_add(struct acpi_device *device) | |||
| 1342 | strcpy(acpi_device_class(device), EEEPC_ACPI_CLASS); | 1364 | strcpy(acpi_device_class(device), EEEPC_ACPI_CLASS); |
| 1343 | device->driver_data = eeepc; | 1365 | device->driver_data = eeepc; |
| 1344 | 1366 | ||
| 1367 | eeepc->hotplug_disabled = hotplug_disabled; | ||
| 1368 | |||
| 1369 | eeepc_dmi_check(eeepc); | ||
| 1370 | |||
| 1345 | result = eeepc_acpi_init(eeepc, device); | 1371 | result = eeepc_acpi_init(eeepc, device); |
| 1346 | if (result) | 1372 | if (result) |
| 1347 | goto fail_platform; | 1373 | goto fail_platform; |
| @@ -1452,10 +1478,12 @@ static int __init eeepc_laptop_init(void) | |||
| 1452 | result = acpi_bus_register_driver(&eeepc_acpi_driver); | 1478 | result = acpi_bus_register_driver(&eeepc_acpi_driver); |
| 1453 | if (result < 0) | 1479 | if (result < 0) |
| 1454 | goto fail_acpi_driver; | 1480 | goto fail_acpi_driver; |
| 1481 | |||
| 1455 | if (!eeepc_device_present) { | 1482 | if (!eeepc_device_present) { |
| 1456 | result = -ENODEV; | 1483 | result = -ENODEV; |
| 1457 | goto fail_no_device; | 1484 | goto fail_no_device; |
| 1458 | } | 1485 | } |
| 1486 | |||
| 1459 | return 0; | 1487 | return 0; |
| 1460 | 1488 | ||
| 1461 | fail_no_device: | 1489 | fail_no_device: |
diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c index 5af53340da6f..3f71a605a492 100644 --- a/drivers/platform/x86/sony-laptop.c +++ b/drivers/platform/x86/sony-laptop.c | |||
| @@ -1201,9 +1201,12 @@ static void sony_nc_rfkill_setup(struct acpi_device *device) | |||
| 1201 | /* the buffer is filled with magic numbers describing the devices | 1201 | /* the buffer is filled with magic numbers describing the devices |
| 1202 | * available, 0xff terminates the enumeration | 1202 | * available, 0xff terminates the enumeration |
| 1203 | */ | 1203 | */ |
| 1204 | while ((dev_code = *(device_enum->buffer.pointer + i)) != 0xff && | 1204 | for (i = 0; i < device_enum->buffer.length; i++) { |
| 1205 | i < device_enum->buffer.length) { | 1205 | |
| 1206 | i++; | 1206 | dev_code = *(device_enum->buffer.pointer + i); |
| 1207 | if (dev_code == 0xff) | ||
| 1208 | break; | ||
| 1209 | |||
| 1207 | dprintk("Radio devices, looking at 0x%.2x\n", dev_code); | 1210 | dprintk("Radio devices, looking at 0x%.2x\n", dev_code); |
| 1208 | 1211 | ||
| 1209 | if (dev_code == 0 && !sony_rfkill_devices[SONY_WIFI]) | 1212 | if (dev_code == 0 && !sony_rfkill_devices[SONY_WIFI]) |
diff --git a/drivers/serial/8250_pnp.c b/drivers/serial/8250_pnp.c index b5496a19d967..24485cc62ff8 100644 --- a/drivers/serial/8250_pnp.c +++ b/drivers/serial/8250_pnp.c | |||
| @@ -328,15 +328,7 @@ static const struct pnp_device_id pnp_dev_table[] = { | |||
| 328 | /* U.S. Robotics 56K Voice INT PnP*/ | 328 | /* U.S. Robotics 56K Voice INT PnP*/ |
| 329 | { "USR9190", 0 }, | 329 | { "USR9190", 0 }, |
| 330 | /* Wacom tablets */ | 330 | /* Wacom tablets */ |
| 331 | { "WACF004", 0 }, | 331 | { "WACFXXX", 0 }, |
| 332 | { "WACF005", 0 }, | ||
| 333 | { "WACF006", 0 }, | ||
| 334 | { "WACF007", 0 }, | ||
| 335 | { "WACF008", 0 }, | ||
| 336 | { "WACF009", 0 }, | ||
| 337 | { "WACF00A", 0 }, | ||
| 338 | { "WACF00B", 0 }, | ||
| 339 | { "WACF00C", 0 }, | ||
| 340 | /* Compaq touchscreen */ | 332 | /* Compaq touchscreen */ |
| 341 | { "FPI2002", 0 }, | 333 | { "FPI2002", 0 }, |
| 342 | /* Fujitsu Stylistic touchscreens */ | 334 | /* Fujitsu Stylistic touchscreens */ |
diff --git a/drivers/serial/imx.c b/drivers/serial/imx.c index 18130f11238e..60d665a17a88 100644 --- a/drivers/serial/imx.c +++ b/drivers/serial/imx.c | |||
| @@ -1088,7 +1088,7 @@ imx_console_get_options(struct imx_port *sport, int *baud, | |||
| 1088 | int *parity, int *bits) | 1088 | int *parity, int *bits) |
| 1089 | { | 1089 | { |
| 1090 | 1090 | ||
| 1091 | if ( readl(sport->port.membase + UCR1) | UCR1_UARTEN ) { | 1091 | if (readl(sport->port.membase + UCR1) & UCR1_UARTEN) { |
| 1092 | /* ok, the port was enabled */ | 1092 | /* ok, the port was enabled */ |
| 1093 | unsigned int ucr2, ubir,ubmr, uartclk; | 1093 | unsigned int ucr2, ubir,ubmr, uartclk; |
| 1094 | unsigned int baud_raw; | 1094 | unsigned int baud_raw; |
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c index 047530b285bb..7f2830709512 100644 --- a/drivers/serial/serial_core.c +++ b/drivers/serial/serial_core.c | |||
| @@ -385,13 +385,20 @@ uart_get_baud_rate(struct uart_port *port, struct ktermios *termios, | |||
| 385 | } | 385 | } |
| 386 | 386 | ||
| 387 | /* | 387 | /* |
| 388 | * As a last resort, if the quotient is zero, | 388 | * As a last resort, if the range cannot be met then clip to |
| 389 | * default to 9600 bps | 389 | * the nearest chip supported rate. |
| 390 | */ | 390 | */ |
| 391 | if (!hung_up) | 391 | if (!hung_up) { |
| 392 | tty_termios_encode_baud_rate(termios, 9600, 9600); | 392 | if (baud <= min) |
| 393 | tty_termios_encode_baud_rate(termios, | ||
| 394 | min + 1, min + 1); | ||
| 395 | else | ||
| 396 | tty_termios_encode_baud_rate(termios, | ||
| 397 | max - 1, max - 1); | ||
| 398 | } | ||
| 393 | } | 399 | } |
| 394 | 400 | /* Should never happen */ | |
| 401 | WARN_ON(1); | ||
| 395 | return 0; | 402 | return 0; |
| 396 | } | 403 | } |
| 397 | 404 | ||
| @@ -2006,12 +2013,6 @@ int uart_suspend_port(struct uart_driver *drv, struct uart_port *uport) | |||
| 2006 | 2013 | ||
| 2007 | mutex_lock(&port->mutex); | 2014 | mutex_lock(&port->mutex); |
| 2008 | 2015 | ||
| 2009 | if (!console_suspend_enabled && uart_console(uport)) { | ||
| 2010 | /* we're going to avoid suspending serial console */ | ||
| 2011 | mutex_unlock(&port->mutex); | ||
| 2012 | return 0; | ||
| 2013 | } | ||
| 2014 | |||
| 2015 | tty_dev = device_find_child(uport->dev, &match, serial_match_port); | 2016 | tty_dev = device_find_child(uport->dev, &match, serial_match_port); |
| 2016 | if (device_may_wakeup(tty_dev)) { | 2017 | if (device_may_wakeup(tty_dev)) { |
| 2017 | enable_irq_wake(uport->irq); | 2018 | enable_irq_wake(uport->irq); |
| @@ -2019,20 +2020,23 @@ int uart_suspend_port(struct uart_driver *drv, struct uart_port *uport) | |||
| 2019 | mutex_unlock(&port->mutex); | 2020 | mutex_unlock(&port->mutex); |
| 2020 | return 0; | 2021 | return 0; |
| 2021 | } | 2022 | } |
| 2022 | uport->suspended = 1; | 2023 | if (console_suspend_enabled || !uart_console(uport)) |
| 2024 | uport->suspended = 1; | ||
| 2023 | 2025 | ||
| 2024 | if (port->flags & ASYNC_INITIALIZED) { | 2026 | if (port->flags & ASYNC_INITIALIZED) { |
| 2025 | const struct uart_ops *ops = uport->ops; | 2027 | const struct uart_ops *ops = uport->ops; |
| 2026 | int tries; | 2028 | int tries; |
| 2027 | 2029 | ||
| 2028 | set_bit(ASYNCB_SUSPENDED, &port->flags); | 2030 | if (console_suspend_enabled || !uart_console(uport)) { |
| 2029 | clear_bit(ASYNCB_INITIALIZED, &port->flags); | 2031 | set_bit(ASYNCB_SUSPENDED, &port->flags); |
| 2032 | clear_bit(ASYNCB_INITIALIZED, &port->flags); | ||
| 2030 | 2033 | ||
| 2031 | spin_lock_irq(&uport->lock); | 2034 | spin_lock_irq(&uport->lock); |
| 2032 | ops->stop_tx(uport); | 2035 | ops->stop_tx(uport); |
| 2033 | ops->set_mctrl(uport, 0); | 2036 | ops->set_mctrl(uport, 0); |
| 2034 | ops->stop_rx(uport); | 2037 | ops->stop_rx(uport); |
| 2035 | spin_unlock_irq(&uport->lock); | 2038 | spin_unlock_irq(&uport->lock); |
| 2039 | } | ||
| 2036 | 2040 | ||
| 2037 | /* | 2041 | /* |
| 2038 | * Wait for the transmitter to empty. | 2042 | * Wait for the transmitter to empty. |
| @@ -2047,16 +2051,18 @@ int uart_suspend_port(struct uart_driver *drv, struct uart_port *uport) | |||
| 2047 | drv->dev_name, | 2051 | drv->dev_name, |
| 2048 | drv->tty_driver->name_base + uport->line); | 2052 | drv->tty_driver->name_base + uport->line); |
| 2049 | 2053 | ||
| 2050 | ops->shutdown(uport); | 2054 | if (console_suspend_enabled || !uart_console(uport)) |
| 2055 | ops->shutdown(uport); | ||
| 2051 | } | 2056 | } |
| 2052 | 2057 | ||
| 2053 | /* | 2058 | /* |
| 2054 | * Disable the console device before suspending. | 2059 | * Disable the console device before suspending. |
| 2055 | */ | 2060 | */ |
| 2056 | if (uart_console(uport)) | 2061 | if (console_suspend_enabled && uart_console(uport)) |
| 2057 | console_stop(uport->cons); | 2062 | console_stop(uport->cons); |
| 2058 | 2063 | ||
| 2059 | uart_change_pm(state, 3); | 2064 | if (console_suspend_enabled || !uart_console(uport)) |
| 2065 | uart_change_pm(state, 3); | ||
| 2060 | 2066 | ||
| 2061 | mutex_unlock(&port->mutex); | 2067 | mutex_unlock(&port->mutex); |
| 2062 | 2068 | ||
| @@ -2073,29 +2079,6 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *uport) | |||
| 2073 | 2079 | ||
| 2074 | mutex_lock(&port->mutex); | 2080 | mutex_lock(&port->mutex); |
| 2075 | 2081 | ||
| 2076 | if (!console_suspend_enabled && uart_console(uport)) { | ||
| 2077 | /* no need to resume serial console, it wasn't suspended */ | ||
| 2078 | /* | ||
| 2079 | * First try to use the console cflag setting. | ||
| 2080 | */ | ||
| 2081 | memset(&termios, 0, sizeof(struct ktermios)); | ||
| 2082 | termios.c_cflag = uport->cons->cflag; | ||
| 2083 | /* | ||
| 2084 | * If that's unset, use the tty termios setting. | ||
| 2085 | */ | ||
| 2086 | if (termios.c_cflag == 0) | ||
| 2087 | termios = *state->port.tty->termios; | ||
| 2088 | else { | ||
| 2089 | termios.c_ispeed = termios.c_ospeed = | ||
| 2090 | tty_termios_input_baud_rate(&termios); | ||
| 2091 | termios.c_ispeed = termios.c_ospeed = | ||
| 2092 | tty_termios_baud_rate(&termios); | ||
| 2093 | } | ||
| 2094 | uport->ops->set_termios(uport, &termios, NULL); | ||
| 2095 | mutex_unlock(&port->mutex); | ||
| 2096 | return 0; | ||
| 2097 | } | ||
| 2098 | |||
| 2099 | tty_dev = device_find_child(uport->dev, &match, serial_match_port); | 2082 | tty_dev = device_find_child(uport->dev, &match, serial_match_port); |
| 2100 | if (!uport->suspended && device_may_wakeup(tty_dev)) { | 2083 | if (!uport->suspended && device_may_wakeup(tty_dev)) { |
| 2101 | disable_irq_wake(uport->irq); | 2084 | disable_irq_wake(uport->irq); |
| @@ -2121,21 +2104,23 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *uport) | |||
| 2121 | spin_lock_irq(&uport->lock); | 2104 | spin_lock_irq(&uport->lock); |
| 2122 | ops->set_mctrl(uport, 0); | 2105 | ops->set_mctrl(uport, 0); |
| 2123 | spin_unlock_irq(&uport->lock); | 2106 | spin_unlock_irq(&uport->lock); |
| 2124 | ret = ops->startup(uport); | 2107 | if (console_suspend_enabled || !uart_console(uport)) { |
| 2125 | if (ret == 0) { | 2108 | ret = ops->startup(uport); |
| 2126 | uart_change_speed(state, NULL); | 2109 | if (ret == 0) { |
| 2127 | spin_lock_irq(&uport->lock); | 2110 | uart_change_speed(state, NULL); |
| 2128 | ops->set_mctrl(uport, uport->mctrl); | 2111 | spin_lock_irq(&uport->lock); |
| 2129 | ops->start_tx(uport); | 2112 | ops->set_mctrl(uport, uport->mctrl); |
| 2130 | spin_unlock_irq(&uport->lock); | 2113 | ops->start_tx(uport); |
| 2131 | set_bit(ASYNCB_INITIALIZED, &port->flags); | 2114 | spin_unlock_irq(&uport->lock); |
| 2132 | } else { | 2115 | set_bit(ASYNCB_INITIALIZED, &port->flags); |
| 2133 | /* | 2116 | } else { |
| 2134 | * Failed to resume - maybe hardware went away? | 2117 | /* |
| 2135 | * Clear the "initialized" flag so we won't try | 2118 | * Failed to resume - maybe hardware went away? |
| 2136 | * to call the low level drivers shutdown method. | 2119 | * Clear the "initialized" flag so we won't try |
| 2137 | */ | 2120 | * to call the low level drivers shutdown method. |
| 2138 | uart_shutdown(state); | 2121 | */ |
| 2122 | uart_shutdown(state); | ||
| 2123 | } | ||
| 2139 | } | 2124 | } |
| 2140 | 2125 | ||
| 2141 | clear_bit(ASYNCB_SUSPENDED, &port->flags); | 2126 | clear_bit(ASYNCB_SUSPENDED, &port->flags); |
diff --git a/drivers/serial/serial_cs.c b/drivers/serial/serial_cs.c index 0ee7239c5d69..df854401af2d 100644 --- a/drivers/serial/serial_cs.c +++ b/drivers/serial/serial_cs.c | |||
| @@ -146,7 +146,8 @@ static void quirk_wakeup_oxsemi(struct pcmcia_device *link) | |||
| 146 | { | 146 | { |
| 147 | struct serial_info *info = link->priv; | 147 | struct serial_info *info = link->priv; |
| 148 | 148 | ||
| 149 | outb(12, info->c950ctrl + 1); | 149 | if (info->c950ctrl) |
| 150 | outb(12, info->c950ctrl + 1); | ||
| 150 | } | 151 | } |
| 151 | 152 | ||
| 152 | /* request_region? oxsemi branch does no request_region too... */ | 153 | /* request_region? oxsemi branch does no request_region too... */ |
diff --git a/drivers/staging/asus_oled/asus_oled.c b/drivers/staging/asus_oled/asus_oled.c index f4c26572c7df..43c57b7688ab 100644 --- a/drivers/staging/asus_oled/asus_oled.c +++ b/drivers/staging/asus_oled/asus_oled.c | |||
| @@ -194,9 +194,11 @@ static ssize_t set_enabled(struct device *dev, struct device_attribute *attr, | |||
| 194 | { | 194 | { |
| 195 | struct usb_interface *intf = to_usb_interface(dev); | 195 | struct usb_interface *intf = to_usb_interface(dev); |
| 196 | struct asus_oled_dev *odev = usb_get_intfdata(intf); | 196 | struct asus_oled_dev *odev = usb_get_intfdata(intf); |
| 197 | int temp = strict_strtoul(buf, 10, NULL); | 197 | unsigned long value; |
| 198 | if (strict_strtoul(buf, 10, &value)) | ||
| 199 | return -EINVAL; | ||
| 198 | 200 | ||
| 199 | enable_oled(odev, temp); | 201 | enable_oled(odev, value); |
| 200 | 202 | ||
| 201 | return count; | 203 | return count; |
| 202 | } | 204 | } |
| @@ -207,10 +209,12 @@ static ssize_t class_set_enabled(struct device *device, | |||
| 207 | { | 209 | { |
| 208 | struct asus_oled_dev *odev = | 210 | struct asus_oled_dev *odev = |
| 209 | (struct asus_oled_dev *) dev_get_drvdata(device); | 211 | (struct asus_oled_dev *) dev_get_drvdata(device); |
| 212 | unsigned long value; | ||
| 210 | 213 | ||
| 211 | int temp = strict_strtoul(buf, 10, NULL); | 214 | if (strict_strtoul(buf, 10, &value)) |
| 215 | return -EINVAL; | ||
| 212 | 216 | ||
| 213 | enable_oled(odev, temp); | 217 | enable_oled(odev, value); |
| 214 | 218 | ||
| 215 | return count; | 219 | return count; |
| 216 | } | 220 | } |
diff --git a/drivers/staging/et131x/et1310_address_map.h b/drivers/staging/et131x/et1310_address_map.h index 6da843cc343c..e715e4dcb523 100644 --- a/drivers/staging/et131x/et1310_address_map.h +++ b/drivers/staging/et131x/et1310_address_map.h | |||
| @@ -203,11 +203,14 @@ typedef struct _GLOBAL_t { /* Location: */ | |||
| 203 | * 9-0: pr ndes | 203 | * 9-0: pr ndes |
| 204 | */ | 204 | */ |
| 205 | 205 | ||
| 206 | #define ET_DMA10_MASK 0x3FF /* 10 bit mask for DMA10W types */ | 206 | #define ET_DMA12_MASK 0x0FFF /* 12 bit mask for DMA12W types */ |
| 207 | #define ET_DMA10_WRAP 0x400 | 207 | #define ET_DMA12_WRAP 0x1000 |
| 208 | #define ET_DMA4_MASK 0x00F /* 4 bit mask for DMA4W types */ | 208 | #define ET_DMA10_MASK 0x03FF /* 10 bit mask for DMA10W types */ |
| 209 | #define ET_DMA4_WRAP 0x010 | 209 | #define ET_DMA10_WRAP 0x0400 |
| 210 | 210 | #define ET_DMA4_MASK 0x000F /* 4 bit mask for DMA4W types */ | |
| 211 | #define ET_DMA4_WRAP 0x0010 | ||
| 212 | |||
| 213 | #define INDEX12(x) ((x) & ET_DMA12_MASK) | ||
| 211 | #define INDEX10(x) ((x) & ET_DMA10_MASK) | 214 | #define INDEX10(x) ((x) & ET_DMA10_MASK) |
| 212 | #define INDEX4(x) ((x) & ET_DMA4_MASK) | 215 | #define INDEX4(x) ((x) & ET_DMA4_MASK) |
| 213 | 216 | ||
| @@ -216,6 +219,11 @@ extern inline void add_10bit(u32 *v, int n) | |||
| 216 | *v = INDEX10(*v + n) | (*v & ET_DMA10_WRAP); | 219 | *v = INDEX10(*v + n) | (*v & ET_DMA10_WRAP); |
| 217 | } | 220 | } |
| 218 | 221 | ||
| 222 | extern inline void add_12bit(u32 *v, int n) | ||
| 223 | { | ||
| 224 | *v = INDEX12(*v + n) | (*v & ET_DMA12_WRAP); | ||
| 225 | } | ||
| 226 | |||
| 219 | /* | 227 | /* |
| 220 | * 10bit DMA with wrap | 228 | * 10bit DMA with wrap |
| 221 | * txdma tx queue write address reg in txdma address map at 0x1010 | 229 | * txdma tx queue write address reg in txdma address map at 0x1010 |
diff --git a/drivers/staging/et131x/et1310_rx.c b/drivers/staging/et131x/et1310_rx.c index 3ddc9b12b8db..81c1a7478ad6 100644 --- a/drivers/staging/et131x/et1310_rx.c +++ b/drivers/staging/et131x/et1310_rx.c | |||
| @@ -831,10 +831,10 @@ PMP_RFD nic_rx_pkts(struct et131x_adapter *etdev) | |||
| 831 | 831 | ||
| 832 | /* Indicate that we have used this PSR entry. */ | 832 | /* Indicate that we have used this PSR entry. */ |
| 833 | /* FIXME wrap 12 */ | 833 | /* FIXME wrap 12 */ |
| 834 | rx_local->local_psr_full = (rx_local->local_psr_full + 1) & 0xFFF; | 834 | add_12bit(&rx_local->local_psr_full, 1); |
| 835 | if (rx_local->local_psr_full > rx_local->PsrNumEntries - 1) { | 835 | if ((rx_local->local_psr_full & 0xFFF) > rx_local->PsrNumEntries - 1) { |
| 836 | /* Clear psr full and toggle the wrap bit */ | 836 | /* Clear psr full and toggle the wrap bit */ |
| 837 | rx_local->local_psr_full &= 0xFFF; | 837 | rx_local->local_psr_full &= ~0xFFF; |
| 838 | rx_local->local_psr_full ^= 0x1000; | 838 | rx_local->local_psr_full ^= 0x1000; |
| 839 | } | 839 | } |
| 840 | 840 | ||
diff --git a/drivers/staging/hv/Hv.c b/drivers/staging/hv/Hv.c index c5b6613f2f2f..c2809f2a2ce0 100644 --- a/drivers/staging/hv/Hv.c +++ b/drivers/staging/hv/Hv.c | |||
| @@ -386,7 +386,7 @@ u16 HvSignalEvent(void) | |||
| 386 | * retrieve the initialized message and event pages. Otherwise, we create and | 386 | * retrieve the initialized message and event pages. Otherwise, we create and |
| 387 | * initialize the message and event pages. | 387 | * initialize the message and event pages. |
| 388 | */ | 388 | */ |
| 389 | int HvSynicInit(u32 irqVector) | 389 | void HvSynicInit(void *irqarg) |
| 390 | { | 390 | { |
| 391 | u64 version; | 391 | u64 version; |
| 392 | union hv_synic_simp simp; | 392 | union hv_synic_simp simp; |
| @@ -394,13 +394,14 @@ int HvSynicInit(u32 irqVector) | |||
| 394 | union hv_synic_sint sharedSint; | 394 | union hv_synic_sint sharedSint; |
| 395 | union hv_synic_scontrol sctrl; | 395 | union hv_synic_scontrol sctrl; |
| 396 | u64 guestID; | 396 | u64 guestID; |
| 397 | int ret = 0; | 397 | u32 irqVector = *((u32 *)(irqarg)); |
| 398 | int cpu = smp_processor_id(); | ||
| 398 | 399 | ||
| 399 | DPRINT_ENTER(VMBUS); | 400 | DPRINT_ENTER(VMBUS); |
| 400 | 401 | ||
| 401 | if (!gHvContext.HypercallPage) { | 402 | if (!gHvContext.HypercallPage) { |
| 402 | DPRINT_EXIT(VMBUS); | 403 | DPRINT_EXIT(VMBUS); |
| 403 | return ret; | 404 | return; |
| 404 | } | 405 | } |
| 405 | 406 | ||
| 406 | /* Check the version */ | 407 | /* Check the version */ |
| @@ -425,27 +426,27 @@ int HvSynicInit(u32 irqVector) | |||
| 425 | */ | 426 | */ |
| 426 | rdmsrl(HV_X64_MSR_GUEST_OS_ID, guestID); | 427 | rdmsrl(HV_X64_MSR_GUEST_OS_ID, guestID); |
| 427 | if (guestID == HV_LINUX_GUEST_ID) { | 428 | if (guestID == HV_LINUX_GUEST_ID) { |
| 428 | gHvContext.synICMessagePage[0] = | 429 | gHvContext.synICMessagePage[cpu] = |
| 429 | phys_to_virt(simp.BaseSimpGpa << PAGE_SHIFT); | 430 | phys_to_virt(simp.BaseSimpGpa << PAGE_SHIFT); |
| 430 | gHvContext.synICEventPage[0] = | 431 | gHvContext.synICEventPage[cpu] = |
| 431 | phys_to_virt(siefp.BaseSiefpGpa << PAGE_SHIFT); | 432 | phys_to_virt(siefp.BaseSiefpGpa << PAGE_SHIFT); |
| 432 | } else { | 433 | } else { |
| 433 | DPRINT_ERR(VMBUS, "unknown guest id!!"); | 434 | DPRINT_ERR(VMBUS, "unknown guest id!!"); |
| 434 | goto Cleanup; | 435 | goto Cleanup; |
| 435 | } | 436 | } |
| 436 | DPRINT_DBG(VMBUS, "MAPPED: Simp: %p, Sifep: %p", | 437 | DPRINT_DBG(VMBUS, "MAPPED: Simp: %p, Sifep: %p", |
| 437 | gHvContext.synICMessagePage[0], | 438 | gHvContext.synICMessagePage[cpu], |
| 438 | gHvContext.synICEventPage[0]); | 439 | gHvContext.synICEventPage[cpu]); |
| 439 | } else { | 440 | } else { |
| 440 | gHvContext.synICMessagePage[0] = osd_PageAlloc(1); | 441 | gHvContext.synICMessagePage[cpu] = (void *)get_zeroed_page(GFP_ATOMIC); |
| 441 | if (gHvContext.synICMessagePage[0] == NULL) { | 442 | if (gHvContext.synICMessagePage[cpu] == NULL) { |
| 442 | DPRINT_ERR(VMBUS, | 443 | DPRINT_ERR(VMBUS, |
| 443 | "unable to allocate SYNIC message page!!"); | 444 | "unable to allocate SYNIC message page!!"); |
| 444 | goto Cleanup; | 445 | goto Cleanup; |
| 445 | } | 446 | } |
| 446 | 447 | ||
| 447 | gHvContext.synICEventPage[0] = osd_PageAlloc(1); | 448 | gHvContext.synICEventPage[cpu] = (void *)get_zeroed_page(GFP_ATOMIC); |
| 448 | if (gHvContext.synICEventPage[0] == NULL) { | 449 | if (gHvContext.synICEventPage[cpu] == NULL) { |
| 449 | DPRINT_ERR(VMBUS, | 450 | DPRINT_ERR(VMBUS, |
| 450 | "unable to allocate SYNIC event page!!"); | 451 | "unable to allocate SYNIC event page!!"); |
| 451 | goto Cleanup; | 452 | goto Cleanup; |
| @@ -454,7 +455,7 @@ int HvSynicInit(u32 irqVector) | |||
| 454 | /* Setup the Synic's message page */ | 455 | /* Setup the Synic's message page */ |
| 455 | rdmsrl(HV_X64_MSR_SIMP, simp.AsUINT64); | 456 | rdmsrl(HV_X64_MSR_SIMP, simp.AsUINT64); |
| 456 | simp.SimpEnabled = 1; | 457 | simp.SimpEnabled = 1; |
| 457 | simp.BaseSimpGpa = virt_to_phys(gHvContext.synICMessagePage[0]) | 458 | simp.BaseSimpGpa = virt_to_phys(gHvContext.synICMessagePage[cpu]) |
| 458 | >> PAGE_SHIFT; | 459 | >> PAGE_SHIFT; |
| 459 | 460 | ||
| 460 | DPRINT_DBG(VMBUS, "HV_X64_MSR_SIMP msr set to: %llx", | 461 | DPRINT_DBG(VMBUS, "HV_X64_MSR_SIMP msr set to: %llx", |
| @@ -465,7 +466,7 @@ int HvSynicInit(u32 irqVector) | |||
| 465 | /* Setup the Synic's event page */ | 466 | /* Setup the Synic's event page */ |
| 466 | rdmsrl(HV_X64_MSR_SIEFP, siefp.AsUINT64); | 467 | rdmsrl(HV_X64_MSR_SIEFP, siefp.AsUINT64); |
| 467 | siefp.SiefpEnabled = 1; | 468 | siefp.SiefpEnabled = 1; |
| 468 | siefp.BaseSiefpGpa = virt_to_phys(gHvContext.synICEventPage[0]) | 469 | siefp.BaseSiefpGpa = virt_to_phys(gHvContext.synICEventPage[cpu]) |
| 469 | >> PAGE_SHIFT; | 470 | >> PAGE_SHIFT; |
| 470 | 471 | ||
| 471 | DPRINT_DBG(VMBUS, "HV_X64_MSR_SIEFP msr set to: %llx", | 472 | DPRINT_DBG(VMBUS, "HV_X64_MSR_SIEFP msr set to: %llx", |
| @@ -501,32 +502,30 @@ int HvSynicInit(u32 irqVector) | |||
| 501 | 502 | ||
| 502 | DPRINT_EXIT(VMBUS); | 503 | DPRINT_EXIT(VMBUS); |
| 503 | 504 | ||
| 504 | return ret; | 505 | return; |
| 505 | 506 | ||
| 506 | Cleanup: | 507 | Cleanup: |
| 507 | ret = -1; | ||
| 508 | |||
| 509 | if (gHvContext.GuestId == HV_LINUX_GUEST_ID) { | 508 | if (gHvContext.GuestId == HV_LINUX_GUEST_ID) { |
| 510 | if (gHvContext.synICEventPage[0]) | 509 | if (gHvContext.synICEventPage[cpu]) |
| 511 | osd_PageFree(gHvContext.synICEventPage[0], 1); | 510 | osd_PageFree(gHvContext.synICEventPage[cpu], 1); |
| 512 | 511 | ||
| 513 | if (gHvContext.synICMessagePage[0]) | 512 | if (gHvContext.synICMessagePage[cpu]) |
| 514 | osd_PageFree(gHvContext.synICMessagePage[0], 1); | 513 | osd_PageFree(gHvContext.synICMessagePage[cpu], 1); |
| 515 | } | 514 | } |
| 516 | 515 | ||
| 517 | DPRINT_EXIT(VMBUS); | 516 | DPRINT_EXIT(VMBUS); |
| 518 | 517 | return; | |
| 519 | return ret; | ||
| 520 | } | 518 | } |
| 521 | 519 | ||
| 522 | /** | 520 | /** |
| 523 | * HvSynicCleanup - Cleanup routine for HvSynicInit(). | 521 | * HvSynicCleanup - Cleanup routine for HvSynicInit(). |
| 524 | */ | 522 | */ |
| 525 | void HvSynicCleanup(void) | 523 | void HvSynicCleanup(void *arg) |
| 526 | { | 524 | { |
| 527 | union hv_synic_sint sharedSint; | 525 | union hv_synic_sint sharedSint; |
| 528 | union hv_synic_simp simp; | 526 | union hv_synic_simp simp; |
| 529 | union hv_synic_siefp siefp; | 527 | union hv_synic_siefp siefp; |
| 528 | int cpu = smp_processor_id(); | ||
| 530 | 529 | ||
| 531 | DPRINT_ENTER(VMBUS); | 530 | DPRINT_ENTER(VMBUS); |
| 532 | 531 | ||
| @@ -539,6 +538,7 @@ void HvSynicCleanup(void) | |||
| 539 | 538 | ||
| 540 | sharedSint.Masked = 1; | 539 | sharedSint.Masked = 1; |
| 541 | 540 | ||
| 541 | /* Need to correctly cleanup in the case of SMP!!! */ | ||
| 542 | /* Disable the interrupt */ | 542 | /* Disable the interrupt */ |
| 543 | wrmsrl(HV_X64_MSR_SINT0 + VMBUS_MESSAGE_SINT, sharedSint.AsUINT64); | 543 | wrmsrl(HV_X64_MSR_SINT0 + VMBUS_MESSAGE_SINT, sharedSint.AsUINT64); |
| 544 | 544 | ||
| @@ -560,8 +560,8 @@ void HvSynicCleanup(void) | |||
| 560 | 560 | ||
| 561 | wrmsrl(HV_X64_MSR_SIEFP, siefp.AsUINT64); | 561 | wrmsrl(HV_X64_MSR_SIEFP, siefp.AsUINT64); |
| 562 | 562 | ||
| 563 | osd_PageFree(gHvContext.synICMessagePage[0], 1); | 563 | osd_PageFree(gHvContext.synICMessagePage[cpu], 1); |
| 564 | osd_PageFree(gHvContext.synICEventPage[0], 1); | 564 | osd_PageFree(gHvContext.synICEventPage[cpu], 1); |
| 565 | } | 565 | } |
| 566 | 566 | ||
| 567 | DPRINT_EXIT(VMBUS); | 567 | DPRINT_EXIT(VMBUS); |
diff --git a/drivers/staging/hv/Hv.h b/drivers/staging/hv/Hv.h index 5379e4bfc56e..fce4b5cdac30 100644 --- a/drivers/staging/hv/Hv.h +++ b/drivers/staging/hv/Hv.h | |||
| @@ -93,7 +93,7 @@ static const struct hv_guid VMBUS_SERVICE_ID = { | |||
| 93 | }, | 93 | }, |
| 94 | }; | 94 | }; |
| 95 | 95 | ||
| 96 | #define MAX_NUM_CPUS 1 | 96 | #define MAX_NUM_CPUS 32 |
| 97 | 97 | ||
| 98 | 98 | ||
| 99 | struct hv_input_signal_event_buffer { | 99 | struct hv_input_signal_event_buffer { |
| @@ -137,8 +137,8 @@ extern u16 HvPostMessage(union hv_connection_id connectionId, | |||
| 137 | 137 | ||
| 138 | extern u16 HvSignalEvent(void); | 138 | extern u16 HvSignalEvent(void); |
| 139 | 139 | ||
| 140 | extern int HvSynicInit(u32 irqVector); | 140 | extern void HvSynicInit(void *irqarg); |
| 141 | 141 | ||
| 142 | extern void HvSynicCleanup(void); | 142 | extern void HvSynicCleanup(void *arg); |
| 143 | 143 | ||
| 144 | #endif /* __HV_H__ */ | 144 | #endif /* __HV_H__ */ |
diff --git a/drivers/staging/hv/Vmbus.c b/drivers/staging/hv/Vmbus.c index a4dd06f6d459..35a023e9f9d1 100644 --- a/drivers/staging/hv/Vmbus.c +++ b/drivers/staging/hv/Vmbus.c | |||
| @@ -129,7 +129,7 @@ static int VmbusOnDeviceAdd(struct hv_device *dev, void *AdditionalInfo) | |||
| 129 | 129 | ||
| 130 | /* strcpy(dev->name, "vmbus"); */ | 130 | /* strcpy(dev->name, "vmbus"); */ |
| 131 | /* SynIC setup... */ | 131 | /* SynIC setup... */ |
| 132 | ret = HvSynicInit(*irqvector); | 132 | on_each_cpu(HvSynicInit, (void *)irqvector, 1); |
| 133 | 133 | ||
| 134 | /* Connect to VMBus in the root partition */ | 134 | /* Connect to VMBus in the root partition */ |
| 135 | ret = VmbusConnect(); | 135 | ret = VmbusConnect(); |
| @@ -150,7 +150,7 @@ static int VmbusOnDeviceRemove(struct hv_device *dev) | |||
| 150 | DPRINT_ENTER(VMBUS); | 150 | DPRINT_ENTER(VMBUS); |
| 151 | VmbusChannelReleaseUnattachedChannels(); | 151 | VmbusChannelReleaseUnattachedChannels(); |
| 152 | VmbusDisconnect(); | 152 | VmbusDisconnect(); |
| 153 | HvSynicCleanup(); | 153 | on_each_cpu(HvSynicCleanup, NULL, 1); |
| 154 | DPRINT_EXIT(VMBUS); | 154 | DPRINT_EXIT(VMBUS); |
| 155 | 155 | ||
| 156 | return ret; | 156 | return ret; |
| @@ -173,7 +173,8 @@ static void VmbusOnCleanup(struct hv_driver *drv) | |||
| 173 | */ | 173 | */ |
| 174 | static void VmbusOnMsgDPC(struct hv_driver *drv) | 174 | static void VmbusOnMsgDPC(struct hv_driver *drv) |
| 175 | { | 175 | { |
| 176 | void *page_addr = gHvContext.synICMessagePage[0]; | 176 | int cpu = smp_processor_id(); |
| 177 | void *page_addr = gHvContext.synICMessagePage[cpu]; | ||
| 177 | struct hv_message *msg = (struct hv_message *)page_addr + | 178 | struct hv_message *msg = (struct hv_message *)page_addr + |
| 178 | VMBUS_MESSAGE_SINT; | 179 | VMBUS_MESSAGE_SINT; |
| 179 | struct hv_message *copied; | 180 | struct hv_message *copied; |
| @@ -230,11 +231,12 @@ static void VmbusOnEventDPC(struct hv_driver *drv) | |||
| 230 | static int VmbusOnISR(struct hv_driver *drv) | 231 | static int VmbusOnISR(struct hv_driver *drv) |
| 231 | { | 232 | { |
| 232 | int ret = 0; | 233 | int ret = 0; |
| 234 | int cpu = smp_processor_id(); | ||
| 233 | void *page_addr; | 235 | void *page_addr; |
| 234 | struct hv_message *msg; | 236 | struct hv_message *msg; |
| 235 | union hv_synic_event_flags *event; | 237 | union hv_synic_event_flags *event; |
| 236 | 238 | ||
| 237 | page_addr = gHvContext.synICMessagePage[0]; | 239 | page_addr = gHvContext.synICMessagePage[cpu]; |
| 238 | msg = (struct hv_message *)page_addr + VMBUS_MESSAGE_SINT; | 240 | msg = (struct hv_message *)page_addr + VMBUS_MESSAGE_SINT; |
| 239 | 241 | ||
| 240 | DPRINT_ENTER(VMBUS); | 242 | DPRINT_ENTER(VMBUS); |
| @@ -248,7 +250,7 @@ static int VmbusOnISR(struct hv_driver *drv) | |||
| 248 | } | 250 | } |
| 249 | 251 | ||
| 250 | /* TODO: Check if there are events to be process */ | 252 | /* TODO: Check if there are events to be process */ |
| 251 | page_addr = gHvContext.synICEventPage[0]; | 253 | page_addr = gHvContext.synICEventPage[cpu]; |
| 252 | event = (union hv_synic_event_flags *)page_addr + VMBUS_MESSAGE_SINT; | 254 | event = (union hv_synic_event_flags *)page_addr + VMBUS_MESSAGE_SINT; |
| 253 | 255 | ||
| 254 | /* Since we are a child, we only need to check bit 0 */ | 256 | /* Since we are a child, we only need to check bit 0 */ |
diff --git a/drivers/usb/core/devices.c b/drivers/usb/core/devices.c index 96f11715cd26..355dffcc23b0 100644 --- a/drivers/usb/core/devices.c +++ b/drivers/usb/core/devices.c | |||
| @@ -494,7 +494,7 @@ static ssize_t usb_device_dump(char __user **buffer, size_t *nbytes, | |||
| 494 | return 0; | 494 | return 0; |
| 495 | /* allocate 2^1 pages = 8K (on i386); | 495 | /* allocate 2^1 pages = 8K (on i386); |
| 496 | * should be more than enough for one device */ | 496 | * should be more than enough for one device */ |
| 497 | pages_start = (char *)__get_free_pages(GFP_KERNEL, 1); | 497 | pages_start = (char *)__get_free_pages(GFP_NOIO, 1); |
| 498 | if (!pages_start) | 498 | if (!pages_start) |
| 499 | return -ENOMEM; | 499 | return -ENOMEM; |
| 500 | 500 | ||
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 0495fa651225..80995ef0868c 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c | |||
| @@ -1684,6 +1684,24 @@ int usb_hcd_alloc_bandwidth(struct usb_device *udev, | |||
| 1684 | } | 1684 | } |
| 1685 | } | 1685 | } |
| 1686 | if (cur_alt && new_alt) { | 1686 | if (cur_alt && new_alt) { |
| 1687 | struct usb_interface *iface = usb_ifnum_to_if(udev, | ||
| 1688 | cur_alt->desc.bInterfaceNumber); | ||
| 1689 | |||
| 1690 | if (iface->resetting_device) { | ||
| 1691 | /* | ||
| 1692 | * The USB core just reset the device, so the xHCI host | ||
| 1693 | * and the device will think alt setting 0 is installed. | ||
| 1694 | * However, the USB core will pass in the alternate | ||
| 1695 | * setting installed before the reset as cur_alt. Dig | ||
| 1696 | * out the alternate setting 0 structure, or the first | ||
| 1697 | * alternate setting if a broken device doesn't have alt | ||
| 1698 | * setting 0. | ||
| 1699 | */ | ||
| 1700 | cur_alt = usb_altnum_to_altsetting(iface, 0); | ||
| 1701 | if (!cur_alt) | ||
| 1702 | cur_alt = &iface->altsetting[0]; | ||
| 1703 | } | ||
| 1704 | |||
| 1687 | /* Drop all the endpoints in the current alt setting */ | 1705 | /* Drop all the endpoints in the current alt setting */ |
| 1688 | for (i = 0; i < cur_alt->desc.bNumEndpoints; i++) { | 1706 | for (i = 0; i < cur_alt->desc.bNumEndpoints; i++) { |
| 1689 | ret = hcd->driver->drop_endpoint(hcd, udev, | 1707 | ret = hcd->driver->drop_endpoint(hcd, udev, |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 0cec6caf6e9b..35cc8b9ba1f5 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
| @@ -3347,6 +3347,9 @@ static void hub_events(void) | |||
| 3347 | USB_PORT_FEAT_C_SUSPEND); | 3347 | USB_PORT_FEAT_C_SUSPEND); |
| 3348 | udev = hdev->children[i-1]; | 3348 | udev = hdev->children[i-1]; |
| 3349 | if (udev) { | 3349 | if (udev) { |
| 3350 | /* TRSMRCY = 10 msec */ | ||
| 3351 | msleep(10); | ||
| 3352 | |||
| 3350 | usb_lock_device(udev); | 3353 | usb_lock_device(udev); |
| 3351 | ret = remote_wakeup(hdev-> | 3354 | ret = remote_wakeup(hdev-> |
| 3352 | children[i-1]); | 3355 | children[i-1]); |
| @@ -3692,19 +3695,14 @@ static int usb_reset_and_verify_device(struct usb_device *udev) | |||
| 3692 | usb_enable_interface(udev, intf, true); | 3695 | usb_enable_interface(udev, intf, true); |
| 3693 | ret = 0; | 3696 | ret = 0; |
| 3694 | } else { | 3697 | } else { |
| 3695 | /* We've just reset the device, so it will think alt | 3698 | /* Let the bandwidth allocation function know that this |
| 3696 | * setting 0 is installed. For usb_set_interface() to | 3699 | * device has been reset, and it will have to use |
| 3697 | * work properly, we need to set the current alternate | 3700 | * alternate setting 0 as the current alternate setting. |
| 3698 | * interface setting to 0 (or the first alt setting, if | ||
| 3699 | * the device doesn't have alt setting 0). | ||
| 3700 | */ | 3701 | */ |
| 3701 | intf->cur_altsetting = | 3702 | intf->resetting_device = 1; |
| 3702 | usb_find_alt_setting(config, i, 0); | ||
| 3703 | if (!intf->cur_altsetting) | ||
| 3704 | intf->cur_altsetting = | ||
| 3705 | &config->intf_cache[i]->altsetting[0]; | ||
| 3706 | ret = usb_set_interface(udev, desc->bInterfaceNumber, | 3703 | ret = usb_set_interface(udev, desc->bInterfaceNumber, |
| 3707 | desc->bAlternateSetting); | 3704 | desc->bAlternateSetting); |
| 3705 | intf->resetting_device = 0; | ||
| 3708 | } | 3706 | } |
| 3709 | if (ret < 0) { | 3707 | if (ret < 0) { |
| 3710 | dev_err(&udev->dev, "failed to restore interface %d " | 3708 | dev_err(&udev->dev, "failed to restore interface %d " |
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index 1b994846e8e0..9bc95fec793f 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c | |||
| @@ -906,11 +906,11 @@ char *usb_cache_string(struct usb_device *udev, int index) | |||
| 906 | if (index <= 0) | 906 | if (index <= 0) |
| 907 | return NULL; | 907 | return NULL; |
| 908 | 908 | ||
| 909 | buf = kmalloc(MAX_USB_STRING_SIZE, GFP_KERNEL); | 909 | buf = kmalloc(MAX_USB_STRING_SIZE, GFP_NOIO); |
| 910 | if (buf) { | 910 | if (buf) { |
| 911 | len = usb_string(udev, index, buf, MAX_USB_STRING_SIZE); | 911 | len = usb_string(udev, index, buf, MAX_USB_STRING_SIZE); |
| 912 | if (len > 0) { | 912 | if (len > 0) { |
| 913 | smallbuf = kmalloc(++len, GFP_KERNEL); | 913 | smallbuf = kmalloc(++len, GFP_NOIO); |
| 914 | if (!smallbuf) | 914 | if (!smallbuf) |
| 915 | return buf; | 915 | return buf; |
| 916 | memcpy(smallbuf, buf, len); | 916 | memcpy(smallbuf, buf, len); |
| @@ -1731,7 +1731,7 @@ int usb_set_configuration(struct usb_device *dev, int configuration) | |||
| 1731 | if (cp) { | 1731 | if (cp) { |
| 1732 | nintf = cp->desc.bNumInterfaces; | 1732 | nintf = cp->desc.bNumInterfaces; |
| 1733 | new_interfaces = kmalloc(nintf * sizeof(*new_interfaces), | 1733 | new_interfaces = kmalloc(nintf * sizeof(*new_interfaces), |
| 1734 | GFP_KERNEL); | 1734 | GFP_NOIO); |
| 1735 | if (!new_interfaces) { | 1735 | if (!new_interfaces) { |
| 1736 | dev_err(&dev->dev, "Out of memory\n"); | 1736 | dev_err(&dev->dev, "Out of memory\n"); |
| 1737 | return -ENOMEM; | 1737 | return -ENOMEM; |
| @@ -1740,7 +1740,7 @@ int usb_set_configuration(struct usb_device *dev, int configuration) | |||
| 1740 | for (; n < nintf; ++n) { | 1740 | for (; n < nintf; ++n) { |
| 1741 | new_interfaces[n] = kzalloc( | 1741 | new_interfaces[n] = kzalloc( |
| 1742 | sizeof(struct usb_interface), | 1742 | sizeof(struct usb_interface), |
| 1743 | GFP_KERNEL); | 1743 | GFP_NOIO); |
| 1744 | if (!new_interfaces[n]) { | 1744 | if (!new_interfaces[n]) { |
| 1745 | dev_err(&dev->dev, "Out of memory\n"); | 1745 | dev_err(&dev->dev, "Out of memory\n"); |
| 1746 | ret = -ENOMEM; | 1746 | ret = -ENOMEM; |
diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c index 485edf937f25..5f3908f6e2dc 100644 --- a/drivers/usb/core/sysfs.c +++ b/drivers/usb/core/sysfs.c | |||
| @@ -115,6 +115,12 @@ show_speed(struct device *dev, struct device_attribute *attr, char *buf) | |||
| 115 | case USB_SPEED_HIGH: | 115 | case USB_SPEED_HIGH: |
| 116 | speed = "480"; | 116 | speed = "480"; |
| 117 | break; | 117 | break; |
| 118 | case USB_SPEED_VARIABLE: | ||
| 119 | speed = "480"; | ||
| 120 | break; | ||
| 121 | case USB_SPEED_SUPER: | ||
| 122 | speed = "5000"; | ||
| 123 | break; | ||
| 118 | default: | 124 | default: |
| 119 | speed = "unknown"; | 125 | speed = "unknown"; |
| 120 | } | 126 | } |
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 5859522d6edd..1ec3857f22e6 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
| @@ -787,9 +787,10 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd) | |||
| 787 | 787 | ||
| 788 | /* start 20 msec resume signaling from this port, | 788 | /* start 20 msec resume signaling from this port, |
| 789 | * and make khubd collect PORT_STAT_C_SUSPEND to | 789 | * and make khubd collect PORT_STAT_C_SUSPEND to |
| 790 | * stop that signaling. | 790 | * stop that signaling. Use 5 ms extra for safety, |
| 791 | * like usb_port_resume() does. | ||
| 791 | */ | 792 | */ |
| 792 | ehci->reset_done [i] = jiffies + msecs_to_jiffies (20); | 793 | ehci->reset_done[i] = jiffies + msecs_to_jiffies(25); |
| 793 | ehci_dbg (ehci, "port %d remote wakeup\n", i + 1); | 794 | ehci_dbg (ehci, "port %d remote wakeup\n", i + 1); |
| 794 | mod_timer(&hcd->rh_timer, ehci->reset_done[i]); | 795 | mod_timer(&hcd->rh_timer, ehci->reset_done[i]); |
| 795 | } | 796 | } |
diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c index 2c6571c05f35..c75d9270c752 100644 --- a/drivers/usb/host/ehci-hub.c +++ b/drivers/usb/host/ehci-hub.c | |||
| @@ -120,9 +120,26 @@ static int ehci_bus_suspend (struct usb_hcd *hcd) | |||
| 120 | del_timer_sync(&ehci->watchdog); | 120 | del_timer_sync(&ehci->watchdog); |
| 121 | del_timer_sync(&ehci->iaa_watchdog); | 121 | del_timer_sync(&ehci->iaa_watchdog); |
| 122 | 122 | ||
| 123 | port = HCS_N_PORTS (ehci->hcs_params); | ||
| 124 | spin_lock_irq (&ehci->lock); | 123 | spin_lock_irq (&ehci->lock); |
| 125 | 124 | ||
| 125 | /* Once the controller is stopped, port resumes that are already | ||
| 126 | * in progress won't complete. Hence if remote wakeup is enabled | ||
| 127 | * for the root hub and any ports are in the middle of a resume or | ||
| 128 | * remote wakeup, we must fail the suspend. | ||
| 129 | */ | ||
| 130 | if (hcd->self.root_hub->do_remote_wakeup) { | ||
| 131 | port = HCS_N_PORTS(ehci->hcs_params); | ||
| 132 | while (port--) { | ||
| 133 | if (ehci->reset_done[port] != 0) { | ||
| 134 | spin_unlock_irq(&ehci->lock); | ||
| 135 | ehci_dbg(ehci, "suspend failed because " | ||
| 136 | "port %d is resuming\n", | ||
| 137 | port + 1); | ||
| 138 | return -EBUSY; | ||
| 139 | } | ||
| 140 | } | ||
| 141 | } | ||
| 142 | |||
| 126 | /* stop schedules, clean any completed work */ | 143 | /* stop schedules, clean any completed work */ |
| 127 | if (HC_IS_RUNNING(hcd->state)) { | 144 | if (HC_IS_RUNNING(hcd->state)) { |
| 128 | ehci_quiesce (ehci); | 145 | ehci_quiesce (ehci); |
| @@ -138,6 +155,7 @@ static int ehci_bus_suspend (struct usb_hcd *hcd) | |||
| 138 | */ | 155 | */ |
| 139 | ehci->bus_suspended = 0; | 156 | ehci->bus_suspended = 0; |
| 140 | ehci->owned_ports = 0; | 157 | ehci->owned_ports = 0; |
| 158 | port = HCS_N_PORTS(ehci->hcs_params); | ||
| 141 | while (port--) { | 159 | while (port--) { |
| 142 | u32 __iomem *reg = &ehci->regs->port_status [port]; | 160 | u32 __iomem *reg = &ehci->regs->port_status [port]; |
| 143 | u32 t1 = ehci_readl(ehci, reg) & ~PORT_RWC_BITS; | 161 | u32 t1 = ehci_readl(ehci, reg) & ~PORT_RWC_BITS; |
diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c index a427d3b00634..89521775c567 100644 --- a/drivers/usb/host/ehci-q.c +++ b/drivers/usb/host/ehci-q.c | |||
| @@ -849,9 +849,10 @@ qh_make ( | |||
| 849 | * But interval 1 scheduling is simpler, and | 849 | * But interval 1 scheduling is simpler, and |
| 850 | * includes high bandwidth. | 850 | * includes high bandwidth. |
| 851 | */ | 851 | */ |
| 852 | dbg ("intr period %d uframes, NYET!", | 852 | urb->interval = 1; |
| 853 | urb->interval); | 853 | } else if (qh->period > ehci->periodic_size) { |
| 854 | goto done; | 854 | qh->period = ehci->periodic_size; |
| 855 | urb->interval = qh->period << 3; | ||
| 855 | } | 856 | } |
| 856 | } else { | 857 | } else { |
| 857 | int think_time; | 858 | int think_time; |
| @@ -874,6 +875,10 @@ qh_make ( | |||
| 874 | usb_calc_bus_time (urb->dev->speed, | 875 | usb_calc_bus_time (urb->dev->speed, |
| 875 | is_input, 0, max_packet (maxp))); | 876 | is_input, 0, max_packet (maxp))); |
| 876 | qh->period = urb->interval; | 877 | qh->period = urb->interval; |
| 878 | if (qh->period > ehci->periodic_size) { | ||
| 879 | qh->period = ehci->periodic_size; | ||
| 880 | urb->interval = qh->period; | ||
| 881 | } | ||
| 877 | } | 882 | } |
| 878 | } | 883 | } |
| 879 | 884 | ||
diff --git a/drivers/usb/host/fhci-hcd.c b/drivers/usb/host/fhci-hcd.c index 0951818ef93b..78e7c3cfcb72 100644 --- a/drivers/usb/host/fhci-hcd.c +++ b/drivers/usb/host/fhci-hcd.c | |||
| @@ -242,9 +242,10 @@ err: | |||
| 242 | static void fhci_usb_free(void *lld) | 242 | static void fhci_usb_free(void *lld) |
| 243 | { | 243 | { |
| 244 | struct fhci_usb *usb = lld; | 244 | struct fhci_usb *usb = lld; |
| 245 | struct fhci_hcd *fhci = usb->fhci; | 245 | struct fhci_hcd *fhci; |
| 246 | 246 | ||
| 247 | if (usb) { | 247 | if (usb) { |
| 248 | fhci = usb->fhci; | ||
| 248 | fhci_config_transceiver(fhci, FHCI_PORT_POWER_OFF); | 249 | fhci_config_transceiver(fhci, FHCI_PORT_POWER_OFF); |
| 249 | fhci_ep0_free(usb); | 250 | fhci_ep0_free(usb); |
| 250 | kfree(usb->actual_frame); | 251 | kfree(usb->actual_frame); |
diff --git a/drivers/usb/host/isp1362-hcd.c b/drivers/usb/host/isp1362-hcd.c index 73352f3739b5..42971657fde2 100644 --- a/drivers/usb/host/isp1362-hcd.c +++ b/drivers/usb/host/isp1362-hcd.c | |||
| @@ -2270,10 +2270,10 @@ static int isp1362_mem_config(struct usb_hcd *hcd) | |||
| 2270 | dev_info(hcd->self.controller, "ISP1362 Memory usage:\n"); | 2270 | dev_info(hcd->self.controller, "ISP1362 Memory usage:\n"); |
| 2271 | dev_info(hcd->self.controller, " ISTL: 2 * %4d: %4d @ $%04x:$%04x\n", | 2271 | dev_info(hcd->self.controller, " ISTL: 2 * %4d: %4d @ $%04x:$%04x\n", |
| 2272 | istl_size / 2, istl_size, 0, istl_size / 2); | 2272 | istl_size / 2, istl_size, 0, istl_size / 2); |
| 2273 | dev_info(hcd->self.controller, " INTL: %4d * (%3lu+8): %4d @ $%04x\n", | 2273 | dev_info(hcd->self.controller, " INTL: %4d * (%3zu+8): %4d @ $%04x\n", |
| 2274 | ISP1362_INTL_BUFFERS, intl_blksize - PTD_HEADER_SIZE, | 2274 | ISP1362_INTL_BUFFERS, intl_blksize - PTD_HEADER_SIZE, |
| 2275 | intl_size, istl_size); | 2275 | intl_size, istl_size); |
| 2276 | dev_info(hcd->self.controller, " ATL : %4d * (%3lu+8): %4d @ $%04x\n", | 2276 | dev_info(hcd->self.controller, " ATL : %4d * (%3zu+8): %4d @ $%04x\n", |
| 2277 | atl_buffers, atl_blksize - PTD_HEADER_SIZE, | 2277 | atl_buffers, atl_blksize - PTD_HEADER_SIZE, |
| 2278 | atl_size, istl_size + intl_size); | 2278 | atl_size, istl_size + intl_size); |
| 2279 | dev_info(hcd->self.controller, " USED/FREE: %4d %4d\n", total, | 2279 | dev_info(hcd->self.controller, " USED/FREE: %4d %4d\n", total, |
| @@ -2697,6 +2697,8 @@ static int __init isp1362_probe(struct platform_device *pdev) | |||
| 2697 | void __iomem *data_reg; | 2697 | void __iomem *data_reg; |
| 2698 | int irq; | 2698 | int irq; |
| 2699 | int retval = 0; | 2699 | int retval = 0; |
| 2700 | struct resource *irq_res; | ||
| 2701 | unsigned int irq_flags = 0; | ||
| 2700 | 2702 | ||
| 2701 | /* basic sanity checks first. board-specific init logic should | 2703 | /* basic sanity checks first. board-specific init logic should |
| 2702 | * have initialized this the three resources and probably board | 2704 | * have initialized this the three resources and probably board |
| @@ -2710,11 +2712,12 @@ static int __init isp1362_probe(struct platform_device *pdev) | |||
| 2710 | 2712 | ||
| 2711 | data = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 2713 | data = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 2712 | addr = platform_get_resource(pdev, IORESOURCE_MEM, 1); | 2714 | addr = platform_get_resource(pdev, IORESOURCE_MEM, 1); |
| 2713 | irq = platform_get_irq(pdev, 0); | 2715 | irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); |
| 2714 | if (!addr || !data || irq < 0) { | 2716 | if (!addr || !data || !irq_res) { |
| 2715 | retval = -ENODEV; | 2717 | retval = -ENODEV; |
| 2716 | goto err1; | 2718 | goto err1; |
| 2717 | } | 2719 | } |
| 2720 | irq = irq_res->start; | ||
| 2718 | 2721 | ||
| 2719 | #ifdef CONFIG_USB_HCD_DMA | 2722 | #ifdef CONFIG_USB_HCD_DMA |
| 2720 | if (pdev->dev.dma_mask) { | 2723 | if (pdev->dev.dma_mask) { |
| @@ -2781,12 +2784,16 @@ static int __init isp1362_probe(struct platform_device *pdev) | |||
| 2781 | } | 2784 | } |
| 2782 | #endif | 2785 | #endif |
| 2783 | 2786 | ||
| 2784 | #ifdef CONFIG_ARM | 2787 | if (irq_res->flags & IORESOURCE_IRQ_HIGHEDGE) |
| 2785 | if (isp1362_hcd->board) | 2788 | irq_flags |= IRQF_TRIGGER_RISING; |
| 2786 | set_irq_type(irq, isp1362_hcd->board->int_act_high ? IRQT_RISING : IRQT_FALLING); | 2789 | if (irq_res->flags & IORESOURCE_IRQ_LOWEDGE) |
| 2787 | #endif | 2790 | irq_flags |= IRQF_TRIGGER_FALLING; |
| 2791 | if (irq_res->flags & IORESOURCE_IRQ_HIGHLEVEL) | ||
| 2792 | irq_flags |= IRQF_TRIGGER_HIGH; | ||
| 2793 | if (irq_res->flags & IORESOURCE_IRQ_LOWLEVEL) | ||
| 2794 | irq_flags |= IRQF_TRIGGER_LOW; | ||
| 2788 | 2795 | ||
| 2789 | retval = usb_add_hcd(hcd, irq, IRQF_TRIGGER_LOW | IRQF_DISABLED | IRQF_SHARED); | 2796 | retval = usb_add_hcd(hcd, irq, irq_flags | IRQF_DISABLED | IRQF_SHARED); |
| 2790 | if (retval != 0) | 2797 | if (retval != 0) |
| 2791 | goto err6; | 2798 | goto err6; |
| 2792 | pr_info("%s, irq %d\n", hcd->product_desc, irq); | 2799 | pr_info("%s, irq %d\n", hcd->product_desc, irq); |
diff --git a/drivers/usb/host/isp1760-hcd.c b/drivers/usb/host/isp1760-hcd.c index 9600a58299db..27b8f7cb4471 100644 --- a/drivers/usb/host/isp1760-hcd.c +++ b/drivers/usb/host/isp1760-hcd.c | |||
| @@ -1039,12 +1039,12 @@ static void do_atl_int(struct usb_hcd *usb_hcd) | |||
| 1039 | if (!nakcount && (dw3 & DW3_QTD_ACTIVE)) { | 1039 | if (!nakcount && (dw3 & DW3_QTD_ACTIVE)) { |
| 1040 | u32 buffstatus; | 1040 | u32 buffstatus; |
| 1041 | 1041 | ||
| 1042 | /* XXX | 1042 | /* |
| 1043 | * NAKs are handled in HW by the chip. Usually if the | 1043 | * NAKs are handled in HW by the chip. Usually if the |
| 1044 | * device is not able to send data fast enough. | 1044 | * device is not able to send data fast enough. |
| 1045 | * This did not trigger for a long time now. | 1045 | * This happens mostly on slower hardware. |
| 1046 | */ | 1046 | */ |
| 1047 | printk(KERN_ERR "Reloading ptd %p/%p... qh %p readed: " | 1047 | printk(KERN_NOTICE "Reloading ptd %p/%p... qh %p read: " |
| 1048 | "%d of %zu done: %08x cur: %08x\n", qtd, | 1048 | "%d of %zu done: %08x cur: %08x\n", qtd, |
| 1049 | urb, qh, PTD_XFERRED_LENGTH(dw3), | 1049 | urb, qh, PTD_XFERRED_LENGTH(dw3), |
| 1050 | qtd->length, done_map, | 1050 | qtd->length, done_map, |
diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c index 5cd0e48f67fb..99cd00fd3514 100644 --- a/drivers/usb/host/uhci-hcd.c +++ b/drivers/usb/host/uhci-hcd.c | |||
| @@ -749,7 +749,20 @@ static int uhci_rh_suspend(struct usb_hcd *hcd) | |||
| 749 | spin_lock_irq(&uhci->lock); | 749 | spin_lock_irq(&uhci->lock); |
| 750 | if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags)) | 750 | if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags)) |
| 751 | rc = -ESHUTDOWN; | 751 | rc = -ESHUTDOWN; |
| 752 | else if (!uhci->dead) | 752 | else if (uhci->dead) |
| 753 | ; /* Dead controllers tell no tales */ | ||
| 754 | |||
| 755 | /* Once the controller is stopped, port resumes that are already | ||
| 756 | * in progress won't complete. Hence if remote wakeup is enabled | ||
| 757 | * for the root hub and any ports are in the middle of a resume or | ||
| 758 | * remote wakeup, we must fail the suspend. | ||
| 759 | */ | ||
| 760 | else if (hcd->self.root_hub->do_remote_wakeup && | ||
| 761 | uhci->resuming_ports) { | ||
| 762 | dev_dbg(uhci_dev(uhci), "suspend failed because a port " | ||
| 763 | "is resuming\n"); | ||
| 764 | rc = -EBUSY; | ||
| 765 | } else | ||
| 753 | suspend_rh(uhci, UHCI_RH_SUSPENDED); | 766 | suspend_rh(uhci, UHCI_RH_SUSPENDED); |
| 754 | spin_unlock_irq(&uhci->lock); | 767 | spin_unlock_irq(&uhci->lock); |
| 755 | return rc; | 768 | return rc; |
diff --git a/drivers/usb/host/uhci-hub.c b/drivers/usb/host/uhci-hub.c index 885b585360b9..8270055848ca 100644 --- a/drivers/usb/host/uhci-hub.c +++ b/drivers/usb/host/uhci-hub.c | |||
| @@ -167,7 +167,7 @@ static void uhci_check_ports(struct uhci_hcd *uhci) | |||
| 167 | /* Port received a wakeup request */ | 167 | /* Port received a wakeup request */ |
| 168 | set_bit(port, &uhci->resuming_ports); | 168 | set_bit(port, &uhci->resuming_ports); |
| 169 | uhci->ports_timeout = jiffies + | 169 | uhci->ports_timeout = jiffies + |
| 170 | msecs_to_jiffies(20); | 170 | msecs_to_jiffies(25); |
| 171 | 171 | ||
| 172 | /* Make sure we see the port again | 172 | /* Make sure we see the port again |
| 173 | * after the resuming period is over. */ | 173 | * after the resuming period is over. */ |
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c index f1ea3a33b6e6..83443d6306d6 100644 --- a/drivers/usb/serial/generic.c +++ b/drivers/usb/serial/generic.c | |||
| @@ -386,12 +386,12 @@ int usb_serial_generic_chars_in_buffer(struct tty_struct *tty) | |||
| 386 | 386 | ||
| 387 | dbg("%s - port %d", __func__, port->number); | 387 | dbg("%s - port %d", __func__, port->number); |
| 388 | 388 | ||
| 389 | if (serial->type->max_in_flight_urbs) { | 389 | spin_lock_irqsave(&port->lock, flags); |
| 390 | spin_lock_irqsave(&port->lock, flags); | 390 | if (serial->type->max_in_flight_urbs) |
| 391 | chars = port->tx_bytes_flight; | 391 | chars = port->tx_bytes_flight; |
| 392 | spin_unlock_irqrestore(&port->lock, flags); | 392 | else if (serial->num_bulk_out) |
| 393 | } else if (serial->num_bulk_out) | ||
| 394 | chars = kfifo_len(&port->write_fifo); | 393 | chars = kfifo_len(&port->write_fifo); |
| 394 | spin_unlock_irqrestore(&port->lock, flags); | ||
| 395 | 395 | ||
| 396 | dbg("%s - returns %d", __func__, chars); | 396 | dbg("%s - returns %d", __func__, chars); |
| 397 | return chars; | 397 | return chars; |
| @@ -489,6 +489,8 @@ void usb_serial_generic_write_bulk_callback(struct urb *urb) | |||
| 489 | dbg("%s - port %d", __func__, port->number); | 489 | dbg("%s - port %d", __func__, port->number); |
| 490 | 490 | ||
| 491 | if (port->serial->type->max_in_flight_urbs) { | 491 | if (port->serial->type->max_in_flight_urbs) { |
| 492 | kfree(urb->transfer_buffer); | ||
| 493 | |||
| 492 | spin_lock_irqsave(&port->lock, flags); | 494 | spin_lock_irqsave(&port->lock, flags); |
| 493 | --port->urbs_in_flight; | 495 | --port->urbs_in_flight; |
| 494 | port->tx_bytes_flight -= urb->transfer_buffer_length; | 496 | port->tx_bytes_flight -= urb->transfer_buffer_length; |
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index 64a0a2c27e12..c932f9053188 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h | |||
| @@ -1807,13 +1807,6 @@ UNUSUAL_DEV( 0x2735, 0x100b, 0x0000, 0x9999, | |||
| 1807 | US_SC_DEVICE, US_PR_DEVICE, NULL, | 1807 | US_SC_DEVICE, US_PR_DEVICE, NULL, |
| 1808 | US_FL_GO_SLOW ), | 1808 | US_FL_GO_SLOW ), |
| 1809 | 1809 | ||
| 1810 | /* Reported by Rohan Hart <rohan.hart17@gmail.com> */ | ||
| 1811 | UNUSUAL_DEV( 0x2770, 0x915d, 0x0010, 0x0010, | ||
| 1812 | "INTOVA", | ||
| 1813 | "Pixtreme", | ||
| 1814 | US_SC_DEVICE, US_PR_DEVICE, NULL, | ||
| 1815 | US_FL_FIX_CAPACITY ), | ||
| 1816 | |||
| 1817 | /* Reported by Frederic Marchal <frederic.marchal@wowcompany.com> | 1810 | /* Reported by Frederic Marchal <frederic.marchal@wowcompany.com> |
| 1818 | * Mio Moov 330 | 1811 | * Mio Moov 330 |
| 1819 | */ | 1812 | */ |
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c index 5a53d4f0dd11..e9f995486ec1 100644 --- a/drivers/usb/storage/usb.c +++ b/drivers/usb/storage/usb.c | |||
| @@ -434,7 +434,8 @@ static void adjust_quirks(struct us_data *us) | |||
| 434 | u16 vid = le16_to_cpu(us->pusb_dev->descriptor.idVendor); | 434 | u16 vid = le16_to_cpu(us->pusb_dev->descriptor.idVendor); |
| 435 | u16 pid = le16_to_cpu(us->pusb_dev->descriptor.idProduct); | 435 | u16 pid = le16_to_cpu(us->pusb_dev->descriptor.idProduct); |
| 436 | unsigned f = 0; | 436 | unsigned f = 0; |
| 437 | unsigned int mask = (US_FL_SANE_SENSE | US_FL_FIX_CAPACITY | | 437 | unsigned int mask = (US_FL_SANE_SENSE | US_FL_BAD_SENSE | |
| 438 | US_FL_FIX_CAPACITY | | ||
| 438 | US_FL_CAPACITY_HEURISTICS | US_FL_IGNORE_DEVICE | | 439 | US_FL_CAPACITY_HEURISTICS | US_FL_IGNORE_DEVICE | |
| 439 | US_FL_NOT_LOCKABLE | US_FL_MAX_SECTORS_64 | | 440 | US_FL_NOT_LOCKABLE | US_FL_MAX_SECTORS_64 | |
| 440 | US_FL_CAPACITY_OK | US_FL_IGNORE_RESIDUE | | 441 | US_FL_CAPACITY_OK | US_FL_IGNORE_RESIDUE | |
| @@ -78,7 +78,7 @@ static struct kmem_cache *bio_find_or_create_slab(unsigned int extra_size) | |||
| 78 | 78 | ||
| 79 | i = 0; | 79 | i = 0; |
| 80 | while (i < bio_slab_nr) { | 80 | while (i < bio_slab_nr) { |
| 81 | struct bio_slab *bslab = &bio_slabs[i]; | 81 | bslab = &bio_slabs[i]; |
| 82 | 82 | ||
| 83 | if (!bslab->slab && entry == -1) | 83 | if (!bslab->slab && entry == -1) |
| 84 | entry = i; | 84 | entry = i; |
diff --git a/fs/btrfs/acl.c b/fs/btrfs/acl.c index 2e9e69987a82..54f4798ab46a 100644 --- a/fs/btrfs/acl.c +++ b/fs/btrfs/acl.c | |||
| @@ -112,12 +112,14 @@ static int btrfs_set_acl(struct btrfs_trans_handle *trans, | |||
| 112 | switch (type) { | 112 | switch (type) { |
| 113 | case ACL_TYPE_ACCESS: | 113 | case ACL_TYPE_ACCESS: |
| 114 | mode = inode->i_mode; | 114 | mode = inode->i_mode; |
| 115 | ret = posix_acl_equiv_mode(acl, &mode); | ||
| 116 | if (ret < 0) | ||
| 117 | return ret; | ||
| 118 | ret = 0; | ||
| 119 | inode->i_mode = mode; | ||
| 120 | name = POSIX_ACL_XATTR_ACCESS; | 115 | name = POSIX_ACL_XATTR_ACCESS; |
| 116 | if (acl) { | ||
| 117 | ret = posix_acl_equiv_mode(acl, &mode); | ||
| 118 | if (ret < 0) | ||
| 119 | return ret; | ||
| 120 | inode->i_mode = mode; | ||
| 121 | } | ||
| 122 | ret = 0; | ||
| 121 | break; | 123 | break; |
| 122 | case ACL_TYPE_DEFAULT: | 124 | case ACL_TYPE_DEFAULT: |
| 123 | if (!S_ISDIR(inode->i_mode)) | 125 | if (!S_ISDIR(inode->i_mode)) |
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 56e50137d0e6..432a2da4641e 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
| @@ -83,6 +83,17 @@ static int block_group_bits(struct btrfs_block_group_cache *cache, u64 bits) | |||
| 83 | return (cache->flags & bits) == bits; | 83 | return (cache->flags & bits) == bits; |
| 84 | } | 84 | } |
| 85 | 85 | ||
| 86 | void btrfs_get_block_group(struct btrfs_block_group_cache *cache) | ||
| 87 | { | ||
| 88 | atomic_inc(&cache->count); | ||
| 89 | } | ||
| 90 | |||
| 91 | void btrfs_put_block_group(struct btrfs_block_group_cache *cache) | ||
| 92 | { | ||
| 93 | if (atomic_dec_and_test(&cache->count)) | ||
| 94 | kfree(cache); | ||
| 95 | } | ||
| 96 | |||
| 86 | /* | 97 | /* |
| 87 | * this adds the block group to the fs_info rb tree for the block group | 98 | * this adds the block group to the fs_info rb tree for the block group |
| 88 | * cache | 99 | * cache |
| @@ -156,7 +167,7 @@ block_group_cache_tree_search(struct btrfs_fs_info *info, u64 bytenr, | |||
| 156 | } | 167 | } |
| 157 | } | 168 | } |
| 158 | if (ret) | 169 | if (ret) |
| 159 | atomic_inc(&ret->count); | 170 | btrfs_get_block_group(ret); |
| 160 | spin_unlock(&info->block_group_cache_lock); | 171 | spin_unlock(&info->block_group_cache_lock); |
| 161 | 172 | ||
| 162 | return ret; | 173 | return ret; |
| @@ -407,6 +418,8 @@ err: | |||
| 407 | 418 | ||
| 408 | put_caching_control(caching_ctl); | 419 | put_caching_control(caching_ctl); |
| 409 | atomic_dec(&block_group->space_info->caching_threads); | 420 | atomic_dec(&block_group->space_info->caching_threads); |
| 421 | btrfs_put_block_group(block_group); | ||
| 422 | |||
| 410 | return 0; | 423 | return 0; |
| 411 | } | 424 | } |
| 412 | 425 | ||
| @@ -447,6 +460,7 @@ static int cache_block_group(struct btrfs_block_group_cache *cache) | |||
| 447 | up_write(&fs_info->extent_commit_sem); | 460 | up_write(&fs_info->extent_commit_sem); |
| 448 | 461 | ||
| 449 | atomic_inc(&cache->space_info->caching_threads); | 462 | atomic_inc(&cache->space_info->caching_threads); |
| 463 | btrfs_get_block_group(cache); | ||
| 450 | 464 | ||
| 451 | tsk = kthread_run(caching_kthread, cache, "btrfs-cache-%llu\n", | 465 | tsk = kthread_run(caching_kthread, cache, "btrfs-cache-%llu\n", |
| 452 | cache->key.objectid); | 466 | cache->key.objectid); |
| @@ -486,12 +500,6 @@ struct btrfs_block_group_cache *btrfs_lookup_block_group( | |||
| 486 | return cache; | 500 | return cache; |
| 487 | } | 501 | } |
| 488 | 502 | ||
| 489 | void btrfs_put_block_group(struct btrfs_block_group_cache *cache) | ||
| 490 | { | ||
| 491 | if (atomic_dec_and_test(&cache->count)) | ||
| 492 | kfree(cache); | ||
| 493 | } | ||
| 494 | |||
| 495 | static struct btrfs_space_info *__find_space_info(struct btrfs_fs_info *info, | 503 | static struct btrfs_space_info *__find_space_info(struct btrfs_fs_info *info, |
| 496 | u64 flags) | 504 | u64 flags) |
| 497 | { | 505 | { |
| @@ -2582,7 +2590,7 @@ next_block_group(struct btrfs_root *root, | |||
| 2582 | if (node) { | 2590 | if (node) { |
| 2583 | cache = rb_entry(node, struct btrfs_block_group_cache, | 2591 | cache = rb_entry(node, struct btrfs_block_group_cache, |
| 2584 | cache_node); | 2592 | cache_node); |
| 2585 | atomic_inc(&cache->count); | 2593 | btrfs_get_block_group(cache); |
| 2586 | } else | 2594 | } else |
| 2587 | cache = NULL; | 2595 | cache = NULL; |
| 2588 | spin_unlock(&root->fs_info->block_group_cache_lock); | 2596 | spin_unlock(&root->fs_info->block_group_cache_lock); |
| @@ -4227,7 +4235,7 @@ search: | |||
| 4227 | u64 offset; | 4235 | u64 offset; |
| 4228 | int cached; | 4236 | int cached; |
| 4229 | 4237 | ||
| 4230 | atomic_inc(&block_group->count); | 4238 | btrfs_get_block_group(block_group); |
| 4231 | search_start = block_group->key.objectid; | 4239 | search_start = block_group->key.objectid; |
| 4232 | 4240 | ||
| 4233 | have_block_group: | 4241 | have_block_group: |
| @@ -4315,7 +4323,7 @@ have_block_group: | |||
| 4315 | 4323 | ||
| 4316 | btrfs_put_block_group(block_group); | 4324 | btrfs_put_block_group(block_group); |
| 4317 | block_group = last_ptr->block_group; | 4325 | block_group = last_ptr->block_group; |
| 4318 | atomic_inc(&block_group->count); | 4326 | btrfs_get_block_group(block_group); |
| 4319 | spin_unlock(&last_ptr->lock); | 4327 | spin_unlock(&last_ptr->lock); |
| 4320 | spin_unlock(&last_ptr->refill_lock); | 4328 | spin_unlock(&last_ptr->refill_lock); |
| 4321 | 4329 | ||
| @@ -7395,9 +7403,7 @@ int btrfs_free_block_groups(struct btrfs_fs_info *info) | |||
| 7395 | wait_block_group_cache_done(block_group); | 7403 | wait_block_group_cache_done(block_group); |
| 7396 | 7404 | ||
| 7397 | btrfs_remove_free_space_cache(block_group); | 7405 | btrfs_remove_free_space_cache(block_group); |
| 7398 | 7406 | btrfs_put_block_group(block_group); | |
| 7399 | WARN_ON(atomic_read(&block_group->count) != 1); | ||
| 7400 | kfree(block_group); | ||
| 7401 | 7407 | ||
| 7402 | spin_lock(&info->block_group_cache_lock); | 7408 | spin_lock(&info->block_group_cache_lock); |
| 7403 | } | 7409 | } |
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index feaa13b105d9..c02033596f02 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c | |||
| @@ -506,7 +506,8 @@ next_slot: | |||
| 506 | } | 506 | } |
| 507 | 507 | ||
| 508 | static int extent_mergeable(struct extent_buffer *leaf, int slot, | 508 | static int extent_mergeable(struct extent_buffer *leaf, int slot, |
| 509 | u64 objectid, u64 bytenr, u64 *start, u64 *end) | 509 | u64 objectid, u64 bytenr, u64 orig_offset, |
| 510 | u64 *start, u64 *end) | ||
| 510 | { | 511 | { |
| 511 | struct btrfs_file_extent_item *fi; | 512 | struct btrfs_file_extent_item *fi; |
| 512 | struct btrfs_key key; | 513 | struct btrfs_key key; |
| @@ -522,6 +523,7 @@ static int extent_mergeable(struct extent_buffer *leaf, int slot, | |||
| 522 | fi = btrfs_item_ptr(leaf, slot, struct btrfs_file_extent_item); | 523 | fi = btrfs_item_ptr(leaf, slot, struct btrfs_file_extent_item); |
| 523 | if (btrfs_file_extent_type(leaf, fi) != BTRFS_FILE_EXTENT_REG || | 524 | if (btrfs_file_extent_type(leaf, fi) != BTRFS_FILE_EXTENT_REG || |
| 524 | btrfs_file_extent_disk_bytenr(leaf, fi) != bytenr || | 525 | btrfs_file_extent_disk_bytenr(leaf, fi) != bytenr || |
| 526 | btrfs_file_extent_offset(leaf, fi) != key.offset - orig_offset || | ||
| 525 | btrfs_file_extent_compression(leaf, fi) || | 527 | btrfs_file_extent_compression(leaf, fi) || |
| 526 | btrfs_file_extent_encryption(leaf, fi) || | 528 | btrfs_file_extent_encryption(leaf, fi) || |
| 527 | btrfs_file_extent_other_encoding(leaf, fi)) | 529 | btrfs_file_extent_other_encoding(leaf, fi)) |
| @@ -561,6 +563,7 @@ int btrfs_mark_extent_written(struct btrfs_trans_handle *trans, | |||
| 561 | u64 split; | 563 | u64 split; |
| 562 | int del_nr = 0; | 564 | int del_nr = 0; |
| 563 | int del_slot = 0; | 565 | int del_slot = 0; |
| 566 | int recow; | ||
| 564 | int ret; | 567 | int ret; |
| 565 | 568 | ||
| 566 | btrfs_drop_extent_cache(inode, start, end - 1, 0); | 569 | btrfs_drop_extent_cache(inode, start, end - 1, 0); |
| @@ -568,6 +571,7 @@ int btrfs_mark_extent_written(struct btrfs_trans_handle *trans, | |||
| 568 | path = btrfs_alloc_path(); | 571 | path = btrfs_alloc_path(); |
| 569 | BUG_ON(!path); | 572 | BUG_ON(!path); |
| 570 | again: | 573 | again: |
| 574 | recow = 0; | ||
| 571 | split = start; | 575 | split = start; |
| 572 | key.objectid = inode->i_ino; | 576 | key.objectid = inode->i_ino; |
| 573 | key.type = BTRFS_EXTENT_DATA_KEY; | 577 | key.type = BTRFS_EXTENT_DATA_KEY; |
| @@ -591,12 +595,60 @@ again: | |||
| 591 | bytenr = btrfs_file_extent_disk_bytenr(leaf, fi); | 595 | bytenr = btrfs_file_extent_disk_bytenr(leaf, fi); |
| 592 | num_bytes = btrfs_file_extent_disk_num_bytes(leaf, fi); | 596 | num_bytes = btrfs_file_extent_disk_num_bytes(leaf, fi); |
| 593 | orig_offset = key.offset - btrfs_file_extent_offset(leaf, fi); | 597 | orig_offset = key.offset - btrfs_file_extent_offset(leaf, fi); |
| 598 | memcpy(&new_key, &key, sizeof(new_key)); | ||
| 599 | |||
| 600 | if (start == key.offset && end < extent_end) { | ||
| 601 | other_start = 0; | ||
| 602 | other_end = start; | ||
| 603 | if (extent_mergeable(leaf, path->slots[0] - 1, | ||
| 604 | inode->i_ino, bytenr, orig_offset, | ||
| 605 | &other_start, &other_end)) { | ||
| 606 | new_key.offset = end; | ||
| 607 | btrfs_set_item_key_safe(trans, root, path, &new_key); | ||
| 608 | fi = btrfs_item_ptr(leaf, path->slots[0], | ||
| 609 | struct btrfs_file_extent_item); | ||
| 610 | btrfs_set_file_extent_num_bytes(leaf, fi, | ||
| 611 | extent_end - end); | ||
| 612 | btrfs_set_file_extent_offset(leaf, fi, | ||
| 613 | end - orig_offset); | ||
| 614 | fi = btrfs_item_ptr(leaf, path->slots[0] - 1, | ||
| 615 | struct btrfs_file_extent_item); | ||
| 616 | btrfs_set_file_extent_num_bytes(leaf, fi, | ||
| 617 | end - other_start); | ||
| 618 | btrfs_mark_buffer_dirty(leaf); | ||
| 619 | goto out; | ||
| 620 | } | ||
| 621 | } | ||
| 622 | |||
| 623 | if (start > key.offset && end == extent_end) { | ||
| 624 | other_start = end; | ||
| 625 | other_end = 0; | ||
| 626 | if (extent_mergeable(leaf, path->slots[0] + 1, | ||
| 627 | inode->i_ino, bytenr, orig_offset, | ||
| 628 | &other_start, &other_end)) { | ||
| 629 | fi = btrfs_item_ptr(leaf, path->slots[0], | ||
| 630 | struct btrfs_file_extent_item); | ||
| 631 | btrfs_set_file_extent_num_bytes(leaf, fi, | ||
| 632 | start - key.offset); | ||
| 633 | path->slots[0]++; | ||
| 634 | new_key.offset = start; | ||
| 635 | btrfs_set_item_key_safe(trans, root, path, &new_key); | ||
| 636 | |||
| 637 | fi = btrfs_item_ptr(leaf, path->slots[0], | ||
| 638 | struct btrfs_file_extent_item); | ||
| 639 | btrfs_set_file_extent_num_bytes(leaf, fi, | ||
| 640 | other_end - start); | ||
| 641 | btrfs_set_file_extent_offset(leaf, fi, | ||
| 642 | start - orig_offset); | ||
| 643 | btrfs_mark_buffer_dirty(leaf); | ||
| 644 | goto out; | ||
| 645 | } | ||
| 646 | } | ||
| 594 | 647 | ||
| 595 | while (start > key.offset || end < extent_end) { | 648 | while (start > key.offset || end < extent_end) { |
| 596 | if (key.offset == start) | 649 | if (key.offset == start) |
| 597 | split = end; | 650 | split = end; |
| 598 | 651 | ||
| 599 | memcpy(&new_key, &key, sizeof(new_key)); | ||
| 600 | new_key.offset = split; | 652 | new_key.offset = split; |
| 601 | ret = btrfs_duplicate_item(trans, root, path, &new_key); | 653 | ret = btrfs_duplicate_item(trans, root, path, &new_key); |
| 602 | if (ret == -EAGAIN) { | 654 | if (ret == -EAGAIN) { |
| @@ -631,15 +683,18 @@ again: | |||
| 631 | path->slots[0]--; | 683 | path->slots[0]--; |
| 632 | extent_end = end; | 684 | extent_end = end; |
| 633 | } | 685 | } |
| 686 | recow = 1; | ||
| 634 | } | 687 | } |
| 635 | 688 | ||
| 636 | fi = btrfs_item_ptr(leaf, path->slots[0], | ||
| 637 | struct btrfs_file_extent_item); | ||
| 638 | |||
| 639 | other_start = end; | 689 | other_start = end; |
| 640 | other_end = 0; | 690 | other_end = 0; |
| 641 | if (extent_mergeable(leaf, path->slots[0] + 1, inode->i_ino, | 691 | if (extent_mergeable(leaf, path->slots[0] + 1, |
| 642 | bytenr, &other_start, &other_end)) { | 692 | inode->i_ino, bytenr, orig_offset, |
| 693 | &other_start, &other_end)) { | ||
| 694 | if (recow) { | ||
| 695 | btrfs_release_path(root, path); | ||
| 696 | goto again; | ||
| 697 | } | ||
| 643 | extent_end = other_end; | 698 | extent_end = other_end; |
| 644 | del_slot = path->slots[0] + 1; | 699 | del_slot = path->slots[0] + 1; |
| 645 | del_nr++; | 700 | del_nr++; |
| @@ -650,8 +705,13 @@ again: | |||
| 650 | } | 705 | } |
| 651 | other_start = 0; | 706 | other_start = 0; |
| 652 | other_end = start; | 707 | other_end = start; |
| 653 | if (extent_mergeable(leaf, path->slots[0] - 1, inode->i_ino, | 708 | if (extent_mergeable(leaf, path->slots[0] - 1, |
| 654 | bytenr, &other_start, &other_end)) { | 709 | inode->i_ino, bytenr, orig_offset, |
| 710 | &other_start, &other_end)) { | ||
| 711 | if (recow) { | ||
| 712 | btrfs_release_path(root, path); | ||
| 713 | goto again; | ||
| 714 | } | ||
| 655 | key.offset = other_start; | 715 | key.offset = other_start; |
| 656 | del_slot = path->slots[0]; | 716 | del_slot = path->slots[0]; |
| 657 | del_nr++; | 717 | del_nr++; |
| @@ -660,22 +720,22 @@ again: | |||
| 660 | inode->i_ino, orig_offset); | 720 | inode->i_ino, orig_offset); |
| 661 | BUG_ON(ret); | 721 | BUG_ON(ret); |
| 662 | } | 722 | } |
| 723 | fi = btrfs_item_ptr(leaf, path->slots[0], | ||
| 724 | struct btrfs_file_extent_item); | ||
| 663 | if (del_nr == 0) { | 725 | if (del_nr == 0) { |
| 664 | btrfs_set_file_extent_type(leaf, fi, | 726 | btrfs_set_file_extent_type(leaf, fi, |
| 665 | BTRFS_FILE_EXTENT_REG); | 727 | BTRFS_FILE_EXTENT_REG); |
| 666 | btrfs_mark_buffer_dirty(leaf); | 728 | btrfs_mark_buffer_dirty(leaf); |
| 667 | goto out; | 729 | } else { |
| 668 | } | 730 | btrfs_set_file_extent_type(leaf, fi, |
| 669 | 731 | BTRFS_FILE_EXTENT_REG); | |
| 670 | fi = btrfs_item_ptr(leaf, del_slot - 1, | 732 | btrfs_set_file_extent_num_bytes(leaf, fi, |
| 671 | struct btrfs_file_extent_item); | 733 | extent_end - key.offset); |
| 672 | btrfs_set_file_extent_type(leaf, fi, BTRFS_FILE_EXTENT_REG); | 734 | btrfs_mark_buffer_dirty(leaf); |
| 673 | btrfs_set_file_extent_num_bytes(leaf, fi, | ||
| 674 | extent_end - key.offset); | ||
| 675 | btrfs_mark_buffer_dirty(leaf); | ||
| 676 | 735 | ||
| 677 | ret = btrfs_del_items(trans, root, path, del_slot, del_nr); | 736 | ret = btrfs_del_items(trans, root, path, del_slot, del_nr); |
| 678 | BUG_ON(ret); | 737 | BUG_ON(ret); |
| 738 | } | ||
| 679 | out: | 739 | out: |
| 680 | btrfs_free_path(path); | 740 | btrfs_free_path(path); |
| 681 | return 0; | 741 | return 0; |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 5440bab23635..b330e27c2d8b 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
| @@ -3796,6 +3796,12 @@ struct inode *btrfs_lookup_dentry(struct inode *dir, struct dentry *dentry) | |||
| 3796 | 3796 | ||
| 3797 | if (location.type == BTRFS_INODE_ITEM_KEY) { | 3797 | if (location.type == BTRFS_INODE_ITEM_KEY) { |
| 3798 | inode = btrfs_iget(dir->i_sb, &location, root); | 3798 | inode = btrfs_iget(dir->i_sb, &location, root); |
| 3799 | if (unlikely(root->clean_orphans) && | ||
| 3800 | !(inode->i_sb->s_flags & MS_RDONLY)) { | ||
| 3801 | down_read(&root->fs_info->cleanup_work_sem); | ||
| 3802 | btrfs_orphan_cleanup(root); | ||
| 3803 | up_read(&root->fs_info->cleanup_work_sem); | ||
| 3804 | } | ||
| 3799 | return inode; | 3805 | return inode; |
| 3800 | } | 3806 | } |
| 3801 | 3807 | ||
| @@ -3995,7 +4001,11 @@ skip: | |||
| 3995 | 4001 | ||
| 3996 | /* Reached end of directory/root. Bump pos past the last item. */ | 4002 | /* Reached end of directory/root. Bump pos past the last item. */ |
| 3997 | if (key_type == BTRFS_DIR_INDEX_KEY) | 4003 | if (key_type == BTRFS_DIR_INDEX_KEY) |
| 3998 | filp->f_pos = INT_LIMIT(off_t); | 4004 | /* |
| 4005 | * 32-bit glibc will use getdents64, but then strtol - | ||
| 4006 | * so the last number we can serve is this. | ||
| 4007 | */ | ||
| 4008 | filp->f_pos = 0x7fffffff; | ||
| 3999 | else | 4009 | else |
| 4000 | filp->f_pos++; | 4010 | filp->f_pos++; |
| 4001 | nopos: | 4011 | nopos: |
diff --git a/fs/btrfs/ordered-data.c b/fs/btrfs/ordered-data.c index b10a49d4bc6a..5c2a9e78a949 100644 --- a/fs/btrfs/ordered-data.c +++ b/fs/btrfs/ordered-data.c | |||
| @@ -626,6 +626,8 @@ int btrfs_ordered_update_i_size(struct inode *inode, u64 offset, | |||
| 626 | 626 | ||
| 627 | if (ordered) | 627 | if (ordered) |
| 628 | offset = entry_end(ordered); | 628 | offset = entry_end(ordered); |
| 629 | else | ||
| 630 | offset = ALIGN(offset, BTRFS_I(inode)->root->sectorsize); | ||
| 629 | 631 | ||
| 630 | mutex_lock(&tree->mutex); | 632 | mutex_lock(&tree->mutex); |
| 631 | disk_i_size = BTRFS_I(inode)->disk_i_size; | 633 | disk_i_size = BTRFS_I(inode)->disk_i_size; |
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index a9728680eca8..ed3e4a2ec2c8 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c | |||
| @@ -3281,8 +3281,10 @@ static noinline_for_stack int relocate_block_group(struct reloc_control *rc) | |||
| 3281 | return -ENOMEM; | 3281 | return -ENOMEM; |
| 3282 | 3282 | ||
| 3283 | path = btrfs_alloc_path(); | 3283 | path = btrfs_alloc_path(); |
| 3284 | if (!path) | 3284 | if (!path) { |
| 3285 | kfree(cluster); | ||
| 3285 | return -ENOMEM; | 3286 | return -ENOMEM; |
| 3287 | } | ||
| 3286 | 3288 | ||
| 3287 | rc->extents_found = 0; | 3289 | rc->extents_found = 0; |
| 3288 | rc->extents_skipped = 0; | 3290 | rc->extents_skipped = 0; |
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 198cff28766d..220dad5db017 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
| @@ -2649,8 +2649,10 @@ again: | |||
| 2649 | em = lookup_extent_mapping(em_tree, logical, *length); | 2649 | em = lookup_extent_mapping(em_tree, logical, *length); |
| 2650 | read_unlock(&em_tree->lock); | 2650 | read_unlock(&em_tree->lock); |
| 2651 | 2651 | ||
| 2652 | if (!em && unplug_page) | 2652 | if (!em && unplug_page) { |
| 2653 | kfree(multi); | ||
| 2653 | return 0; | 2654 | return 0; |
| 2655 | } | ||
| 2654 | 2656 | ||
| 2655 | if (!em) { | 2657 | if (!em) { |
| 2656 | printk(KERN_CRIT "unable to find logical %llu len %llu\n", | 2658 | printk(KERN_CRIT "unable to find logical %llu len %llu\n", |
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 332dd00f0894..c5c45de1a2ee 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c | |||
| @@ -1005,6 +1005,9 @@ COMPATIBLE_IOCTL(SCSI_IOCTL_SEND_COMMAND) | |||
| 1005 | COMPATIBLE_IOCTL(SCSI_IOCTL_PROBE_HOST) | 1005 | COMPATIBLE_IOCTL(SCSI_IOCTL_PROBE_HOST) |
| 1006 | COMPATIBLE_IOCTL(SCSI_IOCTL_GET_PCI) | 1006 | COMPATIBLE_IOCTL(SCSI_IOCTL_GET_PCI) |
| 1007 | #endif | 1007 | #endif |
| 1008 | /* Big V (don't complain on serial console) */ | ||
| 1009 | IGNORE_IOCTL(VT_OPENQRY) | ||
| 1010 | IGNORE_IOCTL(VT_GETMODE) | ||
| 1008 | /* Little p (/dev/rtc, /dev/envctrl, etc.) */ | 1011 | /* Little p (/dev/rtc, /dev/envctrl, etc.) */ |
| 1009 | COMPATIBLE_IOCTL(RTC_AIE_ON) | 1012 | COMPATIBLE_IOCTL(RTC_AIE_ON) |
| 1010 | COMPATIBLE_IOCTL(RTC_AIE_OFF) | 1013 | COMPATIBLE_IOCTL(RTC_AIE_OFF) |
diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c index fbb6e5eed697..7cb0a59f4b9d 100644 --- a/fs/ecryptfs/crypto.c +++ b/fs/ecryptfs/crypto.c | |||
| @@ -1748,7 +1748,7 @@ ecryptfs_process_key_cipher(struct crypto_blkcipher **key_tfm, | |||
| 1748 | char *cipher_name, size_t *key_size) | 1748 | char *cipher_name, size_t *key_size) |
| 1749 | { | 1749 | { |
| 1750 | char dummy_key[ECRYPTFS_MAX_KEY_BYTES]; | 1750 | char dummy_key[ECRYPTFS_MAX_KEY_BYTES]; |
| 1751 | char *full_alg_name; | 1751 | char *full_alg_name = NULL; |
| 1752 | int rc; | 1752 | int rc; |
| 1753 | 1753 | ||
| 1754 | *key_tfm = NULL; | 1754 | *key_tfm = NULL; |
| @@ -1763,7 +1763,6 @@ ecryptfs_process_key_cipher(struct crypto_blkcipher **key_tfm, | |||
| 1763 | if (rc) | 1763 | if (rc) |
| 1764 | goto out; | 1764 | goto out; |
| 1765 | *key_tfm = crypto_alloc_blkcipher(full_alg_name, 0, CRYPTO_ALG_ASYNC); | 1765 | *key_tfm = crypto_alloc_blkcipher(full_alg_name, 0, CRYPTO_ALG_ASYNC); |
| 1766 | kfree(full_alg_name); | ||
| 1767 | if (IS_ERR(*key_tfm)) { | 1766 | if (IS_ERR(*key_tfm)) { |
| 1768 | rc = PTR_ERR(*key_tfm); | 1767 | rc = PTR_ERR(*key_tfm); |
| 1769 | printk(KERN_ERR "Unable to allocate crypto cipher with name " | 1768 | printk(KERN_ERR "Unable to allocate crypto cipher with name " |
| @@ -1786,6 +1785,7 @@ ecryptfs_process_key_cipher(struct crypto_blkcipher **key_tfm, | |||
| 1786 | goto out; | 1785 | goto out; |
| 1787 | } | 1786 | } |
| 1788 | out: | 1787 | out: |
| 1788 | kfree(full_alg_name); | ||
| 1789 | return rc; | 1789 | return rc; |
| 1790 | } | 1790 | } |
| 1791 | 1791 | ||
diff --git a/fs/ecryptfs/file.c b/fs/ecryptfs/file.c index 9e944057001b..678172b61be2 100644 --- a/fs/ecryptfs/file.c +++ b/fs/ecryptfs/file.c | |||
| @@ -158,7 +158,7 @@ static int ecryptfs_open(struct inode *inode, struct file *file) | |||
| 158 | struct dentry *ecryptfs_dentry = file->f_path.dentry; | 158 | struct dentry *ecryptfs_dentry = file->f_path.dentry; |
| 159 | /* Private value of ecryptfs_dentry allocated in | 159 | /* Private value of ecryptfs_dentry allocated in |
| 160 | * ecryptfs_lookup() */ | 160 | * ecryptfs_lookup() */ |
| 161 | struct dentry *lower_dentry = ecryptfs_dentry_to_lower(ecryptfs_dentry); | 161 | struct dentry *lower_dentry; |
| 162 | struct ecryptfs_file_info *file_info; | 162 | struct ecryptfs_file_info *file_info; |
| 163 | 163 | ||
| 164 | mount_crypt_stat = &ecryptfs_superblock_to_private( | 164 | mount_crypt_stat = &ecryptfs_superblock_to_private( |
| @@ -191,13 +191,6 @@ static int ecryptfs_open(struct inode *inode, struct file *file) | |||
| 191 | | ECRYPTFS_ENCRYPTED); | 191 | | ECRYPTFS_ENCRYPTED); |
| 192 | } | 192 | } |
| 193 | mutex_unlock(&crypt_stat->cs_mutex); | 193 | mutex_unlock(&crypt_stat->cs_mutex); |
| 194 | if ((ecryptfs_inode_to_private(inode)->lower_file->f_flags & O_RDONLY) | ||
| 195 | && !(file->f_flags & O_RDONLY)) { | ||
| 196 | rc = -EPERM; | ||
| 197 | printk(KERN_WARNING "%s: Lower persistent file is RO; eCryptfs " | ||
| 198 | "file must hence be opened RO\n", __func__); | ||
| 199 | goto out; | ||
| 200 | } | ||
| 201 | if (!ecryptfs_inode_to_private(inode)->lower_file) { | 194 | if (!ecryptfs_inode_to_private(inode)->lower_file) { |
| 202 | rc = ecryptfs_init_persistent_file(ecryptfs_dentry); | 195 | rc = ecryptfs_init_persistent_file(ecryptfs_dentry); |
| 203 | if (rc) { | 196 | if (rc) { |
| @@ -208,6 +201,13 @@ static int ecryptfs_open(struct inode *inode, struct file *file) | |||
| 208 | goto out; | 201 | goto out; |
| 209 | } | 202 | } |
| 210 | } | 203 | } |
| 204 | if ((ecryptfs_inode_to_private(inode)->lower_file->f_flags & O_RDONLY) | ||
| 205 | && !(file->f_flags & O_RDONLY)) { | ||
| 206 | rc = -EPERM; | ||
| 207 | printk(KERN_WARNING "%s: Lower persistent file is RO; eCryptfs " | ||
| 208 | "file must hence be opened RO\n", __func__); | ||
| 209 | goto out; | ||
| 210 | } | ||
| 211 | ecryptfs_set_file_lower( | 211 | ecryptfs_set_file_lower( |
| 212 | file, ecryptfs_inode_to_private(inode)->lower_file); | 212 | file, ecryptfs_inode_to_private(inode)->lower_file); |
| 213 | if (S_ISDIR(ecryptfs_dentry->d_inode->i_mode)) { | 213 | if (S_ISDIR(ecryptfs_dentry->d_inode->i_mode)) { |
| @@ -299,7 +299,6 @@ static int ecryptfs_ioctl(struct inode *inode, struct file *file, | |||
| 299 | const struct file_operations ecryptfs_dir_fops = { | 299 | const struct file_operations ecryptfs_dir_fops = { |
| 300 | .readdir = ecryptfs_readdir, | 300 | .readdir = ecryptfs_readdir, |
| 301 | .ioctl = ecryptfs_ioctl, | 301 | .ioctl = ecryptfs_ioctl, |
| 302 | .mmap = generic_file_mmap, | ||
| 303 | .open = ecryptfs_open, | 302 | .open = ecryptfs_open, |
| 304 | .flush = ecryptfs_flush, | 303 | .flush = ecryptfs_flush, |
| 305 | .release = ecryptfs_release, | 304 | .release = ecryptfs_release, |
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c index 7f8545032930..4a430ab4115c 100644 --- a/fs/ecryptfs/inode.c +++ b/fs/ecryptfs/inode.c | |||
| @@ -282,7 +282,8 @@ int ecryptfs_lookup_and_interpose_lower(struct dentry *ecryptfs_dentry, | |||
| 282 | goto out; | 282 | goto out; |
| 283 | } | 283 | } |
| 284 | rc = ecryptfs_interpose(lower_dentry, ecryptfs_dentry, | 284 | rc = ecryptfs_interpose(lower_dentry, ecryptfs_dentry, |
| 285 | ecryptfs_dir_inode->i_sb, 1); | 285 | ecryptfs_dir_inode->i_sb, |
| 286 | ECRYPTFS_INTERPOSE_FLAG_D_ADD); | ||
| 286 | if (rc) { | 287 | if (rc) { |
| 287 | printk(KERN_ERR "%s: Error interposing; rc = [%d]\n", | 288 | printk(KERN_ERR "%s: Error interposing; rc = [%d]\n", |
| 288 | __func__, rc); | 289 | __func__, rc); |
| @@ -463,9 +464,6 @@ out_lock: | |||
| 463 | unlock_dir(lower_dir_dentry); | 464 | unlock_dir(lower_dir_dentry); |
| 464 | dput(lower_new_dentry); | 465 | dput(lower_new_dentry); |
| 465 | dput(lower_old_dentry); | 466 | dput(lower_old_dentry); |
| 466 | d_drop(lower_old_dentry); | ||
| 467 | d_drop(new_dentry); | ||
| 468 | d_drop(old_dentry); | ||
| 469 | return rc; | 467 | return rc; |
| 470 | } | 468 | } |
| 471 | 469 | ||
| @@ -614,6 +612,7 @@ ecryptfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
| 614 | struct dentry *lower_new_dentry; | 612 | struct dentry *lower_new_dentry; |
| 615 | struct dentry *lower_old_dir_dentry; | 613 | struct dentry *lower_old_dir_dentry; |
| 616 | struct dentry *lower_new_dir_dentry; | 614 | struct dentry *lower_new_dir_dentry; |
| 615 | struct dentry *trap = NULL; | ||
| 617 | 616 | ||
| 618 | lower_old_dentry = ecryptfs_dentry_to_lower(old_dentry); | 617 | lower_old_dentry = ecryptfs_dentry_to_lower(old_dentry); |
| 619 | lower_new_dentry = ecryptfs_dentry_to_lower(new_dentry); | 618 | lower_new_dentry = ecryptfs_dentry_to_lower(new_dentry); |
| @@ -621,7 +620,17 @@ ecryptfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
| 621 | dget(lower_new_dentry); | 620 | dget(lower_new_dentry); |
| 622 | lower_old_dir_dentry = dget_parent(lower_old_dentry); | 621 | lower_old_dir_dentry = dget_parent(lower_old_dentry); |
| 623 | lower_new_dir_dentry = dget_parent(lower_new_dentry); | 622 | lower_new_dir_dentry = dget_parent(lower_new_dentry); |
| 624 | lock_rename(lower_old_dir_dentry, lower_new_dir_dentry); | 623 | trap = lock_rename(lower_old_dir_dentry, lower_new_dir_dentry); |
| 624 | /* source should not be ancestor of target */ | ||
| 625 | if (trap == lower_old_dentry) { | ||
| 626 | rc = -EINVAL; | ||
| 627 | goto out_lock; | ||
| 628 | } | ||
| 629 | /* target should not be ancestor of source */ | ||
| 630 | if (trap == lower_new_dentry) { | ||
| 631 | rc = -ENOTEMPTY; | ||
| 632 | goto out_lock; | ||
| 633 | } | ||
| 625 | rc = vfs_rename(lower_old_dir_dentry->d_inode, lower_old_dentry, | 634 | rc = vfs_rename(lower_old_dir_dentry->d_inode, lower_old_dentry, |
| 626 | lower_new_dir_dentry->d_inode, lower_new_dentry); | 635 | lower_new_dir_dentry->d_inode, lower_new_dentry); |
| 627 | if (rc) | 636 | if (rc) |
| @@ -772,18 +781,23 @@ upper_size_to_lower_size(struct ecryptfs_crypt_stat *crypt_stat, | |||
| 772 | } | 781 | } |
| 773 | 782 | ||
| 774 | /** | 783 | /** |
| 775 | * ecryptfs_truncate | 784 | * truncate_upper |
| 776 | * @dentry: The ecryptfs layer dentry | 785 | * @dentry: The ecryptfs layer dentry |
| 777 | * @new_length: The length to expand the file to | 786 | * @ia: Address of the ecryptfs inode's attributes |
| 787 | * @lower_ia: Address of the lower inode's attributes | ||
| 778 | * | 788 | * |
| 779 | * Function to handle truncations modifying the size of the file. Note | 789 | * Function to handle truncations modifying the size of the file. Note |
| 780 | * that the file sizes are interpolated. When expanding, we are simply | 790 | * that the file sizes are interpolated. When expanding, we are simply |
| 781 | * writing strings of 0's out. When truncating, we need to modify the | 791 | * writing strings of 0's out. When truncating, we truncate the upper |
| 782 | * underlying file size according to the page index interpolations. | 792 | * inode and update the lower_ia according to the page index |
| 793 | * interpolations. If ATTR_SIZE is set in lower_ia->ia_valid upon return, | ||
| 794 | * the caller must use lower_ia in a call to notify_change() to perform | ||
| 795 | * the truncation of the lower inode. | ||
| 783 | * | 796 | * |
| 784 | * Returns zero on success; non-zero otherwise | 797 | * Returns zero on success; non-zero otherwise |
| 785 | */ | 798 | */ |
| 786 | int ecryptfs_truncate(struct dentry *dentry, loff_t new_length) | 799 | static int truncate_upper(struct dentry *dentry, struct iattr *ia, |
| 800 | struct iattr *lower_ia) | ||
| 787 | { | 801 | { |
| 788 | int rc = 0; | 802 | int rc = 0; |
| 789 | struct inode *inode = dentry->d_inode; | 803 | struct inode *inode = dentry->d_inode; |
| @@ -794,8 +808,10 @@ int ecryptfs_truncate(struct dentry *dentry, loff_t new_length) | |||
| 794 | loff_t lower_size_before_truncate; | 808 | loff_t lower_size_before_truncate; |
| 795 | loff_t lower_size_after_truncate; | 809 | loff_t lower_size_after_truncate; |
| 796 | 810 | ||
| 797 | if (unlikely((new_length == i_size))) | 811 | if (unlikely((ia->ia_size == i_size))) { |
| 812 | lower_ia->ia_valid &= ~ATTR_SIZE; | ||
| 798 | goto out; | 813 | goto out; |
| 814 | } | ||
| 799 | crypt_stat = &ecryptfs_inode_to_private(dentry->d_inode)->crypt_stat; | 815 | crypt_stat = &ecryptfs_inode_to_private(dentry->d_inode)->crypt_stat; |
| 800 | /* Set up a fake ecryptfs file, this is used to interface with | 816 | /* Set up a fake ecryptfs file, this is used to interface with |
| 801 | * the file in the underlying filesystem so that the | 817 | * the file in the underlying filesystem so that the |
| @@ -815,28 +831,30 @@ int ecryptfs_truncate(struct dentry *dentry, loff_t new_length) | |||
| 815 | &fake_ecryptfs_file, | 831 | &fake_ecryptfs_file, |
| 816 | ecryptfs_inode_to_private(dentry->d_inode)->lower_file); | 832 | ecryptfs_inode_to_private(dentry->d_inode)->lower_file); |
| 817 | /* Switch on growing or shrinking file */ | 833 | /* Switch on growing or shrinking file */ |
| 818 | if (new_length > i_size) { | 834 | if (ia->ia_size > i_size) { |
| 819 | char zero[] = { 0x00 }; | 835 | char zero[] = { 0x00 }; |
| 820 | 836 | ||
| 837 | lower_ia->ia_valid &= ~ATTR_SIZE; | ||
| 821 | /* Write a single 0 at the last position of the file; | 838 | /* Write a single 0 at the last position of the file; |
| 822 | * this triggers code that will fill in 0's throughout | 839 | * this triggers code that will fill in 0's throughout |
| 823 | * the intermediate portion of the previous end of the | 840 | * the intermediate portion of the previous end of the |
| 824 | * file and the new and of the file */ | 841 | * file and the new and of the file */ |
| 825 | rc = ecryptfs_write(&fake_ecryptfs_file, zero, | 842 | rc = ecryptfs_write(&fake_ecryptfs_file, zero, |
| 826 | (new_length - 1), 1); | 843 | (ia->ia_size - 1), 1); |
| 827 | } else { /* new_length < i_size_read(inode) */ | 844 | } else { /* ia->ia_size < i_size_read(inode) */ |
| 828 | /* We're chopping off all the pages down do the page | 845 | /* We're chopping off all the pages down to the page |
| 829 | * in which new_length is located. Fill in the end of | 846 | * in which ia->ia_size is located. Fill in the end of |
| 830 | * that page from (new_length & ~PAGE_CACHE_MASK) to | 847 | * that page from (ia->ia_size & ~PAGE_CACHE_MASK) to |
| 831 | * PAGE_CACHE_SIZE with zeros. */ | 848 | * PAGE_CACHE_SIZE with zeros. */ |
| 832 | size_t num_zeros = (PAGE_CACHE_SIZE | 849 | size_t num_zeros = (PAGE_CACHE_SIZE |
| 833 | - (new_length & ~PAGE_CACHE_MASK)); | 850 | - (ia->ia_size & ~PAGE_CACHE_MASK)); |
| 834 | 851 | ||
| 835 | if (!(crypt_stat->flags & ECRYPTFS_ENCRYPTED)) { | 852 | if (!(crypt_stat->flags & ECRYPTFS_ENCRYPTED)) { |
| 836 | rc = vmtruncate(inode, new_length); | 853 | rc = vmtruncate(inode, ia->ia_size); |
| 837 | if (rc) | 854 | if (rc) |
| 838 | goto out_free; | 855 | goto out_free; |
| 839 | rc = vmtruncate(lower_dentry->d_inode, new_length); | 856 | lower_ia->ia_size = ia->ia_size; |
| 857 | lower_ia->ia_valid |= ATTR_SIZE; | ||
| 840 | goto out_free; | 858 | goto out_free; |
| 841 | } | 859 | } |
| 842 | if (num_zeros) { | 860 | if (num_zeros) { |
| @@ -848,7 +866,7 @@ int ecryptfs_truncate(struct dentry *dentry, loff_t new_length) | |||
| 848 | goto out_free; | 866 | goto out_free; |
| 849 | } | 867 | } |
| 850 | rc = ecryptfs_write(&fake_ecryptfs_file, zeros_virt, | 868 | rc = ecryptfs_write(&fake_ecryptfs_file, zeros_virt, |
| 851 | new_length, num_zeros); | 869 | ia->ia_size, num_zeros); |
| 852 | kfree(zeros_virt); | 870 | kfree(zeros_virt); |
| 853 | if (rc) { | 871 | if (rc) { |
| 854 | printk(KERN_ERR "Error attempting to zero out " | 872 | printk(KERN_ERR "Error attempting to zero out " |
| @@ -857,7 +875,7 @@ int ecryptfs_truncate(struct dentry *dentry, loff_t new_length) | |||
| 857 | goto out_free; | 875 | goto out_free; |
| 858 | } | 876 | } |
| 859 | } | 877 | } |
| 860 | vmtruncate(inode, new_length); | 878 | vmtruncate(inode, ia->ia_size); |
| 861 | rc = ecryptfs_write_inode_size_to_metadata(inode); | 879 | rc = ecryptfs_write_inode_size_to_metadata(inode); |
| 862 | if (rc) { | 880 | if (rc) { |
| 863 | printk(KERN_ERR "Problem with " | 881 | printk(KERN_ERR "Problem with " |
| @@ -870,10 +888,12 @@ int ecryptfs_truncate(struct dentry *dentry, loff_t new_length) | |||
| 870 | lower_size_before_truncate = | 888 | lower_size_before_truncate = |
| 871 | upper_size_to_lower_size(crypt_stat, i_size); | 889 | upper_size_to_lower_size(crypt_stat, i_size); |
| 872 | lower_size_after_truncate = | 890 | lower_size_after_truncate = |
| 873 | upper_size_to_lower_size(crypt_stat, new_length); | 891 | upper_size_to_lower_size(crypt_stat, ia->ia_size); |
| 874 | if (lower_size_after_truncate < lower_size_before_truncate) | 892 | if (lower_size_after_truncate < lower_size_before_truncate) { |
| 875 | vmtruncate(lower_dentry->d_inode, | 893 | lower_ia->ia_size = lower_size_after_truncate; |
| 876 | lower_size_after_truncate); | 894 | lower_ia->ia_valid |= ATTR_SIZE; |
| 895 | } else | ||
| 896 | lower_ia->ia_valid &= ~ATTR_SIZE; | ||
| 877 | } | 897 | } |
| 878 | out_free: | 898 | out_free: |
| 879 | if (ecryptfs_file_to_private(&fake_ecryptfs_file)) | 899 | if (ecryptfs_file_to_private(&fake_ecryptfs_file)) |
| @@ -883,6 +903,33 @@ out: | |||
| 883 | return rc; | 903 | return rc; |
| 884 | } | 904 | } |
| 885 | 905 | ||
| 906 | /** | ||
| 907 | * ecryptfs_truncate | ||
| 908 | * @dentry: The ecryptfs layer dentry | ||
| 909 | * @new_length: The length to expand the file to | ||
| 910 | * | ||
| 911 | * Simple function that handles the truncation of an eCryptfs inode and | ||
| 912 | * its corresponding lower inode. | ||
| 913 | * | ||
| 914 | * Returns zero on success; non-zero otherwise | ||
| 915 | */ | ||
| 916 | int ecryptfs_truncate(struct dentry *dentry, loff_t new_length) | ||
| 917 | { | ||
| 918 | struct iattr ia = { .ia_valid = ATTR_SIZE, .ia_size = new_length }; | ||
| 919 | struct iattr lower_ia = { .ia_valid = 0 }; | ||
| 920 | int rc; | ||
| 921 | |||
| 922 | rc = truncate_upper(dentry, &ia, &lower_ia); | ||
| 923 | if (!rc && lower_ia.ia_valid & ATTR_SIZE) { | ||
| 924 | struct dentry *lower_dentry = ecryptfs_dentry_to_lower(dentry); | ||
| 925 | |||
| 926 | mutex_lock(&lower_dentry->d_inode->i_mutex); | ||
| 927 | rc = notify_change(lower_dentry, &lower_ia); | ||
| 928 | mutex_unlock(&lower_dentry->d_inode->i_mutex); | ||
| 929 | } | ||
| 930 | return rc; | ||
| 931 | } | ||
| 932 | |||
| 886 | static int | 933 | static int |
| 887 | ecryptfs_permission(struct inode *inode, int mask) | 934 | ecryptfs_permission(struct inode *inode, int mask) |
| 888 | { | 935 | { |
| @@ -905,6 +952,7 @@ static int ecryptfs_setattr(struct dentry *dentry, struct iattr *ia) | |||
| 905 | { | 952 | { |
| 906 | int rc = 0; | 953 | int rc = 0; |
| 907 | struct dentry *lower_dentry; | 954 | struct dentry *lower_dentry; |
| 955 | struct iattr lower_ia; | ||
| 908 | struct inode *inode; | 956 | struct inode *inode; |
| 909 | struct inode *lower_inode; | 957 | struct inode *lower_inode; |
| 910 | struct ecryptfs_crypt_stat *crypt_stat; | 958 | struct ecryptfs_crypt_stat *crypt_stat; |
| @@ -943,15 +991,11 @@ static int ecryptfs_setattr(struct dentry *dentry, struct iattr *ia) | |||
| 943 | } | 991 | } |
| 944 | } | 992 | } |
| 945 | mutex_unlock(&crypt_stat->cs_mutex); | 993 | mutex_unlock(&crypt_stat->cs_mutex); |
| 994 | memcpy(&lower_ia, ia, sizeof(lower_ia)); | ||
| 995 | if (ia->ia_valid & ATTR_FILE) | ||
| 996 | lower_ia.ia_file = ecryptfs_file_to_lower(ia->ia_file); | ||
| 946 | if (ia->ia_valid & ATTR_SIZE) { | 997 | if (ia->ia_valid & ATTR_SIZE) { |
| 947 | ecryptfs_printk(KERN_DEBUG, | 998 | rc = truncate_upper(dentry, ia, &lower_ia); |
| 948 | "ia->ia_valid = [0x%x] ATTR_SIZE" " = [0x%x]\n", | ||
| 949 | ia->ia_valid, ATTR_SIZE); | ||
| 950 | rc = ecryptfs_truncate(dentry, ia->ia_size); | ||
| 951 | /* ecryptfs_truncate handles resizing of the lower file */ | ||
| 952 | ia->ia_valid &= ~ATTR_SIZE; | ||
| 953 | ecryptfs_printk(KERN_DEBUG, "ia->ia_valid = [%x]\n", | ||
| 954 | ia->ia_valid); | ||
| 955 | if (rc < 0) | 999 | if (rc < 0) |
| 956 | goto out; | 1000 | goto out; |
| 957 | } | 1001 | } |
| @@ -960,17 +1004,32 @@ static int ecryptfs_setattr(struct dentry *dentry, struct iattr *ia) | |||
| 960 | * mode change is for clearing setuid/setgid bits. Allow lower fs | 1004 | * mode change is for clearing setuid/setgid bits. Allow lower fs |
| 961 | * to interpret this in its own way. | 1005 | * to interpret this in its own way. |
| 962 | */ | 1006 | */ |
| 963 | if (ia->ia_valid & (ATTR_KILL_SUID | ATTR_KILL_SGID)) | 1007 | if (lower_ia.ia_valid & (ATTR_KILL_SUID | ATTR_KILL_SGID)) |
| 964 | ia->ia_valid &= ~ATTR_MODE; | 1008 | lower_ia.ia_valid &= ~ATTR_MODE; |
| 965 | 1009 | ||
| 966 | mutex_lock(&lower_dentry->d_inode->i_mutex); | 1010 | mutex_lock(&lower_dentry->d_inode->i_mutex); |
| 967 | rc = notify_change(lower_dentry, ia); | 1011 | rc = notify_change(lower_dentry, &lower_ia); |
| 968 | mutex_unlock(&lower_dentry->d_inode->i_mutex); | 1012 | mutex_unlock(&lower_dentry->d_inode->i_mutex); |
| 969 | out: | 1013 | out: |
| 970 | fsstack_copy_attr_all(inode, lower_inode); | 1014 | fsstack_copy_attr_all(inode, lower_inode); |
| 971 | return rc; | 1015 | return rc; |
| 972 | } | 1016 | } |
| 973 | 1017 | ||
| 1018 | int ecryptfs_getattr(struct vfsmount *mnt, struct dentry *dentry, | ||
| 1019 | struct kstat *stat) | ||
| 1020 | { | ||
| 1021 | struct kstat lower_stat; | ||
| 1022 | int rc; | ||
| 1023 | |||
| 1024 | rc = vfs_getattr(ecryptfs_dentry_to_lower_mnt(dentry), | ||
| 1025 | ecryptfs_dentry_to_lower(dentry), &lower_stat); | ||
| 1026 | if (!rc) { | ||
| 1027 | generic_fillattr(dentry->d_inode, stat); | ||
| 1028 | stat->blocks = lower_stat.blocks; | ||
| 1029 | } | ||
| 1030 | return rc; | ||
| 1031 | } | ||
| 1032 | |||
| 974 | int | 1033 | int |
| 975 | ecryptfs_setxattr(struct dentry *dentry, const char *name, const void *value, | 1034 | ecryptfs_setxattr(struct dentry *dentry, const char *name, const void *value, |
| 976 | size_t size, int flags) | 1035 | size_t size, int flags) |
| @@ -1100,6 +1159,7 @@ const struct inode_operations ecryptfs_dir_iops = { | |||
| 1100 | const struct inode_operations ecryptfs_main_iops = { | 1159 | const struct inode_operations ecryptfs_main_iops = { |
| 1101 | .permission = ecryptfs_permission, | 1160 | .permission = ecryptfs_permission, |
| 1102 | .setattr = ecryptfs_setattr, | 1161 | .setattr = ecryptfs_setattr, |
| 1162 | .getattr = ecryptfs_getattr, | ||
| 1103 | .setxattr = ecryptfs_setxattr, | 1163 | .setxattr = ecryptfs_setxattr, |
| 1104 | .getxattr = ecryptfs_getxattr, | 1164 | .getxattr = ecryptfs_getxattr, |
| 1105 | .listxattr = ecryptfs_listxattr, | 1165 | .listxattr = ecryptfs_listxattr, |
diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c index 567bc4b9f70a..ea2f92101dfe 100644 --- a/fs/ecryptfs/main.c +++ b/fs/ecryptfs/main.c | |||
| @@ -585,8 +585,8 @@ out: | |||
| 585 | * with as much information as it can before needing | 585 | * with as much information as it can before needing |
| 586 | * the lower filesystem. | 586 | * the lower filesystem. |
| 587 | * ecryptfs_read_super(): this accesses the lower filesystem and uses | 587 | * ecryptfs_read_super(): this accesses the lower filesystem and uses |
| 588 | * ecryptfs_interpolate to perform most of the linking | 588 | * ecryptfs_interpose to perform most of the linking |
| 589 | * ecryptfs_interpolate(): links the lower filesystem into ecryptfs | 589 | * ecryptfs_interpose(): links the lower filesystem into ecryptfs (inode.c) |
| 590 | */ | 590 | */ |
| 591 | static int ecryptfs_get_sb(struct file_system_type *fs_type, int flags, | 591 | static int ecryptfs_get_sb(struct file_system_type *fs_type, int flags, |
| 592 | const char *dev_name, void *raw_data, | 592 | const char *dev_name, void *raw_data, |
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h index 9d7febde10a1..09469971472f 100644 --- a/include/acpi/platform/aclinux.h +++ b/include/acpi/platform/aclinux.h | |||
| @@ -152,7 +152,7 @@ static inline void *acpi_os_acquire_object(acpi_cache_t * cache) | |||
| 152 | #include <linux/hardirq.h> | 152 | #include <linux/hardirq.h> |
| 153 | #define ACPI_PREEMPTION_POINT() \ | 153 | #define ACPI_PREEMPTION_POINT() \ |
| 154 | do { \ | 154 | do { \ |
| 155 | if (!in_atomic_preempt_off()) \ | 155 | if (!in_atomic_preempt_off() && !irqs_disabled()) \ |
| 156 | cond_resched(); \ | 156 | cond_resched(); \ |
| 157 | } while (0) | 157 | } while (0) |
| 158 | 158 | ||
diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 36924255c0d5..b926afe8c03e 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h | |||
| @@ -80,7 +80,7 @@ char * __acpi_map_table (unsigned long phys_addr, unsigned long size); | |||
| 80 | void __acpi_unmap_table(char *map, unsigned long size); | 80 | void __acpi_unmap_table(char *map, unsigned long size); |
| 81 | int early_acpi_boot_init(void); | 81 | int early_acpi_boot_init(void); |
| 82 | int acpi_boot_init (void); | 82 | int acpi_boot_init (void); |
| 83 | int acpi_boot_table_init (void); | 83 | void acpi_boot_table_init (void); |
| 84 | int acpi_mps_check (void); | 84 | int acpi_mps_check (void); |
| 85 | int acpi_numa_init (void); | 85 | int acpi_numa_init (void); |
| 86 | 86 | ||
| @@ -321,9 +321,9 @@ static inline int acpi_boot_init(void) | |||
| 321 | return 0; | 321 | return 0; |
| 322 | } | 322 | } |
| 323 | 323 | ||
| 324 | static inline int acpi_boot_table_init(void) | 324 | static inline void acpi_boot_table_init(void) |
| 325 | { | 325 | { |
| 326 | return 0; | 326 | return; |
| 327 | } | 327 | } |
| 328 | 328 | ||
| 329 | static inline int acpi_mps_check(void) | 329 | static inline int acpi_mps_check(void) |
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 9b98173a8184..5c8018977efa 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
| @@ -938,6 +938,8 @@ extern void blk_queue_io_opt(struct request_queue *q, unsigned int opt); | |||
| 938 | extern void blk_set_default_limits(struct queue_limits *lim); | 938 | extern void blk_set_default_limits(struct queue_limits *lim); |
| 939 | extern int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, | 939 | extern int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, |
| 940 | sector_t offset); | 940 | sector_t offset); |
| 941 | extern int bdev_stack_limits(struct queue_limits *t, struct block_device *bdev, | ||
| 942 | sector_t offset); | ||
| 941 | extern void disk_stack_limits(struct gendisk *disk, struct block_device *bdev, | 943 | extern void disk_stack_limits(struct gendisk *disk, struct block_device *bdev, |
| 942 | sector_t offset); | 944 | sector_t offset); |
| 943 | extern void blk_queue_stack_limits(struct request_queue *t, struct request_queue *b); | 945 | extern void blk_queue_stack_limits(struct request_queue *t, struct request_queue *b); |
| @@ -1148,8 +1150,11 @@ static inline int queue_discard_alignment(struct request_queue *q) | |||
| 1148 | static inline int queue_sector_discard_alignment(struct request_queue *q, | 1150 | static inline int queue_sector_discard_alignment(struct request_queue *q, |
| 1149 | sector_t sector) | 1151 | sector_t sector) |
| 1150 | { | 1152 | { |
| 1151 | return ((sector << 9) - q->limits.discard_alignment) | 1153 | struct queue_limits *lim = &q->limits; |
| 1152 | & (q->limits.discard_granularity - 1); | 1154 | unsigned int alignment = (sector << 9) & (lim->discard_granularity - 1); |
| 1155 | |||
| 1156 | return (lim->discard_granularity + lim->discard_alignment - alignment) | ||
| 1157 | & (lim->discard_granularity - 1); | ||
| 1153 | } | 1158 | } |
| 1154 | 1159 | ||
| 1155 | static inline unsigned int queue_discard_zeroes_data(struct request_queue *q) | 1160 | static inline unsigned int queue_discard_zeroes_data(struct request_queue *q) |
diff --git a/include/linux/drbd.h b/include/linux/drbd.h index e84f4733cb55..78962272338a 100644 --- a/include/linux/drbd.h +++ b/include/linux/drbd.h | |||
| @@ -53,7 +53,7 @@ | |||
| 53 | 53 | ||
| 54 | 54 | ||
| 55 | extern const char *drbd_buildtag(void); | 55 | extern const char *drbd_buildtag(void); |
| 56 | #define REL_VERSION "8.3.6" | 56 | #define REL_VERSION "8.3.7" |
| 57 | #define API_VERSION 88 | 57 | #define API_VERSION 88 |
| 58 | #define PRO_VERSION_MIN 86 | 58 | #define PRO_VERSION_MIN 86 |
| 59 | #define PRO_VERSION_MAX 91 | 59 | #define PRO_VERSION_MAX 91 |
diff --git a/include/linux/drbd_nl.h b/include/linux/drbd_nl.h index db5721ad50d1..a4d82f895994 100644 --- a/include/linux/drbd_nl.h +++ b/include/linux/drbd_nl.h | |||
| @@ -69,6 +69,7 @@ NL_PACKET(disconnect, 6, ) | |||
| 69 | 69 | ||
| 70 | NL_PACKET(resize, 7, | 70 | NL_PACKET(resize, 7, |
| 71 | NL_INT64( 29, T_MAY_IGNORE, resize_size) | 71 | NL_INT64( 29, T_MAY_IGNORE, resize_size) |
| 72 | NL_BIT( 68, T_MAY_IGNORE, resize_force) | ||
| 72 | ) | 73 | ) |
| 73 | 74 | ||
| 74 | NL_PACKET(syncer_conf, 8, | 75 | NL_PACKET(syncer_conf, 8, |
diff --git a/include/linux/genhd.h b/include/linux/genhd.h index c6c0c41af35f..9717081c75ad 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h | |||
| @@ -256,9 +256,9 @@ extern struct hd_struct *disk_map_sector_rcu(struct gendisk *disk, | |||
| 256 | #define part_stat_read(part, field) \ | 256 | #define part_stat_read(part, field) \ |
| 257 | ({ \ | 257 | ({ \ |
| 258 | typeof((part)->dkstats->field) res = 0; \ | 258 | typeof((part)->dkstats->field) res = 0; \ |
| 259 | int i; \ | 259 | unsigned int _cpu; \ |
| 260 | for_each_possible_cpu(i) \ | 260 | for_each_possible_cpu(_cpu) \ |
| 261 | res += per_cpu_ptr((part)->dkstats, i)->field; \ | 261 | res += per_cpu_ptr((part)->dkstats, _cpu)->field; \ |
| 262 | res; \ | 262 | res; \ |
| 263 | }) | 263 | }) |
| 264 | 264 | ||
diff --git a/include/linux/iocontext.h b/include/linux/iocontext.h index a63235996309..78ef023227d4 100644 --- a/include/linux/iocontext.h +++ b/include/linux/iocontext.h | |||
| @@ -4,32 +4,6 @@ | |||
| 4 | #include <linux/radix-tree.h> | 4 | #include <linux/radix-tree.h> |
| 5 | #include <linux/rcupdate.h> | 5 | #include <linux/rcupdate.h> |
| 6 | 6 | ||
| 7 | /* | ||
| 8 | * This is the per-process anticipatory I/O scheduler state. | ||
| 9 | */ | ||
| 10 | struct as_io_context { | ||
| 11 | spinlock_t lock; | ||
| 12 | |||
| 13 | void (*dtor)(struct as_io_context *aic); /* destructor */ | ||
| 14 | void (*exit)(struct as_io_context *aic); /* called on task exit */ | ||
| 15 | |||
| 16 | unsigned long state; | ||
| 17 | atomic_t nr_queued; /* queued reads & sync writes */ | ||
| 18 | atomic_t nr_dispatched; /* number of requests gone to the drivers */ | ||
| 19 | |||
| 20 | /* IO History tracking */ | ||
| 21 | /* Thinktime */ | ||
| 22 | unsigned long last_end_request; | ||
| 23 | unsigned long ttime_total; | ||
| 24 | unsigned long ttime_samples; | ||
| 25 | unsigned long ttime_mean; | ||
| 26 | /* Layout pattern */ | ||
| 27 | unsigned int seek_samples; | ||
| 28 | sector_t last_request_pos; | ||
| 29 | u64 seek_total; | ||
| 30 | sector_t seek_mean; | ||
| 31 | }; | ||
| 32 | |||
| 33 | struct cfq_queue; | 7 | struct cfq_queue; |
| 34 | struct cfq_io_context { | 8 | struct cfq_io_context { |
| 35 | void *key; | 9 | void *key; |
| @@ -78,7 +52,6 @@ struct io_context { | |||
| 78 | unsigned long last_waited; /* Time last woken after wait for request */ | 52 | unsigned long last_waited; /* Time last woken after wait for request */ |
| 79 | int nr_batch_requests; /* Number of requests left in the batch */ | 53 | int nr_batch_requests; /* Number of requests left in the batch */ |
| 80 | 54 | ||
| 81 | struct as_io_context *aic; | ||
| 82 | struct radix_tree_root radix_root; | 55 | struct radix_tree_root radix_root; |
| 83 | struct hlist_head cic_list; | 56 | struct hlist_head cic_list; |
| 84 | void *ioc_data; | 57 | void *ioc_data; |
diff --git a/include/linux/usb.h b/include/linux/usb.h index e101a2d04d75..d7ace1b80f09 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h | |||
| @@ -192,6 +192,7 @@ struct usb_interface { | |||
| 192 | unsigned needs_altsetting0:1; /* switch to altsetting 0 is pending */ | 192 | unsigned needs_altsetting0:1; /* switch to altsetting 0 is pending */ |
| 193 | unsigned needs_binding:1; /* needs delayed unbind/rebind */ | 193 | unsigned needs_binding:1; /* needs delayed unbind/rebind */ |
| 194 | unsigned reset_running:1; | 194 | unsigned reset_running:1; |
| 195 | unsigned resetting_device:1; /* true: bandwidth alloc after reset */ | ||
| 195 | 196 | ||
| 196 | struct device dev; /* interface specific device info */ | 197 | struct device dev; /* interface specific device info */ |
| 197 | struct device *usb_dev; | 198 | struct device *usb_dev; |
diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 37e69295f250..d55d905463eb 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c | |||
| @@ -555,10 +555,8 @@ static void __purge_vmap_area_lazy(unsigned long *start, unsigned long *end, | |||
| 555 | } | 555 | } |
| 556 | rcu_read_unlock(); | 556 | rcu_read_unlock(); |
| 557 | 557 | ||
| 558 | if (nr) { | 558 | if (nr) |
| 559 | BUG_ON(nr > atomic_read(&vmap_lazy_nr)); | ||
| 560 | atomic_sub(nr, &vmap_lazy_nr); | 559 | atomic_sub(nr, &vmap_lazy_nr); |
| 561 | } | ||
| 562 | 560 | ||
| 563 | if (nr || force_flush) | 561 | if (nr || force_flush) |
| 564 | flush_tlb_kernel_range(*start, *end); | 562 | flush_tlb_kernel_range(*start, *end); |
