diff options
115 files changed, 1072 insertions, 567 deletions
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 92e83e53148f..cdd2a6e8a3b7 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
| @@ -2385,6 +2385,11 @@ and is between 256 and 4096 characters. It is defined in the file | |||
| 2385 | improve throughput, but will also increase the | 2385 | improve throughput, but will also increase the |
| 2386 | amount of memory reserved for use by the client. | 2386 | amount of memory reserved for use by the client. |
| 2387 | 2387 | ||
| 2388 | swapaccount[=0|1] | ||
| 2389 | [KNL] Enable accounting of swap in memory resource | ||
| 2390 | controller if no parameter or 1 is given or disable | ||
| 2391 | it if 0 is given (See Documentation/cgroups/memory.txt) | ||
| 2392 | |||
| 2388 | swiotlb= [IA-64] Number of I/O TLB slabs | 2393 | swiotlb= [IA-64] Number of I/O TLB slabs |
| 2389 | 2394 | ||
| 2390 | switches= [HW,M68k] | 2395 | switches= [HW,M68k] |
diff --git a/MAINTAINERS b/MAINTAINERS index a92c994ba935..b49ba9a43bf8 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
| @@ -1359,7 +1359,7 @@ F: include/net/bluetooth/ | |||
| 1359 | 1359 | ||
| 1360 | BONDING DRIVER | 1360 | BONDING DRIVER |
| 1361 | M: Jay Vosburgh <fubar@us.ibm.com> | 1361 | M: Jay Vosburgh <fubar@us.ibm.com> |
| 1362 | L: bonding-devel@lists.sourceforge.net | 1362 | L: netdev@vger.kernel.org |
| 1363 | W: http://sourceforge.net/projects/bonding/ | 1363 | W: http://sourceforge.net/projects/bonding/ |
| 1364 | S: Supported | 1364 | S: Supported |
| 1365 | F: drivers/net/bonding/ | 1365 | F: drivers/net/bonding/ |
diff --git a/arch/arm/mach-davinci/dm355.c b/arch/arm/mach-davinci/dm355.c index 9be261beae7d..2652af124acd 100644 --- a/arch/arm/mach-davinci/dm355.c +++ b/arch/arm/mach-davinci/dm355.c | |||
| @@ -359,8 +359,8 @@ static struct clk_lookup dm355_clks[] = { | |||
| 359 | CLK(NULL, "uart1", &uart1_clk), | 359 | CLK(NULL, "uart1", &uart1_clk), |
| 360 | CLK(NULL, "uart2", &uart2_clk), | 360 | CLK(NULL, "uart2", &uart2_clk), |
| 361 | CLK("i2c_davinci.1", NULL, &i2c_clk), | 361 | CLK("i2c_davinci.1", NULL, &i2c_clk), |
| 362 | CLK("davinci-asp.0", NULL, &asp0_clk), | 362 | CLK("davinci-mcbsp.0", NULL, &asp0_clk), |
| 363 | CLK("davinci-asp.1", NULL, &asp1_clk), | 363 | CLK("davinci-mcbsp.1", NULL, &asp1_clk), |
| 364 | CLK("davinci_mmc.0", NULL, &mmcsd0_clk), | 364 | CLK("davinci_mmc.0", NULL, &mmcsd0_clk), |
| 365 | CLK("davinci_mmc.1", NULL, &mmcsd1_clk), | 365 | CLK("davinci_mmc.1", NULL, &mmcsd1_clk), |
| 366 | CLK("spi_davinci.0", NULL, &spi0_clk), | 366 | CLK("spi_davinci.0", NULL, &spi0_clk), |
| @@ -664,7 +664,7 @@ static struct resource dm355_asp1_resources[] = { | |||
| 664 | }; | 664 | }; |
| 665 | 665 | ||
| 666 | static struct platform_device dm355_asp1_device = { | 666 | static struct platform_device dm355_asp1_device = { |
| 667 | .name = "davinci-asp", | 667 | .name = "davinci-mcbsp", |
| 668 | .id = 1, | 668 | .id = 1, |
| 669 | .num_resources = ARRAY_SIZE(dm355_asp1_resources), | 669 | .num_resources = ARRAY_SIZE(dm355_asp1_resources), |
| 670 | .resource = dm355_asp1_resources, | 670 | .resource = dm355_asp1_resources, |
diff --git a/arch/arm/mach-davinci/dm365.c b/arch/arm/mach-davinci/dm365.c index a12065e87266..c466d710d3c1 100644 --- a/arch/arm/mach-davinci/dm365.c +++ b/arch/arm/mach-davinci/dm365.c | |||
| @@ -459,7 +459,7 @@ static struct clk_lookup dm365_clks[] = { | |||
| 459 | CLK(NULL, "usb", &usb_clk), | 459 | CLK(NULL, "usb", &usb_clk), |
| 460 | CLK("davinci_emac.1", NULL, &emac_clk), | 460 | CLK("davinci_emac.1", NULL, &emac_clk), |
| 461 | CLK("davinci_voicecodec", NULL, &voicecodec_clk), | 461 | CLK("davinci_voicecodec", NULL, &voicecodec_clk), |
| 462 | CLK("davinci-asp.0", NULL, &asp0_clk), | 462 | CLK("davinci-mcbsp", NULL, &asp0_clk), |
| 463 | CLK(NULL, "rto", &rto_clk), | 463 | CLK(NULL, "rto", &rto_clk), |
| 464 | CLK(NULL, "mjcp", &mjcp_clk), | 464 | CLK(NULL, "mjcp", &mjcp_clk), |
| 465 | CLK(NULL, NULL, NULL), | 465 | CLK(NULL, NULL, NULL), |
| @@ -922,8 +922,8 @@ static struct resource dm365_asp_resources[] = { | |||
| 922 | }; | 922 | }; |
| 923 | 923 | ||
| 924 | static struct platform_device dm365_asp_device = { | 924 | static struct platform_device dm365_asp_device = { |
| 925 | .name = "davinci-asp", | 925 | .name = "davinci-mcbsp", |
| 926 | .id = 0, | 926 | .id = -1, |
| 927 | .num_resources = ARRAY_SIZE(dm365_asp_resources), | 927 | .num_resources = ARRAY_SIZE(dm365_asp_resources), |
| 928 | .resource = dm365_asp_resources, | 928 | .resource = dm365_asp_resources, |
| 929 | }; | 929 | }; |
diff --git a/arch/arm/mach-davinci/dm644x.c b/arch/arm/mach-davinci/dm644x.c index 0608dd776a16..9a2376b3137c 100644 --- a/arch/arm/mach-davinci/dm644x.c +++ b/arch/arm/mach-davinci/dm644x.c | |||
| @@ -302,7 +302,7 @@ static struct clk_lookup dm644x_clks[] = { | |||
| 302 | CLK("davinci_emac.1", NULL, &emac_clk), | 302 | CLK("davinci_emac.1", NULL, &emac_clk), |
| 303 | CLK("i2c_davinci.1", NULL, &i2c_clk), | 303 | CLK("i2c_davinci.1", NULL, &i2c_clk), |
| 304 | CLK("palm_bk3710", NULL, &ide_clk), | 304 | CLK("palm_bk3710", NULL, &ide_clk), |
| 305 | CLK("davinci-asp", NULL, &asp_clk), | 305 | CLK("davinci-mcbsp", NULL, &asp_clk), |
| 306 | CLK("davinci_mmc.0", NULL, &mmcsd_clk), | 306 | CLK("davinci_mmc.0", NULL, &mmcsd_clk), |
| 307 | CLK(NULL, "spi", &spi_clk), | 307 | CLK(NULL, "spi", &spi_clk), |
| 308 | CLK(NULL, "gpio", &gpio_clk), | 308 | CLK(NULL, "gpio", &gpio_clk), |
| @@ -580,7 +580,7 @@ static struct resource dm644x_asp_resources[] = { | |||
| 580 | }; | 580 | }; |
| 581 | 581 | ||
| 582 | static struct platform_device dm644x_asp_device = { | 582 | static struct platform_device dm644x_asp_device = { |
| 583 | .name = "davinci-asp", | 583 | .name = "davinci-mcbsp", |
| 584 | .id = -1, | 584 | .id = -1, |
| 585 | .num_resources = ARRAY_SIZE(dm644x_asp_resources), | 585 | .num_resources = ARRAY_SIZE(dm644x_asp_resources), |
| 586 | .resource = dm644x_asp_resources, | 586 | .resource = dm644x_asp_resources, |
diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c index 7f7338c90784..1664cce7b0ac 100644 --- a/arch/um/drivers/line.c +++ b/arch/um/drivers/line.c | |||
| @@ -727,6 +727,9 @@ struct winch { | |||
| 727 | 727 | ||
| 728 | static void free_winch(struct winch *winch, int free_irq_ok) | 728 | static void free_winch(struct winch *winch, int free_irq_ok) |
| 729 | { | 729 | { |
| 730 | if (free_irq_ok) | ||
| 731 | free_irq(WINCH_IRQ, winch); | ||
| 732 | |||
| 730 | list_del(&winch->list); | 733 | list_del(&winch->list); |
| 731 | 734 | ||
| 732 | if (winch->pid != -1) | 735 | if (winch->pid != -1) |
| @@ -735,8 +738,6 @@ static void free_winch(struct winch *winch, int free_irq_ok) | |||
| 735 | os_close_file(winch->fd); | 738 | os_close_file(winch->fd); |
| 736 | if (winch->stack != 0) | 739 | if (winch->stack != 0) |
| 737 | free_stack(winch->stack, 0); | 740 | free_stack(winch->stack, 0); |
| 738 | if (free_irq_ok) | ||
| 739 | free_irq(WINCH_IRQ, winch); | ||
| 740 | kfree(winch); | 741 | kfree(winch); |
| 741 | } | 742 | } |
| 742 | 743 | ||
diff --git a/arch/x86/include/asm/fixmap.h b/arch/x86/include/asm/fixmap.h index 4d293dced62f..9479a037419f 100644 --- a/arch/x86/include/asm/fixmap.h +++ b/arch/x86/include/asm/fixmap.h | |||
| @@ -216,8 +216,8 @@ static inline unsigned long virt_to_fix(const unsigned long vaddr) | |||
| 216 | } | 216 | } |
| 217 | 217 | ||
| 218 | /* Return an pointer with offset calculated */ | 218 | /* Return an pointer with offset calculated */ |
| 219 | static inline unsigned long __set_fixmap_offset(enum fixed_addresses idx, | 219 | static __always_inline unsigned long |
| 220 | phys_addr_t phys, pgprot_t flags) | 220 | __set_fixmap_offset(enum fixed_addresses idx, phys_addr_t phys, pgprot_t flags) |
| 221 | { | 221 | { |
| 222 | __set_fixmap(idx, phys, flags); | 222 | __set_fixmap(idx, phys, flags); |
| 223 | return fix_to_virt(idx) + (phys & (PAGE_SIZE - 1)); | 223 | return fix_to_virt(idx) + (phys & (PAGE_SIZE - 1)); |
diff --git a/arch/x86/include/asm/xen/interface.h b/arch/x86/include/asm/xen/interface.h index e8506c1f0c55..1c10c88ee4e1 100644 --- a/arch/x86/include/asm/xen/interface.h +++ b/arch/x86/include/asm/xen/interface.h | |||
| @@ -61,9 +61,9 @@ DEFINE_GUEST_HANDLE(void); | |||
| 61 | #define HYPERVISOR_VIRT_START mk_unsigned_long(__HYPERVISOR_VIRT_START) | 61 | #define HYPERVISOR_VIRT_START mk_unsigned_long(__HYPERVISOR_VIRT_START) |
| 62 | #endif | 62 | #endif |
| 63 | 63 | ||
| 64 | #ifndef machine_to_phys_mapping | 64 | #define MACH2PHYS_VIRT_START mk_unsigned_long(__MACH2PHYS_VIRT_START) |
| 65 | #define machine_to_phys_mapping ((unsigned long *)HYPERVISOR_VIRT_START) | 65 | #define MACH2PHYS_VIRT_END mk_unsigned_long(__MACH2PHYS_VIRT_END) |
| 66 | #endif | 66 | #define MACH2PHYS_NR_ENTRIES ((MACH2PHYS_VIRT_END-MACH2PHYS_VIRT_START)>>__MACH2PHYS_SHIFT) |
| 67 | 67 | ||
| 68 | /* Maximum number of virtual CPUs in multi-processor guests. */ | 68 | /* Maximum number of virtual CPUs in multi-processor guests. */ |
| 69 | #define MAX_VIRT_CPUS 32 | 69 | #define MAX_VIRT_CPUS 32 |
diff --git a/arch/x86/include/asm/xen/interface_32.h b/arch/x86/include/asm/xen/interface_32.h index 42a7e004ae5c..8413688b2571 100644 --- a/arch/x86/include/asm/xen/interface_32.h +++ b/arch/x86/include/asm/xen/interface_32.h | |||
| @@ -32,6 +32,11 @@ | |||
| 32 | /* And the trap vector is... */ | 32 | /* And the trap vector is... */ |
| 33 | #define TRAP_INSTR "int $0x82" | 33 | #define TRAP_INSTR "int $0x82" |
| 34 | 34 | ||
| 35 | #define __MACH2PHYS_VIRT_START 0xF5800000 | ||
| 36 | #define __MACH2PHYS_VIRT_END 0xF6800000 | ||
| 37 | |||
| 38 | #define __MACH2PHYS_SHIFT 2 | ||
| 39 | |||
| 35 | /* | 40 | /* |
| 36 | * Virtual addresses beyond this are not modifiable by guest OSes. The | 41 | * Virtual addresses beyond this are not modifiable by guest OSes. The |
| 37 | * machine->physical mapping table starts at this address, read-only. | 42 | * machine->physical mapping table starts at this address, read-only. |
diff --git a/arch/x86/include/asm/xen/interface_64.h b/arch/x86/include/asm/xen/interface_64.h index 100d2662b97c..839a4811cf98 100644 --- a/arch/x86/include/asm/xen/interface_64.h +++ b/arch/x86/include/asm/xen/interface_64.h | |||
| @@ -39,18 +39,7 @@ | |||
| 39 | #define __HYPERVISOR_VIRT_END 0xFFFF880000000000 | 39 | #define __HYPERVISOR_VIRT_END 0xFFFF880000000000 |
| 40 | #define __MACH2PHYS_VIRT_START 0xFFFF800000000000 | 40 | #define __MACH2PHYS_VIRT_START 0xFFFF800000000000 |
| 41 | #define __MACH2PHYS_VIRT_END 0xFFFF804000000000 | 41 | #define __MACH2PHYS_VIRT_END 0xFFFF804000000000 |
| 42 | 42 | #define __MACH2PHYS_SHIFT 3 | |
| 43 | #ifndef HYPERVISOR_VIRT_START | ||
| 44 | #define HYPERVISOR_VIRT_START mk_unsigned_long(__HYPERVISOR_VIRT_START) | ||
| 45 | #define HYPERVISOR_VIRT_END mk_unsigned_long(__HYPERVISOR_VIRT_END) | ||
| 46 | #endif | ||
| 47 | |||
| 48 | #define MACH2PHYS_VIRT_START mk_unsigned_long(__MACH2PHYS_VIRT_START) | ||
| 49 | #define MACH2PHYS_VIRT_END mk_unsigned_long(__MACH2PHYS_VIRT_END) | ||
| 50 | #define MACH2PHYS_NR_ENTRIES ((MACH2PHYS_VIRT_END-MACH2PHYS_VIRT_START)>>3) | ||
| 51 | #ifndef machine_to_phys_mapping | ||
| 52 | #define machine_to_phys_mapping ((unsigned long *)HYPERVISOR_VIRT_START) | ||
| 53 | #endif | ||
| 54 | 43 | ||
| 55 | /* | 44 | /* |
| 56 | * int HYPERVISOR_set_segment_base(unsigned int which, unsigned long base) | 45 | * int HYPERVISOR_set_segment_base(unsigned int which, unsigned long base) |
diff --git a/arch/x86/include/asm/xen/page.h b/arch/x86/include/asm/xen/page.h index dd8c1414b3d5..8760cc60a21c 100644 --- a/arch/x86/include/asm/xen/page.h +++ b/arch/x86/include/asm/xen/page.h | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | #include <linux/types.h> | 5 | #include <linux/types.h> |
| 6 | #include <linux/spinlock.h> | 6 | #include <linux/spinlock.h> |
| 7 | #include <linux/pfn.h> | 7 | #include <linux/pfn.h> |
| 8 | #include <linux/mm.h> | ||
| 8 | 9 | ||
| 9 | #include <asm/uaccess.h> | 10 | #include <asm/uaccess.h> |
| 10 | #include <asm/page.h> | 11 | #include <asm/page.h> |
| @@ -35,6 +36,8 @@ typedef struct xpaddr { | |||
| 35 | #define MAX_DOMAIN_PAGES \ | 36 | #define MAX_DOMAIN_PAGES \ |
| 36 | ((unsigned long)((u64)CONFIG_XEN_MAX_DOMAIN_MEMORY * 1024 * 1024 * 1024 / PAGE_SIZE)) | 37 | ((unsigned long)((u64)CONFIG_XEN_MAX_DOMAIN_MEMORY * 1024 * 1024 * 1024 / PAGE_SIZE)) |
| 37 | 38 | ||
| 39 | extern unsigned long *machine_to_phys_mapping; | ||
| 40 | extern unsigned int machine_to_phys_order; | ||
| 38 | 41 | ||
| 39 | extern unsigned long get_phys_to_machine(unsigned long pfn); | 42 | extern unsigned long get_phys_to_machine(unsigned long pfn); |
| 40 | extern bool set_phys_to_machine(unsigned long pfn, unsigned long mfn); | 43 | extern bool set_phys_to_machine(unsigned long pfn, unsigned long mfn); |
| @@ -69,10 +72,8 @@ static inline unsigned long mfn_to_pfn(unsigned long mfn) | |||
| 69 | if (xen_feature(XENFEAT_auto_translated_physmap)) | 72 | if (xen_feature(XENFEAT_auto_translated_physmap)) |
| 70 | return mfn; | 73 | return mfn; |
| 71 | 74 | ||
| 72 | #if 0 | ||
| 73 | if (unlikely((mfn >> machine_to_phys_order) != 0)) | 75 | if (unlikely((mfn >> machine_to_phys_order) != 0)) |
| 74 | return max_mapnr; | 76 | return ~0; |
| 75 | #endif | ||
| 76 | 77 | ||
| 77 | pfn = 0; | 78 | pfn = 0; |
| 78 | /* | 79 | /* |
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c index 235c0f4d3861..7250bef7f49e 100644 --- a/arch/x86/xen/enlighten.c +++ b/arch/x86/xen/enlighten.c | |||
| @@ -75,6 +75,11 @@ DEFINE_PER_CPU(struct vcpu_info, xen_vcpu_info); | |||
| 75 | enum xen_domain_type xen_domain_type = XEN_NATIVE; | 75 | enum xen_domain_type xen_domain_type = XEN_NATIVE; |
| 76 | EXPORT_SYMBOL_GPL(xen_domain_type); | 76 | EXPORT_SYMBOL_GPL(xen_domain_type); |
| 77 | 77 | ||
| 78 | unsigned long *machine_to_phys_mapping = (void *)MACH2PHYS_VIRT_START; | ||
| 79 | EXPORT_SYMBOL(machine_to_phys_mapping); | ||
| 80 | unsigned int machine_to_phys_order; | ||
| 81 | EXPORT_SYMBOL(machine_to_phys_order); | ||
| 82 | |||
| 78 | struct start_info *xen_start_info; | 83 | struct start_info *xen_start_info; |
| 79 | EXPORT_SYMBOL_GPL(xen_start_info); | 84 | EXPORT_SYMBOL_GPL(xen_start_info); |
| 80 | 85 | ||
| @@ -1090,6 +1095,8 @@ static void __init xen_setup_stackprotector(void) | |||
| 1090 | /* First C function to be called on Xen boot */ | 1095 | /* First C function to be called on Xen boot */ |
| 1091 | asmlinkage void __init xen_start_kernel(void) | 1096 | asmlinkage void __init xen_start_kernel(void) |
| 1092 | { | 1097 | { |
| 1098 | struct physdev_set_iopl set_iopl; | ||
| 1099 | int rc; | ||
| 1093 | pgd_t *pgd; | 1100 | pgd_t *pgd; |
| 1094 | 1101 | ||
| 1095 | if (!xen_start_info) | 1102 | if (!xen_start_info) |
| @@ -1097,6 +1104,8 @@ asmlinkage void __init xen_start_kernel(void) | |||
| 1097 | 1104 | ||
| 1098 | xen_domain_type = XEN_PV_DOMAIN; | 1105 | xen_domain_type = XEN_PV_DOMAIN; |
| 1099 | 1106 | ||
| 1107 | xen_setup_machphys_mapping(); | ||
| 1108 | |||
| 1100 | /* Install Xen paravirt ops */ | 1109 | /* Install Xen paravirt ops */ |
| 1101 | pv_info = xen_info; | 1110 | pv_info = xen_info; |
| 1102 | pv_init_ops = xen_init_ops; | 1111 | pv_init_ops = xen_init_ops; |
| @@ -1202,10 +1211,18 @@ asmlinkage void __init xen_start_kernel(void) | |||
| 1202 | #else | 1211 | #else |
| 1203 | pv_info.kernel_rpl = 0; | 1212 | pv_info.kernel_rpl = 0; |
| 1204 | #endif | 1213 | #endif |
| 1205 | |||
| 1206 | /* set the limit of our address space */ | 1214 | /* set the limit of our address space */ |
| 1207 | xen_reserve_top(); | 1215 | xen_reserve_top(); |
| 1208 | 1216 | ||
| 1217 | /* We used to do this in xen_arch_setup, but that is too late on AMD | ||
| 1218 | * were early_cpu_init (run before ->arch_setup()) calls early_amd_init | ||
| 1219 | * which pokes 0xcf8 port. | ||
| 1220 | */ | ||
| 1221 | set_iopl.iopl = 1; | ||
| 1222 | rc = HYPERVISOR_physdev_op(PHYSDEVOP_set_iopl, &set_iopl); | ||
| 1223 | if (rc != 0) | ||
| 1224 | xen_raw_printk("physdev_op failed %d\n", rc); | ||
| 1225 | |||
| 1209 | #ifdef CONFIG_X86_32 | 1226 | #ifdef CONFIG_X86_32 |
| 1210 | /* set up basic CPUID stuff */ | 1227 | /* set up basic CPUID stuff */ |
| 1211 | cpu_detect(&new_cpu_data); | 1228 | cpu_detect(&new_cpu_data); |
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c index 21ed8d7f75a5..790af908284e 100644 --- a/arch/x86/xen/mmu.c +++ b/arch/x86/xen/mmu.c | |||
| @@ -2034,6 +2034,20 @@ static __init void xen_map_identity_early(pmd_t *pmd, unsigned long max_pfn) | |||
| 2034 | set_page_prot(pmd, PAGE_KERNEL_RO); | 2034 | set_page_prot(pmd, PAGE_KERNEL_RO); |
| 2035 | } | 2035 | } |
| 2036 | 2036 | ||
| 2037 | void __init xen_setup_machphys_mapping(void) | ||
| 2038 | { | ||
| 2039 | struct xen_machphys_mapping mapping; | ||
| 2040 | unsigned long machine_to_phys_nr_ents; | ||
| 2041 | |||
| 2042 | if (HYPERVISOR_memory_op(XENMEM_machphys_mapping, &mapping) == 0) { | ||
| 2043 | machine_to_phys_mapping = (unsigned long *)mapping.v_start; | ||
| 2044 | machine_to_phys_nr_ents = mapping.max_mfn + 1; | ||
| 2045 | } else { | ||
| 2046 | machine_to_phys_nr_ents = MACH2PHYS_NR_ENTRIES; | ||
| 2047 | } | ||
| 2048 | machine_to_phys_order = fls(machine_to_phys_nr_ents - 1); | ||
| 2049 | } | ||
| 2050 | |||
| 2037 | #ifdef CONFIG_X86_64 | 2051 | #ifdef CONFIG_X86_64 |
| 2038 | static void convert_pfn_mfn(void *v) | 2052 | static void convert_pfn_mfn(void *v) |
| 2039 | { | 2053 | { |
| @@ -2627,7 +2641,8 @@ int xen_remap_domain_mfn_range(struct vm_area_struct *vma, | |||
| 2627 | 2641 | ||
| 2628 | prot = __pgprot(pgprot_val(prot) | _PAGE_IOMAP); | 2642 | prot = __pgprot(pgprot_val(prot) | _PAGE_IOMAP); |
| 2629 | 2643 | ||
| 2630 | vma->vm_flags |= VM_IO | VM_RESERVED | VM_PFNMAP; | 2644 | BUG_ON(!((vma->vm_flags & (VM_PFNMAP | VM_RESERVED | VM_IO)) == |
| 2645 | (VM_PFNMAP | VM_RESERVED | VM_IO))); | ||
| 2631 | 2646 | ||
| 2632 | rmd.mfn = mfn; | 2647 | rmd.mfn = mfn; |
| 2633 | rmd.prot = prot; | 2648 | rmd.prot = prot; |
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c index 769c4b01fa32..38fdffaa71d3 100644 --- a/arch/x86/xen/setup.c +++ b/arch/x86/xen/setup.c | |||
| @@ -248,8 +248,7 @@ char * __init xen_memory_setup(void) | |||
| 248 | else | 248 | else |
| 249 | extra_pages = 0; | 249 | extra_pages = 0; |
| 250 | 250 | ||
| 251 | if (!xen_initial_domain()) | 251 | xen_add_extra_mem(extra_pages); |
| 252 | xen_add_extra_mem(extra_pages); | ||
| 253 | 252 | ||
| 254 | return "Xen"; | 253 | return "Xen"; |
| 255 | } | 254 | } |
| @@ -337,9 +336,6 @@ void __cpuinit xen_enable_syscall(void) | |||
| 337 | 336 | ||
| 338 | void __init xen_arch_setup(void) | 337 | void __init xen_arch_setup(void) |
| 339 | { | 338 | { |
| 340 | struct physdev_set_iopl set_iopl; | ||
| 341 | int rc; | ||
| 342 | |||
| 343 | xen_panic_handler_init(); | 339 | xen_panic_handler_init(); |
| 344 | 340 | ||
| 345 | HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_4gb_segments); | 341 | HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_4gb_segments); |
| @@ -356,11 +352,6 @@ void __init xen_arch_setup(void) | |||
| 356 | xen_enable_sysenter(); | 352 | xen_enable_sysenter(); |
| 357 | xen_enable_syscall(); | 353 | xen_enable_syscall(); |
| 358 | 354 | ||
| 359 | set_iopl.iopl = 1; | ||
| 360 | rc = HYPERVISOR_physdev_op(PHYSDEVOP_set_iopl, &set_iopl); | ||
| 361 | if (rc != 0) | ||
| 362 | printk(KERN_INFO "physdev_op failed %d\n", rc); | ||
| 363 | |||
| 364 | #ifdef CONFIG_ACPI | 355 | #ifdef CONFIG_ACPI |
| 365 | if (!(xen_start_info->flags & SIF_INITDOMAIN)) { | 356 | if (!(xen_start_info->flags & SIF_INITDOMAIN)) { |
| 366 | printk(KERN_INFO "ACPI in unprivileged domain disabled\n"); | 357 | printk(KERN_INFO "ACPI in unprivileged domain disabled\n"); |
diff --git a/drivers/leds/leds-lp5521.c b/drivers/leds/leds-lp5521.c index 3782f31f06d2..33facd0c45d1 100644 --- a/drivers/leds/leds-lp5521.c +++ b/drivers/leds/leds-lp5521.c | |||
| @@ -125,11 +125,22 @@ struct lp5521_chip { | |||
| 125 | u8 num_leds; | 125 | u8 num_leds; |
| 126 | }; | 126 | }; |
| 127 | 127 | ||
| 128 | #define cdev_to_led(c) container_of(c, struct lp5521_led, cdev) | 128 | static inline struct lp5521_led *cdev_to_led(struct led_classdev *cdev) |
| 129 | #define engine_to_lp5521(eng) container_of((eng), struct lp5521_chip, \ | 129 | { |
| 130 | engines[(eng)->id - 1]) | 130 | return container_of(cdev, struct lp5521_led, cdev); |
| 131 | #define led_to_lp5521(led) container_of((led), struct lp5521_chip, \ | 131 | } |
| 132 | leds[(led)->id]) | 132 | |
| 133 | static inline struct lp5521_chip *engine_to_lp5521(struct lp5521_engine *engine) | ||
| 134 | { | ||
| 135 | return container_of(engine, struct lp5521_chip, | ||
| 136 | engines[engine->id - 1]); | ||
| 137 | } | ||
| 138 | |||
| 139 | static inline struct lp5521_chip *led_to_lp5521(struct lp5521_led *led) | ||
| 140 | { | ||
| 141 | return container_of(led, struct lp5521_chip, | ||
| 142 | leds[led->id]); | ||
| 143 | } | ||
| 133 | 144 | ||
| 134 | static void lp5521_led_brightness_work(struct work_struct *work); | 145 | static void lp5521_led_brightness_work(struct work_struct *work); |
| 135 | 146 | ||
| @@ -185,14 +196,17 @@ static int lp5521_load_program(struct lp5521_engine *eng, const u8 *pattern) | |||
| 185 | 196 | ||
| 186 | /* move current engine to direct mode and remember the state */ | 197 | /* move current engine to direct mode and remember the state */ |
| 187 | ret = lp5521_set_engine_mode(eng, LP5521_CMD_DIRECT); | 198 | ret = lp5521_set_engine_mode(eng, LP5521_CMD_DIRECT); |
| 188 | usleep_range(1000, 10000); | 199 | /* Mode change requires min 500 us delay. 1 - 2 ms with margin */ |
| 200 | usleep_range(1000, 2000); | ||
| 189 | ret |= lp5521_read(client, LP5521_REG_OP_MODE, &mode); | 201 | ret |= lp5521_read(client, LP5521_REG_OP_MODE, &mode); |
| 190 | 202 | ||
| 191 | /* For loading, all the engines to load mode */ | 203 | /* For loading, all the engines to load mode */ |
| 192 | lp5521_write(client, LP5521_REG_OP_MODE, LP5521_CMD_DIRECT); | 204 | lp5521_write(client, LP5521_REG_OP_MODE, LP5521_CMD_DIRECT); |
| 193 | usleep_range(1000, 10000); | 205 | /* Mode change requires min 500 us delay. 1 - 2 ms with margin */ |
| 206 | usleep_range(1000, 2000); | ||
| 194 | lp5521_write(client, LP5521_REG_OP_MODE, LP5521_CMD_LOAD); | 207 | lp5521_write(client, LP5521_REG_OP_MODE, LP5521_CMD_LOAD); |
| 195 | usleep_range(1000, 10000); | 208 | /* Mode change requires min 500 us delay. 1 - 2 ms with margin */ |
| 209 | usleep_range(1000, 2000); | ||
| 196 | 210 | ||
| 197 | addr = LP5521_PROG_MEM_BASE + eng->prog_page * LP5521_PROG_MEM_SIZE; | 211 | addr = LP5521_PROG_MEM_BASE + eng->prog_page * LP5521_PROG_MEM_SIZE; |
| 198 | i2c_smbus_write_i2c_block_data(client, | 212 | i2c_smbus_write_i2c_block_data(client, |
| @@ -231,10 +245,6 @@ static int lp5521_configure(struct i2c_client *client, | |||
| 231 | 245 | ||
| 232 | lp5521_init_engine(chip, attr_group); | 246 | lp5521_init_engine(chip, attr_group); |
| 233 | 247 | ||
| 234 | lp5521_write(client, LP5521_REG_RESET, 0xff); | ||
| 235 | |||
| 236 | usleep_range(10000, 20000); | ||
| 237 | |||
| 238 | /* Set all PWMs to direct control mode */ | 248 | /* Set all PWMs to direct control mode */ |
| 239 | ret = lp5521_write(client, LP5521_REG_OP_MODE, 0x3F); | 249 | ret = lp5521_write(client, LP5521_REG_OP_MODE, 0x3F); |
| 240 | 250 | ||
| @@ -251,8 +261,8 @@ static int lp5521_configure(struct i2c_client *client, | |||
| 251 | ret |= lp5521_write(client, LP5521_REG_ENABLE, | 261 | ret |= lp5521_write(client, LP5521_REG_ENABLE, |
| 252 | LP5521_MASTER_ENABLE | LP5521_LOGARITHMIC_PWM | | 262 | LP5521_MASTER_ENABLE | LP5521_LOGARITHMIC_PWM | |
| 253 | LP5521_EXEC_RUN); | 263 | LP5521_EXEC_RUN); |
| 254 | /* enable takes 500us */ | 264 | /* enable takes 500us. 1 - 2 ms leaves some margin */ |
| 255 | usleep_range(500, 20000); | 265 | usleep_range(1000, 2000); |
| 256 | 266 | ||
| 257 | return ret; | 267 | return ret; |
| 258 | } | 268 | } |
| @@ -305,7 +315,8 @@ static int lp5521_detect(struct i2c_client *client) | |||
| 305 | LP5521_MASTER_ENABLE | LP5521_LOGARITHMIC_PWM); | 315 | LP5521_MASTER_ENABLE | LP5521_LOGARITHMIC_PWM); |
| 306 | if (ret) | 316 | if (ret) |
| 307 | return ret; | 317 | return ret; |
| 308 | usleep_range(1000, 10000); | 318 | /* enable takes 500us. 1 - 2 ms leaves some margin */ |
| 319 | usleep_range(1000, 2000); | ||
| 309 | ret = lp5521_read(client, LP5521_REG_ENABLE, &buf); | 320 | ret = lp5521_read(client, LP5521_REG_ENABLE, &buf); |
| 310 | if (ret) | 321 | if (ret) |
| 311 | return ret; | 322 | return ret; |
| @@ -693,11 +704,16 @@ static int lp5521_probe(struct i2c_client *client, | |||
| 693 | 704 | ||
| 694 | if (pdata->enable) { | 705 | if (pdata->enable) { |
| 695 | pdata->enable(0); | 706 | pdata->enable(0); |
| 696 | usleep_range(1000, 10000); | 707 | usleep_range(1000, 2000); /* Keep enable down at least 1ms */ |
| 697 | pdata->enable(1); | 708 | pdata->enable(1); |
| 698 | usleep_range(1000, 10000); /* Spec says min 500us */ | 709 | usleep_range(1000, 2000); /* 500us abs min. */ |
| 699 | } | 710 | } |
| 700 | 711 | ||
| 712 | lp5521_write(client, LP5521_REG_RESET, 0xff); | ||
| 713 | usleep_range(10000, 20000); /* | ||
| 714 | * Exact value is not available. 10 - 20ms | ||
| 715 | * appears to be enough for reset. | ||
| 716 | */ | ||
| 701 | ret = lp5521_detect(client); | 717 | ret = lp5521_detect(client); |
| 702 | 718 | ||
| 703 | if (ret) { | 719 | if (ret) { |
diff --git a/drivers/leds/leds-lp5523.c b/drivers/leds/leds-lp5523.c index 1e11fcc08b28..0cc4ead2fd8b 100644 --- a/drivers/leds/leds-lp5523.c +++ b/drivers/leds/leds-lp5523.c | |||
| @@ -134,15 +134,18 @@ struct lp5523_chip { | |||
| 134 | u8 num_leds; | 134 | u8 num_leds; |
| 135 | }; | 135 | }; |
| 136 | 136 | ||
| 137 | #define cdev_to_led(c) container_of(c, struct lp5523_led, cdev) | 137 | static inline struct lp5523_led *cdev_to_led(struct led_classdev *cdev) |
| 138 | { | ||
| 139 | return container_of(cdev, struct lp5523_led, cdev); | ||
| 140 | } | ||
| 138 | 141 | ||
| 139 | static struct lp5523_chip *engine_to_lp5523(struct lp5523_engine *engine) | 142 | static inline struct lp5523_chip *engine_to_lp5523(struct lp5523_engine *engine) |
| 140 | { | 143 | { |
| 141 | return container_of(engine, struct lp5523_chip, | 144 | return container_of(engine, struct lp5523_chip, |
| 142 | engines[engine->id - 1]); | 145 | engines[engine->id - 1]); |
| 143 | } | 146 | } |
| 144 | 147 | ||
| 145 | static struct lp5523_chip *led_to_lp5523(struct lp5523_led *led) | 148 | static inline struct lp5523_chip *led_to_lp5523(struct lp5523_led *led) |
| 146 | { | 149 | { |
| 147 | return container_of(led, struct lp5523_chip, | 150 | return container_of(led, struct lp5523_chip, |
| 148 | leds[led->id]); | 151 | leds[led->id]); |
| @@ -200,13 +203,9 @@ static int lp5523_configure(struct i2c_client *client) | |||
| 200 | { 0x9c, 0x50, 0x9c, 0xd0, 0x9d, 0x80, 0xd8, 0x00, 0}, | 203 | { 0x9c, 0x50, 0x9c, 0xd0, 0x9d, 0x80, 0xd8, 0x00, 0}, |
| 201 | }; | 204 | }; |
| 202 | 205 | ||
| 203 | lp5523_write(client, LP5523_REG_RESET, 0xff); | ||
| 204 | |||
| 205 | usleep_range(10000, 100000); | ||
| 206 | |||
| 207 | ret |= lp5523_write(client, LP5523_REG_ENABLE, LP5523_ENABLE); | 206 | ret |= lp5523_write(client, LP5523_REG_ENABLE, LP5523_ENABLE); |
| 208 | /* Chip startup time after reset is 500 us */ | 207 | /* Chip startup time is 500 us, 1 - 2 ms gives some margin */ |
| 209 | usleep_range(1000, 10000); | 208 | usleep_range(1000, 2000); |
| 210 | 209 | ||
| 211 | ret |= lp5523_write(client, LP5523_REG_CONFIG, | 210 | ret |= lp5523_write(client, LP5523_REG_CONFIG, |
| 212 | LP5523_AUTO_INC | LP5523_PWR_SAVE | | 211 | LP5523_AUTO_INC | LP5523_PWR_SAVE | |
| @@ -243,8 +242,8 @@ static int lp5523_configure(struct i2c_client *client) | |||
| 243 | return -1; | 242 | return -1; |
| 244 | } | 243 | } |
| 245 | 244 | ||
| 246 | /* Wait 3ms and check the engine status */ | 245 | /* Let the programs run for couple of ms and check the engine status */ |
| 247 | usleep_range(3000, 20000); | 246 | usleep_range(3000, 6000); |
| 248 | lp5523_read(client, LP5523_REG_STATUS, &status); | 247 | lp5523_read(client, LP5523_REG_STATUS, &status); |
| 249 | status &= LP5523_ENG_STATUS_MASK; | 248 | status &= LP5523_ENG_STATUS_MASK; |
| 250 | 249 | ||
| @@ -449,10 +448,10 @@ static ssize_t lp5523_selftest(struct device *dev, | |||
| 449 | /* Measure VDD (i.e. VBAT) first (channel 16 corresponds to VDD) */ | 448 | /* Measure VDD (i.e. VBAT) first (channel 16 corresponds to VDD) */ |
| 450 | lp5523_write(chip->client, LP5523_REG_LED_TEST_CTRL, | 449 | lp5523_write(chip->client, LP5523_REG_LED_TEST_CTRL, |
| 451 | LP5523_EN_LEDTEST | 16); | 450 | LP5523_EN_LEDTEST | 16); |
| 452 | usleep_range(3000, 10000); | 451 | usleep_range(3000, 6000); /* ADC conversion time is typically 2.7 ms */ |
| 453 | ret = lp5523_read(chip->client, LP5523_REG_STATUS, &status); | 452 | ret = lp5523_read(chip->client, LP5523_REG_STATUS, &status); |
| 454 | if (!(status & LP5523_LEDTEST_DONE)) | 453 | if (!(status & LP5523_LEDTEST_DONE)) |
| 455 | usleep_range(3000, 10000); | 454 | usleep_range(3000, 6000); /* Was not ready. Wait little bit */ |
| 456 | 455 | ||
| 457 | ret |= lp5523_read(chip->client, LP5523_REG_LED_TEST_ADC, &vdd); | 456 | ret |= lp5523_read(chip->client, LP5523_REG_LED_TEST_ADC, &vdd); |
| 458 | vdd--; /* There may be some fluctuation in measurement */ | 457 | vdd--; /* There may be some fluctuation in measurement */ |
| @@ -468,16 +467,16 @@ static ssize_t lp5523_selftest(struct device *dev, | |||
| 468 | chip->pdata->led_config[i].led_current); | 467 | chip->pdata->led_config[i].led_current); |
| 469 | 468 | ||
| 470 | lp5523_write(chip->client, LP5523_REG_LED_PWM_BASE + i, 0xff); | 469 | lp5523_write(chip->client, LP5523_REG_LED_PWM_BASE + i, 0xff); |
| 471 | /* let current stabilize 2ms before measurements start */ | 470 | /* let current stabilize 2 - 4ms before measurements start */ |
| 472 | usleep_range(2000, 10000); | 471 | usleep_range(2000, 4000); |
| 473 | lp5523_write(chip->client, | 472 | lp5523_write(chip->client, |
| 474 | LP5523_REG_LED_TEST_CTRL, | 473 | LP5523_REG_LED_TEST_CTRL, |
| 475 | LP5523_EN_LEDTEST | i); | 474 | LP5523_EN_LEDTEST | i); |
| 476 | /* ledtest takes 2.7ms */ | 475 | /* ADC conversion time is 2.7 ms typically */ |
| 477 | usleep_range(3000, 10000); | 476 | usleep_range(3000, 6000); |
| 478 | ret = lp5523_read(chip->client, LP5523_REG_STATUS, &status); | 477 | ret = lp5523_read(chip->client, LP5523_REG_STATUS, &status); |
| 479 | if (!(status & LP5523_LEDTEST_DONE)) | 478 | if (!(status & LP5523_LEDTEST_DONE)) |
| 480 | usleep_range(3000, 10000); | 479 | usleep_range(3000, 6000);/* Was not ready. Wait. */ |
| 481 | ret |= lp5523_read(chip->client, LP5523_REG_LED_TEST_ADC, &adc); | 480 | ret |= lp5523_read(chip->client, LP5523_REG_LED_TEST_ADC, &adc); |
| 482 | 481 | ||
| 483 | if (adc >= vdd || adc < LP5523_ADC_SHORTCIRC_LIM) | 482 | if (adc >= vdd || adc < LP5523_ADC_SHORTCIRC_LIM) |
| @@ -930,11 +929,16 @@ static int lp5523_probe(struct i2c_client *client, | |||
| 930 | 929 | ||
| 931 | if (pdata->enable) { | 930 | if (pdata->enable) { |
| 932 | pdata->enable(0); | 931 | pdata->enable(0); |
| 933 | usleep_range(1000, 10000); | 932 | usleep_range(1000, 2000); /* Keep enable down at least 1ms */ |
| 934 | pdata->enable(1); | 933 | pdata->enable(1); |
| 935 | usleep_range(1000, 10000); /* Spec says min 500us */ | 934 | usleep_range(1000, 2000); /* 500us abs min. */ |
| 936 | } | 935 | } |
| 937 | 936 | ||
| 937 | lp5523_write(client, LP5523_REG_RESET, 0xff); | ||
| 938 | usleep_range(10000, 20000); /* | ||
| 939 | * Exact value is not available. 10 - 20ms | ||
| 940 | * appears to be enough for reset. | ||
| 941 | */ | ||
| 938 | ret = lp5523_detect(client); | 942 | ret = lp5523_detect(client); |
| 939 | if (ret) | 943 | if (ret) |
| 940 | goto fail2; | 944 | goto fail2; |
diff --git a/drivers/leds/leds-ss4200.c b/drivers/leds/leds-ss4200.c index a688293abd0b..614ebebaaa28 100644 --- a/drivers/leds/leds-ss4200.c +++ b/drivers/leds/leds-ss4200.c | |||
| @@ -102,6 +102,7 @@ static struct dmi_system_id __initdata nas_led_whitelist[] = { | |||
| 102 | DMI_MATCH(DMI_PRODUCT_VERSION, "1.00.00") | 102 | DMI_MATCH(DMI_PRODUCT_VERSION, "1.00.00") |
| 103 | } | 103 | } |
| 104 | }, | 104 | }, |
| 105 | {} | ||
| 105 | }; | 106 | }; |
| 106 | 107 | ||
| 107 | /* | 108 | /* |
diff --git a/drivers/misc/isl29020.c b/drivers/misc/isl29020.c index ca47e6285075..307aada5fffe 100644 --- a/drivers/misc/isl29020.c +++ b/drivers/misc/isl29020.c | |||
| @@ -183,9 +183,7 @@ static int isl29020_probe(struct i2c_client *client, | |||
| 183 | 183 | ||
| 184 | static int isl29020_remove(struct i2c_client *client) | 184 | static int isl29020_remove(struct i2c_client *client) |
| 185 | { | 185 | { |
| 186 | struct als_data *data = i2c_get_clientdata(client); | ||
| 187 | sysfs_remove_group(&client->dev.kobj, &m_als_gr); | 186 | sysfs_remove_group(&client->dev.kobj, &m_als_gr); |
| 188 | kfree(data); | ||
| 189 | return 0; | 187 | return 0; |
| 190 | } | 188 | } |
| 191 | 189 | ||
| @@ -245,6 +243,6 @@ static void __exit sensor_isl29020_exit(void) | |||
| 245 | module_init(sensor_isl29020_init); | 243 | module_init(sensor_isl29020_init); |
| 246 | module_exit(sensor_isl29020_exit); | 244 | module_exit(sensor_isl29020_exit); |
| 247 | 245 | ||
| 248 | MODULE_AUTHOR("Kalhan Trisal <kalhan.trisal@intel.com"); | 246 | MODULE_AUTHOR("Kalhan Trisal <kalhan.trisal@intel.com>"); |
| 249 | MODULE_DESCRIPTION("Intersil isl29020 ALS Driver"); | 247 | MODULE_DESCRIPTION("Intersil isl29020 ALS Driver"); |
| 250 | MODULE_LICENSE("GPL v2"); | 248 | MODULE_LICENSE("GPL v2"); |
diff --git a/drivers/misc/sgi-xp/xpc_partition.c b/drivers/misc/sgi-xp/xpc_partition.c index d551f09ccb79..6956f7e7d439 100644 --- a/drivers/misc/sgi-xp/xpc_partition.c +++ b/drivers/misc/sgi-xp/xpc_partition.c | |||
| @@ -439,18 +439,23 @@ xpc_discovery(void) | |||
| 439 | * nodes that can comprise an access protection grouping. The access | 439 | * nodes that can comprise an access protection grouping. The access |
| 440 | * protection is in regards to memory, IOI and IPI. | 440 | * protection is in regards to memory, IOI and IPI. |
| 441 | */ | 441 | */ |
| 442 | max_regions = 64; | ||
| 443 | region_size = xp_region_size; | 442 | region_size = xp_region_size; |
| 444 | 443 | ||
| 445 | switch (region_size) { | 444 | if (is_uv()) |
| 446 | case 128: | 445 | max_regions = 256; |
| 447 | max_regions *= 2; | 446 | else { |
| 448 | case 64: | 447 | max_regions = 64; |
| 449 | max_regions *= 2; | 448 | |
| 450 | case 32: | 449 | switch (region_size) { |
| 451 | max_regions *= 2; | 450 | case 128: |
| 452 | region_size = 16; | 451 | max_regions *= 2; |
| 453 | DBUG_ON(!is_shub2()); | 452 | case 64: |
| 453 | max_regions *= 2; | ||
| 454 | case 32: | ||
| 455 | max_regions *= 2; | ||
| 456 | region_size = 16; | ||
| 457 | DBUG_ON(!is_shub2()); | ||
| 458 | } | ||
| 454 | } | 459 | } |
| 455 | 460 | ||
| 456 | for (region = 0; region < max_regions; region++) { | 461 | for (region = 0; region < max_regions; region++) { |
diff --git a/drivers/net/atl1c/atl1c_hw.c b/drivers/net/atl1c/atl1c_hw.c index 919080b2c3a5..1bf672009948 100644 --- a/drivers/net/atl1c/atl1c_hw.c +++ b/drivers/net/atl1c/atl1c_hw.c | |||
| @@ -82,7 +82,7 @@ static int atl1c_get_permanent_address(struct atl1c_hw *hw) | |||
| 82 | addr[0] = addr[1] = 0; | 82 | addr[0] = addr[1] = 0; |
| 83 | AT_READ_REG(hw, REG_OTP_CTRL, &otp_ctrl_data); | 83 | AT_READ_REG(hw, REG_OTP_CTRL, &otp_ctrl_data); |
| 84 | if (atl1c_check_eeprom_exist(hw)) { | 84 | if (atl1c_check_eeprom_exist(hw)) { |
| 85 | if (hw->nic_type == athr_l1c || hw->nic_type == athr_l2c_b) { | 85 | if (hw->nic_type == athr_l1c || hw->nic_type == athr_l2c) { |
| 86 | /* Enable OTP CLK */ | 86 | /* Enable OTP CLK */ |
| 87 | if (!(otp_ctrl_data & OTP_CTRL_CLK_EN)) { | 87 | if (!(otp_ctrl_data & OTP_CTRL_CLK_EN)) { |
| 88 | otp_ctrl_data |= OTP_CTRL_CLK_EN; | 88 | otp_ctrl_data |= OTP_CTRL_CLK_EN; |
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index 4686c3983fc3..4d62f7bfa036 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c | |||
| @@ -31,7 +31,7 @@ | |||
| 31 | 31 | ||
| 32 | char e1000_driver_name[] = "e1000"; | 32 | char e1000_driver_name[] = "e1000"; |
| 33 | static char e1000_driver_string[] = "Intel(R) PRO/1000 Network Driver"; | 33 | static char e1000_driver_string[] = "Intel(R) PRO/1000 Network Driver"; |
| 34 | #define DRV_VERSION "7.3.21-k6-NAPI" | 34 | #define DRV_VERSION "7.3.21-k8-NAPI" |
| 35 | const char e1000_driver_version[] = DRV_VERSION; | 35 | const char e1000_driver_version[] = DRV_VERSION; |
| 36 | static const char e1000_copyright[] = "Copyright (c) 1999-2006 Intel Corporation."; | 36 | static const char e1000_copyright[] = "Copyright (c) 1999-2006 Intel Corporation."; |
| 37 | 37 | ||
| @@ -485,9 +485,6 @@ void e1000_down(struct e1000_adapter *adapter) | |||
| 485 | struct net_device *netdev = adapter->netdev; | 485 | struct net_device *netdev = adapter->netdev; |
| 486 | u32 rctl, tctl; | 486 | u32 rctl, tctl; |
| 487 | 487 | ||
| 488 | /* signal that we're down so the interrupt handler does not | ||
| 489 | * reschedule our watchdog timer */ | ||
| 490 | set_bit(__E1000_DOWN, &adapter->flags); | ||
| 491 | 488 | ||
| 492 | /* disable receives in the hardware */ | 489 | /* disable receives in the hardware */ |
| 493 | rctl = er32(RCTL); | 490 | rctl = er32(RCTL); |
| @@ -508,6 +505,13 @@ void e1000_down(struct e1000_adapter *adapter) | |||
| 508 | 505 | ||
| 509 | e1000_irq_disable(adapter); | 506 | e1000_irq_disable(adapter); |
| 510 | 507 | ||
| 508 | /* | ||
| 509 | * Setting DOWN must be after irq_disable to prevent | ||
| 510 | * a screaming interrupt. Setting DOWN also prevents | ||
| 511 | * timers and tasks from rescheduling. | ||
| 512 | */ | ||
| 513 | set_bit(__E1000_DOWN, &adapter->flags); | ||
| 514 | |||
| 511 | del_timer_sync(&adapter->tx_fifo_stall_timer); | 515 | del_timer_sync(&adapter->tx_fifo_stall_timer); |
| 512 | del_timer_sync(&adapter->watchdog_timer); | 516 | del_timer_sync(&adapter->watchdog_timer); |
| 513 | del_timer_sync(&adapter->phy_info_timer); | 517 | del_timer_sync(&adapter->phy_info_timer); |
diff --git a/drivers/net/irda/sh_sir.c b/drivers/net/irda/sh_sir.c index 00b38bccd6d0..52a7c86af663 100644 --- a/drivers/net/irda/sh_sir.c +++ b/drivers/net/irda/sh_sir.c | |||
| @@ -258,7 +258,7 @@ static int sh_sir_set_baudrate(struct sh_sir_self *self, u32 baudrate) | |||
| 258 | 258 | ||
| 259 | /* Baud Rate Error Correction x 10000 */ | 259 | /* Baud Rate Error Correction x 10000 */ |
| 260 | u32 rate_err_array[] = { | 260 | u32 rate_err_array[] = { |
| 261 | 0000, 0625, 1250, 1875, | 261 | 0, 625, 1250, 1875, |
| 262 | 2500, 3125, 3750, 4375, | 262 | 2500, 3125, 3750, 4375, |
| 263 | 5000, 5625, 6250, 6875, | 263 | 5000, 5625, 6250, 6875, |
| 264 | 7500, 8125, 8750, 9375, | 264 | 7500, 8125, 8750, 9375, |
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c index f0bd1a1aba3a..e8b9c53c304b 100644 --- a/drivers/net/phy/marvell.c +++ b/drivers/net/phy/marvell.c | |||
| @@ -30,11 +30,14 @@ | |||
| 30 | #include <linux/ethtool.h> | 30 | #include <linux/ethtool.h> |
| 31 | #include <linux/phy.h> | 31 | #include <linux/phy.h> |
| 32 | #include <linux/marvell_phy.h> | 32 | #include <linux/marvell_phy.h> |
| 33 | #include <linux/of.h> | ||
| 33 | 34 | ||
| 34 | #include <asm/io.h> | 35 | #include <asm/io.h> |
| 35 | #include <asm/irq.h> | 36 | #include <asm/irq.h> |
| 36 | #include <asm/uaccess.h> | 37 | #include <asm/uaccess.h> |
| 37 | 38 | ||
| 39 | #define MII_MARVELL_PHY_PAGE 22 | ||
| 40 | |||
| 38 | #define MII_M1011_IEVENT 0x13 | 41 | #define MII_M1011_IEVENT 0x13 |
| 39 | #define MII_M1011_IEVENT_CLEAR 0x0000 | 42 | #define MII_M1011_IEVENT_CLEAR 0x0000 |
| 40 | 43 | ||
| @@ -80,7 +83,6 @@ | |||
| 80 | #define MII_88E1121_PHY_LED_CTRL 16 | 83 | #define MII_88E1121_PHY_LED_CTRL 16 |
| 81 | #define MII_88E1121_PHY_LED_PAGE 3 | 84 | #define MII_88E1121_PHY_LED_PAGE 3 |
| 82 | #define MII_88E1121_PHY_LED_DEF 0x0030 | 85 | #define MII_88E1121_PHY_LED_DEF 0x0030 |
| 83 | #define MII_88E1121_PHY_PAGE 22 | ||
| 84 | 86 | ||
| 85 | #define MII_M1011_PHY_STATUS 0x11 | 87 | #define MII_M1011_PHY_STATUS 0x11 |
| 86 | #define MII_M1011_PHY_STATUS_1000 0x8000 | 88 | #define MII_M1011_PHY_STATUS_1000 0x8000 |
| @@ -186,13 +188,94 @@ static int marvell_config_aneg(struct phy_device *phydev) | |||
| 186 | return 0; | 188 | return 0; |
| 187 | } | 189 | } |
| 188 | 190 | ||
| 191 | #ifdef CONFIG_OF_MDIO | ||
| 192 | /* | ||
| 193 | * Set and/or override some configuration registers based on the | ||
| 194 | * marvell,reg-init property stored in the of_node for the phydev. | ||
| 195 | * | ||
| 196 | * marvell,reg-init = <reg-page reg mask value>,...; | ||
| 197 | * | ||
| 198 | * There may be one or more sets of <reg-page reg mask value>: | ||
| 199 | * | ||
| 200 | * reg-page: which register bank to use. | ||
| 201 | * reg: the register. | ||
| 202 | * mask: if non-zero, ANDed with existing register value. | ||
| 203 | * value: ORed with the masked value and written to the regiser. | ||
| 204 | * | ||
| 205 | */ | ||
| 206 | static int marvell_of_reg_init(struct phy_device *phydev) | ||
| 207 | { | ||
| 208 | const __be32 *paddr; | ||
| 209 | int len, i, saved_page, current_page, page_changed, ret; | ||
| 210 | |||
| 211 | if (!phydev->dev.of_node) | ||
| 212 | return 0; | ||
| 213 | |||
| 214 | paddr = of_get_property(phydev->dev.of_node, "marvell,reg-init", &len); | ||
| 215 | if (!paddr || len < (4 * sizeof(*paddr))) | ||
| 216 | return 0; | ||
| 217 | |||
| 218 | saved_page = phy_read(phydev, MII_MARVELL_PHY_PAGE); | ||
| 219 | if (saved_page < 0) | ||
| 220 | return saved_page; | ||
| 221 | page_changed = 0; | ||
| 222 | current_page = saved_page; | ||
| 223 | |||
| 224 | ret = 0; | ||
| 225 | len /= sizeof(*paddr); | ||
| 226 | for (i = 0; i < len - 3; i += 4) { | ||
| 227 | u16 reg_page = be32_to_cpup(paddr + i); | ||
| 228 | u16 reg = be32_to_cpup(paddr + i + 1); | ||
| 229 | u16 mask = be32_to_cpup(paddr + i + 2); | ||
| 230 | u16 val_bits = be32_to_cpup(paddr + i + 3); | ||
| 231 | int val; | ||
| 232 | |||
| 233 | if (reg_page != current_page) { | ||
| 234 | current_page = reg_page; | ||
| 235 | page_changed = 1; | ||
| 236 | ret = phy_write(phydev, MII_MARVELL_PHY_PAGE, reg_page); | ||
| 237 | if (ret < 0) | ||
| 238 | goto err; | ||
| 239 | } | ||
| 240 | |||
| 241 | val = 0; | ||
| 242 | if (mask) { | ||
| 243 | val = phy_read(phydev, reg); | ||
| 244 | if (val < 0) { | ||
| 245 | ret = val; | ||
| 246 | goto err; | ||
| 247 | } | ||
| 248 | val &= mask; | ||
| 249 | } | ||
| 250 | val |= val_bits; | ||
| 251 | |||
| 252 | ret = phy_write(phydev, reg, val); | ||
| 253 | if (ret < 0) | ||
| 254 | goto err; | ||
| 255 | |||
| 256 | } | ||
| 257 | err: | ||
| 258 | if (page_changed) { | ||
| 259 | i = phy_write(phydev, MII_MARVELL_PHY_PAGE, saved_page); | ||
| 260 | if (ret == 0) | ||
| 261 | ret = i; | ||
| 262 | } | ||
| 263 | return ret; | ||
| 264 | } | ||
| 265 | #else | ||
| 266 | static int marvell_of_reg_init(struct phy_device *phydev) | ||
| 267 | { | ||
| 268 | return 0; | ||
| 269 | } | ||
| 270 | #endif /* CONFIG_OF_MDIO */ | ||
| 271 | |||
| 189 | static int m88e1121_config_aneg(struct phy_device *phydev) | 272 | static int m88e1121_config_aneg(struct phy_device *phydev) |
| 190 | { | 273 | { |
| 191 | int err, oldpage, mscr; | 274 | int err, oldpage, mscr; |
| 192 | 275 | ||
| 193 | oldpage = phy_read(phydev, MII_88E1121_PHY_PAGE); | 276 | oldpage = phy_read(phydev, MII_MARVELL_PHY_PAGE); |
| 194 | 277 | ||
| 195 | err = phy_write(phydev, MII_88E1121_PHY_PAGE, | 278 | err = phy_write(phydev, MII_MARVELL_PHY_PAGE, |
| 196 | MII_88E1121_PHY_MSCR_PAGE); | 279 | MII_88E1121_PHY_MSCR_PAGE); |
| 197 | if (err < 0) | 280 | if (err < 0) |
| 198 | return err; | 281 | return err; |
| @@ -218,7 +301,7 @@ static int m88e1121_config_aneg(struct phy_device *phydev) | |||
| 218 | return err; | 301 | return err; |
| 219 | } | 302 | } |
| 220 | 303 | ||
| 221 | phy_write(phydev, MII_88E1121_PHY_PAGE, oldpage); | 304 | phy_write(phydev, MII_MARVELL_PHY_PAGE, oldpage); |
| 222 | 305 | ||
| 223 | err = phy_write(phydev, MII_BMCR, BMCR_RESET); | 306 | err = phy_write(phydev, MII_BMCR, BMCR_RESET); |
| 224 | if (err < 0) | 307 | if (err < 0) |
| @@ -229,11 +312,11 @@ static int m88e1121_config_aneg(struct phy_device *phydev) | |||
| 229 | if (err < 0) | 312 | if (err < 0) |
| 230 | return err; | 313 | return err; |
| 231 | 314 | ||
| 232 | oldpage = phy_read(phydev, MII_88E1121_PHY_PAGE); | 315 | oldpage = phy_read(phydev, MII_MARVELL_PHY_PAGE); |
| 233 | 316 | ||
| 234 | phy_write(phydev, MII_88E1121_PHY_PAGE, MII_88E1121_PHY_LED_PAGE); | 317 | phy_write(phydev, MII_MARVELL_PHY_PAGE, MII_88E1121_PHY_LED_PAGE); |
| 235 | phy_write(phydev, MII_88E1121_PHY_LED_CTRL, MII_88E1121_PHY_LED_DEF); | 318 | phy_write(phydev, MII_88E1121_PHY_LED_CTRL, MII_88E1121_PHY_LED_DEF); |
| 236 | phy_write(phydev, MII_88E1121_PHY_PAGE, oldpage); | 319 | phy_write(phydev, MII_MARVELL_PHY_PAGE, oldpage); |
| 237 | 320 | ||
| 238 | err = genphy_config_aneg(phydev); | 321 | err = genphy_config_aneg(phydev); |
| 239 | 322 | ||
| @@ -244,9 +327,9 @@ static int m88e1318_config_aneg(struct phy_device *phydev) | |||
| 244 | { | 327 | { |
| 245 | int err, oldpage, mscr; | 328 | int err, oldpage, mscr; |
| 246 | 329 | ||
| 247 | oldpage = phy_read(phydev, MII_88E1121_PHY_PAGE); | 330 | oldpage = phy_read(phydev, MII_MARVELL_PHY_PAGE); |
| 248 | 331 | ||
| 249 | err = phy_write(phydev, MII_88E1121_PHY_PAGE, | 332 | err = phy_write(phydev, MII_MARVELL_PHY_PAGE, |
| 250 | MII_88E1121_PHY_MSCR_PAGE); | 333 | MII_88E1121_PHY_MSCR_PAGE); |
| 251 | if (err < 0) | 334 | if (err < 0) |
| 252 | return err; | 335 | return err; |
| @@ -258,7 +341,7 @@ static int m88e1318_config_aneg(struct phy_device *phydev) | |||
| 258 | if (err < 0) | 341 | if (err < 0) |
| 259 | return err; | 342 | return err; |
| 260 | 343 | ||
| 261 | err = phy_write(phydev, MII_88E1121_PHY_PAGE, oldpage); | 344 | err = phy_write(phydev, MII_MARVELL_PHY_PAGE, oldpage); |
| 262 | if (err < 0) | 345 | if (err < 0) |
| 263 | return err; | 346 | return err; |
| 264 | 347 | ||
| @@ -368,6 +451,9 @@ static int m88e1111_config_init(struct phy_device *phydev) | |||
| 368 | return err; | 451 | return err; |
| 369 | } | 452 | } |
| 370 | 453 | ||
| 454 | err = marvell_of_reg_init(phydev); | ||
| 455 | if (err < 0) | ||
| 456 | return err; | ||
| 371 | 457 | ||
| 372 | err = phy_write(phydev, MII_BMCR, BMCR_RESET); | 458 | err = phy_write(phydev, MII_BMCR, BMCR_RESET); |
| 373 | if (err < 0) | 459 | if (err < 0) |
| @@ -398,7 +484,7 @@ static int m88e1118_config_init(struct phy_device *phydev) | |||
| 398 | int err; | 484 | int err; |
| 399 | 485 | ||
| 400 | /* Change address */ | 486 | /* Change address */ |
| 401 | err = phy_write(phydev, 0x16, 0x0002); | 487 | err = phy_write(phydev, MII_MARVELL_PHY_PAGE, 0x0002); |
| 402 | if (err < 0) | 488 | if (err < 0) |
| 403 | return err; | 489 | return err; |
| 404 | 490 | ||
| @@ -408,7 +494,7 @@ static int m88e1118_config_init(struct phy_device *phydev) | |||
| 408 | return err; | 494 | return err; |
| 409 | 495 | ||
| 410 | /* Change address */ | 496 | /* Change address */ |
| 411 | err = phy_write(phydev, 0x16, 0x0003); | 497 | err = phy_write(phydev, MII_MARVELL_PHY_PAGE, 0x0003); |
| 412 | if (err < 0) | 498 | if (err < 0) |
| 413 | return err; | 499 | return err; |
| 414 | 500 | ||
| @@ -420,8 +506,42 @@ static int m88e1118_config_init(struct phy_device *phydev) | |||
| 420 | if (err < 0) | 506 | if (err < 0) |
| 421 | return err; | 507 | return err; |
| 422 | 508 | ||
| 509 | err = marvell_of_reg_init(phydev); | ||
| 510 | if (err < 0) | ||
| 511 | return err; | ||
| 512 | |||
| 423 | /* Reset address */ | 513 | /* Reset address */ |
| 424 | err = phy_write(phydev, 0x16, 0x0); | 514 | err = phy_write(phydev, MII_MARVELL_PHY_PAGE, 0x0); |
| 515 | if (err < 0) | ||
| 516 | return err; | ||
| 517 | |||
| 518 | err = phy_write(phydev, MII_BMCR, BMCR_RESET); | ||
| 519 | if (err < 0) | ||
| 520 | return err; | ||
| 521 | |||
| 522 | return 0; | ||
| 523 | } | ||
| 524 | |||
| 525 | static int m88e1149_config_init(struct phy_device *phydev) | ||
| 526 | { | ||
| 527 | int err; | ||
| 528 | |||
| 529 | /* Change address */ | ||
| 530 | err = phy_write(phydev, MII_MARVELL_PHY_PAGE, 0x0002); | ||
| 531 | if (err < 0) | ||
| 532 | return err; | ||
| 533 | |||
| 534 | /* Enable 1000 Mbit */ | ||
| 535 | err = phy_write(phydev, 0x15, 0x1048); | ||
| 536 | if (err < 0) | ||
| 537 | return err; | ||
| 538 | |||
| 539 | err = marvell_of_reg_init(phydev); | ||
| 540 | if (err < 0) | ||
| 541 | return err; | ||
| 542 | |||
| 543 | /* Reset address */ | ||
| 544 | err = phy_write(phydev, MII_MARVELL_PHY_PAGE, 0x0); | ||
| 425 | if (err < 0) | 545 | if (err < 0) |
| 426 | return err; | 546 | return err; |
| 427 | 547 | ||
| @@ -491,6 +611,10 @@ static int m88e1145_config_init(struct phy_device *phydev) | |||
| 491 | } | 611 | } |
| 492 | } | 612 | } |
| 493 | 613 | ||
| 614 | err = marvell_of_reg_init(phydev); | ||
| 615 | if (err < 0) | ||
| 616 | return err; | ||
| 617 | |||
| 494 | return 0; | 618 | return 0; |
| 495 | } | 619 | } |
| 496 | 620 | ||
| @@ -685,6 +809,19 @@ static struct phy_driver marvell_drivers[] = { | |||
| 685 | .driver = { .owner = THIS_MODULE }, | 809 | .driver = { .owner = THIS_MODULE }, |
| 686 | }, | 810 | }, |
| 687 | { | 811 | { |
| 812 | .phy_id = MARVELL_PHY_ID_88E1149R, | ||
| 813 | .phy_id_mask = MARVELL_PHY_ID_MASK, | ||
| 814 | .name = "Marvell 88E1149R", | ||
| 815 | .features = PHY_GBIT_FEATURES, | ||
| 816 | .flags = PHY_HAS_INTERRUPT, | ||
| 817 | .config_init = &m88e1149_config_init, | ||
| 818 | .config_aneg = &m88e1118_config_aneg, | ||
| 819 | .read_status = &genphy_read_status, | ||
| 820 | .ack_interrupt = &marvell_ack_interrupt, | ||
| 821 | .config_intr = &marvell_config_intr, | ||
| 822 | .driver = { .owner = THIS_MODULE }, | ||
| 823 | }, | ||
| 824 | { | ||
| 688 | .phy_id = MARVELL_PHY_ID_88E1240, | 825 | .phy_id = MARVELL_PHY_ID_88E1240, |
| 689 | .phy_id_mask = MARVELL_PHY_ID_MASK, | 826 | .phy_id_mask = MARVELL_PHY_ID_MASK, |
| 690 | .name = "Marvell 88E1240", | 827 | .name = "Marvell 88E1240", |
| @@ -735,6 +872,7 @@ static struct mdio_device_id __maybe_unused marvell_tbl[] = { | |||
| 735 | { 0x01410e10, 0xfffffff0 }, | 872 | { 0x01410e10, 0xfffffff0 }, |
| 736 | { 0x01410cb0, 0xfffffff0 }, | 873 | { 0x01410cb0, 0xfffffff0 }, |
| 737 | { 0x01410cd0, 0xfffffff0 }, | 874 | { 0x01410cd0, 0xfffffff0 }, |
| 875 | { 0x01410e50, 0xfffffff0 }, | ||
| 738 | { 0x01410e30, 0xfffffff0 }, | 876 | { 0x01410e30, 0xfffffff0 }, |
| 739 | { 0x01410e90, 0xfffffff0 }, | 877 | { 0x01410e90, 0xfffffff0 }, |
| 740 | { } | 878 | { } |
diff --git a/drivers/net/qlge/qlge_main.c b/drivers/net/qlge/qlge_main.c index c30e0fe55a31..528eaef5308f 100644 --- a/drivers/net/qlge/qlge_main.c +++ b/drivers/net/qlge/qlge_main.c | |||
| @@ -62,15 +62,15 @@ static const u32 default_msg = | |||
| 62 | /* NETIF_MSG_PKTDATA | */ | 62 | /* NETIF_MSG_PKTDATA | */ |
| 63 | NETIF_MSG_HW | NETIF_MSG_WOL | 0; | 63 | NETIF_MSG_HW | NETIF_MSG_WOL | 0; |
| 64 | 64 | ||
| 65 | static int debug = 0x00007fff; /* defaults above */ | 65 | static int debug = -1; /* defaults above */ |
| 66 | module_param(debug, int, 0); | 66 | module_param(debug, int, 0664); |
| 67 | MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)"); | 67 | MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)"); |
| 68 | 68 | ||
| 69 | #define MSIX_IRQ 0 | 69 | #define MSIX_IRQ 0 |
| 70 | #define MSI_IRQ 1 | 70 | #define MSI_IRQ 1 |
| 71 | #define LEG_IRQ 2 | 71 | #define LEG_IRQ 2 |
| 72 | static int qlge_irq_type = MSIX_IRQ; | 72 | static int qlge_irq_type = MSIX_IRQ; |
| 73 | module_param(qlge_irq_type, int, MSIX_IRQ); | 73 | module_param(qlge_irq_type, int, 0664); |
| 74 | MODULE_PARM_DESC(qlge_irq_type, "0 = MSI-X, 1 = MSI, 2 = Legacy."); | 74 | MODULE_PARM_DESC(qlge_irq_type, "0 = MSI-X, 1 = MSI, 2 = Legacy."); |
| 75 | 75 | ||
| 76 | static int qlge_mpi_coredump; | 76 | static int qlge_mpi_coredump; |
diff --git a/drivers/usb/atm/ueagle-atm.c b/drivers/usb/atm/ueagle-atm.c index ea071a5b6eee..44447f54942f 100644 --- a/drivers/usb/atm/ueagle-atm.c +++ b/drivers/usb/atm/ueagle-atm.c | |||
| @@ -2301,7 +2301,7 @@ out: | |||
| 2301 | return ret; | 2301 | return ret; |
| 2302 | } | 2302 | } |
| 2303 | 2303 | ||
| 2304 | static DEVICE_ATTR(stat_status, S_IWUGO | S_IRUGO, read_status, reboot); | 2304 | static DEVICE_ATTR(stat_status, S_IWUSR | S_IRUGO, read_status, reboot); |
| 2305 | 2305 | ||
| 2306 | static ssize_t read_human_status(struct device *dev, | 2306 | static ssize_t read_human_status(struct device *dev, |
| 2307 | struct device_attribute *attr, char *buf) | 2307 | struct device_attribute *attr, char *buf) |
| @@ -2364,8 +2364,7 @@ out: | |||
| 2364 | return ret; | 2364 | return ret; |
| 2365 | } | 2365 | } |
| 2366 | 2366 | ||
| 2367 | static DEVICE_ATTR(stat_human_status, S_IWUGO | S_IRUGO, | 2367 | static DEVICE_ATTR(stat_human_status, S_IRUGO, read_human_status, NULL); |
| 2368 | read_human_status, NULL); | ||
| 2369 | 2368 | ||
| 2370 | static ssize_t read_delin(struct device *dev, struct device_attribute *attr, | 2369 | static ssize_t read_delin(struct device *dev, struct device_attribute *attr, |
| 2371 | char *buf) | 2370 | char *buf) |
| @@ -2397,7 +2396,7 @@ out: | |||
| 2397 | return ret; | 2396 | return ret; |
| 2398 | } | 2397 | } |
| 2399 | 2398 | ||
| 2400 | static DEVICE_ATTR(stat_delin, S_IWUGO | S_IRUGO, read_delin, NULL); | 2399 | static DEVICE_ATTR(stat_delin, S_IRUGO, read_delin, NULL); |
| 2401 | 2400 | ||
| 2402 | #define UEA_ATTR(name, reset) \ | 2401 | #define UEA_ATTR(name, reset) \ |
| 2403 | \ | 2402 | \ |
diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c index b5e20e873cba..717ff653fa23 100644 --- a/drivers/usb/gadget/atmel_usba_udc.c +++ b/drivers/usb/gadget/atmel_usba_udc.c | |||
| @@ -2017,7 +2017,7 @@ static int __init usba_udc_probe(struct platform_device *pdev) | |||
| 2017 | } | 2017 | } |
| 2018 | } else { | 2018 | } else { |
| 2019 | /* gpio_request fail so use -EINVAL for gpio_is_valid */ | 2019 | /* gpio_request fail so use -EINVAL for gpio_is_valid */ |
| 2020 | ubc->vbus_pin = -EINVAL; | 2020 | udc->vbus_pin = -EINVAL; |
| 2021 | } | 2021 | } |
| 2022 | } | 2022 | } |
| 2023 | 2023 | ||
diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c index 86afdc73322f..6e2599661b5b 100644 --- a/drivers/usb/host/ehci-dbg.c +++ b/drivers/usb/host/ehci-dbg.c | |||
| @@ -1067,7 +1067,7 @@ static inline void create_debug_files (struct ehci_hcd *ehci) | |||
| 1067 | &debug_registers_fops)) | 1067 | &debug_registers_fops)) |
| 1068 | goto file_error; | 1068 | goto file_error; |
| 1069 | 1069 | ||
| 1070 | if (!debugfs_create_file("lpm", S_IRUGO|S_IWUGO, ehci->debug_dir, bus, | 1070 | if (!debugfs_create_file("lpm", S_IRUGO|S_IWUSR, ehci->debug_dir, bus, |
| 1071 | &debug_lpm_fops)) | 1071 | &debug_lpm_fops)) |
| 1072 | goto file_error; | 1072 | goto file_error; |
| 1073 | 1073 | ||
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 502a7e6fef42..e9062806d4a2 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
| @@ -1063,10 +1063,11 @@ rescan: | |||
| 1063 | tmp && tmp != qh; | 1063 | tmp && tmp != qh; |
| 1064 | tmp = tmp->qh_next.qh) | 1064 | tmp = tmp->qh_next.qh) |
| 1065 | continue; | 1065 | continue; |
| 1066 | /* periodic qh self-unlinks on empty */ | 1066 | /* periodic qh self-unlinks on empty, and a COMPLETING qh |
| 1067 | if (!tmp) | 1067 | * may already be unlinked. |
| 1068 | goto nogood; | 1068 | */ |
| 1069 | unlink_async (ehci, qh); | 1069 | if (tmp) |
| 1070 | unlink_async(ehci, qh); | ||
| 1070 | /* FALL THROUGH */ | 1071 | /* FALL THROUGH */ |
| 1071 | case QH_STATE_UNLINK: /* wait for hw to finish? */ | 1072 | case QH_STATE_UNLINK: /* wait for hw to finish? */ |
| 1072 | case QH_STATE_UNLINK_WAIT: | 1073 | case QH_STATE_UNLINK_WAIT: |
| @@ -1083,7 +1084,6 @@ idle_timeout: | |||
| 1083 | } | 1084 | } |
| 1084 | /* else FALL THROUGH */ | 1085 | /* else FALL THROUGH */ |
| 1085 | default: | 1086 | default: |
| 1086 | nogood: | ||
| 1087 | /* caller was supposed to have unlinked any requests; | 1087 | /* caller was supposed to have unlinked any requests; |
| 1088 | * that's not our job. just leak this memory. | 1088 | * that's not our job. just leak this memory. |
| 1089 | */ | 1089 | */ |
diff --git a/drivers/usb/host/ehci-mem.c b/drivers/usb/host/ehci-mem.c index d36e4e75e08d..12f70c302b0b 100644 --- a/drivers/usb/host/ehci-mem.c +++ b/drivers/usb/host/ehci-mem.c | |||
| @@ -141,6 +141,10 @@ static void ehci_mem_cleanup (struct ehci_hcd *ehci) | |||
| 141 | qh_put (ehci->async); | 141 | qh_put (ehci->async); |
| 142 | ehci->async = NULL; | 142 | ehci->async = NULL; |
| 143 | 143 | ||
| 144 | if (ehci->dummy) | ||
| 145 | qh_put(ehci->dummy); | ||
| 146 | ehci->dummy = NULL; | ||
| 147 | |||
| 144 | /* DMA consistent memory and pools */ | 148 | /* DMA consistent memory and pools */ |
| 145 | if (ehci->qtd_pool) | 149 | if (ehci->qtd_pool) |
| 146 | dma_pool_destroy (ehci->qtd_pool); | 150 | dma_pool_destroy (ehci->qtd_pool); |
| @@ -227,8 +231,26 @@ static int ehci_mem_init (struct ehci_hcd *ehci, gfp_t flags) | |||
| 227 | if (ehci->periodic == NULL) { | 231 | if (ehci->periodic == NULL) { |
| 228 | goto fail; | 232 | goto fail; |
| 229 | } | 233 | } |
| 230 | for (i = 0; i < ehci->periodic_size; i++) | 234 | |
| 231 | ehci->periodic [i] = EHCI_LIST_END(ehci); | 235 | if (ehci->use_dummy_qh) { |
| 236 | struct ehci_qh_hw *hw; | ||
| 237 | ehci->dummy = ehci_qh_alloc(ehci, flags); | ||
| 238 | if (!ehci->dummy) | ||
| 239 | goto fail; | ||
| 240 | |||
| 241 | hw = ehci->dummy->hw; | ||
| 242 | hw->hw_next = EHCI_LIST_END(ehci); | ||
| 243 | hw->hw_qtd_next = EHCI_LIST_END(ehci); | ||
| 244 | hw->hw_alt_next = EHCI_LIST_END(ehci); | ||
| 245 | hw->hw_token &= ~QTD_STS_ACTIVE; | ||
| 246 | ehci->dummy->hw = hw; | ||
| 247 | |||
| 248 | for (i = 0; i < ehci->periodic_size; i++) | ||
| 249 | ehci->periodic[i] = ehci->dummy->qh_dma; | ||
| 250 | } else { | ||
| 251 | for (i = 0; i < ehci->periodic_size; i++) | ||
| 252 | ehci->periodic[i] = EHCI_LIST_END(ehci); | ||
| 253 | } | ||
| 232 | 254 | ||
| 233 | /* software shadow of hardware table */ | 255 | /* software shadow of hardware table */ |
| 234 | ehci->pshadow = kcalloc(ehci->periodic_size, sizeof(void *), flags); | 256 | ehci->pshadow = kcalloc(ehci->periodic_size, sizeof(void *), flags); |
diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c index a1e8d273103f..01bb72b71832 100644 --- a/drivers/usb/host/ehci-pci.c +++ b/drivers/usb/host/ehci-pci.c | |||
| @@ -103,6 +103,19 @@ static int ehci_pci_setup(struct usb_hcd *hcd) | |||
| 103 | if (retval) | 103 | if (retval) |
| 104 | return retval; | 104 | return retval; |
| 105 | 105 | ||
| 106 | if ((pdev->vendor == PCI_VENDOR_ID_AMD && pdev->device == 0x7808) || | ||
| 107 | (pdev->vendor == PCI_VENDOR_ID_ATI && pdev->device == 0x4396)) { | ||
| 108 | /* EHCI controller on AMD SB700/SB800/Hudson-2/3 platforms may | ||
| 109 | * read/write memory space which does not belong to it when | ||
| 110 | * there is NULL pointer with T-bit set to 1 in the frame list | ||
| 111 | * table. To avoid the issue, the frame list link pointer | ||
| 112 | * should always contain a valid pointer to a inactive qh. | ||
| 113 | */ | ||
| 114 | ehci->use_dummy_qh = 1; | ||
| 115 | ehci_info(ehci, "applying AMD SB700/SB800/Hudson-2/3 EHCI " | ||
| 116 | "dummy qh workaround\n"); | ||
| 117 | } | ||
| 118 | |||
| 106 | /* data structure init */ | 119 | /* data structure init */ |
| 107 | retval = ehci_init(hcd); | 120 | retval = ehci_init(hcd); |
| 108 | if (retval) | 121 | if (retval) |
diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c index a92526d6e5ae..d9f78eb26572 100644 --- a/drivers/usb/host/ehci-sched.c +++ b/drivers/usb/host/ehci-sched.c | |||
| @@ -98,7 +98,14 @@ static void periodic_unlink (struct ehci_hcd *ehci, unsigned frame, void *ptr) | |||
| 98 | */ | 98 | */ |
| 99 | *prev_p = *periodic_next_shadow(ehci, &here, | 99 | *prev_p = *periodic_next_shadow(ehci, &here, |
| 100 | Q_NEXT_TYPE(ehci, *hw_p)); | 100 | Q_NEXT_TYPE(ehci, *hw_p)); |
| 101 | *hw_p = *shadow_next_periodic(ehci, &here, Q_NEXT_TYPE(ehci, *hw_p)); | 101 | |
| 102 | if (!ehci->use_dummy_qh || | ||
| 103 | *shadow_next_periodic(ehci, &here, Q_NEXT_TYPE(ehci, *hw_p)) | ||
| 104 | != EHCI_LIST_END(ehci)) | ||
| 105 | *hw_p = *shadow_next_periodic(ehci, &here, | ||
| 106 | Q_NEXT_TYPE(ehci, *hw_p)); | ||
| 107 | else | ||
| 108 | *hw_p = ehci->dummy->qh_dma; | ||
| 102 | } | 109 | } |
| 103 | 110 | ||
| 104 | /* how many of the uframe's 125 usecs are allocated? */ | 111 | /* how many of the uframe's 125 usecs are allocated? */ |
| @@ -2335,7 +2342,11 @@ restart: | |||
| 2335 | * pointer for much longer, if at all. | 2342 | * pointer for much longer, if at all. |
| 2336 | */ | 2343 | */ |
| 2337 | *q_p = q.itd->itd_next; | 2344 | *q_p = q.itd->itd_next; |
| 2338 | *hw_p = q.itd->hw_next; | 2345 | if (!ehci->use_dummy_qh || |
| 2346 | q.itd->hw_next != EHCI_LIST_END(ehci)) | ||
| 2347 | *hw_p = q.itd->hw_next; | ||
| 2348 | else | ||
| 2349 | *hw_p = ehci->dummy->qh_dma; | ||
| 2339 | type = Q_NEXT_TYPE(ehci, q.itd->hw_next); | 2350 | type = Q_NEXT_TYPE(ehci, q.itd->hw_next); |
| 2340 | wmb(); | 2351 | wmb(); |
| 2341 | modified = itd_complete (ehci, q.itd); | 2352 | modified = itd_complete (ehci, q.itd); |
| @@ -2368,7 +2379,11 @@ restart: | |||
| 2368 | * URB completion. | 2379 | * URB completion. |
| 2369 | */ | 2380 | */ |
| 2370 | *q_p = q.sitd->sitd_next; | 2381 | *q_p = q.sitd->sitd_next; |
| 2371 | *hw_p = q.sitd->hw_next; | 2382 | if (!ehci->use_dummy_qh || |
| 2383 | q.sitd->hw_next != EHCI_LIST_END(ehci)) | ||
| 2384 | *hw_p = q.sitd->hw_next; | ||
| 2385 | else | ||
| 2386 | *hw_p = ehci->dummy->qh_dma; | ||
| 2372 | type = Q_NEXT_TYPE(ehci, q.sitd->hw_next); | 2387 | type = Q_NEXT_TYPE(ehci, q.sitd->hw_next); |
| 2373 | wmb(); | 2388 | wmb(); |
| 2374 | modified = sitd_complete (ehci, q.sitd); | 2389 | modified = sitd_complete (ehci, q.sitd); |
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h index bde823f704e9..ba8eab366b82 100644 --- a/drivers/usb/host/ehci.h +++ b/drivers/usb/host/ehci.h | |||
| @@ -73,6 +73,7 @@ struct ehci_hcd { /* one per controller */ | |||
| 73 | 73 | ||
| 74 | /* async schedule support */ | 74 | /* async schedule support */ |
| 75 | struct ehci_qh *async; | 75 | struct ehci_qh *async; |
| 76 | struct ehci_qh *dummy; /* For AMD quirk use */ | ||
| 76 | struct ehci_qh *reclaim; | 77 | struct ehci_qh *reclaim; |
| 77 | unsigned scanning : 1; | 78 | unsigned scanning : 1; |
| 78 | 79 | ||
| @@ -131,6 +132,7 @@ struct ehci_hcd { /* one per controller */ | |||
| 131 | unsigned need_io_watchdog:1; | 132 | unsigned need_io_watchdog:1; |
| 132 | unsigned broken_periodic:1; | 133 | unsigned broken_periodic:1; |
| 133 | unsigned fs_i_thresh:1; /* Intel iso scheduling */ | 134 | unsigned fs_i_thresh:1; /* Intel iso scheduling */ |
| 135 | unsigned use_dummy_qh:1; /* AMD Frame List table quirk*/ | ||
| 134 | 136 | ||
| 135 | /* required for usb32 quirk */ | 137 | /* required for usb32 quirk */ |
| 136 | #define OHCI_CTRL_HCFS (3 << 6) | 138 | #define OHCI_CTRL_HCFS (3 << 6) |
diff --git a/drivers/usb/host/isp1362-hcd.c b/drivers/usb/host/isp1362-hcd.c index 6c4fb4efb4bb..43a39eb56cc6 100644 --- a/drivers/usb/host/isp1362-hcd.c +++ b/drivers/usb/host/isp1362-hcd.c | |||
| @@ -2683,7 +2683,7 @@ static int __devexit isp1362_remove(struct platform_device *pdev) | |||
| 2683 | return 0; | 2683 | return 0; |
| 2684 | } | 2684 | } |
| 2685 | 2685 | ||
| 2686 | static int __init isp1362_probe(struct platform_device *pdev) | 2686 | static int __devinit isp1362_probe(struct platform_device *pdev) |
| 2687 | { | 2687 | { |
| 2688 | struct usb_hcd *hcd; | 2688 | struct usb_hcd *hcd; |
| 2689 | struct isp1362_hcd *isp1362_hcd; | 2689 | struct isp1362_hcd *isp1362_hcd; |
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index 202770676da3..d178761c3981 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c | |||
| @@ -1045,7 +1045,7 @@ static inline u32 xhci_get_max_esit_payload(struct xhci_hcd *xhci, | |||
| 1045 | if (udev->speed == USB_SPEED_SUPER) | 1045 | if (udev->speed == USB_SPEED_SUPER) |
| 1046 | return ep->ss_ep_comp.wBytesPerInterval; | 1046 | return ep->ss_ep_comp.wBytesPerInterval; |
| 1047 | 1047 | ||
| 1048 | max_packet = ep->desc.wMaxPacketSize & 0x3ff; | 1048 | max_packet = GET_MAX_PACKET(ep->desc.wMaxPacketSize); |
| 1049 | max_burst = (ep->desc.wMaxPacketSize & 0x1800) >> 11; | 1049 | max_burst = (ep->desc.wMaxPacketSize & 0x1800) >> 11; |
| 1050 | /* A 0 in max burst means 1 transfer per ESIT */ | 1050 | /* A 0 in max burst means 1 transfer per ESIT */ |
| 1051 | return max_packet * (max_burst + 1); | 1051 | return max_packet * (max_burst + 1); |
| @@ -1135,7 +1135,7 @@ int xhci_endpoint_init(struct xhci_hcd *xhci, | |||
| 1135 | /* Fall through */ | 1135 | /* Fall through */ |
| 1136 | case USB_SPEED_FULL: | 1136 | case USB_SPEED_FULL: |
| 1137 | case USB_SPEED_LOW: | 1137 | case USB_SPEED_LOW: |
| 1138 | max_packet = ep->desc.wMaxPacketSize & 0x3ff; | 1138 | max_packet = GET_MAX_PACKET(ep->desc.wMaxPacketSize); |
| 1139 | ep_ctx->ep_info2 |= MAX_PACKET(max_packet); | 1139 | ep_ctx->ep_info2 |= MAX_PACKET(max_packet); |
| 1140 | break; | 1140 | break; |
| 1141 | default: | 1141 | default: |
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 9f3115e729b1..df558f6f84e3 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c | |||
| @@ -2104,7 +2104,6 @@ irqreturn_t xhci_irq(struct usb_hcd *hcd) | |||
| 2104 | 2104 | ||
| 2105 | if (!(status & STS_EINT)) { | 2105 | if (!(status & STS_EINT)) { |
| 2106 | spin_unlock(&xhci->lock); | 2106 | spin_unlock(&xhci->lock); |
| 2107 | xhci_warn(xhci, "Spurious interrupt.\n"); | ||
| 2108 | return IRQ_NONE; | 2107 | return IRQ_NONE; |
| 2109 | } | 2108 | } |
| 2110 | xhci_dbg(xhci, "op reg status = %08x\n", status); | 2109 | xhci_dbg(xhci, "op reg status = %08x\n", status); |
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 5d7d4e951ea4..06fca0835b52 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
| @@ -577,6 +577,65 @@ static void xhci_restore_registers(struct xhci_hcd *xhci) | |||
| 577 | xhci_write_64(xhci, xhci->s3.erst_base, &xhci->ir_set->erst_base); | 577 | xhci_write_64(xhci, xhci->s3.erst_base, &xhci->ir_set->erst_base); |
| 578 | } | 578 | } |
| 579 | 579 | ||
| 580 | static void xhci_set_cmd_ring_deq(struct xhci_hcd *xhci) | ||
| 581 | { | ||
| 582 | u64 val_64; | ||
| 583 | |||
| 584 | /* step 2: initialize command ring buffer */ | ||
| 585 | val_64 = xhci_read_64(xhci, &xhci->op_regs->cmd_ring); | ||
| 586 | val_64 = (val_64 & (u64) CMD_RING_RSVD_BITS) | | ||
| 587 | (xhci_trb_virt_to_dma(xhci->cmd_ring->deq_seg, | ||
| 588 | xhci->cmd_ring->dequeue) & | ||
| 589 | (u64) ~CMD_RING_RSVD_BITS) | | ||
| 590 | xhci->cmd_ring->cycle_state; | ||
| 591 | xhci_dbg(xhci, "// Setting command ring address to 0x%llx\n", | ||
| 592 | (long unsigned long) val_64); | ||
| 593 | xhci_write_64(xhci, val_64, &xhci->op_regs->cmd_ring); | ||
| 594 | } | ||
| 595 | |||
| 596 | /* | ||
| 597 | * The whole command ring must be cleared to zero when we suspend the host. | ||
| 598 | * | ||
| 599 | * The host doesn't save the command ring pointer in the suspend well, so we | ||
| 600 | * need to re-program it on resume. Unfortunately, the pointer must be 64-byte | ||
| 601 | * aligned, because of the reserved bits in the command ring dequeue pointer | ||
| 602 | * register. Therefore, we can't just set the dequeue pointer back in the | ||
| 603 | * middle of the ring (TRBs are 16-byte aligned). | ||
| 604 | */ | ||
| 605 | static void xhci_clear_command_ring(struct xhci_hcd *xhci) | ||
| 606 | { | ||
| 607 | struct xhci_ring *ring; | ||
| 608 | struct xhci_segment *seg; | ||
| 609 | |||
| 610 | ring = xhci->cmd_ring; | ||
| 611 | seg = ring->deq_seg; | ||
| 612 | do { | ||
| 613 | memset(seg->trbs, 0, SEGMENT_SIZE); | ||
| 614 | seg = seg->next; | ||
| 615 | } while (seg != ring->deq_seg); | ||
| 616 | |||
| 617 | /* Reset the software enqueue and dequeue pointers */ | ||
| 618 | ring->deq_seg = ring->first_seg; | ||
| 619 | ring->dequeue = ring->first_seg->trbs; | ||
| 620 | ring->enq_seg = ring->deq_seg; | ||
| 621 | ring->enqueue = ring->dequeue; | ||
| 622 | |||
| 623 | /* | ||
| 624 | * Ring is now zeroed, so the HW should look for change of ownership | ||
| 625 | * when the cycle bit is set to 1. | ||
| 626 | */ | ||
| 627 | ring->cycle_state = 1; | ||
| 628 | |||
| 629 | /* | ||
| 630 | * Reset the hardware dequeue pointer. | ||
| 631 | * Yes, this will need to be re-written after resume, but we're paranoid | ||
| 632 | * and want to make sure the hardware doesn't access bogus memory | ||
| 633 | * because, say, the BIOS or an SMI started the host without changing | ||
| 634 | * the command ring pointers. | ||
| 635 | */ | ||
| 636 | xhci_set_cmd_ring_deq(xhci); | ||
| 637 | } | ||
| 638 | |||
| 580 | /* | 639 | /* |
| 581 | * Stop HC (not bus-specific) | 640 | * Stop HC (not bus-specific) |
| 582 | * | 641 | * |
| @@ -604,6 +663,7 @@ int xhci_suspend(struct xhci_hcd *xhci) | |||
| 604 | spin_unlock_irq(&xhci->lock); | 663 | spin_unlock_irq(&xhci->lock); |
| 605 | return -ETIMEDOUT; | 664 | return -ETIMEDOUT; |
| 606 | } | 665 | } |
| 666 | xhci_clear_command_ring(xhci); | ||
| 607 | 667 | ||
| 608 | /* step 3: save registers */ | 668 | /* step 3: save registers */ |
| 609 | xhci_save_registers(xhci); | 669 | xhci_save_registers(xhci); |
| @@ -635,7 +695,6 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) | |||
| 635 | u32 command, temp = 0; | 695 | u32 command, temp = 0; |
| 636 | struct usb_hcd *hcd = xhci_to_hcd(xhci); | 696 | struct usb_hcd *hcd = xhci_to_hcd(xhci); |
| 637 | struct pci_dev *pdev = to_pci_dev(hcd->self.controller); | 697 | struct pci_dev *pdev = to_pci_dev(hcd->self.controller); |
| 638 | u64 val_64; | ||
| 639 | int old_state, retval; | 698 | int old_state, retval; |
| 640 | 699 | ||
| 641 | old_state = hcd->state; | 700 | old_state = hcd->state; |
| @@ -648,15 +707,7 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) | |||
| 648 | /* step 1: restore register */ | 707 | /* step 1: restore register */ |
| 649 | xhci_restore_registers(xhci); | 708 | xhci_restore_registers(xhci); |
| 650 | /* step 2: initialize command ring buffer */ | 709 | /* step 2: initialize command ring buffer */ |
| 651 | val_64 = xhci_read_64(xhci, &xhci->op_regs->cmd_ring); | 710 | xhci_set_cmd_ring_deq(xhci); |
| 652 | val_64 = (val_64 & (u64) CMD_RING_RSVD_BITS) | | ||
| 653 | (xhci_trb_virt_to_dma(xhci->cmd_ring->deq_seg, | ||
| 654 | xhci->cmd_ring->dequeue) & | ||
| 655 | (u64) ~CMD_RING_RSVD_BITS) | | ||
| 656 | xhci->cmd_ring->cycle_state; | ||
| 657 | xhci_dbg(xhci, "// Setting command ring address to 0x%llx\n", | ||
| 658 | (long unsigned long) val_64); | ||
| 659 | xhci_write_64(xhci, val_64, &xhci->op_regs->cmd_ring); | ||
| 660 | /* step 3: restore state and start state*/ | 711 | /* step 3: restore state and start state*/ |
| 661 | /* step 3: set CRS flag */ | 712 | /* step 3: set CRS flag */ |
| 662 | command = xhci_readl(xhci, &xhci->op_regs->command); | 713 | command = xhci_readl(xhci, &xhci->op_regs->command); |
| @@ -714,6 +765,7 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) | |||
| 714 | return retval; | 765 | return retval; |
| 715 | } | 766 | } |
| 716 | 767 | ||
| 768 | spin_unlock_irq(&xhci->lock); | ||
| 717 | /* Re-setup MSI-X */ | 769 | /* Re-setup MSI-X */ |
| 718 | if (hcd->irq) | 770 | if (hcd->irq) |
| 719 | free_irq(hcd->irq, hcd); | 771 | free_irq(hcd->irq, hcd); |
| @@ -736,6 +788,7 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) | |||
| 736 | hcd->irq = pdev->irq; | 788 | hcd->irq = pdev->irq; |
| 737 | } | 789 | } |
| 738 | 790 | ||
| 791 | spin_lock_irq(&xhci->lock); | ||
| 739 | /* step 4: set Run/Stop bit */ | 792 | /* step 4: set Run/Stop bit */ |
| 740 | command = xhci_readl(xhci, &xhci->op_regs->command); | 793 | command = xhci_readl(xhci, &xhci->op_regs->command); |
| 741 | command |= CMD_RUN; | 794 | command |= CMD_RUN; |
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index 93d3bf4d213c..85e65647d445 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h | |||
| @@ -621,6 +621,11 @@ struct xhci_ep_ctx { | |||
| 621 | #define MAX_PACKET_MASK (0xffff << 16) | 621 | #define MAX_PACKET_MASK (0xffff << 16) |
| 622 | #define MAX_PACKET_DECODED(p) (((p) >> 16) & 0xffff) | 622 | #define MAX_PACKET_DECODED(p) (((p) >> 16) & 0xffff) |
| 623 | 623 | ||
| 624 | /* Get max packet size from ep desc. Bit 10..0 specify the max packet size. | ||
| 625 | * USB2.0 spec 9.6.6. | ||
| 626 | */ | ||
| 627 | #define GET_MAX_PACKET(p) ((p) & 0x7ff) | ||
| 628 | |||
| 624 | /* tx_info bitmasks */ | 629 | /* tx_info bitmasks */ |
| 625 | #define AVG_TRB_LENGTH_FOR_EP(p) ((p) & 0xffff) | 630 | #define AVG_TRB_LENGTH_FOR_EP(p) ((p) & 0xffff) |
| 626 | #define MAX_ESIT_PAYLOAD_FOR_EP(p) (((p) & 0xffff) << 16) | 631 | #define MAX_ESIT_PAYLOAD_FOR_EP(p) (((p) & 0xffff) << 16) |
diff --git a/drivers/usb/misc/cypress_cy7c63.c b/drivers/usb/misc/cypress_cy7c63.c index 2f43c57743c9..9251773ecef4 100644 --- a/drivers/usb/misc/cypress_cy7c63.c +++ b/drivers/usb/misc/cypress_cy7c63.c | |||
| @@ -196,11 +196,9 @@ static ssize_t get_port1_handler(struct device *dev, | |||
| 196 | return read_port(dev, attr, buf, 1, CYPRESS_READ_PORT_ID1); | 196 | return read_port(dev, attr, buf, 1, CYPRESS_READ_PORT_ID1); |
| 197 | } | 197 | } |
| 198 | 198 | ||
| 199 | static DEVICE_ATTR(port0, S_IWUGO | S_IRUGO, | 199 | static DEVICE_ATTR(port0, S_IRUGO | S_IWUSR, get_port0_handler, set_port0_handler); |
| 200 | get_port0_handler, set_port0_handler); | ||
| 201 | 200 | ||
| 202 | static DEVICE_ATTR(port1, S_IWUGO | S_IRUGO, | 201 | static DEVICE_ATTR(port1, S_IRUGO | S_IWUSR, get_port1_handler, set_port1_handler); |
| 203 | get_port1_handler, set_port1_handler); | ||
| 204 | 202 | ||
| 205 | 203 | ||
| 206 | static int cypress_probe(struct usb_interface *interface, | 204 | static int cypress_probe(struct usb_interface *interface, |
diff --git a/drivers/usb/misc/trancevibrator.c b/drivers/usb/misc/trancevibrator.c index d77aba46ae85..f63776a48e2a 100644 --- a/drivers/usb/misc/trancevibrator.c +++ b/drivers/usb/misc/trancevibrator.c | |||
| @@ -86,7 +86,7 @@ static ssize_t set_speed(struct device *dev, struct device_attribute *attr, | |||
| 86 | return count; | 86 | return count; |
| 87 | } | 87 | } |
| 88 | 88 | ||
| 89 | static DEVICE_ATTR(speed, S_IWUGO | S_IRUGO, show_speed, set_speed); | 89 | static DEVICE_ATTR(speed, S_IRUGO | S_IWUSR, show_speed, set_speed); |
| 90 | 90 | ||
| 91 | static int tv_probe(struct usb_interface *interface, | 91 | static int tv_probe(struct usb_interface *interface, |
| 92 | const struct usb_device_id *id) | 92 | const struct usb_device_id *id) |
diff --git a/drivers/usb/misc/usbled.c b/drivers/usb/misc/usbled.c index 63da2c3c838f..c96f51de1696 100644 --- a/drivers/usb/misc/usbled.c +++ b/drivers/usb/misc/usbled.c | |||
| @@ -94,7 +94,7 @@ static ssize_t set_##value(struct device *dev, struct device_attribute *attr, co | |||
| 94 | change_color(led); \ | 94 | change_color(led); \ |
| 95 | return count; \ | 95 | return count; \ |
| 96 | } \ | 96 | } \ |
| 97 | static DEVICE_ATTR(value, S_IWUGO | S_IRUGO, show_##value, set_##value); | 97 | static DEVICE_ATTR(value, S_IRUGO | S_IWUSR, show_##value, set_##value); |
| 98 | show_set(blue); | 98 | show_set(blue); |
| 99 | show_set(red); | 99 | show_set(red); |
| 100 | show_set(green); | 100 | show_set(green); |
diff --git a/drivers/usb/misc/usbsevseg.c b/drivers/usb/misc/usbsevseg.c index de8ef945b536..417b8f207e8b 100644 --- a/drivers/usb/misc/usbsevseg.c +++ b/drivers/usb/misc/usbsevseg.c | |||
| @@ -192,7 +192,7 @@ static ssize_t set_attr_##name(struct device *dev, \ | |||
| 192 | \ | 192 | \ |
| 193 | return count; \ | 193 | return count; \ |
| 194 | } \ | 194 | } \ |
| 195 | static DEVICE_ATTR(name, S_IWUGO | S_IRUGO, show_attr_##name, set_attr_##name); | 195 | static DEVICE_ATTR(name, S_IRUGO | S_IWUSR, show_attr_##name, set_attr_##name); |
| 196 | 196 | ||
| 197 | static ssize_t show_attr_text(struct device *dev, | 197 | static ssize_t show_attr_text(struct device *dev, |
| 198 | struct device_attribute *attr, char *buf) | 198 | struct device_attribute *attr, char *buf) |
| @@ -223,7 +223,7 @@ static ssize_t set_attr_text(struct device *dev, | |||
| 223 | return count; | 223 | return count; |
| 224 | } | 224 | } |
| 225 | 225 | ||
| 226 | static DEVICE_ATTR(text, S_IWUGO | S_IRUGO, show_attr_text, set_attr_text); | 226 | static DEVICE_ATTR(text, S_IRUGO | S_IWUSR, show_attr_text, set_attr_text); |
| 227 | 227 | ||
| 228 | static ssize_t show_attr_decimals(struct device *dev, | 228 | static ssize_t show_attr_decimals(struct device *dev, |
| 229 | struct device_attribute *attr, char *buf) | 229 | struct device_attribute *attr, char *buf) |
| @@ -272,8 +272,7 @@ static ssize_t set_attr_decimals(struct device *dev, | |||
| 272 | return count; | 272 | return count; |
| 273 | } | 273 | } |
| 274 | 274 | ||
| 275 | static DEVICE_ATTR(decimals, S_IWUGO | S_IRUGO, | 275 | static DEVICE_ATTR(decimals, S_IRUGO | S_IWUSR, show_attr_decimals, set_attr_decimals); |
| 276 | show_attr_decimals, set_attr_decimals); | ||
| 277 | 276 | ||
| 278 | static ssize_t show_attr_textmode(struct device *dev, | 277 | static ssize_t show_attr_textmode(struct device *dev, |
| 279 | struct device_attribute *attr, char *buf) | 278 | struct device_attribute *attr, char *buf) |
| @@ -319,8 +318,7 @@ static ssize_t set_attr_textmode(struct device *dev, | |||
| 319 | return -EINVAL; | 318 | return -EINVAL; |
| 320 | } | 319 | } |
| 321 | 320 | ||
| 322 | static DEVICE_ATTR(textmode, S_IWUGO | S_IRUGO, | 321 | static DEVICE_ATTR(textmode, S_IRUGO | S_IWUSR, show_attr_textmode, set_attr_textmode); |
| 323 | show_attr_textmode, set_attr_textmode); | ||
| 324 | 322 | ||
| 325 | 323 | ||
| 326 | MYDEV_ATTR_SIMPLE_UNSIGNED(powered, update_display_powered); | 324 | MYDEV_ATTR_SIMPLE_UNSIGNED(powered, update_display_powered); |
diff --git a/drivers/usb/otg/langwell_otg.c b/drivers/usb/otg/langwell_otg.c index bdc3ea66be69..9fea48264fa2 100644 --- a/drivers/usb/otg/langwell_otg.c +++ b/drivers/usb/otg/langwell_otg.c | |||
| @@ -1896,7 +1896,7 @@ set_a_bus_req(struct device *dev, struct device_attribute *attr, | |||
| 1896 | } | 1896 | } |
| 1897 | return count; | 1897 | return count; |
| 1898 | } | 1898 | } |
| 1899 | static DEVICE_ATTR(a_bus_req, S_IRUGO | S_IWUGO, get_a_bus_req, set_a_bus_req); | 1899 | static DEVICE_ATTR(a_bus_req, S_IRUGO | S_IWUSR, get_a_bus_req, set_a_bus_req); |
| 1900 | 1900 | ||
| 1901 | static ssize_t | 1901 | static ssize_t |
| 1902 | get_a_bus_drop(struct device *dev, struct device_attribute *attr, char *buf) | 1902 | get_a_bus_drop(struct device *dev, struct device_attribute *attr, char *buf) |
| @@ -1942,8 +1942,7 @@ set_a_bus_drop(struct device *dev, struct device_attribute *attr, | |||
| 1942 | } | 1942 | } |
| 1943 | return count; | 1943 | return count; |
| 1944 | } | 1944 | } |
| 1945 | static DEVICE_ATTR(a_bus_drop, S_IRUGO | S_IWUGO, | 1945 | static DEVICE_ATTR(a_bus_drop, S_IRUGO | S_IWUSR, get_a_bus_drop, set_a_bus_drop); |
| 1946 | get_a_bus_drop, set_a_bus_drop); | ||
| 1947 | 1946 | ||
| 1948 | static ssize_t | 1947 | static ssize_t |
| 1949 | get_b_bus_req(struct device *dev, struct device_attribute *attr, char *buf) | 1948 | get_b_bus_req(struct device *dev, struct device_attribute *attr, char *buf) |
| @@ -1988,7 +1987,7 @@ set_b_bus_req(struct device *dev, struct device_attribute *attr, | |||
| 1988 | } | 1987 | } |
| 1989 | return count; | 1988 | return count; |
| 1990 | } | 1989 | } |
| 1991 | static DEVICE_ATTR(b_bus_req, S_IRUGO | S_IWUGO, get_b_bus_req, set_b_bus_req); | 1990 | static DEVICE_ATTR(b_bus_req, S_IRUGO | S_IWUSR, get_b_bus_req, set_b_bus_req); |
| 1992 | 1991 | ||
| 1993 | static ssize_t | 1992 | static ssize_t |
| 1994 | set_a_clr_err(struct device *dev, struct device_attribute *attr, | 1993 | set_a_clr_err(struct device *dev, struct device_attribute *attr, |
| @@ -2012,7 +2011,7 @@ set_a_clr_err(struct device *dev, struct device_attribute *attr, | |||
| 2012 | } | 2011 | } |
| 2013 | return count; | 2012 | return count; |
| 2014 | } | 2013 | } |
| 2015 | static DEVICE_ATTR(a_clr_err, S_IWUGO, NULL, set_a_clr_err); | 2014 | static DEVICE_ATTR(a_clr_err, S_IWUSR, NULL, set_a_clr_err); |
| 2016 | 2015 | ||
| 2017 | static struct attribute *inputs_attrs[] = { | 2016 | static struct attribute *inputs_attrs[] = { |
| 2018 | &dev_attr_a_bus_req.attr, | 2017 | &dev_attr_a_bus_req.attr, |
diff --git a/drivers/usb/storage/sierra_ms.c b/drivers/usb/storage/sierra_ms.c index 57fc2f532cab..ceba512f84d0 100644 --- a/drivers/usb/storage/sierra_ms.c +++ b/drivers/usb/storage/sierra_ms.c | |||
| @@ -121,7 +121,7 @@ static ssize_t show_truinst(struct device *dev, struct device_attribute *attr, | |||
| 121 | } | 121 | } |
| 122 | return result; | 122 | return result; |
| 123 | } | 123 | } |
| 124 | static DEVICE_ATTR(truinst, S_IWUGO | S_IRUGO, show_truinst, NULL); | 124 | static DEVICE_ATTR(truinst, S_IRUGO, show_truinst, NULL); |
| 125 | 125 | ||
| 126 | int sierra_ms_init(struct us_data *us) | 126 | int sierra_ms_init(struct us_data *us) |
| 127 | { | 127 | { |
diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c index e207810bba3c..08703299ef61 100644 --- a/drivers/video/backlight/backlight.c +++ b/drivers/video/backlight/backlight.c | |||
| @@ -197,12 +197,12 @@ static int backlight_suspend(struct device *dev, pm_message_t state) | |||
| 197 | { | 197 | { |
| 198 | struct backlight_device *bd = to_backlight_device(dev); | 198 | struct backlight_device *bd = to_backlight_device(dev); |
| 199 | 199 | ||
| 200 | if (bd->ops->options & BL_CORE_SUSPENDRESUME) { | 200 | mutex_lock(&bd->ops_lock); |
| 201 | mutex_lock(&bd->ops_lock); | 201 | if (bd->ops && bd->ops->options & BL_CORE_SUSPENDRESUME) { |
| 202 | bd->props.state |= BL_CORE_SUSPENDED; | 202 | bd->props.state |= BL_CORE_SUSPENDED; |
| 203 | backlight_update_status(bd); | 203 | backlight_update_status(bd); |
| 204 | mutex_unlock(&bd->ops_lock); | ||
| 205 | } | 204 | } |
| 205 | mutex_unlock(&bd->ops_lock); | ||
| 206 | 206 | ||
| 207 | return 0; | 207 | return 0; |
| 208 | } | 208 | } |
| @@ -211,12 +211,12 @@ static int backlight_resume(struct device *dev) | |||
| 211 | { | 211 | { |
| 212 | struct backlight_device *bd = to_backlight_device(dev); | 212 | struct backlight_device *bd = to_backlight_device(dev); |
| 213 | 213 | ||
| 214 | if (bd->ops->options & BL_CORE_SUSPENDRESUME) { | 214 | mutex_lock(&bd->ops_lock); |
| 215 | mutex_lock(&bd->ops_lock); | 215 | if (bd->ops && bd->ops->options & BL_CORE_SUSPENDRESUME) { |
| 216 | bd->props.state &= ~BL_CORE_SUSPENDED; | 216 | bd->props.state &= ~BL_CORE_SUSPENDED; |
| 217 | backlight_update_status(bd); | 217 | backlight_update_status(bd); |
| 218 | mutex_unlock(&bd->ops_lock); | ||
| 219 | } | 218 | } |
| 219 | mutex_unlock(&bd->ops_lock); | ||
| 220 | 220 | ||
| 221 | return 0; | 221 | return 0; |
| 222 | } | 222 | } |
diff --git a/drivers/xen/Makefile b/drivers/xen/Makefile index eb8a78d77d9d..533a199e7a3f 100644 --- a/drivers/xen/Makefile +++ b/drivers/xen/Makefile | |||
| @@ -8,9 +8,12 @@ obj-$(CONFIG_BLOCK) += biomerge.o | |||
| 8 | obj-$(CONFIG_HOTPLUG_CPU) += cpu_hotplug.o | 8 | obj-$(CONFIG_HOTPLUG_CPU) += cpu_hotplug.o |
| 9 | obj-$(CONFIG_XEN_XENCOMM) += xencomm.o | 9 | obj-$(CONFIG_XEN_XENCOMM) += xencomm.o |
| 10 | obj-$(CONFIG_XEN_BALLOON) += balloon.o | 10 | obj-$(CONFIG_XEN_BALLOON) += balloon.o |
| 11 | obj-$(CONFIG_XEN_DEV_EVTCHN) += evtchn.o | 11 | obj-$(CONFIG_XEN_DEV_EVTCHN) += xen-evtchn.o |
| 12 | obj-$(CONFIG_XENFS) += xenfs/ | 12 | obj-$(CONFIG_XENFS) += xenfs/ |
| 13 | obj-$(CONFIG_XEN_SYS_HYPERVISOR) += sys-hypervisor.o | 13 | obj-$(CONFIG_XEN_SYS_HYPERVISOR) += sys-hypervisor.o |
| 14 | obj-$(CONFIG_XEN_PLATFORM_PCI) += platform-pci.o | 14 | obj-$(CONFIG_XEN_PLATFORM_PCI) += platform-pci.o |
| 15 | obj-$(CONFIG_SWIOTLB_XEN) += swiotlb-xen.o | 15 | obj-$(CONFIG_SWIOTLB_XEN) += swiotlb-xen.o |
| 16 | obj-$(CONFIG_XEN_DOM0) += pci.o | 16 | obj-$(CONFIG_XEN_DOM0) += pci.o |
| 17 | |||
| 18 | xen-evtchn-y := evtchn.o | ||
| 19 | |||
diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c index 500290b150bb..2b17ad5b4b32 100644 --- a/drivers/xen/balloon.c +++ b/drivers/xen/balloon.c | |||
| @@ -50,6 +50,7 @@ | |||
| 50 | #include <asm/pgtable.h> | 50 | #include <asm/pgtable.h> |
| 51 | #include <asm/uaccess.h> | 51 | #include <asm/uaccess.h> |
| 52 | #include <asm/tlb.h> | 52 | #include <asm/tlb.h> |
| 53 | #include <asm/e820.h> | ||
| 53 | 54 | ||
| 54 | #include <asm/xen/hypervisor.h> | 55 | #include <asm/xen/hypervisor.h> |
| 55 | #include <asm/xen/hypercall.h> | 56 | #include <asm/xen/hypercall.h> |
| @@ -119,7 +120,7 @@ static void scrub_page(struct page *page) | |||
| 119 | } | 120 | } |
| 120 | 121 | ||
| 121 | /* balloon_append: add the given page to the balloon. */ | 122 | /* balloon_append: add the given page to the balloon. */ |
| 122 | static void balloon_append(struct page *page) | 123 | static void __balloon_append(struct page *page) |
| 123 | { | 124 | { |
| 124 | /* Lowmem is re-populated first, so highmem pages go at list tail. */ | 125 | /* Lowmem is re-populated first, so highmem pages go at list tail. */ |
| 125 | if (PageHighMem(page)) { | 126 | if (PageHighMem(page)) { |
| @@ -130,7 +131,11 @@ static void balloon_append(struct page *page) | |||
| 130 | list_add(&page->lru, &ballooned_pages); | 131 | list_add(&page->lru, &ballooned_pages); |
| 131 | balloon_stats.balloon_low++; | 132 | balloon_stats.balloon_low++; |
| 132 | } | 133 | } |
| 134 | } | ||
| 133 | 135 | ||
| 136 | static void balloon_append(struct page *page) | ||
| 137 | { | ||
| 138 | __balloon_append(page); | ||
| 134 | totalram_pages--; | 139 | totalram_pages--; |
| 135 | } | 140 | } |
| 136 | 141 | ||
| @@ -191,7 +196,7 @@ static unsigned long current_target(void) | |||
| 191 | 196 | ||
| 192 | static int increase_reservation(unsigned long nr_pages) | 197 | static int increase_reservation(unsigned long nr_pages) |
| 193 | { | 198 | { |
| 194 | unsigned long pfn, i, flags; | 199 | unsigned long pfn, i; |
| 195 | struct page *page; | 200 | struct page *page; |
| 196 | long rc; | 201 | long rc; |
| 197 | struct xen_memory_reservation reservation = { | 202 | struct xen_memory_reservation reservation = { |
| @@ -203,8 +208,6 @@ static int increase_reservation(unsigned long nr_pages) | |||
| 203 | if (nr_pages > ARRAY_SIZE(frame_list)) | 208 | if (nr_pages > ARRAY_SIZE(frame_list)) |
| 204 | nr_pages = ARRAY_SIZE(frame_list); | 209 | nr_pages = ARRAY_SIZE(frame_list); |
| 205 | 210 | ||
| 206 | spin_lock_irqsave(&xen_reservation_lock, flags); | ||
| 207 | |||
| 208 | page = balloon_first_page(); | 211 | page = balloon_first_page(); |
| 209 | for (i = 0; i < nr_pages; i++) { | 212 | for (i = 0; i < nr_pages; i++) { |
| 210 | BUG_ON(page == NULL); | 213 | BUG_ON(page == NULL); |
| @@ -247,14 +250,12 @@ static int increase_reservation(unsigned long nr_pages) | |||
| 247 | balloon_stats.current_pages += rc; | 250 | balloon_stats.current_pages += rc; |
| 248 | 251 | ||
| 249 | out: | 252 | out: |
| 250 | spin_unlock_irqrestore(&xen_reservation_lock, flags); | ||
| 251 | |||
| 252 | return rc < 0 ? rc : rc != nr_pages; | 253 | return rc < 0 ? rc : rc != nr_pages; |
| 253 | } | 254 | } |
| 254 | 255 | ||
| 255 | static int decrease_reservation(unsigned long nr_pages) | 256 | static int decrease_reservation(unsigned long nr_pages) |
| 256 | { | 257 | { |
| 257 | unsigned long pfn, i, flags; | 258 | unsigned long pfn, i; |
| 258 | struct page *page; | 259 | struct page *page; |
| 259 | int need_sleep = 0; | 260 | int need_sleep = 0; |
| 260 | int ret; | 261 | int ret; |
| @@ -292,8 +293,6 @@ static int decrease_reservation(unsigned long nr_pages) | |||
| 292 | kmap_flush_unused(); | 293 | kmap_flush_unused(); |
| 293 | flush_tlb_all(); | 294 | flush_tlb_all(); |
| 294 | 295 | ||
| 295 | spin_lock_irqsave(&xen_reservation_lock, flags); | ||
| 296 | |||
| 297 | /* No more mappings: invalidate P2M and add to balloon. */ | 296 | /* No more mappings: invalidate P2M and add to balloon. */ |
| 298 | for (i = 0; i < nr_pages; i++) { | 297 | for (i = 0; i < nr_pages; i++) { |
| 299 | pfn = mfn_to_pfn(frame_list[i]); | 298 | pfn = mfn_to_pfn(frame_list[i]); |
| @@ -308,8 +307,6 @@ static int decrease_reservation(unsigned long nr_pages) | |||
| 308 | 307 | ||
| 309 | balloon_stats.current_pages -= nr_pages; | 308 | balloon_stats.current_pages -= nr_pages; |
| 310 | 309 | ||
| 311 | spin_unlock_irqrestore(&xen_reservation_lock, flags); | ||
| 312 | |||
| 313 | return need_sleep; | 310 | return need_sleep; |
| 314 | } | 311 | } |
| 315 | 312 | ||
| @@ -395,7 +392,7 @@ static struct notifier_block xenstore_notifier; | |||
| 395 | 392 | ||
| 396 | static int __init balloon_init(void) | 393 | static int __init balloon_init(void) |
| 397 | { | 394 | { |
| 398 | unsigned long pfn; | 395 | unsigned long pfn, extra_pfn_end; |
| 399 | struct page *page; | 396 | struct page *page; |
| 400 | 397 | ||
| 401 | if (!xen_pv_domain()) | 398 | if (!xen_pv_domain()) |
| @@ -416,10 +413,15 @@ static int __init balloon_init(void) | |||
| 416 | register_balloon(&balloon_sysdev); | 413 | register_balloon(&balloon_sysdev); |
| 417 | 414 | ||
| 418 | /* Initialise the balloon with excess memory space. */ | 415 | /* Initialise the balloon with excess memory space. */ |
| 419 | for (pfn = xen_start_info->nr_pages; pfn < max_pfn; pfn++) { | 416 | extra_pfn_end = min(e820_end_of_ram_pfn(), |
| 417 | (unsigned long)PFN_DOWN(xen_extra_mem_start + xen_extra_mem_size)); | ||
| 418 | for (pfn = PFN_UP(xen_extra_mem_start); | ||
| 419 | pfn < extra_pfn_end; | ||
| 420 | pfn++) { | ||
| 420 | page = pfn_to_page(pfn); | 421 | page = pfn_to_page(pfn); |
| 421 | if (!PageReserved(page)) | 422 | /* totalram_pages doesn't include the boot-time |
| 422 | balloon_append(page); | 423 | balloon extension, so don't subtract from it. */ |
| 424 | __balloon_append(page); | ||
| 423 | } | 425 | } |
| 424 | 426 | ||
| 425 | target_watch.callback = watch_target; | 427 | target_watch.callback = watch_target; |
diff --git a/drivers/xen/events.c b/drivers/xen/events.c index 321a0c8346e5..2811bb988ea0 100644 --- a/drivers/xen/events.c +++ b/drivers/xen/events.c | |||
| @@ -278,17 +278,17 @@ static void bind_evtchn_to_cpu(unsigned int chn, unsigned int cpu) | |||
| 278 | cpumask_copy(irq_to_desc(irq)->affinity, cpumask_of(cpu)); | 278 | cpumask_copy(irq_to_desc(irq)->affinity, cpumask_of(cpu)); |
| 279 | #endif | 279 | #endif |
| 280 | 280 | ||
| 281 | __clear_bit(chn, cpu_evtchn_mask(cpu_from_irq(irq))); | 281 | clear_bit(chn, cpu_evtchn_mask(cpu_from_irq(irq))); |
| 282 | __set_bit(chn, cpu_evtchn_mask(cpu)); | 282 | set_bit(chn, cpu_evtchn_mask(cpu)); |
| 283 | 283 | ||
| 284 | irq_info[irq].cpu = cpu; | 284 | irq_info[irq].cpu = cpu; |
| 285 | } | 285 | } |
| 286 | 286 | ||
| 287 | static void init_evtchn_cpu_bindings(void) | 287 | static void init_evtchn_cpu_bindings(void) |
| 288 | { | 288 | { |
| 289 | int i; | ||
| 289 | #ifdef CONFIG_SMP | 290 | #ifdef CONFIG_SMP |
| 290 | struct irq_desc *desc; | 291 | struct irq_desc *desc; |
| 291 | int i; | ||
| 292 | 292 | ||
| 293 | /* By default all event channels notify CPU#0. */ | 293 | /* By default all event channels notify CPU#0. */ |
| 294 | for_each_irq_desc(i, desc) { | 294 | for_each_irq_desc(i, desc) { |
| @@ -296,7 +296,10 @@ static void init_evtchn_cpu_bindings(void) | |||
| 296 | } | 296 | } |
| 297 | #endif | 297 | #endif |
| 298 | 298 | ||
| 299 | memset(cpu_evtchn_mask(0), ~0, sizeof(struct cpu_evtchn_s)); | 299 | for_each_possible_cpu(i) |
| 300 | memset(cpu_evtchn_mask(i), | ||
| 301 | (i == 0) ? ~0 : 0, sizeof(struct cpu_evtchn_s)); | ||
| 302 | |||
| 300 | } | 303 | } |
| 301 | 304 | ||
| 302 | static inline void clear_evtchn(int port) | 305 | static inline void clear_evtchn(int port) |
| @@ -752,7 +755,7 @@ int xen_destroy_irq(int irq) | |||
| 752 | goto out; | 755 | goto out; |
| 753 | 756 | ||
| 754 | if (xen_initial_domain()) { | 757 | if (xen_initial_domain()) { |
| 755 | unmap_irq.pirq = info->u.pirq.gsi; | 758 | unmap_irq.pirq = info->u.pirq.pirq; |
| 756 | unmap_irq.domid = DOMID_SELF; | 759 | unmap_irq.domid = DOMID_SELF; |
| 757 | rc = HYPERVISOR_physdev_op(PHYSDEVOP_unmap_pirq, &unmap_irq); | 760 | rc = HYPERVISOR_physdev_op(PHYSDEVOP_unmap_pirq, &unmap_irq); |
| 758 | if (rc) { | 761 | if (rc) { |
diff --git a/drivers/xen/evtchn.c b/drivers/xen/evtchn.c index fec6ba3c08a8..ef11daf0cafe 100644 --- a/drivers/xen/evtchn.c +++ b/drivers/xen/evtchn.c | |||
| @@ -69,20 +69,51 @@ struct per_user_data { | |||
| 69 | const char *name; | 69 | const char *name; |
| 70 | }; | 70 | }; |
| 71 | 71 | ||
| 72 | /* Who's bound to each port? */ | 72 | /* |
| 73 | static struct per_user_data *port_user[NR_EVENT_CHANNELS]; | 73 | * Who's bound to each port? This is logically an array of struct |
| 74 | * per_user_data *, but we encode the current enabled-state in bit 0. | ||
| 75 | */ | ||
| 76 | static unsigned long *port_user; | ||
| 74 | static DEFINE_SPINLOCK(port_user_lock); /* protects port_user[] and ring_prod */ | 77 | static DEFINE_SPINLOCK(port_user_lock); /* protects port_user[] and ring_prod */ |
| 75 | 78 | ||
| 76 | irqreturn_t evtchn_interrupt(int irq, void *data) | 79 | static inline struct per_user_data *get_port_user(unsigned port) |
| 80 | { | ||
| 81 | return (struct per_user_data *)(port_user[port] & ~1); | ||
| 82 | } | ||
| 83 | |||
| 84 | static inline void set_port_user(unsigned port, struct per_user_data *u) | ||
| 85 | { | ||
| 86 | port_user[port] = (unsigned long)u; | ||
| 87 | } | ||
| 88 | |||
| 89 | static inline bool get_port_enabled(unsigned port) | ||
| 90 | { | ||
| 91 | return port_user[port] & 1; | ||
| 92 | } | ||
| 93 | |||
| 94 | static inline void set_port_enabled(unsigned port, bool enabled) | ||
| 95 | { | ||
| 96 | if (enabled) | ||
| 97 | port_user[port] |= 1; | ||
| 98 | else | ||
| 99 | port_user[port] &= ~1; | ||
| 100 | } | ||
| 101 | |||
| 102 | static irqreturn_t evtchn_interrupt(int irq, void *data) | ||
| 77 | { | 103 | { |
| 78 | unsigned int port = (unsigned long)data; | 104 | unsigned int port = (unsigned long)data; |
| 79 | struct per_user_data *u; | 105 | struct per_user_data *u; |
| 80 | 106 | ||
| 81 | spin_lock(&port_user_lock); | 107 | spin_lock(&port_user_lock); |
| 82 | 108 | ||
| 83 | u = port_user[port]; | 109 | u = get_port_user(port); |
| 110 | |||
| 111 | WARN(!get_port_enabled(port), | ||
| 112 | "Interrupt for port %d, but apparently not enabled; per-user %p\n", | ||
| 113 | port, u); | ||
| 84 | 114 | ||
| 85 | disable_irq_nosync(irq); | 115 | disable_irq_nosync(irq); |
| 116 | set_port_enabled(port, false); | ||
| 86 | 117 | ||
| 87 | if ((u->ring_prod - u->ring_cons) < EVTCHN_RING_SIZE) { | 118 | if ((u->ring_prod - u->ring_cons) < EVTCHN_RING_SIZE) { |
| 88 | u->ring[EVTCHN_RING_MASK(u->ring_prod)] = port; | 119 | u->ring[EVTCHN_RING_MASK(u->ring_prod)] = port; |
| @@ -92,9 +123,8 @@ irqreturn_t evtchn_interrupt(int irq, void *data) | |||
| 92 | kill_fasync(&u->evtchn_async_queue, | 123 | kill_fasync(&u->evtchn_async_queue, |
| 93 | SIGIO, POLL_IN); | 124 | SIGIO, POLL_IN); |
| 94 | } | 125 | } |
| 95 | } else { | 126 | } else |
| 96 | u->ring_overflow = 1; | 127 | u->ring_overflow = 1; |
| 97 | } | ||
| 98 | 128 | ||
| 99 | spin_unlock(&port_user_lock); | 129 | spin_unlock(&port_user_lock); |
| 100 | 130 | ||
| @@ -198,9 +228,18 @@ static ssize_t evtchn_write(struct file *file, const char __user *buf, | |||
| 198 | goto out; | 228 | goto out; |
| 199 | 229 | ||
| 200 | spin_lock_irq(&port_user_lock); | 230 | spin_lock_irq(&port_user_lock); |
| 201 | for (i = 0; i < (count/sizeof(evtchn_port_t)); i++) | 231 | |
| 202 | if ((kbuf[i] < NR_EVENT_CHANNELS) && (port_user[kbuf[i]] == u)) | 232 | for (i = 0; i < (count/sizeof(evtchn_port_t)); i++) { |
| 203 | enable_irq(irq_from_evtchn(kbuf[i])); | 233 | unsigned port = kbuf[i]; |
| 234 | |||
| 235 | if (port < NR_EVENT_CHANNELS && | ||
| 236 | get_port_user(port) == u && | ||
| 237 | !get_port_enabled(port)) { | ||
| 238 | set_port_enabled(port, true); | ||
| 239 | enable_irq(irq_from_evtchn(port)); | ||
| 240 | } | ||
| 241 | } | ||
| 242 | |||
| 204 | spin_unlock_irq(&port_user_lock); | 243 | spin_unlock_irq(&port_user_lock); |
| 205 | 244 | ||
| 206 | rc = count; | 245 | rc = count; |
| @@ -222,8 +261,9 @@ static int evtchn_bind_to_user(struct per_user_data *u, int port) | |||
| 222 | * interrupt handler yet, and our caller has already | 261 | * interrupt handler yet, and our caller has already |
| 223 | * serialized bind operations.) | 262 | * serialized bind operations.) |
| 224 | */ | 263 | */ |
| 225 | BUG_ON(port_user[port] != NULL); | 264 | BUG_ON(get_port_user(port) != NULL); |
| 226 | port_user[port] = u; | 265 | set_port_user(port, u); |
| 266 | set_port_enabled(port, true); /* start enabled */ | ||
| 227 | 267 | ||
| 228 | rc = bind_evtchn_to_irqhandler(port, evtchn_interrupt, IRQF_DISABLED, | 268 | rc = bind_evtchn_to_irqhandler(port, evtchn_interrupt, IRQF_DISABLED, |
| 229 | u->name, (void *)(unsigned long)port); | 269 | u->name, (void *)(unsigned long)port); |
| @@ -239,10 +279,7 @@ static void evtchn_unbind_from_user(struct per_user_data *u, int port) | |||
| 239 | 279 | ||
| 240 | unbind_from_irqhandler(irq, (void *)(unsigned long)port); | 280 | unbind_from_irqhandler(irq, (void *)(unsigned long)port); |
| 241 | 281 | ||
| 242 | /* make sure we unbind the irq handler before clearing the port */ | 282 | set_port_user(port, NULL); |
| 243 | barrier(); | ||
| 244 | |||
| 245 | port_user[port] = NULL; | ||
| 246 | } | 283 | } |
| 247 | 284 | ||
| 248 | static long evtchn_ioctl(struct file *file, | 285 | static long evtchn_ioctl(struct file *file, |
| @@ -333,15 +370,17 @@ static long evtchn_ioctl(struct file *file, | |||
| 333 | spin_lock_irq(&port_user_lock); | 370 | spin_lock_irq(&port_user_lock); |
| 334 | 371 | ||
| 335 | rc = -ENOTCONN; | 372 | rc = -ENOTCONN; |
| 336 | if (port_user[unbind.port] != u) { | 373 | if (get_port_user(unbind.port) != u) { |
| 337 | spin_unlock_irq(&port_user_lock); | 374 | spin_unlock_irq(&port_user_lock); |
| 338 | break; | 375 | break; |
| 339 | } | 376 | } |
| 340 | 377 | ||
| 341 | evtchn_unbind_from_user(u, unbind.port); | 378 | disable_irq(irq_from_evtchn(unbind.port)); |
| 342 | 379 | ||
| 343 | spin_unlock_irq(&port_user_lock); | 380 | spin_unlock_irq(&port_user_lock); |
| 344 | 381 | ||
| 382 | evtchn_unbind_from_user(u, unbind.port); | ||
| 383 | |||
| 345 | rc = 0; | 384 | rc = 0; |
| 346 | break; | 385 | break; |
| 347 | } | 386 | } |
| @@ -355,7 +394,7 @@ static long evtchn_ioctl(struct file *file, | |||
| 355 | 394 | ||
| 356 | if (notify.port >= NR_EVENT_CHANNELS) { | 395 | if (notify.port >= NR_EVENT_CHANNELS) { |
| 357 | rc = -EINVAL; | 396 | rc = -EINVAL; |
| 358 | } else if (port_user[notify.port] != u) { | 397 | } else if (get_port_user(notify.port) != u) { |
| 359 | rc = -ENOTCONN; | 398 | rc = -ENOTCONN; |
| 360 | } else { | 399 | } else { |
| 361 | notify_remote_via_evtchn(notify.port); | 400 | notify_remote_via_evtchn(notify.port); |
| @@ -431,7 +470,7 @@ static int evtchn_open(struct inode *inode, struct file *filp) | |||
| 431 | 470 | ||
| 432 | filp->private_data = u; | 471 | filp->private_data = u; |
| 433 | 472 | ||
| 434 | return 0; | 473 | return nonseekable_open(inode, filp);; |
| 435 | } | 474 | } |
| 436 | 475 | ||
| 437 | static int evtchn_release(struct inode *inode, struct file *filp) | 476 | static int evtchn_release(struct inode *inode, struct file *filp) |
| @@ -444,14 +483,21 @@ static int evtchn_release(struct inode *inode, struct file *filp) | |||
| 444 | free_page((unsigned long)u->ring); | 483 | free_page((unsigned long)u->ring); |
| 445 | 484 | ||
| 446 | for (i = 0; i < NR_EVENT_CHANNELS; i++) { | 485 | for (i = 0; i < NR_EVENT_CHANNELS; i++) { |
| 447 | if (port_user[i] != u) | 486 | if (get_port_user(i) != u) |
| 448 | continue; | 487 | continue; |
| 449 | 488 | ||
| 450 | evtchn_unbind_from_user(port_user[i], i); | 489 | disable_irq(irq_from_evtchn(i)); |
| 451 | } | 490 | } |
| 452 | 491 | ||
| 453 | spin_unlock_irq(&port_user_lock); | 492 | spin_unlock_irq(&port_user_lock); |
| 454 | 493 | ||
| 494 | for (i = 0; i < NR_EVENT_CHANNELS; i++) { | ||
| 495 | if (get_port_user(i) != u) | ||
| 496 | continue; | ||
| 497 | |||
| 498 | evtchn_unbind_from_user(get_port_user(i), i); | ||
| 499 | } | ||
| 500 | |||
| 455 | kfree(u->name); | 501 | kfree(u->name); |
| 456 | kfree(u); | 502 | kfree(u); |
| 457 | 503 | ||
| @@ -467,12 +513,12 @@ static const struct file_operations evtchn_fops = { | |||
| 467 | .fasync = evtchn_fasync, | 513 | .fasync = evtchn_fasync, |
| 468 | .open = evtchn_open, | 514 | .open = evtchn_open, |
| 469 | .release = evtchn_release, | 515 | .release = evtchn_release, |
| 470 | .llseek = noop_llseek, | 516 | .llseek = no_llseek, |
| 471 | }; | 517 | }; |
| 472 | 518 | ||
| 473 | static struct miscdevice evtchn_miscdev = { | 519 | static struct miscdevice evtchn_miscdev = { |
| 474 | .minor = MISC_DYNAMIC_MINOR, | 520 | .minor = MISC_DYNAMIC_MINOR, |
| 475 | .name = "evtchn", | 521 | .name = "xen/evtchn", |
| 476 | .fops = &evtchn_fops, | 522 | .fops = &evtchn_fops, |
| 477 | }; | 523 | }; |
| 478 | static int __init evtchn_init(void) | 524 | static int __init evtchn_init(void) |
| @@ -482,8 +528,11 @@ static int __init evtchn_init(void) | |||
| 482 | if (!xen_domain()) | 528 | if (!xen_domain()) |
| 483 | return -ENODEV; | 529 | return -ENODEV; |
| 484 | 530 | ||
| 531 | port_user = kcalloc(NR_EVENT_CHANNELS, sizeof(*port_user), GFP_KERNEL); | ||
| 532 | if (port_user == NULL) | ||
| 533 | return -ENOMEM; | ||
| 534 | |||
| 485 | spin_lock_init(&port_user_lock); | 535 | spin_lock_init(&port_user_lock); |
| 486 | memset(port_user, 0, sizeof(port_user)); | ||
| 487 | 536 | ||
| 488 | /* Create '/dev/misc/evtchn'. */ | 537 | /* Create '/dev/misc/evtchn'. */ |
| 489 | err = misc_register(&evtchn_miscdev); | 538 | err = misc_register(&evtchn_miscdev); |
| @@ -499,6 +548,9 @@ static int __init evtchn_init(void) | |||
| 499 | 548 | ||
| 500 | static void __exit evtchn_cleanup(void) | 549 | static void __exit evtchn_cleanup(void) |
| 501 | { | 550 | { |
| 551 | kfree(port_user); | ||
| 552 | port_user = NULL; | ||
| 553 | |||
| 502 | misc_deregister(&evtchn_miscdev); | 554 | misc_deregister(&evtchn_miscdev); |
| 503 | } | 555 | } |
| 504 | 556 | ||
diff --git a/drivers/xen/xenfs/privcmd.c b/drivers/xen/xenfs/privcmd.c index 0f5d4162b22d..dbd3b16fd131 100644 --- a/drivers/xen/xenfs/privcmd.c +++ b/drivers/xen/xenfs/privcmd.c | |||
| @@ -265,9 +265,7 @@ static int mmap_return_errors(void *data, void *state) | |||
| 265 | xen_pfn_t *mfnp = data; | 265 | xen_pfn_t *mfnp = data; |
| 266 | struct mmap_batch_state *st = state; | 266 | struct mmap_batch_state *st = state; |
| 267 | 267 | ||
| 268 | put_user(*mfnp, st->user++); | 268 | return put_user(*mfnp, st->user++); |
| 269 | |||
| 270 | return 0; | ||
| 271 | } | 269 | } |
| 272 | 270 | ||
| 273 | static struct vm_operations_struct privcmd_vm_ops; | 271 | static struct vm_operations_struct privcmd_vm_ops; |
| @@ -322,10 +320,8 @@ static long privcmd_ioctl_mmap_batch(void __user *udata) | |||
| 322 | up_write(&mm->mmap_sem); | 320 | up_write(&mm->mmap_sem); |
| 323 | 321 | ||
| 324 | if (state.err > 0) { | 322 | if (state.err > 0) { |
| 325 | ret = 0; | ||
| 326 | |||
| 327 | state.user = m.arr; | 323 | state.user = m.arr; |
| 328 | traverse_pages(m.num, sizeof(xen_pfn_t), | 324 | ret = traverse_pages(m.num, sizeof(xen_pfn_t), |
| 329 | &pagelist, | 325 | &pagelist, |
| 330 | mmap_return_errors, &state); | 326 | mmap_return_errors, &state); |
| 331 | } | 327 | } |
| @@ -383,8 +379,9 @@ static int privcmd_mmap(struct file *file, struct vm_area_struct *vma) | |||
| 383 | if (xen_feature(XENFEAT_auto_translated_physmap)) | 379 | if (xen_feature(XENFEAT_auto_translated_physmap)) |
| 384 | return -ENOSYS; | 380 | return -ENOSYS; |
| 385 | 381 | ||
| 386 | /* DONTCOPY is essential for Xen as copy_page_range is broken. */ | 382 | /* DONTCOPY is essential for Xen because copy_page_range doesn't know |
| 387 | vma->vm_flags |= VM_RESERVED | VM_IO | VM_DONTCOPY; | 383 | * how to recreate these mappings */ |
| 384 | vma->vm_flags |= VM_RESERVED | VM_IO | VM_DONTCOPY | VM_PFNMAP; | ||
| 388 | vma->vm_ops = &privcmd_vm_ops; | 385 | vma->vm_ops = &privcmd_vm_ops; |
| 389 | vma->vm_private_data = NULL; | 386 | vma->vm_private_data = NULL; |
| 390 | 387 | ||
diff --git a/drivers/xen/xenfs/super.c b/drivers/xen/xenfs/super.c index f6339d11d59c..1aa389719846 100644 --- a/drivers/xen/xenfs/super.c +++ b/drivers/xen/xenfs/super.c | |||
| @@ -12,8 +12,6 @@ | |||
| 12 | #include <linux/module.h> | 12 | #include <linux/module.h> |
| 13 | #include <linux/fs.h> | 13 | #include <linux/fs.h> |
| 14 | #include <linux/magic.h> | 14 | #include <linux/magic.h> |
| 15 | #include <linux/mm.h> | ||
| 16 | #include <linux/backing-dev.h> | ||
| 17 | 15 | ||
| 18 | #include <xen/xen.h> | 16 | #include <xen/xen.h> |
| 19 | 17 | ||
| @@ -24,28 +22,12 @@ | |||
| 24 | MODULE_DESCRIPTION("Xen filesystem"); | 22 | MODULE_DESCRIPTION("Xen filesystem"); |
| 25 | MODULE_LICENSE("GPL"); | 23 | MODULE_LICENSE("GPL"); |
| 26 | 24 | ||
| 27 | static int xenfs_set_page_dirty(struct page *page) | ||
| 28 | { | ||
| 29 | return !TestSetPageDirty(page); | ||
| 30 | } | ||
| 31 | |||
| 32 | static const struct address_space_operations xenfs_aops = { | ||
| 33 | .set_page_dirty = xenfs_set_page_dirty, | ||
| 34 | }; | ||
| 35 | |||
| 36 | static struct backing_dev_info xenfs_backing_dev_info = { | ||
| 37 | .ra_pages = 0, /* No readahead */ | ||
| 38 | .capabilities = BDI_CAP_NO_ACCT_AND_WRITEBACK, | ||
| 39 | }; | ||
| 40 | |||
| 41 | static struct inode *xenfs_make_inode(struct super_block *sb, int mode) | 25 | static struct inode *xenfs_make_inode(struct super_block *sb, int mode) |
| 42 | { | 26 | { |
| 43 | struct inode *ret = new_inode(sb); | 27 | struct inode *ret = new_inode(sb); |
| 44 | 28 | ||
| 45 | if (ret) { | 29 | if (ret) { |
| 46 | ret->i_mode = mode; | 30 | ret->i_mode = mode; |
| 47 | ret->i_mapping->a_ops = &xenfs_aops; | ||
| 48 | ret->i_mapping->backing_dev_info = &xenfs_backing_dev_info; | ||
| 49 | ret->i_uid = ret->i_gid = 0; | 31 | ret->i_uid = ret->i_gid = 0; |
| 50 | ret->i_blocks = 0; | 32 | ret->i_blocks = 0; |
| 51 | ret->i_atime = ret->i_mtime = ret->i_ctime = CURRENT_TIME; | 33 | ret->i_atime = ret->i_mtime = ret->i_ctime = CURRENT_TIME; |
| @@ -121,9 +103,9 @@ static int xenfs_fill_super(struct super_block *sb, void *data, int silent) | |||
| 121 | return rc; | 103 | return rc; |
| 122 | } | 104 | } |
| 123 | 105 | ||
| 124 | static int xenfs_mount(struct file_system_type *fs_type, | 106 | static struct dentry *xenfs_mount(struct file_system_type *fs_type, |
| 125 | int flags, const char *dev_name, | 107 | int flags, const char *dev_name, |
| 126 | void *data) | 108 | void *data) |
| 127 | { | 109 | { |
| 128 | return mount_single(fs_type, flags, data, xenfs_fill_super); | 110 | return mount_single(fs_type, flags, data, xenfs_fill_super); |
| 129 | } | 111 | } |
| @@ -137,25 +119,11 @@ static struct file_system_type xenfs_type = { | |||
| 137 | 119 | ||
| 138 | static int __init xenfs_init(void) | 120 | static int __init xenfs_init(void) |
| 139 | { | 121 | { |
| 140 | int err; | 122 | if (xen_domain()) |
| 141 | if (!xen_domain()) { | 123 | return register_filesystem(&xenfs_type); |
| 142 | printk(KERN_INFO "xenfs: not registering filesystem on non-xen platform\n"); | ||
| 143 | return 0; | ||
| 144 | } | ||
| 145 | |||
| 146 | err = register_filesystem(&xenfs_type); | ||
| 147 | if (err) { | ||
| 148 | printk(KERN_ERR "xenfs: Unable to register filesystem!\n"); | ||
| 149 | goto out; | ||
| 150 | } | ||
| 151 | |||
| 152 | err = bdi_init(&xenfs_backing_dev_info); | ||
| 153 | if (err) | ||
| 154 | unregister_filesystem(&xenfs_type); | ||
| 155 | |||
| 156 | out: | ||
| 157 | 124 | ||
| 158 | return err; | 125 | printk(KERN_INFO "XENFS: not registering filesystem on non-xen platform\n"); |
| 126 | return 0; | ||
| 159 | } | 127 | } |
| 160 | 128 | ||
| 161 | static void __exit xenfs_exit(void) | 129 | static void __exit xenfs_exit(void) |
diff --git a/fs/fuse/file.c b/fs/fuse/file.c index c8224587123f..9242d294fe90 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c | |||
| @@ -134,6 +134,7 @@ EXPORT_SYMBOL_GPL(fuse_do_open); | |||
| 134 | void fuse_finish_open(struct inode *inode, struct file *file) | 134 | void fuse_finish_open(struct inode *inode, struct file *file) |
| 135 | { | 135 | { |
| 136 | struct fuse_file *ff = file->private_data; | 136 | struct fuse_file *ff = file->private_data; |
| 137 | struct fuse_conn *fc = get_fuse_conn(inode); | ||
| 137 | 138 | ||
| 138 | if (ff->open_flags & FOPEN_DIRECT_IO) | 139 | if (ff->open_flags & FOPEN_DIRECT_IO) |
| 139 | file->f_op = &fuse_direct_io_file_operations; | 140 | file->f_op = &fuse_direct_io_file_operations; |
| @@ -141,6 +142,15 @@ void fuse_finish_open(struct inode *inode, struct file *file) | |||
| 141 | invalidate_inode_pages2(inode->i_mapping); | 142 | invalidate_inode_pages2(inode->i_mapping); |
| 142 | if (ff->open_flags & FOPEN_NONSEEKABLE) | 143 | if (ff->open_flags & FOPEN_NONSEEKABLE) |
| 143 | nonseekable_open(inode, file); | 144 | nonseekable_open(inode, file); |
| 145 | if (fc->atomic_o_trunc && (file->f_flags & O_TRUNC)) { | ||
| 146 | struct fuse_inode *fi = get_fuse_inode(inode); | ||
| 147 | |||
| 148 | spin_lock(&fc->lock); | ||
| 149 | fi->attr_version = ++fc->attr_version; | ||
| 150 | i_size_write(inode, 0); | ||
| 151 | spin_unlock(&fc->lock); | ||
| 152 | fuse_invalidate_attr(inode); | ||
| 153 | } | ||
| 144 | } | 154 | } |
| 145 | 155 | ||
| 146 | int fuse_open_common(struct inode *inode, struct file *file, bool isdir) | 156 | int fuse_open_common(struct inode *inode, struct file *file, bool isdir) |
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index da6b01d70f01..c126c83b9a45 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c | |||
| @@ -706,6 +706,7 @@ static int pagemap_hugetlb_range(pte_t *pte, unsigned long hmask, | |||
| 706 | * skip over unmapped regions. | 706 | * skip over unmapped regions. |
| 707 | */ | 707 | */ |
| 708 | #define PAGEMAP_WALK_SIZE (PMD_SIZE) | 708 | #define PAGEMAP_WALK_SIZE (PMD_SIZE) |
| 709 | #define PAGEMAP_WALK_MASK (PMD_MASK) | ||
| 709 | static ssize_t pagemap_read(struct file *file, char __user *buf, | 710 | static ssize_t pagemap_read(struct file *file, char __user *buf, |
| 710 | size_t count, loff_t *ppos) | 711 | size_t count, loff_t *ppos) |
| 711 | { | 712 | { |
| @@ -776,7 +777,7 @@ static ssize_t pagemap_read(struct file *file, char __user *buf, | |||
| 776 | unsigned long end; | 777 | unsigned long end; |
| 777 | 778 | ||
| 778 | pm.pos = 0; | 779 | pm.pos = 0; |
| 779 | end = start_vaddr + PAGEMAP_WALK_SIZE; | 780 | end = (start_vaddr + PAGEMAP_WALK_SIZE) & PAGEMAP_WALK_MASK; |
| 780 | /* overflow ? */ | 781 | /* overflow ? */ |
| 781 | if (end < start_vaddr || end > end_vaddr) | 782 | if (end < start_vaddr || end > end_vaddr) |
| 782 | end = end_vaddr; | 783 | end = end_vaddr; |
diff --git a/fs/reiserfs/ioctl.c b/fs/reiserfs/ioctl.c index bd9763e76bae..79265fdc317a 100644 --- a/fs/reiserfs/ioctl.c +++ b/fs/reiserfs/ioctl.c | |||
| @@ -183,12 +183,11 @@ int reiserfs_unpack(struct inode *inode, struct file *filp) | |||
| 183 | return 0; | 183 | return 0; |
| 184 | } | 184 | } |
| 185 | 185 | ||
| 186 | /* we need to make sure nobody is changing the file size beneath | ||
| 187 | ** us | ||
| 188 | */ | ||
| 189 | reiserfs_mutex_lock_safe(&inode->i_mutex, inode->i_sb); | ||
| 190 | depth = reiserfs_write_lock_once(inode->i_sb); | 186 | depth = reiserfs_write_lock_once(inode->i_sb); |
| 191 | 187 | ||
| 188 | /* we need to make sure nobody is changing the file size beneath us */ | ||
| 189 | reiserfs_mutex_lock_safe(&inode->i_mutex, inode->i_sb); | ||
| 190 | |||
| 192 | write_from = inode->i_size & (blocksize - 1); | 191 | write_from = inode->i_size & (blocksize - 1); |
| 193 | /* if we are on a block boundary, we are already unpacked. */ | 192 | /* if we are on a block boundary, we are already unpacked. */ |
| 194 | if (write_from == 0) { | 193 | if (write_from == 0) { |
diff --git a/include/linux/fs.h b/include/linux/fs.h index eedc00b7b1ee..c9e06cc70dad 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
| @@ -34,9 +34,9 @@ | |||
| 34 | #define SEEK_MAX SEEK_END | 34 | #define SEEK_MAX SEEK_END |
| 35 | 35 | ||
| 36 | struct fstrim_range { | 36 | struct fstrim_range { |
| 37 | uint64_t start; | 37 | __u64 start; |
| 38 | uint64_t len; | 38 | __u64 len; |
| 39 | uint64_t minlen; | 39 | __u64 minlen; |
| 40 | }; | 40 | }; |
| 41 | 41 | ||
| 42 | /* And dynamically-tunable limits and defaults: */ | 42 | /* And dynamically-tunable limits and defaults: */ |
diff --git a/include/linux/marvell_phy.h b/include/linux/marvell_phy.h index 1ff81b51b656..dd3c34ebca9a 100644 --- a/include/linux/marvell_phy.h +++ b/include/linux/marvell_phy.h | |||
| @@ -11,6 +11,7 @@ | |||
| 11 | #define MARVELL_PHY_ID_88E1118 0x01410e10 | 11 | #define MARVELL_PHY_ID_88E1118 0x01410e10 |
| 12 | #define MARVELL_PHY_ID_88E1121R 0x01410cb0 | 12 | #define MARVELL_PHY_ID_88E1121R 0x01410cb0 |
| 13 | #define MARVELL_PHY_ID_88E1145 0x01410cd0 | 13 | #define MARVELL_PHY_ID_88E1145 0x01410cd0 |
| 14 | #define MARVELL_PHY_ID_88E1149R 0x01410e50 | ||
| 14 | #define MARVELL_PHY_ID_88E1240 0x01410e30 | 15 | #define MARVELL_PHY_ID_88E1240 0x01410e30 |
| 15 | #define MARVELL_PHY_ID_88E1318S 0x01410e90 | 16 | #define MARVELL_PHY_ID_88E1318S 0x01410e90 |
| 16 | 17 | ||
diff --git a/include/linux/mfd/wm8350/audio.h b/include/linux/mfd/wm8350/audio.h index a95141eafce3..bd581c6fa085 100644 --- a/include/linux/mfd/wm8350/audio.h +++ b/include/linux/mfd/wm8350/audio.h | |||
| @@ -522,9 +522,6 @@ | |||
| 522 | #define WM8350_MCLK_SEL_PLL_32K 3 | 522 | #define WM8350_MCLK_SEL_PLL_32K 3 |
| 523 | #define WM8350_MCLK_SEL_MCLK 5 | 523 | #define WM8350_MCLK_SEL_MCLK 5 |
| 524 | 524 | ||
| 525 | #define WM8350_MCLK_DIR_OUT 0 | ||
| 526 | #define WM8350_MCLK_DIR_IN 1 | ||
| 527 | |||
| 528 | /* clock divider id's */ | 525 | /* clock divider id's */ |
| 529 | #define WM8350_ADC_CLKDIV 0 | 526 | #define WM8350_ADC_CLKDIV 0 |
| 530 | #define WM8350_DAC_CLKDIV 1 | 527 | #define WM8350_DAC_CLKDIV 1 |
diff --git a/include/linux/page_cgroup.h b/include/linux/page_cgroup.h index 5bb13b3db84d..b02195dfc1b0 100644 --- a/include/linux/page_cgroup.h +++ b/include/linux/page_cgroup.h | |||
| @@ -59,8 +59,6 @@ static inline void ClearPageCgroup##uname(struct page_cgroup *pc) \ | |||
| 59 | static inline int TestClearPageCgroup##uname(struct page_cgroup *pc) \ | 59 | static inline int TestClearPageCgroup##uname(struct page_cgroup *pc) \ |
| 60 | { return test_and_clear_bit(PCG_##lname, &pc->flags); } | 60 | { return test_and_clear_bit(PCG_##lname, &pc->flags); } |
| 61 | 61 | ||
| 62 | TESTPCGFLAG(Locked, LOCK) | ||
| 63 | |||
| 64 | /* Cache flag is set only once (at allocation) */ | 62 | /* Cache flag is set only once (at allocation) */ |
| 65 | TESTPCGFLAG(Cache, CACHE) | 63 | TESTPCGFLAG(Cache, CACHE) |
| 66 | CLEARPCGFLAG(Cache, CACHE) | 64 | CLEARPCGFLAG(Cache, CACHE) |
| @@ -104,6 +102,11 @@ static inline void unlock_page_cgroup(struct page_cgroup *pc) | |||
| 104 | bit_spin_unlock(PCG_LOCK, &pc->flags); | 102 | bit_spin_unlock(PCG_LOCK, &pc->flags); |
| 105 | } | 103 | } |
| 106 | 104 | ||
| 105 | static inline int page_is_cgroup_locked(struct page_cgroup *pc) | ||
| 106 | { | ||
| 107 | return bit_spin_is_locked(PCG_LOCK, &pc->flags); | ||
| 108 | } | ||
| 109 | |||
| 107 | #else /* CONFIG_CGROUP_MEM_RES_CTLR */ | 110 | #else /* CONFIG_CGROUP_MEM_RES_CTLR */ |
| 108 | struct page_cgroup; | 111 | struct page_cgroup; |
| 109 | 112 | ||
diff --git a/include/xen/interface/memory.h b/include/xen/interface/memory.h index d7a6c13bde69..eac3ce153719 100644 --- a/include/xen/interface/memory.h +++ b/include/xen/interface/memory.h | |||
| @@ -141,6 +141,19 @@ struct xen_machphys_mfn_list { | |||
| 141 | DEFINE_GUEST_HANDLE_STRUCT(xen_machphys_mfn_list); | 141 | DEFINE_GUEST_HANDLE_STRUCT(xen_machphys_mfn_list); |
| 142 | 142 | ||
| 143 | /* | 143 | /* |
| 144 | * Returns the location in virtual address space of the machine_to_phys | ||
| 145 | * mapping table. Architectures which do not have a m2p table, or which do not | ||
| 146 | * map it by default into guest address space, do not implement this command. | ||
| 147 | * arg == addr of xen_machphys_mapping_t. | ||
| 148 | */ | ||
| 149 | #define XENMEM_machphys_mapping 12 | ||
| 150 | struct xen_machphys_mapping { | ||
| 151 | unsigned long v_start, v_end; /* Start and end virtual addresses. */ | ||
| 152 | unsigned long max_mfn; /* Maximum MFN that can be looked up. */ | ||
| 153 | }; | ||
| 154 | DEFINE_GUEST_HANDLE_STRUCT(xen_machphys_mapping_t); | ||
| 155 | |||
| 156 | /* | ||
| 144 | * Sets the GPFN at which a particular page appears in the specified guest's | 157 | * Sets the GPFN at which a particular page appears in the specified guest's |
| 145 | * pseudophysical address space. | 158 | * pseudophysical address space. |
| 146 | * arg == addr of xen_add_to_physmap_t. | 159 | * arg == addr of xen_add_to_physmap_t. |
diff --git a/include/xen/page.h b/include/xen/page.h index eaf85fab1263..0be36b976f4b 100644 --- a/include/xen/page.h +++ b/include/xen/page.h | |||
| @@ -1 +1,8 @@ | |||
| 1 | #ifndef _XEN_PAGE_H | ||
| 2 | #define _XEN_PAGE_H | ||
| 3 | |||
| 1 | #include <asm/xen/page.h> | 4 | #include <asm/xen/page.h> |
| 5 | |||
| 6 | extern phys_addr_t xen_extra_mem_start, xen_extra_mem_size; | ||
| 7 | |||
| 8 | #endif /* _XEN_PAGE_H */ | ||
diff --git a/include/xen/privcmd.h b/include/xen/privcmd.h index b42cdfd92fee..17857fb4d550 100644 --- a/include/xen/privcmd.h +++ b/include/xen/privcmd.h | |||
| @@ -34,13 +34,10 @@ | |||
| 34 | #define __LINUX_PUBLIC_PRIVCMD_H__ | 34 | #define __LINUX_PUBLIC_PRIVCMD_H__ |
| 35 | 35 | ||
| 36 | #include <linux/types.h> | 36 | #include <linux/types.h> |
| 37 | #include <linux/compiler.h> | ||
| 37 | 38 | ||
| 38 | typedef unsigned long xen_pfn_t; | 39 | typedef unsigned long xen_pfn_t; |
| 39 | 40 | ||
| 40 | #ifndef __user | ||
| 41 | #define __user | ||
| 42 | #endif | ||
| 43 | |||
| 44 | struct privcmd_hypercall { | 41 | struct privcmd_hypercall { |
| 45 | __u64 op; | 42 | __u64 op; |
| 46 | __u64 arg[5]; | 43 | __u64 arg[5]; |
diff --git a/init/Kconfig b/init/Kconfig index 88c10468db46..c9728992a776 100644 --- a/init/Kconfig +++ b/init/Kconfig | |||
| @@ -613,6 +613,19 @@ config CGROUP_MEM_RES_CTLR_SWAP | |||
| 613 | if boot option "noswapaccount" is set, swap will not be accounted. | 613 | if boot option "noswapaccount" is set, swap will not be accounted. |
| 614 | Now, memory usage of swap_cgroup is 2 bytes per entry. If swap page | 614 | Now, memory usage of swap_cgroup is 2 bytes per entry. If swap page |
| 615 | size is 4096bytes, 512k per 1Gbytes of swap. | 615 | size is 4096bytes, 512k per 1Gbytes of swap. |
| 616 | config CGROUP_MEM_RES_CTLR_SWAP_ENABLED | ||
| 617 | bool "Memory Resource Controller Swap Extension enabled by default" | ||
| 618 | depends on CGROUP_MEM_RES_CTLR_SWAP | ||
| 619 | default y | ||
| 620 | help | ||
| 621 | Memory Resource Controller Swap Extension comes with its price in | ||
| 622 | a bigger memory consumption. General purpose distribution kernels | ||
| 623 | which want to enable the feautre but keep it disabled by default | ||
| 624 | and let the user enable it by swapaccount boot command line | ||
| 625 | parameter should have this option unselected. | ||
| 626 | For those who want to have the feature enabled by default should | ||
| 627 | select this option (if, for some reason, they need to disable it | ||
| 628 | then noswapaccount does the trick). | ||
| 616 | 629 | ||
| 617 | menuconfig CGROUP_SCHED | 630 | menuconfig CGROUP_SCHED |
| 618 | bool "Group CPU scheduler" | 631 | bool "Group CPU scheduler" |
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 2efa8ea07ff7..7a22b4129211 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
| @@ -61,7 +61,14 @@ struct mem_cgroup *root_mem_cgroup __read_mostly; | |||
| 61 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP | 61 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP |
| 62 | /* Turned on only when memory cgroup is enabled && really_do_swap_account = 1 */ | 62 | /* Turned on only when memory cgroup is enabled && really_do_swap_account = 1 */ |
| 63 | int do_swap_account __read_mostly; | 63 | int do_swap_account __read_mostly; |
| 64 | static int really_do_swap_account __initdata = 1; /* for remember boot option*/ | 64 | |
| 65 | /* for remember boot option*/ | ||
| 66 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP_ENABLED | ||
| 67 | static int really_do_swap_account __initdata = 1; | ||
| 68 | #else | ||
| 69 | static int really_do_swap_account __initdata = 0; | ||
| 70 | #endif | ||
| 71 | |||
| 65 | #else | 72 | #else |
| 66 | #define do_swap_account (0) | 73 | #define do_swap_account (0) |
| 67 | #endif | 74 | #endif |
| @@ -278,13 +285,14 @@ enum move_type { | |||
| 278 | 285 | ||
| 279 | /* "mc" and its members are protected by cgroup_mutex */ | 286 | /* "mc" and its members are protected by cgroup_mutex */ |
| 280 | static struct move_charge_struct { | 287 | static struct move_charge_struct { |
| 281 | spinlock_t lock; /* for from, to, moving_task */ | 288 | spinlock_t lock; /* for from, to */ |
| 282 | struct mem_cgroup *from; | 289 | struct mem_cgroup *from; |
| 283 | struct mem_cgroup *to; | 290 | struct mem_cgroup *to; |
| 284 | unsigned long precharge; | 291 | unsigned long precharge; |
| 285 | unsigned long moved_charge; | 292 | unsigned long moved_charge; |
| 286 | unsigned long moved_swap; | 293 | unsigned long moved_swap; |
| 287 | struct task_struct *moving_task; /* a task moving charges */ | 294 | struct task_struct *moving_task; /* a task moving charges */ |
| 295 | struct mm_struct *mm; | ||
| 288 | wait_queue_head_t waitq; /* a waitq for other context */ | 296 | wait_queue_head_t waitq; /* a waitq for other context */ |
| 289 | } mc = { | 297 | } mc = { |
| 290 | .lock = __SPIN_LOCK_UNLOCKED(mc.lock), | 298 | .lock = __SPIN_LOCK_UNLOCKED(mc.lock), |
| @@ -2152,7 +2160,7 @@ static void __mem_cgroup_move_account(struct page_cgroup *pc, | |||
| 2152 | { | 2160 | { |
| 2153 | VM_BUG_ON(from == to); | 2161 | VM_BUG_ON(from == to); |
| 2154 | VM_BUG_ON(PageLRU(pc->page)); | 2162 | VM_BUG_ON(PageLRU(pc->page)); |
| 2155 | VM_BUG_ON(!PageCgroupLocked(pc)); | 2163 | VM_BUG_ON(!page_is_cgroup_locked(pc)); |
| 2156 | VM_BUG_ON(!PageCgroupUsed(pc)); | 2164 | VM_BUG_ON(!PageCgroupUsed(pc)); |
| 2157 | VM_BUG_ON(pc->mem_cgroup != from); | 2165 | VM_BUG_ON(pc->mem_cgroup != from); |
| 2158 | 2166 | ||
| @@ -4631,7 +4639,7 @@ static unsigned long mem_cgroup_count_precharge(struct mm_struct *mm) | |||
| 4631 | unsigned long precharge; | 4639 | unsigned long precharge; |
| 4632 | struct vm_area_struct *vma; | 4640 | struct vm_area_struct *vma; |
| 4633 | 4641 | ||
| 4634 | down_read(&mm->mmap_sem); | 4642 | /* We've already held the mmap_sem */ |
| 4635 | for (vma = mm->mmap; vma; vma = vma->vm_next) { | 4643 | for (vma = mm->mmap; vma; vma = vma->vm_next) { |
| 4636 | struct mm_walk mem_cgroup_count_precharge_walk = { | 4644 | struct mm_walk mem_cgroup_count_precharge_walk = { |
| 4637 | .pmd_entry = mem_cgroup_count_precharge_pte_range, | 4645 | .pmd_entry = mem_cgroup_count_precharge_pte_range, |
| @@ -4643,7 +4651,6 @@ static unsigned long mem_cgroup_count_precharge(struct mm_struct *mm) | |||
| 4643 | walk_page_range(vma->vm_start, vma->vm_end, | 4651 | walk_page_range(vma->vm_start, vma->vm_end, |
| 4644 | &mem_cgroup_count_precharge_walk); | 4652 | &mem_cgroup_count_precharge_walk); |
| 4645 | } | 4653 | } |
| 4646 | up_read(&mm->mmap_sem); | ||
| 4647 | 4654 | ||
| 4648 | precharge = mc.precharge; | 4655 | precharge = mc.precharge; |
| 4649 | mc.precharge = 0; | 4656 | mc.precharge = 0; |
| @@ -4694,11 +4701,16 @@ static void mem_cgroup_clear_mc(void) | |||
| 4694 | 4701 | ||
| 4695 | mc.moved_swap = 0; | 4702 | mc.moved_swap = 0; |
| 4696 | } | 4703 | } |
| 4704 | if (mc.mm) { | ||
| 4705 | up_read(&mc.mm->mmap_sem); | ||
| 4706 | mmput(mc.mm); | ||
| 4707 | } | ||
| 4697 | spin_lock(&mc.lock); | 4708 | spin_lock(&mc.lock); |
| 4698 | mc.from = NULL; | 4709 | mc.from = NULL; |
| 4699 | mc.to = NULL; | 4710 | mc.to = NULL; |
| 4700 | mc.moving_task = NULL; | ||
| 4701 | spin_unlock(&mc.lock); | 4711 | spin_unlock(&mc.lock); |
| 4712 | mc.moving_task = NULL; | ||
| 4713 | mc.mm = NULL; | ||
| 4702 | mem_cgroup_end_move(from); | 4714 | mem_cgroup_end_move(from); |
| 4703 | memcg_oom_recover(from); | 4715 | memcg_oom_recover(from); |
| 4704 | memcg_oom_recover(to); | 4716 | memcg_oom_recover(to); |
| @@ -4724,12 +4736,21 @@ static int mem_cgroup_can_attach(struct cgroup_subsys *ss, | |||
| 4724 | return 0; | 4736 | return 0; |
| 4725 | /* We move charges only when we move a owner of the mm */ | 4737 | /* We move charges only when we move a owner of the mm */ |
| 4726 | if (mm->owner == p) { | 4738 | if (mm->owner == p) { |
| 4739 | /* | ||
| 4740 | * We do all the move charge works under one mmap_sem to | ||
| 4741 | * avoid deadlock with down_write(&mmap_sem) | ||
| 4742 | * -> try_charge() -> if (mc.moving_task) -> sleep. | ||
| 4743 | */ | ||
| 4744 | down_read(&mm->mmap_sem); | ||
| 4745 | |||
| 4727 | VM_BUG_ON(mc.from); | 4746 | VM_BUG_ON(mc.from); |
| 4728 | VM_BUG_ON(mc.to); | 4747 | VM_BUG_ON(mc.to); |
| 4729 | VM_BUG_ON(mc.precharge); | 4748 | VM_BUG_ON(mc.precharge); |
| 4730 | VM_BUG_ON(mc.moved_charge); | 4749 | VM_BUG_ON(mc.moved_charge); |
| 4731 | VM_BUG_ON(mc.moved_swap); | 4750 | VM_BUG_ON(mc.moved_swap); |
| 4732 | VM_BUG_ON(mc.moving_task); | 4751 | VM_BUG_ON(mc.moving_task); |
| 4752 | VM_BUG_ON(mc.mm); | ||
| 4753 | |||
| 4733 | mem_cgroup_start_move(from); | 4754 | mem_cgroup_start_move(from); |
| 4734 | spin_lock(&mc.lock); | 4755 | spin_lock(&mc.lock); |
| 4735 | mc.from = from; | 4756 | mc.from = from; |
| @@ -4737,14 +4758,16 @@ static int mem_cgroup_can_attach(struct cgroup_subsys *ss, | |||
| 4737 | mc.precharge = 0; | 4758 | mc.precharge = 0; |
| 4738 | mc.moved_charge = 0; | 4759 | mc.moved_charge = 0; |
| 4739 | mc.moved_swap = 0; | 4760 | mc.moved_swap = 0; |
| 4740 | mc.moving_task = current; | ||
| 4741 | spin_unlock(&mc.lock); | 4761 | spin_unlock(&mc.lock); |
| 4762 | mc.moving_task = current; | ||
| 4763 | mc.mm = mm; | ||
| 4742 | 4764 | ||
| 4743 | ret = mem_cgroup_precharge_mc(mm); | 4765 | ret = mem_cgroup_precharge_mc(mm); |
| 4744 | if (ret) | 4766 | if (ret) |
| 4745 | mem_cgroup_clear_mc(); | 4767 | mem_cgroup_clear_mc(); |
| 4746 | } | 4768 | /* We call up_read() and mmput() in clear_mc(). */ |
| 4747 | mmput(mm); | 4769 | } else |
| 4770 | mmput(mm); | ||
| 4748 | } | 4771 | } |
| 4749 | return ret; | 4772 | return ret; |
| 4750 | } | 4773 | } |
| @@ -4832,7 +4855,7 @@ static void mem_cgroup_move_charge(struct mm_struct *mm) | |||
| 4832 | struct vm_area_struct *vma; | 4855 | struct vm_area_struct *vma; |
| 4833 | 4856 | ||
| 4834 | lru_add_drain_all(); | 4857 | lru_add_drain_all(); |
| 4835 | down_read(&mm->mmap_sem); | 4858 | /* We've already held the mmap_sem */ |
| 4836 | for (vma = mm->mmap; vma; vma = vma->vm_next) { | 4859 | for (vma = mm->mmap; vma; vma = vma->vm_next) { |
| 4837 | int ret; | 4860 | int ret; |
| 4838 | struct mm_walk mem_cgroup_move_charge_walk = { | 4861 | struct mm_walk mem_cgroup_move_charge_walk = { |
| @@ -4851,7 +4874,6 @@ static void mem_cgroup_move_charge(struct mm_struct *mm) | |||
| 4851 | */ | 4874 | */ |
| 4852 | break; | 4875 | break; |
| 4853 | } | 4876 | } |
| 4854 | up_read(&mm->mmap_sem); | ||
| 4855 | } | 4877 | } |
| 4856 | 4878 | ||
| 4857 | static void mem_cgroup_move_task(struct cgroup_subsys *ss, | 4879 | static void mem_cgroup_move_task(struct cgroup_subsys *ss, |
| @@ -4860,17 +4882,11 @@ static void mem_cgroup_move_task(struct cgroup_subsys *ss, | |||
| 4860 | struct task_struct *p, | 4882 | struct task_struct *p, |
| 4861 | bool threadgroup) | 4883 | bool threadgroup) |
| 4862 | { | 4884 | { |
| 4863 | struct mm_struct *mm; | 4885 | if (!mc.mm) |
| 4864 | |||
| 4865 | if (!mc.to) | ||
| 4866 | /* no need to move charge */ | 4886 | /* no need to move charge */ |
| 4867 | return; | 4887 | return; |
| 4868 | 4888 | ||
| 4869 | mm = get_task_mm(p); | 4889 | mem_cgroup_move_charge(mc.mm); |
| 4870 | if (mm) { | ||
| 4871 | mem_cgroup_move_charge(mm); | ||
| 4872 | mmput(mm); | ||
| 4873 | } | ||
| 4874 | mem_cgroup_clear_mc(); | 4890 | mem_cgroup_clear_mc(); |
| 4875 | } | 4891 | } |
| 4876 | #else /* !CONFIG_MMU */ | 4892 | #else /* !CONFIG_MMU */ |
| @@ -4911,10 +4927,20 @@ struct cgroup_subsys mem_cgroup_subsys = { | |||
| 4911 | }; | 4927 | }; |
| 4912 | 4928 | ||
| 4913 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP | 4929 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP |
| 4930 | static int __init enable_swap_account(char *s) | ||
| 4931 | { | ||
| 4932 | /* consider enabled if no parameter or 1 is given */ | ||
| 4933 | if (!s || !strcmp(s, "1")) | ||
| 4934 | really_do_swap_account = 1; | ||
| 4935 | else if (!strcmp(s, "0")) | ||
| 4936 | really_do_swap_account = 0; | ||
| 4937 | return 1; | ||
| 4938 | } | ||
| 4939 | __setup("swapaccount", enable_swap_account); | ||
| 4914 | 4940 | ||
| 4915 | static int __init disable_swap_account(char *s) | 4941 | static int __init disable_swap_account(char *s) |
| 4916 | { | 4942 | { |
| 4917 | really_do_swap_account = 0; | 4943 | enable_swap_account("0"); |
| 4918 | return 1; | 4944 | return 1; |
| 4919 | } | 4945 | } |
| 4920 | __setup("noswapaccount", disable_swap_account); | 4946 | __setup("noswapaccount", disable_swap_account); |
diff --git a/mm/nommu.c b/mm/nommu.c index 3613517c7592..27a9ac588516 100644 --- a/mm/nommu.c +++ b/mm/nommu.c | |||
| @@ -1717,6 +1717,7 @@ void exit_mmap(struct mm_struct *mm) | |||
| 1717 | mm->mmap = vma->vm_next; | 1717 | mm->mmap = vma->vm_next; |
| 1718 | delete_vma_from_mm(vma); | 1718 | delete_vma_from_mm(vma); |
| 1719 | delete_vma(mm, vma); | 1719 | delete_vma(mm, vma); |
| 1720 | cond_resched(); | ||
| 1720 | } | 1721 | } |
| 1721 | 1722 | ||
| 1722 | kleave(""); | 1723 | kleave(""); |
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 07a654486f75..e4092704c1a9 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
| @@ -3008,14 +3008,6 @@ static __init_refok int __build_all_zonelists(void *data) | |||
| 3008 | build_zonelist_cache(pgdat); | 3008 | build_zonelist_cache(pgdat); |
| 3009 | } | 3009 | } |
| 3010 | 3010 | ||
| 3011 | #ifdef CONFIG_MEMORY_HOTPLUG | ||
| 3012 | /* Setup real pagesets for the new zone */ | ||
| 3013 | if (data) { | ||
| 3014 | struct zone *zone = data; | ||
| 3015 | setup_zone_pageset(zone); | ||
| 3016 | } | ||
| 3017 | #endif | ||
| 3018 | |||
| 3019 | /* | 3011 | /* |
| 3020 | * Initialize the boot_pagesets that are going to be used | 3012 | * Initialize the boot_pagesets that are going to be used |
| 3021 | * for bootstrapping processors. The real pagesets for | 3013 | * for bootstrapping processors. The real pagesets for |
| @@ -3064,7 +3056,11 @@ void build_all_zonelists(void *data) | |||
| 3064 | } else { | 3056 | } else { |
| 3065 | /* we have to stop all cpus to guarantee there is no user | 3057 | /* we have to stop all cpus to guarantee there is no user |
| 3066 | of zonelist */ | 3058 | of zonelist */ |
| 3067 | stop_machine(__build_all_zonelists, data, NULL); | 3059 | #ifdef CONFIG_MEMORY_HOTPLUG |
| 3060 | if (data) | ||
| 3061 | setup_zone_pageset((struct zone *)data); | ||
| 3062 | #endif | ||
| 3063 | stop_machine(__build_all_zonelists, NULL, NULL); | ||
| 3068 | /* cpuset refresh routine should be here */ | 3064 | /* cpuset refresh routine should be here */ |
| 3069 | } | 3065 | } |
| 3070 | vm_total_pages = nr_free_pagecache_pages(); | 3066 | vm_total_pages = nr_free_pagecache_pages(); |
diff --git a/mm/pagewalk.c b/mm/pagewalk.c index 8b1a2ce21ee5..38cc58b8b2b0 100644 --- a/mm/pagewalk.c +++ b/mm/pagewalk.c | |||
| @@ -139,7 +139,6 @@ int walk_page_range(unsigned long addr, unsigned long end, | |||
| 139 | pgd_t *pgd; | 139 | pgd_t *pgd; |
| 140 | unsigned long next; | 140 | unsigned long next; |
| 141 | int err = 0; | 141 | int err = 0; |
| 142 | struct vm_area_struct *vma; | ||
| 143 | 142 | ||
| 144 | if (addr >= end) | 143 | if (addr >= end) |
| 145 | return err; | 144 | return err; |
| @@ -149,15 +148,17 @@ int walk_page_range(unsigned long addr, unsigned long end, | |||
| 149 | 148 | ||
| 150 | pgd = pgd_offset(walk->mm, addr); | 149 | pgd = pgd_offset(walk->mm, addr); |
| 151 | do { | 150 | do { |
| 151 | struct vm_area_struct *uninitialized_var(vma); | ||
| 152 | |||
| 152 | next = pgd_addr_end(addr, end); | 153 | next = pgd_addr_end(addr, end); |
| 153 | 154 | ||
| 155 | #ifdef CONFIG_HUGETLB_PAGE | ||
| 154 | /* | 156 | /* |
| 155 | * handle hugetlb vma individually because pagetable walk for | 157 | * handle hugetlb vma individually because pagetable walk for |
| 156 | * the hugetlb page is dependent on the architecture and | 158 | * the hugetlb page is dependent on the architecture and |
| 157 | * we can't handled it in the same manner as non-huge pages. | 159 | * we can't handled it in the same manner as non-huge pages. |
| 158 | */ | 160 | */ |
| 159 | vma = find_vma(walk->mm, addr); | 161 | vma = find_vma(walk->mm, addr); |
| 160 | #ifdef CONFIG_HUGETLB_PAGE | ||
| 161 | if (vma && is_vm_hugetlb_page(vma)) { | 162 | if (vma && is_vm_hugetlb_page(vma)) { |
| 162 | if (vma->vm_end < next) | 163 | if (vma->vm_end < next) |
| 163 | next = vma->vm_end; | 164 | next = vma->vm_end; |
diff --git a/net/ceph/buffer.c b/net/ceph/buffer.c index 53d8abfa25d5..bf3e6a13c215 100644 --- a/net/ceph/buffer.c +++ b/net/ceph/buffer.c | |||
| @@ -19,7 +19,7 @@ struct ceph_buffer *ceph_buffer_new(size_t len, gfp_t gfp) | |||
| 19 | if (b->vec.iov_base) { | 19 | if (b->vec.iov_base) { |
| 20 | b->is_vmalloc = false; | 20 | b->is_vmalloc = false; |
| 21 | } else { | 21 | } else { |
| 22 | b->vec.iov_base = __vmalloc(len, gfp, PAGE_KERNEL); | 22 | b->vec.iov_base = __vmalloc(len, gfp | __GFP_HIGHMEM, PAGE_KERNEL); |
| 23 | if (!b->vec.iov_base) { | 23 | if (!b->vec.iov_base) { |
| 24 | kfree(b); | 24 | kfree(b); |
| 25 | return NULL; | 25 | return NULL; |
diff --git a/net/core/request_sock.c b/net/core/request_sock.c index 7552495aff7a..fceeb37d7161 100644 --- a/net/core/request_sock.c +++ b/net/core/request_sock.c | |||
| @@ -45,9 +45,7 @@ int reqsk_queue_alloc(struct request_sock_queue *queue, | |||
| 45 | nr_table_entries = roundup_pow_of_two(nr_table_entries + 1); | 45 | nr_table_entries = roundup_pow_of_two(nr_table_entries + 1); |
| 46 | lopt_size += nr_table_entries * sizeof(struct request_sock *); | 46 | lopt_size += nr_table_entries * sizeof(struct request_sock *); |
| 47 | if (lopt_size > PAGE_SIZE) | 47 | if (lopt_size > PAGE_SIZE) |
| 48 | lopt = __vmalloc(lopt_size, | 48 | lopt = vzalloc(lopt_size); |
| 49 | GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO, | ||
| 50 | PAGE_KERNEL); | ||
| 51 | else | 49 | else |
| 52 | lopt = kzalloc(lopt_size, GFP_KERNEL); | 50 | lopt = kzalloc(lopt_size, GFP_KERNEL); |
| 53 | if (lopt == NULL) | 51 | if (lopt == NULL) |
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c index 200eb538fbb3..0f280348e0fd 100644 --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c | |||
| @@ -365,7 +365,7 @@ static struct tnode *tnode_alloc(size_t size) | |||
| 365 | if (size <= PAGE_SIZE) | 365 | if (size <= PAGE_SIZE) |
| 366 | return kzalloc(size, GFP_KERNEL); | 366 | return kzalloc(size, GFP_KERNEL); |
| 367 | else | 367 | else |
| 368 | return __vmalloc(size, GFP_KERNEL | __GFP_ZERO, PAGE_KERNEL); | 368 | return vzalloc(size); |
| 369 | } | 369 | } |
| 370 | 370 | ||
| 371 | static void __tnode_vfree(struct work_struct *arg) | 371 | static void __tnode_vfree(struct work_struct *arg) |
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 2fc35b32df9e..23cc8e1ce8d4 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
| @@ -2758,13 +2758,13 @@ static int addrconf_ifdown(struct net_device *dev, int how) | |||
| 2758 | ifa->state = INET6_IFADDR_STATE_DEAD; | 2758 | ifa->state = INET6_IFADDR_STATE_DEAD; |
| 2759 | spin_unlock_bh(&ifa->state_lock); | 2759 | spin_unlock_bh(&ifa->state_lock); |
| 2760 | 2760 | ||
| 2761 | if (state == INET6_IFADDR_STATE_DEAD) { | 2761 | if (state != INET6_IFADDR_STATE_DEAD) { |
| 2762 | in6_ifa_put(ifa); | ||
| 2763 | } else { | ||
| 2764 | __ipv6_ifa_notify(RTM_DELADDR, ifa); | 2762 | __ipv6_ifa_notify(RTM_DELADDR, ifa); |
| 2765 | atomic_notifier_call_chain(&inet6addr_chain, | 2763 | atomic_notifier_call_chain(&inet6addr_chain, |
| 2766 | NETDEV_DOWN, ifa); | 2764 | NETDEV_DOWN, ifa); |
| 2767 | } | 2765 | } |
| 2766 | |||
| 2767 | in6_ifa_put(ifa); | ||
| 2768 | write_lock_bh(&idev->lock); | 2768 | write_lock_bh(&idev->lock); |
| 2769 | } | 2769 | } |
| 2770 | } | 2770 | } |
diff --git a/net/xfrm/xfrm_hash.c b/net/xfrm/xfrm_hash.c index a2023ec52329..1e98bc0fe0a5 100644 --- a/net/xfrm/xfrm_hash.c +++ b/net/xfrm/xfrm_hash.c | |||
| @@ -19,7 +19,7 @@ struct hlist_head *xfrm_hash_alloc(unsigned int sz) | |||
| 19 | if (sz <= PAGE_SIZE) | 19 | if (sz <= PAGE_SIZE) |
| 20 | n = kzalloc(sz, GFP_KERNEL); | 20 | n = kzalloc(sz, GFP_KERNEL); |
| 21 | else if (hashdist) | 21 | else if (hashdist) |
| 22 | n = __vmalloc(sz, GFP_KERNEL | __GFP_ZERO, PAGE_KERNEL); | 22 | n = vzalloc(sz); |
| 23 | else | 23 | else |
| 24 | n = (struct hlist_head *) | 24 | n = (struct hlist_head *) |
| 25 | __get_free_pages(GFP_KERNEL | __GFP_NOWARN | __GFP_ZERO, | 25 | __get_free_pages(GFP_KERNEL | __GFP_NOWARN | __GFP_ZERO, |
diff --git a/scripts/gfp-translate b/scripts/gfp-translate index d81b968d864e..c9230e158a8f 100644 --- a/scripts/gfp-translate +++ b/scripts/gfp-translate | |||
| @@ -63,7 +63,12 @@ fi | |||
| 63 | 63 | ||
| 64 | # Extract GFP flags from the kernel source | 64 | # Extract GFP flags from the kernel source |
| 65 | TMPFILE=`mktemp -t gfptranslate-XXXXXX` || exit 1 | 65 | TMPFILE=`mktemp -t gfptranslate-XXXXXX` || exit 1 |
| 66 | grep "^#define __GFP" $SOURCE/include/linux/gfp.h | sed -e 's/(__force gfp_t)//' | sed -e 's/u)/)/' | grep -v GFP_BITS | sed -e 's/)\//) \//' > $TMPFILE | 66 | grep -q ___GFP $SOURCE/include/linux/gfp.h |
| 67 | if [ $? -eq 0 ]; then | ||
| 68 | grep "^#define ___GFP" $SOURCE/include/linux/gfp.h | sed -e 's/u$//' | grep -v GFP_BITS > $TMPFILE | ||
| 69 | else | ||
| 70 | grep "^#define __GFP" $SOURCE/include/linux/gfp.h | sed -e 's/(__force gfp_t)//' | sed -e 's/u)/)/' | grep -v GFP_BITS | sed -e 's/)\//) \//' > $TMPFILE | ||
| 71 | fi | ||
| 67 | 72 | ||
| 68 | # Parse the flags | 73 | # Parse the flags |
| 69 | IFS=" | 74 | IFS=" |
diff --git a/sound/atmel/abdac.c b/sound/atmel/abdac.c index f2f41c854221..6e2409181895 100644 --- a/sound/atmel/abdac.c +++ b/sound/atmel/abdac.c | |||
| @@ -420,9 +420,9 @@ static int __devinit atmel_abdac_probe(struct platform_device *pdev) | |||
| 420 | return PTR_ERR(pclk); | 420 | return PTR_ERR(pclk); |
| 421 | } | 421 | } |
| 422 | sample_clk = clk_get(&pdev->dev, "sample_clk"); | 422 | sample_clk = clk_get(&pdev->dev, "sample_clk"); |
| 423 | if (IS_ERR(pclk)) { | 423 | if (IS_ERR(sample_clk)) { |
| 424 | dev_dbg(&pdev->dev, "no sample clock\n"); | 424 | dev_dbg(&pdev->dev, "no sample clock\n"); |
| 425 | retval = PTR_ERR(pclk); | 425 | retval = PTR_ERR(sample_clk); |
| 426 | goto out_put_pclk; | 426 | goto out_put_pclk; |
| 427 | } | 427 | } |
| 428 | clk_enable(pclk); | 428 | clk_enable(pclk); |
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index a1707cca9c66..b75db8e9cc0f 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c | |||
| @@ -223,7 +223,7 @@ static void xrun_log(struct snd_pcm_substream *substream, | |||
| 223 | entry->jiffies = jiffies; | 223 | entry->jiffies = jiffies; |
| 224 | entry->pos = pos; | 224 | entry->pos = pos; |
| 225 | entry->period_size = runtime->period_size; | 225 | entry->period_size = runtime->period_size; |
| 226 | entry->buffer_size = runtime->buffer_size;; | 226 | entry->buffer_size = runtime->buffer_size; |
| 227 | entry->old_hw_ptr = runtime->status->hw_ptr; | 227 | entry->old_hw_ptr = runtime->status->hw_ptr; |
| 228 | entry->hw_ptr_base = runtime->hw_ptr_base; | 228 | entry->hw_ptr_base = runtime->hw_ptr_base; |
| 229 | log->idx = (log->idx + 1) % XRUN_LOG_CNT; | 229 | log->idx = (log->idx + 1) % XRUN_LOG_CNT; |
diff --git a/sound/oss/dev_table.c b/sound/oss/dev_table.c index 727bdb9ba2dc..d8cf3e58dc76 100644 --- a/sound/oss/dev_table.c +++ b/sound/oss/dev_table.c | |||
| @@ -71,7 +71,7 @@ int sound_install_audiodrv(int vers, char *name, struct audio_driver *driver, | |||
| 71 | if (sound_nblocks >= MAX_MEM_BLOCKS) | 71 | if (sound_nblocks >= MAX_MEM_BLOCKS) |
| 72 | sound_nblocks = MAX_MEM_BLOCKS - 1; | 72 | sound_nblocks = MAX_MEM_BLOCKS - 1; |
| 73 | 73 | ||
| 74 | op = (struct audio_operations *) (sound_mem_blocks[sound_nblocks] = vmalloc(sizeof(struct audio_operations))); | 74 | op = (struct audio_operations *) (sound_mem_blocks[sound_nblocks] = vzalloc(sizeof(struct audio_operations))); |
| 75 | sound_nblocks++; | 75 | sound_nblocks++; |
| 76 | if (sound_nblocks >= MAX_MEM_BLOCKS) | 76 | if (sound_nblocks >= MAX_MEM_BLOCKS) |
| 77 | sound_nblocks = MAX_MEM_BLOCKS - 1; | 77 | sound_nblocks = MAX_MEM_BLOCKS - 1; |
| @@ -81,7 +81,6 @@ int sound_install_audiodrv(int vers, char *name, struct audio_driver *driver, | |||
| 81 | sound_unload_audiodev(num); | 81 | sound_unload_audiodev(num); |
| 82 | return -(ENOMEM); | 82 | return -(ENOMEM); |
| 83 | } | 83 | } |
| 84 | memset((char *) op, 0, sizeof(struct audio_operations)); | ||
| 85 | init_waitqueue_head(&op->in_sleeper); | 84 | init_waitqueue_head(&op->in_sleeper); |
| 86 | init_waitqueue_head(&op->out_sleeper); | 85 | init_waitqueue_head(&op->out_sleeper); |
| 87 | init_waitqueue_head(&op->poll_sleeper); | 86 | init_waitqueue_head(&op->poll_sleeper); |
| @@ -128,7 +127,7 @@ int sound_install_mixer(int vers, char *name, struct mixer_operations *driver, | |||
| 128 | /* FIXME: This leaks a mixer_operations struct every time its called | 127 | /* FIXME: This leaks a mixer_operations struct every time its called |
| 129 | until you unload sound! */ | 128 | until you unload sound! */ |
| 130 | 129 | ||
| 131 | op = (struct mixer_operations *) (sound_mem_blocks[sound_nblocks] = vmalloc(sizeof(struct mixer_operations))); | 130 | op = (struct mixer_operations *) (sound_mem_blocks[sound_nblocks] = vzalloc(sizeof(struct mixer_operations))); |
| 132 | sound_nblocks++; | 131 | sound_nblocks++; |
| 133 | if (sound_nblocks >= MAX_MEM_BLOCKS) | 132 | if (sound_nblocks >= MAX_MEM_BLOCKS) |
| 134 | sound_nblocks = MAX_MEM_BLOCKS - 1; | 133 | sound_nblocks = MAX_MEM_BLOCKS - 1; |
| @@ -137,7 +136,6 @@ int sound_install_mixer(int vers, char *name, struct mixer_operations *driver, | |||
| 137 | printk(KERN_ERR "Sound: Can't allocate mixer driver for (%s)\n", name); | 136 | printk(KERN_ERR "Sound: Can't allocate mixer driver for (%s)\n", name); |
| 138 | return -ENOMEM; | 137 | return -ENOMEM; |
| 139 | } | 138 | } |
| 140 | memset((char *) op, 0, sizeof(struct mixer_operations)); | ||
| 141 | memcpy((char *) op, (char *) driver, driver_size); | 139 | memcpy((char *) op, (char *) driver, driver_size); |
| 142 | 140 | ||
| 143 | strlcpy(op->name, name, sizeof(op->name)); | 141 | strlcpy(op->name, name, sizeof(op->name)); |
diff --git a/sound/oss/midibuf.c b/sound/oss/midibuf.c index 782b3b84dac6..ceedb1eff203 100644 --- a/sound/oss/midibuf.c +++ b/sound/oss/midibuf.c | |||
| @@ -178,7 +178,7 @@ int MIDIbuf_open(int dev, struct file *file) | |||
| 178 | return err; | 178 | return err; |
| 179 | 179 | ||
| 180 | parms[dev].prech_timeout = MAX_SCHEDULE_TIMEOUT; | 180 | parms[dev].prech_timeout = MAX_SCHEDULE_TIMEOUT; |
| 181 | midi_in_buf[dev] = (struct midi_buf *) vmalloc(sizeof(struct midi_buf)); | 181 | midi_in_buf[dev] = vmalloc(sizeof(struct midi_buf)); |
| 182 | 182 | ||
| 183 | if (midi_in_buf[dev] == NULL) | 183 | if (midi_in_buf[dev] == NULL) |
| 184 | { | 184 | { |
| @@ -188,7 +188,7 @@ int MIDIbuf_open(int dev, struct file *file) | |||
| 188 | } | 188 | } |
| 189 | midi_in_buf[dev]->len = midi_in_buf[dev]->head = midi_in_buf[dev]->tail = 0; | 189 | midi_in_buf[dev]->len = midi_in_buf[dev]->head = midi_in_buf[dev]->tail = 0; |
| 190 | 190 | ||
| 191 | midi_out_buf[dev] = (struct midi_buf *) vmalloc(sizeof(struct midi_buf)); | 191 | midi_out_buf[dev] = vmalloc(sizeof(struct midi_buf)); |
| 192 | 192 | ||
| 193 | if (midi_out_buf[dev] == NULL) | 193 | if (midi_out_buf[dev] == NULL) |
| 194 | { | 194 | { |
diff --git a/sound/oss/pss.c b/sound/oss/pss.c index e19dd5dcc2de..9b800ce5100e 100644 --- a/sound/oss/pss.c +++ b/sound/oss/pss.c | |||
| @@ -859,7 +859,7 @@ static int pss_coproc_ioctl(void *dev_info, unsigned int cmd, void __user *arg, | |||
| 859 | return 0; | 859 | return 0; |
| 860 | 860 | ||
| 861 | case SNDCTL_COPR_LOAD: | 861 | case SNDCTL_COPR_LOAD: |
| 862 | buf = (copr_buffer *) vmalloc(sizeof(copr_buffer)); | 862 | buf = vmalloc(sizeof(copr_buffer)); |
| 863 | if (buf == NULL) | 863 | if (buf == NULL) |
| 864 | return -ENOSPC; | 864 | return -ENOSPC; |
| 865 | if (copy_from_user(buf, arg, sizeof(copr_buffer))) { | 865 | if (copy_from_user(buf, arg, sizeof(copr_buffer))) { |
| @@ -871,7 +871,7 @@ static int pss_coproc_ioctl(void *dev_info, unsigned int cmd, void __user *arg, | |||
| 871 | return err; | 871 | return err; |
| 872 | 872 | ||
| 873 | case SNDCTL_COPR_SENDMSG: | 873 | case SNDCTL_COPR_SENDMSG: |
| 874 | mbuf = (copr_msg *)vmalloc(sizeof(copr_msg)); | 874 | mbuf = vmalloc(sizeof(copr_msg)); |
| 875 | if (mbuf == NULL) | 875 | if (mbuf == NULL) |
| 876 | return -ENOSPC; | 876 | return -ENOSPC; |
| 877 | if (copy_from_user(mbuf, arg, sizeof(copr_msg))) { | 877 | if (copy_from_user(mbuf, arg, sizeof(copr_msg))) { |
| @@ -895,7 +895,7 @@ static int pss_coproc_ioctl(void *dev_info, unsigned int cmd, void __user *arg, | |||
| 895 | 895 | ||
| 896 | case SNDCTL_COPR_RCVMSG: | 896 | case SNDCTL_COPR_RCVMSG: |
| 897 | err = 0; | 897 | err = 0; |
| 898 | mbuf = (copr_msg *)vmalloc(sizeof(copr_msg)); | 898 | mbuf = vmalloc(sizeof(copr_msg)); |
| 899 | if (mbuf == NULL) | 899 | if (mbuf == NULL) |
| 900 | return -ENOSPC; | 900 | return -ENOSPC; |
| 901 | data = (unsigned short *)mbuf->data; | 901 | data = (unsigned short *)mbuf->data; |
diff --git a/sound/oss/sequencer.c b/sound/oss/sequencer.c index e85789e53816..5ea1098ac427 100644 --- a/sound/oss/sequencer.c +++ b/sound/oss/sequencer.c | |||
| @@ -1646,13 +1646,13 @@ void sequencer_init(void) | |||
| 1646 | { | 1646 | { |
| 1647 | if (sequencer_ok) | 1647 | if (sequencer_ok) |
| 1648 | return; | 1648 | return; |
| 1649 | queue = (unsigned char *)vmalloc(SEQ_MAX_QUEUE * EV_SZ); | 1649 | queue = vmalloc(SEQ_MAX_QUEUE * EV_SZ); |
| 1650 | if (queue == NULL) | 1650 | if (queue == NULL) |
| 1651 | { | 1651 | { |
| 1652 | printk(KERN_ERR "sequencer: Can't allocate memory for sequencer output queue\n"); | 1652 | printk(KERN_ERR "sequencer: Can't allocate memory for sequencer output queue\n"); |
| 1653 | return; | 1653 | return; |
| 1654 | } | 1654 | } |
| 1655 | iqueue = (unsigned char *)vmalloc(SEQ_MAX_QUEUE * IEV_SZ); | 1655 | iqueue = vmalloc(SEQ_MAX_QUEUE * IEV_SZ); |
| 1656 | if (iqueue == NULL) | 1656 | if (iqueue == NULL) |
| 1657 | { | 1657 | { |
| 1658 | printk(KERN_ERR "sequencer: Can't allocate memory for sequencer input queue\n"); | 1658 | printk(KERN_ERR "sequencer: Can't allocate memory for sequencer input queue\n"); |
diff --git a/sound/pci/asihpi/hpioctl.c b/sound/pci/asihpi/hpioctl.c index 62895a719fcb..22dbd91811a4 100644 --- a/sound/pci/asihpi/hpioctl.c +++ b/sound/pci/asihpi/hpioctl.c | |||
| @@ -435,7 +435,7 @@ void __devexit asihpi_adapter_remove(struct pci_dev *pci_dev) | |||
| 435 | struct hpi_message hm; | 435 | struct hpi_message hm; |
| 436 | struct hpi_response hr; | 436 | struct hpi_response hr; |
| 437 | struct hpi_adapter *pa; | 437 | struct hpi_adapter *pa; |
| 438 | pa = (struct hpi_adapter *)pci_get_drvdata(pci_dev); | 438 | pa = pci_get_drvdata(pci_dev); |
| 439 | 439 | ||
| 440 | hpi_init_message_response(&hm, &hr, HPI_OBJ_SUBSYSTEM, | 440 | hpi_init_message_response(&hm, &hr, HPI_OBJ_SUBSYSTEM, |
| 441 | HPI_SUBSYS_DELETE_ADAPTER); | 441 | HPI_SUBSYS_DELETE_ADAPTER); |
diff --git a/sound/pci/azt3328.c b/sound/pci/azt3328.c index 4679ed83a43b..2f3cacbd5528 100644 --- a/sound/pci/azt3328.c +++ b/sound/pci/azt3328.c | |||
| @@ -1129,10 +1129,11 @@ snd_azf3328_codec_setdmaa(struct snd_azf3328 *chip, | |||
| 1129 | 1129 | ||
| 1130 | count_areas = size/2; | 1130 | count_areas = size/2; |
| 1131 | addr_area2 = addr+count_areas; | 1131 | addr_area2 = addr+count_areas; |
| 1132 | count_areas--; /* max. index */ | ||
| 1133 | snd_azf3328_dbgcodec("setdma: buffers %08lx[%u] / %08lx[%u]\n", | 1132 | snd_azf3328_dbgcodec("setdma: buffers %08lx[%u] / %08lx[%u]\n", |
| 1134 | addr, count_areas, addr_area2, count_areas); | 1133 | addr, count_areas, addr_area2, count_areas); |
| 1135 | 1134 | ||
| 1135 | count_areas--; /* max. index */ | ||
| 1136 | |||
| 1136 | /* build combined I/O buffer length word */ | 1137 | /* build combined I/O buffer length word */ |
| 1137 | lengths = (count_areas << 16) | (count_areas); | 1138 | lengths = (count_areas << 16) | (count_areas); |
| 1138 | spin_lock_irqsave(&chip->reg_lock, flags); | 1139 | spin_lock_irqsave(&chip->reg_lock, flags); |
| @@ -1740,11 +1741,15 @@ static const struct snd_pcm_hardware snd_azf3328_hardware = | |||
| 1740 | .rate_max = AZF_FREQ_66200, | 1741 | .rate_max = AZF_FREQ_66200, |
| 1741 | .channels_min = 1, | 1742 | .channels_min = 1, |
| 1742 | .channels_max = 2, | 1743 | .channels_max = 2, |
| 1743 | .buffer_bytes_max = 65536, | 1744 | .buffer_bytes_max = (64*1024), |
| 1744 | .period_bytes_min = 64, | 1745 | .period_bytes_min = 1024, |
| 1745 | .period_bytes_max = 65536, | 1746 | .period_bytes_max = (32*1024), |
| 1746 | .periods_min = 1, | 1747 | /* We simply have two DMA areas (instead of a list of descriptors |
| 1747 | .periods_max = 1024, | 1748 | such as other cards); I believe that this is a fixed hardware |
| 1749 | attribute and there isn't much driver magic to be done to expand it. | ||
| 1750 | Thus indicate that we have at least and at most 2 periods. */ | ||
| 1751 | .periods_min = 2, | ||
| 1752 | .periods_max = 2, | ||
| 1748 | /* FIXME: maybe that card actually has a FIFO? | 1753 | /* FIXME: maybe that card actually has a FIFO? |
| 1749 | * Hmm, it seems newer revisions do have one, but we still don't know | 1754 | * Hmm, it seems newer revisions do have one, but we still don't know |
| 1750 | * its size... */ | 1755 | * its size... */ |
| @@ -1980,8 +1985,13 @@ snd_azf3328_timer_stop(struct snd_timer *timer) | |||
| 1980 | chip = snd_timer_chip(timer); | 1985 | chip = snd_timer_chip(timer); |
| 1981 | spin_lock_irqsave(&chip->reg_lock, flags); | 1986 | spin_lock_irqsave(&chip->reg_lock, flags); |
| 1982 | /* disable timer countdown and interrupt */ | 1987 | /* disable timer countdown and interrupt */ |
| 1983 | /* FIXME: should we write TIMER_IRQ_ACK here? */ | 1988 | /* Hmm, should we write TIMER_IRQ_ACK here? |
| 1984 | snd_azf3328_ctrl_outb(chip, IDX_IO_TIMER_VALUE + 3, 0); | 1989 | YES indeed, otherwise a rogue timer operation - which prompts |
| 1990 | ALSA(?) to call repeated stop() in vain, but NOT start() - | ||
| 1991 | will never end (value 0x03 is kept shown in control byte). | ||
| 1992 | Simply manually poking 0x04 _once_ immediately successfully stops | ||
| 1993 | the hardware/ALSA interrupt activity. */ | ||
| 1994 | snd_azf3328_ctrl_outb(chip, IDX_IO_TIMER_VALUE + 3, 0x04); | ||
| 1985 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 1995 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
| 1986 | snd_azf3328_dbgcallleave(); | 1996 | snd_azf3328_dbgcallleave(); |
| 1987 | return 0; | 1997 | return 0; |
diff --git a/sound/pci/ctxfi/ctpcm.c b/sound/pci/ctxfi/ctpcm.c index 85ab43e89212..457d21189b0d 100644 --- a/sound/pci/ctxfi/ctpcm.c +++ b/sound/pci/ctxfi/ctpcm.c | |||
| @@ -129,8 +129,6 @@ static int ct_pcm_playback_open(struct snd_pcm_substream *substream) | |||
| 129 | 129 | ||
| 130 | apcm->substream = substream; | 130 | apcm->substream = substream; |
| 131 | apcm->interrupt = ct_atc_pcm_interrupt; | 131 | apcm->interrupt = ct_atc_pcm_interrupt; |
| 132 | runtime->private_data = apcm; | ||
| 133 | runtime->private_free = ct_atc_pcm_free_substream; | ||
| 134 | if (IEC958 == substream->pcm->device) { | 132 | if (IEC958 == substream->pcm->device) { |
| 135 | runtime->hw = ct_spdif_passthru_playback_hw; | 133 | runtime->hw = ct_spdif_passthru_playback_hw; |
| 136 | atc->spdif_out_passthru(atc, 1); | 134 | atc->spdif_out_passthru(atc, 1); |
| @@ -155,8 +153,12 @@ static int ct_pcm_playback_open(struct snd_pcm_substream *substream) | |||
| 155 | } | 153 | } |
| 156 | 154 | ||
| 157 | apcm->timer = ct_timer_instance_new(atc->timer, apcm); | 155 | apcm->timer = ct_timer_instance_new(atc->timer, apcm); |
| 158 | if (!apcm->timer) | 156 | if (!apcm->timer) { |
| 157 | kfree(apcm); | ||
| 159 | return -ENOMEM; | 158 | return -ENOMEM; |
| 159 | } | ||
| 160 | runtime->private_data = apcm; | ||
| 161 | runtime->private_free = ct_atc_pcm_free_substream; | ||
| 160 | 162 | ||
| 161 | return 0; | 163 | return 0; |
| 162 | } | 164 | } |
| @@ -278,8 +280,6 @@ static int ct_pcm_capture_open(struct snd_pcm_substream *substream) | |||
| 278 | apcm->started = 0; | 280 | apcm->started = 0; |
| 279 | apcm->substream = substream; | 281 | apcm->substream = substream; |
| 280 | apcm->interrupt = ct_atc_pcm_interrupt; | 282 | apcm->interrupt = ct_atc_pcm_interrupt; |
| 281 | runtime->private_data = apcm; | ||
| 282 | runtime->private_free = ct_atc_pcm_free_substream; | ||
| 283 | runtime->hw = ct_pcm_capture_hw; | 283 | runtime->hw = ct_pcm_capture_hw; |
| 284 | runtime->hw.rate_max = atc->rsr * atc->msr; | 284 | runtime->hw.rate_max = atc->rsr * atc->msr; |
| 285 | 285 | ||
| @@ -298,8 +298,12 @@ static int ct_pcm_capture_open(struct snd_pcm_substream *substream) | |||
| 298 | } | 298 | } |
| 299 | 299 | ||
| 300 | apcm->timer = ct_timer_instance_new(atc->timer, apcm); | 300 | apcm->timer = ct_timer_instance_new(atc->timer, apcm); |
| 301 | if (!apcm->timer) | 301 | if (!apcm->timer) { |
| 302 | kfree(apcm); | ||
| 302 | return -ENOMEM; | 303 | return -ENOMEM; |
| 304 | } | ||
| 305 | runtime->private_data = apcm; | ||
| 306 | runtime->private_free = ct_atc_pcm_free_substream; | ||
| 303 | 307 | ||
| 304 | return 0; | 308 | return 0; |
| 305 | } | 309 | } |
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index 6361f752b5f3..846d1ead47fd 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c | |||
| @@ -3100,6 +3100,7 @@ static struct snd_pci_quirk cxt5066_cfg_tbl[] = { | |||
| 3100 | SND_PCI_QUIRK(0x1028, 0x0402, "Dell Vostro", CXT5066_DELL_VOSTRO), | 3100 | SND_PCI_QUIRK(0x1028, 0x0402, "Dell Vostro", CXT5066_DELL_VOSTRO), |
| 3101 | SND_PCI_QUIRK(0x1028, 0x0408, "Dell Inspiron One 19T", CXT5066_IDEAPAD), | 3101 | SND_PCI_QUIRK(0x1028, 0x0408, "Dell Inspiron One 19T", CXT5066_IDEAPAD), |
| 3102 | SND_PCI_QUIRK(0x103c, 0x360b, "HP G60", CXT5066_HP_LAPTOP), | 3102 | SND_PCI_QUIRK(0x103c, 0x360b, "HP G60", CXT5066_HP_LAPTOP), |
| 3103 | SND_PCI_QUIRK(0x1043, 0x13f3, "Asus A52J", CXT5066_HP_LAPTOP), | ||
| 3103 | SND_PCI_QUIRK(0x1179, 0xff1e, "Toshiba Satellite C650D", CXT5066_IDEAPAD), | 3104 | SND_PCI_QUIRK(0x1179, 0xff1e, "Toshiba Satellite C650D", CXT5066_IDEAPAD), |
| 3104 | SND_PCI_QUIRK(0x1179, 0xff50, "Toshiba Satellite P500-PSPGSC-01800T", CXT5066_OLPC_XO_1_5), | 3105 | SND_PCI_QUIRK(0x1179, 0xff50, "Toshiba Satellite P500-PSPGSC-01800T", CXT5066_OLPC_XO_1_5), |
| 3105 | SND_PCI_QUIRK(0x1179, 0xffe0, "Toshiba Satellite Pro T130-15F", CXT5066_OLPC_XO_1_5), | 3106 | SND_PCI_QUIRK(0x1179, 0xffe0, "Toshiba Satellite Pro T130-15F", CXT5066_OLPC_XO_1_5), |
| @@ -3110,6 +3111,7 @@ static struct snd_pci_quirk cxt5066_cfg_tbl[] = { | |||
| 3110 | SND_PCI_QUIRK(0x17aa, 0x21b2, "Thinkpad X100e", CXT5066_IDEAPAD), | 3111 | SND_PCI_QUIRK(0x17aa, 0x21b2, "Thinkpad X100e", CXT5066_IDEAPAD), |
| 3111 | SND_PCI_QUIRK(0x17aa, 0x21b3, "Thinkpad Edge 13 (197)", CXT5066_IDEAPAD), | 3112 | SND_PCI_QUIRK(0x17aa, 0x21b3, "Thinkpad Edge 13 (197)", CXT5066_IDEAPAD), |
| 3112 | SND_PCI_QUIRK(0x17aa, 0x21b4, "Thinkpad Edge", CXT5066_IDEAPAD), | 3113 | SND_PCI_QUIRK(0x17aa, 0x21b4, "Thinkpad Edge", CXT5066_IDEAPAD), |
| 3114 | SND_PCI_QUIRK(0x17aa, 0x21c8, "Thinkpad Edge 11", CXT5066_IDEAPAD), | ||
| 3113 | SND_PCI_QUIRK(0x17aa, 0x215e, "Lenovo Thinkpad", CXT5066_THINKPAD), | 3115 | SND_PCI_QUIRK(0x17aa, 0x215e, "Lenovo Thinkpad", CXT5066_THINKPAD), |
| 3114 | SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo G series", CXT5066_IDEAPAD), | 3116 | SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo G series", CXT5066_IDEAPAD), |
| 3115 | SND_PCI_QUIRK(0x17aa, 0x390a, "Lenovo S10-3t", CXT5066_IDEAPAD), | 3117 | SND_PCI_QUIRK(0x17aa, 0x390a, "Lenovo S10-3t", CXT5066_IDEAPAD), |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 5f00589cb791..0ac6aed0c889 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
| @@ -14623,7 +14623,10 @@ static int alc275_setup_dual_adc(struct hda_codec *codec) | |||
| 14623 | /* different alc269-variants */ | 14623 | /* different alc269-variants */ |
| 14624 | enum { | 14624 | enum { |
| 14625 | ALC269_TYPE_NORMAL, | 14625 | ALC269_TYPE_NORMAL, |
| 14626 | ALC269_TYPE_ALC258, | ||
| 14626 | ALC269_TYPE_ALC259, | 14627 | ALC269_TYPE_ALC259, |
| 14628 | ALC269_TYPE_ALC269VB, | ||
| 14629 | ALC269_TYPE_ALC270, | ||
| 14627 | ALC269_TYPE_ALC271X, | 14630 | ALC269_TYPE_ALC271X, |
| 14628 | }; | 14631 | }; |
| 14629 | 14632 | ||
| @@ -15023,7 +15026,7 @@ static int alc269_fill_coef(struct hda_codec *codec) | |||
| 15023 | static int patch_alc269(struct hda_codec *codec) | 15026 | static int patch_alc269(struct hda_codec *codec) |
| 15024 | { | 15027 | { |
| 15025 | struct alc_spec *spec; | 15028 | struct alc_spec *spec; |
| 15026 | int board_config; | 15029 | int board_config, coef; |
| 15027 | int err; | 15030 | int err; |
| 15028 | 15031 | ||
| 15029 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | 15032 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| @@ -15034,14 +15037,23 @@ static int patch_alc269(struct hda_codec *codec) | |||
| 15034 | 15037 | ||
| 15035 | alc_auto_parse_customize_define(codec); | 15038 | alc_auto_parse_customize_define(codec); |
| 15036 | 15039 | ||
| 15037 | if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){ | 15040 | coef = alc_read_coef_idx(codec, 0); |
| 15041 | if ((coef & 0x00f0) == 0x0010) { | ||
| 15038 | if (codec->bus->pci->subsystem_vendor == 0x1025 && | 15042 | if (codec->bus->pci->subsystem_vendor == 0x1025 && |
| 15039 | spec->cdefine.platform_type == 1) { | 15043 | spec->cdefine.platform_type == 1) { |
| 15040 | alc_codec_rename(codec, "ALC271X"); | 15044 | alc_codec_rename(codec, "ALC271X"); |
| 15041 | spec->codec_variant = ALC269_TYPE_ALC271X; | 15045 | spec->codec_variant = ALC269_TYPE_ALC271X; |
| 15042 | } else { | 15046 | } else if ((coef & 0xf000) == 0x1000) { |
| 15047 | spec->codec_variant = ALC269_TYPE_ALC270; | ||
| 15048 | } else if ((coef & 0xf000) == 0x2000) { | ||
| 15043 | alc_codec_rename(codec, "ALC259"); | 15049 | alc_codec_rename(codec, "ALC259"); |
| 15044 | spec->codec_variant = ALC269_TYPE_ALC259; | 15050 | spec->codec_variant = ALC269_TYPE_ALC259; |
| 15051 | } else if ((coef & 0xf000) == 0x3000) { | ||
| 15052 | alc_codec_rename(codec, "ALC258"); | ||
| 15053 | spec->codec_variant = ALC269_TYPE_ALC258; | ||
| 15054 | } else { | ||
| 15055 | alc_codec_rename(codec, "ALC269VB"); | ||
| 15056 | spec->codec_variant = ALC269_TYPE_ALC269VB; | ||
| 15045 | } | 15057 | } |
| 15046 | } else | 15058 | } else |
| 15047 | alc_fix_pll_init(codec, 0x20, 0x04, 15); | 15059 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| @@ -15104,7 +15116,7 @@ static int patch_alc269(struct hda_codec *codec) | |||
| 15104 | spec->stream_digital_capture = &alc269_pcm_digital_capture; | 15116 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 15105 | 15117 | ||
| 15106 | if (!spec->adc_nids) { /* wasn't filled automatically? use default */ | 15118 | if (!spec->adc_nids) { /* wasn't filled automatically? use default */ |
| 15107 | if (spec->codec_variant != ALC269_TYPE_NORMAL) { | 15119 | if (spec->codec_variant == ALC269_TYPE_NORMAL) { |
| 15108 | spec->adc_nids = alc269_adc_nids; | 15120 | spec->adc_nids = alc269_adc_nids; |
| 15109 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); | 15121 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
| 15110 | spec->capsrc_nids = alc269_capsrc_nids; | 15122 | spec->capsrc_nids = alc269_capsrc_nids; |
| @@ -19298,6 +19310,7 @@ static const struct alc_fixup alc662_fixups[] = { | |||
| 19298 | 19310 | ||
| 19299 | static struct snd_pci_quirk alc662_fixup_tbl[] = { | 19311 | static struct snd_pci_quirk alc662_fixup_tbl[] = { |
| 19300 | SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE), | 19312 | SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE), |
| 19313 | SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD), | ||
| 19301 | SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD), | 19314 | SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD), |
| 19302 | SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD), | 19315 | SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD), |
| 19303 | {} | 19316 | {} |
| @@ -19419,7 +19432,10 @@ static int patch_alc888(struct hda_codec *codec) | |||
| 19419 | { | 19432 | { |
| 19420 | if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){ | 19433 | if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){ |
| 19421 | kfree(codec->chip_name); | 19434 | kfree(codec->chip_name); |
| 19422 | codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL); | 19435 | if (codec->vendor_id == 0x10ec0887) |
| 19436 | codec->chip_name = kstrdup("ALC887-VD", GFP_KERNEL); | ||
| 19437 | else | ||
| 19438 | codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL); | ||
| 19423 | if (!codec->chip_name) { | 19439 | if (!codec->chip_name) { |
| 19424 | alc_free(codec); | 19440 | alc_free(codec); |
| 19425 | return -ENOMEM; | 19441 | return -ENOMEM; |
| @@ -19909,7 +19925,7 @@ static struct hda_codec_preset snd_hda_preset_realtek[] = { | |||
| 19909 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", | 19925 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
| 19910 | .patch = patch_alc882 }, | 19926 | .patch = patch_alc882 }, |
| 19911 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, | 19927 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
| 19912 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 }, | 19928 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc888 }, |
| 19913 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", | 19929 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
| 19914 | .patch = patch_alc882 }, | 19930 | .patch = patch_alc882 }, |
| 19915 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 }, | 19931 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 }, |
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 93fa59cc60ef..5c710807dfe5 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
| @@ -389,6 +389,11 @@ static hda_nid_t stac92hd83xxx_dmic_nids[STAC92HD83XXX_NUM_DMICS + 1] = { | |||
| 389 | 0x11, 0x20, 0 | 389 | 0x11, 0x20, 0 |
| 390 | }; | 390 | }; |
| 391 | 391 | ||
| 392 | #define STAC92HD87B_NUM_DMICS 1 | ||
| 393 | static hda_nid_t stac92hd87b_dmic_nids[STAC92HD87B_NUM_DMICS + 1] = { | ||
| 394 | 0x11, 0 | ||
| 395 | }; | ||
| 396 | |||
| 392 | #define STAC92HD83XXX_NUM_CAPS 2 | 397 | #define STAC92HD83XXX_NUM_CAPS 2 |
| 393 | static unsigned long stac92hd83xxx_capvols[] = { | 398 | static unsigned long stac92hd83xxx_capvols[] = { |
| 394 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), | 399 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), |
| @@ -3486,10 +3491,8 @@ static int stac92xx_auto_create_dmic_input_ctls(struct hda_codec *codec, | |||
| 3486 | return err; | 3491 | return err; |
| 3487 | } | 3492 | } |
| 3488 | 3493 | ||
| 3489 | if (snd_hda_get_bool_hint(codec, "separate_dmux") != 1) { | 3494 | if (snd_hda_get_bool_hint(codec, "separate_dmux") != 1) |
| 3490 | snd_hda_add_imux_item(imux, label, index, NULL); | 3495 | snd_hda_add_imux_item(imux, label, index, NULL); |
| 3491 | spec->num_analog_muxes++; | ||
| 3492 | } | ||
| 3493 | } | 3496 | } |
| 3494 | 3497 | ||
| 3495 | return 0; | 3498 | return 0; |
| @@ -5452,12 +5455,17 @@ again: | |||
| 5452 | stac92hd83xxx_brd_tbl[spec->board_config]); | 5455 | stac92hd83xxx_brd_tbl[spec->board_config]); |
| 5453 | 5456 | ||
| 5454 | switch (codec->vendor_id) { | 5457 | switch (codec->vendor_id) { |
| 5458 | case 0x111d76d1: | ||
| 5459 | case 0x111d76d9: | ||
| 5460 | spec->dmic_nids = stac92hd87b_dmic_nids; | ||
| 5461 | spec->num_dmics = stac92xx_connected_ports(codec, | ||
| 5462 | stac92hd87b_dmic_nids, | ||
| 5463 | STAC92HD87B_NUM_DMICS); | ||
| 5464 | /* Fall through */ | ||
| 5455 | case 0x111d7666: | 5465 | case 0x111d7666: |
| 5456 | case 0x111d7667: | 5466 | case 0x111d7667: |
| 5457 | case 0x111d7668: | 5467 | case 0x111d7668: |
| 5458 | case 0x111d7669: | 5468 | case 0x111d7669: |
| 5459 | case 0x111d76d1: | ||
| 5460 | case 0x111d76d9: | ||
| 5461 | spec->num_pins = ARRAY_SIZE(stac92hd88xxx_pin_nids); | 5469 | spec->num_pins = ARRAY_SIZE(stac92hd88xxx_pin_nids); |
| 5462 | spec->pin_nids = stac92hd88xxx_pin_nids; | 5470 | spec->pin_nids = stac92hd88xxx_pin_nids; |
| 5463 | spec->mono_nid = 0; | 5471 | spec->mono_nid = 0; |
diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c index 400f9ebd243e..629a5494347a 100644 --- a/sound/pci/intel8x0.c +++ b/sound/pci/intel8x0.c | |||
| @@ -1866,6 +1866,12 @@ static struct ac97_quirk ac97_quirks[] __devinitdata = { | |||
| 1866 | }, | 1866 | }, |
| 1867 | { | 1867 | { |
| 1868 | .subvendor = 0x1028, | 1868 | .subvendor = 0x1028, |
| 1869 | .subdevice = 0x0182, | ||
| 1870 | .name = "Dell Latitude D610", /* STAC9750/51 */ | ||
| 1871 | .type = AC97_TUNE_HP_ONLY | ||
| 1872 | }, | ||
| 1873 | { | ||
| 1874 | .subvendor = 0x1028, | ||
| 1869 | .subdevice = 0x0186, | 1875 | .subdevice = 0x0186, |
| 1870 | .name = "Dell Latitude D810", /* cf. Malone #41015 */ | 1876 | .name = "Dell Latitude D810", /* cf. Malone #41015 */ |
| 1871 | .type = AC97_TUNE_HP_MUTE_LED | 1877 | .type = AC97_TUNE_HP_MUTE_LED |
diff --git a/sound/pci/mixart/mixart_hwdep.h b/sound/pci/mixart/mixart_hwdep.h index a46f5083db99..812e288ef2e7 100644 --- a/sound/pci/mixart/mixart_hwdep.h +++ b/sound/pci/mixart/mixart_hwdep.h | |||
| @@ -25,11 +25,21 @@ | |||
| 25 | 25 | ||
| 26 | #include <sound/hwdep.h> | 26 | #include <sound/hwdep.h> |
| 27 | 27 | ||
| 28 | #ifndef readl_be | ||
| 28 | #define readl_be(x) be32_to_cpu(__raw_readl(x)) | 29 | #define readl_be(x) be32_to_cpu(__raw_readl(x)) |
| 30 | #endif | ||
| 31 | |||
| 32 | #ifndef writel_be | ||
| 29 | #define writel_be(data,addr) __raw_writel(cpu_to_be32(data),addr) | 33 | #define writel_be(data,addr) __raw_writel(cpu_to_be32(data),addr) |
| 34 | #endif | ||
| 30 | 35 | ||
| 36 | #ifndef readl_le | ||
| 31 | #define readl_le(x) le32_to_cpu(__raw_readl(x)) | 37 | #define readl_le(x) le32_to_cpu(__raw_readl(x)) |
| 38 | #endif | ||
| 39 | |||
| 40 | #ifndef writel_le | ||
| 32 | #define writel_le(data,addr) __raw_writel(cpu_to_le32(data),addr) | 41 | #define writel_le(data,addr) __raw_writel(cpu_to_le32(data),addr) |
| 42 | #endif | ||
| 33 | 43 | ||
| 34 | #define MIXART_MEM(mgr,x) ((mgr)->mem[0].virt + (x)) | 44 | #define MIXART_MEM(mgr,x) ((mgr)->mem[0].virt + (x)) |
| 35 | #define MIXART_REG(mgr,x) ((mgr)->mem[1].virt + (x)) | 45 | #define MIXART_REG(mgr,x) ((mgr)->mem[1].virt + (x)) |
diff --git a/sound/ppc/pmac.c b/sound/ppc/pmac.c index 85081172403f..b47cfd45b3b9 100644 --- a/sound/ppc/pmac.c +++ b/sound/ppc/pmac.c | |||
| @@ -1228,10 +1228,8 @@ int __devinit snd_pmac_new(struct snd_card *card, struct snd_pmac **chip_return) | |||
| 1228 | chip->rsrc[i].start + 1, | 1228 | chip->rsrc[i].start + 1, |
| 1229 | rnames[i]) == NULL) { | 1229 | rnames[i]) == NULL) { |
| 1230 | printk(KERN_ERR "snd: can't request rsrc " | 1230 | printk(KERN_ERR "snd: can't request rsrc " |
| 1231 | " %d (%s: 0x%016llx:%016llx)\n", | 1231 | " %d (%s: %pR)\n", |
| 1232 | i, rnames[i], | 1232 | i, rnames[i], &chip->rsrc[i]); |
| 1233 | (unsigned long long)chip->rsrc[i].start, | ||
| 1234 | (unsigned long long)chip->rsrc[i].end); | ||
| 1235 | err = -ENODEV; | 1233 | err = -ENODEV; |
| 1236 | goto __error; | 1234 | goto __error; |
| 1237 | } | 1235 | } |
| @@ -1256,10 +1254,8 @@ int __devinit snd_pmac_new(struct snd_card *card, struct snd_pmac **chip_return) | |||
| 1256 | chip->rsrc[i].start + 1, | 1254 | chip->rsrc[i].start + 1, |
| 1257 | rnames[i]) == NULL) { | 1255 | rnames[i]) == NULL) { |
| 1258 | printk(KERN_ERR "snd: can't request rsrc " | 1256 | printk(KERN_ERR "snd: can't request rsrc " |
| 1259 | " %d (%s: 0x%016llx:%016llx)\n", | 1257 | " %d (%s: %pR)\n", |
| 1260 | i, rnames[i], | 1258 | i, rnames[i], &chip->rsrc[i]); |
| 1261 | (unsigned long long)chip->rsrc[i].start, | ||
| 1262 | (unsigned long long)chip->rsrc[i].end); | ||
| 1263 | err = -ENODEV; | 1259 | err = -ENODEV; |
| 1264 | goto __error; | 1260 | goto __error; |
| 1265 | } | 1261 | } |
diff --git a/sound/soc/atmel/Kconfig b/sound/soc/atmel/Kconfig index e720d5e6f04c..bee3c94f58b0 100644 --- a/sound/soc/atmel/Kconfig +++ b/sound/soc/atmel/Kconfig | |||
| @@ -16,7 +16,8 @@ config SND_ATMEL_SOC_SSC | |||
| 16 | 16 | ||
| 17 | config SND_AT91_SOC_SAM9G20_WM8731 | 17 | config SND_AT91_SOC_SAM9G20_WM8731 |
| 18 | tristate "SoC Audio support for WM8731-based At91sam9g20 evaluation board" | 18 | tristate "SoC Audio support for WM8731-based At91sam9g20 evaluation board" |
| 19 | depends on ATMEL_SSC && ARCH_AT91SAM9G20 && SND_ATMEL_SOC | 19 | depends on ATMEL_SSC && ARCH_AT91SAM9G20 && SND_ATMEL_SOC && \ |
| 20 | AT91_PROGRAMMABLE_CLOCKS | ||
| 20 | select SND_ATMEL_SOC_SSC | 21 | select SND_ATMEL_SOC_SSC |
| 21 | select SND_SOC_WM8731 | 22 | select SND_SOC_WM8731 |
| 22 | help | 23 | help |
| @@ -25,7 +26,7 @@ config SND_AT91_SOC_SAM9G20_WM8731 | |||
| 25 | 26 | ||
| 26 | config SND_AT32_SOC_PLAYPAQ | 27 | config SND_AT32_SOC_PLAYPAQ |
| 27 | tristate "SoC Audio support for PlayPaq with WM8510" | 28 | tristate "SoC Audio support for PlayPaq with WM8510" |
| 28 | depends on SND_ATMEL_SOC && BOARD_PLAYPAQ | 29 | depends on SND_ATMEL_SOC && BOARD_PLAYPAQ && AT91_PROGRAMMABLE_CLOCKS |
| 29 | select SND_ATMEL_SOC_SSC | 30 | select SND_ATMEL_SOC_SSC |
| 30 | select SND_SOC_WM8510 | 31 | select SND_SOC_WM8510 |
| 31 | help | 32 | help |
diff --git a/sound/soc/codecs/max98088.c b/sound/soc/codecs/max98088.c index bc22ee93a75d..470cb93b1d1f 100644 --- a/sound/soc/codecs/max98088.c +++ b/sound/soc/codecs/max98088.c | |||
| @@ -28,6 +28,11 @@ | |||
| 28 | #include <sound/max98088.h> | 28 | #include <sound/max98088.h> |
| 29 | #include "max98088.h" | 29 | #include "max98088.h" |
| 30 | 30 | ||
| 31 | enum max98088_type { | ||
| 32 | MAX98088, | ||
| 33 | MAX98089, | ||
| 34 | }; | ||
| 35 | |||
| 31 | struct max98088_cdata { | 36 | struct max98088_cdata { |
| 32 | unsigned int rate; | 37 | unsigned int rate; |
| 33 | unsigned int fmt; | 38 | unsigned int fmt; |
| @@ -36,6 +41,7 @@ struct max98088_cdata { | |||
| 36 | 41 | ||
| 37 | struct max98088_priv { | 42 | struct max98088_priv { |
| 38 | u8 reg_cache[M98088_REG_CNT]; | 43 | u8 reg_cache[M98088_REG_CNT]; |
| 44 | enum max98088_type devtype; | ||
| 39 | void *control_data; | 45 | void *control_data; |
| 40 | struct max98088_pdata *pdata; | 46 | struct max98088_pdata *pdata; |
| 41 | unsigned int sysclk; | 47 | unsigned int sysclk; |
| @@ -2040,6 +2046,8 @@ static int max98088_i2c_probe(struct i2c_client *i2c, | |||
| 2040 | if (max98088 == NULL) | 2046 | if (max98088 == NULL) |
| 2041 | return -ENOMEM; | 2047 | return -ENOMEM; |
| 2042 | 2048 | ||
| 2049 | max98088->devtype = id->driver_data; | ||
| 2050 | |||
| 2043 | i2c_set_clientdata(i2c, max98088); | 2051 | i2c_set_clientdata(i2c, max98088); |
| 2044 | max98088->control_data = i2c; | 2052 | max98088->control_data = i2c; |
| 2045 | max98088->pdata = i2c->dev.platform_data; | 2053 | max98088->pdata = i2c->dev.platform_data; |
| @@ -2059,7 +2067,8 @@ static int __devexit max98088_i2c_remove(struct i2c_client *client) | |||
| 2059 | } | 2067 | } |
| 2060 | 2068 | ||
| 2061 | static const struct i2c_device_id max98088_i2c_id[] = { | 2069 | static const struct i2c_device_id max98088_i2c_id[] = { |
| 2062 | { "max98088", 0 }, | 2070 | { "max98088", MAX98088 }, |
| 2071 | { "max98089", MAX98089 }, | ||
| 2063 | { } | 2072 | { } |
| 2064 | }; | 2073 | }; |
| 2065 | MODULE_DEVICE_TABLE(i2c, max98088_i2c_id); | 2074 | MODULE_DEVICE_TABLE(i2c, max98088_i2c_id); |
diff --git a/sound/soc/codecs/uda134x.c b/sound/soc/codecs/uda134x.c index 7540a509a6f5..464f0cfa4c7a 100644 --- a/sound/soc/codecs/uda134x.c +++ b/sound/soc/codecs/uda134x.c | |||
| @@ -597,6 +597,7 @@ static struct snd_soc_codec_driver soc_codec_dev_uda134x = { | |||
| 597 | .resume = uda134x_soc_resume, | 597 | .resume = uda134x_soc_resume, |
| 598 | .reg_cache_size = sizeof(uda134x_reg), | 598 | .reg_cache_size = sizeof(uda134x_reg), |
| 599 | .reg_word_size = sizeof(u8), | 599 | .reg_word_size = sizeof(u8), |
| 600 | .reg_cache_default = uda134x_reg, | ||
| 600 | .reg_cache_step = 1, | 601 | .reg_cache_step = 1, |
| 601 | .read = uda134x_read_reg_cache, | 602 | .read = uda134x_read_reg_cache, |
| 602 | .write = uda134x_write, | 603 | .write = uda134x_write, |
diff --git a/sound/soc/codecs/wm8350.c b/sound/soc/codecs/wm8350.c index f4f1fba38eb9..7611add7f8c3 100644 --- a/sound/soc/codecs/wm8350.c +++ b/sound/soc/codecs/wm8350.c | |||
| @@ -831,7 +831,7 @@ static int wm8350_set_dai_sysclk(struct snd_soc_dai *codec_dai, | |||
| 831 | } | 831 | } |
| 832 | 832 | ||
| 833 | /* MCLK direction */ | 833 | /* MCLK direction */ |
| 834 | if (dir == WM8350_MCLK_DIR_OUT) | 834 | if (dir == SND_SOC_CLOCK_OUT) |
| 835 | wm8350_set_bits(wm8350, WM8350_CLOCK_CONTROL_2, | 835 | wm8350_set_bits(wm8350, WM8350_CLOCK_CONTROL_2, |
| 836 | WM8350_MCLK_DIR); | 836 | WM8350_MCLK_DIR); |
| 837 | else | 837 | else |
| @@ -1586,6 +1586,13 @@ static int wm8350_codec_probe(struct snd_soc_codec *codec) | |||
| 1586 | wm8350_set_bits(wm8350, WM8350_ROUT2_VOLUME, | 1586 | wm8350_set_bits(wm8350, WM8350_ROUT2_VOLUME, |
| 1587 | WM8350_OUT2_VU | WM8350_OUT2R_MUTE); | 1587 | WM8350_OUT2_VU | WM8350_OUT2R_MUTE); |
| 1588 | 1588 | ||
| 1589 | /* Make sure AIF tristating is disabled by default */ | ||
| 1590 | wm8350_clear_bits(wm8350, WM8350_AI_FORMATING, WM8350_AIF_TRI); | ||
| 1591 | |||
| 1592 | /* Make sure we've got a sane companding setup too */ | ||
| 1593 | wm8350_clear_bits(wm8350, WM8350_ADC_DAC_COMP, | ||
| 1594 | WM8350_DAC_COMP | WM8350_LOOPBACK); | ||
| 1595 | |||
| 1589 | /* Make sure jack detect is disabled to start off with */ | 1596 | /* Make sure jack detect is disabled to start off with */ |
| 1590 | wm8350_clear_bits(wm8350, WM8350_JACK_DETECT, | 1597 | wm8350_clear_bits(wm8350, WM8350_JACK_DETECT, |
| 1591 | WM8350_JDL_ENA | WM8350_JDR_ENA); | 1598 | WM8350_JDL_ENA | WM8350_JDR_ENA); |
diff --git a/sound/soc/codecs/wm8776.c b/sound/soc/codecs/wm8776.c index 04182c464e35..0132a27140ae 100644 --- a/sound/soc/codecs/wm8776.c +++ b/sound/soc/codecs/wm8776.c | |||
| @@ -34,7 +34,6 @@ | |||
| 34 | /* codec private data */ | 34 | /* codec private data */ |
| 35 | struct wm8776_priv { | 35 | struct wm8776_priv { |
| 36 | enum snd_soc_control_type control_type; | 36 | enum snd_soc_control_type control_type; |
| 37 | u16 reg_cache[WM8776_CACHEREGNUM]; | ||
| 38 | int sysclk[2]; | 37 | int sysclk[2]; |
| 39 | }; | 38 | }; |
| 40 | 39 | ||
diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c index 894d0cd3aa9b..e8092745a207 100644 --- a/sound/soc/codecs/wm8962.c +++ b/sound/soc/codecs/wm8962.c | |||
| @@ -3500,8 +3500,11 @@ static ssize_t wm8962_beep_set(struct device *dev, | |||
| 3500 | { | 3500 | { |
| 3501 | struct wm8962_priv *wm8962 = dev_get_drvdata(dev); | 3501 | struct wm8962_priv *wm8962 = dev_get_drvdata(dev); |
| 3502 | long int time; | 3502 | long int time; |
| 3503 | int ret; | ||
| 3503 | 3504 | ||
| 3504 | strict_strtol(buf, 10, &time); | 3505 | ret = strict_strtol(buf, 10, &time); |
| 3506 | if (ret != 0) | ||
| 3507 | return ret; | ||
| 3505 | 3508 | ||
| 3506 | input_event(wm8962->beep, EV_SND, SND_TONE, time); | 3509 | input_event(wm8962->beep, EV_SND, SND_TONE, time); |
| 3507 | 3510 | ||
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index 0db59c3aa5d4..830dfdd66c5f 100644 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c | |||
| @@ -3903,6 +3903,8 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec) | |||
| 3903 | return -ENOMEM; | 3903 | return -ENOMEM; |
| 3904 | snd_soc_codec_set_drvdata(codec, wm8994); | 3904 | snd_soc_codec_set_drvdata(codec, wm8994); |
| 3905 | 3905 | ||
| 3906 | codec->reg_cache = &wm8994->reg_cache; | ||
| 3907 | |||
| 3906 | wm8994->pdata = dev_get_platdata(codec->dev->parent); | 3908 | wm8994->pdata = dev_get_platdata(codec->dev->parent); |
| 3907 | wm8994->codec = codec; | 3909 | wm8994->codec = codec; |
| 3908 | 3910 | ||
diff --git a/sound/soc/davinci/davinci-evm.c b/sound/soc/davinci/davinci-evm.c index 2b07b17a6b2d..bc9e6b0b3f6f 100644 --- a/sound/soc/davinci/davinci-evm.c +++ b/sound/soc/davinci/davinci-evm.c | |||
| @@ -157,12 +157,23 @@ static int evm_aic3x_init(struct snd_soc_pcm_runtime *rtd) | |||
| 157 | } | 157 | } |
| 158 | 158 | ||
| 159 | /* davinci-evm digital audio interface glue - connects codec <--> CPU */ | 159 | /* davinci-evm digital audio interface glue - connects codec <--> CPU */ |
| 160 | static struct snd_soc_dai_link evm_dai = { | 160 | static struct snd_soc_dai_link dm6446_evm_dai = { |
| 161 | .name = "TLV320AIC3X", | 161 | .name = "TLV320AIC3X", |
| 162 | .stream_name = "AIC3X", | 162 | .stream_name = "AIC3X", |
| 163 | .cpu_dai_name = "davinci-mcasp.0", | 163 | .cpu_dai_name = "davinci-mcbsp", |
| 164 | .codec_dai_name = "tlv320aic3x-hifi", | 164 | .codec_dai_name = "tlv320aic3x-hifi", |
| 165 | .codec_name = "tlv320aic3x-codec.0-001a", | 165 | .codec_name = "tlv320aic3x-codec.1-001b", |
| 166 | .platform_name = "davinci-pcm-audio", | ||
| 167 | .init = evm_aic3x_init, | ||
| 168 | .ops = &evm_ops, | ||
| 169 | }; | ||
| 170 | |||
| 171 | static struct snd_soc_dai_link dm355_evm_dai = { | ||
| 172 | .name = "TLV320AIC3X", | ||
| 173 | .stream_name = "AIC3X", | ||
| 174 | .cpu_dai_name = "davinci-mcbsp.1", | ||
| 175 | .codec_dai_name = "tlv320aic3x-hifi", | ||
| 176 | .codec_name = "tlv320aic3x-codec.1-001b", | ||
| 166 | .platform_name = "davinci-pcm-audio", | 177 | .platform_name = "davinci-pcm-audio", |
| 167 | .init = evm_aic3x_init, | 178 | .init = evm_aic3x_init, |
| 168 | .ops = &evm_ops, | 179 | .ops = &evm_ops, |
| @@ -172,10 +183,10 @@ static struct snd_soc_dai_link dm365_evm_dai = { | |||
| 172 | #ifdef CONFIG_SND_DM365_AIC3X_CODEC | 183 | #ifdef CONFIG_SND_DM365_AIC3X_CODEC |
| 173 | .name = "TLV320AIC3X", | 184 | .name = "TLV320AIC3X", |
| 174 | .stream_name = "AIC3X", | 185 | .stream_name = "AIC3X", |
| 175 | .cpu_dai_name = "davinci-i2s", | 186 | .cpu_dai_name = "davinci-mcbsp", |
| 176 | .codec_dai_name = "tlv320aic3x-hifi", | 187 | .codec_dai_name = "tlv320aic3x-hifi", |
| 177 | .init = evm_aic3x_init, | 188 | .init = evm_aic3x_init, |
| 178 | .codec_name = "tlv320aic3x-codec.0-001a", | 189 | .codec_name = "tlv320aic3x-codec.1-0018", |
| 179 | .ops = &evm_ops, | 190 | .ops = &evm_ops, |
| 180 | #elif defined(CONFIG_SND_DM365_VOICE_CODEC) | 191 | #elif defined(CONFIG_SND_DM365_VOICE_CODEC) |
| 181 | .name = "Voice Codec - CQ93VC", | 192 | .name = "Voice Codec - CQ93VC", |
| @@ -219,10 +230,17 @@ static struct snd_soc_dai_link da8xx_evm_dai = { | |||
| 219 | .ops = &evm_ops, | 230 | .ops = &evm_ops, |
| 220 | }; | 231 | }; |
| 221 | 232 | ||
| 222 | /* davinci dm6446, dm355 evm audio machine driver */ | 233 | /* davinci dm6446 evm audio machine driver */ |
| 223 | static struct snd_soc_card snd_soc_card_evm = { | 234 | static struct snd_soc_card dm6446_snd_soc_card_evm = { |
| 224 | .name = "DaVinci EVM", | 235 | .name = "DaVinci DM6446 EVM", |
| 225 | .dai_link = &evm_dai, | 236 | .dai_link = &dm6446_evm_dai, |
| 237 | .num_links = 1, | ||
| 238 | }; | ||
| 239 | |||
| 240 | /* davinci dm355 evm audio machine driver */ | ||
| 241 | static struct snd_soc_card dm355_snd_soc_card_evm = { | ||
| 242 | .name = "DaVinci DM355 EVM", | ||
| 243 | .dai_link = &dm355_evm_dai, | ||
| 226 | .num_links = 1, | 244 | .num_links = 1, |
| 227 | }; | 245 | }; |
| 228 | 246 | ||
| @@ -261,10 +279,10 @@ static int __init evm_init(void) | |||
| 261 | int ret; | 279 | int ret; |
| 262 | 280 | ||
| 263 | if (machine_is_davinci_evm()) { | 281 | if (machine_is_davinci_evm()) { |
| 264 | evm_snd_dev_data = &snd_soc_card_evm; | 282 | evm_snd_dev_data = &dm6446_snd_soc_card_evm; |
| 265 | index = 0; | 283 | index = 0; |
| 266 | } else if (machine_is_davinci_dm355_evm()) { | 284 | } else if (machine_is_davinci_dm355_evm()) { |
| 267 | evm_snd_dev_data = &snd_soc_card_evm; | 285 | evm_snd_dev_data = &dm355_snd_soc_card_evm; |
| 268 | index = 1; | 286 | index = 1; |
| 269 | } else if (machine_is_davinci_dm365_evm()) { | 287 | } else if (machine_is_davinci_dm365_evm()) { |
| 270 | evm_snd_dev_data = &dm365_snd_soc_card_evm; | 288 | evm_snd_dev_data = &dm365_snd_soc_card_evm; |
diff --git a/sound/soc/davinci/davinci-i2s.c b/sound/soc/davinci/davinci-i2s.c index d46b545d41f4..9e0e565e6ed9 100644 --- a/sound/soc/davinci/davinci-i2s.c +++ b/sound/soc/davinci/davinci-i2s.c | |||
| @@ -426,9 +426,6 @@ static int davinci_i2s_hw_params(struct snd_pcm_substream *substream, | |||
| 426 | snd_pcm_format_t fmt; | 426 | snd_pcm_format_t fmt; |
| 427 | unsigned element_cnt = 1; | 427 | unsigned element_cnt = 1; |
| 428 | 428 | ||
| 429 | dai->capture_dma_data = dev->dma_params; | ||
| 430 | dai->playback_dma_data = dev->dma_params; | ||
| 431 | |||
| 432 | /* general line settings */ | 429 | /* general line settings */ |
| 433 | spcr = davinci_mcbsp_read_reg(dev, DAVINCI_MCBSP_SPCR_REG); | 430 | spcr = davinci_mcbsp_read_reg(dev, DAVINCI_MCBSP_SPCR_REG); |
| 434 | if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) { | 431 | if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) { |
| @@ -601,6 +598,15 @@ static int davinci_i2s_trigger(struct snd_pcm_substream *substream, int cmd, | |||
| 601 | return ret; | 598 | return ret; |
| 602 | } | 599 | } |
| 603 | 600 | ||
| 601 | static int davinci_i2s_startup(struct snd_pcm_substream *substream, | ||
| 602 | struct snd_soc_dai *dai) | ||
| 603 | { | ||
| 604 | struct davinci_mcbsp_dev *dev = snd_soc_dai_get_drvdata(dai); | ||
| 605 | |||
| 606 | snd_soc_dai_set_dma_data(dai, substream, dev->dma_params); | ||
| 607 | return 0; | ||
| 608 | } | ||
| 609 | |||
| 604 | static void davinci_i2s_shutdown(struct snd_pcm_substream *substream, | 610 | static void davinci_i2s_shutdown(struct snd_pcm_substream *substream, |
| 605 | struct snd_soc_dai *dai) | 611 | struct snd_soc_dai *dai) |
| 606 | { | 612 | { |
| @@ -612,6 +618,7 @@ static void davinci_i2s_shutdown(struct snd_pcm_substream *substream, | |||
| 612 | #define DAVINCI_I2S_RATES SNDRV_PCM_RATE_8000_96000 | 618 | #define DAVINCI_I2S_RATES SNDRV_PCM_RATE_8000_96000 |
| 613 | 619 | ||
| 614 | static struct snd_soc_dai_ops davinci_i2s_dai_ops = { | 620 | static struct snd_soc_dai_ops davinci_i2s_dai_ops = { |
| 621 | .startup = davinci_i2s_startup, | ||
| 615 | .shutdown = davinci_i2s_shutdown, | 622 | .shutdown = davinci_i2s_shutdown, |
| 616 | .prepare = davinci_i2s_prepare, | 623 | .prepare = davinci_i2s_prepare, |
| 617 | .trigger = davinci_i2s_trigger, | 624 | .trigger = davinci_i2s_trigger, |
| @@ -749,7 +756,7 @@ static struct platform_driver davinci_mcbsp_driver = { | |||
| 749 | .probe = davinci_i2s_probe, | 756 | .probe = davinci_i2s_probe, |
| 750 | .remove = davinci_i2s_remove, | 757 | .remove = davinci_i2s_remove, |
| 751 | .driver = { | 758 | .driver = { |
| 752 | .name = "davinci-i2s", | 759 | .name = "davinci-mcbsp", |
| 753 | .owner = THIS_MODULE, | 760 | .owner = THIS_MODULE, |
| 754 | }, | 761 | }, |
| 755 | }; | 762 | }; |
diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c index 86918ee12419..fb55d2c5d704 100644 --- a/sound/soc/davinci/davinci-mcasp.c +++ b/sound/soc/davinci/davinci-mcasp.c | |||
| @@ -715,9 +715,6 @@ static int davinci_mcasp_hw_params(struct snd_pcm_substream *substream, | |||
| 715 | int word_length; | 715 | int word_length; |
| 716 | u8 fifo_level; | 716 | u8 fifo_level; |
| 717 | 717 | ||
| 718 | cpu_dai->capture_dma_data = dev->dma_params; | ||
| 719 | cpu_dai->playback_dma_data = dev->dma_params; | ||
| 720 | |||
| 721 | davinci_hw_common_param(dev, substream->stream); | 718 | davinci_hw_common_param(dev, substream->stream); |
| 722 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | 719 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) |
| 723 | fifo_level = dev->txnumevt; | 720 | fifo_level = dev->txnumevt; |
| @@ -799,7 +796,17 @@ static int davinci_mcasp_trigger(struct snd_pcm_substream *substream, | |||
| 799 | return ret; | 796 | return ret; |
| 800 | } | 797 | } |
| 801 | 798 | ||
| 799 | static int davinci_mcasp_startup(struct snd_pcm_substream *substream, | ||
| 800 | struct snd_soc_dai *dai) | ||
| 801 | { | ||
| 802 | struct davinci_audio_dev *dev = snd_soc_dai_get_drvdata(dai); | ||
| 803 | |||
| 804 | snd_soc_dai_set_dma_data(dai, substream, dev->dma_params); | ||
| 805 | return 0; | ||
| 806 | } | ||
| 807 | |||
| 802 | static struct snd_soc_dai_ops davinci_mcasp_dai_ops = { | 808 | static struct snd_soc_dai_ops davinci_mcasp_dai_ops = { |
| 809 | .startup = davinci_mcasp_startup, | ||
| 803 | .trigger = davinci_mcasp_trigger, | 810 | .trigger = davinci_mcasp_trigger, |
| 804 | .hw_params = davinci_mcasp_hw_params, | 811 | .hw_params = davinci_mcasp_hw_params, |
| 805 | .set_fmt = davinci_mcasp_set_dai_fmt, | 812 | .set_fmt = davinci_mcasp_set_dai_fmt, |
diff --git a/sound/soc/davinci/davinci-sffsdr.c b/sound/soc/davinci/davinci-sffsdr.c index 009b6521a1bf..6c6666a1f942 100644 --- a/sound/soc/davinci/davinci-sffsdr.c +++ b/sound/soc/davinci/davinci-sffsdr.c | |||
| @@ -84,7 +84,7 @@ static struct snd_soc_ops sffsdr_ops = { | |||
| 84 | static struct snd_soc_dai_link sffsdr_dai = { | 84 | static struct snd_soc_dai_link sffsdr_dai = { |
| 85 | .name = "PCM3008", /* Codec name */ | 85 | .name = "PCM3008", /* Codec name */ |
| 86 | .stream_name = "PCM3008 HiFi", | 86 | .stream_name = "PCM3008 HiFi", |
| 87 | .cpu_dai_name = "davinci-asp.0", | 87 | .cpu_dai_name = "davinci-mcbsp", |
| 88 | .codec_dai_name = "pcm3008-hifi", | 88 | .codec_dai_name = "pcm3008-hifi", |
| 89 | .codec_name = "pcm3008-codec", | 89 | .codec_name = "pcm3008-codec", |
| 90 | .platform_name = "davinci-pcm-audio", | 90 | .platform_name = "davinci-pcm-audio", |
diff --git a/sound/soc/davinci/davinci-vcif.c b/sound/soc/davinci/davinci-vcif.c index ea232f6a2c21..fb4cc1edf339 100644 --- a/sound/soc/davinci/davinci-vcif.c +++ b/sound/soc/davinci/davinci-vcif.c | |||
| @@ -97,9 +97,6 @@ static int davinci_vcif_hw_params(struct snd_pcm_substream *substream, | |||
| 97 | &davinci_vcif_dev->dma_params[substream->stream]; | 97 | &davinci_vcif_dev->dma_params[substream->stream]; |
| 98 | u32 w; | 98 | u32 w; |
| 99 | 99 | ||
| 100 | dai->capture_dma_data = davinci_vcif_dev->dma_params; | ||
| 101 | dai->playback_dma_data = davinci_vcif_dev->dma_params; | ||
| 102 | |||
| 103 | /* Restart the codec before setup */ | 100 | /* Restart the codec before setup */ |
| 104 | davinci_vcif_stop(substream); | 101 | davinci_vcif_stop(substream); |
| 105 | davinci_vcif_start(substream); | 102 | davinci_vcif_start(substream); |
| @@ -174,9 +171,19 @@ static int davinci_vcif_trigger(struct snd_pcm_substream *substream, int cmd, | |||
| 174 | return ret; | 171 | return ret; |
| 175 | } | 172 | } |
| 176 | 173 | ||
| 174 | static int davinci_vcif_startup(struct snd_pcm_substream *substream, | ||
| 175 | struct snd_soc_dai *dai) | ||
| 176 | { | ||
| 177 | struct davinci_vcif_dev *dev = snd_soc_dai_get_drvdata(dai); | ||
| 178 | |||
| 179 | snd_soc_dai_set_dma_data(dai, substream, dev->dma_params); | ||
| 180 | return 0; | ||
| 181 | } | ||
| 182 | |||
| 177 | #define DAVINCI_VCIF_RATES SNDRV_PCM_RATE_8000_48000 | 183 | #define DAVINCI_VCIF_RATES SNDRV_PCM_RATE_8000_48000 |
| 178 | 184 | ||
| 179 | static struct snd_soc_dai_ops davinci_vcif_dai_ops = { | 185 | static struct snd_soc_dai_ops davinci_vcif_dai_ops = { |
| 186 | .startup = davinci_vcif_startup, | ||
| 180 | .trigger = davinci_vcif_trigger, | 187 | .trigger = davinci_vcif_trigger, |
| 181 | .hw_params = davinci_vcif_hw_params, | 188 | .hw_params = davinci_vcif_hw_params, |
| 182 | }; | 189 | }; |
diff --git a/sound/soc/fsl/mpc5200_psc_i2s.c b/sound/soc/fsl/mpc5200_psc_i2s.c index 74ffed41340f..9018fa5bf0db 100644 --- a/sound/soc/fsl/mpc5200_psc_i2s.c +++ b/sound/soc/fsl/mpc5200_psc_i2s.c | |||
| @@ -160,7 +160,7 @@ static int __devinit psc_i2s_of_probe(struct platform_device *op, | |||
| 160 | rc = snd_soc_register_dais(&op->dev, psc_i2s_dai, ARRAY_SIZE(psc_i2s_dai)); | 160 | rc = snd_soc_register_dais(&op->dev, psc_i2s_dai, ARRAY_SIZE(psc_i2s_dai)); |
| 161 | if (rc != 0) { | 161 | if (rc != 0) { |
| 162 | pr_err("Failed to register DAI\n"); | 162 | pr_err("Failed to register DAI\n"); |
| 163 | return 0; | 163 | return rc; |
| 164 | } | 164 | } |
| 165 | 165 | ||
| 166 | psc_dma = dev_get_drvdata(&op->dev); | 166 | psc_dma = dev_get_drvdata(&op->dev); |
diff --git a/sound/soc/imx/eukrea-tlv320.c b/sound/soc/imx/eukrea-tlv320.c index b59675257ce5..dd4fffdbd177 100644 --- a/sound/soc/imx/eukrea-tlv320.c +++ b/sound/soc/imx/eukrea-tlv320.c | |||
| @@ -34,8 +34,8 @@ static int eukrea_tlv320_hw_params(struct snd_pcm_substream *substream, | |||
| 34 | struct snd_pcm_hw_params *params) | 34 | struct snd_pcm_hw_params *params) |
| 35 | { | 35 | { |
| 36 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 36 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
| 37 | struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; | 37 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
| 38 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 38 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
| 39 | int ret; | 39 | int ret; |
| 40 | 40 | ||
| 41 | ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S | | 41 | ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S | |
| @@ -79,10 +79,10 @@ static struct snd_soc_ops eukrea_tlv320_snd_ops = { | |||
| 79 | static struct snd_soc_dai_link eukrea_tlv320_dai = { | 79 | static struct snd_soc_dai_link eukrea_tlv320_dai = { |
| 80 | .name = "tlv320aic23", | 80 | .name = "tlv320aic23", |
| 81 | .stream_name = "TLV320AIC23", | 81 | .stream_name = "TLV320AIC23", |
| 82 | .codec_dai = "tlv320aic23-hifi", | 82 | .codec_dai_name = "tlv320aic23-hifi", |
| 83 | .platform_name = "imx-pcm-audio.0", | 83 | .platform_name = "imx-pcm-audio.0", |
| 84 | .codec_name = "tlv320aic23-codec.0-001a", | 84 | .codec_name = "tlv320aic23-codec.0-001a", |
| 85 | .cpu_dai = "imx-ssi.0", | 85 | .cpu_dai_name = "imx-ssi.0", |
| 86 | .ops = &eukrea_tlv320_snd_ops, | 86 | .ops = &eukrea_tlv320_snd_ops, |
| 87 | }; | 87 | }; |
| 88 | 88 | ||
diff --git a/sound/soc/imx/imx-pcm-dma-mx2.c b/sound/soc/imx/imx-pcm-dma-mx2.c index fd493ee1428e..671ef8dd524c 100644 --- a/sound/soc/imx/imx-pcm-dma-mx2.c +++ b/sound/soc/imx/imx-pcm-dma-mx2.c | |||
| @@ -20,6 +20,7 @@ | |||
| 20 | #include <linux/module.h> | 20 | #include <linux/module.h> |
| 21 | #include <linux/platform_device.h> | 21 | #include <linux/platform_device.h> |
| 22 | #include <linux/slab.h> | 22 | #include <linux/slab.h> |
| 23 | #include <linux/dmaengine.h> | ||
| 23 | 24 | ||
| 24 | #include <sound/core.h> | 25 | #include <sound/core.h> |
| 25 | #include <sound/initval.h> | 26 | #include <sound/initval.h> |
| @@ -27,165 +28,146 @@ | |||
| 27 | #include <sound/pcm_params.h> | 28 | #include <sound/pcm_params.h> |
| 28 | #include <sound/soc.h> | 29 | #include <sound/soc.h> |
| 29 | 30 | ||
| 30 | #include <mach/dma-mx1-mx2.h> | 31 | #include <mach/dma.h> |
| 31 | 32 | ||
| 32 | #include "imx-ssi.h" | 33 | #include "imx-ssi.h" |
| 33 | 34 | ||
| 34 | struct imx_pcm_runtime_data { | 35 | struct imx_pcm_runtime_data { |
| 35 | int sg_count; | 36 | int period_bytes; |
| 36 | struct scatterlist *sg_list; | ||
| 37 | int period; | ||
| 38 | int periods; | 37 | int periods; |
| 39 | unsigned long dma_addr; | ||
| 40 | int dma; | 38 | int dma; |
| 41 | struct snd_pcm_substream *substream; | ||
| 42 | unsigned long offset; | 39 | unsigned long offset; |
| 43 | unsigned long size; | 40 | unsigned long size; |
| 44 | unsigned long period_cnt; | ||
| 45 | void *buf; | 41 | void *buf; |
| 46 | int period_time; | 42 | int period_time; |
| 43 | struct dma_async_tx_descriptor *desc; | ||
| 44 | struct dma_chan *dma_chan; | ||
| 45 | struct imx_dma_data dma_data; | ||
| 47 | }; | 46 | }; |
| 48 | 47 | ||
| 49 | /* Called by the DMA framework when a period has elapsed */ | 48 | static void audio_dma_irq(void *data) |
| 50 | static void imx_ssi_dma_progression(int channel, void *data, | ||
| 51 | struct scatterlist *sg) | ||
| 52 | { | 49 | { |
| 53 | struct snd_pcm_substream *substream = data; | 50 | struct snd_pcm_substream *substream = (struct snd_pcm_substream *)data; |
| 54 | struct snd_pcm_runtime *runtime = substream->runtime; | 51 | struct snd_pcm_runtime *runtime = substream->runtime; |
| 55 | struct imx_pcm_runtime_data *iprtd = runtime->private_data; | 52 | struct imx_pcm_runtime_data *iprtd = runtime->private_data; |
| 56 | 53 | ||
| 57 | if (!sg) | 54 | iprtd->offset += iprtd->period_bytes; |
| 58 | return; | 55 | iprtd->offset %= iprtd->period_bytes * iprtd->periods; |
| 59 | |||
| 60 | runtime = iprtd->substream->runtime; | ||
| 61 | 56 | ||
| 62 | iprtd->offset = sg->dma_address - runtime->dma_addr; | 57 | snd_pcm_period_elapsed(substream); |
| 63 | |||
| 64 | snd_pcm_period_elapsed(iprtd->substream); | ||
| 65 | } | 58 | } |
| 66 | 59 | ||
| 67 | static void imx_ssi_dma_callback(int channel, void *data) | 60 | static bool filter(struct dma_chan *chan, void *param) |
| 68 | { | 61 | { |
| 69 | pr_err("%s shouldn't be called\n", __func__); | 62 | struct imx_pcm_runtime_data *iprtd = param; |
| 70 | } | ||
| 71 | 63 | ||
| 72 | static void snd_imx_dma_err_callback(int channel, void *data, int err) | 64 | if (!imx_dma_is_general_purpose(chan)) |
| 73 | { | 65 | return false; |
| 74 | struct snd_pcm_substream *substream = data; | ||
| 75 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | ||
| 76 | struct imx_pcm_dma_params *dma_params = | ||
| 77 | snd_soc_dai_get_dma_data(rtd->dai->cpu_dai, substream); | ||
| 78 | struct snd_pcm_runtime *runtime = substream->runtime; | ||
| 79 | struct imx_pcm_runtime_data *iprtd = runtime->private_data; | ||
| 80 | int ret; | ||
| 81 | 66 | ||
| 82 | pr_err("DMA timeout on channel %d -%s%s%s%s\n", | 67 | chan->private = &iprtd->dma_data; |
| 83 | channel, | ||
| 84 | err & IMX_DMA_ERR_BURST ? " burst" : "", | ||
| 85 | err & IMX_DMA_ERR_REQUEST ? " request" : "", | ||
| 86 | err & IMX_DMA_ERR_TRANSFER ? " transfer" : "", | ||
| 87 | err & IMX_DMA_ERR_BUFFER ? " buffer" : ""); | ||
| 88 | 68 | ||
| 89 | imx_dma_disable(iprtd->dma); | 69 | return true; |
| 90 | ret = imx_dma_setup_sg(iprtd->dma, iprtd->sg_list, iprtd->sg_count, | ||
| 91 | IMX_DMA_LENGTH_LOOP, dma_params->dma_addr, | ||
| 92 | substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? | ||
| 93 | DMA_MODE_WRITE : DMA_MODE_READ); | ||
| 94 | if (!ret) | ||
| 95 | imx_dma_enable(iprtd->dma); | ||
| 96 | } | 70 | } |
| 97 | 71 | ||
| 98 | static int imx_ssi_dma_alloc(struct snd_pcm_substream *substream) | 72 | static int imx_ssi_dma_alloc(struct snd_pcm_substream *substream, |
| 73 | struct snd_pcm_hw_params *params) | ||
| 99 | { | 74 | { |
| 100 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 75 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
| 101 | struct imx_pcm_dma_params *dma_params; | 76 | struct imx_pcm_dma_params *dma_params; |
| 102 | struct snd_pcm_runtime *runtime = substream->runtime; | 77 | struct snd_pcm_runtime *runtime = substream->runtime; |
| 103 | struct imx_pcm_runtime_data *iprtd = runtime->private_data; | 78 | struct imx_pcm_runtime_data *iprtd = runtime->private_data; |
| 79 | struct dma_slave_config slave_config; | ||
| 80 | dma_cap_mask_t mask; | ||
| 81 | enum dma_slave_buswidth buswidth; | ||
| 104 | int ret; | 82 | int ret; |
| 105 | 83 | ||
| 106 | dma_params = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); | 84 | dma_params = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); |
| 107 | 85 | ||
| 108 | iprtd->dma = imx_dma_request_by_prio(DRV_NAME, DMA_PRIO_HIGH); | 86 | iprtd->dma_data.peripheral_type = IMX_DMATYPE_SSI; |
| 109 | if (iprtd->dma < 0) { | 87 | iprtd->dma_data.priority = DMA_PRIO_HIGH; |
| 110 | pr_err("Failed to claim the audio DMA\n"); | 88 | iprtd->dma_data.dma_request = dma_params->dma; |
| 111 | return -ENODEV; | ||
| 112 | } | ||
| 113 | 89 | ||
| 114 | ret = imx_dma_setup_handlers(iprtd->dma, | 90 | /* Try to grab a DMA channel */ |
| 115 | imx_ssi_dma_callback, | 91 | dma_cap_zero(mask); |
| 116 | snd_imx_dma_err_callback, substream); | 92 | dma_cap_set(DMA_SLAVE, mask); |
| 117 | if (ret) | 93 | iprtd->dma_chan = dma_request_channel(mask, filter, iprtd); |
| 118 | goto out; | 94 | if (!iprtd->dma_chan) |
| 95 | return -EINVAL; | ||
| 119 | 96 | ||
| 120 | ret = imx_dma_setup_progression_handler(iprtd->dma, | 97 | switch (params_format(params)) { |
| 121 | imx_ssi_dma_progression); | 98 | case SNDRV_PCM_FORMAT_S16_LE: |
| 122 | if (ret) { | 99 | buswidth = DMA_SLAVE_BUSWIDTH_2_BYTES; |
| 123 | pr_err("Failed to setup the DMA handler\n"); | 100 | break; |
| 124 | goto out; | 101 | case SNDRV_PCM_FORMAT_S20_3LE: |
| 102 | case SNDRV_PCM_FORMAT_S24_LE: | ||
| 103 | buswidth = DMA_SLAVE_BUSWIDTH_4_BYTES; | ||
| 104 | break; | ||
| 105 | default: | ||
| 106 | return 0; | ||
| 125 | } | 107 | } |
| 126 | 108 | ||
| 127 | ret = imx_dma_config_channel(iprtd->dma, | 109 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { |
| 128 | IMX_DMA_MEMSIZE_16 | IMX_DMA_TYPE_FIFO, | 110 | slave_config.direction = DMA_TO_DEVICE; |
| 129 | IMX_DMA_MEMSIZE_32 | IMX_DMA_TYPE_LINEAR, | 111 | slave_config.dst_addr = dma_params->dma_addr; |
| 130 | dma_params->dma, 1); | 112 | slave_config.dst_addr_width = buswidth; |
| 131 | if (ret < 0) { | 113 | slave_config.dst_maxburst = dma_params->burstsize; |
| 132 | pr_err("Cannot configure DMA channel: %d\n", ret); | 114 | } else { |
| 133 | goto out; | 115 | slave_config.direction = DMA_FROM_DEVICE; |
| 116 | slave_config.src_addr = dma_params->dma_addr; | ||
| 117 | slave_config.src_addr_width = buswidth; | ||
| 118 | slave_config.src_maxburst = dma_params->burstsize; | ||
| 134 | } | 119 | } |
| 135 | 120 | ||
| 136 | imx_dma_config_burstlen(iprtd->dma, dma_params->burstsize * 2); | 121 | ret = dmaengine_slave_config(iprtd->dma_chan, &slave_config); |
| 122 | if (ret) | ||
| 123 | return ret; | ||
| 137 | 124 | ||
| 138 | return 0; | 125 | return 0; |
| 139 | out: | ||
| 140 | imx_dma_free(iprtd->dma); | ||
| 141 | return ret; | ||
| 142 | } | 126 | } |
| 143 | 127 | ||
| 144 | static int snd_imx_pcm_hw_params(struct snd_pcm_substream *substream, | 128 | static int snd_imx_pcm_hw_params(struct snd_pcm_substream *substream, |
| 145 | struct snd_pcm_hw_params *params) | 129 | struct snd_pcm_hw_params *params) |
| 146 | { | 130 | { |
| 131 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | ||
| 147 | struct snd_pcm_runtime *runtime = substream->runtime; | 132 | struct snd_pcm_runtime *runtime = substream->runtime; |
| 148 | struct imx_pcm_runtime_data *iprtd = runtime->private_data; | 133 | struct imx_pcm_runtime_data *iprtd = runtime->private_data; |
| 149 | int i; | ||
| 150 | unsigned long dma_addr; | 134 | unsigned long dma_addr; |
| 135 | struct dma_chan *chan; | ||
| 136 | struct imx_pcm_dma_params *dma_params; | ||
| 137 | int ret; | ||
| 151 | 138 | ||
| 152 | imx_ssi_dma_alloc(substream); | 139 | dma_params = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); |
| 140 | ret = imx_ssi_dma_alloc(substream, params); | ||
| 141 | if (ret) | ||
| 142 | return ret; | ||
| 143 | chan = iprtd->dma_chan; | ||
| 153 | 144 | ||
| 154 | iprtd->size = params_buffer_bytes(params); | 145 | iprtd->size = params_buffer_bytes(params); |
| 155 | iprtd->periods = params_periods(params); | 146 | iprtd->periods = params_periods(params); |
| 156 | iprtd->period = params_period_bytes(params); | 147 | iprtd->period_bytes = params_period_bytes(params); |
| 157 | iprtd->offset = 0; | 148 | iprtd->offset = 0; |
| 158 | iprtd->period_time = HZ / (params_rate(params) / | 149 | iprtd->period_time = HZ / (params_rate(params) / |
| 159 | params_period_size(params)); | 150 | params_period_size(params)); |
| 160 | 151 | ||
| 161 | snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer); | 152 | snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer); |
| 162 | 153 | ||
| 163 | if (iprtd->sg_count != iprtd->periods) { | ||
| 164 | kfree(iprtd->sg_list); | ||
| 165 | |||
| 166 | iprtd->sg_list = kcalloc(iprtd->periods + 1, | ||
| 167 | sizeof(struct scatterlist), GFP_KERNEL); | ||
| 168 | if (!iprtd->sg_list) | ||
| 169 | return -ENOMEM; | ||
| 170 | iprtd->sg_count = iprtd->periods + 1; | ||
| 171 | } | ||
| 172 | |||
| 173 | sg_init_table(iprtd->sg_list, iprtd->sg_count); | ||
| 174 | dma_addr = runtime->dma_addr; | 154 | dma_addr = runtime->dma_addr; |
| 175 | 155 | ||
| 176 | for (i = 0; i < iprtd->periods; i++) { | 156 | iprtd->buf = (unsigned int *)substream->dma_buffer.area; |
| 177 | iprtd->sg_list[i].page_link = 0; | 157 | |
| 178 | iprtd->sg_list[i].offset = 0; | 158 | iprtd->desc = chan->device->device_prep_dma_cyclic(chan, dma_addr, |
| 179 | iprtd->sg_list[i].dma_address = dma_addr; | 159 | iprtd->period_bytes * iprtd->periods, |
| 180 | iprtd->sg_list[i].length = iprtd->period; | 160 | iprtd->period_bytes, |
| 181 | dma_addr += iprtd->period; | 161 | substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? |
| 162 | DMA_TO_DEVICE : DMA_FROM_DEVICE); | ||
| 163 | if (!iprtd->desc) { | ||
| 164 | dev_err(&chan->dev->device, "cannot prepare slave dma\n"); | ||
| 165 | return -EINVAL; | ||
| 182 | } | 166 | } |
| 183 | 167 | ||
| 184 | /* close the loop */ | 168 | iprtd->desc->callback = audio_dma_irq; |
| 185 | iprtd->sg_list[iprtd->sg_count - 1].offset = 0; | 169 | iprtd->desc->callback_param = substream; |
| 186 | iprtd->sg_list[iprtd->sg_count - 1].length = 0; | 170 | |
| 187 | iprtd->sg_list[iprtd->sg_count - 1].page_link = | ||
| 188 | ((unsigned long) iprtd->sg_list | 0x01) & ~0x02; | ||
| 189 | return 0; | 171 | return 0; |
| 190 | } | 172 | } |
| 191 | 173 | ||
| @@ -194,41 +176,21 @@ static int snd_imx_pcm_hw_free(struct snd_pcm_substream *substream) | |||
| 194 | struct snd_pcm_runtime *runtime = substream->runtime; | 176 | struct snd_pcm_runtime *runtime = substream->runtime; |
| 195 | struct imx_pcm_runtime_data *iprtd = runtime->private_data; | 177 | struct imx_pcm_runtime_data *iprtd = runtime->private_data; |
| 196 | 178 | ||
| 197 | if (iprtd->dma >= 0) { | 179 | if (iprtd->dma_chan) { |
| 198 | imx_dma_free(iprtd->dma); | 180 | dma_release_channel(iprtd->dma_chan); |
| 199 | iprtd->dma = -EINVAL; | 181 | iprtd->dma_chan = NULL; |
| 200 | } | 182 | } |
| 201 | 183 | ||
| 202 | kfree(iprtd->sg_list); | ||
| 203 | iprtd->sg_list = NULL; | ||
| 204 | |||
| 205 | return 0; | 184 | return 0; |
| 206 | } | 185 | } |
| 207 | 186 | ||
| 208 | static int snd_imx_pcm_prepare(struct snd_pcm_substream *substream) | 187 | static int snd_imx_pcm_prepare(struct snd_pcm_substream *substream) |
| 209 | { | 188 | { |
| 210 | struct snd_pcm_runtime *runtime = substream->runtime; | ||
| 211 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 189 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
| 212 | struct imx_pcm_dma_params *dma_params; | 190 | struct imx_pcm_dma_params *dma_params; |
| 213 | struct imx_pcm_runtime_data *iprtd = runtime->private_data; | ||
| 214 | int err; | ||
| 215 | 191 | ||
| 216 | dma_params = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); | 192 | dma_params = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); |
| 217 | 193 | ||
| 218 | iprtd->substream = substream; | ||
| 219 | iprtd->buf = (unsigned int *)substream->dma_buffer.area; | ||
| 220 | iprtd->period_cnt = 0; | ||
| 221 | |||
| 222 | pr_debug("%s: buf: %p period: %d periods: %d\n", | ||
| 223 | __func__, iprtd->buf, iprtd->period, iprtd->periods); | ||
| 224 | |||
| 225 | err = imx_dma_setup_sg(iprtd->dma, iprtd->sg_list, iprtd->sg_count, | ||
| 226 | IMX_DMA_LENGTH_LOOP, dma_params->dma_addr, | ||
| 227 | substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? | ||
| 228 | DMA_MODE_WRITE : DMA_MODE_READ); | ||
| 229 | if (err) | ||
| 230 | return err; | ||
| 231 | |||
| 232 | return 0; | 194 | return 0; |
| 233 | } | 195 | } |
| 234 | 196 | ||
| @@ -241,14 +203,14 @@ static int snd_imx_pcm_trigger(struct snd_pcm_substream *substream, int cmd) | |||
| 241 | case SNDRV_PCM_TRIGGER_START: | 203 | case SNDRV_PCM_TRIGGER_START: |
| 242 | case SNDRV_PCM_TRIGGER_RESUME: | 204 | case SNDRV_PCM_TRIGGER_RESUME: |
| 243 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: | 205 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: |
| 244 | imx_dma_enable(iprtd->dma); | 206 | dmaengine_submit(iprtd->desc); |
| 245 | 207 | ||
| 246 | break; | 208 | break; |
| 247 | 209 | ||
| 248 | case SNDRV_PCM_TRIGGER_STOP: | 210 | case SNDRV_PCM_TRIGGER_STOP: |
| 249 | case SNDRV_PCM_TRIGGER_SUSPEND: | 211 | case SNDRV_PCM_TRIGGER_SUSPEND: |
| 250 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: | 212 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: |
| 251 | imx_dma_disable(iprtd->dma); | 213 | dmaengine_terminate_all(iprtd->dma_chan); |
| 252 | 214 | ||
| 253 | break; | 215 | break; |
| 254 | default: | 216 | default: |
| @@ -263,6 +225,9 @@ static snd_pcm_uframes_t snd_imx_pcm_pointer(struct snd_pcm_substream *substream | |||
| 263 | struct snd_pcm_runtime *runtime = substream->runtime; | 225 | struct snd_pcm_runtime *runtime = substream->runtime; |
| 264 | struct imx_pcm_runtime_data *iprtd = runtime->private_data; | 226 | struct imx_pcm_runtime_data *iprtd = runtime->private_data; |
| 265 | 227 | ||
| 228 | pr_debug("%s: %ld %ld\n", __func__, iprtd->offset, | ||
| 229 | bytes_to_frames(substream->runtime, iprtd->offset)); | ||
| 230 | |||
| 266 | return bytes_to_frames(substream->runtime, iprtd->offset); | 231 | return bytes_to_frames(substream->runtime, iprtd->offset); |
| 267 | } | 232 | } |
| 268 | 233 | ||
| @@ -279,7 +244,7 @@ static struct snd_pcm_hardware snd_imx_hardware = { | |||
| 279 | .channels_max = 2, | 244 | .channels_max = 2, |
| 280 | .buffer_bytes_max = IMX_SSI_DMABUF_SIZE, | 245 | .buffer_bytes_max = IMX_SSI_DMABUF_SIZE, |
| 281 | .period_bytes_min = 128, | 246 | .period_bytes_min = 128, |
| 282 | .period_bytes_max = 16 * 1024, | 247 | .period_bytes_max = 65535, /* Limited by SDMA engine */ |
| 283 | .periods_min = 2, | 248 | .periods_min = 2, |
| 284 | .periods_max = 255, | 249 | .periods_max = 255, |
| 285 | .fifo_size = 0, | 250 | .fifo_size = 0, |
| @@ -304,11 +269,23 @@ static int snd_imx_open(struct snd_pcm_substream *substream) | |||
| 304 | } | 269 | } |
| 305 | 270 | ||
| 306 | snd_soc_set_runtime_hwparams(substream, &snd_imx_hardware); | 271 | snd_soc_set_runtime_hwparams(substream, &snd_imx_hardware); |
| 272 | |||
| 273 | return 0; | ||
| 274 | } | ||
| 275 | |||
| 276 | static int snd_imx_close(struct snd_pcm_substream *substream) | ||
| 277 | { | ||
| 278 | struct snd_pcm_runtime *runtime = substream->runtime; | ||
| 279 | struct imx_pcm_runtime_data *iprtd = runtime->private_data; | ||
| 280 | |||
| 281 | kfree(iprtd); | ||
| 282 | |||
| 307 | return 0; | 283 | return 0; |
| 308 | } | 284 | } |
| 309 | 285 | ||
| 310 | static struct snd_pcm_ops imx_pcm_ops = { | 286 | static struct snd_pcm_ops imx_pcm_ops = { |
| 311 | .open = snd_imx_open, | 287 | .open = snd_imx_open, |
| 288 | .close = snd_imx_close, | ||
| 312 | .ioctl = snd_pcm_lib_ioctl, | 289 | .ioctl = snd_pcm_lib_ioctl, |
| 313 | .hw_params = snd_imx_pcm_hw_params, | 290 | .hw_params = snd_imx_pcm_hw_params, |
| 314 | .hw_free = snd_imx_pcm_hw_free, | 291 | .hw_free = snd_imx_pcm_hw_free, |
| @@ -340,7 +317,6 @@ static struct platform_driver imx_pcm_driver = { | |||
| 340 | .name = "imx-pcm-audio", | 317 | .name = "imx-pcm-audio", |
| 341 | .owner = THIS_MODULE, | 318 | .owner = THIS_MODULE, |
| 342 | }, | 319 | }, |
| 343 | |||
| 344 | .probe = imx_soc_platform_probe, | 320 | .probe = imx_soc_platform_probe, |
| 345 | .remove = __devexit_p(imx_soc_platform_remove), | 321 | .remove = __devexit_p(imx_soc_platform_remove), |
| 346 | }; | 322 | }; |
| @@ -356,4 +332,3 @@ static void __exit snd_imx_pcm_exit(void) | |||
| 356 | platform_driver_unregister(&imx_pcm_driver); | 332 | platform_driver_unregister(&imx_pcm_driver); |
| 357 | } | 333 | } |
| 358 | module_exit(snd_imx_pcm_exit); | 334 | module_exit(snd_imx_pcm_exit); |
| 359 | |||
diff --git a/sound/soc/imx/imx-ssi.c b/sound/soc/imx/imx-ssi.c index d4bd345b0a8d..d2d98c75ee8a 100644 --- a/sound/soc/imx/imx-ssi.c +++ b/sound/soc/imx/imx-ssi.c | |||
| @@ -439,7 +439,22 @@ void imx_pcm_free(struct snd_pcm *pcm) | |||
| 439 | } | 439 | } |
| 440 | EXPORT_SYMBOL_GPL(imx_pcm_free); | 440 | EXPORT_SYMBOL_GPL(imx_pcm_free); |
| 441 | 441 | ||
| 442 | static int imx_ssi_dai_probe(struct snd_soc_dai *dai) | ||
| 443 | { | ||
| 444 | struct imx_ssi *ssi = dev_get_drvdata(dai->dev); | ||
| 445 | uint32_t val; | ||
| 446 | |||
| 447 | snd_soc_dai_set_drvdata(dai, ssi); | ||
| 448 | |||
| 449 | val = SSI_SFCSR_TFWM0(ssi->dma_params_tx.burstsize) | | ||
| 450 | SSI_SFCSR_RFWM0(ssi->dma_params_rx.burstsize); | ||
| 451 | writel(val, ssi->base + SSI_SFCSR); | ||
| 452 | |||
| 453 | return 0; | ||
| 454 | } | ||
| 455 | |||
| 442 | static struct snd_soc_dai_driver imx_ssi_dai = { | 456 | static struct snd_soc_dai_driver imx_ssi_dai = { |
| 457 | .probe = imx_ssi_dai_probe, | ||
| 443 | .playback = { | 458 | .playback = { |
| 444 | .channels_min = 2, | 459 | .channels_min = 2, |
| 445 | .channels_max = 2, | 460 | .channels_max = 2, |
| @@ -455,20 +470,6 @@ static struct snd_soc_dai_driver imx_ssi_dai = { | |||
| 455 | .ops = &imx_ssi_pcm_dai_ops, | 470 | .ops = &imx_ssi_pcm_dai_ops, |
| 456 | }; | 471 | }; |
| 457 | 472 | ||
| 458 | static int imx_ssi_dai_probe(struct snd_soc_dai *dai) | ||
| 459 | { | ||
| 460 | struct imx_ssi *ssi = dev_get_drvdata(dai->dev); | ||
| 461 | uint32_t val; | ||
| 462 | |||
| 463 | snd_soc_dai_set_drvdata(dai, ssi); | ||
| 464 | |||
| 465 | val = SSI_SFCSR_TFWM0(ssi->dma_params_tx.burstsize) | | ||
| 466 | SSI_SFCSR_RFWM0(ssi->dma_params_rx.burstsize); | ||
| 467 | writel(val, ssi->base + SSI_SFCSR); | ||
| 468 | |||
| 469 | return 0; | ||
| 470 | } | ||
| 471 | |||
| 472 | static struct snd_soc_dai_driver imx_ac97_dai = { | 473 | static struct snd_soc_dai_driver imx_ac97_dai = { |
| 473 | .probe = imx_ssi_dai_probe, | 474 | .probe = imx_ssi_dai_probe, |
| 474 | .ac97_control = 1, | 475 | .ac97_control = 1, |
| @@ -677,7 +678,17 @@ static int imx_ssi_probe(struct platform_device *pdev) | |||
| 677 | goto failed_register; | 678 | goto failed_register; |
| 678 | } | 679 | } |
| 679 | 680 | ||
| 680 | ssi->soc_platform_pdev = platform_device_alloc("imx-fiq-pcm-audio", pdev->id); | 681 | ssi->soc_platform_pdev_fiq = platform_device_alloc("imx-fiq-pcm-audio", pdev->id); |
| 682 | if (!ssi->soc_platform_pdev_fiq) | ||
| 683 | goto failed_pdev_fiq_alloc; | ||
| 684 | platform_set_drvdata(ssi->soc_platform_pdev_fiq, ssi); | ||
| 685 | ret = platform_device_add(ssi->soc_platform_pdev_fiq); | ||
| 686 | if (ret) { | ||
| 687 | dev_err(&pdev->dev, "failed to add platform device\n"); | ||
| 688 | goto failed_pdev_fiq_add; | ||
| 689 | } | ||
| 690 | |||
| 691 | ssi->soc_platform_pdev = platform_device_alloc("imx-pcm-audio", pdev->id); | ||
| 681 | if (!ssi->soc_platform_pdev) | 692 | if (!ssi->soc_platform_pdev) |
| 682 | goto failed_pdev_alloc; | 693 | goto failed_pdev_alloc; |
| 683 | platform_set_drvdata(ssi->soc_platform_pdev, ssi); | 694 | platform_set_drvdata(ssi->soc_platform_pdev, ssi); |
| @@ -692,6 +703,9 @@ static int imx_ssi_probe(struct platform_device *pdev) | |||
| 692 | failed_pdev_add: | 703 | failed_pdev_add: |
| 693 | platform_device_put(ssi->soc_platform_pdev); | 704 | platform_device_put(ssi->soc_platform_pdev); |
| 694 | failed_pdev_alloc: | 705 | failed_pdev_alloc: |
| 706 | failed_pdev_fiq_add: | ||
| 707 | platform_device_put(ssi->soc_platform_pdev_fiq); | ||
| 708 | failed_pdev_fiq_alloc: | ||
| 695 | snd_soc_unregister_dai(&pdev->dev); | 709 | snd_soc_unregister_dai(&pdev->dev); |
| 696 | failed_register: | 710 | failed_register: |
| 697 | failed_ac97: | 711 | failed_ac97: |
diff --git a/sound/soc/imx/imx-ssi.h b/sound/soc/imx/imx-ssi.h index 53b780d9b2b0..a4406a134892 100644 --- a/sound/soc/imx/imx-ssi.h +++ b/sound/soc/imx/imx-ssi.h | |||
| @@ -185,6 +185,9 @@ | |||
| 185 | 185 | ||
| 186 | #define DRV_NAME "imx-ssi" | 186 | #define DRV_NAME "imx-ssi" |
| 187 | 187 | ||
| 188 | #include <linux/dmaengine.h> | ||
| 189 | #include <mach/dma.h> | ||
| 190 | |||
| 188 | struct imx_pcm_dma_params { | 191 | struct imx_pcm_dma_params { |
| 189 | int dma; | 192 | int dma; |
| 190 | unsigned long dma_addr; | 193 | unsigned long dma_addr; |
| @@ -212,6 +215,7 @@ struct imx_ssi { | |||
| 212 | int enabled; | 215 | int enabled; |
| 213 | 216 | ||
| 214 | struct platform_device *soc_platform_pdev; | 217 | struct platform_device *soc_platform_pdev; |
| 218 | struct platform_device *soc_platform_pdev_fiq; | ||
| 215 | }; | 219 | }; |
| 216 | 220 | ||
| 217 | struct snd_soc_platform *imx_ssi_fiq_init(struct platform_device *pdev, | 221 | struct snd_soc_platform *imx_ssi_fiq_init(struct platform_device *pdev, |
diff --git a/sound/soc/imx/phycore-ac97.c b/sound/soc/imx/phycore-ac97.c index 6a65dd705519..39f23734781a 100644 --- a/sound/soc/imx/phycore-ac97.c +++ b/sound/soc/imx/phycore-ac97.c | |||
| @@ -20,9 +20,6 @@ | |||
| 20 | #include <sound/soc-dapm.h> | 20 | #include <sound/soc-dapm.h> |
| 21 | #include <asm/mach-types.h> | 21 | #include <asm/mach-types.h> |
| 22 | 22 | ||
| 23 | #include "../codecs/wm9712.h" | ||
| 24 | #include "imx-ssi.h" | ||
| 25 | |||
| 26 | static struct snd_soc_card imx_phycore; | 23 | static struct snd_soc_card imx_phycore; |
| 27 | 24 | ||
| 28 | static struct snd_soc_ops imx_phycore_hifi_ops = { | 25 | static struct snd_soc_ops imx_phycore_hifi_ops = { |
| @@ -41,7 +38,7 @@ static struct snd_soc_dai_link imx_phycore_dai_ac97[] = { | |||
| 41 | }; | 38 | }; |
| 42 | 39 | ||
| 43 | static struct snd_soc_card imx_phycore = { | 40 | static struct snd_soc_card imx_phycore = { |
| 44 | .name = "PhyCORE-audio", | 41 | .name = "PhyCORE-ac97-audio", |
| 45 | .dai_link = imx_phycore_dai_ac97, | 42 | .dai_link = imx_phycore_dai_ac97, |
| 46 | .num_links = ARRAY_SIZE(imx_phycore_dai_ac97), | 43 | .num_links = ARRAY_SIZE(imx_phycore_dai_ac97), |
| 47 | }; | 44 | }; |
diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c index d211c9fa5a91..7e84f24b9a88 100644 --- a/sound/soc/omap/omap-mcbsp.c +++ b/sound/soc/omap/omap-mcbsp.c | |||
| @@ -644,15 +644,23 @@ static int omap_mcbsp_dai_set_dai_sysclk(struct snd_soc_dai *cpu_dai, | |||
| 644 | 644 | ||
| 645 | 645 | ||
| 646 | case OMAP_MCBSP_CLKR_SRC_CLKR: | 646 | case OMAP_MCBSP_CLKR_SRC_CLKR: |
| 647 | if (cpu_class_is_omap1()) | ||
| 648 | break; | ||
| 647 | omap2_mcbsp1_mux_clkr_src(CLKR_SRC_CLKR); | 649 | omap2_mcbsp1_mux_clkr_src(CLKR_SRC_CLKR); |
| 648 | break; | 650 | break; |
| 649 | case OMAP_MCBSP_CLKR_SRC_CLKX: | 651 | case OMAP_MCBSP_CLKR_SRC_CLKX: |
| 652 | if (cpu_class_is_omap1()) | ||
| 653 | break; | ||
| 650 | omap2_mcbsp1_mux_clkr_src(CLKR_SRC_CLKX); | 654 | omap2_mcbsp1_mux_clkr_src(CLKR_SRC_CLKX); |
| 651 | break; | 655 | break; |
| 652 | case OMAP_MCBSP_FSR_SRC_FSR: | 656 | case OMAP_MCBSP_FSR_SRC_FSR: |
| 657 | if (cpu_class_is_omap1()) | ||
| 658 | break; | ||
| 653 | omap2_mcbsp1_mux_fsr_src(FSR_SRC_FSR); | 659 | omap2_mcbsp1_mux_fsr_src(FSR_SRC_FSR); |
| 654 | break; | 660 | break; |
| 655 | case OMAP_MCBSP_FSR_SRC_FSX: | 661 | case OMAP_MCBSP_FSR_SRC_FSX: |
| 662 | if (cpu_class_is_omap1()) | ||
| 663 | break; | ||
| 656 | omap2_mcbsp1_mux_fsr_src(FSR_SRC_FSX); | 664 | omap2_mcbsp1_mux_fsr_src(FSR_SRC_FSX); |
| 657 | break; | 665 | break; |
| 658 | default: | 666 | default: |
diff --git a/sound/soc/pxa/corgi.c b/sound/soc/pxa/corgi.c index 97e9423615c9..f451acd4935b 100644 --- a/sound/soc/pxa/corgi.c +++ b/sound/soc/pxa/corgi.c | |||
| @@ -100,8 +100,13 @@ static int corgi_startup(struct snd_pcm_substream *substream) | |||
| 100 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 100 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
| 101 | struct snd_soc_codec *codec = rtd->codec; | 101 | struct snd_soc_codec *codec = rtd->codec; |
| 102 | 102 | ||
| 103 | mutex_lock(&codec->mutex); | ||
| 104 | |||
| 103 | /* check the jack status at stream startup */ | 105 | /* check the jack status at stream startup */ |
| 104 | corgi_ext_control(codec); | 106 | corgi_ext_control(codec); |
| 107 | |||
| 108 | mutex_unlock(&codec->mutex); | ||
| 109 | |||
| 105 | return 0; | 110 | return 0; |
| 106 | } | 111 | } |
| 107 | 112 | ||
diff --git a/sound/soc/pxa/magician.c b/sound/soc/pxa/magician.c index b8207ced4072..5ef0526924b9 100644 --- a/sound/soc/pxa/magician.c +++ b/sound/soc/pxa/magician.c | |||
| @@ -72,9 +72,13 @@ static int magician_startup(struct snd_pcm_substream *substream) | |||
| 72 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 72 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
| 73 | struct snd_soc_codec *codec = rtd->codec; | 73 | struct snd_soc_codec *codec = rtd->codec; |
| 74 | 74 | ||
| 75 | mutex_lock(&codec->mutex); | ||
| 76 | |||
| 75 | /* check the jack status at stream startup */ | 77 | /* check the jack status at stream startup */ |
| 76 | magician_ext_control(codec); | 78 | magician_ext_control(codec); |
| 77 | 79 | ||
| 80 | mutex_unlock(&codec->mutex); | ||
| 81 | |||
| 78 | return 0; | 82 | return 0; |
| 79 | } | 83 | } |
| 80 | 84 | ||
diff --git a/sound/soc/pxa/poodle.c b/sound/soc/pxa/poodle.c index af84ee9c5e11..84edd0385a21 100644 --- a/sound/soc/pxa/poodle.c +++ b/sound/soc/pxa/poodle.c | |||
| @@ -77,8 +77,13 @@ static int poodle_startup(struct snd_pcm_substream *substream) | |||
| 77 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 77 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
| 78 | struct snd_soc_codec *codec = rtd->codec; | 78 | struct snd_soc_codec *codec = rtd->codec; |
| 79 | 79 | ||
| 80 | mutex_lock(&codec->mutex); | ||
| 81 | |||
| 80 | /* check the jack status at stream startup */ | 82 | /* check the jack status at stream startup */ |
| 81 | poodle_ext_control(codec); | 83 | poodle_ext_control(codec); |
| 84 | |||
| 85 | mutex_unlock(&codec->mutex); | ||
| 86 | |||
| 82 | return 0; | 87 | return 0; |
| 83 | } | 88 | } |
| 84 | 89 | ||
diff --git a/sound/soc/pxa/spitz.c b/sound/soc/pxa/spitz.c index f470f360f4dd..0b30d7de24ec 100644 --- a/sound/soc/pxa/spitz.c +++ b/sound/soc/pxa/spitz.c | |||
| @@ -108,8 +108,13 @@ static int spitz_startup(struct snd_pcm_substream *substream) | |||
| 108 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 108 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
| 109 | struct snd_soc_codec *codec = rtd->codec; | 109 | struct snd_soc_codec *codec = rtd->codec; |
| 110 | 110 | ||
| 111 | mutex_lock(&codec->mutex); | ||
| 112 | |||
| 111 | /* check the jack status at stream startup */ | 113 | /* check the jack status at stream startup */ |
| 112 | spitz_ext_control(codec); | 114 | spitz_ext_control(codec); |
| 115 | |||
| 116 | mutex_unlock(&codec->mutex); | ||
| 117 | |||
| 113 | return 0; | 118 | return 0; |
| 114 | } | 119 | } |
| 115 | 120 | ||
diff --git a/sound/soc/pxa/tosa.c b/sound/soc/pxa/tosa.c index 73d0edd8ded9..7b983f935454 100644 --- a/sound/soc/pxa/tosa.c +++ b/sound/soc/pxa/tosa.c | |||
| @@ -81,8 +81,13 @@ static int tosa_startup(struct snd_pcm_substream *substream) | |||
| 81 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 81 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
| 82 | struct snd_soc_codec *codec = rtd->codec; | 82 | struct snd_soc_codec *codec = rtd->codec; |
| 83 | 83 | ||
| 84 | mutex_lock(&codec->mutex); | ||
| 85 | |||
| 84 | /* check the jack status at stream startup */ | 86 | /* check the jack status at stream startup */ |
| 85 | tosa_ext_control(codec); | 87 | tosa_ext_control(codec); |
| 88 | |||
| 89 | mutex_unlock(&codec->mutex); | ||
| 90 | |||
| 86 | return 0; | 91 | return 0; |
| 87 | } | 92 | } |
| 88 | 93 | ||
diff --git a/sound/soc/s3c24xx/Kconfig b/sound/soc/s3c24xx/Kconfig index 8a6b53ccd203..d85bf8a0abb2 100644 --- a/sound/soc/s3c24xx/Kconfig +++ b/sound/soc/s3c24xx/Kconfig | |||
| @@ -2,6 +2,7 @@ config SND_S3C24XX_SOC | |||
| 2 | tristate "SoC Audio for the Samsung S3CXXXX chips" | 2 | tristate "SoC Audio for the Samsung S3CXXXX chips" |
| 3 | depends on ARCH_S3C2410 || ARCH_S3C64XX || ARCH_S5PC100 || ARCH_S5PV210 | 3 | depends on ARCH_S3C2410 || ARCH_S3C64XX || ARCH_S5PC100 || ARCH_S5PV210 |
| 4 | select S3C64XX_DMA if ARCH_S3C64XX | 4 | select S3C64XX_DMA if ARCH_S3C64XX |
| 5 | select S3C2410_DMA if ARCH_S3C2410 | ||
| 5 | help | 6 | help |
| 6 | Say Y or M if you want to add support for codecs attached to | 7 | Say Y or M if you want to add support for codecs attached to |
| 7 | the S3C24XX AC97 or I2S interfaces. You will also need to | 8 | the S3C24XX AC97 or I2S interfaces. You will also need to |
diff --git a/sound/soc/s3c24xx/rx1950_uda1380.c b/sound/soc/s3c24xx/rx1950_uda1380.c index ffd5cf2fb0a9..468cc11fdf47 100644 --- a/sound/soc/s3c24xx/rx1950_uda1380.c +++ b/sound/soc/s3c24xx/rx1950_uda1380.c | |||
| @@ -50,7 +50,6 @@ static unsigned int rates[] = { | |||
| 50 | 16000, | 50 | 16000, |
| 51 | 44100, | 51 | 44100, |
| 52 | 48000, | 52 | 48000, |
| 53 | 88200, | ||
| 54 | }; | 53 | }; |
| 55 | 54 | ||
| 56 | static struct snd_pcm_hw_constraint_list hw_rates = { | 55 | static struct snd_pcm_hw_constraint_list hw_rates = { |
| @@ -130,7 +129,6 @@ static const struct snd_soc_dapm_route audio_map[] = { | |||
| 130 | }; | 129 | }; |
| 131 | 130 | ||
| 132 | static struct platform_device *s3c24xx_snd_device; | 131 | static struct platform_device *s3c24xx_snd_device; |
| 133 | static struct clk *xtal; | ||
| 134 | 132 | ||
| 135 | static int rx1950_startup(struct snd_pcm_substream *substream) | 133 | static int rx1950_startup(struct snd_pcm_substream *substream) |
| 136 | { | 134 | { |
| @@ -179,10 +177,8 @@ static int rx1950_hw_params(struct snd_pcm_substream *substream, | |||
| 179 | case 44100: | 177 | case 44100: |
| 180 | case 88200: | 178 | case 88200: |
| 181 | clk_source = S3C24XX_CLKSRC_MPLL; | 179 | clk_source = S3C24XX_CLKSRC_MPLL; |
| 182 | fs_mode = S3C2410_IISMOD_256FS; | 180 | fs_mode = S3C2410_IISMOD_384FS; |
| 183 | div = clk_get_rate(xtal) / (256 * rate); | 181 | div = 1; |
| 184 | if (clk_get_rate(xtal) % (256 * rate) > (128 * rate)) | ||
| 185 | div++; | ||
| 186 | break; | 182 | break; |
| 187 | default: | 183 | default: |
| 188 | printk(KERN_ERR "%s: rate %d is not supported\n", | 184 | printk(KERN_ERR "%s: rate %d is not supported\n", |
| @@ -210,7 +206,7 @@ static int rx1950_hw_params(struct snd_pcm_substream *substream, | |||
| 210 | 206 | ||
| 211 | /* set MCLK division for sample rate */ | 207 | /* set MCLK division for sample rate */ |
| 212 | ret = snd_soc_dai_set_clkdiv(cpu_dai, S3C24XX_DIV_MCLK, | 208 | ret = snd_soc_dai_set_clkdiv(cpu_dai, S3C24XX_DIV_MCLK, |
| 213 | S3C2410_IISMOD_384FS); | 209 | fs_mode); |
| 214 | if (ret < 0) | 210 | if (ret < 0) |
| 215 | return ret; | 211 | return ret; |
| 216 | 212 | ||
| @@ -295,17 +291,8 @@ static int __init rx1950_init(void) | |||
| 295 | goto err_plat_add; | 291 | goto err_plat_add; |
| 296 | } | 292 | } |
| 297 | 293 | ||
| 298 | xtal = clk_get(&s3c24xx_snd_device->dev, "xtal"); | ||
| 299 | |||
| 300 | if (IS_ERR(xtal)) { | ||
| 301 | ret = PTR_ERR(xtal); | ||
| 302 | platform_device_unregister(s3c24xx_snd_device); | ||
| 303 | goto err_clk; | ||
| 304 | } | ||
| 305 | |||
| 306 | return 0; | 294 | return 0; |
| 307 | 295 | ||
| 308 | err_clk: | ||
| 309 | err_plat_add: | 296 | err_plat_add: |
| 310 | err_plat_alloc: | 297 | err_plat_alloc: |
| 311 | err_gpio_conf: | 298 | err_gpio_conf: |
| @@ -320,7 +307,6 @@ static void __exit rx1950_exit(void) | |||
| 320 | platform_device_unregister(s3c24xx_snd_device); | 307 | platform_device_unregister(s3c24xx_snd_device); |
| 321 | snd_soc_jack_free_gpios(&hp_jack, ARRAY_SIZE(hp_jack_gpios), | 308 | snd_soc_jack_free_gpios(&hp_jack, ARRAY_SIZE(hp_jack_gpios), |
| 322 | hp_jack_gpios); | 309 | hp_jack_gpios); |
| 323 | clk_put(xtal); | ||
| 324 | gpio_free(S3C2410_GPA(1)); | 310 | gpio_free(S3C2410_GPA(1)); |
| 325 | } | 311 | } |
| 326 | 312 | ||
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 614a8b30d87b..441285ade024 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
| @@ -3043,8 +3043,10 @@ int snd_soc_register_dais(struct device *dev, | |||
| 3043 | for (i = 0; i < count; i++) { | 3043 | for (i = 0; i < count; i++) { |
| 3044 | 3044 | ||
| 3045 | dai = kzalloc(sizeof(struct snd_soc_dai), GFP_KERNEL); | 3045 | dai = kzalloc(sizeof(struct snd_soc_dai), GFP_KERNEL); |
| 3046 | if (dai == NULL) | 3046 | if (dai == NULL) { |
| 3047 | return -ENOMEM; | 3047 | ret = -ENOMEM; |
| 3048 | goto err; | ||
| 3049 | } | ||
| 3048 | 3050 | ||
| 3049 | /* create DAI component name */ | 3051 | /* create DAI component name */ |
| 3050 | dai->name = fmt_multiple_name(dev, &dai_drv[i]); | 3052 | dai->name = fmt_multiple_name(dev, &dai_drv[i]); |
| @@ -3263,9 +3265,6 @@ int snd_soc_register_codec(struct device *dev, | |||
| 3263 | return 0; | 3265 | return 0; |
| 3264 | 3266 | ||
| 3265 | error: | 3267 | error: |
| 3266 | for (i--; i >= 0; i--) | ||
| 3267 | snd_soc_unregister_dai(dev); | ||
| 3268 | |||
| 3269 | if (codec->reg_cache) | 3268 | if (codec->reg_cache) |
| 3270 | kfree(codec->reg_cache); | 3269 | kfree(codec->reg_cache); |
| 3271 | kfree(codec->name); | 3270 | kfree(codec->name); |
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 7d85c6496afa..75ed6491222d 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
| @@ -683,12 +683,12 @@ static int dapm_seq_compare(struct snd_soc_dapm_widget *a, | |||
| 683 | struct snd_soc_dapm_widget *b, | 683 | struct snd_soc_dapm_widget *b, |
| 684 | int sort[]) | 684 | int sort[]) |
| 685 | { | 685 | { |
| 686 | if (a->codec != b->codec) | ||
| 687 | return (unsigned long)a - (unsigned long)b; | ||
| 688 | if (sort[a->id] != sort[b->id]) | 686 | if (sort[a->id] != sort[b->id]) |
| 689 | return sort[a->id] - sort[b->id]; | 687 | return sort[a->id] - sort[b->id]; |
| 690 | if (a->reg != b->reg) | 688 | if (a->reg != b->reg) |
| 691 | return a->reg - b->reg; | 689 | return a->reg - b->reg; |
| 690 | if (a->codec != b->codec) | ||
| 691 | return (unsigned long)a->codec - (unsigned long)b->codec; | ||
| 692 | 692 | ||
| 693 | return 0; | 693 | return 0; |
| 694 | } | 694 | } |
diff --git a/sound/spi/at73c213.c b/sound/spi/at73c213.c index 1bc56b2b94e2..337a00241a1f 100644 --- a/sound/spi/at73c213.c +++ b/sound/spi/at73c213.c | |||
| @@ -155,7 +155,7 @@ static int snd_at73c213_set_bitrate(struct snd_at73c213 *chip) | |||
| 155 | if (max_tries < 1) | 155 | if (max_tries < 1) |
| 156 | max_tries = 1; | 156 | max_tries = 1; |
| 157 | 157 | ||
| 158 | /* ssc_div must be a power of 2. */ | 158 | /* ssc_div must be even. */ |
| 159 | ssc_div = (ssc_div + 1) & ~1UL; | 159 | ssc_div = (ssc_div + 1) & ~1UL; |
| 160 | 160 | ||
| 161 | if ((ssc_rate / (ssc_div * 2 * 16)) < BITRATE_MIN) { | 161 | if ((ssc_rate / (ssc_div * 2 * 16)) < BITRATE_MIN) { |
