diff options
237 files changed, 2087 insertions, 939 deletions
diff --git a/.gitignore b/.gitignore index 8faa6c02b39e..5d56a3fd0de6 100644 --- a/.gitignore +++ b/.gitignore | |||
@@ -28,6 +28,7 @@ modules.builtin | |||
28 | *.gz | 28 | *.gz |
29 | *.bz2 | 29 | *.bz2 |
30 | *.lzma | 30 | *.lzma |
31 | *.xz | ||
31 | *.lzo | 32 | *.lzo |
32 | *.patch | 33 | *.patch |
33 | *.gcno | 34 | *.gcno |
diff --git a/Documentation/cgroups/blkio-controller.txt b/Documentation/cgroups/blkio-controller.txt index d915c16df42c..465351d4cf85 100644 --- a/Documentation/cgroups/blkio-controller.txt +++ b/Documentation/cgroups/blkio-controller.txt | |||
@@ -140,7 +140,7 @@ Proportional weight policy files | |||
140 | - Specifies per cgroup weight. This is default weight of the group | 140 | - Specifies per cgroup weight. This is default weight of the group |
141 | on all the devices until and unless overridden by per device rule. | 141 | on all the devices until and unless overridden by per device rule. |
142 | (See blkio.weight_device). | 142 | (See blkio.weight_device). |
143 | Currently allowed range of weights is from 100 to 1000. | 143 | Currently allowed range of weights is from 10 to 1000. |
144 | 144 | ||
145 | - blkio.weight_device | 145 | - blkio.weight_device |
146 | - One can specify per cgroup per device rules using this interface. | 146 | - One can specify per cgroup per device rules using this interface. |
diff --git a/MAINTAINERS b/MAINTAINERS index 6f99e1260db8..8afba6321e24 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -1692,6 +1692,13 @@ M: Andy Whitcroft <apw@canonical.com> | |||
1692 | S: Supported | 1692 | S: Supported |
1693 | F: scripts/checkpatch.pl | 1693 | F: scripts/checkpatch.pl |
1694 | 1694 | ||
1695 | CHINESE DOCUMENTATION | ||
1696 | M: Harry Wei <harryxiyou@gmail.com> | ||
1697 | L: xiyoulinuxkernelgroup@googlegroups.com | ||
1698 | L: linux-kernel@zh-kernel.org (moderated for non-subscribers) | ||
1699 | S: Maintained | ||
1700 | F: Documentation/zh_CN/ | ||
1701 | |||
1695 | CISCO VIC ETHERNET NIC DRIVER | 1702 | CISCO VIC ETHERNET NIC DRIVER |
1696 | M: Vasanthy Kolluri <vkolluri@cisco.com> | 1703 | M: Vasanthy Kolluri <vkolluri@cisco.com> |
1697 | M: Roopa Prabhu <roprabhu@cisco.com> | 1704 | M: Roopa Prabhu <roprabhu@cisco.com> |
@@ -5266,7 +5273,7 @@ S: Maintained | |||
5266 | F: drivers/net/wireless/rtl818x/rtl8180/ | 5273 | F: drivers/net/wireless/rtl818x/rtl8180/ |
5267 | 5274 | ||
5268 | RTL8187 WIRELESS DRIVER | 5275 | RTL8187 WIRELESS DRIVER |
5269 | M: Herton Ronaldo Krzesinski <herton@mandriva.com.br> | 5276 | M: Herton Ronaldo Krzesinski <herton@canonical.com> |
5270 | M: Hin-Tak Leung <htl10@users.sourceforge.net> | 5277 | M: Hin-Tak Leung <htl10@users.sourceforge.net> |
5271 | M: Larry Finger <Larry.Finger@lwfinger.net> | 5278 | M: Larry Finger <Larry.Finger@lwfinger.net> |
5272 | L: linux-wireless@vger.kernel.org | 5279 | L: linux-wireless@vger.kernel.org |
@@ -6104,7 +6111,7 @@ S: Maintained | |||
6104 | F: security/tomoyo/ | 6111 | F: security/tomoyo/ |
6105 | 6112 | ||
6106 | TOPSTAR LAPTOP EXTRAS DRIVER | 6113 | TOPSTAR LAPTOP EXTRAS DRIVER |
6107 | M: Herton Ronaldo Krzesinski <herton@mandriva.com.br> | 6114 | M: Herton Ronaldo Krzesinski <herton@canonical.com> |
6108 | L: platform-driver-x86@vger.kernel.org | 6115 | L: platform-driver-x86@vger.kernel.org |
6109 | S: Maintained | 6116 | S: Maintained |
6110 | F: drivers/platform/x86/topstar-laptop.c | 6117 | F: drivers/platform/x86/topstar-laptop.c |
diff --git a/arch/arm/mach-omap2/clkt_dpll.c b/arch/arm/mach-omap2/clkt_dpll.c index 337392c3f549..acb7ae5b0a25 100644 --- a/arch/arm/mach-omap2/clkt_dpll.c +++ b/arch/arm/mach-omap2/clkt_dpll.c | |||
@@ -77,7 +77,7 @@ static int _dpll_test_fint(struct clk *clk, u8 n) | |||
77 | dd = clk->dpll_data; | 77 | dd = clk->dpll_data; |
78 | 78 | ||
79 | /* DPLL divider must result in a valid jitter correction val */ | 79 | /* DPLL divider must result in a valid jitter correction val */ |
80 | fint = clk->parent->rate / (n + 1); | 80 | fint = clk->parent->rate / n; |
81 | if (fint < DPLL_FINT_BAND1_MIN) { | 81 | if (fint < DPLL_FINT_BAND1_MIN) { |
82 | 82 | ||
83 | pr_debug("rejecting n=%d due to Fint failure, " | 83 | pr_debug("rejecting n=%d due to Fint failure, " |
diff --git a/arch/arm/mach-omap2/mailbox.c b/arch/arm/mach-omap2/mailbox.c index 394413dc7deb..0a585dfa9874 100644 --- a/arch/arm/mach-omap2/mailbox.c +++ b/arch/arm/mach-omap2/mailbox.c | |||
@@ -334,7 +334,7 @@ static struct omap_mbox mbox_iva_info = { | |||
334 | .priv = &omap2_mbox_iva_priv, | 334 | .priv = &omap2_mbox_iva_priv, |
335 | }; | 335 | }; |
336 | 336 | ||
337 | struct omap_mbox *omap2_mboxes[] = { &mbox_iva_info, &mbox_dsp_info, NULL }; | 337 | struct omap_mbox *omap2_mboxes[] = { &mbox_dsp_info, &mbox_iva_info, NULL }; |
338 | #endif | 338 | #endif |
339 | 339 | ||
340 | #if defined(CONFIG_ARCH_OMAP4) | 340 | #if defined(CONFIG_ARCH_OMAP4) |
diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c index 98148b6c36e9..6c84659cf846 100644 --- a/arch/arm/mach-omap2/mux.c +++ b/arch/arm/mach-omap2/mux.c | |||
@@ -605,7 +605,7 @@ static void __init omap_mux_dbg_create_entry( | |||
605 | list_for_each_entry(e, &partition->muxmodes, node) { | 605 | list_for_each_entry(e, &partition->muxmodes, node) { |
606 | struct omap_mux *m = &e->mux; | 606 | struct omap_mux *m = &e->mux; |
607 | 607 | ||
608 | (void)debugfs_create_file(m->muxnames[0], S_IWUGO, mux_dbg_dir, | 608 | (void)debugfs_create_file(m->muxnames[0], S_IWUSR, mux_dbg_dir, |
609 | m, &omap_mux_dbg_signal_fops); | 609 | m, &omap_mux_dbg_signal_fops); |
610 | } | 610 | } |
611 | } | 611 | } |
diff --git a/arch/arm/mach-omap2/pm-debug.c b/arch/arm/mach-omap2/pm-debug.c index 125f56591fb5..a5a83b358ddd 100644 --- a/arch/arm/mach-omap2/pm-debug.c +++ b/arch/arm/mach-omap2/pm-debug.c | |||
@@ -637,14 +637,14 @@ static int __init pm_dbg_init(void) | |||
637 | 637 | ||
638 | } | 638 | } |
639 | 639 | ||
640 | (void) debugfs_create_file("enable_off_mode", S_IRUGO | S_IWUGO, d, | 640 | (void) debugfs_create_file("enable_off_mode", S_IRUGO | S_IWUSR, d, |
641 | &enable_off_mode, &pm_dbg_option_fops); | 641 | &enable_off_mode, &pm_dbg_option_fops); |
642 | (void) debugfs_create_file("sleep_while_idle", S_IRUGO | S_IWUGO, d, | 642 | (void) debugfs_create_file("sleep_while_idle", S_IRUGO | S_IWUSR, d, |
643 | &sleep_while_idle, &pm_dbg_option_fops); | 643 | &sleep_while_idle, &pm_dbg_option_fops); |
644 | (void) debugfs_create_file("wakeup_timer_seconds", S_IRUGO | S_IWUGO, d, | 644 | (void) debugfs_create_file("wakeup_timer_seconds", S_IRUGO | S_IWUSR, d, |
645 | &wakeup_timer_seconds, &pm_dbg_option_fops); | 645 | &wakeup_timer_seconds, &pm_dbg_option_fops); |
646 | (void) debugfs_create_file("wakeup_timer_milliseconds", | 646 | (void) debugfs_create_file("wakeup_timer_milliseconds", |
647 | S_IRUGO | S_IWUGO, d, &wakeup_timer_milliseconds, | 647 | S_IRUGO | S_IWUSR, d, &wakeup_timer_milliseconds, |
648 | &pm_dbg_option_fops); | 648 | &pm_dbg_option_fops); |
649 | pm_dbg_init_done = 1; | 649 | pm_dbg_init_done = 1; |
650 | 650 | ||
diff --git a/arch/arm/mach-omap2/prcm_mpu44xx.h b/arch/arm/mach-omap2/prcm_mpu44xx.h index 729a644ce852..3300ff6e3cfe 100644 --- a/arch/arm/mach-omap2/prcm_mpu44xx.h +++ b/arch/arm/mach-omap2/prcm_mpu44xx.h | |||
@@ -38,8 +38,8 @@ | |||
38 | #define OMAP4430_PRCM_MPU_CPU1_INST 0x0800 | 38 | #define OMAP4430_PRCM_MPU_CPU1_INST 0x0800 |
39 | 39 | ||
40 | /* PRCM_MPU clockdomain register offsets (from instance start) */ | 40 | /* PRCM_MPU clockdomain register offsets (from instance start) */ |
41 | #define OMAP4430_PRCM_MPU_CPU0_MPU_CDOFFS 0x0000 | 41 | #define OMAP4430_PRCM_MPU_CPU0_MPU_CDOFFS 0x0018 |
42 | #define OMAP4430_PRCM_MPU_CPU1_MPU_CDOFFS 0x0000 | 42 | #define OMAP4430_PRCM_MPU_CPU1_MPU_CDOFFS 0x0018 |
43 | 43 | ||
44 | 44 | ||
45 | /* | 45 | /* |
diff --git a/arch/arm/mach-omap2/smartreflex.c b/arch/arm/mach-omap2/smartreflex.c index c37e823266d3..95ac336fe3f7 100644 --- a/arch/arm/mach-omap2/smartreflex.c +++ b/arch/arm/mach-omap2/smartreflex.c | |||
@@ -900,7 +900,7 @@ static int __init omap_sr_probe(struct platform_device *pdev) | |||
900 | return PTR_ERR(dbg_dir); | 900 | return PTR_ERR(dbg_dir); |
901 | } | 901 | } |
902 | 902 | ||
903 | (void) debugfs_create_file("autocomp", S_IRUGO | S_IWUGO, dbg_dir, | 903 | (void) debugfs_create_file("autocomp", S_IRUGO | S_IWUSR, dbg_dir, |
904 | (void *)sr_info, &pm_sr_fops); | 904 | (void *)sr_info, &pm_sr_fops); |
905 | (void) debugfs_create_x32("errweight", S_IRUGO, dbg_dir, | 905 | (void) debugfs_create_x32("errweight", S_IRUGO, dbg_dir, |
906 | &sr_info->err_weight); | 906 | &sr_info->err_weight); |
@@ -939,7 +939,7 @@ static int __init omap_sr_probe(struct platform_device *pdev) | |||
939 | strcpy(name, "volt_"); | 939 | strcpy(name, "volt_"); |
940 | sprintf(volt_name, "%d", volt_data[i].volt_nominal); | 940 | sprintf(volt_name, "%d", volt_data[i].volt_nominal); |
941 | strcat(name, volt_name); | 941 | strcat(name, volt_name); |
942 | (void) debugfs_create_x32(name, S_IRUGO | S_IWUGO, nvalue_dir, | 942 | (void) debugfs_create_x32(name, S_IRUGO | S_IWUSR, nvalue_dir, |
943 | &(sr_info->nvalue_table[i].nvalue)); | 943 | &(sr_info->nvalue_table[i].nvalue)); |
944 | } | 944 | } |
945 | 945 | ||
diff --git a/arch/arm/mach-omap2/timer-gp.c b/arch/arm/mach-omap2/timer-gp.c index 7b7c2683ae7b..0fc550e7e482 100644 --- a/arch/arm/mach-omap2/timer-gp.c +++ b/arch/arm/mach-omap2/timer-gp.c | |||
@@ -39,6 +39,7 @@ | |||
39 | #include <asm/mach/time.h> | 39 | #include <asm/mach/time.h> |
40 | #include <plat/dmtimer.h> | 40 | #include <plat/dmtimer.h> |
41 | #include <asm/localtimer.h> | 41 | #include <asm/localtimer.h> |
42 | #include <asm/sched_clock.h> | ||
42 | 43 | ||
43 | #include "timer-gp.h" | 44 | #include "timer-gp.h" |
44 | 45 | ||
@@ -190,6 +191,7 @@ static void __init omap2_gp_clocksource_init(void) | |||
190 | /* | 191 | /* |
191 | * clocksource | 192 | * clocksource |
192 | */ | 193 | */ |
194 | static DEFINE_CLOCK_DATA(cd); | ||
193 | static struct omap_dm_timer *gpt_clocksource; | 195 | static struct omap_dm_timer *gpt_clocksource; |
194 | static cycle_t clocksource_read_cycles(struct clocksource *cs) | 196 | static cycle_t clocksource_read_cycles(struct clocksource *cs) |
195 | { | 197 | { |
@@ -204,6 +206,15 @@ static struct clocksource clocksource_gpt = { | |||
204 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, | 206 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, |
205 | }; | 207 | }; |
206 | 208 | ||
209 | static void notrace dmtimer_update_sched_clock(void) | ||
210 | { | ||
211 | u32 cyc; | ||
212 | |||
213 | cyc = omap_dm_timer_read_counter(gpt_clocksource); | ||
214 | |||
215 | update_sched_clock(&cd, cyc, (u32)~0); | ||
216 | } | ||
217 | |||
207 | /* Setup free-running counter for clocksource */ | 218 | /* Setup free-running counter for clocksource */ |
208 | static void __init omap2_gp_clocksource_init(void) | 219 | static void __init omap2_gp_clocksource_init(void) |
209 | { | 220 | { |
@@ -224,6 +235,8 @@ static void __init omap2_gp_clocksource_init(void) | |||
224 | 235 | ||
225 | omap_dm_timer_set_load_start(gpt, 1, 0); | 236 | omap_dm_timer_set_load_start(gpt, 1, 0); |
226 | 237 | ||
238 | init_sched_clock(&cd, dmtimer_update_sched_clock, 32, tick_rate); | ||
239 | |||
227 | if (clocksource_register_hz(&clocksource_gpt, tick_rate)) | 240 | if (clocksource_register_hz(&clocksource_gpt, tick_rate)) |
228 | printk(err2, clocksource_gpt.name); | 241 | printk(err2, clocksource_gpt.name); |
229 | } | 242 | } |
diff --git a/arch/arm/mach-tegra/include/mach/kbc.h b/arch/arm/mach-tegra/include/mach/kbc.h index 66ad2760c621..04c779832c78 100644 --- a/arch/arm/mach-tegra/include/mach/kbc.h +++ b/arch/arm/mach-tegra/include/mach/kbc.h | |||
@@ -57,5 +57,6 @@ struct tegra_kbc_platform_data { | |||
57 | const struct matrix_keymap_data *keymap_data; | 57 | const struct matrix_keymap_data *keymap_data; |
58 | 58 | ||
59 | bool wakeup; | 59 | bool wakeup; |
60 | bool use_fn_map; | ||
60 | }; | 61 | }; |
61 | #endif | 62 | #endif |
diff --git a/arch/arm/plat-omap/mailbox.c b/arch/arm/plat-omap/mailbox.c index 459b319a9fad..49d3208793e5 100644 --- a/arch/arm/plat-omap/mailbox.c +++ b/arch/arm/plat-omap/mailbox.c | |||
@@ -322,15 +322,18 @@ static void omap_mbox_fini(struct omap_mbox *mbox) | |||
322 | 322 | ||
323 | struct omap_mbox *omap_mbox_get(const char *name, struct notifier_block *nb) | 323 | struct omap_mbox *omap_mbox_get(const char *name, struct notifier_block *nb) |
324 | { | 324 | { |
325 | struct omap_mbox *mbox; | 325 | struct omap_mbox *_mbox, *mbox = NULL; |
326 | int ret; | 326 | int i, ret; |
327 | 327 | ||
328 | if (!mboxes) | 328 | if (!mboxes) |
329 | return ERR_PTR(-EINVAL); | 329 | return ERR_PTR(-EINVAL); |
330 | 330 | ||
331 | for (mbox = *mboxes; mbox; mbox++) | 331 | for (i = 0; (_mbox = mboxes[i]); i++) { |
332 | if (!strcmp(mbox->name, name)) | 332 | if (!strcmp(_mbox->name, name)) { |
333 | mbox = _mbox; | ||
333 | break; | 334 | break; |
335 | } | ||
336 | } | ||
334 | 337 | ||
335 | if (!mbox) | 338 | if (!mbox) |
336 | return ERR_PTR(-ENOENT); | 339 | return ERR_PTR(-ENOENT); |
diff --git a/arch/cris/kernel/vmlinux.lds.S b/arch/cris/kernel/vmlinux.lds.S index 442218980db0..c49be845f96a 100644 --- a/arch/cris/kernel/vmlinux.lds.S +++ b/arch/cris/kernel/vmlinux.lds.S | |||
@@ -72,11 +72,6 @@ SECTIONS | |||
72 | INIT_TEXT_SECTION(PAGE_SIZE) | 72 | INIT_TEXT_SECTION(PAGE_SIZE) |
73 | .init.data : { INIT_DATA } | 73 | .init.data : { INIT_DATA } |
74 | .init.setup : { INIT_SETUP(16) } | 74 | .init.setup : { INIT_SETUP(16) } |
75 | #ifdef CONFIG_ETRAX_ARCH_V32 | ||
76 | __start___param = .; | ||
77 | __param : { *(__param) } | ||
78 | __stop___param = .; | ||
79 | #endif | ||
80 | .initcall.init : { | 75 | .initcall.init : { |
81 | INIT_CALLS | 76 | INIT_CALLS |
82 | } | 77 | } |
diff --git a/arch/x86/include/asm/acpi.h b/arch/x86/include/asm/acpi.h index 211ca3f7fd16..4ea15ca89b2b 100644 --- a/arch/x86/include/asm/acpi.h +++ b/arch/x86/include/asm/acpi.h | |||
@@ -88,6 +88,7 @@ extern int acpi_disabled; | |||
88 | extern int acpi_pci_disabled; | 88 | extern int acpi_pci_disabled; |
89 | extern int acpi_skip_timer_override; | 89 | extern int acpi_skip_timer_override; |
90 | extern int acpi_use_timer_override; | 90 | extern int acpi_use_timer_override; |
91 | extern int acpi_fix_pin2_polarity; | ||
91 | 92 | ||
92 | extern u8 acpi_sci_flags; | 93 | extern u8 acpi_sci_flags; |
93 | extern int acpi_sci_override_gsi; | 94 | extern int acpi_sci_override_gsi; |
diff --git a/arch/x86/include/asm/perf_event_p4.h b/arch/x86/include/asm/perf_event_p4.h index e2f6a99f14ab..cc29086e30cd 100644 --- a/arch/x86/include/asm/perf_event_p4.h +++ b/arch/x86/include/asm/perf_event_p4.h | |||
@@ -22,6 +22,7 @@ | |||
22 | 22 | ||
23 | #define ARCH_P4_CNTRVAL_BITS (40) | 23 | #define ARCH_P4_CNTRVAL_BITS (40) |
24 | #define ARCH_P4_CNTRVAL_MASK ((1ULL << ARCH_P4_CNTRVAL_BITS) - 1) | 24 | #define ARCH_P4_CNTRVAL_MASK ((1ULL << ARCH_P4_CNTRVAL_BITS) - 1) |
25 | #define ARCH_P4_UNFLAGGED_BIT ((1ULL) << (ARCH_P4_CNTRVAL_BITS - 1)) | ||
25 | 26 | ||
26 | #define P4_ESCR_EVENT_MASK 0x7e000000U | 27 | #define P4_ESCR_EVENT_MASK 0x7e000000U |
27 | #define P4_ESCR_EVENT_SHIFT 25 | 28 | #define P4_ESCR_EVENT_SHIFT 25 |
diff --git a/arch/x86/include/asm/smpboot_hooks.h b/arch/x86/include/asm/smpboot_hooks.h index 6c22bf353f26..725b77831993 100644 --- a/arch/x86/include/asm/smpboot_hooks.h +++ b/arch/x86/include/asm/smpboot_hooks.h | |||
@@ -34,7 +34,7 @@ static inline void smpboot_restore_warm_reset_vector(void) | |||
34 | */ | 34 | */ |
35 | CMOS_WRITE(0, 0xf); | 35 | CMOS_WRITE(0, 0xf); |
36 | 36 | ||
37 | *((volatile long *)phys_to_virt(apic->trampoline_phys_low)) = 0; | 37 | *((volatile u32 *)phys_to_virt(apic->trampoline_phys_low)) = 0; |
38 | } | 38 | } |
39 | 39 | ||
40 | static inline void __init smpboot_setup_io_apic(void) | 40 | static inline void __init smpboot_setup_io_apic(void) |
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index b3a71137983a..3e6e2d68f761 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c | |||
@@ -72,6 +72,7 @@ u8 acpi_sci_flags __initdata; | |||
72 | int acpi_sci_override_gsi __initdata; | 72 | int acpi_sci_override_gsi __initdata; |
73 | int acpi_skip_timer_override __initdata; | 73 | int acpi_skip_timer_override __initdata; |
74 | int acpi_use_timer_override __initdata; | 74 | int acpi_use_timer_override __initdata; |
75 | int acpi_fix_pin2_polarity __initdata; | ||
75 | 76 | ||
76 | #ifdef CONFIG_X86_LOCAL_APIC | 77 | #ifdef CONFIG_X86_LOCAL_APIC |
77 | static u64 acpi_lapic_addr __initdata = APIC_DEFAULT_PHYS_BASE; | 78 | static u64 acpi_lapic_addr __initdata = APIC_DEFAULT_PHYS_BASE; |
@@ -415,10 +416,15 @@ acpi_parse_int_src_ovr(struct acpi_subtable_header * header, | |||
415 | return 0; | 416 | return 0; |
416 | } | 417 | } |
417 | 418 | ||
418 | if (acpi_skip_timer_override && | 419 | if (intsrc->source_irq == 0 && intsrc->global_irq == 2) { |
419 | intsrc->source_irq == 0 && intsrc->global_irq == 2) { | 420 | if (acpi_skip_timer_override) { |
420 | printk(PREFIX "BIOS IRQ0 pin2 override ignored.\n"); | 421 | printk(PREFIX "BIOS IRQ0 pin2 override ignored.\n"); |
421 | return 0; | 422 | return 0; |
423 | } | ||
424 | if (acpi_fix_pin2_polarity && (intsrc->inti_flags & ACPI_MADT_POLARITY_MASK)) { | ||
425 | intsrc->inti_flags &= ~ACPI_MADT_POLARITY_MASK; | ||
426 | printk(PREFIX "BIOS IRQ0 pin2 override: forcing polarity to high active.\n"); | ||
427 | } | ||
422 | } | 428 | } |
423 | 429 | ||
424 | mp_override_legacy_irq(intsrc->source_irq, | 430 | mp_override_legacy_irq(intsrc->source_irq, |
diff --git a/arch/x86/kernel/apb_timer.c b/arch/x86/kernel/apb_timer.c index 51ef31a89be9..51d4e1663066 100644 --- a/arch/x86/kernel/apb_timer.c +++ b/arch/x86/kernel/apb_timer.c | |||
@@ -284,7 +284,7 @@ static int __init apbt_clockevent_register(void) | |||
284 | memcpy(&adev->evt, &apbt_clockevent, sizeof(struct clock_event_device)); | 284 | memcpy(&adev->evt, &apbt_clockevent, sizeof(struct clock_event_device)); |
285 | 285 | ||
286 | if (mrst_timer_options == MRST_TIMER_LAPIC_APBT) { | 286 | if (mrst_timer_options == MRST_TIMER_LAPIC_APBT) { |
287 | apbt_clockevent.rating = APBT_CLOCKEVENT_RATING - 100; | 287 | adev->evt.rating = APBT_CLOCKEVENT_RATING - 100; |
288 | global_clock_event = &adev->evt; | 288 | global_clock_event = &adev->evt; |
289 | printk(KERN_DEBUG "%s clockevent registered as global\n", | 289 | printk(KERN_DEBUG "%s clockevent registered as global\n", |
290 | global_clock_event->name); | 290 | global_clock_event->name); |
diff --git a/arch/x86/kernel/cpu/perf_event_p4.c b/arch/x86/kernel/cpu/perf_event_p4.c index f7a0993c1e7c..ff751a9f182b 100644 --- a/arch/x86/kernel/cpu/perf_event_p4.c +++ b/arch/x86/kernel/cpu/perf_event_p4.c | |||
@@ -770,9 +770,14 @@ static inline int p4_pmu_clear_cccr_ovf(struct hw_perf_event *hwc) | |||
770 | return 1; | 770 | return 1; |
771 | } | 771 | } |
772 | 772 | ||
773 | /* it might be unflagged overflow */ | 773 | /* |
774 | rdmsrl(hwc->event_base + hwc->idx, v); | 774 | * In some circumstances the overflow might issue an NMI but did |
775 | if (!(v & ARCH_P4_CNTRVAL_MASK)) | 775 | * not set P4_CCCR_OVF bit. Because a counter holds a negative value |
776 | * we simply check for high bit being set, if it's cleared it means | ||
777 | * the counter has reached zero value and continued counting before | ||
778 | * real NMI signal was received: | ||
779 | */ | ||
780 | if (!(v & ARCH_P4_UNFLAGGED_BIT)) | ||
776 | return 1; | 781 | return 1; |
777 | 782 | ||
778 | return 0; | 783 | return 0; |
diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c index 76b8cd953dee..9efbdcc56425 100644 --- a/arch/x86/kernel/early-quirks.c +++ b/arch/x86/kernel/early-quirks.c | |||
@@ -143,15 +143,10 @@ static void __init ati_bugs(int num, int slot, int func) | |||
143 | 143 | ||
144 | static u32 __init ati_sbx00_rev(int num, int slot, int func) | 144 | static u32 __init ati_sbx00_rev(int num, int slot, int func) |
145 | { | 145 | { |
146 | u32 old, d; | 146 | u32 d; |
147 | 147 | ||
148 | d = read_pci_config(num, slot, func, 0x70); | ||
149 | old = d; | ||
150 | d &= ~(1<<8); | ||
151 | write_pci_config(num, slot, func, 0x70, d); | ||
152 | d = read_pci_config(num, slot, func, 0x8); | 148 | d = read_pci_config(num, slot, func, 0x8); |
153 | d &= 0xff; | 149 | d &= 0xff; |
154 | write_pci_config(num, slot, func, 0x70, old); | ||
155 | 150 | ||
156 | return d; | 151 | return d; |
157 | } | 152 | } |
@@ -160,13 +155,16 @@ static void __init ati_bugs_contd(int num, int slot, int func) | |||
160 | { | 155 | { |
161 | u32 d, rev; | 156 | u32 d, rev; |
162 | 157 | ||
163 | if (acpi_use_timer_override) | ||
164 | return; | ||
165 | |||
166 | rev = ati_sbx00_rev(num, slot, func); | 158 | rev = ati_sbx00_rev(num, slot, func); |
159 | if (rev >= 0x40) | ||
160 | acpi_fix_pin2_polarity = 1; | ||
161 | |||
167 | if (rev > 0x13) | 162 | if (rev > 0x13) |
168 | return; | 163 | return; |
169 | 164 | ||
165 | if (acpi_use_timer_override) | ||
166 | return; | ||
167 | |||
170 | /* check for IRQ0 interrupt swap */ | 168 | /* check for IRQ0 interrupt swap */ |
171 | d = read_pci_config(num, slot, func, 0x64); | 169 | d = read_pci_config(num, slot, func, 0x64); |
172 | if (!(d & (1<<14))) | 170 | if (!(d & (1<<14))) |
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c index fc7aae1e2bc7..715037caeb43 100644 --- a/arch/x86/kernel/reboot.c +++ b/arch/x86/kernel/reboot.c | |||
@@ -285,6 +285,14 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = { | |||
285 | DMI_MATCH(DMI_BOARD_NAME, "P4S800"), | 285 | DMI_MATCH(DMI_BOARD_NAME, "P4S800"), |
286 | }, | 286 | }, |
287 | }, | 287 | }, |
288 | { /* Handle problems with rebooting on VersaLogic Menlow boards */ | ||
289 | .callback = set_bios_reboot, | ||
290 | .ident = "VersaLogic Menlow based board", | ||
291 | .matches = { | ||
292 | DMI_MATCH(DMI_BOARD_VENDOR, "VersaLogic Corporation"), | ||
293 | DMI_MATCH(DMI_BOARD_NAME, "VersaLogic Menlow board"), | ||
294 | }, | ||
295 | }, | ||
288 | { } | 296 | { } |
289 | }; | 297 | }; |
290 | 298 | ||
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 54ce246a383e..63fec1531e89 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c | |||
@@ -2777,6 +2777,8 @@ static int dr_interception(struct vcpu_svm *svm) | |||
2777 | kvm_register_write(&svm->vcpu, reg, val); | 2777 | kvm_register_write(&svm->vcpu, reg, val); |
2778 | } | 2778 | } |
2779 | 2779 | ||
2780 | skip_emulated_instruction(&svm->vcpu); | ||
2781 | |||
2780 | return 1; | 2782 | return 1; |
2781 | } | 2783 | } |
2782 | 2784 | ||
diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h index ea4861bdd549..57e7234c5ae5 100644 --- a/block/blk-cgroup.h +++ b/block/blk-cgroup.h | |||
@@ -240,7 +240,7 @@ static inline char *blkg_path(struct blkio_group *blkg) { return NULL; } | |||
240 | 240 | ||
241 | #endif | 241 | #endif |
242 | 242 | ||
243 | #define BLKIO_WEIGHT_MIN 100 | 243 | #define BLKIO_WEIGHT_MIN 10 |
244 | #define BLKIO_WEIGHT_MAX 1000 | 244 | #define BLKIO_WEIGHT_MAX 1000 |
245 | #define BLKIO_WEIGHT_DEFAULT 500 | 245 | #define BLKIO_WEIGHT_DEFAULT 500 |
246 | 246 | ||
diff --git a/block/blk-core.c b/block/blk-core.c index 7e9715ae18c8..e1fcf7a24668 100644 --- a/block/blk-core.c +++ b/block/blk-core.c | |||
@@ -217,7 +217,7 @@ static void blk_delay_work(struct work_struct *work) | |||
217 | 217 | ||
218 | q = container_of(work, struct request_queue, delay_work.work); | 218 | q = container_of(work, struct request_queue, delay_work.work); |
219 | spin_lock_irq(q->queue_lock); | 219 | spin_lock_irq(q->queue_lock); |
220 | __blk_run_queue(q); | 220 | __blk_run_queue(q, false); |
221 | spin_unlock_irq(q->queue_lock); | 221 | spin_unlock_irq(q->queue_lock); |
222 | } | 222 | } |
223 | 223 | ||
@@ -251,7 +251,7 @@ void blk_start_queue(struct request_queue *q) | |||
251 | WARN_ON(!irqs_disabled()); | 251 | WARN_ON(!irqs_disabled()); |
252 | 252 | ||
253 | queue_flag_clear(QUEUE_FLAG_STOPPED, q); | 253 | queue_flag_clear(QUEUE_FLAG_STOPPED, q); |
254 | __blk_run_queue(q); | 254 | __blk_run_queue(q, false); |
255 | } | 255 | } |
256 | EXPORT_SYMBOL(blk_start_queue); | 256 | EXPORT_SYMBOL(blk_start_queue); |
257 | 257 | ||
@@ -289,11 +289,14 @@ EXPORT_SYMBOL(blk_stop_queue); | |||
289 | * that its ->make_request_fn will not re-add plugging prior to calling | 289 | * that its ->make_request_fn will not re-add plugging prior to calling |
290 | * this function. | 290 | * this function. |
291 | * | 291 | * |
292 | * This function does not cancel any asynchronous activity arising | ||
293 | * out of elevator or throttling code. That would require elevaotor_exit() | ||
294 | * and blk_throtl_exit() to be called with queue lock initialized. | ||
295 | * | ||
292 | */ | 296 | */ |
293 | void blk_sync_queue(struct request_queue *q) | 297 | void blk_sync_queue(struct request_queue *q) |
294 | { | 298 | { |
295 | del_timer_sync(&q->timeout); | 299 | del_timer_sync(&q->timeout); |
296 | throtl_shutdown_timer_wq(q); | ||
297 | cancel_delayed_work_sync(&q->delay_work); | 300 | cancel_delayed_work_sync(&q->delay_work); |
298 | queue_sync_plugs(q); | 301 | queue_sync_plugs(q); |
299 | } | 302 | } |
@@ -302,13 +305,14 @@ EXPORT_SYMBOL(blk_sync_queue); | |||
302 | /** | 305 | /** |
303 | * __blk_run_queue - run a single device queue | 306 | * __blk_run_queue - run a single device queue |
304 | * @q: The queue to run | 307 | * @q: The queue to run |
308 | * @force_kblockd: Don't run @q->request_fn directly. Use kblockd. | ||
305 | * | 309 | * |
306 | * Description: | 310 | * Description: |
307 | * See @blk_run_queue. This variant must be called with the queue lock | 311 | * See @blk_run_queue. This variant must be called with the queue lock |
308 | * held and interrupts disabled. | 312 | * held and interrupts disabled. |
309 | * | 313 | * |
310 | */ | 314 | */ |
311 | void __blk_run_queue(struct request_queue *q) | 315 | void __blk_run_queue(struct request_queue *q, bool force_kblockd) |
312 | { | 316 | { |
313 | if (unlikely(blk_queue_stopped(q))) | 317 | if (unlikely(blk_queue_stopped(q))) |
314 | return; | 318 | return; |
@@ -317,7 +321,7 @@ void __blk_run_queue(struct request_queue *q) | |||
317 | * Only recurse once to avoid overrunning the stack, let the unplug | 321 | * Only recurse once to avoid overrunning the stack, let the unplug |
318 | * handling reinvoke the handler shortly if we already got there. | 322 | * handling reinvoke the handler shortly if we already got there. |
319 | */ | 323 | */ |
320 | if (!queue_flag_test_and_set(QUEUE_FLAG_REENTER, q)) { | 324 | if (!force_kblockd && !queue_flag_test_and_set(QUEUE_FLAG_REENTER, q)) { |
321 | q->request_fn(q); | 325 | q->request_fn(q); |
322 | queue_flag_clear(QUEUE_FLAG_REENTER, q); | 326 | queue_flag_clear(QUEUE_FLAG_REENTER, q); |
323 | } else | 327 | } else |
@@ -338,7 +342,7 @@ void blk_run_queue(struct request_queue *q) | |||
338 | unsigned long flags; | 342 | unsigned long flags; |
339 | 343 | ||
340 | spin_lock_irqsave(q->queue_lock, flags); | 344 | spin_lock_irqsave(q->queue_lock, flags); |
341 | __blk_run_queue(q); | 345 | __blk_run_queue(q, false); |
342 | spin_unlock_irqrestore(q->queue_lock, flags); | 346 | spin_unlock_irqrestore(q->queue_lock, flags); |
343 | } | 347 | } |
344 | EXPORT_SYMBOL(blk_run_queue); | 348 | EXPORT_SYMBOL(blk_run_queue); |
@@ -348,6 +352,11 @@ void blk_put_queue(struct request_queue *q) | |||
348 | kobject_put(&q->kobj); | 352 | kobject_put(&q->kobj); |
349 | } | 353 | } |
350 | 354 | ||
355 | /* | ||
356 | * Note: If a driver supplied the queue lock, it should not zap that lock | ||
357 | * unexpectedly as some queue cleanup components like elevator_exit() and | ||
358 | * blk_throtl_exit() need queue lock. | ||
359 | */ | ||
351 | void blk_cleanup_queue(struct request_queue *q) | 360 | void blk_cleanup_queue(struct request_queue *q) |
352 | { | 361 | { |
353 | /* | 362 | /* |
@@ -366,6 +375,8 @@ void blk_cleanup_queue(struct request_queue *q) | |||
366 | if (q->elevator) | 375 | if (q->elevator) |
367 | elevator_exit(q->elevator); | 376 | elevator_exit(q->elevator); |
368 | 377 | ||
378 | blk_throtl_exit(q); | ||
379 | |||
369 | blk_put_queue(q); | 380 | blk_put_queue(q); |
370 | } | 381 | } |
371 | EXPORT_SYMBOL(blk_cleanup_queue); | 382 | EXPORT_SYMBOL(blk_cleanup_queue); |
@@ -439,6 +450,12 @@ struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id) | |||
439 | mutex_init(&q->sysfs_lock); | 450 | mutex_init(&q->sysfs_lock); |
440 | spin_lock_init(&q->__queue_lock); | 451 | spin_lock_init(&q->__queue_lock); |
441 | 452 | ||
453 | /* | ||
454 | * By default initialize queue_lock to internal lock and driver can | ||
455 | * override it later if need be. | ||
456 | */ | ||
457 | q->queue_lock = &q->__queue_lock; | ||
458 | |||
442 | return q; | 459 | return q; |
443 | } | 460 | } |
444 | EXPORT_SYMBOL(blk_alloc_queue_node); | 461 | EXPORT_SYMBOL(blk_alloc_queue_node); |
@@ -522,7 +539,10 @@ blk_init_allocated_queue_node(struct request_queue *q, request_fn_proc *rfn, | |||
522 | q->prep_rq_fn = NULL; | 539 | q->prep_rq_fn = NULL; |
523 | q->unprep_rq_fn = NULL; | 540 | q->unprep_rq_fn = NULL; |
524 | q->queue_flags = QUEUE_FLAG_DEFAULT; | 541 | q->queue_flags = QUEUE_FLAG_DEFAULT; |
525 | q->queue_lock = lock; | 542 | |
543 | /* Override internal queue lock with supplied lock pointer */ | ||
544 | if (lock) | ||
545 | q->queue_lock = lock; | ||
526 | 546 | ||
527 | /* | 547 | /* |
528 | * This also sets hw/phys segments, boundary and size | 548 | * This also sets hw/phys segments, boundary and size |
@@ -971,7 +991,7 @@ void blk_insert_request(struct request_queue *q, struct request *rq, | |||
971 | blk_queue_end_tag(q, rq); | 991 | blk_queue_end_tag(q, rq); |
972 | 992 | ||
973 | add_acct_request(q, rq, where); | 993 | add_acct_request(q, rq, where); |
974 | __blk_run_queue(q); | 994 | __blk_run_queue(q, false); |
975 | spin_unlock_irqrestore(q->queue_lock, flags); | 995 | spin_unlock_irqrestore(q->queue_lock, flags); |
976 | } | 996 | } |
977 | EXPORT_SYMBOL(blk_insert_request); | 997 | EXPORT_SYMBOL(blk_insert_request); |
@@ -1307,7 +1327,7 @@ get_rq: | |||
1307 | } else { | 1327 | } else { |
1308 | spin_lock_irq(q->queue_lock); | 1328 | spin_lock_irq(q->queue_lock); |
1309 | add_acct_request(q, req, where); | 1329 | add_acct_request(q, req, where); |
1310 | __blk_run_queue(q); | 1330 | __blk_run_queue(q, false); |
1311 | out_unlock: | 1331 | out_unlock: |
1312 | spin_unlock_irq(q->queue_lock); | 1332 | spin_unlock_irq(q->queue_lock); |
1313 | } | 1333 | } |
@@ -2654,7 +2674,7 @@ static void flush_plug_list(struct blk_plug *plug) | |||
2654 | BUG_ON(!rq->q); | 2674 | BUG_ON(!rq->q); |
2655 | if (rq->q != q) { | 2675 | if (rq->q != q) { |
2656 | if (q) { | 2676 | if (q) { |
2657 | __blk_run_queue(q); | 2677 | __blk_run_queue(q, false); |
2658 | spin_unlock(q->queue_lock); | 2678 | spin_unlock(q->queue_lock); |
2659 | } | 2679 | } |
2660 | q = rq->q; | 2680 | q = rq->q; |
@@ -2669,7 +2689,7 @@ static void flush_plug_list(struct blk_plug *plug) | |||
2669 | } | 2689 | } |
2670 | 2690 | ||
2671 | if (q) { | 2691 | if (q) { |
2672 | __blk_run_queue(q); | 2692 | __blk_run_queue(q, false); |
2673 | spin_unlock(q->queue_lock); | 2693 | spin_unlock(q->queue_lock); |
2674 | } | 2694 | } |
2675 | 2695 | ||
diff --git a/block/blk-exec.c b/block/blk-exec.c index 81e31819a597..7482b7fa863b 100644 --- a/block/blk-exec.c +++ b/block/blk-exec.c | |||
@@ -55,7 +55,7 @@ void blk_execute_rq_nowait(struct request_queue *q, struct gendisk *bd_disk, | |||
55 | WARN_ON(irqs_disabled()); | 55 | WARN_ON(irqs_disabled()); |
56 | spin_lock_irq(q->queue_lock); | 56 | spin_lock_irq(q->queue_lock); |
57 | __elv_add_request(q, rq, where); | 57 | __elv_add_request(q, rq, where); |
58 | __blk_run_queue(q); | 58 | __blk_run_queue(q, false); |
59 | /* the queue is stopped so it won't be plugged+unplugged */ | 59 | /* the queue is stopped so it won't be plugged+unplugged */ |
60 | if (rq->cmd_type == REQ_TYPE_PM_RESUME) | 60 | if (rq->cmd_type == REQ_TYPE_PM_RESUME) |
61 | q->request_fn(q); | 61 | q->request_fn(q); |
diff --git a/block/blk-flush.c b/block/blk-flush.c index 671fa9da7560..93d5fd8e51eb 100644 --- a/block/blk-flush.c +++ b/block/blk-flush.c | |||
@@ -211,9 +211,14 @@ static void flush_end_io(struct request *flush_rq, int error) | |||
211 | queued |= blk_flush_complete_seq(rq, seq, error); | 211 | queued |= blk_flush_complete_seq(rq, seq, error); |
212 | } | 212 | } |
213 | 213 | ||
214 | /* after populating an empty queue, kick it to avoid stall */ | 214 | /* |
215 | * Moving a request silently to empty queue_head may stall the | ||
216 | * queue. Kick the queue in those cases. This function is called | ||
217 | * from request completion path and calling directly into | ||
218 | * request_fn may confuse the driver. Always use kblockd. | ||
219 | */ | ||
215 | if (queued) | 220 | if (queued) |
216 | __blk_run_queue(q); | 221 | __blk_run_queue(q, true); |
217 | } | 222 | } |
218 | 223 | ||
219 | /** | 224 | /** |
@@ -256,7 +261,7 @@ static bool blk_kick_flush(struct request_queue *q) | |||
256 | q->flush_rq.end_io = flush_end_io; | 261 | q->flush_rq.end_io = flush_end_io; |
257 | 262 | ||
258 | q->flush_pending_idx ^= 1; | 263 | q->flush_pending_idx ^= 1; |
259 | elv_insert(q, &q->flush_rq, ELEVATOR_INSERT_FRONT); | 264 | elv_insert(q, &q->flush_rq, ELEVATOR_INSERT_REQUEUE); |
260 | return true; | 265 | return true; |
261 | } | 266 | } |
262 | 267 | ||
@@ -264,9 +269,12 @@ static void flush_data_end_io(struct request *rq, int error) | |||
264 | { | 269 | { |
265 | struct request_queue *q = rq->q; | 270 | struct request_queue *q = rq->q; |
266 | 271 | ||
267 | /* after populating an empty queue, kick it to avoid stall */ | 272 | /* |
273 | * After populating an empty queue, kick it to avoid stall. Read | ||
274 | * the comment in flush_end_io(). | ||
275 | */ | ||
268 | if (blk_flush_complete_seq(rq, REQ_FSEQ_DATA, error)) | 276 | if (blk_flush_complete_seq(rq, REQ_FSEQ_DATA, error)) |
269 | __blk_run_queue(q); | 277 | __blk_run_queue(q, true); |
270 | } | 278 | } |
271 | 279 | ||
272 | /** | 280 | /** |
diff --git a/block/blk-lib.c b/block/blk-lib.c index 1a320d2406b0..eec78becb355 100644 --- a/block/blk-lib.c +++ b/block/blk-lib.c | |||
@@ -132,7 +132,7 @@ static void bio_batch_end_io(struct bio *bio, int err) | |||
132 | } | 132 | } |
133 | 133 | ||
134 | /** | 134 | /** |
135 | * blkdev_issue_zeroout generate number of zero filed write bios | 135 | * blkdev_issue_zeroout - generate number of zero filed write bios |
136 | * @bdev: blockdev to issue | 136 | * @bdev: blockdev to issue |
137 | * @sector: start sector | 137 | * @sector: start sector |
138 | * @nr_sects: number of sectors to write | 138 | * @nr_sects: number of sectors to write |
diff --git a/block/blk-settings.c b/block/blk-settings.c index c8d68921dddb..1fa769293597 100644 --- a/block/blk-settings.c +++ b/block/blk-settings.c | |||
@@ -168,13 +168,6 @@ void blk_queue_make_request(struct request_queue *q, make_request_fn *mfn) | |||
168 | blk_queue_max_hw_sectors(q, BLK_SAFE_MAX_SECTORS); | 168 | blk_queue_max_hw_sectors(q, BLK_SAFE_MAX_SECTORS); |
169 | 169 | ||
170 | /* | 170 | /* |
171 | * If the caller didn't supply a lock, fall back to our embedded | ||
172 | * per-queue locks | ||
173 | */ | ||
174 | if (!q->queue_lock) | ||
175 | q->queue_lock = &q->__queue_lock; | ||
176 | |||
177 | /* | ||
178 | * by default assume old behaviour and bounce for any highmem page | 171 | * by default assume old behaviour and bounce for any highmem page |
179 | */ | 172 | */ |
180 | blk_queue_bounce_limit(q, BLK_BOUNCE_HIGH); | 173 | blk_queue_bounce_limit(q, BLK_BOUNCE_HIGH); |
diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c index 41fb69150b4d..261c75c665ae 100644 --- a/block/blk-sysfs.c +++ b/block/blk-sysfs.c | |||
@@ -471,8 +471,6 @@ static void blk_release_queue(struct kobject *kobj) | |||
471 | 471 | ||
472 | blk_sync_queue(q); | 472 | blk_sync_queue(q); |
473 | 473 | ||
474 | blk_throtl_exit(q); | ||
475 | |||
476 | if (rl->rq_pool) | 474 | if (rl->rq_pool) |
477 | mempool_destroy(rl->rq_pool); | 475 | mempool_destroy(rl->rq_pool); |
478 | 476 | ||
diff --git a/block/blk-throttle.c b/block/blk-throttle.c index 658ee505315b..37abbfc68590 100644 --- a/block/blk-throttle.c +++ b/block/blk-throttle.c | |||
@@ -20,6 +20,11 @@ static int throtl_quantum = 32; | |||
20 | /* Throttling is performed over 100ms slice and after that slice is renewed */ | 20 | /* Throttling is performed over 100ms slice and after that slice is renewed */ |
21 | static unsigned long throtl_slice = HZ/10; /* 100 ms */ | 21 | static unsigned long throtl_slice = HZ/10; /* 100 ms */ |
22 | 22 | ||
23 | /* A workqueue to queue throttle related work */ | ||
24 | static struct workqueue_struct *kthrotld_workqueue; | ||
25 | static void throtl_schedule_delayed_work(struct throtl_data *td, | ||
26 | unsigned long delay); | ||
27 | |||
23 | struct throtl_rb_root { | 28 | struct throtl_rb_root { |
24 | struct rb_root rb; | 29 | struct rb_root rb; |
25 | struct rb_node *left; | 30 | struct rb_node *left; |
@@ -97,7 +102,7 @@ struct throtl_data | |||
97 | /* Work for dispatching throttled bios */ | 102 | /* Work for dispatching throttled bios */ |
98 | struct delayed_work throtl_work; | 103 | struct delayed_work throtl_work; |
99 | 104 | ||
100 | atomic_t limits_changed; | 105 | bool limits_changed; |
101 | }; | 106 | }; |
102 | 107 | ||
103 | enum tg_state_flags { | 108 | enum tg_state_flags { |
@@ -196,6 +201,7 @@ static struct throtl_grp * throtl_find_alloc_tg(struct throtl_data *td, | |||
196 | RB_CLEAR_NODE(&tg->rb_node); | 201 | RB_CLEAR_NODE(&tg->rb_node); |
197 | bio_list_init(&tg->bio_lists[0]); | 202 | bio_list_init(&tg->bio_lists[0]); |
198 | bio_list_init(&tg->bio_lists[1]); | 203 | bio_list_init(&tg->bio_lists[1]); |
204 | td->limits_changed = false; | ||
199 | 205 | ||
200 | /* | 206 | /* |
201 | * Take the initial reference that will be released on destroy | 207 | * Take the initial reference that will be released on destroy |
@@ -345,10 +351,9 @@ static void throtl_schedule_next_dispatch(struct throtl_data *td) | |||
345 | update_min_dispatch_time(st); | 351 | update_min_dispatch_time(st); |
346 | 352 | ||
347 | if (time_before_eq(st->min_disptime, jiffies)) | 353 | if (time_before_eq(st->min_disptime, jiffies)) |
348 | throtl_schedule_delayed_work(td->queue, 0); | 354 | throtl_schedule_delayed_work(td, 0); |
349 | else | 355 | else |
350 | throtl_schedule_delayed_work(td->queue, | 356 | throtl_schedule_delayed_work(td, (st->min_disptime - jiffies)); |
351 | (st->min_disptime - jiffies)); | ||
352 | } | 357 | } |
353 | 358 | ||
354 | static inline void | 359 | static inline void |
@@ -733,34 +738,27 @@ static void throtl_process_limit_change(struct throtl_data *td) | |||
733 | struct throtl_grp *tg; | 738 | struct throtl_grp *tg; |
734 | struct hlist_node *pos, *n; | 739 | struct hlist_node *pos, *n; |
735 | 740 | ||
736 | if (!atomic_read(&td->limits_changed)) | 741 | if (!td->limits_changed) |
737 | return; | 742 | return; |
738 | 743 | ||
739 | throtl_log(td, "limit changed =%d", atomic_read(&td->limits_changed)); | 744 | xchg(&td->limits_changed, false); |
740 | 745 | ||
741 | /* | 746 | throtl_log(td, "limits changed"); |
742 | * Make sure updates from throtl_update_blkio_group_read_bps() group | ||
743 | * of functions to tg->limits_changed are visible. We do not | ||
744 | * want update td->limits_changed to be visible but update to | ||
745 | * tg->limits_changed not being visible yet on this cpu. Hence | ||
746 | * the read barrier. | ||
747 | */ | ||
748 | smp_rmb(); | ||
749 | 747 | ||
750 | hlist_for_each_entry_safe(tg, pos, n, &td->tg_list, tg_node) { | 748 | hlist_for_each_entry_safe(tg, pos, n, &td->tg_list, tg_node) { |
751 | if (throtl_tg_on_rr(tg) && tg->limits_changed) { | 749 | if (!tg->limits_changed) |
752 | throtl_log_tg(td, tg, "limit change rbps=%llu wbps=%llu" | 750 | continue; |
753 | " riops=%u wiops=%u", tg->bps[READ], | 751 | |
754 | tg->bps[WRITE], tg->iops[READ], | 752 | if (!xchg(&tg->limits_changed, false)) |
755 | tg->iops[WRITE]); | 753 | continue; |
754 | |||
755 | throtl_log_tg(td, tg, "limit change rbps=%llu wbps=%llu" | ||
756 | " riops=%u wiops=%u", tg->bps[READ], tg->bps[WRITE], | ||
757 | tg->iops[READ], tg->iops[WRITE]); | ||
758 | |||
759 | if (throtl_tg_on_rr(tg)) | ||
756 | tg_update_disptime(td, tg); | 760 | tg_update_disptime(td, tg); |
757 | tg->limits_changed = false; | ||
758 | } | ||
759 | } | 761 | } |
760 | |||
761 | smp_mb__before_atomic_dec(); | ||
762 | atomic_dec(&td->limits_changed); | ||
763 | smp_mb__after_atomic_dec(); | ||
764 | } | 762 | } |
765 | 763 | ||
766 | /* Dispatch throttled bios. Should be called without queue lock held. */ | 764 | /* Dispatch throttled bios. Should be called without queue lock held. */ |
@@ -817,10 +815,10 @@ void blk_throtl_work(struct work_struct *work) | |||
817 | } | 815 | } |
818 | 816 | ||
819 | /* Call with queue lock held */ | 817 | /* Call with queue lock held */ |
820 | void throtl_schedule_delayed_work(struct request_queue *q, unsigned long delay) | 818 | static void |
819 | throtl_schedule_delayed_work(struct throtl_data *td, unsigned long delay) | ||
821 | { | 820 | { |
822 | 821 | ||
823 | struct throtl_data *td = q->td; | ||
824 | struct delayed_work *dwork = &td->throtl_work; | 822 | struct delayed_work *dwork = &td->throtl_work; |
825 | 823 | ||
826 | if (total_nr_queued(td) > 0) { | 824 | if (total_nr_queued(td) > 0) { |
@@ -829,12 +827,11 @@ void throtl_schedule_delayed_work(struct request_queue *q, unsigned long delay) | |||
829 | * Cancel that and schedule a new one. | 827 | * Cancel that and schedule a new one. |
830 | */ | 828 | */ |
831 | __cancel_delayed_work(dwork); | 829 | __cancel_delayed_work(dwork); |
832 | kblockd_schedule_delayed_work(q, dwork, delay); | 830 | queue_delayed_work(kthrotld_workqueue, dwork, delay); |
833 | throtl_log(td, "schedule work. delay=%lu jiffies=%lu", | 831 | throtl_log(td, "schedule work. delay=%lu jiffies=%lu", |
834 | delay, jiffies); | 832 | delay, jiffies); |
835 | } | 833 | } |
836 | } | 834 | } |
837 | EXPORT_SYMBOL(throtl_schedule_delayed_work); | ||
838 | 835 | ||
839 | static void | 836 | static void |
840 | throtl_destroy_tg(struct throtl_data *td, struct throtl_grp *tg) | 837 | throtl_destroy_tg(struct throtl_data *td, struct throtl_grp *tg) |
@@ -897,6 +894,15 @@ void throtl_unlink_blkio_group(void *key, struct blkio_group *blkg) | |||
897 | spin_unlock_irqrestore(td->queue->queue_lock, flags); | 894 | spin_unlock_irqrestore(td->queue->queue_lock, flags); |
898 | } | 895 | } |
899 | 896 | ||
897 | static void throtl_update_blkio_group_common(struct throtl_data *td, | ||
898 | struct throtl_grp *tg) | ||
899 | { | ||
900 | xchg(&tg->limits_changed, true); | ||
901 | xchg(&td->limits_changed, true); | ||
902 | /* Schedule a work now to process the limit change */ | ||
903 | throtl_schedule_delayed_work(td, 0); | ||
904 | } | ||
905 | |||
900 | /* | 906 | /* |
901 | * For all update functions, key should be a valid pointer because these | 907 | * For all update functions, key should be a valid pointer because these |
902 | * update functions are called under blkcg_lock, that means, blkg is | 908 | * update functions are called under blkcg_lock, that means, blkg is |
@@ -910,64 +916,43 @@ static void throtl_update_blkio_group_read_bps(void *key, | |||
910 | struct blkio_group *blkg, u64 read_bps) | 916 | struct blkio_group *blkg, u64 read_bps) |
911 | { | 917 | { |
912 | struct throtl_data *td = key; | 918 | struct throtl_data *td = key; |
919 | struct throtl_grp *tg = tg_of_blkg(blkg); | ||
913 | 920 | ||
914 | tg_of_blkg(blkg)->bps[READ] = read_bps; | 921 | tg->bps[READ] = read_bps; |
915 | /* Make sure read_bps is updated before setting limits_changed */ | 922 | throtl_update_blkio_group_common(td, tg); |
916 | smp_wmb(); | ||
917 | tg_of_blkg(blkg)->limits_changed = true; | ||
918 | |||
919 | /* Make sure tg->limits_changed is updated before td->limits_changed */ | ||
920 | smp_mb__before_atomic_inc(); | ||
921 | atomic_inc(&td->limits_changed); | ||
922 | smp_mb__after_atomic_inc(); | ||
923 | |||
924 | /* Schedule a work now to process the limit change */ | ||
925 | throtl_schedule_delayed_work(td->queue, 0); | ||
926 | } | 923 | } |
927 | 924 | ||
928 | static void throtl_update_blkio_group_write_bps(void *key, | 925 | static void throtl_update_blkio_group_write_bps(void *key, |
929 | struct blkio_group *blkg, u64 write_bps) | 926 | struct blkio_group *blkg, u64 write_bps) |
930 | { | 927 | { |
931 | struct throtl_data *td = key; | 928 | struct throtl_data *td = key; |
929 | struct throtl_grp *tg = tg_of_blkg(blkg); | ||
932 | 930 | ||
933 | tg_of_blkg(blkg)->bps[WRITE] = write_bps; | 931 | tg->bps[WRITE] = write_bps; |
934 | smp_wmb(); | 932 | throtl_update_blkio_group_common(td, tg); |
935 | tg_of_blkg(blkg)->limits_changed = true; | ||
936 | smp_mb__before_atomic_inc(); | ||
937 | atomic_inc(&td->limits_changed); | ||
938 | smp_mb__after_atomic_inc(); | ||
939 | throtl_schedule_delayed_work(td->queue, 0); | ||
940 | } | 933 | } |
941 | 934 | ||
942 | static void throtl_update_blkio_group_read_iops(void *key, | 935 | static void throtl_update_blkio_group_read_iops(void *key, |
943 | struct blkio_group *blkg, unsigned int read_iops) | 936 | struct blkio_group *blkg, unsigned int read_iops) |
944 | { | 937 | { |
945 | struct throtl_data *td = key; | 938 | struct throtl_data *td = key; |
939 | struct throtl_grp *tg = tg_of_blkg(blkg); | ||
946 | 940 | ||
947 | tg_of_blkg(blkg)->iops[READ] = read_iops; | 941 | tg->iops[READ] = read_iops; |
948 | smp_wmb(); | 942 | throtl_update_blkio_group_common(td, tg); |
949 | tg_of_blkg(blkg)->limits_changed = true; | ||
950 | smp_mb__before_atomic_inc(); | ||
951 | atomic_inc(&td->limits_changed); | ||
952 | smp_mb__after_atomic_inc(); | ||
953 | throtl_schedule_delayed_work(td->queue, 0); | ||
954 | } | 943 | } |
955 | 944 | ||
956 | static void throtl_update_blkio_group_write_iops(void *key, | 945 | static void throtl_update_blkio_group_write_iops(void *key, |
957 | struct blkio_group *blkg, unsigned int write_iops) | 946 | struct blkio_group *blkg, unsigned int write_iops) |
958 | { | 947 | { |
959 | struct throtl_data *td = key; | 948 | struct throtl_data *td = key; |
949 | struct throtl_grp *tg = tg_of_blkg(blkg); | ||
960 | 950 | ||
961 | tg_of_blkg(blkg)->iops[WRITE] = write_iops; | 951 | tg->iops[WRITE] = write_iops; |
962 | smp_wmb(); | 952 | throtl_update_blkio_group_common(td, tg); |
963 | tg_of_blkg(blkg)->limits_changed = true; | ||
964 | smp_mb__before_atomic_inc(); | ||
965 | atomic_inc(&td->limits_changed); | ||
966 | smp_mb__after_atomic_inc(); | ||
967 | throtl_schedule_delayed_work(td->queue, 0); | ||
968 | } | 953 | } |
969 | 954 | ||
970 | void throtl_shutdown_timer_wq(struct request_queue *q) | 955 | static void throtl_shutdown_wq(struct request_queue *q) |
971 | { | 956 | { |
972 | struct throtl_data *td = q->td; | 957 | struct throtl_data *td = q->td; |
973 | 958 | ||
@@ -1008,15 +993,10 @@ int blk_throtl_bio(struct request_queue *q, struct bio **biop) | |||
1008 | /* | 993 | /* |
1009 | * There is already another bio queued in same dir. No | 994 | * There is already another bio queued in same dir. No |
1010 | * need to update dispatch time. | 995 | * need to update dispatch time. |
1011 | * Still update the disptime if rate limits on this group | ||
1012 | * were changed. | ||
1013 | */ | 996 | */ |
1014 | if (!tg->limits_changed) | 997 | update_disptime = false; |
1015 | update_disptime = false; | ||
1016 | else | ||
1017 | tg->limits_changed = false; | ||
1018 | |||
1019 | goto queue_bio; | 998 | goto queue_bio; |
999 | |||
1020 | } | 1000 | } |
1021 | 1001 | ||
1022 | /* Bio is with-in rate limit of group */ | 1002 | /* Bio is with-in rate limit of group */ |
@@ -1057,7 +1037,7 @@ int blk_throtl_init(struct request_queue *q) | |||
1057 | 1037 | ||
1058 | INIT_HLIST_HEAD(&td->tg_list); | 1038 | INIT_HLIST_HEAD(&td->tg_list); |
1059 | td->tg_service_tree = THROTL_RB_ROOT; | 1039 | td->tg_service_tree = THROTL_RB_ROOT; |
1060 | atomic_set(&td->limits_changed, 0); | 1040 | td->limits_changed = false; |
1061 | 1041 | ||
1062 | /* Init root group */ | 1042 | /* Init root group */ |
1063 | tg = &td->root_tg; | 1043 | tg = &td->root_tg; |
@@ -1069,6 +1049,7 @@ int blk_throtl_init(struct request_queue *q) | |||
1069 | /* Practically unlimited BW */ | 1049 | /* Practically unlimited BW */ |
1070 | tg->bps[0] = tg->bps[1] = -1; | 1050 | tg->bps[0] = tg->bps[1] = -1; |
1071 | tg->iops[0] = tg->iops[1] = -1; | 1051 | tg->iops[0] = tg->iops[1] = -1; |
1052 | td->limits_changed = false; | ||
1072 | 1053 | ||
1073 | /* | 1054 | /* |
1074 | * Set root group reference to 2. One reference will be dropped when | 1055 | * Set root group reference to 2. One reference will be dropped when |
@@ -1101,7 +1082,7 @@ void blk_throtl_exit(struct request_queue *q) | |||
1101 | 1082 | ||
1102 | BUG_ON(!td); | 1083 | BUG_ON(!td); |
1103 | 1084 | ||
1104 | throtl_shutdown_timer_wq(q); | 1085 | throtl_shutdown_wq(q); |
1105 | 1086 | ||
1106 | spin_lock_irq(q->queue_lock); | 1087 | spin_lock_irq(q->queue_lock); |
1107 | throtl_release_tgs(td); | 1088 | throtl_release_tgs(td); |
@@ -1131,12 +1112,16 @@ void blk_throtl_exit(struct request_queue *q) | |||
1131 | * update limits through cgroup and another work got queued, cancel | 1112 | * update limits through cgroup and another work got queued, cancel |
1132 | * it. | 1113 | * it. |
1133 | */ | 1114 | */ |
1134 | throtl_shutdown_timer_wq(q); | 1115 | throtl_shutdown_wq(q); |
1135 | throtl_td_free(td); | 1116 | throtl_td_free(td); |
1136 | } | 1117 | } |
1137 | 1118 | ||
1138 | static int __init throtl_init(void) | 1119 | static int __init throtl_init(void) |
1139 | { | 1120 | { |
1121 | kthrotld_workqueue = alloc_workqueue("kthrotld", WQ_MEM_RECLAIM, 0); | ||
1122 | if (!kthrotld_workqueue) | ||
1123 | panic("Failed to create kthrotld\n"); | ||
1124 | |||
1140 | blkio_policy_register(&blkio_policy_throtl); | 1125 | blkio_policy_register(&blkio_policy_throtl); |
1141 | return 0; | 1126 | return 0; |
1142 | } | 1127 | } |
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index ef631539dd2a..c826ef81c679 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c | |||
@@ -237,6 +237,7 @@ struct cfq_data { | |||
237 | struct rb_root prio_trees[CFQ_PRIO_LISTS]; | 237 | struct rb_root prio_trees[CFQ_PRIO_LISTS]; |
238 | 238 | ||
239 | unsigned int busy_queues; | 239 | unsigned int busy_queues; |
240 | unsigned int busy_sync_queues; | ||
240 | 241 | ||
241 | int rq_in_driver; | 242 | int rq_in_driver; |
242 | int rq_in_flight[2]; | 243 | int rq_in_flight[2]; |
@@ -549,15 +550,13 @@ static inline u64 min_vdisktime(u64 min_vdisktime, u64 vdisktime) | |||
549 | 550 | ||
550 | static void update_min_vdisktime(struct cfq_rb_root *st) | 551 | static void update_min_vdisktime(struct cfq_rb_root *st) |
551 | { | 552 | { |
552 | u64 vdisktime = st->min_vdisktime; | ||
553 | struct cfq_group *cfqg; | 553 | struct cfq_group *cfqg; |
554 | 554 | ||
555 | if (st->left) { | 555 | if (st->left) { |
556 | cfqg = rb_entry_cfqg(st->left); | 556 | cfqg = rb_entry_cfqg(st->left); |
557 | vdisktime = min_vdisktime(vdisktime, cfqg->vdisktime); | 557 | st->min_vdisktime = max_vdisktime(st->min_vdisktime, |
558 | cfqg->vdisktime); | ||
558 | } | 559 | } |
559 | |||
560 | st->min_vdisktime = max_vdisktime(st->min_vdisktime, vdisktime); | ||
561 | } | 560 | } |
562 | 561 | ||
563 | /* | 562 | /* |
@@ -1337,6 +1336,8 @@ static void cfq_add_cfqq_rr(struct cfq_data *cfqd, struct cfq_queue *cfqq) | |||
1337 | BUG_ON(cfq_cfqq_on_rr(cfqq)); | 1336 | BUG_ON(cfq_cfqq_on_rr(cfqq)); |
1338 | cfq_mark_cfqq_on_rr(cfqq); | 1337 | cfq_mark_cfqq_on_rr(cfqq); |
1339 | cfqd->busy_queues++; | 1338 | cfqd->busy_queues++; |
1339 | if (cfq_cfqq_sync(cfqq)) | ||
1340 | cfqd->busy_sync_queues++; | ||
1340 | 1341 | ||
1341 | cfq_resort_rr_list(cfqd, cfqq); | 1342 | cfq_resort_rr_list(cfqd, cfqq); |
1342 | } | 1343 | } |
@@ -1363,6 +1364,8 @@ static void cfq_del_cfqq_rr(struct cfq_data *cfqd, struct cfq_queue *cfqq) | |||
1363 | cfq_group_service_tree_del(cfqd, cfqq->cfqg); | 1364 | cfq_group_service_tree_del(cfqd, cfqq->cfqg); |
1364 | BUG_ON(!cfqd->busy_queues); | 1365 | BUG_ON(!cfqd->busy_queues); |
1365 | cfqd->busy_queues--; | 1366 | cfqd->busy_queues--; |
1367 | if (cfq_cfqq_sync(cfqq)) | ||
1368 | cfqd->busy_sync_queues--; | ||
1366 | } | 1369 | } |
1367 | 1370 | ||
1368 | /* | 1371 | /* |
@@ -2370,6 +2373,7 @@ static bool cfq_may_dispatch(struct cfq_data *cfqd, struct cfq_queue *cfqq) | |||
2370 | * Does this cfqq already have too much IO in flight? | 2373 | * Does this cfqq already have too much IO in flight? |
2371 | */ | 2374 | */ |
2372 | if (cfqq->dispatched >= max_dispatch) { | 2375 | if (cfqq->dispatched >= max_dispatch) { |
2376 | bool promote_sync = false; | ||
2373 | /* | 2377 | /* |
2374 | * idle queue must always only have a single IO in flight | 2378 | * idle queue must always only have a single IO in flight |
2375 | */ | 2379 | */ |
@@ -2377,15 +2381,31 @@ static bool cfq_may_dispatch(struct cfq_data *cfqd, struct cfq_queue *cfqq) | |||
2377 | return false; | 2381 | return false; |
2378 | 2382 | ||
2379 | /* | 2383 | /* |
2384 | * If there is only one sync queue, and its think time is | ||
2385 | * small, we can ignore async queue here and give the sync | ||
2386 | * queue no dispatch limit. The reason is a sync queue can | ||
2387 | * preempt async queue, limiting the sync queue doesn't make | ||
2388 | * sense. This is useful for aiostress test. | ||
2389 | */ | ||
2390 | if (cfq_cfqq_sync(cfqq) && cfqd->busy_sync_queues == 1) { | ||
2391 | struct cfq_io_context *cic = RQ_CIC(cfqq->next_rq); | ||
2392 | |||
2393 | if (sample_valid(cic->ttime_samples) && | ||
2394 | cic->ttime_mean < cfqd->cfq_slice_idle) | ||
2395 | promote_sync = true; | ||
2396 | } | ||
2397 | |||
2398 | /* | ||
2380 | * We have other queues, don't allow more IO from this one | 2399 | * We have other queues, don't allow more IO from this one |
2381 | */ | 2400 | */ |
2382 | if (cfqd->busy_queues > 1 && cfq_slice_used_soon(cfqd, cfqq)) | 2401 | if (cfqd->busy_queues > 1 && cfq_slice_used_soon(cfqd, cfqq) && |
2402 | !promote_sync) | ||
2383 | return false; | 2403 | return false; |
2384 | 2404 | ||
2385 | /* | 2405 | /* |
2386 | * Sole queue user, no limit | 2406 | * Sole queue user, no limit |
2387 | */ | 2407 | */ |
2388 | if (cfqd->busy_queues == 1) | 2408 | if (cfqd->busy_queues == 1 || promote_sync) |
2389 | max_dispatch = -1; | 2409 | max_dispatch = -1; |
2390 | else | 2410 | else |
2391 | /* | 2411 | /* |
@@ -3317,7 +3337,7 @@ cfq_rq_enqueued(struct cfq_data *cfqd, struct cfq_queue *cfqq, | |||
3317 | cfqd->busy_queues > 1) { | 3337 | cfqd->busy_queues > 1) { |
3318 | cfq_del_timer(cfqd, cfqq); | 3338 | cfq_del_timer(cfqd, cfqq); |
3319 | cfq_clear_cfqq_wait_request(cfqq); | 3339 | cfq_clear_cfqq_wait_request(cfqq); |
3320 | __blk_run_queue(cfqd->queue); | 3340 | __blk_run_queue(cfqd->queue, false); |
3321 | } else { | 3341 | } else { |
3322 | cfq_blkiocg_update_idle_time_stats( | 3342 | cfq_blkiocg_update_idle_time_stats( |
3323 | &cfqq->cfqg->blkg); | 3343 | &cfqq->cfqg->blkg); |
@@ -3332,7 +3352,7 @@ cfq_rq_enqueued(struct cfq_data *cfqd, struct cfq_queue *cfqq, | |||
3332 | * this new queue is RT and the current one is BE | 3352 | * this new queue is RT and the current one is BE |
3333 | */ | 3353 | */ |
3334 | cfq_preempt_queue(cfqd, cfqq); | 3354 | cfq_preempt_queue(cfqd, cfqq); |
3335 | __blk_run_queue(cfqd->queue); | 3355 | __blk_run_queue(cfqd->queue, false); |
3336 | } | 3356 | } |
3337 | } | 3357 | } |
3338 | 3358 | ||
@@ -3668,12 +3688,11 @@ new_queue: | |||
3668 | 3688 | ||
3669 | cfqq->allocated[rw]++; | 3689 | cfqq->allocated[rw]++; |
3670 | 3690 | ||
3671 | spin_unlock_irqrestore(q->queue_lock, flags); | ||
3672 | |||
3673 | cfqq->ref++; | 3691 | cfqq->ref++; |
3674 | rq->elevator_private[0] = cic; | 3692 | rq->elevator_private[0] = cic; |
3675 | rq->elevator_private[1] = cfqq; | 3693 | rq->elevator_private[1] = cfqq; |
3676 | rq->elevator_private[2] = cfq_ref_get_cfqg(cfqq->cfqg); | 3694 | rq->elevator_private[2] = cfq_ref_get_cfqg(cfqq->cfqg); |
3695 | spin_unlock_irqrestore(q->queue_lock, flags); | ||
3677 | return 0; | 3696 | return 0; |
3678 | 3697 | ||
3679 | queue_fail: | 3698 | queue_fail: |
@@ -3693,7 +3712,7 @@ static void cfq_kick_queue(struct work_struct *work) | |||
3693 | struct request_queue *q = cfqd->queue; | 3712 | struct request_queue *q = cfqd->queue; |
3694 | 3713 | ||
3695 | spin_lock_irq(q->queue_lock); | 3714 | spin_lock_irq(q->queue_lock); |
3696 | __blk_run_queue(cfqd->queue); | 3715 | __blk_run_queue(cfqd->queue, false); |
3697 | spin_unlock_irq(q->queue_lock); | 3716 | spin_unlock_irq(q->queue_lock); |
3698 | } | 3717 | } |
3699 | 3718 | ||
diff --git a/block/elevator.c b/block/elevator.c index 3ea208256e78..542ce826b401 100644 --- a/block/elevator.c +++ b/block/elevator.c | |||
@@ -604,7 +604,7 @@ void elv_quiesce_start(struct request_queue *q) | |||
604 | */ | 604 | */ |
605 | elv_drain_elevator(q); | 605 | elv_drain_elevator(q); |
606 | while (q->rq.elvpriv) { | 606 | while (q->rq.elvpriv) { |
607 | __blk_run_queue(q); | 607 | __blk_run_queue(q, false); |
608 | spin_unlock_irq(q->queue_lock); | 608 | spin_unlock_irq(q->queue_lock); |
609 | msleep(10); | 609 | msleep(10); |
610 | spin_lock_irq(q->queue_lock); | 610 | spin_lock_irq(q->queue_lock); |
@@ -644,7 +644,7 @@ void elv_insert(struct request_queue *q, struct request *rq, int where) | |||
644 | * with anything. There's no point in delaying queue | 644 | * with anything. There's no point in delaying queue |
645 | * processing. | 645 | * processing. |
646 | */ | 646 | */ |
647 | __blk_run_queue(q); | 647 | __blk_run_queue(q, false); |
648 | break; | 648 | break; |
649 | 649 | ||
650 | case ELEVATOR_INSERT_SORT: | 650 | case ELEVATOR_INSERT_SORT: |
diff --git a/block/genhd.c b/block/genhd.c index 73d85a8e3c85..c91a2dac6b6b 100644 --- a/block/genhd.c +++ b/block/genhd.c | |||
@@ -1355,7 +1355,7 @@ int invalidate_partition(struct gendisk *disk, int partno) | |||
1355 | struct block_device *bdev = bdget_disk(disk, partno); | 1355 | struct block_device *bdev = bdget_disk(disk, partno); |
1356 | if (bdev) { | 1356 | if (bdev) { |
1357 | fsync_bdev(bdev); | 1357 | fsync_bdev(bdev); |
1358 | res = __invalidate_device(bdev); | 1358 | res = __invalidate_device(bdev, true); |
1359 | bdput(bdev); | 1359 | bdput(bdev); |
1360 | } | 1360 | } |
1361 | return res; | 1361 | return res; |
@@ -1494,7 +1494,7 @@ void disk_block_events(struct gendisk *disk) | |||
1494 | void disk_unblock_events(struct gendisk *disk) | 1494 | void disk_unblock_events(struct gendisk *disk) |
1495 | { | 1495 | { |
1496 | if (disk->ev) | 1496 | if (disk->ev) |
1497 | __disk_unblock_events(disk, true); | 1497 | __disk_unblock_events(disk, false); |
1498 | } | 1498 | } |
1499 | 1499 | ||
1500 | /** | 1500 | /** |
diff --git a/block/ioctl.c b/block/ioctl.c index 9049d460fa89..1124cd297263 100644 --- a/block/ioctl.c +++ b/block/ioctl.c | |||
@@ -294,9 +294,11 @@ int blkdev_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd, | |||
294 | return -EINVAL; | 294 | return -EINVAL; |
295 | if (get_user(n, (int __user *) arg)) | 295 | if (get_user(n, (int __user *) arg)) |
296 | return -EFAULT; | 296 | return -EFAULT; |
297 | if (!(mode & FMODE_EXCL) && | 297 | if (!(mode & FMODE_EXCL)) { |
298 | blkdev_get(bdev, mode | FMODE_EXCL, &bdev) < 0) | 298 | bdgrab(bdev); |
299 | return -EBUSY; | 299 | if (blkdev_get(bdev, mode | FMODE_EXCL, &bdev) < 0) |
300 | return -EBUSY; | ||
301 | } | ||
300 | ret = set_blocksize(bdev, n); | 302 | ret = set_blocksize(bdev, n); |
301 | if (!(mode & FMODE_EXCL)) | 303 | if (!(mode & FMODE_EXCL)) |
302 | blkdev_put(bdev, mode | FMODE_EXCL); | 304 | blkdev_put(bdev, mode | FMODE_EXCL); |
diff --git a/drivers/block/DAC960.c b/drivers/block/DAC960.c index 1f286ab461d3..79882104e431 100644 --- a/drivers/block/DAC960.c +++ b/drivers/block/DAC960.c | |||
@@ -140,13 +140,14 @@ static int DAC960_getgeo(struct block_device *bdev, struct hd_geometry *geo) | |||
140 | return 0; | 140 | return 0; |
141 | } | 141 | } |
142 | 142 | ||
143 | static int DAC960_media_changed(struct gendisk *disk) | 143 | static unsigned int DAC960_check_events(struct gendisk *disk, |
144 | unsigned int clearing) | ||
144 | { | 145 | { |
145 | DAC960_Controller_T *p = disk->queue->queuedata; | 146 | DAC960_Controller_T *p = disk->queue->queuedata; |
146 | int drive_nr = (long)disk->private_data; | 147 | int drive_nr = (long)disk->private_data; |
147 | 148 | ||
148 | if (!p->LogicalDriveInitiallyAccessible[drive_nr]) | 149 | if (!p->LogicalDriveInitiallyAccessible[drive_nr]) |
149 | return 1; | 150 | return DISK_EVENT_MEDIA_CHANGE; |
150 | return 0; | 151 | return 0; |
151 | } | 152 | } |
152 | 153 | ||
@@ -163,7 +164,7 @@ static const struct block_device_operations DAC960_BlockDeviceOperations = { | |||
163 | .owner = THIS_MODULE, | 164 | .owner = THIS_MODULE, |
164 | .open = DAC960_open, | 165 | .open = DAC960_open, |
165 | .getgeo = DAC960_getgeo, | 166 | .getgeo = DAC960_getgeo, |
166 | .media_changed = DAC960_media_changed, | 167 | .check_events = DAC960_check_events, |
167 | .revalidate_disk = DAC960_revalidate_disk, | 168 | .revalidate_disk = DAC960_revalidate_disk, |
168 | }; | 169 | }; |
169 | 170 | ||
@@ -2546,6 +2547,7 @@ static bool DAC960_RegisterBlockDevice(DAC960_Controller_T *Controller) | |||
2546 | disk->major = MajorNumber; | 2547 | disk->major = MajorNumber; |
2547 | disk->first_minor = n << DAC960_MaxPartitionsBits; | 2548 | disk->first_minor = n << DAC960_MaxPartitionsBits; |
2548 | disk->fops = &DAC960_BlockDeviceOperations; | 2549 | disk->fops = &DAC960_BlockDeviceOperations; |
2550 | disk->events = DISK_EVENT_MEDIA_CHANGE; | ||
2549 | } | 2551 | } |
2550 | /* | 2552 | /* |
2551 | Indicate the Block Device Registration completed successfully, | 2553 | Indicate the Block Device Registration completed successfully, |
diff --git a/drivers/block/amiflop.c b/drivers/block/amiflop.c index 7888501ad9ee..5e7d3fe2c13b 100644 --- a/drivers/block/amiflop.c +++ b/drivers/block/amiflop.c | |||
@@ -1658,12 +1658,12 @@ static int floppy_release(struct gendisk *disk, fmode_t mode) | |||
1658 | } | 1658 | } |
1659 | 1659 | ||
1660 | /* | 1660 | /* |
1661 | * floppy-change is never called from an interrupt, so we can relax a bit | 1661 | * check_events is never called from an interrupt, so we can relax a bit |
1662 | * here, sleep etc. Note that floppy-on tries to set current_DOR to point | 1662 | * here, sleep etc. Note that floppy-on tries to set current_DOR to point |
1663 | * to the desired drive, but it will probably not survive the sleep if | 1663 | * to the desired drive, but it will probably not survive the sleep if |
1664 | * several floppies are used at the same time: thus the loop. | 1664 | * several floppies are used at the same time: thus the loop. |
1665 | */ | 1665 | */ |
1666 | static int amiga_floppy_change(struct gendisk *disk) | 1666 | static unsigned amiga_check_events(struct gendisk *disk, unsigned int clearing) |
1667 | { | 1667 | { |
1668 | struct amiga_floppy_struct *p = disk->private_data; | 1668 | struct amiga_floppy_struct *p = disk->private_data; |
1669 | int drive = p - unit; | 1669 | int drive = p - unit; |
@@ -1686,7 +1686,7 @@ static int amiga_floppy_change(struct gendisk *disk) | |||
1686 | p->dirty = 0; | 1686 | p->dirty = 0; |
1687 | writepending = 0; /* if this was true before, too bad! */ | 1687 | writepending = 0; /* if this was true before, too bad! */ |
1688 | writefromint = 0; | 1688 | writefromint = 0; |
1689 | return 1; | 1689 | return DISK_EVENT_MEDIA_CHANGE; |
1690 | } | 1690 | } |
1691 | return 0; | 1691 | return 0; |
1692 | } | 1692 | } |
@@ -1697,7 +1697,7 @@ static const struct block_device_operations floppy_fops = { | |||
1697 | .release = floppy_release, | 1697 | .release = floppy_release, |
1698 | .ioctl = fd_ioctl, | 1698 | .ioctl = fd_ioctl, |
1699 | .getgeo = fd_getgeo, | 1699 | .getgeo = fd_getgeo, |
1700 | .media_changed = amiga_floppy_change, | 1700 | .check_events = amiga_check_events, |
1701 | }; | 1701 | }; |
1702 | 1702 | ||
1703 | static int __init fd_probe_drives(void) | 1703 | static int __init fd_probe_drives(void) |
@@ -1736,6 +1736,7 @@ static int __init fd_probe_drives(void) | |||
1736 | disk->major = FLOPPY_MAJOR; | 1736 | disk->major = FLOPPY_MAJOR; |
1737 | disk->first_minor = drive; | 1737 | disk->first_minor = drive; |
1738 | disk->fops = &floppy_fops; | 1738 | disk->fops = &floppy_fops; |
1739 | disk->events = DISK_EVENT_MEDIA_CHANGE; | ||
1739 | sprintf(disk->disk_name, "fd%d", drive); | 1740 | sprintf(disk->disk_name, "fd%d", drive); |
1740 | disk->private_data = &unit[drive]; | 1741 | disk->private_data = &unit[drive]; |
1741 | set_capacity(disk, 880*2); | 1742 | set_capacity(disk, 880*2); |
diff --git a/drivers/block/ataflop.c b/drivers/block/ataflop.c index 605a67e40bbf..c871eae14120 100644 --- a/drivers/block/ataflop.c +++ b/drivers/block/ataflop.c | |||
@@ -1324,23 +1324,24 @@ static void finish_fdc_done( int dummy ) | |||
1324 | * due to unrecognised disk changes. | 1324 | * due to unrecognised disk changes. |
1325 | */ | 1325 | */ |
1326 | 1326 | ||
1327 | static int check_floppy_change(struct gendisk *disk) | 1327 | static unsigned int floppy_check_events(struct gendisk *disk, |
1328 | unsigned int clearing) | ||
1328 | { | 1329 | { |
1329 | struct atari_floppy_struct *p = disk->private_data; | 1330 | struct atari_floppy_struct *p = disk->private_data; |
1330 | unsigned int drive = p - unit; | 1331 | unsigned int drive = p - unit; |
1331 | if (test_bit (drive, &fake_change)) { | 1332 | if (test_bit (drive, &fake_change)) { |
1332 | /* simulated change (e.g. after formatting) */ | 1333 | /* simulated change (e.g. after formatting) */ |
1333 | return 1; | 1334 | return DISK_EVENT_MEDIA_CHANGE; |
1334 | } | 1335 | } |
1335 | if (test_bit (drive, &changed_floppies)) { | 1336 | if (test_bit (drive, &changed_floppies)) { |
1336 | /* surely changed (the WP signal changed at least once) */ | 1337 | /* surely changed (the WP signal changed at least once) */ |
1337 | return 1; | 1338 | return DISK_EVENT_MEDIA_CHANGE; |
1338 | } | 1339 | } |
1339 | if (UD.wpstat) { | 1340 | if (UD.wpstat) { |
1340 | /* WP is on -> could be changed: to be sure, buffers should be | 1341 | /* WP is on -> could be changed: to be sure, buffers should be |
1341 | * invalidated... | 1342 | * invalidated... |
1342 | */ | 1343 | */ |
1343 | return 1; | 1344 | return DISK_EVENT_MEDIA_CHANGE; |
1344 | } | 1345 | } |
1345 | 1346 | ||
1346 | return 0; | 1347 | return 0; |
@@ -1570,7 +1571,7 @@ static int fd_locked_ioctl(struct block_device *bdev, fmode_t mode, | |||
1570 | * or the next access will revalidate - and clear UDT :-( | 1571 | * or the next access will revalidate - and clear UDT :-( |
1571 | */ | 1572 | */ |
1572 | 1573 | ||
1573 | if (check_floppy_change(disk)) | 1574 | if (floppy_check_events(disk, 0)) |
1574 | floppy_revalidate(disk); | 1575 | floppy_revalidate(disk); |
1575 | 1576 | ||
1576 | if (UD.flags & FTD_MSG) | 1577 | if (UD.flags & FTD_MSG) |
@@ -1904,7 +1905,7 @@ static const struct block_device_operations floppy_fops = { | |||
1904 | .open = floppy_unlocked_open, | 1905 | .open = floppy_unlocked_open, |
1905 | .release = floppy_release, | 1906 | .release = floppy_release, |
1906 | .ioctl = fd_ioctl, | 1907 | .ioctl = fd_ioctl, |
1907 | .media_changed = check_floppy_change, | 1908 | .check_events = floppy_check_events, |
1908 | .revalidate_disk= floppy_revalidate, | 1909 | .revalidate_disk= floppy_revalidate, |
1909 | }; | 1910 | }; |
1910 | 1911 | ||
@@ -1963,6 +1964,7 @@ static int __init atari_floppy_init (void) | |||
1963 | unit[i].disk->first_minor = i; | 1964 | unit[i].disk->first_minor = i; |
1964 | sprintf(unit[i].disk->disk_name, "fd%d", i); | 1965 | sprintf(unit[i].disk->disk_name, "fd%d", i); |
1965 | unit[i].disk->fops = &floppy_fops; | 1966 | unit[i].disk->fops = &floppy_fops; |
1967 | unit[i].disk->events = DISK_EVENT_MEDIA_CHANGE; | ||
1966 | unit[i].disk->private_data = &unit[i]; | 1968 | unit[i].disk->private_data = &unit[i]; |
1967 | unit[i].disk->queue = blk_init_queue(do_fd_request, | 1969 | unit[i].disk->queue = blk_init_queue(do_fd_request, |
1968 | &ataflop_lock); | 1970 | &ataflop_lock); |
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index 271142b9e2cd..301d7a9a41a6 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c | |||
@@ -3281,7 +3281,7 @@ static int set_geometry(unsigned int cmd, struct floppy_struct *g, | |||
3281 | struct block_device *bdev = opened_bdev[cnt]; | 3281 | struct block_device *bdev = opened_bdev[cnt]; |
3282 | if (!bdev || ITYPE(drive_state[cnt].fd_device) != type) | 3282 | if (!bdev || ITYPE(drive_state[cnt].fd_device) != type) |
3283 | continue; | 3283 | continue; |
3284 | __invalidate_device(bdev); | 3284 | __invalidate_device(bdev, true); |
3285 | } | 3285 | } |
3286 | mutex_unlock(&open_lock); | 3286 | mutex_unlock(&open_lock); |
3287 | } else { | 3287 | } else { |
@@ -3770,13 +3770,14 @@ out2: | |||
3770 | /* | 3770 | /* |
3771 | * Check if the disk has been changed or if a change has been faked. | 3771 | * Check if the disk has been changed or if a change has been faked. |
3772 | */ | 3772 | */ |
3773 | static int check_floppy_change(struct gendisk *disk) | 3773 | static unsigned int floppy_check_events(struct gendisk *disk, |
3774 | unsigned int clearing) | ||
3774 | { | 3775 | { |
3775 | int drive = (long)disk->private_data; | 3776 | int drive = (long)disk->private_data; |
3776 | 3777 | ||
3777 | if (test_bit(FD_DISK_CHANGED_BIT, &UDRS->flags) || | 3778 | if (test_bit(FD_DISK_CHANGED_BIT, &UDRS->flags) || |
3778 | test_bit(FD_VERIFY_BIT, &UDRS->flags)) | 3779 | test_bit(FD_VERIFY_BIT, &UDRS->flags)) |
3779 | return 1; | 3780 | return DISK_EVENT_MEDIA_CHANGE; |
3780 | 3781 | ||
3781 | if (time_after(jiffies, UDRS->last_checked + UDP->checkfreq)) { | 3782 | if (time_after(jiffies, UDRS->last_checked + UDP->checkfreq)) { |
3782 | lock_fdc(drive, false); | 3783 | lock_fdc(drive, false); |
@@ -3788,7 +3789,7 @@ static int check_floppy_change(struct gendisk *disk) | |||
3788 | test_bit(FD_VERIFY_BIT, &UDRS->flags) || | 3789 | test_bit(FD_VERIFY_BIT, &UDRS->flags) || |
3789 | test_bit(drive, &fake_change) || | 3790 | test_bit(drive, &fake_change) || |
3790 | drive_no_geom(drive)) | 3791 | drive_no_geom(drive)) |
3791 | return 1; | 3792 | return DISK_EVENT_MEDIA_CHANGE; |
3792 | return 0; | 3793 | return 0; |
3793 | } | 3794 | } |
3794 | 3795 | ||
@@ -3897,7 +3898,7 @@ static const struct block_device_operations floppy_fops = { | |||
3897 | .release = floppy_release, | 3898 | .release = floppy_release, |
3898 | .ioctl = fd_ioctl, | 3899 | .ioctl = fd_ioctl, |
3899 | .getgeo = fd_getgeo, | 3900 | .getgeo = fd_getgeo, |
3900 | .media_changed = check_floppy_change, | 3901 | .check_events = floppy_check_events, |
3901 | .revalidate_disk = floppy_revalidate, | 3902 | .revalidate_disk = floppy_revalidate, |
3902 | }; | 3903 | }; |
3903 | 3904 | ||
@@ -4204,6 +4205,7 @@ static int __init floppy_init(void) | |||
4204 | disks[dr]->major = FLOPPY_MAJOR; | 4205 | disks[dr]->major = FLOPPY_MAJOR; |
4205 | disks[dr]->first_minor = TOMINOR(dr); | 4206 | disks[dr]->first_minor = TOMINOR(dr); |
4206 | disks[dr]->fops = &floppy_fops; | 4207 | disks[dr]->fops = &floppy_fops; |
4208 | disks[dr]->events = DISK_EVENT_MEDIA_CHANGE; | ||
4207 | sprintf(disks[dr]->disk_name, "fd%d", dr); | 4209 | sprintf(disks[dr]->disk_name, "fd%d", dr); |
4208 | 4210 | ||
4209 | init_timer(&motor_off_timer[dr]); | 4211 | init_timer(&motor_off_timer[dr]); |
diff --git a/drivers/block/loop.c b/drivers/block/loop.c index 01b8e4a87c9f..a076a14ca72d 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c | |||
@@ -78,7 +78,6 @@ | |||
78 | 78 | ||
79 | #include <asm/uaccess.h> | 79 | #include <asm/uaccess.h> |
80 | 80 | ||
81 | static DEFINE_MUTEX(loop_mutex); | ||
82 | static LIST_HEAD(loop_devices); | 81 | static LIST_HEAD(loop_devices); |
83 | static DEFINE_MUTEX(loop_devices_mutex); | 82 | static DEFINE_MUTEX(loop_devices_mutex); |
84 | 83 | ||
@@ -1488,11 +1487,9 @@ static int lo_open(struct block_device *bdev, fmode_t mode) | |||
1488 | { | 1487 | { |
1489 | struct loop_device *lo = bdev->bd_disk->private_data; | 1488 | struct loop_device *lo = bdev->bd_disk->private_data; |
1490 | 1489 | ||
1491 | mutex_lock(&loop_mutex); | ||
1492 | mutex_lock(&lo->lo_ctl_mutex); | 1490 | mutex_lock(&lo->lo_ctl_mutex); |
1493 | lo->lo_refcnt++; | 1491 | lo->lo_refcnt++; |
1494 | mutex_unlock(&lo->lo_ctl_mutex); | 1492 | mutex_unlock(&lo->lo_ctl_mutex); |
1495 | mutex_unlock(&loop_mutex); | ||
1496 | 1493 | ||
1497 | return 0; | 1494 | return 0; |
1498 | } | 1495 | } |
@@ -1502,7 +1499,6 @@ static int lo_release(struct gendisk *disk, fmode_t mode) | |||
1502 | struct loop_device *lo = disk->private_data; | 1499 | struct loop_device *lo = disk->private_data; |
1503 | int err; | 1500 | int err; |
1504 | 1501 | ||
1505 | mutex_lock(&loop_mutex); | ||
1506 | mutex_lock(&lo->lo_ctl_mutex); | 1502 | mutex_lock(&lo->lo_ctl_mutex); |
1507 | 1503 | ||
1508 | if (--lo->lo_refcnt) | 1504 | if (--lo->lo_refcnt) |
@@ -1527,7 +1523,6 @@ static int lo_release(struct gendisk *disk, fmode_t mode) | |||
1527 | out: | 1523 | out: |
1528 | mutex_unlock(&lo->lo_ctl_mutex); | 1524 | mutex_unlock(&lo->lo_ctl_mutex); |
1529 | out_unlocked: | 1525 | out_unlocked: |
1530 | mutex_unlock(&loop_mutex); | ||
1531 | return 0; | 1526 | return 0; |
1532 | } | 1527 | } |
1533 | 1528 | ||
@@ -1628,9 +1623,6 @@ out: | |||
1628 | 1623 | ||
1629 | static void loop_free(struct loop_device *lo) | 1624 | static void loop_free(struct loop_device *lo) |
1630 | { | 1625 | { |
1631 | if (!lo->lo_queue->queue_lock) | ||
1632 | lo->lo_queue->queue_lock = &lo->lo_queue->__queue_lock; | ||
1633 | |||
1634 | blk_cleanup_queue(lo->lo_queue); | 1626 | blk_cleanup_queue(lo->lo_queue); |
1635 | put_disk(lo->lo_disk); | 1627 | put_disk(lo->lo_disk); |
1636 | list_del(&lo->lo_list); | 1628 | list_del(&lo->lo_list); |
diff --git a/drivers/block/paride/pcd.c b/drivers/block/paride/pcd.c index 62cec6afd7ad..2f2ccf686251 100644 --- a/drivers/block/paride/pcd.c +++ b/drivers/block/paride/pcd.c | |||
@@ -172,7 +172,8 @@ module_param_array(drive3, int, NULL, 0); | |||
172 | static int pcd_open(struct cdrom_device_info *cdi, int purpose); | 172 | static int pcd_open(struct cdrom_device_info *cdi, int purpose); |
173 | static void pcd_release(struct cdrom_device_info *cdi); | 173 | static void pcd_release(struct cdrom_device_info *cdi); |
174 | static int pcd_drive_status(struct cdrom_device_info *cdi, int slot_nr); | 174 | static int pcd_drive_status(struct cdrom_device_info *cdi, int slot_nr); |
175 | static int pcd_media_changed(struct cdrom_device_info *cdi, int slot_nr); | 175 | static unsigned int pcd_check_events(struct cdrom_device_info *cdi, |
176 | unsigned int clearing, int slot_nr); | ||
176 | static int pcd_tray_move(struct cdrom_device_info *cdi, int position); | 177 | static int pcd_tray_move(struct cdrom_device_info *cdi, int position); |
177 | static int pcd_lock_door(struct cdrom_device_info *cdi, int lock); | 178 | static int pcd_lock_door(struct cdrom_device_info *cdi, int lock); |
178 | static int pcd_drive_reset(struct cdrom_device_info *cdi); | 179 | static int pcd_drive_reset(struct cdrom_device_info *cdi); |
@@ -257,10 +258,11 @@ static int pcd_block_ioctl(struct block_device *bdev, fmode_t mode, | |||
257 | return ret; | 258 | return ret; |
258 | } | 259 | } |
259 | 260 | ||
260 | static int pcd_block_media_changed(struct gendisk *disk) | 261 | static unsigned int pcd_block_check_events(struct gendisk *disk, |
262 | unsigned int clearing) | ||
261 | { | 263 | { |
262 | struct pcd_unit *cd = disk->private_data; | 264 | struct pcd_unit *cd = disk->private_data; |
263 | return cdrom_media_changed(&cd->info); | 265 | return cdrom_check_events(&cd->info, clearing); |
264 | } | 266 | } |
265 | 267 | ||
266 | static const struct block_device_operations pcd_bdops = { | 268 | static const struct block_device_operations pcd_bdops = { |
@@ -268,14 +270,14 @@ static const struct block_device_operations pcd_bdops = { | |||
268 | .open = pcd_block_open, | 270 | .open = pcd_block_open, |
269 | .release = pcd_block_release, | 271 | .release = pcd_block_release, |
270 | .ioctl = pcd_block_ioctl, | 272 | .ioctl = pcd_block_ioctl, |
271 | .media_changed = pcd_block_media_changed, | 273 | .check_events = pcd_block_check_events, |
272 | }; | 274 | }; |
273 | 275 | ||
274 | static struct cdrom_device_ops pcd_dops = { | 276 | static struct cdrom_device_ops pcd_dops = { |
275 | .open = pcd_open, | 277 | .open = pcd_open, |
276 | .release = pcd_release, | 278 | .release = pcd_release, |
277 | .drive_status = pcd_drive_status, | 279 | .drive_status = pcd_drive_status, |
278 | .media_changed = pcd_media_changed, | 280 | .check_events = pcd_check_events, |
279 | .tray_move = pcd_tray_move, | 281 | .tray_move = pcd_tray_move, |
280 | .lock_door = pcd_lock_door, | 282 | .lock_door = pcd_lock_door, |
281 | .get_mcn = pcd_get_mcn, | 283 | .get_mcn = pcd_get_mcn, |
@@ -318,6 +320,7 @@ static void pcd_init_units(void) | |||
318 | disk->first_minor = unit; | 320 | disk->first_minor = unit; |
319 | strcpy(disk->disk_name, cd->name); /* umm... */ | 321 | strcpy(disk->disk_name, cd->name); /* umm... */ |
320 | disk->fops = &pcd_bdops; | 322 | disk->fops = &pcd_bdops; |
323 | disk->events = DISK_EVENT_MEDIA_CHANGE; | ||
321 | } | 324 | } |
322 | } | 325 | } |
323 | 326 | ||
@@ -502,13 +505,14 @@ static int pcd_packet(struct cdrom_device_info *cdi, struct packet_command *cgc) | |||
502 | 505 | ||
503 | #define DBMSG(msg) ((verbose>1)?(msg):NULL) | 506 | #define DBMSG(msg) ((verbose>1)?(msg):NULL) |
504 | 507 | ||
505 | static int pcd_media_changed(struct cdrom_device_info *cdi, int slot_nr) | 508 | static unsigned int pcd_check_events(struct cdrom_device_info *cdi, |
509 | unsigned int clearing, int slot_nr) | ||
506 | { | 510 | { |
507 | struct pcd_unit *cd = cdi->handle; | 511 | struct pcd_unit *cd = cdi->handle; |
508 | int res = cd->changed; | 512 | int res = cd->changed; |
509 | if (res) | 513 | if (res) |
510 | cd->changed = 0; | 514 | cd->changed = 0; |
511 | return res; | 515 | return res ? DISK_EVENT_MEDIA_CHANGE : 0; |
512 | } | 516 | } |
513 | 517 | ||
514 | static int pcd_lock_door(struct cdrom_device_info *cdi, int lock) | 518 | static int pcd_lock_door(struct cdrom_device_info *cdi, int lock) |
diff --git a/drivers/block/paride/pd.c b/drivers/block/paride/pd.c index c0ee1558b9bb..21dfdb776869 100644 --- a/drivers/block/paride/pd.c +++ b/drivers/block/paride/pd.c | |||
@@ -794,7 +794,7 @@ static int pd_release(struct gendisk *p, fmode_t mode) | |||
794 | return 0; | 794 | return 0; |
795 | } | 795 | } |
796 | 796 | ||
797 | static int pd_check_media(struct gendisk *p) | 797 | static unsigned int pd_check_events(struct gendisk *p, unsigned int clearing) |
798 | { | 798 | { |
799 | struct pd_unit *disk = p->private_data; | 799 | struct pd_unit *disk = p->private_data; |
800 | int r; | 800 | int r; |
@@ -803,7 +803,7 @@ static int pd_check_media(struct gendisk *p) | |||
803 | pd_special_command(disk, pd_media_check); | 803 | pd_special_command(disk, pd_media_check); |
804 | r = disk->changed; | 804 | r = disk->changed; |
805 | disk->changed = 0; | 805 | disk->changed = 0; |
806 | return r; | 806 | return r ? DISK_EVENT_MEDIA_CHANGE : 0; |
807 | } | 807 | } |
808 | 808 | ||
809 | static int pd_revalidate(struct gendisk *p) | 809 | static int pd_revalidate(struct gendisk *p) |
@@ -822,7 +822,7 @@ static const struct block_device_operations pd_fops = { | |||
822 | .release = pd_release, | 822 | .release = pd_release, |
823 | .ioctl = pd_ioctl, | 823 | .ioctl = pd_ioctl, |
824 | .getgeo = pd_getgeo, | 824 | .getgeo = pd_getgeo, |
825 | .media_changed = pd_check_media, | 825 | .check_events = pd_check_events, |
826 | .revalidate_disk= pd_revalidate | 826 | .revalidate_disk= pd_revalidate |
827 | }; | 827 | }; |
828 | 828 | ||
@@ -837,6 +837,7 @@ static void pd_probe_drive(struct pd_unit *disk) | |||
837 | p->fops = &pd_fops; | 837 | p->fops = &pd_fops; |
838 | p->major = major; | 838 | p->major = major; |
839 | p->first_minor = (disk - pd) << PD_BITS; | 839 | p->first_minor = (disk - pd) << PD_BITS; |
840 | p->events = DISK_EVENT_MEDIA_CHANGE; | ||
840 | disk->gd = p; | 841 | disk->gd = p; |
841 | p->private_data = disk; | 842 | p->private_data = disk; |
842 | p->queue = pd_queue; | 843 | p->queue = pd_queue; |
diff --git a/drivers/block/paride/pf.c b/drivers/block/paride/pf.c index 635f25dd9e10..7adeb1edbf43 100644 --- a/drivers/block/paride/pf.c +++ b/drivers/block/paride/pf.c | |||
@@ -243,7 +243,8 @@ static struct pf_unit units[PF_UNITS]; | |||
243 | static int pf_identify(struct pf_unit *pf); | 243 | static int pf_identify(struct pf_unit *pf); |
244 | static void pf_lock(struct pf_unit *pf, int func); | 244 | static void pf_lock(struct pf_unit *pf, int func); |
245 | static void pf_eject(struct pf_unit *pf); | 245 | static void pf_eject(struct pf_unit *pf); |
246 | static int pf_check_media(struct gendisk *disk); | 246 | static unsigned int pf_check_events(struct gendisk *disk, |
247 | unsigned int clearing); | ||
247 | 248 | ||
248 | static char pf_scratch[512]; /* scratch block buffer */ | 249 | static char pf_scratch[512]; /* scratch block buffer */ |
249 | 250 | ||
@@ -270,7 +271,7 @@ static const struct block_device_operations pf_fops = { | |||
270 | .release = pf_release, | 271 | .release = pf_release, |
271 | .ioctl = pf_ioctl, | 272 | .ioctl = pf_ioctl, |
272 | .getgeo = pf_getgeo, | 273 | .getgeo = pf_getgeo, |
273 | .media_changed = pf_check_media, | 274 | .check_events = pf_check_events, |
274 | }; | 275 | }; |
275 | 276 | ||
276 | static void __init pf_init_units(void) | 277 | static void __init pf_init_units(void) |
@@ -293,6 +294,7 @@ static void __init pf_init_units(void) | |||
293 | disk->first_minor = unit; | 294 | disk->first_minor = unit; |
294 | strcpy(disk->disk_name, pf->name); | 295 | strcpy(disk->disk_name, pf->name); |
295 | disk->fops = &pf_fops; | 296 | disk->fops = &pf_fops; |
297 | disk->events = DISK_EVENT_MEDIA_CHANGE; | ||
296 | if (!(*drives[unit])[D_PRT]) | 298 | if (!(*drives[unit])[D_PRT]) |
297 | pf_drive_count++; | 299 | pf_drive_count++; |
298 | } | 300 | } |
@@ -377,9 +379,9 @@ static int pf_release(struct gendisk *disk, fmode_t mode) | |||
377 | 379 | ||
378 | } | 380 | } |
379 | 381 | ||
380 | static int pf_check_media(struct gendisk *disk) | 382 | static unsigned int pf_check_events(struct gendisk *disk, unsigned int clearing) |
381 | { | 383 | { |
382 | return 1; | 384 | return DISK_EVENT_MEDIA_CHANGE; |
383 | } | 385 | } |
384 | 386 | ||
385 | static inline int status_reg(struct pf_unit *pf) | 387 | static inline int status_reg(struct pf_unit *pf) |
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c index d20e13f80001..07a382eaf0a8 100644 --- a/drivers/block/pktcdvd.c +++ b/drivers/block/pktcdvd.c | |||
@@ -2794,7 +2794,8 @@ static int pkt_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd, | |||
2794 | return ret; | 2794 | return ret; |
2795 | } | 2795 | } |
2796 | 2796 | ||
2797 | static int pkt_media_changed(struct gendisk *disk) | 2797 | static unsigned int pkt_check_events(struct gendisk *disk, |
2798 | unsigned int clearing) | ||
2798 | { | 2799 | { |
2799 | struct pktcdvd_device *pd = disk->private_data; | 2800 | struct pktcdvd_device *pd = disk->private_data; |
2800 | struct gendisk *attached_disk; | 2801 | struct gendisk *attached_disk; |
@@ -2804,9 +2805,9 @@ static int pkt_media_changed(struct gendisk *disk) | |||
2804 | if (!pd->bdev) | 2805 | if (!pd->bdev) |
2805 | return 0; | 2806 | return 0; |
2806 | attached_disk = pd->bdev->bd_disk; | 2807 | attached_disk = pd->bdev->bd_disk; |
2807 | if (!attached_disk) | 2808 | if (!attached_disk || !attached_disk->fops->check_events) |
2808 | return 0; | 2809 | return 0; |
2809 | return attached_disk->fops->media_changed(attached_disk); | 2810 | return attached_disk->fops->check_events(attached_disk, clearing); |
2810 | } | 2811 | } |
2811 | 2812 | ||
2812 | static const struct block_device_operations pktcdvd_ops = { | 2813 | static const struct block_device_operations pktcdvd_ops = { |
@@ -2814,7 +2815,7 @@ static const struct block_device_operations pktcdvd_ops = { | |||
2814 | .open = pkt_open, | 2815 | .open = pkt_open, |
2815 | .release = pkt_close, | 2816 | .release = pkt_close, |
2816 | .ioctl = pkt_ioctl, | 2817 | .ioctl = pkt_ioctl, |
2817 | .media_changed = pkt_media_changed, | 2818 | .check_events = pkt_check_events, |
2818 | }; | 2819 | }; |
2819 | 2820 | ||
2820 | static char *pktcdvd_devnode(struct gendisk *gd, mode_t *mode) | 2821 | static char *pktcdvd_devnode(struct gendisk *gd, mode_t *mode) |
@@ -2887,6 +2888,10 @@ static int pkt_setup_dev(dev_t dev, dev_t* pkt_dev) | |||
2887 | if (ret) | 2888 | if (ret) |
2888 | goto out_new_dev; | 2889 | goto out_new_dev; |
2889 | 2890 | ||
2891 | /* inherit events of the host device */ | ||
2892 | disk->events = pd->bdev->bd_disk->events; | ||
2893 | disk->async_events = pd->bdev->bd_disk->async_events; | ||
2894 | |||
2890 | add_disk(disk); | 2895 | add_disk(disk); |
2891 | 2896 | ||
2892 | pkt_sysfs_dev_new(pd); | 2897 | pkt_sysfs_dev_new(pd); |
diff --git a/drivers/block/swim.c b/drivers/block/swim.c index 75333d0a3327..24a482f2fbd6 100644 --- a/drivers/block/swim.c +++ b/drivers/block/swim.c | |||
@@ -741,11 +741,12 @@ static int floppy_getgeo(struct block_device *bdev, struct hd_geometry *geo) | |||
741 | return 0; | 741 | return 0; |
742 | } | 742 | } |
743 | 743 | ||
744 | static int floppy_check_change(struct gendisk *disk) | 744 | static unsigned int floppy_check_events(struct gendisk *disk, |
745 | unsigned int clearing) | ||
745 | { | 746 | { |
746 | struct floppy_state *fs = disk->private_data; | 747 | struct floppy_state *fs = disk->private_data; |
747 | 748 | ||
748 | return fs->ejected; | 749 | return fs->ejected ? DISK_EVENT_MEDIA_CHANGE : 0; |
749 | } | 750 | } |
750 | 751 | ||
751 | static int floppy_revalidate(struct gendisk *disk) | 752 | static int floppy_revalidate(struct gendisk *disk) |
@@ -772,7 +773,7 @@ static const struct block_device_operations floppy_fops = { | |||
772 | .release = floppy_release, | 773 | .release = floppy_release, |
773 | .ioctl = floppy_ioctl, | 774 | .ioctl = floppy_ioctl, |
774 | .getgeo = floppy_getgeo, | 775 | .getgeo = floppy_getgeo, |
775 | .media_changed = floppy_check_change, | 776 | .check_events = floppy_check_events, |
776 | .revalidate_disk = floppy_revalidate, | 777 | .revalidate_disk = floppy_revalidate, |
777 | }; | 778 | }; |
778 | 779 | ||
@@ -857,6 +858,7 @@ static int __devinit swim_floppy_init(struct swim_priv *swd) | |||
857 | swd->unit[drive].disk->first_minor = drive; | 858 | swd->unit[drive].disk->first_minor = drive; |
858 | sprintf(swd->unit[drive].disk->disk_name, "fd%d", drive); | 859 | sprintf(swd->unit[drive].disk->disk_name, "fd%d", drive); |
859 | swd->unit[drive].disk->fops = &floppy_fops; | 860 | swd->unit[drive].disk->fops = &floppy_fops; |
861 | swd->unit[drive].disk->events = DISK_EVENT_MEDIA_CHANGE; | ||
860 | swd->unit[drive].disk->private_data = &swd->unit[drive]; | 862 | swd->unit[drive].disk->private_data = &swd->unit[drive]; |
861 | swd->unit[drive].disk->queue = swd->queue; | 863 | swd->unit[drive].disk->queue = swd->queue; |
862 | set_capacity(swd->unit[drive].disk, 2880); | 864 | set_capacity(swd->unit[drive].disk, 2880); |
diff --git a/drivers/block/swim3.c b/drivers/block/swim3.c index bf3a5b859299..4c10f56facbf 100644 --- a/drivers/block/swim3.c +++ b/drivers/block/swim3.c | |||
@@ -250,7 +250,8 @@ static int floppy_ioctl(struct block_device *bdev, fmode_t mode, | |||
250 | unsigned int cmd, unsigned long param); | 250 | unsigned int cmd, unsigned long param); |
251 | static int floppy_open(struct block_device *bdev, fmode_t mode); | 251 | static int floppy_open(struct block_device *bdev, fmode_t mode); |
252 | static int floppy_release(struct gendisk *disk, fmode_t mode); | 252 | static int floppy_release(struct gendisk *disk, fmode_t mode); |
253 | static int floppy_check_change(struct gendisk *disk); | 253 | static unsigned int floppy_check_events(struct gendisk *disk, |
254 | unsigned int clearing); | ||
254 | static int floppy_revalidate(struct gendisk *disk); | 255 | static int floppy_revalidate(struct gendisk *disk); |
255 | 256 | ||
256 | static bool swim3_end_request(int err, unsigned int nr_bytes) | 257 | static bool swim3_end_request(int err, unsigned int nr_bytes) |
@@ -975,10 +976,11 @@ static int floppy_release(struct gendisk *disk, fmode_t mode) | |||
975 | return 0; | 976 | return 0; |
976 | } | 977 | } |
977 | 978 | ||
978 | static int floppy_check_change(struct gendisk *disk) | 979 | static unsigned int floppy_check_events(struct gendisk *disk, |
980 | unsigned int clearing) | ||
979 | { | 981 | { |
980 | struct floppy_state *fs = disk->private_data; | 982 | struct floppy_state *fs = disk->private_data; |
981 | return fs->ejected; | 983 | return fs->ejected ? DISK_EVENT_MEDIA_CHANGE : 0; |
982 | } | 984 | } |
983 | 985 | ||
984 | static int floppy_revalidate(struct gendisk *disk) | 986 | static int floppy_revalidate(struct gendisk *disk) |
@@ -1025,7 +1027,7 @@ static const struct block_device_operations floppy_fops = { | |||
1025 | .open = floppy_unlocked_open, | 1027 | .open = floppy_unlocked_open, |
1026 | .release = floppy_release, | 1028 | .release = floppy_release, |
1027 | .ioctl = floppy_ioctl, | 1029 | .ioctl = floppy_ioctl, |
1028 | .media_changed = floppy_check_change, | 1030 | .check_events = floppy_check_events, |
1029 | .revalidate_disk= floppy_revalidate, | 1031 | .revalidate_disk= floppy_revalidate, |
1030 | }; | 1032 | }; |
1031 | 1033 | ||
@@ -1161,6 +1163,7 @@ static int __devinit swim3_attach(struct macio_dev *mdev, const struct of_device | |||
1161 | disk->major = FLOPPY_MAJOR; | 1163 | disk->major = FLOPPY_MAJOR; |
1162 | disk->first_minor = i; | 1164 | disk->first_minor = i; |
1163 | disk->fops = &floppy_fops; | 1165 | disk->fops = &floppy_fops; |
1166 | disk->events = DISK_EVENT_MEDIA_CHANGE; | ||
1164 | disk->private_data = &floppy_states[i]; | 1167 | disk->private_data = &floppy_states[i]; |
1165 | disk->queue = swim3_queue; | 1168 | disk->queue = swim3_queue; |
1166 | disk->flags |= GENHD_FL_REMOVABLE; | 1169 | disk->flags |= GENHD_FL_REMOVABLE; |
diff --git a/drivers/block/ub.c b/drivers/block/ub.c index 9ae3bb713286..68b9430c7cfe 100644 --- a/drivers/block/ub.c +++ b/drivers/block/ub.c | |||
@@ -1788,7 +1788,8 @@ static int ub_bd_revalidate(struct gendisk *disk) | |||
1788 | * | 1788 | * |
1789 | * The return code is bool! | 1789 | * The return code is bool! |
1790 | */ | 1790 | */ |
1791 | static int ub_bd_media_changed(struct gendisk *disk) | 1791 | static unsigned int ub_bd_check_events(struct gendisk *disk, |
1792 | unsigned int clearing) | ||
1792 | { | 1793 | { |
1793 | struct ub_lun *lun = disk->private_data; | 1794 | struct ub_lun *lun = disk->private_data; |
1794 | 1795 | ||
@@ -1806,10 +1807,10 @@ static int ub_bd_media_changed(struct gendisk *disk) | |||
1806 | */ | 1807 | */ |
1807 | if (ub_sync_tur(lun->udev, lun) != 0) { | 1808 | if (ub_sync_tur(lun->udev, lun) != 0) { |
1808 | lun->changed = 1; | 1809 | lun->changed = 1; |
1809 | return 1; | 1810 | return DISK_EVENT_MEDIA_CHANGE; |
1810 | } | 1811 | } |
1811 | 1812 | ||
1812 | return lun->changed; | 1813 | return lun->changed ? DISK_EVENT_MEDIA_CHANGE : 0; |
1813 | } | 1814 | } |
1814 | 1815 | ||
1815 | static const struct block_device_operations ub_bd_fops = { | 1816 | static const struct block_device_operations ub_bd_fops = { |
@@ -1817,7 +1818,7 @@ static const struct block_device_operations ub_bd_fops = { | |||
1817 | .open = ub_bd_unlocked_open, | 1818 | .open = ub_bd_unlocked_open, |
1818 | .release = ub_bd_release, | 1819 | .release = ub_bd_release, |
1819 | .ioctl = ub_bd_ioctl, | 1820 | .ioctl = ub_bd_ioctl, |
1820 | .media_changed = ub_bd_media_changed, | 1821 | .check_events = ub_bd_check_events, |
1821 | .revalidate_disk = ub_bd_revalidate, | 1822 | .revalidate_disk = ub_bd_revalidate, |
1822 | }; | 1823 | }; |
1823 | 1824 | ||
@@ -2333,6 +2334,7 @@ static int ub_probe_lun(struct ub_dev *sc, int lnum) | |||
2333 | disk->major = UB_MAJOR; | 2334 | disk->major = UB_MAJOR; |
2334 | disk->first_minor = lun->id * UB_PARTS_PER_LUN; | 2335 | disk->first_minor = lun->id * UB_PARTS_PER_LUN; |
2335 | disk->fops = &ub_bd_fops; | 2336 | disk->fops = &ub_bd_fops; |
2337 | disk->events = DISK_EVENT_MEDIA_CHANGE; | ||
2336 | disk->private_data = lun; | 2338 | disk->private_data = lun; |
2337 | disk->driverfs_dev = &sc->intf->dev; | 2339 | disk->driverfs_dev = &sc->intf->dev; |
2338 | 2340 | ||
diff --git a/drivers/block/umem.c b/drivers/block/umem.c index 653439faa729..031ca720d926 100644 --- a/drivers/block/umem.c +++ b/drivers/block/umem.c | |||
@@ -766,20 +766,10 @@ static int mm_getgeo(struct block_device *bdev, struct hd_geometry *geo) | |||
766 | return 0; | 766 | return 0; |
767 | } | 767 | } |
768 | 768 | ||
769 | /* | ||
770 | * Future support for removable devices | ||
771 | */ | ||
772 | static int mm_check_change(struct gendisk *disk) | ||
773 | { | ||
774 | /* struct cardinfo *dev = disk->private_data; */ | ||
775 | return 0; | ||
776 | } | ||
777 | |||
778 | static const struct block_device_operations mm_fops = { | 769 | static const struct block_device_operations mm_fops = { |
779 | .owner = THIS_MODULE, | 770 | .owner = THIS_MODULE, |
780 | .getgeo = mm_getgeo, | 771 | .getgeo = mm_getgeo, |
781 | .revalidate_disk = mm_revalidate, | 772 | .revalidate_disk = mm_revalidate, |
782 | .media_changed = mm_check_change, | ||
783 | }; | 773 | }; |
784 | 774 | ||
785 | static int __devinit mm_pci_probe(struct pci_dev *dev, | 775 | static int __devinit mm_pci_probe(struct pci_dev *dev, |
diff --git a/drivers/block/xsysace.c b/drivers/block/xsysace.c index 829161edae53..16a2fa96b810 100644 --- a/drivers/block/xsysace.c +++ b/drivers/block/xsysace.c | |||
@@ -867,12 +867,12 @@ static void ace_request(struct request_queue * q) | |||
867 | } | 867 | } |
868 | } | 868 | } |
869 | 869 | ||
870 | static int ace_media_changed(struct gendisk *gd) | 870 | static unsigned int ace_check_events(struct gendisk *gd, unsigned int clearing) |
871 | { | 871 | { |
872 | struct ace_device *ace = gd->private_data; | 872 | struct ace_device *ace = gd->private_data; |
873 | dev_dbg(ace->dev, "ace_media_changed(): %i\n", ace->media_change); | 873 | dev_dbg(ace->dev, "ace_check_events(): %i\n", ace->media_change); |
874 | 874 | ||
875 | return ace->media_change; | 875 | return ace->media_change ? DISK_EVENT_MEDIA_CHANGE : 0; |
876 | } | 876 | } |
877 | 877 | ||
878 | static int ace_revalidate_disk(struct gendisk *gd) | 878 | static int ace_revalidate_disk(struct gendisk *gd) |
@@ -953,7 +953,7 @@ static const struct block_device_operations ace_fops = { | |||
953 | .owner = THIS_MODULE, | 953 | .owner = THIS_MODULE, |
954 | .open = ace_open, | 954 | .open = ace_open, |
955 | .release = ace_release, | 955 | .release = ace_release, |
956 | .media_changed = ace_media_changed, | 956 | .check_events = ace_check_events, |
957 | .revalidate_disk = ace_revalidate_disk, | 957 | .revalidate_disk = ace_revalidate_disk, |
958 | .getgeo = ace_getgeo, | 958 | .getgeo = ace_getgeo, |
959 | }; | 959 | }; |
@@ -1005,6 +1005,7 @@ static int __devinit ace_setup(struct ace_device *ace) | |||
1005 | ace->gd->major = ace_major; | 1005 | ace->gd->major = ace_major; |
1006 | ace->gd->first_minor = ace->id * ACE_NUM_MINORS; | 1006 | ace->gd->first_minor = ace->id * ACE_NUM_MINORS; |
1007 | ace->gd->fops = &ace_fops; | 1007 | ace->gd->fops = &ace_fops; |
1008 | ace->gd->events = DISK_EVENT_MEDIA_CHANGE; | ||
1008 | ace->gd->queue = ace->queue; | 1009 | ace->gd->queue = ace->queue; |
1009 | ace->gd->private_data = ace; | 1010 | ace->gd->private_data = ace; |
1010 | snprintf(ace->gd->disk_name, 32, "xs%c", ace->id + 'a'); | 1011 | snprintf(ace->gd->disk_name, 32, "xs%c", ace->id + 'a'); |
diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c index 333c21289d97..6dcd55a74c0a 100644 --- a/drivers/bluetooth/ath3k.c +++ b/drivers/bluetooth/ath3k.c | |||
@@ -41,6 +41,9 @@ static struct usb_device_id ath3k_table[] = { | |||
41 | 41 | ||
42 | /* Atheros AR9285 Malbec with sflash firmware */ | 42 | /* Atheros AR9285 Malbec with sflash firmware */ |
43 | { USB_DEVICE(0x03F0, 0x311D) }, | 43 | { USB_DEVICE(0x03F0, 0x311D) }, |
44 | |||
45 | /* Atheros AR5BBU12 with sflash firmware */ | ||
46 | { USB_DEVICE(0x0489, 0xE02C) }, | ||
44 | { } /* Terminating entry */ | 47 | { } /* Terminating entry */ |
45 | }; | 48 | }; |
46 | 49 | ||
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index 4cefa91e6c34..700a3840fddc 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c | |||
@@ -105,6 +105,9 @@ static struct usb_device_id blacklist_table[] = { | |||
105 | /* Atheros AR9285 Malbec with sflash firmware */ | 105 | /* Atheros AR9285 Malbec with sflash firmware */ |
106 | { USB_DEVICE(0x03f0, 0x311d), .driver_info = BTUSB_IGNORE }, | 106 | { USB_DEVICE(0x03f0, 0x311d), .driver_info = BTUSB_IGNORE }, |
107 | 107 | ||
108 | /* Atheros AR5BBU12 with sflash firmware */ | ||
109 | { USB_DEVICE(0x0489, 0xe02c), .driver_info = BTUSB_IGNORE }, | ||
110 | |||
108 | /* Broadcom BCM2035 */ | 111 | /* Broadcom BCM2035 */ |
109 | { USB_DEVICE(0x0a5c, 0x2035), .driver_info = BTUSB_WRONG_SCO_MTU }, | 112 | { USB_DEVICE(0x0a5c, 0x2035), .driver_info = BTUSB_WRONG_SCO_MTU }, |
110 | { USB_DEVICE(0x0a5c, 0x200a), .driver_info = BTUSB_WRONG_SCO_MTU }, | 113 | { USB_DEVICE(0x0a5c, 0x200a), .driver_info = BTUSB_WRONG_SCO_MTU }, |
@@ -829,7 +832,7 @@ static void btusb_work(struct work_struct *work) | |||
829 | 832 | ||
830 | if (hdev->conn_hash.sco_num > 0) { | 833 | if (hdev->conn_hash.sco_num > 0) { |
831 | if (!test_bit(BTUSB_DID_ISO_RESUME, &data->flags)) { | 834 | if (!test_bit(BTUSB_DID_ISO_RESUME, &data->flags)) { |
832 | err = usb_autopm_get_interface(data->isoc); | 835 | err = usb_autopm_get_interface(data->isoc ? data->isoc : data->intf); |
833 | if (err < 0) { | 836 | if (err < 0) { |
834 | clear_bit(BTUSB_ISOC_RUNNING, &data->flags); | 837 | clear_bit(BTUSB_ISOC_RUNNING, &data->flags); |
835 | usb_kill_anchored_urbs(&data->isoc_anchor); | 838 | usb_kill_anchored_urbs(&data->isoc_anchor); |
@@ -858,7 +861,7 @@ static void btusb_work(struct work_struct *work) | |||
858 | 861 | ||
859 | __set_isoc_interface(hdev, 0); | 862 | __set_isoc_interface(hdev, 0); |
860 | if (test_and_clear_bit(BTUSB_DID_ISO_RESUME, &data->flags)) | 863 | if (test_and_clear_bit(BTUSB_DID_ISO_RESUME, &data->flags)) |
861 | usb_autopm_put_interface(data->isoc); | 864 | usb_autopm_put_interface(data->isoc ? data->isoc : data->intf); |
862 | } | 865 | } |
863 | } | 866 | } |
864 | 867 | ||
@@ -1041,8 +1044,6 @@ static int btusb_probe(struct usb_interface *intf, | |||
1041 | 1044 | ||
1042 | usb_set_intfdata(intf, data); | 1045 | usb_set_intfdata(intf, data); |
1043 | 1046 | ||
1044 | usb_enable_autosuspend(interface_to_usbdev(intf)); | ||
1045 | |||
1046 | return 0; | 1047 | return 0; |
1047 | } | 1048 | } |
1048 | 1049 | ||
diff --git a/drivers/cdrom/gdrom.c b/drivers/cdrom/gdrom.c index 64a21461c408..b2b034fea34e 100644 --- a/drivers/cdrom/gdrom.c +++ b/drivers/cdrom/gdrom.c | |||
@@ -395,10 +395,12 @@ static int gdrom_drivestatus(struct cdrom_device_info *cd_info, int ignore) | |||
395 | return CDS_NO_INFO; | 395 | return CDS_NO_INFO; |
396 | } | 396 | } |
397 | 397 | ||
398 | static int gdrom_mediachanged(struct cdrom_device_info *cd_info, int ignore) | 398 | static unsigned int gdrom_check_events(struct cdrom_device_info *cd_info, |
399 | unsigned int clearing, int ignore) | ||
399 | { | 400 | { |
400 | /* check the sense key */ | 401 | /* check the sense key */ |
401 | return (__raw_readb(GDROM_ERROR_REG) & 0xF0) == 0x60; | 402 | return (__raw_readb(GDROM_ERROR_REG) & 0xF0) == 0x60 ? |
403 | DISK_EVENT_MEDIA_CHANGE : 0; | ||
402 | } | 404 | } |
403 | 405 | ||
404 | /* reset the G1 bus */ | 406 | /* reset the G1 bus */ |
@@ -483,7 +485,7 @@ static struct cdrom_device_ops gdrom_ops = { | |||
483 | .open = gdrom_open, | 485 | .open = gdrom_open, |
484 | .release = gdrom_release, | 486 | .release = gdrom_release, |
485 | .drive_status = gdrom_drivestatus, | 487 | .drive_status = gdrom_drivestatus, |
486 | .media_changed = gdrom_mediachanged, | 488 | .check_events = gdrom_check_events, |
487 | .get_last_session = gdrom_get_last_session, | 489 | .get_last_session = gdrom_get_last_session, |
488 | .reset = gdrom_hardreset, | 490 | .reset = gdrom_hardreset, |
489 | .audio_ioctl = gdrom_audio_ioctl, | 491 | .audio_ioctl = gdrom_audio_ioctl, |
@@ -509,9 +511,10 @@ static int gdrom_bdops_release(struct gendisk *disk, fmode_t mode) | |||
509 | return 0; | 511 | return 0; |
510 | } | 512 | } |
511 | 513 | ||
512 | static int gdrom_bdops_mediachanged(struct gendisk *disk) | 514 | static unsigned int gdrom_bdops_check_events(struct gendisk *disk, |
515 | unsigned int clearing) | ||
513 | { | 516 | { |
514 | return cdrom_media_changed(gd.cd_info); | 517 | return cdrom_check_events(gd.cd_info, clearing); |
515 | } | 518 | } |
516 | 519 | ||
517 | static int gdrom_bdops_ioctl(struct block_device *bdev, fmode_t mode, | 520 | static int gdrom_bdops_ioctl(struct block_device *bdev, fmode_t mode, |
@@ -530,7 +533,7 @@ static const struct block_device_operations gdrom_bdops = { | |||
530 | .owner = THIS_MODULE, | 533 | .owner = THIS_MODULE, |
531 | .open = gdrom_bdops_open, | 534 | .open = gdrom_bdops_open, |
532 | .release = gdrom_bdops_release, | 535 | .release = gdrom_bdops_release, |
533 | .media_changed = gdrom_bdops_mediachanged, | 536 | .check_events = gdrom_bdops_check_events, |
534 | .ioctl = gdrom_bdops_ioctl, | 537 | .ioctl = gdrom_bdops_ioctl, |
535 | }; | 538 | }; |
536 | 539 | ||
@@ -800,6 +803,7 @@ static int __devinit probe_gdrom(struct platform_device *devptr) | |||
800 | goto probe_fail_cdrom_register; | 803 | goto probe_fail_cdrom_register; |
801 | } | 804 | } |
802 | gd.disk->fops = &gdrom_bdops; | 805 | gd.disk->fops = &gdrom_bdops; |
806 | gd.disk->events = DISK_EVENT_MEDIA_CHANGE; | ||
803 | /* latch on to the interrupt */ | 807 | /* latch on to the interrupt */ |
804 | err = gdrom_set_interrupt_handlers(); | 808 | err = gdrom_set_interrupt_handlers(); |
805 | if (err) | 809 | if (err) |
diff --git a/drivers/cdrom/viocd.c b/drivers/cdrom/viocd.c index be73a9b493a6..4e874c5fa605 100644 --- a/drivers/cdrom/viocd.c +++ b/drivers/cdrom/viocd.c | |||
@@ -186,10 +186,11 @@ static int viocd_blk_ioctl(struct block_device *bdev, fmode_t mode, | |||
186 | return ret; | 186 | return ret; |
187 | } | 187 | } |
188 | 188 | ||
189 | static int viocd_blk_media_changed(struct gendisk *disk) | 189 | static unsigned int viocd_blk_check_events(struct gendisk *disk, |
190 | unsigned int clearing) | ||
190 | { | 191 | { |
191 | struct disk_info *di = disk->private_data; | 192 | struct disk_info *di = disk->private_data; |
192 | return cdrom_media_changed(&di->viocd_info); | 193 | return cdrom_check_events(&di->viocd_info, clearing); |
193 | } | 194 | } |
194 | 195 | ||
195 | static const struct block_device_operations viocd_fops = { | 196 | static const struct block_device_operations viocd_fops = { |
@@ -197,7 +198,7 @@ static const struct block_device_operations viocd_fops = { | |||
197 | .open = viocd_blk_open, | 198 | .open = viocd_blk_open, |
198 | .release = viocd_blk_release, | 199 | .release = viocd_blk_release, |
199 | .ioctl = viocd_blk_ioctl, | 200 | .ioctl = viocd_blk_ioctl, |
200 | .media_changed = viocd_blk_media_changed, | 201 | .check_events = viocd_blk_check_events, |
201 | }; | 202 | }; |
202 | 203 | ||
203 | static int viocd_open(struct cdrom_device_info *cdi, int purpose) | 204 | static int viocd_open(struct cdrom_device_info *cdi, int purpose) |
@@ -320,7 +321,8 @@ static void do_viocd_request(struct request_queue *q) | |||
320 | } | 321 | } |
321 | } | 322 | } |
322 | 323 | ||
323 | static int viocd_media_changed(struct cdrom_device_info *cdi, int disc_nr) | 324 | static unsigned int viocd_check_events(struct cdrom_device_info *cdi, |
325 | unsigned int clearing, int disc_nr) | ||
324 | { | 326 | { |
325 | struct viocd_waitevent we; | 327 | struct viocd_waitevent we; |
326 | HvLpEvent_Rc hvrc; | 328 | HvLpEvent_Rc hvrc; |
@@ -340,7 +342,7 @@ static int viocd_media_changed(struct cdrom_device_info *cdi, int disc_nr) | |||
340 | if (hvrc != 0) { | 342 | if (hvrc != 0) { |
341 | pr_warning("bad rc on HvCallEvent_signalLpEventFast %d\n", | 343 | pr_warning("bad rc on HvCallEvent_signalLpEventFast %d\n", |
342 | (int)hvrc); | 344 | (int)hvrc); |
343 | return -EIO; | 345 | return 0; |
344 | } | 346 | } |
345 | 347 | ||
346 | wait_for_completion(&we.com); | 348 | wait_for_completion(&we.com); |
@@ -354,7 +356,7 @@ static int viocd_media_changed(struct cdrom_device_info *cdi, int disc_nr) | |||
354 | return 0; | 356 | return 0; |
355 | } | 357 | } |
356 | 358 | ||
357 | return we.changed; | 359 | return we.changed ? DISK_EVENT_MEDIA_CHANGE : 0; |
358 | } | 360 | } |
359 | 361 | ||
360 | static int viocd_lock_door(struct cdrom_device_info *cdi, int locking) | 362 | static int viocd_lock_door(struct cdrom_device_info *cdi, int locking) |
@@ -550,7 +552,7 @@ static int viocd_audio_ioctl(struct cdrom_device_info *cdi, unsigned int cmd, | |||
550 | static struct cdrom_device_ops viocd_dops = { | 552 | static struct cdrom_device_ops viocd_dops = { |
551 | .open = viocd_open, | 553 | .open = viocd_open, |
552 | .release = viocd_release, | 554 | .release = viocd_release, |
553 | .media_changed = viocd_media_changed, | 555 | .check_events = viocd_check_events, |
554 | .lock_door = viocd_lock_door, | 556 | .lock_door = viocd_lock_door, |
555 | .generic_packet = viocd_packet, | 557 | .generic_packet = viocd_packet, |
556 | .audio_ioctl = viocd_audio_ioctl, | 558 | .audio_ioctl = viocd_audio_ioctl, |
@@ -624,6 +626,7 @@ static int viocd_probe(struct vio_dev *vdev, const struct vio_device_id *id) | |||
624 | gendisk->queue = q; | 626 | gendisk->queue = q; |
625 | gendisk->fops = &viocd_fops; | 627 | gendisk->fops = &viocd_fops; |
626 | gendisk->flags = GENHD_FL_CD|GENHD_FL_REMOVABLE; | 628 | gendisk->flags = GENHD_FL_CD|GENHD_FL_REMOVABLE; |
629 | gendisk->events = DISK_EVENT_MEDIA_CHANGE; | ||
627 | set_capacity(gendisk, 0); | 630 | set_capacity(gendisk, 0); |
628 | gendisk->private_data = d; | 631 | gendisk->private_data = d; |
629 | d->viocd_disk = gendisk; | 632 | d->viocd_disk = gendisk; |
diff --git a/drivers/char/agp/amd64-agp.c b/drivers/char/agp/amd64-agp.c index 9252e85706ef..780498d76581 100644 --- a/drivers/char/agp/amd64-agp.c +++ b/drivers/char/agp/amd64-agp.c | |||
@@ -773,18 +773,23 @@ int __init agp_amd64_init(void) | |||
773 | #else | 773 | #else |
774 | printk(KERN_INFO PFX "You can boot with agp=try_unsupported\n"); | 774 | printk(KERN_INFO PFX "You can boot with agp=try_unsupported\n"); |
775 | #endif | 775 | #endif |
776 | pci_unregister_driver(&agp_amd64_pci_driver); | ||
776 | return -ENODEV; | 777 | return -ENODEV; |
777 | } | 778 | } |
778 | 779 | ||
779 | /* First check that we have at least one AMD64 NB */ | 780 | /* First check that we have at least one AMD64 NB */ |
780 | if (!pci_dev_present(amd_nb_misc_ids)) | 781 | if (!pci_dev_present(amd_nb_misc_ids)) { |
782 | pci_unregister_driver(&agp_amd64_pci_driver); | ||
781 | return -ENODEV; | 783 | return -ENODEV; |
784 | } | ||
782 | 785 | ||
783 | /* Look for any AGP bridge */ | 786 | /* Look for any AGP bridge */ |
784 | agp_amd64_pci_driver.id_table = agp_amd64_pci_promisc_table; | 787 | agp_amd64_pci_driver.id_table = agp_amd64_pci_promisc_table; |
785 | err = driver_attach(&agp_amd64_pci_driver.driver); | 788 | err = driver_attach(&agp_amd64_pci_driver.driver); |
786 | if (err == 0 && agp_bridges_found == 0) | 789 | if (err == 0 && agp_bridges_found == 0) { |
790 | pci_unregister_driver(&agp_amd64_pci_driver); | ||
787 | err = -ENODEV; | 791 | err = -ENODEV; |
792 | } | ||
788 | } | 793 | } |
789 | return err; | 794 | return err; |
790 | } | 795 | } |
diff --git a/drivers/char/agp/intel-agp.h b/drivers/char/agp/intel-agp.h index c195bfeade11..5feebe2800e9 100644 --- a/drivers/char/agp/intel-agp.h +++ b/drivers/char/agp/intel-agp.h | |||
@@ -130,6 +130,7 @@ | |||
130 | #define INTEL_GMCH_GMS_STOLEN_352M (0xd << 4) | 130 | #define INTEL_GMCH_GMS_STOLEN_352M (0xd << 4) |
131 | 131 | ||
132 | #define I915_IFPADDR 0x60 | 132 | #define I915_IFPADDR 0x60 |
133 | #define I830_HIC 0x70 | ||
133 | 134 | ||
134 | /* Intel 965G registers */ | 135 | /* Intel 965G registers */ |
135 | #define I965_MSAC 0x62 | 136 | #define I965_MSAC 0x62 |
diff --git a/drivers/char/agp/intel-gtt.c b/drivers/char/agp/intel-gtt.c index fab3d3265adb..0d09b537bb9a 100644 --- a/drivers/char/agp/intel-gtt.c +++ b/drivers/char/agp/intel-gtt.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/kernel.h> | 21 | #include <linux/kernel.h> |
22 | #include <linux/pagemap.h> | 22 | #include <linux/pagemap.h> |
23 | #include <linux/agp_backend.h> | 23 | #include <linux/agp_backend.h> |
24 | #include <linux/delay.h> | ||
24 | #include <asm/smp.h> | 25 | #include <asm/smp.h> |
25 | #include "agp.h" | 26 | #include "agp.h" |
26 | #include "intel-agp.h" | 27 | #include "intel-agp.h" |
@@ -70,12 +71,8 @@ static struct _intel_private { | |||
70 | u32 __iomem *gtt; /* I915G */ | 71 | u32 __iomem *gtt; /* I915G */ |
71 | bool clear_fake_agp; /* on first access via agp, fill with scratch */ | 72 | bool clear_fake_agp; /* on first access via agp, fill with scratch */ |
72 | int num_dcache_entries; | 73 | int num_dcache_entries; |
73 | union { | 74 | void __iomem *i9xx_flush_page; |
74 | void __iomem *i9xx_flush_page; | ||
75 | void *i8xx_flush_page; | ||
76 | }; | ||
77 | char *i81x_gtt_table; | 75 | char *i81x_gtt_table; |
78 | struct page *i8xx_page; | ||
79 | struct resource ifp_resource; | 76 | struct resource ifp_resource; |
80 | int resource_valid; | 77 | int resource_valid; |
81 | struct page *scratch_page; | 78 | struct page *scratch_page; |
@@ -722,28 +719,6 @@ static int intel_fake_agp_fetch_size(void) | |||
722 | 719 | ||
723 | static void i830_cleanup(void) | 720 | static void i830_cleanup(void) |
724 | { | 721 | { |
725 | if (intel_private.i8xx_flush_page) { | ||
726 | kunmap(intel_private.i8xx_flush_page); | ||
727 | intel_private.i8xx_flush_page = NULL; | ||
728 | } | ||
729 | |||
730 | __free_page(intel_private.i8xx_page); | ||
731 | intel_private.i8xx_page = NULL; | ||
732 | } | ||
733 | |||
734 | static void intel_i830_setup_flush(void) | ||
735 | { | ||
736 | /* return if we've already set the flush mechanism up */ | ||
737 | if (intel_private.i8xx_page) | ||
738 | return; | ||
739 | |||
740 | intel_private.i8xx_page = alloc_page(GFP_KERNEL); | ||
741 | if (!intel_private.i8xx_page) | ||
742 | return; | ||
743 | |||
744 | intel_private.i8xx_flush_page = kmap(intel_private.i8xx_page); | ||
745 | if (!intel_private.i8xx_flush_page) | ||
746 | i830_cleanup(); | ||
747 | } | 722 | } |
748 | 723 | ||
749 | /* The chipset_flush interface needs to get data that has already been | 724 | /* The chipset_flush interface needs to get data that has already been |
@@ -758,14 +733,27 @@ static void intel_i830_setup_flush(void) | |||
758 | */ | 733 | */ |
759 | static void i830_chipset_flush(void) | 734 | static void i830_chipset_flush(void) |
760 | { | 735 | { |
761 | unsigned int *pg = intel_private.i8xx_flush_page; | 736 | unsigned long timeout = jiffies + msecs_to_jiffies(1000); |
737 | |||
738 | /* Forcibly evict everything from the CPU write buffers. | ||
739 | * clflush appears to be insufficient. | ||
740 | */ | ||
741 | wbinvd_on_all_cpus(); | ||
742 | |||
743 | /* Now we've only seen documents for this magic bit on 855GM, | ||
744 | * we hope it exists for the other gen2 chipsets... | ||
745 | * | ||
746 | * Also works as advertised on my 845G. | ||
747 | */ | ||
748 | writel(readl(intel_private.registers+I830_HIC) | (1<<31), | ||
749 | intel_private.registers+I830_HIC); | ||
762 | 750 | ||
763 | memset(pg, 0, 1024); | 751 | while (readl(intel_private.registers+I830_HIC) & (1<<31)) { |
752 | if (time_after(jiffies, timeout)) | ||
753 | break; | ||
764 | 754 | ||
765 | if (cpu_has_clflush) | 755 | udelay(50); |
766 | clflush_cache_range(pg, 1024); | 756 | } |
767 | else if (wbinvd_on_all_cpus() != 0) | ||
768 | printk(KERN_ERR "Timed out waiting for cache flush.\n"); | ||
769 | } | 757 | } |
770 | 758 | ||
771 | static void i830_write_entry(dma_addr_t addr, unsigned int entry, | 759 | static void i830_write_entry(dma_addr_t addr, unsigned int entry, |
@@ -849,8 +837,6 @@ static int i830_setup(void) | |||
849 | 837 | ||
850 | intel_private.gtt_bus_addr = reg_addr + I810_PTE_BASE; | 838 | intel_private.gtt_bus_addr = reg_addr + I810_PTE_BASE; |
851 | 839 | ||
852 | intel_i830_setup_flush(); | ||
853 | |||
854 | return 0; | 840 | return 0; |
855 | } | 841 | } |
856 | 842 | ||
diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c index 777181a2e603..bcbbc71febb7 100644 --- a/drivers/char/pcmcia/cm4000_cs.c +++ b/drivers/char/pcmcia/cm4000_cs.c | |||
@@ -830,8 +830,7 @@ static void monitor_card(unsigned long p) | |||
830 | test_bit(IS_ANY_T1, &dev->flags))) { | 830 | test_bit(IS_ANY_T1, &dev->flags))) { |
831 | DEBUGP(4, dev, "Perform AUTOPPS\n"); | 831 | DEBUGP(4, dev, "Perform AUTOPPS\n"); |
832 | set_bit(IS_AUTOPPS_ACT, &dev->flags); | 832 | set_bit(IS_AUTOPPS_ACT, &dev->flags); |
833 | ptsreq.protocol = ptsreq.protocol = | 833 | ptsreq.protocol = (0x01 << dev->proto); |
834 | (0x01 << dev->proto); | ||
835 | ptsreq.flags = 0x01; | 834 | ptsreq.flags = 0x01; |
836 | ptsreq.pts1 = 0x00; | 835 | ptsreq.pts1 = 0x00; |
837 | ptsreq.pts2 = 0x00; | 836 | ptsreq.pts2 = 0x00; |
diff --git a/drivers/char/pcmcia/ipwireless/main.c b/drivers/char/pcmcia/ipwireless/main.c index 94b8eb4d691d..444155a305ae 100644 --- a/drivers/char/pcmcia/ipwireless/main.c +++ b/drivers/char/pcmcia/ipwireless/main.c | |||
@@ -78,7 +78,6 @@ static void signalled_reboot_callback(void *callback_data) | |||
78 | static int ipwireless_probe(struct pcmcia_device *p_dev, void *priv_data) | 78 | static int ipwireless_probe(struct pcmcia_device *p_dev, void *priv_data) |
79 | { | 79 | { |
80 | struct ipw_dev *ipw = priv_data; | 80 | struct ipw_dev *ipw = priv_data; |
81 | struct resource *io_resource; | ||
82 | int ret; | 81 | int ret; |
83 | 82 | ||
84 | p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; | 83 | p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; |
@@ -92,9 +91,12 @@ static int ipwireless_probe(struct pcmcia_device *p_dev, void *priv_data) | |||
92 | if (ret) | 91 | if (ret) |
93 | return ret; | 92 | return ret; |
94 | 93 | ||
95 | io_resource = request_region(p_dev->resource[0]->start, | 94 | if (!request_region(p_dev->resource[0]->start, |
96 | resource_size(p_dev->resource[0]), | 95 | resource_size(p_dev->resource[0]), |
97 | IPWIRELESS_PCCARD_NAME); | 96 | IPWIRELESS_PCCARD_NAME)) { |
97 | ret = -EBUSY; | ||
98 | goto exit; | ||
99 | } | ||
98 | 100 | ||
99 | p_dev->resource[2]->flags |= | 101 | p_dev->resource[2]->flags |= |
100 | WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_CM | WIN_ENABLE; | 102 | WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_CM | WIN_ENABLE; |
@@ -105,22 +107,25 @@ static int ipwireless_probe(struct pcmcia_device *p_dev, void *priv_data) | |||
105 | 107 | ||
106 | ret = pcmcia_map_mem_page(p_dev, p_dev->resource[2], p_dev->card_addr); | 108 | ret = pcmcia_map_mem_page(p_dev, p_dev->resource[2], p_dev->card_addr); |
107 | if (ret != 0) | 109 | if (ret != 0) |
108 | goto exit2; | 110 | goto exit1; |
109 | 111 | ||
110 | ipw->is_v2_card = resource_size(p_dev->resource[2]) == 0x100; | 112 | ipw->is_v2_card = resource_size(p_dev->resource[2]) == 0x100; |
111 | 113 | ||
112 | ipw->attr_memory = ioremap(p_dev->resource[2]->start, | 114 | ipw->common_memory = ioremap(p_dev->resource[2]->start, |
113 | resource_size(p_dev->resource[2])); | 115 | resource_size(p_dev->resource[2])); |
114 | request_mem_region(p_dev->resource[2]->start, | 116 | if (!request_mem_region(p_dev->resource[2]->start, |
115 | resource_size(p_dev->resource[2]), | 117 | resource_size(p_dev->resource[2]), |
116 | IPWIRELESS_PCCARD_NAME); | 118 | IPWIRELESS_PCCARD_NAME)) { |
119 | ret = -EBUSY; | ||
120 | goto exit2; | ||
121 | } | ||
117 | 122 | ||
118 | p_dev->resource[3]->flags |= WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_AM | | 123 | p_dev->resource[3]->flags |= WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_AM | |
119 | WIN_ENABLE; | 124 | WIN_ENABLE; |
120 | p_dev->resource[3]->end = 0; /* this used to be 0x1000 */ | 125 | p_dev->resource[3]->end = 0; /* this used to be 0x1000 */ |
121 | ret = pcmcia_request_window(p_dev, p_dev->resource[3], 0); | 126 | ret = pcmcia_request_window(p_dev, p_dev->resource[3], 0); |
122 | if (ret != 0) | 127 | if (ret != 0) |
123 | goto exit2; | 128 | goto exit3; |
124 | 129 | ||
125 | ret = pcmcia_map_mem_page(p_dev, p_dev->resource[3], 0); | 130 | ret = pcmcia_map_mem_page(p_dev, p_dev->resource[3], 0); |
126 | if (ret != 0) | 131 | if (ret != 0) |
@@ -128,23 +133,28 @@ static int ipwireless_probe(struct pcmcia_device *p_dev, void *priv_data) | |||
128 | 133 | ||
129 | ipw->attr_memory = ioremap(p_dev->resource[3]->start, | 134 | ipw->attr_memory = ioremap(p_dev->resource[3]->start, |
130 | resource_size(p_dev->resource[3])); | 135 | resource_size(p_dev->resource[3])); |
131 | request_mem_region(p_dev->resource[3]->start, | 136 | if (!request_mem_region(p_dev->resource[3]->start, |
132 | resource_size(p_dev->resource[3]), | 137 | resource_size(p_dev->resource[3]), |
133 | IPWIRELESS_PCCARD_NAME); | 138 | IPWIRELESS_PCCARD_NAME)) { |
139 | ret = -EBUSY; | ||
140 | goto exit4; | ||
141 | } | ||
134 | 142 | ||
135 | return 0; | 143 | return 0; |
136 | 144 | ||
145 | exit4: | ||
146 | iounmap(ipw->attr_memory); | ||
137 | exit3: | 147 | exit3: |
148 | release_mem_region(p_dev->resource[2]->start, | ||
149 | resource_size(p_dev->resource[2])); | ||
138 | exit2: | 150 | exit2: |
139 | if (ipw->common_memory) { | 151 | iounmap(ipw->common_memory); |
140 | release_mem_region(p_dev->resource[2]->start, | ||
141 | resource_size(p_dev->resource[2])); | ||
142 | iounmap(ipw->common_memory); | ||
143 | } | ||
144 | exit1: | 152 | exit1: |
145 | release_resource(io_resource); | 153 | release_region(p_dev->resource[0]->start, |
154 | resource_size(p_dev->resource[0])); | ||
155 | exit: | ||
146 | pcmcia_disable_device(p_dev); | 156 | pcmcia_disable_device(p_dev); |
147 | return -1; | 157 | return ret; |
148 | } | 158 | } |
149 | 159 | ||
150 | static int config_ipwireless(struct ipw_dev *ipw) | 160 | static int config_ipwireless(struct ipw_dev *ipw) |
@@ -219,6 +229,8 @@ exit: | |||
219 | 229 | ||
220 | static void release_ipwireless(struct ipw_dev *ipw) | 230 | static void release_ipwireless(struct ipw_dev *ipw) |
221 | { | 231 | { |
232 | release_region(ipw->link->resource[0]->start, | ||
233 | resource_size(ipw->link->resource[0])); | ||
222 | if (ipw->common_memory) { | 234 | if (ipw->common_memory) { |
223 | release_mem_region(ipw->link->resource[2]->start, | 235 | release_mem_region(ipw->link->resource[2]->start, |
224 | resource_size(ipw->link->resource[2])); | 236 | resource_size(ipw->link->resource[2])); |
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c index 3dadfa2a8528..28d1d3c24d65 100644 --- a/drivers/gpu/drm/drm_irq.c +++ b/drivers/gpu/drm/drm_irq.c | |||
@@ -164,8 +164,10 @@ static void vblank_disable_and_save(struct drm_device *dev, int crtc) | |||
164 | * available. In that case we can't account for this and just | 164 | * available. In that case we can't account for this and just |
165 | * hope for the best. | 165 | * hope for the best. |
166 | */ | 166 | */ |
167 | if ((vblrc > 0) && (abs(diff_ns) > 1000000)) | 167 | if ((vblrc > 0) && (abs64(diff_ns) > 1000000)) { |
168 | atomic_inc(&dev->_vblank_count[crtc]); | 168 | atomic_inc(&dev->_vblank_count[crtc]); |
169 | smp_mb__after_atomic_inc(); | ||
170 | } | ||
169 | 171 | ||
170 | /* Invalidate all timestamps while vblank irq's are off. */ | 172 | /* Invalidate all timestamps while vblank irq's are off. */ |
171 | clear_vblank_timestamps(dev, crtc); | 173 | clear_vblank_timestamps(dev, crtc); |
@@ -491,6 +493,12 @@ void drm_calc_timestamping_constants(struct drm_crtc *crtc) | |||
491 | /* Dot clock in Hz: */ | 493 | /* Dot clock in Hz: */ |
492 | dotclock = (u64) crtc->hwmode.clock * 1000; | 494 | dotclock = (u64) crtc->hwmode.clock * 1000; |
493 | 495 | ||
496 | /* Fields of interlaced scanout modes are only halve a frame duration. | ||
497 | * Double the dotclock to get halve the frame-/line-/pixelduration. | ||
498 | */ | ||
499 | if (crtc->hwmode.flags & DRM_MODE_FLAG_INTERLACE) | ||
500 | dotclock *= 2; | ||
501 | |||
494 | /* Valid dotclock? */ | 502 | /* Valid dotclock? */ |
495 | if (dotclock > 0) { | 503 | if (dotclock > 0) { |
496 | /* Convert scanline length in pixels and video dot clock to | 504 | /* Convert scanline length in pixels and video dot clock to |
@@ -603,14 +611,6 @@ int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, int crtc, | |||
603 | return -EAGAIN; | 611 | return -EAGAIN; |
604 | } | 612 | } |
605 | 613 | ||
606 | /* Don't know yet how to handle interlaced or | ||
607 | * double scan modes. Just no-op for now. | ||
608 | */ | ||
609 | if (mode->flags & (DRM_MODE_FLAG_INTERLACE | DRM_MODE_FLAG_DBLSCAN)) { | ||
610 | DRM_DEBUG("crtc %d: Noop due to unsupported mode.\n", crtc); | ||
611 | return -ENOTSUPP; | ||
612 | } | ||
613 | |||
614 | /* Get current scanout position with system timestamp. | 614 | /* Get current scanout position with system timestamp. |
615 | * Repeat query up to DRM_TIMESTAMP_MAXRETRIES times | 615 | * Repeat query up to DRM_TIMESTAMP_MAXRETRIES times |
616 | * if single query takes longer than max_error nanoseconds. | 616 | * if single query takes longer than max_error nanoseconds. |
@@ -858,10 +858,11 @@ static void drm_update_vblank_count(struct drm_device *dev, int crtc) | |||
858 | if (rc) { | 858 | if (rc) { |
859 | tslot = atomic_read(&dev->_vblank_count[crtc]) + diff; | 859 | tslot = atomic_read(&dev->_vblank_count[crtc]) + diff; |
860 | vblanktimestamp(dev, crtc, tslot) = t_vblank; | 860 | vblanktimestamp(dev, crtc, tslot) = t_vblank; |
861 | smp_wmb(); | ||
862 | } | 861 | } |
863 | 862 | ||
863 | smp_mb__before_atomic_inc(); | ||
864 | atomic_add(diff, &dev->_vblank_count[crtc]); | 864 | atomic_add(diff, &dev->_vblank_count[crtc]); |
865 | smp_mb__after_atomic_inc(); | ||
865 | } | 866 | } |
866 | 867 | ||
867 | /** | 868 | /** |
@@ -1011,7 +1012,8 @@ int drm_modeset_ctl(struct drm_device *dev, void *data, | |||
1011 | struct drm_file *file_priv) | 1012 | struct drm_file *file_priv) |
1012 | { | 1013 | { |
1013 | struct drm_modeset_ctl *modeset = data; | 1014 | struct drm_modeset_ctl *modeset = data; |
1014 | int crtc, ret = 0; | 1015 | int ret = 0; |
1016 | unsigned int crtc; | ||
1015 | 1017 | ||
1016 | /* If drm_vblank_init() hasn't been called yet, just no-op */ | 1018 | /* If drm_vblank_init() hasn't been called yet, just no-op */ |
1017 | if (!dev->num_crtcs) | 1019 | if (!dev->num_crtcs) |
@@ -1293,15 +1295,16 @@ bool drm_handle_vblank(struct drm_device *dev, int crtc) | |||
1293 | * e.g., due to spurious vblank interrupts. We need to | 1295 | * e.g., due to spurious vblank interrupts. We need to |
1294 | * ignore those for accounting. | 1296 | * ignore those for accounting. |
1295 | */ | 1297 | */ |
1296 | if (abs(diff_ns) > DRM_REDUNDANT_VBLIRQ_THRESH_NS) { | 1298 | if (abs64(diff_ns) > DRM_REDUNDANT_VBLIRQ_THRESH_NS) { |
1297 | /* Store new timestamp in ringbuffer. */ | 1299 | /* Store new timestamp in ringbuffer. */ |
1298 | vblanktimestamp(dev, crtc, vblcount + 1) = tvblank; | 1300 | vblanktimestamp(dev, crtc, vblcount + 1) = tvblank; |
1299 | smp_wmb(); | ||
1300 | 1301 | ||
1301 | /* Increment cooked vblank count. This also atomically commits | 1302 | /* Increment cooked vblank count. This also atomically commits |
1302 | * the timestamp computed above. | 1303 | * the timestamp computed above. |
1303 | */ | 1304 | */ |
1305 | smp_mb__before_atomic_inc(); | ||
1304 | atomic_inc(&dev->_vblank_count[crtc]); | 1306 | atomic_inc(&dev->_vblank_count[crtc]); |
1307 | smp_mb__after_atomic_inc(); | ||
1305 | } else { | 1308 | } else { |
1306 | DRM_DEBUG("crtc %d: Redundant vblirq ignored. diff_ns = %d\n", | 1309 | DRM_DEBUG("crtc %d: Redundant vblirq ignored. diff_ns = %d\n", |
1307 | crtc, (int) diff_ns); | 1310 | crtc, (int) diff_ns); |
diff --git a/drivers/gpu/drm/i915/i915_gem_tiling.c b/drivers/gpu/drm/i915/i915_gem_tiling.c index 22a32b9932c5..79a04fde69b5 100644 --- a/drivers/gpu/drm/i915/i915_gem_tiling.c +++ b/drivers/gpu/drm/i915/i915_gem_tiling.c | |||
@@ -184,7 +184,7 @@ i915_gem_detect_bit_6_swizzle(struct drm_device *dev) | |||
184 | static bool | 184 | static bool |
185 | i915_tiling_ok(struct drm_device *dev, int stride, int size, int tiling_mode) | 185 | i915_tiling_ok(struct drm_device *dev, int stride, int size, int tiling_mode) |
186 | { | 186 | { |
187 | int tile_width; | 187 | int tile_width, tile_height; |
188 | 188 | ||
189 | /* Linear is always fine */ | 189 | /* Linear is always fine */ |
190 | if (tiling_mode == I915_TILING_NONE) | 190 | if (tiling_mode == I915_TILING_NONE) |
@@ -215,6 +215,20 @@ i915_tiling_ok(struct drm_device *dev, int stride, int size, int tiling_mode) | |||
215 | } | 215 | } |
216 | } | 216 | } |
217 | 217 | ||
218 | if (IS_GEN2(dev) || | ||
219 | (tiling_mode == I915_TILING_Y && HAS_128_BYTE_Y_TILING(dev))) | ||
220 | tile_height = 32; | ||
221 | else | ||
222 | tile_height = 8; | ||
223 | /* i8xx is strange: It has 2 interleaved rows of tiles, so needs an even | ||
224 | * number of tile rows. */ | ||
225 | if (IS_GEN2(dev)) | ||
226 | tile_height *= 2; | ||
227 | |||
228 | /* Size needs to be aligned to a full tile row */ | ||
229 | if (size & (tile_height * stride - 1)) | ||
230 | return false; | ||
231 | |||
218 | /* 965+ just needs multiples of tile width */ | 232 | /* 965+ just needs multiples of tile width */ |
219 | if (INTEL_INFO(dev)->gen >= 4) { | 233 | if (INTEL_INFO(dev)->gen >= 4) { |
220 | if (stride & (tile_width - 1)) | 234 | if (stride & (tile_width - 1)) |
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c index 97f946dcc1aa..8a9e08bf1cf7 100644 --- a/drivers/gpu/drm/i915/i915_irq.c +++ b/drivers/gpu/drm/i915/i915_irq.c | |||
@@ -316,6 +316,8 @@ static void i915_hotplug_work_func(struct work_struct *work) | |||
316 | struct drm_mode_config *mode_config = &dev->mode_config; | 316 | struct drm_mode_config *mode_config = &dev->mode_config; |
317 | struct intel_encoder *encoder; | 317 | struct intel_encoder *encoder; |
318 | 318 | ||
319 | DRM_DEBUG_KMS("running encoder hotplug functions\n"); | ||
320 | |||
319 | list_for_each_entry(encoder, &mode_config->encoder_list, base.head) | 321 | list_for_each_entry(encoder, &mode_config->encoder_list, base.head) |
320 | if (encoder->hot_plug) | 322 | if (encoder->hot_plug) |
321 | encoder->hot_plug(encoder); | 323 | encoder->hot_plug(encoder); |
@@ -1649,9 +1651,7 @@ static int ironlake_irq_postinstall(struct drm_device *dev) | |||
1649 | } else { | 1651 | } else { |
1650 | hotplug_mask = SDE_CRT_HOTPLUG | SDE_PORTB_HOTPLUG | | 1652 | hotplug_mask = SDE_CRT_HOTPLUG | SDE_PORTB_HOTPLUG | |
1651 | SDE_PORTC_HOTPLUG | SDE_PORTD_HOTPLUG; | 1653 | SDE_PORTC_HOTPLUG | SDE_PORTD_HOTPLUG; |
1652 | hotplug_mask |= SDE_AUX_MASK | SDE_FDI_MASK | SDE_TRANS_MASK; | 1654 | hotplug_mask |= SDE_AUX_MASK; |
1653 | I915_WRITE(FDI_RXA_IMR, 0); | ||
1654 | I915_WRITE(FDI_RXB_IMR, 0); | ||
1655 | } | 1655 | } |
1656 | 1656 | ||
1657 | dev_priv->pch_irq_mask = ~hotplug_mask; | 1657 | dev_priv->pch_irq_mask = ~hotplug_mask; |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 3b006536b3d2..e79b25bbee6c 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -1630,19 +1630,19 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y, | |||
1630 | struct drm_i915_gem_object *obj = to_intel_framebuffer(old_fb)->obj; | 1630 | struct drm_i915_gem_object *obj = to_intel_framebuffer(old_fb)->obj; |
1631 | 1631 | ||
1632 | wait_event(dev_priv->pending_flip_queue, | 1632 | wait_event(dev_priv->pending_flip_queue, |
1633 | atomic_read(&dev_priv->mm.wedged) || | ||
1633 | atomic_read(&obj->pending_flip) == 0); | 1634 | atomic_read(&obj->pending_flip) == 0); |
1634 | 1635 | ||
1635 | /* Big Hammer, we also need to ensure that any pending | 1636 | /* Big Hammer, we also need to ensure that any pending |
1636 | * MI_WAIT_FOR_EVENT inside a user batch buffer on the | 1637 | * MI_WAIT_FOR_EVENT inside a user batch buffer on the |
1637 | * current scanout is retired before unpinning the old | 1638 | * current scanout is retired before unpinning the old |
1638 | * framebuffer. | 1639 | * framebuffer. |
1640 | * | ||
1641 | * This should only fail upon a hung GPU, in which case we | ||
1642 | * can safely continue. | ||
1639 | */ | 1643 | */ |
1640 | ret = i915_gem_object_flush_gpu(obj, false); | 1644 | ret = i915_gem_object_flush_gpu(obj, false); |
1641 | if (ret) { | 1645 | (void) ret; |
1642 | i915_gem_object_unpin(to_intel_framebuffer(crtc->fb)->obj); | ||
1643 | mutex_unlock(&dev->struct_mutex); | ||
1644 | return ret; | ||
1645 | } | ||
1646 | } | 1646 | } |
1647 | 1647 | ||
1648 | ret = intel_pipe_set_base_atomic(crtc, crtc->fb, x, y, | 1648 | ret = intel_pipe_set_base_atomic(crtc, crtc->fb, x, y, |
@@ -2045,6 +2045,31 @@ static void intel_crtc_wait_for_pending_flips(struct drm_crtc *crtc) | |||
2045 | atomic_read(&obj->pending_flip) == 0); | 2045 | atomic_read(&obj->pending_flip) == 0); |
2046 | } | 2046 | } |
2047 | 2047 | ||
2048 | static bool intel_crtc_driving_pch(struct drm_crtc *crtc) | ||
2049 | { | ||
2050 | struct drm_device *dev = crtc->dev; | ||
2051 | struct drm_mode_config *mode_config = &dev->mode_config; | ||
2052 | struct intel_encoder *encoder; | ||
2053 | |||
2054 | /* | ||
2055 | * If there's a non-PCH eDP on this crtc, it must be DP_A, and that | ||
2056 | * must be driven by its own crtc; no sharing is possible. | ||
2057 | */ | ||
2058 | list_for_each_entry(encoder, &mode_config->encoder_list, base.head) { | ||
2059 | if (encoder->base.crtc != crtc) | ||
2060 | continue; | ||
2061 | |||
2062 | switch (encoder->type) { | ||
2063 | case INTEL_OUTPUT_EDP: | ||
2064 | if (!intel_encoder_is_pch_edp(&encoder->base)) | ||
2065 | return false; | ||
2066 | continue; | ||
2067 | } | ||
2068 | } | ||
2069 | |||
2070 | return true; | ||
2071 | } | ||
2072 | |||
2048 | static void ironlake_crtc_enable(struct drm_crtc *crtc) | 2073 | static void ironlake_crtc_enable(struct drm_crtc *crtc) |
2049 | { | 2074 | { |
2050 | struct drm_device *dev = crtc->dev; | 2075 | struct drm_device *dev = crtc->dev; |
@@ -2053,6 +2078,7 @@ static void ironlake_crtc_enable(struct drm_crtc *crtc) | |||
2053 | int pipe = intel_crtc->pipe; | 2078 | int pipe = intel_crtc->pipe; |
2054 | int plane = intel_crtc->plane; | 2079 | int plane = intel_crtc->plane; |
2055 | u32 reg, temp; | 2080 | u32 reg, temp; |
2081 | bool is_pch_port = false; | ||
2056 | 2082 | ||
2057 | if (intel_crtc->active) | 2083 | if (intel_crtc->active) |
2058 | return; | 2084 | return; |
@@ -2066,7 +2092,56 @@ static void ironlake_crtc_enable(struct drm_crtc *crtc) | |||
2066 | I915_WRITE(PCH_LVDS, temp | LVDS_PORT_EN); | 2092 | I915_WRITE(PCH_LVDS, temp | LVDS_PORT_EN); |
2067 | } | 2093 | } |
2068 | 2094 | ||
2069 | ironlake_fdi_enable(crtc); | 2095 | is_pch_port = intel_crtc_driving_pch(crtc); |
2096 | |||
2097 | if (is_pch_port) | ||
2098 | ironlake_fdi_enable(crtc); | ||
2099 | else { | ||
2100 | /* disable CPU FDI tx and PCH FDI rx */ | ||
2101 | reg = FDI_TX_CTL(pipe); | ||
2102 | temp = I915_READ(reg); | ||
2103 | I915_WRITE(reg, temp & ~FDI_TX_ENABLE); | ||
2104 | POSTING_READ(reg); | ||
2105 | |||
2106 | reg = FDI_RX_CTL(pipe); | ||
2107 | temp = I915_READ(reg); | ||
2108 | temp &= ~(0x7 << 16); | ||
2109 | temp |= (I915_READ(PIPECONF(pipe)) & PIPE_BPC_MASK) << 11; | ||
2110 | I915_WRITE(reg, temp & ~FDI_RX_ENABLE); | ||
2111 | |||
2112 | POSTING_READ(reg); | ||
2113 | udelay(100); | ||
2114 | |||
2115 | /* Ironlake workaround, disable clock pointer after downing FDI */ | ||
2116 | if (HAS_PCH_IBX(dev)) | ||
2117 | I915_WRITE(FDI_RX_CHICKEN(pipe), | ||
2118 | I915_READ(FDI_RX_CHICKEN(pipe) & | ||
2119 | ~FDI_RX_PHASE_SYNC_POINTER_ENABLE)); | ||
2120 | |||
2121 | /* still set train pattern 1 */ | ||
2122 | reg = FDI_TX_CTL(pipe); | ||
2123 | temp = I915_READ(reg); | ||
2124 | temp &= ~FDI_LINK_TRAIN_NONE; | ||
2125 | temp |= FDI_LINK_TRAIN_PATTERN_1; | ||
2126 | I915_WRITE(reg, temp); | ||
2127 | |||
2128 | reg = FDI_RX_CTL(pipe); | ||
2129 | temp = I915_READ(reg); | ||
2130 | if (HAS_PCH_CPT(dev)) { | ||
2131 | temp &= ~FDI_LINK_TRAIN_PATTERN_MASK_CPT; | ||
2132 | temp |= FDI_LINK_TRAIN_PATTERN_1_CPT; | ||
2133 | } else { | ||
2134 | temp &= ~FDI_LINK_TRAIN_NONE; | ||
2135 | temp |= FDI_LINK_TRAIN_PATTERN_1; | ||
2136 | } | ||
2137 | /* BPC in FDI rx is consistent with that in PIPECONF */ | ||
2138 | temp &= ~(0x07 << 16); | ||
2139 | temp |= (I915_READ(PIPECONF(pipe)) & PIPE_BPC_MASK) << 11; | ||
2140 | I915_WRITE(reg, temp); | ||
2141 | |||
2142 | POSTING_READ(reg); | ||
2143 | udelay(100); | ||
2144 | } | ||
2070 | 2145 | ||
2071 | /* Enable panel fitting for LVDS */ | 2146 | /* Enable panel fitting for LVDS */ |
2072 | if (dev_priv->pch_pf_size && | 2147 | if (dev_priv->pch_pf_size && |
@@ -2100,6 +2175,10 @@ static void ironlake_crtc_enable(struct drm_crtc *crtc) | |||
2100 | intel_flush_display_plane(dev, plane); | 2175 | intel_flush_display_plane(dev, plane); |
2101 | } | 2176 | } |
2102 | 2177 | ||
2178 | /* Skip the PCH stuff if possible */ | ||
2179 | if (!is_pch_port) | ||
2180 | goto done; | ||
2181 | |||
2103 | /* For PCH output, training FDI link */ | 2182 | /* For PCH output, training FDI link */ |
2104 | if (IS_GEN6(dev)) | 2183 | if (IS_GEN6(dev)) |
2105 | gen6_fdi_link_train(crtc); | 2184 | gen6_fdi_link_train(crtc); |
@@ -2184,7 +2263,7 @@ static void ironlake_crtc_enable(struct drm_crtc *crtc) | |||
2184 | I915_WRITE(reg, temp | TRANS_ENABLE); | 2263 | I915_WRITE(reg, temp | TRANS_ENABLE); |
2185 | if (wait_for(I915_READ(reg) & TRANS_STATE_ENABLE, 100)) | 2264 | if (wait_for(I915_READ(reg) & TRANS_STATE_ENABLE, 100)) |
2186 | DRM_ERROR("failed to enable transcoder %d\n", pipe); | 2265 | DRM_ERROR("failed to enable transcoder %d\n", pipe); |
2187 | 2266 | done: | |
2188 | intel_crtc_load_lut(crtc); | 2267 | intel_crtc_load_lut(crtc); |
2189 | intel_update_fbc(dev); | 2268 | intel_update_fbc(dev); |
2190 | intel_crtc_update_cursor(crtc, true); | 2269 | intel_crtc_update_cursor(crtc, true); |
@@ -6496,7 +6575,7 @@ static void ironlake_disable_rc6(struct drm_device *dev) | |||
6496 | POSTING_READ(RSTDBYCTL); | 6575 | POSTING_READ(RSTDBYCTL); |
6497 | } | 6576 | } |
6498 | 6577 | ||
6499 | ironlake_disable_rc6(dev); | 6578 | ironlake_teardown_rc6(dev); |
6500 | } | 6579 | } |
6501 | 6580 | ||
6502 | static int ironlake_setup_rc6(struct drm_device *dev) | 6581 | static int ironlake_setup_rc6(struct drm_device *dev) |
diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c index d38a4d9f9b0b..a52184007f5f 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bo.c +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c | |||
@@ -49,7 +49,10 @@ nouveau_bo_del_ttm(struct ttm_buffer_object *bo) | |||
49 | DRM_ERROR("bo %p still attached to GEM object\n", bo); | 49 | DRM_ERROR("bo %p still attached to GEM object\n", bo); |
50 | 50 | ||
51 | nv10_mem_put_tile_region(dev, nvbo->tile, NULL); | 51 | nv10_mem_put_tile_region(dev, nvbo->tile, NULL); |
52 | nouveau_vm_put(&nvbo->vma); | 52 | if (nvbo->vma.node) { |
53 | nouveau_vm_unmap(&nvbo->vma); | ||
54 | nouveau_vm_put(&nvbo->vma); | ||
55 | } | ||
53 | kfree(nvbo); | 56 | kfree(nvbo); |
54 | } | 57 | } |
55 | 58 | ||
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c index 56deae5bf02e..93fa735c8c1a 100644 --- a/drivers/gpu/drm/radeon/r100.c +++ b/drivers/gpu/drm/radeon/r100.c | |||
@@ -3490,7 +3490,7 @@ void r100_cs_track_clear(struct radeon_device *rdev, struct r100_cs_track *track | |||
3490 | track->num_texture = 16; | 3490 | track->num_texture = 16; |
3491 | track->maxy = 4096; | 3491 | track->maxy = 4096; |
3492 | track->separate_cube = 0; | 3492 | track->separate_cube = 0; |
3493 | track->aaresolve = true; | 3493 | track->aaresolve = false; |
3494 | track->aa.robj = NULL; | 3494 | track->aa.robj = NULL; |
3495 | } | 3495 | } |
3496 | 3496 | ||
@@ -3801,8 +3801,6 @@ static int r100_startup(struct radeon_device *rdev) | |||
3801 | r100_mc_program(rdev); | 3801 | r100_mc_program(rdev); |
3802 | /* Resume clock */ | 3802 | /* Resume clock */ |
3803 | r100_clock_startup(rdev); | 3803 | r100_clock_startup(rdev); |
3804 | /* Initialize GPU configuration (# pipes, ...) */ | ||
3805 | // r100_gpu_init(rdev); | ||
3806 | /* Initialize GART (initialize after TTM so we can allocate | 3804 | /* Initialize GART (initialize after TTM so we can allocate |
3807 | * memory through TTM but finalize after TTM) */ | 3805 | * memory through TTM but finalize after TTM) */ |
3808 | r100_enable_bm(rdev); | 3806 | r100_enable_bm(rdev); |
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c index 0e657095de7c..3e7e7f9eb781 100644 --- a/drivers/gpu/drm/radeon/radeon_display.c +++ b/drivers/gpu/drm/radeon/radeon_display.c | |||
@@ -971,7 +971,7 @@ void radeon_compute_pll_legacy(struct radeon_pll *pll, | |||
971 | max_fractional_feed_div = pll->max_frac_feedback_div; | 971 | max_fractional_feed_div = pll->max_frac_feedback_div; |
972 | } | 972 | } |
973 | 973 | ||
974 | for (post_div = min_post_div; post_div <= max_post_div; ++post_div) { | 974 | for (post_div = max_post_div; post_div >= min_post_div; --post_div) { |
975 | uint32_t ref_div; | 975 | uint32_t ref_div; |
976 | 976 | ||
977 | if ((pll->flags & RADEON_PLL_NO_ODD_POST_DIV) && (post_div & 1)) | 977 | if ((pll->flags & RADEON_PLL_NO_ODD_POST_DIV) && (post_div & 1)) |
diff --git a/drivers/gpu/drm/radeon/radeon_fb.c b/drivers/gpu/drm/radeon/radeon_fb.c index 66324b5bb5ba..cc44bdfec80f 100644 --- a/drivers/gpu/drm/radeon/radeon_fb.c +++ b/drivers/gpu/drm/radeon/radeon_fb.c | |||
@@ -113,11 +113,14 @@ static int radeonfb_create_pinned_object(struct radeon_fbdev *rfbdev, | |||
113 | u32 tiling_flags = 0; | 113 | u32 tiling_flags = 0; |
114 | int ret; | 114 | int ret; |
115 | int aligned_size, size; | 115 | int aligned_size, size; |
116 | int height = mode_cmd->height; | ||
116 | 117 | ||
117 | /* need to align pitch with crtc limits */ | 118 | /* need to align pitch with crtc limits */ |
118 | mode_cmd->pitch = radeon_align_pitch(rdev, mode_cmd->width, mode_cmd->bpp, fb_tiled) * ((mode_cmd->bpp + 1) / 8); | 119 | mode_cmd->pitch = radeon_align_pitch(rdev, mode_cmd->width, mode_cmd->bpp, fb_tiled) * ((mode_cmd->bpp + 1) / 8); |
119 | 120 | ||
120 | size = mode_cmd->pitch * mode_cmd->height; | 121 | if (rdev->family >= CHIP_R600) |
122 | height = ALIGN(mode_cmd->height, 8); | ||
123 | size = mode_cmd->pitch * height; | ||
121 | aligned_size = ALIGN(size, PAGE_SIZE); | 124 | aligned_size = ALIGN(size, PAGE_SIZE); |
122 | ret = radeon_gem_object_create(rdev, aligned_size, 0, | 125 | ret = radeon_gem_object_create(rdev, aligned_size, 0, |
123 | RADEON_GEM_DOMAIN_VRAM, | 126 | RADEON_GEM_DOMAIN_VRAM, |
diff --git a/drivers/hwmon/ad7414.c b/drivers/hwmon/ad7414.c index 86d822aa9bbf..d46c0c758ddf 100644 --- a/drivers/hwmon/ad7414.c +++ b/drivers/hwmon/ad7414.c | |||
@@ -242,6 +242,7 @@ static const struct i2c_device_id ad7414_id[] = { | |||
242 | { "ad7414", 0 }, | 242 | { "ad7414", 0 }, |
243 | {} | 243 | {} |
244 | }; | 244 | }; |
245 | MODULE_DEVICE_TABLE(i2c, ad7414_id); | ||
245 | 246 | ||
246 | static struct i2c_driver ad7414_driver = { | 247 | static struct i2c_driver ad7414_driver = { |
247 | .driver = { | 248 | .driver = { |
diff --git a/drivers/hwmon/adt7411.c b/drivers/hwmon/adt7411.c index f13c843a2964..5cc3e3784b42 100644 --- a/drivers/hwmon/adt7411.c +++ b/drivers/hwmon/adt7411.c | |||
@@ -334,6 +334,7 @@ static const struct i2c_device_id adt7411_id[] = { | |||
334 | { "adt7411", 0 }, | 334 | { "adt7411", 0 }, |
335 | { } | 335 | { } |
336 | }; | 336 | }; |
337 | MODULE_DEVICE_TABLE(i2c, adt7411_id); | ||
337 | 338 | ||
338 | static struct i2c_driver adt7411_driver = { | 339 | static struct i2c_driver adt7411_driver = { |
339 | .driver = { | 340 | .driver = { |
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c index b605ff3a1fa0..829a2a1029f7 100644 --- a/drivers/i2c/busses/i2c-omap.c +++ b/drivers/i2c/busses/i2c-omap.c | |||
@@ -847,11 +847,15 @@ complete: | |||
847 | dev_err(dev->dev, "Arbitration lost\n"); | 847 | dev_err(dev->dev, "Arbitration lost\n"); |
848 | err |= OMAP_I2C_STAT_AL; | 848 | err |= OMAP_I2C_STAT_AL; |
849 | } | 849 | } |
850 | /* | ||
851 | * ProDB0017052: Clear ARDY bit twice | ||
852 | */ | ||
850 | if (stat & (OMAP_I2C_STAT_ARDY | OMAP_I2C_STAT_NACK | | 853 | if (stat & (OMAP_I2C_STAT_ARDY | OMAP_I2C_STAT_NACK | |
851 | OMAP_I2C_STAT_AL)) { | 854 | OMAP_I2C_STAT_AL)) { |
852 | omap_i2c_ack_stat(dev, stat & | 855 | omap_i2c_ack_stat(dev, stat & |
853 | (OMAP_I2C_STAT_RRDY | OMAP_I2C_STAT_RDR | | 856 | (OMAP_I2C_STAT_RRDY | OMAP_I2C_STAT_RDR | |
854 | OMAP_I2C_STAT_XRDY | OMAP_I2C_STAT_XDR)); | 857 | OMAP_I2C_STAT_XRDY | OMAP_I2C_STAT_XDR | |
858 | OMAP_I2C_STAT_ARDY)); | ||
855 | omap_i2c_complete_cmd(dev, err); | 859 | omap_i2c_complete_cmd(dev, err); |
856 | return IRQ_HANDLED; | 860 | return IRQ_HANDLED; |
857 | } | 861 | } |
@@ -1137,12 +1141,41 @@ omap_i2c_remove(struct platform_device *pdev) | |||
1137 | return 0; | 1141 | return 0; |
1138 | } | 1142 | } |
1139 | 1143 | ||
1144 | #ifdef CONFIG_SUSPEND | ||
1145 | static int omap_i2c_suspend(struct device *dev) | ||
1146 | { | ||
1147 | if (!pm_runtime_suspended(dev)) | ||
1148 | if (dev->bus && dev->bus->pm && dev->bus->pm->runtime_suspend) | ||
1149 | dev->bus->pm->runtime_suspend(dev); | ||
1150 | |||
1151 | return 0; | ||
1152 | } | ||
1153 | |||
1154 | static int omap_i2c_resume(struct device *dev) | ||
1155 | { | ||
1156 | if (!pm_runtime_suspended(dev)) | ||
1157 | if (dev->bus && dev->bus->pm && dev->bus->pm->runtime_resume) | ||
1158 | dev->bus->pm->runtime_resume(dev); | ||
1159 | |||
1160 | return 0; | ||
1161 | } | ||
1162 | |||
1163 | static struct dev_pm_ops omap_i2c_pm_ops = { | ||
1164 | .suspend = omap_i2c_suspend, | ||
1165 | .resume = omap_i2c_resume, | ||
1166 | }; | ||
1167 | #define OMAP_I2C_PM_OPS (&omap_i2c_pm_ops) | ||
1168 | #else | ||
1169 | #define OMAP_I2C_PM_OPS NULL | ||
1170 | #endif | ||
1171 | |||
1140 | static struct platform_driver omap_i2c_driver = { | 1172 | static struct platform_driver omap_i2c_driver = { |
1141 | .probe = omap_i2c_probe, | 1173 | .probe = omap_i2c_probe, |
1142 | .remove = omap_i2c_remove, | 1174 | .remove = omap_i2c_remove, |
1143 | .driver = { | 1175 | .driver = { |
1144 | .name = "omap_i2c", | 1176 | .name = "omap_i2c", |
1145 | .owner = THIS_MODULE, | 1177 | .owner = THIS_MODULE, |
1178 | .pm = OMAP_I2C_PM_OPS, | ||
1146 | }, | 1179 | }, |
1147 | }; | 1180 | }; |
1148 | 1181 | ||
diff --git a/drivers/i2c/busses/i2c-stu300.c b/drivers/i2c/busses/i2c-stu300.c index 495be451d326..266135ddf7fa 100644 --- a/drivers/i2c/busses/i2c-stu300.c +++ b/drivers/i2c/busses/i2c-stu300.c | |||
@@ -942,7 +942,7 @@ stu300_probe(struct platform_device *pdev) | |||
942 | adap->owner = THIS_MODULE; | 942 | adap->owner = THIS_MODULE; |
943 | /* DDC class but actually often used for more generic I2C */ | 943 | /* DDC class but actually often used for more generic I2C */ |
944 | adap->class = I2C_CLASS_DDC; | 944 | adap->class = I2C_CLASS_DDC; |
945 | strncpy(adap->name, "ST Microelectronics DDC I2C adapter", | 945 | strlcpy(adap->name, "ST Microelectronics DDC I2C adapter", |
946 | sizeof(adap->name)); | 946 | sizeof(adap->name)); |
947 | adap->nr = bus_nr; | 947 | adap->nr = bus_nr; |
948 | adap->algo = &stu300_algo; | 948 | adap->algo = &stu300_algo; |
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index 7ce9caf4521b..fd1e11799137 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c | |||
@@ -1170,7 +1170,7 @@ static struct cdrom_device_ops ide_cdrom_dops = { | |||
1170 | .open = ide_cdrom_open_real, | 1170 | .open = ide_cdrom_open_real, |
1171 | .release = ide_cdrom_release_real, | 1171 | .release = ide_cdrom_release_real, |
1172 | .drive_status = ide_cdrom_drive_status, | 1172 | .drive_status = ide_cdrom_drive_status, |
1173 | .media_changed = ide_cdrom_check_media_change_real, | 1173 | .check_events = ide_cdrom_check_events_real, |
1174 | .tray_move = ide_cdrom_tray_move, | 1174 | .tray_move = ide_cdrom_tray_move, |
1175 | .lock_door = ide_cdrom_lock_door, | 1175 | .lock_door = ide_cdrom_lock_door, |
1176 | .select_speed = ide_cdrom_select_speed, | 1176 | .select_speed = ide_cdrom_select_speed, |
@@ -1693,10 +1693,11 @@ static int idecd_ioctl(struct block_device *bdev, fmode_t mode, | |||
1693 | } | 1693 | } |
1694 | 1694 | ||
1695 | 1695 | ||
1696 | static int idecd_media_changed(struct gendisk *disk) | 1696 | static unsigned int idecd_check_events(struct gendisk *disk, |
1697 | unsigned int clearing) | ||
1697 | { | 1698 | { |
1698 | struct cdrom_info *info = ide_drv_g(disk, cdrom_info); | 1699 | struct cdrom_info *info = ide_drv_g(disk, cdrom_info); |
1699 | return cdrom_media_changed(&info->devinfo); | 1700 | return cdrom_check_events(&info->devinfo, clearing); |
1700 | } | 1701 | } |
1701 | 1702 | ||
1702 | static int idecd_revalidate_disk(struct gendisk *disk) | 1703 | static int idecd_revalidate_disk(struct gendisk *disk) |
@@ -1714,7 +1715,7 @@ static const struct block_device_operations idecd_ops = { | |||
1714 | .open = idecd_open, | 1715 | .open = idecd_open, |
1715 | .release = idecd_release, | 1716 | .release = idecd_release, |
1716 | .ioctl = idecd_ioctl, | 1717 | .ioctl = idecd_ioctl, |
1717 | .media_changed = idecd_media_changed, | 1718 | .check_events = idecd_check_events, |
1718 | .revalidate_disk = idecd_revalidate_disk | 1719 | .revalidate_disk = idecd_revalidate_disk |
1719 | }; | 1720 | }; |
1720 | 1721 | ||
@@ -1781,6 +1782,7 @@ static int ide_cd_probe(ide_drive_t *drive) | |||
1781 | ide_cd_read_toc(drive, &sense); | 1782 | ide_cd_read_toc(drive, &sense); |
1782 | g->fops = &idecd_ops; | 1783 | g->fops = &idecd_ops; |
1783 | g->flags |= GENHD_FL_REMOVABLE; | 1784 | g->flags |= GENHD_FL_REMOVABLE; |
1785 | g->events = DISK_EVENT_MEDIA_CHANGE; | ||
1784 | add_disk(g); | 1786 | add_disk(g); |
1785 | return 0; | 1787 | return 0; |
1786 | 1788 | ||
diff --git a/drivers/ide/ide-cd.h b/drivers/ide/ide-cd.h index 93a3cf1b0f3f..1efc936f5b66 100644 --- a/drivers/ide/ide-cd.h +++ b/drivers/ide/ide-cd.h | |||
@@ -111,7 +111,8 @@ int cdrom_check_status(ide_drive_t *, struct request_sense *); | |||
111 | int ide_cdrom_open_real(struct cdrom_device_info *, int); | 111 | int ide_cdrom_open_real(struct cdrom_device_info *, int); |
112 | void ide_cdrom_release_real(struct cdrom_device_info *); | 112 | void ide_cdrom_release_real(struct cdrom_device_info *); |
113 | int ide_cdrom_drive_status(struct cdrom_device_info *, int); | 113 | int ide_cdrom_drive_status(struct cdrom_device_info *, int); |
114 | int ide_cdrom_check_media_change_real(struct cdrom_device_info *, int); | 114 | unsigned int ide_cdrom_check_events_real(struct cdrom_device_info *, |
115 | unsigned int clearing, int slot_nr); | ||
115 | int ide_cdrom_tray_move(struct cdrom_device_info *, int); | 116 | int ide_cdrom_tray_move(struct cdrom_device_info *, int); |
116 | int ide_cdrom_lock_door(struct cdrom_device_info *, int); | 117 | int ide_cdrom_lock_door(struct cdrom_device_info *, int); |
117 | int ide_cdrom_select_speed(struct cdrom_device_info *, int); | 118 | int ide_cdrom_select_speed(struct cdrom_device_info *, int); |
diff --git a/drivers/ide/ide-cd_ioctl.c b/drivers/ide/ide-cd_ioctl.c index 766b3deeb23c..2a6bc50e8a41 100644 --- a/drivers/ide/ide-cd_ioctl.c +++ b/drivers/ide/ide-cd_ioctl.c | |||
@@ -79,8 +79,8 @@ int ide_cdrom_drive_status(struct cdrom_device_info *cdi, int slot_nr) | |||
79 | return CDS_DRIVE_NOT_READY; | 79 | return CDS_DRIVE_NOT_READY; |
80 | } | 80 | } |
81 | 81 | ||
82 | int ide_cdrom_check_media_change_real(struct cdrom_device_info *cdi, | 82 | unsigned int ide_cdrom_check_events_real(struct cdrom_device_info *cdi, |
83 | int slot_nr) | 83 | unsigned int clearing, int slot_nr) |
84 | { | 84 | { |
85 | ide_drive_t *drive = cdi->handle; | 85 | ide_drive_t *drive = cdi->handle; |
86 | int retval; | 86 | int retval; |
@@ -89,9 +89,9 @@ int ide_cdrom_check_media_change_real(struct cdrom_device_info *cdi, | |||
89 | (void) cdrom_check_status(drive, NULL); | 89 | (void) cdrom_check_status(drive, NULL); |
90 | retval = (drive->dev_flags & IDE_DFLAG_MEDIA_CHANGED) ? 1 : 0; | 90 | retval = (drive->dev_flags & IDE_DFLAG_MEDIA_CHANGED) ? 1 : 0; |
91 | drive->dev_flags &= ~IDE_DFLAG_MEDIA_CHANGED; | 91 | drive->dev_flags &= ~IDE_DFLAG_MEDIA_CHANGED; |
92 | return retval; | 92 | return retval ? DISK_EVENT_MEDIA_CHANGE : 0; |
93 | } else { | 93 | } else { |
94 | return -EINVAL; | 94 | return 0; |
95 | } | 95 | } |
96 | } | 96 | } |
97 | 97 | ||
diff --git a/drivers/ide/ide-gd.c b/drivers/ide/ide-gd.c index 35c4b43585e3..c4ffd4888939 100644 --- a/drivers/ide/ide-gd.c +++ b/drivers/ide/ide-gd.c | |||
@@ -285,11 +285,12 @@ static int ide_gd_getgeo(struct block_device *bdev, struct hd_geometry *geo) | |||
285 | return 0; | 285 | return 0; |
286 | } | 286 | } |
287 | 287 | ||
288 | static int ide_gd_media_changed(struct gendisk *disk) | 288 | static unsigned int ide_gd_check_events(struct gendisk *disk, |
289 | unsigned int clearing) | ||
289 | { | 290 | { |
290 | struct ide_disk_obj *idkp = ide_drv_g(disk, ide_disk_obj); | 291 | struct ide_disk_obj *idkp = ide_drv_g(disk, ide_disk_obj); |
291 | ide_drive_t *drive = idkp->drive; | 292 | ide_drive_t *drive = idkp->drive; |
292 | int ret; | 293 | bool ret; |
293 | 294 | ||
294 | /* do not scan partitions twice if this is a removable device */ | 295 | /* do not scan partitions twice if this is a removable device */ |
295 | if (drive->dev_flags & IDE_DFLAG_ATTACH) { | 296 | if (drive->dev_flags & IDE_DFLAG_ATTACH) { |
@@ -297,10 +298,10 @@ static int ide_gd_media_changed(struct gendisk *disk) | |||
297 | return 0; | 298 | return 0; |
298 | } | 299 | } |
299 | 300 | ||
300 | ret = !!(drive->dev_flags & IDE_DFLAG_MEDIA_CHANGED); | 301 | ret = drive->dev_flags & IDE_DFLAG_MEDIA_CHANGED; |
301 | drive->dev_flags &= ~IDE_DFLAG_MEDIA_CHANGED; | 302 | drive->dev_flags &= ~IDE_DFLAG_MEDIA_CHANGED; |
302 | 303 | ||
303 | return ret; | 304 | return ret ? DISK_EVENT_MEDIA_CHANGE : 0; |
304 | } | 305 | } |
305 | 306 | ||
306 | static void ide_gd_unlock_native_capacity(struct gendisk *disk) | 307 | static void ide_gd_unlock_native_capacity(struct gendisk *disk) |
@@ -318,7 +319,7 @@ static int ide_gd_revalidate_disk(struct gendisk *disk) | |||
318 | struct ide_disk_obj *idkp = ide_drv_g(disk, ide_disk_obj); | 319 | struct ide_disk_obj *idkp = ide_drv_g(disk, ide_disk_obj); |
319 | ide_drive_t *drive = idkp->drive; | 320 | ide_drive_t *drive = idkp->drive; |
320 | 321 | ||
321 | if (ide_gd_media_changed(disk)) | 322 | if (ide_gd_check_events(disk, 0)) |
322 | drive->disk_ops->get_capacity(drive); | 323 | drive->disk_ops->get_capacity(drive); |
323 | 324 | ||
324 | set_capacity(disk, ide_gd_capacity(drive)); | 325 | set_capacity(disk, ide_gd_capacity(drive)); |
@@ -340,7 +341,7 @@ static const struct block_device_operations ide_gd_ops = { | |||
340 | .release = ide_gd_release, | 341 | .release = ide_gd_release, |
341 | .ioctl = ide_gd_ioctl, | 342 | .ioctl = ide_gd_ioctl, |
342 | .getgeo = ide_gd_getgeo, | 343 | .getgeo = ide_gd_getgeo, |
343 | .media_changed = ide_gd_media_changed, | 344 | .check_events = ide_gd_check_events, |
344 | .unlock_native_capacity = ide_gd_unlock_native_capacity, | 345 | .unlock_native_capacity = ide_gd_unlock_native_capacity, |
345 | .revalidate_disk = ide_gd_revalidate_disk | 346 | .revalidate_disk = ide_gd_revalidate_disk |
346 | }; | 347 | }; |
@@ -412,6 +413,7 @@ static int ide_gd_probe(ide_drive_t *drive) | |||
412 | if (drive->dev_flags & IDE_DFLAG_REMOVABLE) | 413 | if (drive->dev_flags & IDE_DFLAG_REMOVABLE) |
413 | g->flags = GENHD_FL_REMOVABLE; | 414 | g->flags = GENHD_FL_REMOVABLE; |
414 | g->fops = &ide_gd_ops; | 415 | g->fops = &ide_gd_ops; |
416 | g->events = DISK_EVENT_MEDIA_CHANGE; | ||
415 | add_disk(g); | 417 | add_disk(g); |
416 | return 0; | 418 | return 0; |
417 | 419 | ||
diff --git a/drivers/input/gameport/gameport.c b/drivers/input/gameport/gameport.c index 23cf8fc933ec..5b8f59d6c3e8 100644 --- a/drivers/input/gameport/gameport.c +++ b/drivers/input/gameport/gameport.c | |||
@@ -360,7 +360,7 @@ static int gameport_queue_event(void *object, struct module *owner, | |||
360 | event->owner = owner; | 360 | event->owner = owner; |
361 | 361 | ||
362 | list_add_tail(&event->node, &gameport_event_list); | 362 | list_add_tail(&event->node, &gameport_event_list); |
363 | schedule_work(&gameport_event_work); | 363 | queue_work(system_long_wq, &gameport_event_work); |
364 | 364 | ||
365 | out: | 365 | out: |
366 | spin_unlock_irqrestore(&gameport_event_lock, flags); | 366 | spin_unlock_irqrestore(&gameport_event_lock, flags); |
diff --git a/drivers/input/keyboard/tegra-kbc.c b/drivers/input/keyboard/tegra-kbc.c index ac471b77c18e..99ce9032d08c 100644 --- a/drivers/input/keyboard/tegra-kbc.c +++ b/drivers/input/keyboard/tegra-kbc.c | |||
@@ -71,8 +71,9 @@ struct tegra_kbc { | |||
71 | spinlock_t lock; | 71 | spinlock_t lock; |
72 | unsigned int repoll_dly; | 72 | unsigned int repoll_dly; |
73 | unsigned long cp_dly_jiffies; | 73 | unsigned long cp_dly_jiffies; |
74 | bool use_fn_map; | ||
74 | const struct tegra_kbc_platform_data *pdata; | 75 | const struct tegra_kbc_platform_data *pdata; |
75 | unsigned short keycode[KBC_MAX_KEY]; | 76 | unsigned short keycode[KBC_MAX_KEY * 2]; |
76 | unsigned short current_keys[KBC_MAX_KPENT]; | 77 | unsigned short current_keys[KBC_MAX_KPENT]; |
77 | unsigned int num_pressed_keys; | 78 | unsigned int num_pressed_keys; |
78 | struct timer_list timer; | 79 | struct timer_list timer; |
@@ -178,6 +179,40 @@ static const u32 tegra_kbc_default_keymap[] = { | |||
178 | KEY(15, 5, KEY_F2), | 179 | KEY(15, 5, KEY_F2), |
179 | KEY(15, 6, KEY_CAPSLOCK), | 180 | KEY(15, 6, KEY_CAPSLOCK), |
180 | KEY(15, 7, KEY_F6), | 181 | KEY(15, 7, KEY_F6), |
182 | |||
183 | /* Software Handled Function Keys */ | ||
184 | KEY(20, 0, KEY_KP7), | ||
185 | |||
186 | KEY(21, 0, KEY_KP9), | ||
187 | KEY(21, 1, KEY_KP8), | ||
188 | KEY(21, 2, KEY_KP4), | ||
189 | KEY(21, 4, KEY_KP1), | ||
190 | |||
191 | KEY(22, 1, KEY_KPSLASH), | ||
192 | KEY(22, 2, KEY_KP6), | ||
193 | KEY(22, 3, KEY_KP5), | ||
194 | KEY(22, 4, KEY_KP3), | ||
195 | KEY(22, 5, KEY_KP2), | ||
196 | KEY(22, 7, KEY_KP0), | ||
197 | |||
198 | KEY(27, 1, KEY_KPASTERISK), | ||
199 | KEY(27, 3, KEY_KPMINUS), | ||
200 | KEY(27, 4, KEY_KPPLUS), | ||
201 | KEY(27, 5, KEY_KPDOT), | ||
202 | |||
203 | KEY(28, 5, KEY_VOLUMEUP), | ||
204 | |||
205 | KEY(29, 3, KEY_HOME), | ||
206 | KEY(29, 4, KEY_END), | ||
207 | KEY(29, 5, KEY_BRIGHTNESSDOWN), | ||
208 | KEY(29, 6, KEY_VOLUMEDOWN), | ||
209 | KEY(29, 7, KEY_BRIGHTNESSUP), | ||
210 | |||
211 | KEY(30, 0, KEY_NUMLOCK), | ||
212 | KEY(30, 1, KEY_SCROLLLOCK), | ||
213 | KEY(30, 2, KEY_MUTE), | ||
214 | |||
215 | KEY(31, 4, KEY_HELP), | ||
181 | }; | 216 | }; |
182 | 217 | ||
183 | static const struct matrix_keymap_data tegra_kbc_default_keymap_data = { | 218 | static const struct matrix_keymap_data tegra_kbc_default_keymap_data = { |
@@ -224,6 +259,7 @@ static void tegra_kbc_report_keys(struct tegra_kbc *kbc) | |||
224 | unsigned int i; | 259 | unsigned int i; |
225 | unsigned int num_down = 0; | 260 | unsigned int num_down = 0; |
226 | unsigned long flags; | 261 | unsigned long flags; |
262 | bool fn_keypress = false; | ||
227 | 263 | ||
228 | spin_lock_irqsave(&kbc->lock, flags); | 264 | spin_lock_irqsave(&kbc->lock, flags); |
229 | for (i = 0; i < KBC_MAX_KPENT; i++) { | 265 | for (i = 0; i < KBC_MAX_KPENT; i++) { |
@@ -237,11 +273,28 @@ static void tegra_kbc_report_keys(struct tegra_kbc *kbc) | |||
237 | MATRIX_SCAN_CODE(row, col, KBC_ROW_SHIFT); | 273 | MATRIX_SCAN_CODE(row, col, KBC_ROW_SHIFT); |
238 | 274 | ||
239 | scancodes[num_down] = scancode; | 275 | scancodes[num_down] = scancode; |
240 | keycodes[num_down++] = kbc->keycode[scancode]; | 276 | keycodes[num_down] = kbc->keycode[scancode]; |
277 | /* If driver uses Fn map, do not report the Fn key. */ | ||
278 | if ((keycodes[num_down] == KEY_FN) && kbc->use_fn_map) | ||
279 | fn_keypress = true; | ||
280 | else | ||
281 | num_down++; | ||
241 | } | 282 | } |
242 | 283 | ||
243 | val >>= 8; | 284 | val >>= 8; |
244 | } | 285 | } |
286 | |||
287 | /* | ||
288 | * If the platform uses Fn keymaps, translate keys on a Fn keypress. | ||
289 | * Function keycodes are KBC_MAX_KEY apart from the plain keycodes. | ||
290 | */ | ||
291 | if (fn_keypress) { | ||
292 | for (i = 0; i < num_down; i++) { | ||
293 | scancodes[i] += KBC_MAX_KEY; | ||
294 | keycodes[i] = kbc->keycode[scancodes[i]]; | ||
295 | } | ||
296 | } | ||
297 | |||
245 | spin_unlock_irqrestore(&kbc->lock, flags); | 298 | spin_unlock_irqrestore(&kbc->lock, flags); |
246 | 299 | ||
247 | tegra_kbc_report_released_keys(kbc->idev, | 300 | tegra_kbc_report_released_keys(kbc->idev, |
@@ -594,8 +647,11 @@ static int __devinit tegra_kbc_probe(struct platform_device *pdev) | |||
594 | 647 | ||
595 | input_dev->keycode = kbc->keycode; | 648 | input_dev->keycode = kbc->keycode; |
596 | input_dev->keycodesize = sizeof(kbc->keycode[0]); | 649 | input_dev->keycodesize = sizeof(kbc->keycode[0]); |
597 | input_dev->keycodemax = ARRAY_SIZE(kbc->keycode); | 650 | input_dev->keycodemax = KBC_MAX_KEY; |
651 | if (pdata->use_fn_map) | ||
652 | input_dev->keycodemax *= 2; | ||
598 | 653 | ||
654 | kbc->use_fn_map = pdata->use_fn_map; | ||
599 | keymap_data = pdata->keymap_data ?: &tegra_kbc_default_keymap_data; | 655 | keymap_data = pdata->keymap_data ?: &tegra_kbc_default_keymap_data; |
600 | matrix_keypad_build_keymap(keymap_data, KBC_ROW_SHIFT, | 656 | matrix_keypad_build_keymap(keymap_data, KBC_ROW_SHIFT, |
601 | input_dev->keycode, input_dev->keybit); | 657 | input_dev->keycode, input_dev->keybit); |
diff --git a/drivers/input/mouse/synaptics.h b/drivers/input/mouse/synaptics.h index 25e5d042a72c..7453938bf5ef 100644 --- a/drivers/input/mouse/synaptics.h +++ b/drivers/input/mouse/synaptics.h | |||
@@ -51,6 +51,29 @@ | |||
51 | #define SYN_EXT_CAP_REQUESTS(c) (((c) & 0x700000) >> 20) | 51 | #define SYN_EXT_CAP_REQUESTS(c) (((c) & 0x700000) >> 20) |
52 | #define SYN_CAP_MULTI_BUTTON_NO(ec) (((ec) & 0x00f000) >> 12) | 52 | #define SYN_CAP_MULTI_BUTTON_NO(ec) (((ec) & 0x00f000) >> 12) |
53 | #define SYN_CAP_PRODUCT_ID(ec) (((ec) & 0xff0000) >> 16) | 53 | #define SYN_CAP_PRODUCT_ID(ec) (((ec) & 0xff0000) >> 16) |
54 | |||
55 | /* | ||
56 | * The following describes response for the 0x0c query. | ||
57 | * | ||
58 | * byte mask name meaning | ||
59 | * ---- ---- ------- ------------ | ||
60 | * 1 0x01 adjustable threshold capacitive button sensitivity | ||
61 | * can be adjusted | ||
62 | * 1 0x02 report max query 0x0d gives max coord reported | ||
63 | * 1 0x04 clearpad sensor is ClearPad product | ||
64 | * 1 0x08 advanced gesture not particularly meaningful | ||
65 | * 1 0x10 clickpad bit 0 1-button ClickPad | ||
66 | * 1 0x60 multifinger mode identifies firmware finger counting | ||
67 | * (not reporting!) algorithm. | ||
68 | * Not particularly meaningful | ||
69 | * 1 0x80 covered pad W clipped to 14, 15 == pad mostly covered | ||
70 | * 2 0x01 clickpad bit 1 2-button ClickPad | ||
71 | * 2 0x02 deluxe LED controls touchpad support LED commands | ||
72 | * ala multimedia control bar | ||
73 | * 2 0x04 reduced filtering firmware does less filtering on | ||
74 | * position data, driver should watch | ||
75 | * for noise. | ||
76 | */ | ||
54 | #define SYN_CAP_CLICKPAD(ex0c) ((ex0c) & 0x100000) /* 1-button ClickPad */ | 77 | #define SYN_CAP_CLICKPAD(ex0c) ((ex0c) & 0x100000) /* 1-button ClickPad */ |
55 | #define SYN_CAP_CLICKPAD2BTN(ex0c) ((ex0c) & 0x000100) /* 2-button ClickPad */ | 78 | #define SYN_CAP_CLICKPAD2BTN(ex0c) ((ex0c) & 0x000100) /* 2-button ClickPad */ |
56 | #define SYN_CAP_MAX_DIMENSIONS(ex0c) ((ex0c) & 0x020000) | 79 | #define SYN_CAP_MAX_DIMENSIONS(ex0c) ((ex0c) & 0x020000) |
diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c index 7c38d1fbabf2..ba70058e2be3 100644 --- a/drivers/input/serio/serio.c +++ b/drivers/input/serio/serio.c | |||
@@ -299,7 +299,7 @@ static int serio_queue_event(void *object, struct module *owner, | |||
299 | event->owner = owner; | 299 | event->owner = owner; |
300 | 300 | ||
301 | list_add_tail(&event->node, &serio_event_list); | 301 | list_add_tail(&event->node, &serio_event_list); |
302 | schedule_work(&serio_event_work); | 302 | queue_work(system_long_wq, &serio_event_work); |
303 | 303 | ||
304 | out: | 304 | out: |
305 | spin_unlock_irqrestore(&serio_event_lock, flags); | 305 | spin_unlock_irqrestore(&serio_event_lock, flags); |
diff --git a/drivers/md/linear.c b/drivers/md/linear.c index 38861b5b9d90..338804f8fb3b 100644 --- a/drivers/md/linear.c +++ b/drivers/md/linear.c | |||
@@ -200,7 +200,6 @@ static int linear_run (mddev_t *mddev) | |||
200 | 200 | ||
201 | if (md_check_no_bitmap(mddev)) | 201 | if (md_check_no_bitmap(mddev)) |
202 | return -EINVAL; | 202 | return -EINVAL; |
203 | mddev->queue->queue_lock = &mddev->queue->__queue_lock; | ||
204 | conf = linear_conf(mddev, mddev->raid_disks); | 203 | conf = linear_conf(mddev, mddev->raid_disks); |
205 | 204 | ||
206 | if (!conf) | 205 | if (!conf) |
diff --git a/drivers/md/md.c b/drivers/md/md.c index 28f9c1ee4e3a..86ba66c0b28a 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -553,6 +553,9 @@ static mddev_t * mddev_find(dev_t unit) | |||
553 | { | 553 | { |
554 | mddev_t *mddev, *new = NULL; | 554 | mddev_t *mddev, *new = NULL; |
555 | 555 | ||
556 | if (unit && MAJOR(unit) != MD_MAJOR) | ||
557 | unit &= ~((1<<MdpMinorShift)-1); | ||
558 | |||
556 | retry: | 559 | retry: |
557 | spin_lock(&all_mddevs_lock); | 560 | spin_lock(&all_mddevs_lock); |
558 | 561 | ||
@@ -4137,10 +4140,10 @@ array_size_store(mddev_t *mddev, const char *buf, size_t len) | |||
4137 | } | 4140 | } |
4138 | 4141 | ||
4139 | mddev->array_sectors = sectors; | 4142 | mddev->array_sectors = sectors; |
4140 | set_capacity(mddev->gendisk, mddev->array_sectors); | 4143 | if (mddev->pers) { |
4141 | if (mddev->pers) | 4144 | set_capacity(mddev->gendisk, mddev->array_sectors); |
4142 | revalidate_disk(mddev->gendisk); | 4145 | revalidate_disk(mddev->gendisk); |
4143 | 4146 | } | |
4144 | return len; | 4147 | return len; |
4145 | } | 4148 | } |
4146 | 4149 | ||
@@ -4623,6 +4626,7 @@ static int do_md_run(mddev_t *mddev) | |||
4623 | } | 4626 | } |
4624 | set_capacity(mddev->gendisk, mddev->array_sectors); | 4627 | set_capacity(mddev->gendisk, mddev->array_sectors); |
4625 | revalidate_disk(mddev->gendisk); | 4628 | revalidate_disk(mddev->gendisk); |
4629 | mddev->changed = 1; | ||
4626 | kobject_uevent(&disk_to_dev(mddev->gendisk)->kobj, KOBJ_CHANGE); | 4630 | kobject_uevent(&disk_to_dev(mddev->gendisk)->kobj, KOBJ_CHANGE); |
4627 | out: | 4631 | out: |
4628 | return err; | 4632 | return err; |
@@ -4711,6 +4715,7 @@ static void md_clean(mddev_t *mddev) | |||
4711 | mddev->sync_speed_min = mddev->sync_speed_max = 0; | 4715 | mddev->sync_speed_min = mddev->sync_speed_max = 0; |
4712 | mddev->recovery = 0; | 4716 | mddev->recovery = 0; |
4713 | mddev->in_sync = 0; | 4717 | mddev->in_sync = 0; |
4718 | mddev->changed = 0; | ||
4714 | mddev->degraded = 0; | 4719 | mddev->degraded = 0; |
4715 | mddev->safemode = 0; | 4720 | mddev->safemode = 0; |
4716 | mddev->bitmap_info.offset = 0; | 4721 | mddev->bitmap_info.offset = 0; |
@@ -4825,6 +4830,7 @@ static int do_md_stop(mddev_t * mddev, int mode, int is_open) | |||
4825 | 4830 | ||
4826 | set_capacity(disk, 0); | 4831 | set_capacity(disk, 0); |
4827 | mutex_unlock(&mddev->open_mutex); | 4832 | mutex_unlock(&mddev->open_mutex); |
4833 | mddev->changed = 1; | ||
4828 | revalidate_disk(disk); | 4834 | revalidate_disk(disk); |
4829 | 4835 | ||
4830 | if (mddev->ro) | 4836 | if (mddev->ro) |
@@ -6009,7 +6015,7 @@ static int md_open(struct block_device *bdev, fmode_t mode) | |||
6009 | atomic_inc(&mddev->openers); | 6015 | atomic_inc(&mddev->openers); |
6010 | mutex_unlock(&mddev->open_mutex); | 6016 | mutex_unlock(&mddev->open_mutex); |
6011 | 6017 | ||
6012 | check_disk_size_change(mddev->gendisk, bdev); | 6018 | check_disk_change(bdev); |
6013 | out: | 6019 | out: |
6014 | return err; | 6020 | return err; |
6015 | } | 6021 | } |
@@ -6024,6 +6030,21 @@ static int md_release(struct gendisk *disk, fmode_t mode) | |||
6024 | 6030 | ||
6025 | return 0; | 6031 | return 0; |
6026 | } | 6032 | } |
6033 | |||
6034 | static int md_media_changed(struct gendisk *disk) | ||
6035 | { | ||
6036 | mddev_t *mddev = disk->private_data; | ||
6037 | |||
6038 | return mddev->changed; | ||
6039 | } | ||
6040 | |||
6041 | static int md_revalidate(struct gendisk *disk) | ||
6042 | { | ||
6043 | mddev_t *mddev = disk->private_data; | ||
6044 | |||
6045 | mddev->changed = 0; | ||
6046 | return 0; | ||
6047 | } | ||
6027 | static const struct block_device_operations md_fops = | 6048 | static const struct block_device_operations md_fops = |
6028 | { | 6049 | { |
6029 | .owner = THIS_MODULE, | 6050 | .owner = THIS_MODULE, |
@@ -6034,6 +6055,8 @@ static const struct block_device_operations md_fops = | |||
6034 | .compat_ioctl = md_compat_ioctl, | 6055 | .compat_ioctl = md_compat_ioctl, |
6035 | #endif | 6056 | #endif |
6036 | .getgeo = md_getgeo, | 6057 | .getgeo = md_getgeo, |
6058 | .media_changed = md_media_changed, | ||
6059 | .revalidate_disk= md_revalidate, | ||
6037 | }; | 6060 | }; |
6038 | 6061 | ||
6039 | static int md_thread(void * arg) | 6062 | static int md_thread(void * arg) |
diff --git a/drivers/md/md.h b/drivers/md/md.h index 7e90b8593b2a..12215d437fcc 100644 --- a/drivers/md/md.h +++ b/drivers/md/md.h | |||
@@ -274,6 +274,8 @@ struct mddev_s | |||
274 | atomic_t active; /* general refcount */ | 274 | atomic_t active; /* general refcount */ |
275 | atomic_t openers; /* number of active opens */ | 275 | atomic_t openers; /* number of active opens */ |
276 | 276 | ||
277 | int changed; /* True if we might need to | ||
278 | * reread partition info */ | ||
277 | int degraded; /* whether md should consider | 279 | int degraded; /* whether md should consider |
278 | * adding a spare | 280 | * adding a spare |
279 | */ | 281 | */ |
diff --git a/drivers/md/multipath.c b/drivers/md/multipath.c index 1cc8ed44e4ad..5e694b151c30 100644 --- a/drivers/md/multipath.c +++ b/drivers/md/multipath.c | |||
@@ -405,7 +405,6 @@ static int multipath_run (mddev_t *mddev) | |||
405 | * bookkeeping area. [whatever we allocate in multipath_run(), | 405 | * bookkeeping area. [whatever we allocate in multipath_run(), |
406 | * should be freed in multipath_stop()] | 406 | * should be freed in multipath_stop()] |
407 | */ | 407 | */ |
408 | mddev->queue->queue_lock = &mddev->queue->__queue_lock; | ||
409 | 408 | ||
410 | conf = kzalloc(sizeof(multipath_conf_t), GFP_KERNEL); | 409 | conf = kzalloc(sizeof(multipath_conf_t), GFP_KERNEL); |
411 | mddev->private = conf; | 410 | mddev->private = conf; |
diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c index 6338c0fe6208..95916fd6394a 100644 --- a/drivers/md/raid0.c +++ b/drivers/md/raid0.c | |||
@@ -345,7 +345,6 @@ static int raid0_run(mddev_t *mddev) | |||
345 | if (md_check_no_bitmap(mddev)) | 345 | if (md_check_no_bitmap(mddev)) |
346 | return -EINVAL; | 346 | return -EINVAL; |
347 | blk_queue_max_hw_sectors(mddev->queue, mddev->chunk_sectors); | 347 | blk_queue_max_hw_sectors(mddev->queue, mddev->chunk_sectors); |
348 | mddev->queue->queue_lock = &mddev->queue->__queue_lock; | ||
349 | 348 | ||
350 | /* if private is not null, we are here after takeover */ | 349 | /* if private is not null, we are here after takeover */ |
351 | if (mddev->private == NULL) { | 350 | if (mddev->private == NULL) { |
@@ -654,6 +653,7 @@ static void *raid0_takeover_raid1(mddev_t *mddev) | |||
654 | mddev->new_layout = 0; | 653 | mddev->new_layout = 0; |
655 | mddev->new_chunk_sectors = 128; /* by default set chunk size to 64k */ | 654 | mddev->new_chunk_sectors = 128; /* by default set chunk size to 64k */ |
656 | mddev->delta_disks = 1 - mddev->raid_disks; | 655 | mddev->delta_disks = 1 - mddev->raid_disks; |
656 | mddev->raid_disks = 1; | ||
657 | /* make sure it will be not marked as dirty */ | 657 | /* make sure it will be not marked as dirty */ |
658 | mddev->recovery_cp = MaxSector; | 658 | mddev->recovery_cp = MaxSector; |
659 | 659 | ||
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index b67d822d57ae..8f34ad5c478b 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -1973,7 +1973,6 @@ static int run(mddev_t *mddev) | |||
1973 | if (IS_ERR(conf)) | 1973 | if (IS_ERR(conf)) |
1974 | return PTR_ERR(conf); | 1974 | return PTR_ERR(conf); |
1975 | 1975 | ||
1976 | mddev->queue->queue_lock = &conf->device_lock; | ||
1977 | list_for_each_entry(rdev, &mddev->disks, same_set) { | 1976 | list_for_each_entry(rdev, &mddev->disks, same_set) { |
1978 | disk_stack_limits(mddev->gendisk, rdev->bdev, | 1977 | disk_stack_limits(mddev->gendisk, rdev->bdev, |
1979 | rdev->data_offset << 9); | 1978 | rdev->data_offset << 9); |
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index e79f1c5bf71b..c0d0f5f7e407 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
@@ -2256,8 +2256,6 @@ static int run(mddev_t *mddev) | |||
2256 | if (!conf) | 2256 | if (!conf) |
2257 | goto out; | 2257 | goto out; |
2258 | 2258 | ||
2259 | mddev->queue->queue_lock = &conf->device_lock; | ||
2260 | |||
2261 | mddev->thread = conf->thread; | 2259 | mddev->thread = conf->thread; |
2262 | conf->thread = NULL; | 2260 | conf->thread = NULL; |
2263 | 2261 | ||
diff --git a/drivers/message/i2o/i2o_block.c b/drivers/message/i2o/i2o_block.c index b29eb4eaa86e..47ec5bc0ed21 100644 --- a/drivers/message/i2o/i2o_block.c +++ b/drivers/message/i2o/i2o_block.c | |||
@@ -695,20 +695,22 @@ static int i2o_block_ioctl(struct block_device *bdev, fmode_t mode, | |||
695 | }; | 695 | }; |
696 | 696 | ||
697 | /** | 697 | /** |
698 | * i2o_block_media_changed - Have we seen a media change? | 698 | * i2o_block_check_events - Have we seen a media change? |
699 | * @disk: gendisk which should be verified | 699 | * @disk: gendisk which should be verified |
700 | * @clearing: events being cleared | ||
700 | * | 701 | * |
701 | * Verifies if the media has changed. | 702 | * Verifies if the media has changed. |
702 | * | 703 | * |
703 | * Returns 1 if the media was changed or 0 otherwise. | 704 | * Returns 1 if the media was changed or 0 otherwise. |
704 | */ | 705 | */ |
705 | static int i2o_block_media_changed(struct gendisk *disk) | 706 | static unsigned int i2o_block_check_events(struct gendisk *disk, |
707 | unsigned int clearing) | ||
706 | { | 708 | { |
707 | struct i2o_block_device *p = disk->private_data; | 709 | struct i2o_block_device *p = disk->private_data; |
708 | 710 | ||
709 | if (p->media_change_flag) { | 711 | if (p->media_change_flag) { |
710 | p->media_change_flag = 0; | 712 | p->media_change_flag = 0; |
711 | return 1; | 713 | return DISK_EVENT_MEDIA_CHANGE; |
712 | } | 714 | } |
713 | return 0; | 715 | return 0; |
714 | } | 716 | } |
@@ -946,7 +948,7 @@ static const struct block_device_operations i2o_block_fops = { | |||
946 | .ioctl = i2o_block_ioctl, | 948 | .ioctl = i2o_block_ioctl, |
947 | .compat_ioctl = i2o_block_ioctl, | 949 | .compat_ioctl = i2o_block_ioctl, |
948 | .getgeo = i2o_block_getgeo, | 950 | .getgeo = i2o_block_getgeo, |
949 | .media_changed = i2o_block_media_changed | 951 | .check_events = i2o_block_check_events, |
950 | }; | 952 | }; |
951 | 953 | ||
952 | /** | 954 | /** |
@@ -998,6 +1000,7 @@ static struct i2o_block_device *i2o_block_device_alloc(void) | |||
998 | gd->major = I2O_MAJOR; | 1000 | gd->major = I2O_MAJOR; |
999 | gd->queue = queue; | 1001 | gd->queue = queue; |
1000 | gd->fops = &i2o_block_fops; | 1002 | gd->fops = &i2o_block_fops; |
1003 | gd->events = DISK_EVENT_MEDIA_CHANGE; | ||
1001 | gd->private_data = dev; | 1004 | gd->private_data = dev; |
1002 | 1005 | ||
1003 | dev->gd = gd; | 1006 | dev->gd = gd; |
diff --git a/drivers/net/dm9000.c b/drivers/net/dm9000.c index 2d4c4fc1d900..461dd6f905f7 100644 --- a/drivers/net/dm9000.c +++ b/drivers/net/dm9000.c | |||
@@ -802,10 +802,7 @@ dm9000_init_dm9000(struct net_device *dev) | |||
802 | /* Checksum mode */ | 802 | /* Checksum mode */ |
803 | dm9000_set_rx_csum_unlocked(dev, db->rx_csum); | 803 | dm9000_set_rx_csum_unlocked(dev, db->rx_csum); |
804 | 804 | ||
805 | /* GPIO0 on pre-activate PHY */ | ||
806 | iow(db, DM9000_GPR, 0); /* REG_1F bit0 activate phyxcer */ | ||
807 | iow(db, DM9000_GPCR, GPCR_GEP_CNTL); /* Let GPIO0 output */ | 805 | iow(db, DM9000_GPCR, GPCR_GEP_CNTL); /* Let GPIO0 output */ |
808 | iow(db, DM9000_GPR, 0); /* Enable PHY */ | ||
809 | 806 | ||
810 | ncr = (db->flags & DM9000_PLATF_EXT_PHY) ? NCR_EXT_PHY : 0; | 807 | ncr = (db->flags & DM9000_PLATF_EXT_PHY) ? NCR_EXT_PHY : 0; |
811 | 808 | ||
@@ -852,8 +849,8 @@ static void dm9000_timeout(struct net_device *dev) | |||
852 | unsigned long flags; | 849 | unsigned long flags; |
853 | 850 | ||
854 | /* Save previous register address */ | 851 | /* Save previous register address */ |
855 | reg_save = readb(db->io_addr); | ||
856 | spin_lock_irqsave(&db->lock, flags); | 852 | spin_lock_irqsave(&db->lock, flags); |
853 | reg_save = readb(db->io_addr); | ||
857 | 854 | ||
858 | netif_stop_queue(dev); | 855 | netif_stop_queue(dev); |
859 | dm9000_reset(db); | 856 | dm9000_reset(db); |
@@ -1194,6 +1191,10 @@ dm9000_open(struct net_device *dev) | |||
1194 | if (request_irq(dev->irq, dm9000_interrupt, irqflags, dev->name, dev)) | 1191 | if (request_irq(dev->irq, dm9000_interrupt, irqflags, dev->name, dev)) |
1195 | return -EAGAIN; | 1192 | return -EAGAIN; |
1196 | 1193 | ||
1194 | /* GPIO0 on pre-activate PHY, Reg 1F is not set by reset */ | ||
1195 | iow(db, DM9000_GPR, 0); /* REG_1F bit0 activate phyxcer */ | ||
1196 | mdelay(1); /* delay needs by DM9000B */ | ||
1197 | |||
1197 | /* Initialize DM9000 board */ | 1198 | /* Initialize DM9000 board */ |
1198 | dm9000_reset(db); | 1199 | dm9000_reset(db); |
1199 | dm9000_init_dm9000(dev); | 1200 | dm9000_init_dm9000(dev); |
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c index 469ab0b7ce31..ef2133b16f8c 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c | |||
@@ -617,8 +617,9 @@ static void ocp_write(struct rtl8169_private *tp, u8 mask, u16 reg, u32 data) | |||
617 | } | 617 | } |
618 | } | 618 | } |
619 | 619 | ||
620 | static void rtl8168_oob_notify(void __iomem *ioaddr, u8 cmd) | 620 | static void rtl8168_oob_notify(struct rtl8169_private *tp, u8 cmd) |
621 | { | 621 | { |
622 | void __iomem *ioaddr = tp->mmio_addr; | ||
622 | int i; | 623 | int i; |
623 | 624 | ||
624 | RTL_W8(ERIDR, cmd); | 625 | RTL_W8(ERIDR, cmd); |
@@ -630,7 +631,7 @@ static void rtl8168_oob_notify(void __iomem *ioaddr, u8 cmd) | |||
630 | break; | 631 | break; |
631 | } | 632 | } |
632 | 633 | ||
633 | ocp_write(ioaddr, 0x1, 0x30, 0x00000001); | 634 | ocp_write(tp, 0x1, 0x30, 0x00000001); |
634 | } | 635 | } |
635 | 636 | ||
636 | #define OOB_CMD_RESET 0x00 | 637 | #define OOB_CMD_RESET 0x00 |
@@ -2868,8 +2869,11 @@ static void r8168_pll_power_down(struct rtl8169_private *tp) | |||
2868 | { | 2869 | { |
2869 | void __iomem *ioaddr = tp->mmio_addr; | 2870 | void __iomem *ioaddr = tp->mmio_addr; |
2870 | 2871 | ||
2871 | if (tp->mac_version == RTL_GIGA_MAC_VER_27) | 2872 | if (((tp->mac_version == RTL_GIGA_MAC_VER_27) || |
2873 | (tp->mac_version == RTL_GIGA_MAC_VER_28)) && | ||
2874 | (ocp_read(tp, 0x0f, 0x0010) & 0x00008000)) { | ||
2872 | return; | 2875 | return; |
2876 | } | ||
2873 | 2877 | ||
2874 | if (((tp->mac_version == RTL_GIGA_MAC_VER_23) || | 2878 | if (((tp->mac_version == RTL_GIGA_MAC_VER_23) || |
2875 | (tp->mac_version == RTL_GIGA_MAC_VER_24)) && | 2879 | (tp->mac_version == RTL_GIGA_MAC_VER_24)) && |
@@ -2891,6 +2895,8 @@ static void r8168_pll_power_down(struct rtl8169_private *tp) | |||
2891 | switch (tp->mac_version) { | 2895 | switch (tp->mac_version) { |
2892 | case RTL_GIGA_MAC_VER_25: | 2896 | case RTL_GIGA_MAC_VER_25: |
2893 | case RTL_GIGA_MAC_VER_26: | 2897 | case RTL_GIGA_MAC_VER_26: |
2898 | case RTL_GIGA_MAC_VER_27: | ||
2899 | case RTL_GIGA_MAC_VER_28: | ||
2894 | RTL_W8(PMCH, RTL_R8(PMCH) & ~0x80); | 2900 | RTL_W8(PMCH, RTL_R8(PMCH) & ~0x80); |
2895 | break; | 2901 | break; |
2896 | } | 2902 | } |
@@ -2900,12 +2906,17 @@ static void r8168_pll_power_up(struct rtl8169_private *tp) | |||
2900 | { | 2906 | { |
2901 | void __iomem *ioaddr = tp->mmio_addr; | 2907 | void __iomem *ioaddr = tp->mmio_addr; |
2902 | 2908 | ||
2903 | if (tp->mac_version == RTL_GIGA_MAC_VER_27) | 2909 | if (((tp->mac_version == RTL_GIGA_MAC_VER_27) || |
2910 | (tp->mac_version == RTL_GIGA_MAC_VER_28)) && | ||
2911 | (ocp_read(tp, 0x0f, 0x0010) & 0x00008000)) { | ||
2904 | return; | 2912 | return; |
2913 | } | ||
2905 | 2914 | ||
2906 | switch (tp->mac_version) { | 2915 | switch (tp->mac_version) { |
2907 | case RTL_GIGA_MAC_VER_25: | 2916 | case RTL_GIGA_MAC_VER_25: |
2908 | case RTL_GIGA_MAC_VER_26: | 2917 | case RTL_GIGA_MAC_VER_26: |
2918 | case RTL_GIGA_MAC_VER_27: | ||
2919 | case RTL_GIGA_MAC_VER_28: | ||
2909 | RTL_W8(PMCH, RTL_R8(PMCH) | 0x80); | 2920 | RTL_W8(PMCH, RTL_R8(PMCH) | 0x80); |
2910 | break; | 2921 | break; |
2911 | } | 2922 | } |
@@ -3042,7 +3053,7 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
3042 | goto err_out_mwi_2; | 3053 | goto err_out_mwi_2; |
3043 | } | 3054 | } |
3044 | 3055 | ||
3045 | tp->cp_cmd = PCIMulRW | RxChkSum; | 3056 | tp->cp_cmd = RxChkSum; |
3046 | 3057 | ||
3047 | if ((sizeof(dma_addr_t) > 4) && | 3058 | if ((sizeof(dma_addr_t) > 4) && |
3048 | !pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) && use_dac) { | 3059 | !pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) && use_dac) { |
@@ -3318,7 +3329,8 @@ static void rtl8169_hw_reset(struct rtl8169_private *tp) | |||
3318 | /* Disable interrupts */ | 3329 | /* Disable interrupts */ |
3319 | rtl8169_irq_mask_and_ack(ioaddr); | 3330 | rtl8169_irq_mask_and_ack(ioaddr); |
3320 | 3331 | ||
3321 | if (tp->mac_version == RTL_GIGA_MAC_VER_28) { | 3332 | if (tp->mac_version == RTL_GIGA_MAC_VER_27 || |
3333 | tp->mac_version == RTL_GIGA_MAC_VER_28) { | ||
3322 | while (RTL_R8(TxPoll) & NPQ) | 3334 | while (RTL_R8(TxPoll) & NPQ) |
3323 | udelay(20); | 3335 | udelay(20); |
3324 | 3336 | ||
@@ -3847,8 +3859,7 @@ static void rtl_hw_start_8168(struct net_device *dev) | |||
3847 | Cxpl_dbg_sel | \ | 3859 | Cxpl_dbg_sel | \ |
3848 | ASF | \ | 3860 | ASF | \ |
3849 | PktCntrDisable | \ | 3861 | PktCntrDisable | \ |
3850 | PCIDAC | \ | 3862 | Mac_dbgo_sel) |
3851 | PCIMulRW) | ||
3852 | 3863 | ||
3853 | static void rtl_hw_start_8102e_1(void __iomem *ioaddr, struct pci_dev *pdev) | 3864 | static void rtl_hw_start_8102e_1(void __iomem *ioaddr, struct pci_dev *pdev) |
3854 | { | 3865 | { |
@@ -3878,8 +3889,6 @@ static void rtl_hw_start_8102e_1(void __iomem *ioaddr, struct pci_dev *pdev) | |||
3878 | if ((cfg1 & LEDS0) && (cfg1 & LEDS1)) | 3889 | if ((cfg1 & LEDS0) && (cfg1 & LEDS1)) |
3879 | RTL_W8(Config1, cfg1 & ~LEDS0); | 3890 | RTL_W8(Config1, cfg1 & ~LEDS0); |
3880 | 3891 | ||
3881 | RTL_W16(CPlusCmd, RTL_R16(CPlusCmd) & ~R810X_CPCMD_QUIRK_MASK); | ||
3882 | |||
3883 | rtl_ephy_init(ioaddr, e_info_8102e_1, ARRAY_SIZE(e_info_8102e_1)); | 3892 | rtl_ephy_init(ioaddr, e_info_8102e_1, ARRAY_SIZE(e_info_8102e_1)); |
3884 | } | 3893 | } |
3885 | 3894 | ||
@@ -3891,8 +3900,6 @@ static void rtl_hw_start_8102e_2(void __iomem *ioaddr, struct pci_dev *pdev) | |||
3891 | 3900 | ||
3892 | RTL_W8(Config1, MEMMAP | IOMAP | VPD | PMEnable); | 3901 | RTL_W8(Config1, MEMMAP | IOMAP | VPD | PMEnable); |
3893 | RTL_W8(Config3, RTL_R8(Config3) & ~Beacon_en); | 3902 | RTL_W8(Config3, RTL_R8(Config3) & ~Beacon_en); |
3894 | |||
3895 | RTL_W16(CPlusCmd, RTL_R16(CPlusCmd) & ~R810X_CPCMD_QUIRK_MASK); | ||
3896 | } | 3903 | } |
3897 | 3904 | ||
3898 | static void rtl_hw_start_8102e_3(void __iomem *ioaddr, struct pci_dev *pdev) | 3905 | static void rtl_hw_start_8102e_3(void __iomem *ioaddr, struct pci_dev *pdev) |
@@ -3918,6 +3925,8 @@ static void rtl_hw_start_8101(struct net_device *dev) | |||
3918 | } | 3925 | } |
3919 | } | 3926 | } |
3920 | 3927 | ||
3928 | RTL_W8(Cfg9346, Cfg9346_Unlock); | ||
3929 | |||
3921 | switch (tp->mac_version) { | 3930 | switch (tp->mac_version) { |
3922 | case RTL_GIGA_MAC_VER_07: | 3931 | case RTL_GIGA_MAC_VER_07: |
3923 | rtl_hw_start_8102e_1(ioaddr, pdev); | 3932 | rtl_hw_start_8102e_1(ioaddr, pdev); |
@@ -3932,14 +3941,13 @@ static void rtl_hw_start_8101(struct net_device *dev) | |||
3932 | break; | 3941 | break; |
3933 | } | 3942 | } |
3934 | 3943 | ||
3935 | RTL_W8(Cfg9346, Cfg9346_Unlock); | 3944 | RTL_W8(Cfg9346, Cfg9346_Lock); |
3936 | 3945 | ||
3937 | RTL_W8(MaxTxPacketSize, TxPacketMax); | 3946 | RTL_W8(MaxTxPacketSize, TxPacketMax); |
3938 | 3947 | ||
3939 | rtl_set_rx_max_size(ioaddr, rx_buf_sz); | 3948 | rtl_set_rx_max_size(ioaddr, rx_buf_sz); |
3940 | 3949 | ||
3941 | tp->cp_cmd |= rtl_rw_cpluscmd(ioaddr) | PCIMulRW; | 3950 | tp->cp_cmd &= ~R810X_CPCMD_QUIRK_MASK; |
3942 | |||
3943 | RTL_W16(CPlusCmd, tp->cp_cmd); | 3951 | RTL_W16(CPlusCmd, tp->cp_cmd); |
3944 | 3952 | ||
3945 | RTL_W16(IntrMitigate, 0x0000); | 3953 | RTL_W16(IntrMitigate, 0x0000); |
@@ -3949,14 +3957,10 @@ static void rtl_hw_start_8101(struct net_device *dev) | |||
3949 | RTL_W8(ChipCmd, CmdTxEnb | CmdRxEnb); | 3957 | RTL_W8(ChipCmd, CmdTxEnb | CmdRxEnb); |
3950 | rtl_set_rx_tx_config_registers(tp); | 3958 | rtl_set_rx_tx_config_registers(tp); |
3951 | 3959 | ||
3952 | RTL_W8(Cfg9346, Cfg9346_Lock); | ||
3953 | |||
3954 | RTL_R8(IntrMask); | 3960 | RTL_R8(IntrMask); |
3955 | 3961 | ||
3956 | rtl_set_rx_mode(dev); | 3962 | rtl_set_rx_mode(dev); |
3957 | 3963 | ||
3958 | RTL_W8(ChipCmd, CmdTxEnb | CmdRxEnb); | ||
3959 | |||
3960 | RTL_W16(MultiIntr, RTL_R16(MultiIntr) & 0xf000); | 3964 | RTL_W16(MultiIntr, RTL_R16(MultiIntr) & 0xf000); |
3961 | 3965 | ||
3962 | RTL_W16(IntrMask, tp->intr_event); | 3966 | RTL_W16(IntrMask, tp->intr_event); |
diff --git a/drivers/net/sfc/ethtool.c b/drivers/net/sfc/ethtool.c index 0e8bb19ed60d..ca886d98bdc7 100644 --- a/drivers/net/sfc/ethtool.c +++ b/drivers/net/sfc/ethtool.c | |||
@@ -569,9 +569,14 @@ static void efx_ethtool_self_test(struct net_device *net_dev, | |||
569 | struct ethtool_test *test, u64 *data) | 569 | struct ethtool_test *test, u64 *data) |
570 | { | 570 | { |
571 | struct efx_nic *efx = netdev_priv(net_dev); | 571 | struct efx_nic *efx = netdev_priv(net_dev); |
572 | struct efx_self_tests efx_tests; | 572 | struct efx_self_tests *efx_tests; |
573 | int already_up; | 573 | int already_up; |
574 | int rc; | 574 | int rc = -ENOMEM; |
575 | |||
576 | efx_tests = kzalloc(sizeof(*efx_tests), GFP_KERNEL); | ||
577 | if (!efx_tests) | ||
578 | goto fail; | ||
579 | |||
575 | 580 | ||
576 | ASSERT_RTNL(); | 581 | ASSERT_RTNL(); |
577 | if (efx->state != STATE_RUNNING) { | 582 | if (efx->state != STATE_RUNNING) { |
@@ -589,13 +594,11 @@ static void efx_ethtool_self_test(struct net_device *net_dev, | |||
589 | if (rc) { | 594 | if (rc) { |
590 | netif_err(efx, drv, efx->net_dev, | 595 | netif_err(efx, drv, efx->net_dev, |
591 | "failed opening device.\n"); | 596 | "failed opening device.\n"); |
592 | goto fail2; | 597 | goto fail1; |
593 | } | 598 | } |
594 | } | 599 | } |
595 | 600 | ||
596 | memset(&efx_tests, 0, sizeof(efx_tests)); | 601 | rc = efx_selftest(efx, efx_tests, test->flags); |
597 | |||
598 | rc = efx_selftest(efx, &efx_tests, test->flags); | ||
599 | 602 | ||
600 | if (!already_up) | 603 | if (!already_up) |
601 | dev_close(efx->net_dev); | 604 | dev_close(efx->net_dev); |
@@ -604,10 +607,11 @@ static void efx_ethtool_self_test(struct net_device *net_dev, | |||
604 | rc == 0 ? "passed" : "failed", | 607 | rc == 0 ? "passed" : "failed", |
605 | (test->flags & ETH_TEST_FL_OFFLINE) ? "off" : "on"); | 608 | (test->flags & ETH_TEST_FL_OFFLINE) ? "off" : "on"); |
606 | 609 | ||
607 | fail2: | 610 | fail1: |
608 | fail1: | ||
609 | /* Fill ethtool results structures */ | 611 | /* Fill ethtool results structures */ |
610 | efx_ethtool_fill_self_tests(efx, &efx_tests, NULL, data); | 612 | efx_ethtool_fill_self_tests(efx, efx_tests, NULL, data); |
613 | kfree(efx_tests); | ||
614 | fail: | ||
611 | if (rc) | 615 | if (rc) |
612 | test->flags |= ETH_TEST_FL_FAILED; | 616 | test->flags |= ETH_TEST_FL_FAILED; |
613 | } | 617 | } |
diff --git a/drivers/net/usb/dm9601.c b/drivers/net/usb/dm9601.c index 02b622e3b9fb..5002f5be47be 100644 --- a/drivers/net/usb/dm9601.c +++ b/drivers/net/usb/dm9601.c | |||
@@ -651,6 +651,10 @@ static const struct usb_device_id products[] = { | |||
651 | .driver_info = (unsigned long)&dm9601_info, | 651 | .driver_info = (unsigned long)&dm9601_info, |
652 | }, | 652 | }, |
653 | { | 653 | { |
654 | USB_DEVICE(0x0fe6, 0x9700), /* DM9601 USB to Fast Ethernet Adapter */ | ||
655 | .driver_info = (unsigned long)&dm9601_info, | ||
656 | }, | ||
657 | { | ||
654 | USB_DEVICE(0x0a46, 0x9000), /* DM9000E */ | 658 | USB_DEVICE(0x0a46, 0x9000), /* DM9000E */ |
655 | .driver_info = (unsigned long)&dm9601_info, | 659 | .driver_info = (unsigned long)&dm9601_info, |
656 | }, | 660 | }, |
diff --git a/drivers/net/wireless/ath/ath5k/phy.c b/drivers/net/wireless/ath/ath5k/phy.c index 78c26fdccad1..62ce2f4e8605 100644 --- a/drivers/net/wireless/ath/ath5k/phy.c +++ b/drivers/net/wireless/ath/ath5k/phy.c | |||
@@ -282,6 +282,34 @@ int ath5k_hw_phy_disable(struct ath5k_hw *ah) | |||
282 | return 0; | 282 | return 0; |
283 | } | 283 | } |
284 | 284 | ||
285 | /* | ||
286 | * Wait for synth to settle | ||
287 | */ | ||
288 | static void ath5k_hw_wait_for_synth(struct ath5k_hw *ah, | ||
289 | struct ieee80211_channel *channel) | ||
290 | { | ||
291 | /* | ||
292 | * On 5211+ read activation -> rx delay | ||
293 | * and use it (100ns steps). | ||
294 | */ | ||
295 | if (ah->ah_version != AR5K_AR5210) { | ||
296 | u32 delay; | ||
297 | delay = ath5k_hw_reg_read(ah, AR5K_PHY_RX_DELAY) & | ||
298 | AR5K_PHY_RX_DELAY_M; | ||
299 | delay = (channel->hw_value & CHANNEL_CCK) ? | ||
300 | ((delay << 2) / 22) : (delay / 10); | ||
301 | if (ah->ah_bwmode == AR5K_BWMODE_10MHZ) | ||
302 | delay = delay << 1; | ||
303 | if (ah->ah_bwmode == AR5K_BWMODE_5MHZ) | ||
304 | delay = delay << 2; | ||
305 | /* XXX: /2 on turbo ? Let's be safe | ||
306 | * for now */ | ||
307 | udelay(100 + delay); | ||
308 | } else { | ||
309 | mdelay(1); | ||
310 | } | ||
311 | } | ||
312 | |||
285 | 313 | ||
286 | /**********************\ | 314 | /**********************\ |
287 | * RF Gain optimization * | 315 | * RF Gain optimization * |
@@ -1253,6 +1281,7 @@ static int ath5k_hw_channel(struct ath5k_hw *ah, | |||
1253 | case AR5K_RF5111: | 1281 | case AR5K_RF5111: |
1254 | ret = ath5k_hw_rf5111_channel(ah, channel); | 1282 | ret = ath5k_hw_rf5111_channel(ah, channel); |
1255 | break; | 1283 | break; |
1284 | case AR5K_RF2317: | ||
1256 | case AR5K_RF2425: | 1285 | case AR5K_RF2425: |
1257 | ret = ath5k_hw_rf2425_channel(ah, channel); | 1286 | ret = ath5k_hw_rf2425_channel(ah, channel); |
1258 | break; | 1287 | break; |
@@ -3237,6 +3266,13 @@ int ath5k_hw_phy_init(struct ath5k_hw *ah, struct ieee80211_channel *channel, | |||
3237 | /* Failed */ | 3266 | /* Failed */ |
3238 | if (i >= 100) | 3267 | if (i >= 100) |
3239 | return -EIO; | 3268 | return -EIO; |
3269 | |||
3270 | /* Set channel and wait for synth */ | ||
3271 | ret = ath5k_hw_channel(ah, channel); | ||
3272 | if (ret) | ||
3273 | return ret; | ||
3274 | |||
3275 | ath5k_hw_wait_for_synth(ah, channel); | ||
3240 | } | 3276 | } |
3241 | 3277 | ||
3242 | /* | 3278 | /* |
@@ -3251,13 +3287,53 @@ int ath5k_hw_phy_init(struct ath5k_hw *ah, struct ieee80211_channel *channel, | |||
3251 | if (ret) | 3287 | if (ret) |
3252 | return ret; | 3288 | return ret; |
3253 | 3289 | ||
3290 | /* Write OFDM timings on 5212*/ | ||
3291 | if (ah->ah_version == AR5K_AR5212 && | ||
3292 | channel->hw_value & CHANNEL_OFDM) { | ||
3293 | |||
3294 | ret = ath5k_hw_write_ofdm_timings(ah, channel); | ||
3295 | if (ret) | ||
3296 | return ret; | ||
3297 | |||
3298 | /* Spur info is available only from EEPROM versions | ||
3299 | * greater than 5.3, but the EEPROM routines will use | ||
3300 | * static values for older versions */ | ||
3301 | if (ah->ah_mac_srev >= AR5K_SREV_AR5424) | ||
3302 | ath5k_hw_set_spur_mitigation_filter(ah, | ||
3303 | channel); | ||
3304 | } | ||
3305 | |||
3306 | /* If we used fast channel switching | ||
3307 | * we are done, release RF bus and | ||
3308 | * fire up NF calibration. | ||
3309 | * | ||
3310 | * Note: Only NF calibration due to | ||
3311 | * channel change, not AGC calibration | ||
3312 | * since AGC is still running ! | ||
3313 | */ | ||
3314 | if (fast) { | ||
3315 | /* | ||
3316 | * Release RF Bus grant | ||
3317 | */ | ||
3318 | AR5K_REG_DISABLE_BITS(ah, AR5K_PHY_RFBUS_REQ, | ||
3319 | AR5K_PHY_RFBUS_REQ_REQUEST); | ||
3320 | |||
3321 | /* | ||
3322 | * Start NF calibration | ||
3323 | */ | ||
3324 | AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_AGCCTL, | ||
3325 | AR5K_PHY_AGCCTL_NF); | ||
3326 | |||
3327 | return ret; | ||
3328 | } | ||
3329 | |||
3254 | /* | 3330 | /* |
3255 | * For 5210 we do all initialization using | 3331 | * For 5210 we do all initialization using |
3256 | * initvals, so we don't have to modify | 3332 | * initvals, so we don't have to modify |
3257 | * any settings (5210 also only supports | 3333 | * any settings (5210 also only supports |
3258 | * a/aturbo modes) | 3334 | * a/aturbo modes) |
3259 | */ | 3335 | */ |
3260 | if ((ah->ah_version != AR5K_AR5210) && !fast) { | 3336 | if (ah->ah_version != AR5K_AR5210) { |
3261 | 3337 | ||
3262 | /* | 3338 | /* |
3263 | * Write initial RF gain settings | 3339 | * Write initial RF gain settings |
@@ -3276,22 +3352,6 @@ int ath5k_hw_phy_init(struct ath5k_hw *ah, struct ieee80211_channel *channel, | |||
3276 | if (ret) | 3352 | if (ret) |
3277 | return ret; | 3353 | return ret; |
3278 | 3354 | ||
3279 | /* Write OFDM timings on 5212*/ | ||
3280 | if (ah->ah_version == AR5K_AR5212 && | ||
3281 | channel->hw_value & CHANNEL_OFDM) { | ||
3282 | |||
3283 | ret = ath5k_hw_write_ofdm_timings(ah, channel); | ||
3284 | if (ret) | ||
3285 | return ret; | ||
3286 | |||
3287 | /* Spur info is available only from EEPROM versions | ||
3288 | * greater than 5.3, but the EEPROM routines will use | ||
3289 | * static values for older versions */ | ||
3290 | if (ah->ah_mac_srev >= AR5K_SREV_AR5424) | ||
3291 | ath5k_hw_set_spur_mitigation_filter(ah, | ||
3292 | channel); | ||
3293 | } | ||
3294 | |||
3295 | /*Enable/disable 802.11b mode on 5111 | 3355 | /*Enable/disable 802.11b mode on 5111 |
3296 | (enable 2111 frequency converter + CCK)*/ | 3356 | (enable 2111 frequency converter + CCK)*/ |
3297 | if (ah->ah_radio == AR5K_RF5111) { | 3357 | if (ah->ah_radio == AR5K_RF5111) { |
@@ -3322,47 +3382,20 @@ int ath5k_hw_phy_init(struct ath5k_hw *ah, struct ieee80211_channel *channel, | |||
3322 | */ | 3382 | */ |
3323 | ath5k_hw_reg_write(ah, AR5K_PHY_ACT_ENABLE, AR5K_PHY_ACT); | 3383 | ath5k_hw_reg_write(ah, AR5K_PHY_ACT_ENABLE, AR5K_PHY_ACT); |
3324 | 3384 | ||
3385 | ath5k_hw_wait_for_synth(ah, channel); | ||
3386 | |||
3325 | /* | 3387 | /* |
3326 | * On 5211+ read activation -> rx delay | 3388 | * Perform ADC test to see if baseband is ready |
3327 | * and use it. | 3389 | * Set tx hold and check adc test register |
3328 | */ | 3390 | */ |
3329 | if (ah->ah_version != AR5K_AR5210) { | 3391 | phy_tst1 = ath5k_hw_reg_read(ah, AR5K_PHY_TST1); |
3330 | u32 delay; | 3392 | ath5k_hw_reg_write(ah, AR5K_PHY_TST1_TXHOLD, AR5K_PHY_TST1); |
3331 | delay = ath5k_hw_reg_read(ah, AR5K_PHY_RX_DELAY) & | 3393 | for (i = 0; i <= 20; i++) { |
3332 | AR5K_PHY_RX_DELAY_M; | 3394 | if (!(ath5k_hw_reg_read(ah, AR5K_PHY_ADC_TEST) & 0x10)) |
3333 | delay = (channel->hw_value & CHANNEL_CCK) ? | 3395 | break; |
3334 | ((delay << 2) / 22) : (delay / 10); | 3396 | udelay(200); |
3335 | if (ah->ah_bwmode == AR5K_BWMODE_10MHZ) | ||
3336 | delay = delay << 1; | ||
3337 | if (ah->ah_bwmode == AR5K_BWMODE_5MHZ) | ||
3338 | delay = delay << 2; | ||
3339 | /* XXX: /2 on turbo ? Let's be safe | ||
3340 | * for now */ | ||
3341 | udelay(100 + delay); | ||
3342 | } else { | ||
3343 | mdelay(1); | ||
3344 | } | ||
3345 | |||
3346 | if (fast) | ||
3347 | /* | ||
3348 | * Release RF Bus grant | ||
3349 | */ | ||
3350 | AR5K_REG_DISABLE_BITS(ah, AR5K_PHY_RFBUS_REQ, | ||
3351 | AR5K_PHY_RFBUS_REQ_REQUEST); | ||
3352 | else { | ||
3353 | /* | ||
3354 | * Perform ADC test to see if baseband is ready | ||
3355 | * Set tx hold and check adc test register | ||
3356 | */ | ||
3357 | phy_tst1 = ath5k_hw_reg_read(ah, AR5K_PHY_TST1); | ||
3358 | ath5k_hw_reg_write(ah, AR5K_PHY_TST1_TXHOLD, AR5K_PHY_TST1); | ||
3359 | for (i = 0; i <= 20; i++) { | ||
3360 | if (!(ath5k_hw_reg_read(ah, AR5K_PHY_ADC_TEST) & 0x10)) | ||
3361 | break; | ||
3362 | udelay(200); | ||
3363 | } | ||
3364 | ath5k_hw_reg_write(ah, phy_tst1, AR5K_PHY_TST1); | ||
3365 | } | 3397 | } |
3398 | ath5k_hw_reg_write(ah, phy_tst1, AR5K_PHY_TST1); | ||
3366 | 3399 | ||
3367 | /* | 3400 | /* |
3368 | * Start automatic gain control calibration | 3401 | * Start automatic gain control calibration |
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h index 23838e37d45f..1a7fa6ea4cf5 100644 --- a/drivers/net/wireless/ath/ath9k/ath9k.h +++ b/drivers/net/wireless/ath/ath9k/ath9k.h | |||
@@ -21,7 +21,6 @@ | |||
21 | #include <linux/device.h> | 21 | #include <linux/device.h> |
22 | #include <linux/leds.h> | 22 | #include <linux/leds.h> |
23 | #include <linux/completion.h> | 23 | #include <linux/completion.h> |
24 | #include <linux/pm_qos_params.h> | ||
25 | 24 | ||
26 | #include "debug.h" | 25 | #include "debug.h" |
27 | #include "common.h" | 26 | #include "common.h" |
@@ -57,8 +56,6 @@ struct ath_node; | |||
57 | 56 | ||
58 | #define A_MAX(a, b) ((a) > (b) ? (a) : (b)) | 57 | #define A_MAX(a, b) ((a) > (b) ? (a) : (b)) |
59 | 58 | ||
60 | #define ATH9K_PM_QOS_DEFAULT_VALUE 55 | ||
61 | |||
62 | #define TSF_TO_TU(_h,_l) \ | 59 | #define TSF_TO_TU(_h,_l) \ |
63 | ((((u32)(_h)) << 22) | (((u32)(_l)) >> 10)) | 60 | ((((u32)(_h)) << 22) | (((u32)(_l)) >> 10)) |
64 | 61 | ||
@@ -633,8 +630,6 @@ struct ath_softc { | |||
633 | struct ath_descdma txsdma; | 630 | struct ath_descdma txsdma; |
634 | 631 | ||
635 | struct ath_ant_comb ant_comb; | 632 | struct ath_ant_comb ant_comb; |
636 | |||
637 | struct pm_qos_request_list pm_qos_req; | ||
638 | }; | 633 | }; |
639 | 634 | ||
640 | struct ath_wiphy { | 635 | struct ath_wiphy { |
@@ -666,7 +661,6 @@ static inline void ath_read_cachesize(struct ath_common *common, int *csz) | |||
666 | extern struct ieee80211_ops ath9k_ops; | 661 | extern struct ieee80211_ops ath9k_ops; |
667 | extern int ath9k_modparam_nohwcrypt; | 662 | extern int ath9k_modparam_nohwcrypt; |
668 | extern int led_blink; | 663 | extern int led_blink; |
669 | extern int ath9k_pm_qos_value; | ||
670 | extern bool is_ath9k_unloaded; | 664 | extern bool is_ath9k_unloaded; |
671 | 665 | ||
672 | irqreturn_t ath_isr(int irq, void *dev); | 666 | irqreturn_t ath_isr(int irq, void *dev); |
diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c index 087a6a95edd5..a033d01bf8a0 100644 --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c | |||
@@ -41,10 +41,6 @@ static int ath9k_btcoex_enable; | |||
41 | module_param_named(btcoex_enable, ath9k_btcoex_enable, int, 0444); | 41 | module_param_named(btcoex_enable, ath9k_btcoex_enable, int, 0444); |
42 | MODULE_PARM_DESC(btcoex_enable, "Enable wifi-BT coexistence"); | 42 | MODULE_PARM_DESC(btcoex_enable, "Enable wifi-BT coexistence"); |
43 | 43 | ||
44 | int ath9k_pm_qos_value = ATH9K_PM_QOS_DEFAULT_VALUE; | ||
45 | module_param_named(pmqos, ath9k_pm_qos_value, int, S_IRUSR | S_IRGRP | S_IROTH); | ||
46 | MODULE_PARM_DESC(pmqos, "User specified PM-QOS value"); | ||
47 | |||
48 | bool is_ath9k_unloaded; | 44 | bool is_ath9k_unloaded; |
49 | /* We use the hw_value as an index into our private channel structure */ | 45 | /* We use the hw_value as an index into our private channel structure */ |
50 | 46 | ||
@@ -762,9 +758,6 @@ int ath9k_init_device(u16 devid, struct ath_softc *sc, u16 subsysid, | |||
762 | ath_init_leds(sc); | 758 | ath_init_leds(sc); |
763 | ath_start_rfkill_poll(sc); | 759 | ath_start_rfkill_poll(sc); |
764 | 760 | ||
765 | pm_qos_add_request(&sc->pm_qos_req, PM_QOS_CPU_DMA_LATENCY, | ||
766 | PM_QOS_DEFAULT_VALUE); | ||
767 | |||
768 | return 0; | 761 | return 0; |
769 | 762 | ||
770 | error_world: | 763 | error_world: |
@@ -831,7 +824,6 @@ void ath9k_deinit_device(struct ath_softc *sc) | |||
831 | } | 824 | } |
832 | 825 | ||
833 | ieee80211_unregister_hw(hw); | 826 | ieee80211_unregister_hw(hw); |
834 | pm_qos_remove_request(&sc->pm_qos_req); | ||
835 | ath_rx_cleanup(sc); | 827 | ath_rx_cleanup(sc); |
836 | ath_tx_cleanup(sc); | 828 | ath_tx_cleanup(sc); |
837 | ath9k_deinit_softc(sc); | 829 | ath9k_deinit_softc(sc); |
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index da5c64597c1f..a09d15f7aa6e 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c | |||
@@ -1173,12 +1173,6 @@ static int ath9k_start(struct ieee80211_hw *hw) | |||
1173 | ath9k_btcoex_timer_resume(sc); | 1173 | ath9k_btcoex_timer_resume(sc); |
1174 | } | 1174 | } |
1175 | 1175 | ||
1176 | /* User has the option to provide pm-qos value as a module | ||
1177 | * parameter rather than using the default value of | ||
1178 | * 'ATH9K_PM_QOS_DEFAULT_VALUE'. | ||
1179 | */ | ||
1180 | pm_qos_update_request(&sc->pm_qos_req, ath9k_pm_qos_value); | ||
1181 | |||
1182 | if (ah->caps.pcie_lcr_extsync_en && common->bus_ops->extn_synch_en) | 1176 | if (ah->caps.pcie_lcr_extsync_en && common->bus_ops->extn_synch_en) |
1183 | common->bus_ops->extn_synch_en(common); | 1177 | common->bus_ops->extn_synch_en(common); |
1184 | 1178 | ||
@@ -1345,8 +1339,6 @@ static void ath9k_stop(struct ieee80211_hw *hw) | |||
1345 | 1339 | ||
1346 | sc->sc_flags |= SC_OP_INVALID; | 1340 | sc->sc_flags |= SC_OP_INVALID; |
1347 | 1341 | ||
1348 | pm_qos_update_request(&sc->pm_qos_req, PM_QOS_DEFAULT_VALUE); | ||
1349 | |||
1350 | mutex_unlock(&sc->mutex); | 1342 | mutex_unlock(&sc->mutex); |
1351 | 1343 | ||
1352 | ath_dbg(common, ATH_DBG_CONFIG, "Driver halt\n"); | 1344 | ath_dbg(common, ATH_DBG_CONFIG, "Driver halt\n"); |
diff --git a/drivers/net/wireless/p54/p54pci.c b/drivers/net/wireless/p54/p54pci.c index 1eacba4daa5b..0494d7b102d4 100644 --- a/drivers/net/wireless/p54/p54pci.c +++ b/drivers/net/wireless/p54/p54pci.c | |||
@@ -199,6 +199,7 @@ static void p54p_check_rx_ring(struct ieee80211_hw *dev, u32 *index, | |||
199 | while (i != idx) { | 199 | while (i != idx) { |
200 | u16 len; | 200 | u16 len; |
201 | struct sk_buff *skb; | 201 | struct sk_buff *skb; |
202 | dma_addr_t dma_addr; | ||
202 | desc = &ring[i]; | 203 | desc = &ring[i]; |
203 | len = le16_to_cpu(desc->len); | 204 | len = le16_to_cpu(desc->len); |
204 | skb = rx_buf[i]; | 205 | skb = rx_buf[i]; |
@@ -216,17 +217,20 @@ static void p54p_check_rx_ring(struct ieee80211_hw *dev, u32 *index, | |||
216 | 217 | ||
217 | len = priv->common.rx_mtu; | 218 | len = priv->common.rx_mtu; |
218 | } | 219 | } |
220 | dma_addr = le32_to_cpu(desc->host_addr); | ||
221 | pci_dma_sync_single_for_cpu(priv->pdev, dma_addr, | ||
222 | priv->common.rx_mtu + 32, PCI_DMA_FROMDEVICE); | ||
219 | skb_put(skb, len); | 223 | skb_put(skb, len); |
220 | 224 | ||
221 | if (p54_rx(dev, skb)) { | 225 | if (p54_rx(dev, skb)) { |
222 | pci_unmap_single(priv->pdev, | 226 | pci_unmap_single(priv->pdev, dma_addr, |
223 | le32_to_cpu(desc->host_addr), | 227 | priv->common.rx_mtu + 32, PCI_DMA_FROMDEVICE); |
224 | priv->common.rx_mtu + 32, | ||
225 | PCI_DMA_FROMDEVICE); | ||
226 | rx_buf[i] = NULL; | 228 | rx_buf[i] = NULL; |
227 | desc->host_addr = 0; | 229 | desc->host_addr = cpu_to_le32(0); |
228 | } else { | 230 | } else { |
229 | skb_trim(skb, 0); | 231 | skb_trim(skb, 0); |
232 | pci_dma_sync_single_for_device(priv->pdev, dma_addr, | ||
233 | priv->common.rx_mtu + 32, PCI_DMA_FROMDEVICE); | ||
230 | desc->len = cpu_to_le16(priv->common.rx_mtu + 32); | 234 | desc->len = cpu_to_le16(priv->common.rx_mtu + 32); |
231 | } | 235 | } |
232 | 236 | ||
diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c index aa97971a38af..3b3f1e45ab3e 100644 --- a/drivers/net/wireless/rt2x00/rt2800pci.c +++ b/drivers/net/wireless/rt2x00/rt2800pci.c | |||
@@ -652,6 +652,12 @@ static void rt2800pci_fill_rxdone(struct queue_entry *entry, | |||
652 | */ | 652 | */ |
653 | rxdesc->flags |= RX_FLAG_IV_STRIPPED; | 653 | rxdesc->flags |= RX_FLAG_IV_STRIPPED; |
654 | 654 | ||
655 | /* | ||
656 | * The hardware has already checked the Michael Mic and has | ||
657 | * stripped it from the frame. Signal this to mac80211. | ||
658 | */ | ||
659 | rxdesc->flags |= RX_FLAG_MMIC_STRIPPED; | ||
660 | |||
655 | if (rxdesc->cipher_status == RX_CRYPTO_SUCCESS) | 661 | if (rxdesc->cipher_status == RX_CRYPTO_SUCCESS) |
656 | rxdesc->flags |= RX_FLAG_DECRYPTED; | 662 | rxdesc->flags |= RX_FLAG_DECRYPTED; |
657 | else if (rxdesc->cipher_status == RX_CRYPTO_FAIL_MIC) | 663 | else if (rxdesc->cipher_status == RX_CRYPTO_FAIL_MIC) |
@@ -1065,6 +1071,8 @@ static DEFINE_PCI_DEVICE_TABLE(rt2800pci_device_table) = { | |||
1065 | { PCI_DEVICE(0x1814, 0x3390), PCI_DEVICE_DATA(&rt2800pci_ops) }, | 1071 | { PCI_DEVICE(0x1814, 0x3390), PCI_DEVICE_DATA(&rt2800pci_ops) }, |
1066 | #endif | 1072 | #endif |
1067 | #ifdef CONFIG_RT2800PCI_RT35XX | 1073 | #ifdef CONFIG_RT2800PCI_RT35XX |
1074 | { PCI_DEVICE(0x1432, 0x7711), PCI_DEVICE_DATA(&rt2800pci_ops) }, | ||
1075 | { PCI_DEVICE(0x1432, 0x7722), PCI_DEVICE_DATA(&rt2800pci_ops) }, | ||
1068 | { PCI_DEVICE(0x1814, 0x3060), PCI_DEVICE_DATA(&rt2800pci_ops) }, | 1076 | { PCI_DEVICE(0x1814, 0x3060), PCI_DEVICE_DATA(&rt2800pci_ops) }, |
1069 | { PCI_DEVICE(0x1814, 0x3062), PCI_DEVICE_DATA(&rt2800pci_ops) }, | 1077 | { PCI_DEVICE(0x1814, 0x3062), PCI_DEVICE_DATA(&rt2800pci_ops) }, |
1070 | { PCI_DEVICE(0x1814, 0x3562), PCI_DEVICE_DATA(&rt2800pci_ops) }, | 1078 | { PCI_DEVICE(0x1814, 0x3562), PCI_DEVICE_DATA(&rt2800pci_ops) }, |
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c index b97a4a54ff4c..197a36c05fda 100644 --- a/drivers/net/wireless/rt2x00/rt2800usb.c +++ b/drivers/net/wireless/rt2x00/rt2800usb.c | |||
@@ -486,6 +486,12 @@ static void rt2800usb_fill_rxdone(struct queue_entry *entry, | |||
486 | */ | 486 | */ |
487 | rxdesc->flags |= RX_FLAG_IV_STRIPPED; | 487 | rxdesc->flags |= RX_FLAG_IV_STRIPPED; |
488 | 488 | ||
489 | /* | ||
490 | * The hardware has already checked the Michael Mic and has | ||
491 | * stripped it from the frame. Signal this to mac80211. | ||
492 | */ | ||
493 | rxdesc->flags |= RX_FLAG_MMIC_STRIPPED; | ||
494 | |||
489 | if (rxdesc->cipher_status == RX_CRYPTO_SUCCESS) | 495 | if (rxdesc->cipher_status == RX_CRYPTO_SUCCESS) |
490 | rxdesc->flags |= RX_FLAG_DECRYPTED; | 496 | rxdesc->flags |= RX_FLAG_DECRYPTED; |
491 | else if (rxdesc->cipher_status == RX_CRYPTO_FAIL_MIC) | 497 | else if (rxdesc->cipher_status == RX_CRYPTO_FAIL_MIC) |
diff --git a/drivers/nfc/Kconfig b/drivers/nfc/Kconfig index ffedfd492754..ea1580085347 100644 --- a/drivers/nfc/Kconfig +++ b/drivers/nfc/Kconfig | |||
@@ -3,7 +3,7 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | menuconfig NFC_DEVICES | 5 | menuconfig NFC_DEVICES |
6 | bool "NFC devices" | 6 | bool "Near Field Communication (NFC) devices" |
7 | default n | 7 | default n |
8 | ---help--- | 8 | ---help--- |
9 | You'll have to say Y if your computer contains an NFC device that | 9 | You'll have to say Y if your computer contains an NFC device that |
diff --git a/drivers/nfc/pn544.c b/drivers/nfc/pn544.c index bae647264dd6..724f65d8f9e4 100644 --- a/drivers/nfc/pn544.c +++ b/drivers/nfc/pn544.c | |||
@@ -60,7 +60,7 @@ enum pn544_irq { | |||
60 | struct pn544_info { | 60 | struct pn544_info { |
61 | struct miscdevice miscdev; | 61 | struct miscdevice miscdev; |
62 | struct i2c_client *i2c_dev; | 62 | struct i2c_client *i2c_dev; |
63 | struct regulator_bulk_data regs[2]; | 63 | struct regulator_bulk_data regs[3]; |
64 | 64 | ||
65 | enum pn544_state state; | 65 | enum pn544_state state; |
66 | wait_queue_head_t read_wait; | 66 | wait_queue_head_t read_wait; |
@@ -74,6 +74,7 @@ struct pn544_info { | |||
74 | 74 | ||
75 | static const char reg_vdd_io[] = "Vdd_IO"; | 75 | static const char reg_vdd_io[] = "Vdd_IO"; |
76 | static const char reg_vbat[] = "VBat"; | 76 | static const char reg_vbat[] = "VBat"; |
77 | static const char reg_vsim[] = "VSim"; | ||
77 | 78 | ||
78 | /* sysfs interface */ | 79 | /* sysfs interface */ |
79 | static ssize_t pn544_test(struct device *dev, | 80 | static ssize_t pn544_test(struct device *dev, |
@@ -740,6 +741,7 @@ static int __devinit pn544_probe(struct i2c_client *client, | |||
740 | 741 | ||
741 | info->regs[0].supply = reg_vdd_io; | 742 | info->regs[0].supply = reg_vdd_io; |
742 | info->regs[1].supply = reg_vbat; | 743 | info->regs[1].supply = reg_vbat; |
744 | info->regs[2].supply = reg_vsim; | ||
743 | r = regulator_bulk_get(&client->dev, ARRAY_SIZE(info->regs), | 745 | r = regulator_bulk_get(&client->dev, ARRAY_SIZE(info->regs), |
744 | info->regs); | 746 | info->regs); |
745 | if (r < 0) | 747 | if (r < 0) |
diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c index 0bdda5b3ed55..42fbf1a75576 100644 --- a/drivers/pcmcia/pcmcia_resource.c +++ b/drivers/pcmcia/pcmcia_resource.c | |||
@@ -518,6 +518,8 @@ int pcmcia_enable_device(struct pcmcia_device *p_dev) | |||
518 | flags |= CONF_ENABLE_IOCARD; | 518 | flags |= CONF_ENABLE_IOCARD; |
519 | if (flags & CONF_ENABLE_IOCARD) | 519 | if (flags & CONF_ENABLE_IOCARD) |
520 | s->socket.flags |= SS_IOCARD; | 520 | s->socket.flags |= SS_IOCARD; |
521 | if (flags & CONF_ENABLE_ZVCARD) | ||
522 | s->socket.flags |= SS_ZVCARD | SS_IOCARD; | ||
521 | if (flags & CONF_ENABLE_SPKR) { | 523 | if (flags & CONF_ENABLE_SPKR) { |
522 | s->socket.flags |= SS_SPKR_ENA; | 524 | s->socket.flags |= SS_SPKR_ENA; |
523 | status = CCSR_AUDIO_ENA; | 525 | status = CCSR_AUDIO_ENA; |
diff --git a/drivers/pcmcia/pxa2xx_base.c b/drivers/pcmcia/pxa2xx_base.c index 3755e7c8c715..2c540542b5af 100644 --- a/drivers/pcmcia/pxa2xx_base.c +++ b/drivers/pcmcia/pxa2xx_base.c | |||
@@ -215,7 +215,7 @@ pxa2xx_pcmcia_frequency_change(struct soc_pcmcia_socket *skt, | |||
215 | } | 215 | } |
216 | #endif | 216 | #endif |
217 | 217 | ||
218 | static void pxa2xx_configure_sockets(struct device *dev) | 218 | void pxa2xx_configure_sockets(struct device *dev) |
219 | { | 219 | { |
220 | struct pcmcia_low_level *ops = dev->platform_data; | 220 | struct pcmcia_low_level *ops = dev->platform_data; |
221 | /* | 221 | /* |
diff --git a/drivers/pcmcia/pxa2xx_base.h b/drivers/pcmcia/pxa2xx_base.h index bb62ea87b8f9..b609b45469ed 100644 --- a/drivers/pcmcia/pxa2xx_base.h +++ b/drivers/pcmcia/pxa2xx_base.h | |||
@@ -1,3 +1,4 @@ | |||
1 | int pxa2xx_drv_pcmcia_add_one(struct soc_pcmcia_socket *skt); | 1 | int pxa2xx_drv_pcmcia_add_one(struct soc_pcmcia_socket *skt); |
2 | void pxa2xx_drv_pcmcia_ops(struct pcmcia_low_level *ops); | 2 | void pxa2xx_drv_pcmcia_ops(struct pcmcia_low_level *ops); |
3 | void pxa2xx_configure_sockets(struct device *dev); | ||
3 | 4 | ||
diff --git a/drivers/pcmcia/pxa2xx_lubbock.c b/drivers/pcmcia/pxa2xx_lubbock.c index b9f8c8fb42bd..25afe637c657 100644 --- a/drivers/pcmcia/pxa2xx_lubbock.c +++ b/drivers/pcmcia/pxa2xx_lubbock.c | |||
@@ -226,6 +226,7 @@ int pcmcia_lubbock_init(struct sa1111_dev *sadev) | |||
226 | lubbock_set_misc_wr((1 << 15) | (1 << 14), 0); | 226 | lubbock_set_misc_wr((1 << 15) | (1 << 14), 0); |
227 | 227 | ||
228 | pxa2xx_drv_pcmcia_ops(&lubbock_pcmcia_ops); | 228 | pxa2xx_drv_pcmcia_ops(&lubbock_pcmcia_ops); |
229 | pxa2xx_configure_sockets(&sadev->dev); | ||
229 | ret = sa1111_pcmcia_add(sadev, &lubbock_pcmcia_ops, | 230 | ret = sa1111_pcmcia_add(sadev, &lubbock_pcmcia_ops, |
230 | pxa2xx_drv_pcmcia_add_one); | 231 | pxa2xx_drv_pcmcia_add_one); |
231 | } | 232 | } |
diff --git a/drivers/pps/kapi.c b/drivers/pps/kapi.c index cba1b43f7519..a4e8eb9fece6 100644 --- a/drivers/pps/kapi.c +++ b/drivers/pps/kapi.c | |||
@@ -168,7 +168,7 @@ void pps_event(struct pps_device *pps, struct pps_event_time *ts, int event, | |||
168 | { | 168 | { |
169 | unsigned long flags; | 169 | unsigned long flags; |
170 | int captured = 0; | 170 | int captured = 0; |
171 | struct pps_ktime ts_real; | 171 | struct pps_ktime ts_real = { .sec = 0, .nsec = 0, .flags = 0 }; |
172 | 172 | ||
173 | /* check event type */ | 173 | /* check event type */ |
174 | BUG_ON((event & (PPS_CAPTUREASSERT | PPS_CAPTURECLEAR)) == 0); | 174 | BUG_ON((event & (PPS_CAPTUREASSERT | PPS_CAPTURECLEAR)) == 0); |
diff --git a/drivers/rapidio/rio-sysfs.c b/drivers/rapidio/rio-sysfs.c index 76b41853a877..1269fbd2deca 100644 --- a/drivers/rapidio/rio-sysfs.c +++ b/drivers/rapidio/rio-sysfs.c | |||
@@ -77,9 +77,9 @@ rio_read_config(struct file *filp, struct kobject *kobj, | |||
77 | 77 | ||
78 | /* Several chips lock up trying to read undefined config space */ | 78 | /* Several chips lock up trying to read undefined config space */ |
79 | if (capable(CAP_SYS_ADMIN)) | 79 | if (capable(CAP_SYS_ADMIN)) |
80 | size = 0x200000; | 80 | size = RIO_MAINT_SPACE_SZ; |
81 | 81 | ||
82 | if (off > size) | 82 | if (off >= size) |
83 | return 0; | 83 | return 0; |
84 | if (off + count > size) { | 84 | if (off + count > size) { |
85 | size -= off; | 85 | size -= off; |
@@ -147,10 +147,10 @@ rio_write_config(struct file *filp, struct kobject *kobj, | |||
147 | loff_t init_off = off; | 147 | loff_t init_off = off; |
148 | u8 *data = (u8 *) buf; | 148 | u8 *data = (u8 *) buf; |
149 | 149 | ||
150 | if (off > 0x200000) | 150 | if (off >= RIO_MAINT_SPACE_SZ) |
151 | return 0; | 151 | return 0; |
152 | if (off + count > 0x200000) { | 152 | if (off + count > RIO_MAINT_SPACE_SZ) { |
153 | size = 0x200000 - off; | 153 | size = RIO_MAINT_SPACE_SZ - off; |
154 | count = size; | 154 | count = size; |
155 | } | 155 | } |
156 | 156 | ||
@@ -200,7 +200,7 @@ static struct bin_attribute rio_config_attr = { | |||
200 | .name = "config", | 200 | .name = "config", |
201 | .mode = S_IRUGO | S_IWUSR, | 201 | .mode = S_IRUGO | S_IWUSR, |
202 | }, | 202 | }, |
203 | .size = 0x200000, | 203 | .size = RIO_MAINT_SPACE_SZ, |
204 | .read = rio_read_config, | 204 | .read = rio_read_config, |
205 | .write = rio_write_config, | 205 | .write = rio_write_config, |
206 | }; | 206 | }; |
diff --git a/drivers/regulator/mc13xxx-regulator-core.c b/drivers/regulator/mc13xxx-regulator-core.c index f53d31b950d4..2bb5de1f2421 100644 --- a/drivers/regulator/mc13xxx-regulator-core.c +++ b/drivers/regulator/mc13xxx-regulator-core.c | |||
@@ -174,7 +174,7 @@ static int mc13xxx_regulator_get_voltage(struct regulator_dev *rdev) | |||
174 | 174 | ||
175 | dev_dbg(rdev_get_dev(rdev), "%s id: %d val: %d\n", __func__, id, val); | 175 | dev_dbg(rdev_get_dev(rdev), "%s id: %d val: %d\n", __func__, id, val); |
176 | 176 | ||
177 | BUG_ON(val < 0 || val > mc13xxx_regulators[id].desc.n_voltages); | 177 | BUG_ON(val > mc13xxx_regulators[id].desc.n_voltages); |
178 | 178 | ||
179 | return mc13xxx_regulators[id].voltages[val]; | 179 | return mc13xxx_regulators[id].voltages[val]; |
180 | } | 180 | } |
diff --git a/drivers/regulator/wm831x-dcdc.c b/drivers/regulator/wm831x-dcdc.c index 8b0d2c4bde91..06df898842c0 100644 --- a/drivers/regulator/wm831x-dcdc.c +++ b/drivers/regulator/wm831x-dcdc.c | |||
@@ -120,6 +120,7 @@ static unsigned int wm831x_dcdc_get_mode(struct regulator_dev *rdev) | |||
120 | return REGULATOR_MODE_IDLE; | 120 | return REGULATOR_MODE_IDLE; |
121 | default: | 121 | default: |
122 | BUG(); | 122 | BUG(); |
123 | return -EINVAL; | ||
123 | } | 124 | } |
124 | } | 125 | } |
125 | 126 | ||
diff --git a/drivers/rtc/rtc-at91sam9.c b/drivers/rtc/rtc-at91sam9.c index c36749e4c926..5469c52cba3d 100644 --- a/drivers/rtc/rtc-at91sam9.c +++ b/drivers/rtc/rtc-at91sam9.c | |||
@@ -309,7 +309,7 @@ static const struct rtc_class_ops at91_rtc_ops = { | |||
309 | .read_alarm = at91_rtc_readalarm, | 309 | .read_alarm = at91_rtc_readalarm, |
310 | .set_alarm = at91_rtc_setalarm, | 310 | .set_alarm = at91_rtc_setalarm, |
311 | .proc = at91_rtc_proc, | 311 | .proc = at91_rtc_proc, |
312 | .alarm_irq_enabled = at91_rtc_alarm_irq_enable, | 312 | .alarm_irq_enable = at91_rtc_alarm_irq_enable, |
313 | }; | 313 | }; |
314 | 314 | ||
315 | /* | 315 | /* |
diff --git a/drivers/rtc/rtc-ds3232.c b/drivers/rtc/rtc-ds3232.c index 23a9ee19764c..950735415a7c 100644 --- a/drivers/rtc/rtc-ds3232.c +++ b/drivers/rtc/rtc-ds3232.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * RTC client/driver for the Maxim/Dallas DS3232 Real-Time Clock over I2C | 2 | * RTC client/driver for the Maxim/Dallas DS3232 Real-Time Clock over I2C |
3 | * | 3 | * |
4 | * Copyright (C) 2009-2010 Freescale Semiconductor. | 4 | * Copyright (C) 2009-2011 Freescale Semiconductor. |
5 | * Author: Jack Lan <jack.lan@freescale.com> | 5 | * Author: Jack Lan <jack.lan@freescale.com> |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify it | 7 | * This program is free software; you can redistribute it and/or modify it |
@@ -141,9 +141,11 @@ static int ds3232_read_time(struct device *dev, struct rtc_time *time) | |||
141 | time->tm_hour = bcd2bin(hour); | 141 | time->tm_hour = bcd2bin(hour); |
142 | } | 142 | } |
143 | 143 | ||
144 | time->tm_wday = bcd2bin(week); | 144 | /* Day of the week in linux range is 0~6 while 1~7 in RTC chip */ |
145 | time->tm_wday = bcd2bin(week) - 1; | ||
145 | time->tm_mday = bcd2bin(day); | 146 | time->tm_mday = bcd2bin(day); |
146 | time->tm_mon = bcd2bin(month & 0x7F); | 147 | /* linux tm_mon range:0~11, while month range is 1~12 in RTC chip */ |
148 | time->tm_mon = bcd2bin(month & 0x7F) - 1; | ||
147 | if (century) | 149 | if (century) |
148 | add_century = 100; | 150 | add_century = 100; |
149 | 151 | ||
@@ -162,9 +164,11 @@ static int ds3232_set_time(struct device *dev, struct rtc_time *time) | |||
162 | buf[0] = bin2bcd(time->tm_sec); | 164 | buf[0] = bin2bcd(time->tm_sec); |
163 | buf[1] = bin2bcd(time->tm_min); | 165 | buf[1] = bin2bcd(time->tm_min); |
164 | buf[2] = bin2bcd(time->tm_hour); | 166 | buf[2] = bin2bcd(time->tm_hour); |
165 | buf[3] = bin2bcd(time->tm_wday); /* Day of the week */ | 167 | /* Day of the week in linux range is 0~6 while 1~7 in RTC chip */ |
168 | buf[3] = bin2bcd(time->tm_wday + 1); | ||
166 | buf[4] = bin2bcd(time->tm_mday); /* Date */ | 169 | buf[4] = bin2bcd(time->tm_mday); /* Date */ |
167 | buf[5] = bin2bcd(time->tm_mon); | 170 | /* linux tm_mon range:0~11, while month range is 1~12 in RTC chip */ |
171 | buf[5] = bin2bcd(time->tm_mon + 1); | ||
168 | if (time->tm_year >= 100) { | 172 | if (time->tm_year >= 100) { |
169 | buf[5] |= 0x80; | 173 | buf[5] |= 0x80; |
170 | buf[6] = bin2bcd(time->tm_year - 100); | 174 | buf[6] = bin2bcd(time->tm_year - 100); |
diff --git a/drivers/s390/char/tape_block.c b/drivers/s390/char/tape_block.c index f061b2527b44..83cea9a55e2f 100644 --- a/drivers/s390/char/tape_block.c +++ b/drivers/s390/char/tape_block.c | |||
@@ -48,14 +48,14 @@ | |||
48 | static DEFINE_MUTEX(tape_block_mutex); | 48 | static DEFINE_MUTEX(tape_block_mutex); |
49 | static int tapeblock_open(struct block_device *, fmode_t); | 49 | static int tapeblock_open(struct block_device *, fmode_t); |
50 | static int tapeblock_release(struct gendisk *, fmode_t); | 50 | static int tapeblock_release(struct gendisk *, fmode_t); |
51 | static int tapeblock_medium_changed(struct gendisk *); | 51 | static unsigned int tapeblock_check_events(struct gendisk *, unsigned int); |
52 | static int tapeblock_revalidate_disk(struct gendisk *); | 52 | static int tapeblock_revalidate_disk(struct gendisk *); |
53 | 53 | ||
54 | static const struct block_device_operations tapeblock_fops = { | 54 | static const struct block_device_operations tapeblock_fops = { |
55 | .owner = THIS_MODULE, | 55 | .owner = THIS_MODULE, |
56 | .open = tapeblock_open, | 56 | .open = tapeblock_open, |
57 | .release = tapeblock_release, | 57 | .release = tapeblock_release, |
58 | .media_changed = tapeblock_medium_changed, | 58 | .check_events = tapeblock_check_events, |
59 | .revalidate_disk = tapeblock_revalidate_disk, | 59 | .revalidate_disk = tapeblock_revalidate_disk, |
60 | }; | 60 | }; |
61 | 61 | ||
@@ -236,6 +236,7 @@ tapeblock_setup_device(struct tape_device * device) | |||
236 | disk->major = tapeblock_major; | 236 | disk->major = tapeblock_major; |
237 | disk->first_minor = device->first_minor; | 237 | disk->first_minor = device->first_minor; |
238 | disk->fops = &tapeblock_fops; | 238 | disk->fops = &tapeblock_fops; |
239 | disk->events = DISK_EVENT_MEDIA_CHANGE; | ||
239 | disk->private_data = tape_get_device(device); | 240 | disk->private_data = tape_get_device(device); |
240 | disk->queue = blkdat->request_queue; | 241 | disk->queue = blkdat->request_queue; |
241 | set_capacity(disk, 0); | 242 | set_capacity(disk, 0); |
@@ -339,8 +340,8 @@ tapeblock_revalidate_disk(struct gendisk *disk) | |||
339 | return 0; | 340 | return 0; |
340 | } | 341 | } |
341 | 342 | ||
342 | static int | 343 | static unsigned int |
343 | tapeblock_medium_changed(struct gendisk *disk) | 344 | tapeblock_check_events(struct gendisk *disk, unsigned int clearing) |
344 | { | 345 | { |
345 | struct tape_device *device; | 346 | struct tape_device *device; |
346 | 347 | ||
@@ -348,7 +349,7 @@ tapeblock_medium_changed(struct gendisk *disk) | |||
348 | DBF_LH(6, "tapeblock_medium_changed(%p) = %d\n", | 349 | DBF_LH(6, "tapeblock_medium_changed(%p) = %d\n", |
349 | device, device->blk_data.medium_changed); | 350 | device, device->blk_data.medium_changed); |
350 | 351 | ||
351 | return device->blk_data.medium_changed; | 352 | return device->blk_data.medium_changed ? DISK_EVENT_MEDIA_CHANGE : 0; |
352 | } | 353 | } |
353 | 354 | ||
354 | /* | 355 | /* |
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 5a0ae7a944ce..bf80a4c5a481 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
@@ -443,7 +443,7 @@ static void scsi_run_queue(struct request_queue *q) | |||
443 | &sdev->request_queue->queue_flags); | 443 | &sdev->request_queue->queue_flags); |
444 | if (flagset) | 444 | if (flagset) |
445 | queue_flag_set(QUEUE_FLAG_REENTER, sdev->request_queue); | 445 | queue_flag_set(QUEUE_FLAG_REENTER, sdev->request_queue); |
446 | __blk_run_queue(sdev->request_queue); | 446 | __blk_run_queue(sdev->request_queue, false); |
447 | if (flagset) | 447 | if (flagset) |
448 | queue_flag_clear(QUEUE_FLAG_REENTER, sdev->request_queue); | 448 | queue_flag_clear(QUEUE_FLAG_REENTER, sdev->request_queue); |
449 | spin_unlock(sdev->request_queue->queue_lock); | 449 | spin_unlock(sdev->request_queue->queue_lock); |
diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c index 2cefabd5bdb5..2941d2d92c94 100644 --- a/drivers/scsi/scsi_transport_fc.c +++ b/drivers/scsi/scsi_transport_fc.c | |||
@@ -3829,7 +3829,7 @@ fc_bsg_goose_queue(struct fc_rport *rport) | |||
3829 | !test_bit(QUEUE_FLAG_REENTER, &rport->rqst_q->queue_flags); | 3829 | !test_bit(QUEUE_FLAG_REENTER, &rport->rqst_q->queue_flags); |
3830 | if (flagset) | 3830 | if (flagset) |
3831 | queue_flag_set(QUEUE_FLAG_REENTER, rport->rqst_q); | 3831 | queue_flag_set(QUEUE_FLAG_REENTER, rport->rqst_q); |
3832 | __blk_run_queue(rport->rqst_q); | 3832 | __blk_run_queue(rport->rqst_q, false); |
3833 | if (flagset) | 3833 | if (flagset) |
3834 | queue_flag_clear(QUEUE_FLAG_REENTER, rport->rqst_q); | 3834 | queue_flag_clear(QUEUE_FLAG_REENTER, rport->rqst_q); |
3835 | spin_unlock_irqrestore(rport->rqst_q->queue_lock, flags); | 3835 | spin_unlock_irqrestore(rport->rqst_q->queue_lock, flags); |
diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c index 4fb809485d9e..1ecd7e17f571 100644 --- a/drivers/staging/hv/blkvsc_drv.c +++ b/drivers/staging/hv/blkvsc_drv.c | |||
@@ -131,7 +131,8 @@ static void blkvsc_shutdown(struct device *device); | |||
131 | 131 | ||
132 | static int blkvsc_open(struct block_device *bdev, fmode_t mode); | 132 | static int blkvsc_open(struct block_device *bdev, fmode_t mode); |
133 | static int blkvsc_release(struct gendisk *disk, fmode_t mode); | 133 | static int blkvsc_release(struct gendisk *disk, fmode_t mode); |
134 | static int blkvsc_media_changed(struct gendisk *gd); | 134 | static unsigned int blkvsc_check_events(struct gendisk *gd, |
135 | unsigned int clearing); | ||
135 | static int blkvsc_revalidate_disk(struct gendisk *gd); | 136 | static int blkvsc_revalidate_disk(struct gendisk *gd); |
136 | static int blkvsc_getgeo(struct block_device *bd, struct hd_geometry *hg); | 137 | static int blkvsc_getgeo(struct block_device *bd, struct hd_geometry *hg); |
137 | static int blkvsc_ioctl(struct block_device *bd, fmode_t mode, | 138 | static int blkvsc_ioctl(struct block_device *bd, fmode_t mode, |
@@ -162,7 +163,7 @@ static const struct block_device_operations block_ops = { | |||
162 | .owner = THIS_MODULE, | 163 | .owner = THIS_MODULE, |
163 | .open = blkvsc_open, | 164 | .open = blkvsc_open, |
164 | .release = blkvsc_release, | 165 | .release = blkvsc_release, |
165 | .media_changed = blkvsc_media_changed, | 166 | .check_events = blkvsc_check_events, |
166 | .revalidate_disk = blkvsc_revalidate_disk, | 167 | .revalidate_disk = blkvsc_revalidate_disk, |
167 | .getgeo = blkvsc_getgeo, | 168 | .getgeo = blkvsc_getgeo, |
168 | .ioctl = blkvsc_ioctl, | 169 | .ioctl = blkvsc_ioctl, |
@@ -367,6 +368,7 @@ static int blkvsc_probe(struct device *device) | |||
367 | else | 368 | else |
368 | blkdev->gd->first_minor = 0; | 369 | blkdev->gd->first_minor = 0; |
369 | blkdev->gd->fops = &block_ops; | 370 | blkdev->gd->fops = &block_ops; |
371 | blkdev->gd->events = DISK_EVENT_MEDIA_CHANGE; | ||
370 | blkdev->gd->private_data = blkdev; | 372 | blkdev->gd->private_data = blkdev; |
371 | blkdev->gd->driverfs_dev = &(blkdev->device_ctx->device); | 373 | blkdev->gd->driverfs_dev = &(blkdev->device_ctx->device); |
372 | sprintf(blkdev->gd->disk_name, "hd%c", 'a' + devnum); | 374 | sprintf(blkdev->gd->disk_name, "hd%c", 'a' + devnum); |
@@ -1352,10 +1354,11 @@ static int blkvsc_release(struct gendisk *disk, fmode_t mode) | |||
1352 | return 0; | 1354 | return 0; |
1353 | } | 1355 | } |
1354 | 1356 | ||
1355 | static int blkvsc_media_changed(struct gendisk *gd) | 1357 | static unsigned int blkvsc_check_events(struct gendisk *gd, |
1358 | unsigned int clearing) | ||
1356 | { | 1359 | { |
1357 | DPRINT_DBG(BLKVSC_DRV, "- enter\n"); | 1360 | DPRINT_DBG(BLKVSC_DRV, "- enter\n"); |
1358 | return 1; | 1361 | return DISK_EVENT_MEDIA_CHANGE; |
1359 | } | 1362 | } |
1360 | 1363 | ||
1361 | static int blkvsc_revalidate_disk(struct gendisk *gd) | 1364 | static int blkvsc_revalidate_disk(struct gendisk *gd) |
diff --git a/drivers/staging/westbridge/astoria/block/cyasblkdev_block.c b/drivers/staging/westbridge/astoria/block/cyasblkdev_block.c index e1851f00be56..842cd9214a5e 100644 --- a/drivers/staging/westbridge/astoria/block/cyasblkdev_block.c +++ b/drivers/staging/westbridge/astoria/block/cyasblkdev_block.c | |||
@@ -381,10 +381,10 @@ static int cyasblkdev_blk_ioctl( | |||
381 | return -ENOTTY; | 381 | return -ENOTTY; |
382 | } | 382 | } |
383 | 383 | ||
384 | /* Media_changed block_device opp | 384 | /* check_events block_device opp |
385 | * this one is called by kernel to confirm if the media really changed | 385 | * this one is called by kernel to confirm if the media really changed |
386 | * as we indicated by issuing check_disk_change() call */ | 386 | * as we indicated by issuing check_disk_change() call */ |
387 | int cyasblkdev_media_changed(struct gendisk *gd) | 387 | unsigned int cyasblkdev_check_events(struct gendisk *gd, unsigned int clearing) |
388 | { | 388 | { |
389 | struct cyasblkdev_blk_data *bd; | 389 | struct cyasblkdev_blk_data *bd; |
390 | 390 | ||
@@ -402,7 +402,7 @@ int cyasblkdev_media_changed(struct gendisk *gd) | |||
402 | #endif | 402 | #endif |
403 | } | 403 | } |
404 | 404 | ||
405 | /* return media change state "1" yes, 0 no */ | 405 | /* return media change state - DISK_EVENT_MEDIA_CHANGE yes, 0 no */ |
406 | return 0; | 406 | return 0; |
407 | } | 407 | } |
408 | 408 | ||
@@ -432,7 +432,7 @@ static struct block_device_operations cyasblkdev_bdops = { | |||
432 | .ioctl = cyasblkdev_blk_ioctl, | 432 | .ioctl = cyasblkdev_blk_ioctl, |
433 | /* .getgeo = cyasblkdev_blk_getgeo, */ | 433 | /* .getgeo = cyasblkdev_blk_getgeo, */ |
434 | /* added to support media removal( real and simulated) media */ | 434 | /* added to support media removal( real and simulated) media */ |
435 | .media_changed = cyasblkdev_media_changed, | 435 | .check_events = cyasblkdev_check_events, |
436 | /* added to support media removal( real and simulated) media */ | 436 | /* added to support media removal( real and simulated) media */ |
437 | .revalidate_disk = cyasblkdev_revalidate_disk, | 437 | .revalidate_disk = cyasblkdev_revalidate_disk, |
438 | .owner = THIS_MODULE, | 438 | .owner = THIS_MODULE, |
@@ -1090,6 +1090,7 @@ static int cyasblkdev_add_disks(int bus_num, | |||
1090 | bd->user_disk_0->first_minor = devidx << CYASBLKDEV_SHIFT; | 1090 | bd->user_disk_0->first_minor = devidx << CYASBLKDEV_SHIFT; |
1091 | bd->user_disk_0->minors = 8; | 1091 | bd->user_disk_0->minors = 8; |
1092 | bd->user_disk_0->fops = &cyasblkdev_bdops; | 1092 | bd->user_disk_0->fops = &cyasblkdev_bdops; |
1093 | bd->user_disk_0->events = DISK_EVENT_MEDIA_CHANGE; | ||
1093 | bd->user_disk_0->private_data = bd; | 1094 | bd->user_disk_0->private_data = bd; |
1094 | bd->user_disk_0->queue = bd->queue.queue; | 1095 | bd->user_disk_0->queue = bd->queue.queue; |
1095 | bd->dbgprn_flags = DBGPRN_RD_RQ; | 1096 | bd->dbgprn_flags = DBGPRN_RD_RQ; |
@@ -1190,6 +1191,7 @@ static int cyasblkdev_add_disks(int bus_num, | |||
1190 | bd->user_disk_1->first_minor = (devidx + 1) << CYASBLKDEV_SHIFT; | 1191 | bd->user_disk_1->first_minor = (devidx + 1) << CYASBLKDEV_SHIFT; |
1191 | bd->user_disk_1->minors = 8; | 1192 | bd->user_disk_1->minors = 8; |
1192 | bd->user_disk_1->fops = &cyasblkdev_bdops; | 1193 | bd->user_disk_1->fops = &cyasblkdev_bdops; |
1194 | bd->user_disk_0->events = DISK_EVENT_MEDIA_CHANGE; | ||
1193 | bd->user_disk_1->private_data = bd; | 1195 | bd->user_disk_1->private_data = bd; |
1194 | bd->user_disk_1->queue = bd->queue.queue; | 1196 | bd->user_disk_1->queue = bd->queue.queue; |
1195 | bd->dbgprn_flags = DBGPRN_RD_RQ; | 1197 | bd->dbgprn_flags = DBGPRN_RD_RQ; |
@@ -1278,6 +1280,7 @@ static int cyasblkdev_add_disks(int bus_num, | |||
1278 | (devidx + 2) << CYASBLKDEV_SHIFT; | 1280 | (devidx + 2) << CYASBLKDEV_SHIFT; |
1279 | bd->system_disk->minors = 8; | 1281 | bd->system_disk->minors = 8; |
1280 | bd->system_disk->fops = &cyasblkdev_bdops; | 1282 | bd->system_disk->fops = &cyasblkdev_bdops; |
1283 | bd->system_disk->events = DISK_EVENT_MEDIA_CHANGE; | ||
1281 | bd->system_disk->private_data = bd; | 1284 | bd->system_disk->private_data = bd; |
1282 | bd->system_disk->queue = bd->queue.queue; | 1285 | bd->system_disk->queue = bd->queue.queue; |
1283 | /* don't search for vfat | 1286 | /* don't search for vfat |
diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig index f7a5dba3ca23..bf7c687519ef 100644 --- a/drivers/thermal/Kconfig +++ b/drivers/thermal/Kconfig | |||
@@ -4,7 +4,6 @@ | |||
4 | 4 | ||
5 | menuconfig THERMAL | 5 | menuconfig THERMAL |
6 | tristate "Generic Thermal sysfs driver" | 6 | tristate "Generic Thermal sysfs driver" |
7 | depends on NET | ||
8 | help | 7 | help |
9 | Generic Thermal Sysfs driver offers a generic mechanism for | 8 | Generic Thermal Sysfs driver offers a generic mechanism for |
10 | thermal management. Usually it's made up of one or more thermal | 9 | thermal management. Usually it's made up of one or more thermal |
diff --git a/drivers/thermal/thermal_sys.c b/drivers/thermal/thermal_sys.c index 7d0e63c79280..713b7ea4a607 100644 --- a/drivers/thermal/thermal_sys.c +++ b/drivers/thermal/thermal_sys.c | |||
@@ -62,20 +62,6 @@ static DEFINE_MUTEX(thermal_list_lock); | |||
62 | 62 | ||
63 | static unsigned int thermal_event_seqnum; | 63 | static unsigned int thermal_event_seqnum; |
64 | 64 | ||
65 | static struct genl_family thermal_event_genl_family = { | ||
66 | .id = GENL_ID_GENERATE, | ||
67 | .name = THERMAL_GENL_FAMILY_NAME, | ||
68 | .version = THERMAL_GENL_VERSION, | ||
69 | .maxattr = THERMAL_GENL_ATTR_MAX, | ||
70 | }; | ||
71 | |||
72 | static struct genl_multicast_group thermal_event_mcgrp = { | ||
73 | .name = THERMAL_GENL_MCAST_GROUP_NAME, | ||
74 | }; | ||
75 | |||
76 | static int genetlink_init(void); | ||
77 | static void genetlink_exit(void); | ||
78 | |||
79 | static int get_idr(struct idr *idr, struct mutex *lock, int *id) | 65 | static int get_idr(struct idr *idr, struct mutex *lock, int *id) |
80 | { | 66 | { |
81 | int err; | 67 | int err; |
@@ -1225,6 +1211,18 @@ void thermal_zone_device_unregister(struct thermal_zone_device *tz) | |||
1225 | 1211 | ||
1226 | EXPORT_SYMBOL(thermal_zone_device_unregister); | 1212 | EXPORT_SYMBOL(thermal_zone_device_unregister); |
1227 | 1213 | ||
1214 | #ifdef CONFIG_NET | ||
1215 | static struct genl_family thermal_event_genl_family = { | ||
1216 | .id = GENL_ID_GENERATE, | ||
1217 | .name = THERMAL_GENL_FAMILY_NAME, | ||
1218 | .version = THERMAL_GENL_VERSION, | ||
1219 | .maxattr = THERMAL_GENL_ATTR_MAX, | ||
1220 | }; | ||
1221 | |||
1222 | static struct genl_multicast_group thermal_event_mcgrp = { | ||
1223 | .name = THERMAL_GENL_MCAST_GROUP_NAME, | ||
1224 | }; | ||
1225 | |||
1228 | int generate_netlink_event(u32 orig, enum events event) | 1226 | int generate_netlink_event(u32 orig, enum events event) |
1229 | { | 1227 | { |
1230 | struct sk_buff *skb; | 1228 | struct sk_buff *skb; |
@@ -1301,6 +1299,15 @@ static int genetlink_init(void) | |||
1301 | return result; | 1299 | return result; |
1302 | } | 1300 | } |
1303 | 1301 | ||
1302 | static void genetlink_exit(void) | ||
1303 | { | ||
1304 | genl_unregister_family(&thermal_event_genl_family); | ||
1305 | } | ||
1306 | #else /* !CONFIG_NET */ | ||
1307 | static inline int genetlink_init(void) { return 0; } | ||
1308 | static inline void genetlink_exit(void) {} | ||
1309 | #endif /* !CONFIG_NET */ | ||
1310 | |||
1304 | static int __init thermal_init(void) | 1311 | static int __init thermal_init(void) |
1305 | { | 1312 | { |
1306 | int result = 0; | 1313 | int result = 0; |
@@ -1316,11 +1323,6 @@ static int __init thermal_init(void) | |||
1316 | return result; | 1323 | return result; |
1317 | } | 1324 | } |
1318 | 1325 | ||
1319 | static void genetlink_exit(void) | ||
1320 | { | ||
1321 | genl_unregister_family(&thermal_event_genl_family); | ||
1322 | } | ||
1323 | |||
1324 | static void __exit thermal_exit(void) | 1326 | static void __exit thermal_exit(void) |
1325 | { | 1327 | { |
1326 | class_unregister(&thermal_class); | 1328 | class_unregister(&thermal_class); |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index d041c6826e43..0f299b7aad60 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -2681,17 +2681,13 @@ hub_port_init (struct usb_hub *hub, struct usb_device *udev, int port1, | |||
2681 | 2681 | ||
2682 | mutex_lock(&usb_address0_mutex); | 2682 | mutex_lock(&usb_address0_mutex); |
2683 | 2683 | ||
2684 | if (!udev->config && oldspeed == USB_SPEED_SUPER) { | 2684 | /* Reset the device; full speed may morph to high speed */ |
2685 | /* Don't reset USB 3.0 devices during an initial setup */ | 2685 | /* FIXME a USB 2.0 device may morph into SuperSpeed on reset. */ |
2686 | usb_set_device_state(udev, USB_STATE_DEFAULT); | 2686 | retval = hub_port_reset(hub, port1, udev, delay); |
2687 | } else { | 2687 | if (retval < 0) /* error or disconnect */ |
2688 | /* Reset the device; full speed may morph to high speed */ | 2688 | goto fail; |
2689 | /* FIXME a USB 2.0 device may morph into SuperSpeed on reset. */ | 2689 | /* success, speed is known */ |
2690 | retval = hub_port_reset(hub, port1, udev, delay); | 2690 | |
2691 | if (retval < 0) /* error or disconnect */ | ||
2692 | goto fail; | ||
2693 | /* success, speed is known */ | ||
2694 | } | ||
2695 | retval = -ENODEV; | 2691 | retval = -ENODEV; |
2696 | 2692 | ||
2697 | if (oldspeed != USB_SPEED_UNKNOWN && oldspeed != udev->speed) { | 2693 | if (oldspeed != USB_SPEED_UNKNOWN && oldspeed != udev->speed) { |
diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c index 44c595432d6f..81ce6a8e1d94 100644 --- a/drivers/usb/core/quirks.c +++ b/drivers/usb/core/quirks.c | |||
@@ -48,6 +48,10 @@ static const struct usb_device_id usb_quirk_list[] = { | |||
48 | { USB_DEVICE(0x04b4, 0x0526), .driver_info = | 48 | { USB_DEVICE(0x04b4, 0x0526), .driver_info = |
49 | USB_QUIRK_CONFIG_INTF_STRINGS }, | 49 | USB_QUIRK_CONFIG_INTF_STRINGS }, |
50 | 50 | ||
51 | /* Samsung Android phone modem - ID conflict with SPH-I500 */ | ||
52 | { USB_DEVICE(0x04e8, 0x6601), .driver_info = | ||
53 | USB_QUIRK_CONFIG_INTF_STRINGS }, | ||
54 | |||
51 | /* Roland SC-8820 */ | 55 | /* Roland SC-8820 */ |
52 | { USB_DEVICE(0x0582, 0x0007), .driver_info = USB_QUIRK_RESET_RESUME }, | 56 | { USB_DEVICE(0x0582, 0x0007), .driver_info = USB_QUIRK_RESET_RESUME }, |
53 | 57 | ||
@@ -68,6 +72,10 @@ static const struct usb_device_id usb_quirk_list[] = { | |||
68 | /* M-Systems Flash Disk Pioneers */ | 72 | /* M-Systems Flash Disk Pioneers */ |
69 | { USB_DEVICE(0x08ec, 0x1000), .driver_info = USB_QUIRK_RESET_RESUME }, | 73 | { USB_DEVICE(0x08ec, 0x1000), .driver_info = USB_QUIRK_RESET_RESUME }, |
70 | 74 | ||
75 | /* Keytouch QWERTY Panel keyboard */ | ||
76 | { USB_DEVICE(0x0926, 0x3333), .driver_info = | ||
77 | USB_QUIRK_CONFIG_INTF_STRINGS }, | ||
78 | |||
71 | /* X-Rite/Gretag-Macbeth Eye-One Pro display colorimeter */ | 79 | /* X-Rite/Gretag-Macbeth Eye-One Pro display colorimeter */ |
72 | { USB_DEVICE(0x0971, 0x2000), .driver_info = USB_QUIRK_NO_SET_INTF }, | 80 | { USB_DEVICE(0x0971, 0x2000), .driver_info = USB_QUIRK_NO_SET_INTF }, |
73 | 81 | ||
diff --git a/drivers/usb/host/xhci-dbg.c b/drivers/usb/host/xhci-dbg.c index fcbf4abbf381..0231814a97a5 100644 --- a/drivers/usb/host/xhci-dbg.c +++ b/drivers/usb/host/xhci-dbg.c | |||
@@ -169,9 +169,10 @@ static void xhci_print_ports(struct xhci_hcd *xhci) | |||
169 | } | 169 | } |
170 | } | 170 | } |
171 | 171 | ||
172 | void xhci_print_ir_set(struct xhci_hcd *xhci, struct xhci_intr_reg *ir_set, int set_num) | 172 | void xhci_print_ir_set(struct xhci_hcd *xhci, int set_num) |
173 | { | 173 | { |
174 | void *addr; | 174 | struct xhci_intr_reg __iomem *ir_set = &xhci->run_regs->ir_set[set_num]; |
175 | void __iomem *addr; | ||
175 | u32 temp; | 176 | u32 temp; |
176 | u64 temp_64; | 177 | u64 temp_64; |
177 | 178 | ||
@@ -449,7 +450,7 @@ char *xhci_get_slot_state(struct xhci_hcd *xhci, | |||
449 | } | 450 | } |
450 | } | 451 | } |
451 | 452 | ||
452 | void xhci_dbg_slot_ctx(struct xhci_hcd *xhci, struct xhci_container_ctx *ctx) | 453 | static void xhci_dbg_slot_ctx(struct xhci_hcd *xhci, struct xhci_container_ctx *ctx) |
453 | { | 454 | { |
454 | /* Fields are 32 bits wide, DMA addresses are in bytes */ | 455 | /* Fields are 32 bits wide, DMA addresses are in bytes */ |
455 | int field_size = 32 / 8; | 456 | int field_size = 32 / 8; |
@@ -488,7 +489,7 @@ void xhci_dbg_slot_ctx(struct xhci_hcd *xhci, struct xhci_container_ctx *ctx) | |||
488 | dbg_rsvd64(xhci, (u64 *)slot_ctx, dma); | 489 | dbg_rsvd64(xhci, (u64 *)slot_ctx, dma); |
489 | } | 490 | } |
490 | 491 | ||
491 | void xhci_dbg_ep_ctx(struct xhci_hcd *xhci, | 492 | static void xhci_dbg_ep_ctx(struct xhci_hcd *xhci, |
492 | struct xhci_container_ctx *ctx, | 493 | struct xhci_container_ctx *ctx, |
493 | unsigned int last_ep) | 494 | unsigned int last_ep) |
494 | { | 495 | { |
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index 1d0f45f0e7a6..a9534396e85b 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c | |||
@@ -307,7 +307,7 @@ struct xhci_ep_ctx *xhci_get_ep_ctx(struct xhci_hcd *xhci, | |||
307 | 307 | ||
308 | /***************** Streams structures manipulation *************************/ | 308 | /***************** Streams structures manipulation *************************/ |
309 | 309 | ||
310 | void xhci_free_stream_ctx(struct xhci_hcd *xhci, | 310 | static void xhci_free_stream_ctx(struct xhci_hcd *xhci, |
311 | unsigned int num_stream_ctxs, | 311 | unsigned int num_stream_ctxs, |
312 | struct xhci_stream_ctx *stream_ctx, dma_addr_t dma) | 312 | struct xhci_stream_ctx *stream_ctx, dma_addr_t dma) |
313 | { | 313 | { |
@@ -335,7 +335,7 @@ void xhci_free_stream_ctx(struct xhci_hcd *xhci, | |||
335 | * The stream context array must be a power of 2, and can be as small as | 335 | * The stream context array must be a power of 2, and can be as small as |
336 | * 64 bytes or as large as 1MB. | 336 | * 64 bytes or as large as 1MB. |
337 | */ | 337 | */ |
338 | struct xhci_stream_ctx *xhci_alloc_stream_ctx(struct xhci_hcd *xhci, | 338 | static struct xhci_stream_ctx *xhci_alloc_stream_ctx(struct xhci_hcd *xhci, |
339 | unsigned int num_stream_ctxs, dma_addr_t *dma, | 339 | unsigned int num_stream_ctxs, dma_addr_t *dma, |
340 | gfp_t mem_flags) | 340 | gfp_t mem_flags) |
341 | { | 341 | { |
@@ -1900,11 +1900,11 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) | |||
1900 | val &= DBOFF_MASK; | 1900 | val &= DBOFF_MASK; |
1901 | xhci_dbg(xhci, "// Doorbell array is located at offset 0x%x" | 1901 | xhci_dbg(xhci, "// Doorbell array is located at offset 0x%x" |
1902 | " from cap regs base addr\n", val); | 1902 | " from cap regs base addr\n", val); |
1903 | xhci->dba = (void *) xhci->cap_regs + val; | 1903 | xhci->dba = (void __iomem *) xhci->cap_regs + val; |
1904 | xhci_dbg_regs(xhci); | 1904 | xhci_dbg_regs(xhci); |
1905 | xhci_print_run_regs(xhci); | 1905 | xhci_print_run_regs(xhci); |
1906 | /* Set ir_set to interrupt register set 0 */ | 1906 | /* Set ir_set to interrupt register set 0 */ |
1907 | xhci->ir_set = (void *) xhci->run_regs->ir_set; | 1907 | xhci->ir_set = &xhci->run_regs->ir_set[0]; |
1908 | 1908 | ||
1909 | /* | 1909 | /* |
1910 | * Event ring setup: Allocate a normal ring, but also setup | 1910 | * Event ring setup: Allocate a normal ring, but also setup |
@@ -1961,7 +1961,7 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) | |||
1961 | /* Set the event ring dequeue address */ | 1961 | /* Set the event ring dequeue address */ |
1962 | xhci_set_hc_event_deq(xhci); | 1962 | xhci_set_hc_event_deq(xhci); |
1963 | xhci_dbg(xhci, "Wrote ERST address to ir_set 0.\n"); | 1963 | xhci_dbg(xhci, "Wrote ERST address to ir_set 0.\n"); |
1964 | xhci_print_ir_set(xhci, xhci->ir_set, 0); | 1964 | xhci_print_ir_set(xhci, 0); |
1965 | 1965 | ||
1966 | /* | 1966 | /* |
1967 | * XXX: Might need to set the Interrupter Moderation Register to | 1967 | * XXX: Might need to set the Interrupter Moderation Register to |
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 3e8211c1ce5a..3289bf4832c9 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c | |||
@@ -474,8 +474,11 @@ void xhci_find_new_dequeue_state(struct xhci_hcd *xhci, | |||
474 | state->new_deq_seg = find_trb_seg(cur_td->start_seg, | 474 | state->new_deq_seg = find_trb_seg(cur_td->start_seg, |
475 | dev->eps[ep_index].stopped_trb, | 475 | dev->eps[ep_index].stopped_trb, |
476 | &state->new_cycle_state); | 476 | &state->new_cycle_state); |
477 | if (!state->new_deq_seg) | 477 | if (!state->new_deq_seg) { |
478 | BUG(); | 478 | WARN_ON(1); |
479 | return; | ||
480 | } | ||
481 | |||
479 | /* Dig out the cycle state saved by the xHC during the stop ep cmd */ | 482 | /* Dig out the cycle state saved by the xHC during the stop ep cmd */ |
480 | xhci_dbg(xhci, "Finding endpoint context\n"); | 483 | xhci_dbg(xhci, "Finding endpoint context\n"); |
481 | ep_ctx = xhci_get_ep_ctx(xhci, dev->out_ctx, ep_index); | 484 | ep_ctx = xhci_get_ep_ctx(xhci, dev->out_ctx, ep_index); |
@@ -486,8 +489,10 @@ void xhci_find_new_dequeue_state(struct xhci_hcd *xhci, | |||
486 | state->new_deq_seg = find_trb_seg(state->new_deq_seg, | 489 | state->new_deq_seg = find_trb_seg(state->new_deq_seg, |
487 | state->new_deq_ptr, | 490 | state->new_deq_ptr, |
488 | &state->new_cycle_state); | 491 | &state->new_cycle_state); |
489 | if (!state->new_deq_seg) | 492 | if (!state->new_deq_seg) { |
490 | BUG(); | 493 | WARN_ON(1); |
494 | return; | ||
495 | } | ||
491 | 496 | ||
492 | trb = &state->new_deq_ptr->generic; | 497 | trb = &state->new_deq_ptr->generic; |
493 | if ((trb->field[3] & TRB_TYPE_BITMASK) == TRB_TYPE(TRB_LINK) && | 498 | if ((trb->field[3] & TRB_TYPE_BITMASK) == TRB_TYPE(TRB_LINK) && |
@@ -2363,12 +2368,13 @@ static unsigned int count_sg_trbs_needed(struct xhci_hcd *xhci, struct urb *urb) | |||
2363 | 2368 | ||
2364 | /* Scatter gather list entries may cross 64KB boundaries */ | 2369 | /* Scatter gather list entries may cross 64KB boundaries */ |
2365 | running_total = TRB_MAX_BUFF_SIZE - | 2370 | running_total = TRB_MAX_BUFF_SIZE - |
2366 | (sg_dma_address(sg) & ((1 << TRB_MAX_BUFF_SHIFT) - 1)); | 2371 | (sg_dma_address(sg) & (TRB_MAX_BUFF_SIZE - 1)); |
2372 | running_total &= TRB_MAX_BUFF_SIZE - 1; | ||
2367 | if (running_total != 0) | 2373 | if (running_total != 0) |
2368 | num_trbs++; | 2374 | num_trbs++; |
2369 | 2375 | ||
2370 | /* How many more 64KB chunks to transfer, how many more TRBs? */ | 2376 | /* How many more 64KB chunks to transfer, how many more TRBs? */ |
2371 | while (running_total < sg_dma_len(sg)) { | 2377 | while (running_total < sg_dma_len(sg) && running_total < temp) { |
2372 | num_trbs++; | 2378 | num_trbs++; |
2373 | running_total += TRB_MAX_BUFF_SIZE; | 2379 | running_total += TRB_MAX_BUFF_SIZE; |
2374 | } | 2380 | } |
@@ -2394,11 +2400,11 @@ static unsigned int count_sg_trbs_needed(struct xhci_hcd *xhci, struct urb *urb) | |||
2394 | static void check_trb_math(struct urb *urb, int num_trbs, int running_total) | 2400 | static void check_trb_math(struct urb *urb, int num_trbs, int running_total) |
2395 | { | 2401 | { |
2396 | if (num_trbs != 0) | 2402 | if (num_trbs != 0) |
2397 | dev_dbg(&urb->dev->dev, "%s - ep %#x - Miscalculated number of " | 2403 | dev_err(&urb->dev->dev, "%s - ep %#x - Miscalculated number of " |
2398 | "TRBs, %d left\n", __func__, | 2404 | "TRBs, %d left\n", __func__, |
2399 | urb->ep->desc.bEndpointAddress, num_trbs); | 2405 | urb->ep->desc.bEndpointAddress, num_trbs); |
2400 | if (running_total != urb->transfer_buffer_length) | 2406 | if (running_total != urb->transfer_buffer_length) |
2401 | dev_dbg(&urb->dev->dev, "%s - ep %#x - Miscalculated tx length, " | 2407 | dev_err(&urb->dev->dev, "%s - ep %#x - Miscalculated tx length, " |
2402 | "queued %#x (%d), asked for %#x (%d)\n", | 2408 | "queued %#x (%d), asked for %#x (%d)\n", |
2403 | __func__, | 2409 | __func__, |
2404 | urb->ep->desc.bEndpointAddress, | 2410 | urb->ep->desc.bEndpointAddress, |
@@ -2533,8 +2539,7 @@ static int queue_bulk_sg_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2533 | sg = urb->sg; | 2539 | sg = urb->sg; |
2534 | addr = (u64) sg_dma_address(sg); | 2540 | addr = (u64) sg_dma_address(sg); |
2535 | this_sg_len = sg_dma_len(sg); | 2541 | this_sg_len = sg_dma_len(sg); |
2536 | trb_buff_len = TRB_MAX_BUFF_SIZE - | 2542 | trb_buff_len = TRB_MAX_BUFF_SIZE - (addr & (TRB_MAX_BUFF_SIZE - 1)); |
2537 | (addr & ((1 << TRB_MAX_BUFF_SHIFT) - 1)); | ||
2538 | trb_buff_len = min_t(int, trb_buff_len, this_sg_len); | 2543 | trb_buff_len = min_t(int, trb_buff_len, this_sg_len); |
2539 | if (trb_buff_len > urb->transfer_buffer_length) | 2544 | if (trb_buff_len > urb->transfer_buffer_length) |
2540 | trb_buff_len = urb->transfer_buffer_length; | 2545 | trb_buff_len = urb->transfer_buffer_length; |
@@ -2572,7 +2577,7 @@ static int queue_bulk_sg_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2572 | (unsigned int) (addr + TRB_MAX_BUFF_SIZE) & ~(TRB_MAX_BUFF_SIZE - 1), | 2577 | (unsigned int) (addr + TRB_MAX_BUFF_SIZE) & ~(TRB_MAX_BUFF_SIZE - 1), |
2573 | (unsigned int) addr + trb_buff_len); | 2578 | (unsigned int) addr + trb_buff_len); |
2574 | if (TRB_MAX_BUFF_SIZE - | 2579 | if (TRB_MAX_BUFF_SIZE - |
2575 | (addr & ((1 << TRB_MAX_BUFF_SHIFT) - 1)) < trb_buff_len) { | 2580 | (addr & (TRB_MAX_BUFF_SIZE - 1)) < trb_buff_len) { |
2576 | xhci_warn(xhci, "WARN: sg dma xfer crosses 64KB boundaries!\n"); | 2581 | xhci_warn(xhci, "WARN: sg dma xfer crosses 64KB boundaries!\n"); |
2577 | xhci_dbg(xhci, "Next boundary at %#x, end dma = %#x\n", | 2582 | xhci_dbg(xhci, "Next boundary at %#x, end dma = %#x\n", |
2578 | (unsigned int) (addr + TRB_MAX_BUFF_SIZE) & ~(TRB_MAX_BUFF_SIZE - 1), | 2583 | (unsigned int) (addr + TRB_MAX_BUFF_SIZE) & ~(TRB_MAX_BUFF_SIZE - 1), |
@@ -2616,7 +2621,7 @@ static int queue_bulk_sg_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2616 | } | 2621 | } |
2617 | 2622 | ||
2618 | trb_buff_len = TRB_MAX_BUFF_SIZE - | 2623 | trb_buff_len = TRB_MAX_BUFF_SIZE - |
2619 | (addr & ((1 << TRB_MAX_BUFF_SHIFT) - 1)); | 2624 | (addr & (TRB_MAX_BUFF_SIZE - 1)); |
2620 | trb_buff_len = min_t(int, trb_buff_len, this_sg_len); | 2625 | trb_buff_len = min_t(int, trb_buff_len, this_sg_len); |
2621 | if (running_total + trb_buff_len > urb->transfer_buffer_length) | 2626 | if (running_total + trb_buff_len > urb->transfer_buffer_length) |
2622 | trb_buff_len = | 2627 | trb_buff_len = |
@@ -2656,7 +2661,8 @@ int xhci_queue_bulk_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2656 | num_trbs = 0; | 2661 | num_trbs = 0; |
2657 | /* How much data is (potentially) left before the 64KB boundary? */ | 2662 | /* How much data is (potentially) left before the 64KB boundary? */ |
2658 | running_total = TRB_MAX_BUFF_SIZE - | 2663 | running_total = TRB_MAX_BUFF_SIZE - |
2659 | (urb->transfer_dma & ((1 << TRB_MAX_BUFF_SHIFT) - 1)); | 2664 | (urb->transfer_dma & (TRB_MAX_BUFF_SIZE - 1)); |
2665 | running_total &= TRB_MAX_BUFF_SIZE - 1; | ||
2660 | 2666 | ||
2661 | /* If there's some data on this 64KB chunk, or we have to send a | 2667 | /* If there's some data on this 64KB chunk, or we have to send a |
2662 | * zero-length transfer, we need at least one TRB | 2668 | * zero-length transfer, we need at least one TRB |
@@ -2700,8 +2706,8 @@ int xhci_queue_bulk_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2700 | /* How much data is in the first TRB? */ | 2706 | /* How much data is in the first TRB? */ |
2701 | addr = (u64) urb->transfer_dma; | 2707 | addr = (u64) urb->transfer_dma; |
2702 | trb_buff_len = TRB_MAX_BUFF_SIZE - | 2708 | trb_buff_len = TRB_MAX_BUFF_SIZE - |
2703 | (urb->transfer_dma & ((1 << TRB_MAX_BUFF_SHIFT) - 1)); | 2709 | (urb->transfer_dma & (TRB_MAX_BUFF_SIZE - 1)); |
2704 | if (urb->transfer_buffer_length < trb_buff_len) | 2710 | if (trb_buff_len > urb->transfer_buffer_length) |
2705 | trb_buff_len = urb->transfer_buffer_length; | 2711 | trb_buff_len = urb->transfer_buffer_length; |
2706 | 2712 | ||
2707 | first_trb = true; | 2713 | first_trb = true; |
@@ -2879,8 +2885,8 @@ static int count_isoc_trbs_needed(struct xhci_hcd *xhci, | |||
2879 | addr = (u64) (urb->transfer_dma + urb->iso_frame_desc[i].offset); | 2885 | addr = (u64) (urb->transfer_dma + urb->iso_frame_desc[i].offset); |
2880 | td_len = urb->iso_frame_desc[i].length; | 2886 | td_len = urb->iso_frame_desc[i].length; |
2881 | 2887 | ||
2882 | running_total = TRB_MAX_BUFF_SIZE - | 2888 | running_total = TRB_MAX_BUFF_SIZE - (addr & (TRB_MAX_BUFF_SIZE - 1)); |
2883 | (addr & ((1 << TRB_MAX_BUFF_SHIFT) - 1)); | 2889 | running_total &= TRB_MAX_BUFF_SIZE - 1; |
2884 | if (running_total != 0) | 2890 | if (running_total != 0) |
2885 | num_trbs++; | 2891 | num_trbs++; |
2886 | 2892 | ||
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 34cf4e165877..2083fc2179b2 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
@@ -109,7 +109,7 @@ int xhci_halt(struct xhci_hcd *xhci) | |||
109 | /* | 109 | /* |
110 | * Set the run bit and wait for the host to be running. | 110 | * Set the run bit and wait for the host to be running. |
111 | */ | 111 | */ |
112 | int xhci_start(struct xhci_hcd *xhci) | 112 | static int xhci_start(struct xhci_hcd *xhci) |
113 | { | 113 | { |
114 | u32 temp; | 114 | u32 temp; |
115 | int ret; | 115 | int ret; |
@@ -329,7 +329,7 @@ int xhci_init(struct usb_hcd *hcd) | |||
329 | 329 | ||
330 | 330 | ||
331 | #ifdef CONFIG_USB_XHCI_HCD_DEBUGGING | 331 | #ifdef CONFIG_USB_XHCI_HCD_DEBUGGING |
332 | void xhci_event_ring_work(unsigned long arg) | 332 | static void xhci_event_ring_work(unsigned long arg) |
333 | { | 333 | { |
334 | unsigned long flags; | 334 | unsigned long flags; |
335 | int temp; | 335 | int temp; |
@@ -473,7 +473,7 @@ int xhci_run(struct usb_hcd *hcd) | |||
473 | xhci->ir_set, (unsigned int) ER_IRQ_ENABLE(temp)); | 473 | xhci->ir_set, (unsigned int) ER_IRQ_ENABLE(temp)); |
474 | xhci_writel(xhci, ER_IRQ_ENABLE(temp), | 474 | xhci_writel(xhci, ER_IRQ_ENABLE(temp), |
475 | &xhci->ir_set->irq_pending); | 475 | &xhci->ir_set->irq_pending); |
476 | xhci_print_ir_set(xhci, xhci->ir_set, 0); | 476 | xhci_print_ir_set(xhci, 0); |
477 | 477 | ||
478 | if (NUM_TEST_NOOPS > 0) | 478 | if (NUM_TEST_NOOPS > 0) |
479 | doorbell = xhci_setup_one_noop(xhci); | 479 | doorbell = xhci_setup_one_noop(xhci); |
@@ -528,7 +528,7 @@ void xhci_stop(struct usb_hcd *hcd) | |||
528 | temp = xhci_readl(xhci, &xhci->ir_set->irq_pending); | 528 | temp = xhci_readl(xhci, &xhci->ir_set->irq_pending); |
529 | xhci_writel(xhci, ER_IRQ_DISABLE(temp), | 529 | xhci_writel(xhci, ER_IRQ_DISABLE(temp), |
530 | &xhci->ir_set->irq_pending); | 530 | &xhci->ir_set->irq_pending); |
531 | xhci_print_ir_set(xhci, xhci->ir_set, 0); | 531 | xhci_print_ir_set(xhci, 0); |
532 | 532 | ||
533 | xhci_dbg(xhci, "cleaning up memory\n"); | 533 | xhci_dbg(xhci, "cleaning up memory\n"); |
534 | xhci_mem_cleanup(xhci); | 534 | xhci_mem_cleanup(xhci); |
@@ -755,7 +755,7 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) | |||
755 | temp = xhci_readl(xhci, &xhci->ir_set->irq_pending); | 755 | temp = xhci_readl(xhci, &xhci->ir_set->irq_pending); |
756 | xhci_writel(xhci, ER_IRQ_DISABLE(temp), | 756 | xhci_writel(xhci, ER_IRQ_DISABLE(temp), |
757 | &xhci->ir_set->irq_pending); | 757 | &xhci->ir_set->irq_pending); |
758 | xhci_print_ir_set(xhci, xhci->ir_set, 0); | 758 | xhci_print_ir_set(xhci, 0); |
759 | 759 | ||
760 | xhci_dbg(xhci, "cleaning up memory\n"); | 760 | xhci_dbg(xhci, "cleaning up memory\n"); |
761 | xhci_mem_cleanup(xhci); | 761 | xhci_mem_cleanup(xhci); |
@@ -857,7 +857,7 @@ unsigned int xhci_last_valid_endpoint(u32 added_ctxs) | |||
857 | /* Returns 1 if the arguments are OK; | 857 | /* Returns 1 if the arguments are OK; |
858 | * returns 0 this is a root hub; returns -EINVAL for NULL pointers. | 858 | * returns 0 this is a root hub; returns -EINVAL for NULL pointers. |
859 | */ | 859 | */ |
860 | int xhci_check_args(struct usb_hcd *hcd, struct usb_device *udev, | 860 | static int xhci_check_args(struct usb_hcd *hcd, struct usb_device *udev, |
861 | struct usb_host_endpoint *ep, int check_ep, bool check_virt_dev, | 861 | struct usb_host_endpoint *ep, int check_ep, bool check_virt_dev, |
862 | const char *func) { | 862 | const char *func) { |
863 | struct xhci_hcd *xhci; | 863 | struct xhci_hcd *xhci; |
@@ -1693,7 +1693,7 @@ static void xhci_setup_input_ctx_for_config_ep(struct xhci_hcd *xhci, | |||
1693 | xhci_dbg_ctx(xhci, in_ctx, xhci_last_valid_endpoint(add_flags)); | 1693 | xhci_dbg_ctx(xhci, in_ctx, xhci_last_valid_endpoint(add_flags)); |
1694 | } | 1694 | } |
1695 | 1695 | ||
1696 | void xhci_setup_input_ctx_for_quirk(struct xhci_hcd *xhci, | 1696 | static void xhci_setup_input_ctx_for_quirk(struct xhci_hcd *xhci, |
1697 | unsigned int slot_id, unsigned int ep_index, | 1697 | unsigned int slot_id, unsigned int ep_index, |
1698 | struct xhci_dequeue_state *deq_state) | 1698 | struct xhci_dequeue_state *deq_state) |
1699 | { | 1699 | { |
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index 7f236fd22015..7f127df6dd55 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h | |||
@@ -1348,7 +1348,7 @@ static inline int xhci_link_trb_quirk(struct xhci_hcd *xhci) | |||
1348 | } | 1348 | } |
1349 | 1349 | ||
1350 | /* xHCI debugging */ | 1350 | /* xHCI debugging */ |
1351 | void xhci_print_ir_set(struct xhci_hcd *xhci, struct xhci_intr_reg *ir_set, int set_num); | 1351 | void xhci_print_ir_set(struct xhci_hcd *xhci, int set_num); |
1352 | void xhci_print_registers(struct xhci_hcd *xhci); | 1352 | void xhci_print_registers(struct xhci_hcd *xhci); |
1353 | void xhci_dbg_regs(struct xhci_hcd *xhci); | 1353 | void xhci_dbg_regs(struct xhci_hcd *xhci); |
1354 | void xhci_print_run_regs(struct xhci_hcd *xhci); | 1354 | void xhci_print_run_regs(struct xhci_hcd *xhci); |
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 54a8bd1047d6..c292d5c499e7 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c | |||
@@ -1864,6 +1864,7 @@ allocate_instance(struct device *dev, | |||
1864 | INIT_LIST_HEAD(&musb->out_bulk); | 1864 | INIT_LIST_HEAD(&musb->out_bulk); |
1865 | 1865 | ||
1866 | hcd->uses_new_polling = 1; | 1866 | hcd->uses_new_polling = 1; |
1867 | hcd->has_tt = 1; | ||
1867 | 1868 | ||
1868 | musb->vbuserr_retry = VBUSERR_RETRY_COUNT; | 1869 | musb->vbuserr_retry = VBUSERR_RETRY_COUNT; |
1869 | musb->a_wait_bcon = OTG_TIME_A_WAIT_BCON; | 1870 | musb->a_wait_bcon = OTG_TIME_A_WAIT_BCON; |
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h index d74a8113ae74..e6400be8a0f8 100644 --- a/drivers/usb/musb/musb_core.h +++ b/drivers/usb/musb/musb_core.h | |||
@@ -488,6 +488,15 @@ struct musb { | |||
488 | unsigned set_address:1; | 488 | unsigned set_address:1; |
489 | unsigned test_mode:1; | 489 | unsigned test_mode:1; |
490 | unsigned softconnect:1; | 490 | unsigned softconnect:1; |
491 | |||
492 | u8 address; | ||
493 | u8 test_mode_nr; | ||
494 | u16 ackpend; /* ep0 */ | ||
495 | enum musb_g_ep0_state ep0_state; | ||
496 | struct usb_gadget g; /* the gadget */ | ||
497 | struct usb_gadget_driver *gadget_driver; /* its driver */ | ||
498 | #endif | ||
499 | |||
491 | /* | 500 | /* |
492 | * FIXME: Remove this flag. | 501 | * FIXME: Remove this flag. |
493 | * | 502 | * |
@@ -501,14 +510,6 @@ struct musb { | |||
501 | */ | 510 | */ |
502 | unsigned double_buffer_not_ok:1 __deprecated; | 511 | unsigned double_buffer_not_ok:1 __deprecated; |
503 | 512 | ||
504 | u8 address; | ||
505 | u8 test_mode_nr; | ||
506 | u16 ackpend; /* ep0 */ | ||
507 | enum musb_g_ep0_state ep0_state; | ||
508 | struct usb_gadget g; /* the gadget */ | ||
509 | struct usb_gadget_driver *gadget_driver; /* its driver */ | ||
510 | #endif | ||
511 | |||
512 | struct musb_hdrc_config *config; | 513 | struct musb_hdrc_config *config; |
513 | 514 | ||
514 | #ifdef MUSB_CONFIG_PROC_FS | 515 | #ifdef MUSB_CONFIG_PROC_FS |
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c index a3f12333fc41..bc8badd16897 100644 --- a/drivers/usb/musb/omap2430.c +++ b/drivers/usb/musb/omap2430.c | |||
@@ -362,6 +362,7 @@ static int omap2430_musb_init(struct musb *musb) | |||
362 | 362 | ||
363 | static int omap2430_musb_exit(struct musb *musb) | 363 | static int omap2430_musb_exit(struct musb *musb) |
364 | { | 364 | { |
365 | del_timer_sync(&musb_idle_timer); | ||
365 | 366 | ||
366 | omap2430_low_level_exit(musb); | 367 | omap2430_low_level_exit(musb); |
367 | otg_put_transceiver(musb->xceiv); | 368 | otg_put_transceiver(musb->xceiv); |
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c index 7481ff8a49e4..0457813eebee 100644 --- a/drivers/usb/serial/sierra.c +++ b/drivers/usb/serial/sierra.c | |||
@@ -301,6 +301,9 @@ static const struct usb_device_id id_table[] = { | |||
301 | { USB_DEVICE(0x1199, 0x68A3), /* Sierra Wireless Direct IP modems */ | 301 | { USB_DEVICE(0x1199, 0x68A3), /* Sierra Wireless Direct IP modems */ |
302 | .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist | 302 | .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist |
303 | }, | 303 | }, |
304 | { USB_DEVICE(0x0f3d, 0x68A3), /* Airprime/Sierra Wireless Direct IP modems */ | ||
305 | .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist | ||
306 | }, | ||
304 | { USB_DEVICE(0x413C, 0x08133) }, /* Dell Computer Corp. Wireless 5720 VZW Mobile Broadband (EVDO Rev-A) Minicard GPS Port */ | 307 | { USB_DEVICE(0x413C, 0x08133) }, /* Dell Computer Corp. Wireless 5720 VZW Mobile Broadband (EVDO Rev-A) Minicard GPS Port */ |
305 | 308 | ||
306 | { } | 309 | { } |
diff --git a/drivers/usb/serial/usb_wwan.c b/drivers/usb/serial/usb_wwan.c index b004b2a485c3..9c014e2ecd68 100644 --- a/drivers/usb/serial/usb_wwan.c +++ b/drivers/usb/serial/usb_wwan.c | |||
@@ -295,12 +295,15 @@ static void usb_wwan_indat_callback(struct urb *urb) | |||
295 | __func__, status, endpoint); | 295 | __func__, status, endpoint); |
296 | } else { | 296 | } else { |
297 | tty = tty_port_tty_get(&port->port); | 297 | tty = tty_port_tty_get(&port->port); |
298 | if (urb->actual_length) { | 298 | if (tty) { |
299 | tty_insert_flip_string(tty, data, urb->actual_length); | 299 | if (urb->actual_length) { |
300 | tty_flip_buffer_push(tty); | 300 | tty_insert_flip_string(tty, data, |
301 | } else | 301 | urb->actual_length); |
302 | dbg("%s: empty read urb received", __func__); | 302 | tty_flip_buffer_push(tty); |
303 | tty_kref_put(tty); | 303 | } else |
304 | dbg("%s: empty read urb received", __func__); | ||
305 | tty_kref_put(tty); | ||
306 | } | ||
304 | 307 | ||
305 | /* Resubmit urb so we continue receiving */ | 308 | /* Resubmit urb so we continue receiving */ |
306 | if (status != -ESHUTDOWN) { | 309 | if (status != -ESHUTDOWN) { |
diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c index 15a5d89b7f39..1c11959a7d58 100644 --- a/drivers/usb/serial/visor.c +++ b/drivers/usb/serial/visor.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/uaccess.h> | 27 | #include <linux/uaccess.h> |
28 | #include <linux/usb.h> | 28 | #include <linux/usb.h> |
29 | #include <linux/usb/serial.h> | 29 | #include <linux/usb/serial.h> |
30 | #include <linux/usb/cdc.h> | ||
30 | #include "visor.h" | 31 | #include "visor.h" |
31 | 32 | ||
32 | /* | 33 | /* |
@@ -479,6 +480,17 @@ static int visor_probe(struct usb_serial *serial, | |||
479 | 480 | ||
480 | dbg("%s", __func__); | 481 | dbg("%s", __func__); |
481 | 482 | ||
483 | /* | ||
484 | * some Samsung Android phones in modem mode have the same ID | ||
485 | * as SPH-I500, but they are ACM devices, so dont bind to them | ||
486 | */ | ||
487 | if (id->idVendor == SAMSUNG_VENDOR_ID && | ||
488 | id->idProduct == SAMSUNG_SPH_I500_ID && | ||
489 | serial->dev->descriptor.bDeviceClass == USB_CLASS_COMM && | ||
490 | serial->dev->descriptor.bDeviceSubClass == | ||
491 | USB_CDC_SUBCLASS_ACM) | ||
492 | return -ENODEV; | ||
493 | |||
482 | if (serial->dev->actconfig->desc.bConfigurationValue != 1) { | 494 | if (serial->dev->actconfig->desc.bConfigurationValue != 1) { |
483 | dev_err(&serial->dev->dev, "active config #%d != 1 ??\n", | 495 | dev_err(&serial->dev->dev, "active config #%d != 1 ??\n", |
484 | serial->dev->actconfig->desc.bConfigurationValue); | 496 | serial->dev->actconfig->desc.bConfigurationValue); |
diff --git a/fs/afs/write.c b/fs/afs/write.c index 15690bb1d3b5..789b3afb3423 100644 --- a/fs/afs/write.c +++ b/fs/afs/write.c | |||
@@ -140,6 +140,7 @@ int afs_write_begin(struct file *file, struct address_space *mapping, | |||
140 | candidate->first = candidate->last = index; | 140 | candidate->first = candidate->last = index; |
141 | candidate->offset_first = from; | 141 | candidate->offset_first = from; |
142 | candidate->to_last = to; | 142 | candidate->to_last = to; |
143 | INIT_LIST_HEAD(&candidate->link); | ||
143 | candidate->usage = 1; | 144 | candidate->usage = 1; |
144 | candidate->state = AFS_WBACK_PENDING; | 145 | candidate->state = AFS_WBACK_PENDING; |
145 | init_waitqueue_head(&candidate->waitq); | 146 | init_waitqueue_head(&candidate->waitq); |
@@ -228,15 +228,23 @@ static void __put_ioctx(struct kioctx *ctx) | |||
228 | call_rcu(&ctx->rcu_head, ctx_rcu_free); | 228 | call_rcu(&ctx->rcu_head, ctx_rcu_free); |
229 | } | 229 | } |
230 | 230 | ||
231 | #define get_ioctx(kioctx) do { \ | 231 | static inline void get_ioctx(struct kioctx *kioctx) |
232 | BUG_ON(atomic_read(&(kioctx)->users) <= 0); \ | 232 | { |
233 | atomic_inc(&(kioctx)->users); \ | 233 | BUG_ON(atomic_read(&kioctx->users) <= 0); |
234 | } while (0) | 234 | atomic_inc(&kioctx->users); |
235 | #define put_ioctx(kioctx) do { \ | 235 | } |
236 | BUG_ON(atomic_read(&(kioctx)->users) <= 0); \ | 236 | |
237 | if (unlikely(atomic_dec_and_test(&(kioctx)->users))) \ | 237 | static inline int try_get_ioctx(struct kioctx *kioctx) |
238 | __put_ioctx(kioctx); \ | 238 | { |
239 | } while (0) | 239 | return atomic_inc_not_zero(&kioctx->users); |
240 | } | ||
241 | |||
242 | static inline void put_ioctx(struct kioctx *kioctx) | ||
243 | { | ||
244 | BUG_ON(atomic_read(&kioctx->users) <= 0); | ||
245 | if (unlikely(atomic_dec_and_test(&kioctx->users))) | ||
246 | __put_ioctx(kioctx); | ||
247 | } | ||
240 | 248 | ||
241 | /* ioctx_alloc | 249 | /* ioctx_alloc |
242 | * Allocates and initializes an ioctx. Returns an ERR_PTR if it failed. | 250 | * Allocates and initializes an ioctx. Returns an ERR_PTR if it failed. |
@@ -590,8 +598,13 @@ static struct kioctx *lookup_ioctx(unsigned long ctx_id) | |||
590 | rcu_read_lock(); | 598 | rcu_read_lock(); |
591 | 599 | ||
592 | hlist_for_each_entry_rcu(ctx, n, &mm->ioctx_list, list) { | 600 | hlist_for_each_entry_rcu(ctx, n, &mm->ioctx_list, list) { |
593 | if (ctx->user_id == ctx_id && !ctx->dead) { | 601 | /* |
594 | get_ioctx(ctx); | 602 | * RCU protects us against accessing freed memory but |
603 | * we have to be careful not to get a reference when the | ||
604 | * reference count already dropped to 0 (ctx->dead test | ||
605 | * is unreliable because of races). | ||
606 | */ | ||
607 | if (ctx->user_id == ctx_id && !ctx->dead && try_get_ioctx(ctx)){ | ||
595 | ret = ctx; | 608 | ret = ctx; |
596 | break; | 609 | break; |
597 | } | 610 | } |
@@ -1569,6 +1582,23 @@ static int io_submit_one(struct kioctx *ctx, struct iocb __user *user_iocb, | |||
1569 | goto out_put_req; | 1582 | goto out_put_req; |
1570 | 1583 | ||
1571 | spin_lock_irq(&ctx->ctx_lock); | 1584 | spin_lock_irq(&ctx->ctx_lock); |
1585 | /* | ||
1586 | * We could have raced with io_destroy() and are currently holding a | ||
1587 | * reference to ctx which should be destroyed. We cannot submit IO | ||
1588 | * since ctx gets freed as soon as io_submit() puts its reference. The | ||
1589 | * check here is reliable: io_destroy() sets ctx->dead before waiting | ||
1590 | * for outstanding IO and the barrier between these two is realized by | ||
1591 | * unlock of mm->ioctx_lock and lock of ctx->ctx_lock. Analogously we | ||
1592 | * increment ctx->reqs_active before checking for ctx->dead and the | ||
1593 | * barrier is realized by unlock and lock of ctx->ctx_lock. Thus if we | ||
1594 | * don't see ctx->dead set here, io_destroy() waits for our IO to | ||
1595 | * finish. | ||
1596 | */ | ||
1597 | if (ctx->dead) { | ||
1598 | spin_unlock_irq(&ctx->ctx_lock); | ||
1599 | ret = -EINVAL; | ||
1600 | goto out_put_req; | ||
1601 | } | ||
1572 | aio_run_iocb(req); | 1602 | aio_run_iocb(req); |
1573 | if (!list_empty(&ctx->run_list)) { | 1603 | if (!list_empty(&ctx->run_list)) { |
1574 | /* drain the run list */ | 1604 | /* drain the run list */ |
@@ -43,7 +43,7 @@ static mempool_t *bio_split_pool __read_mostly; | |||
43 | * unsigned short | 43 | * unsigned short |
44 | */ | 44 | */ |
45 | #define BV(x) { .nr_vecs = x, .name = "biovec-"__stringify(x) } | 45 | #define BV(x) { .nr_vecs = x, .name = "biovec-"__stringify(x) } |
46 | struct biovec_slab bvec_slabs[BIOVEC_NR_POOLS] __read_mostly = { | 46 | static struct biovec_slab bvec_slabs[BIOVEC_NR_POOLS] __read_mostly = { |
47 | BV(1), BV(4), BV(16), BV(64), BV(128), BV(BIO_MAX_PAGES), | 47 | BV(1), BV(4), BV(16), BV(64), BV(128), BV(BIO_MAX_PAGES), |
48 | }; | 48 | }; |
49 | #undef BV | 49 | #undef BV |
@@ -1656,12 +1656,10 @@ static void __init biovec_init_slabs(void) | |||
1656 | int size; | 1656 | int size; |
1657 | struct biovec_slab *bvs = bvec_slabs + i; | 1657 | struct biovec_slab *bvs = bvec_slabs + i; |
1658 | 1658 | ||
1659 | #ifndef CONFIG_BLK_DEV_INTEGRITY | ||
1660 | if (bvs->nr_vecs <= BIO_INLINE_VECS) { | 1659 | if (bvs->nr_vecs <= BIO_INLINE_VECS) { |
1661 | bvs->slab = NULL; | 1660 | bvs->slab = NULL; |
1662 | continue; | 1661 | continue; |
1663 | } | 1662 | } |
1664 | #endif | ||
1665 | 1663 | ||
1666 | size = bvs->nr_vecs * sizeof(struct bio_vec); | 1664 | size = bvs->nr_vecs * sizeof(struct bio_vec); |
1667 | bvs->slab = kmem_cache_create(bvs->name, size, 0, | 1665 | bvs->slab = kmem_cache_create(bvs->name, size, 0, |
diff --git a/fs/block_dev.c b/fs/block_dev.c index fffc2c672396..fbe05cbdd692 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c | |||
@@ -873,6 +873,11 @@ int bd_link_disk_holder(struct block_device *bdev, struct gendisk *disk) | |||
873 | ret = add_symlink(bdev->bd_part->holder_dir, &disk_to_dev(disk)->kobj); | 873 | ret = add_symlink(bdev->bd_part->holder_dir, &disk_to_dev(disk)->kobj); |
874 | if (ret) | 874 | if (ret) |
875 | goto out_del; | 875 | goto out_del; |
876 | /* | ||
877 | * bdev could be deleted beneath us which would implicitly destroy | ||
878 | * the holder directory. Hold on to it. | ||
879 | */ | ||
880 | kobject_get(bdev->bd_part->holder_dir); | ||
876 | 881 | ||
877 | list_add(&holder->list, &bdev->bd_holder_disks); | 882 | list_add(&holder->list, &bdev->bd_holder_disks); |
878 | goto out_unlock; | 883 | goto out_unlock; |
@@ -909,6 +914,7 @@ void bd_unlink_disk_holder(struct block_device *bdev, struct gendisk *disk) | |||
909 | del_symlink(disk->slave_dir, &part_to_dev(bdev->bd_part)->kobj); | 914 | del_symlink(disk->slave_dir, &part_to_dev(bdev->bd_part)->kobj); |
910 | del_symlink(bdev->bd_part->holder_dir, | 915 | del_symlink(bdev->bd_part->holder_dir, |
911 | &disk_to_dev(disk)->kobj); | 916 | &disk_to_dev(disk)->kobj); |
917 | kobject_put(bdev->bd_part->holder_dir); | ||
912 | list_del_init(&holder->list); | 918 | list_del_init(&holder->list); |
913 | kfree(holder); | 919 | kfree(holder); |
914 | } | 920 | } |
@@ -922,14 +928,15 @@ EXPORT_SYMBOL_GPL(bd_unlink_disk_holder); | |||
922 | * flush_disk - invalidates all buffer-cache entries on a disk | 928 | * flush_disk - invalidates all buffer-cache entries on a disk |
923 | * | 929 | * |
924 | * @bdev: struct block device to be flushed | 930 | * @bdev: struct block device to be flushed |
931 | * @kill_dirty: flag to guide handling of dirty inodes | ||
925 | * | 932 | * |
926 | * Invalidates all buffer-cache entries on a disk. It should be called | 933 | * Invalidates all buffer-cache entries on a disk. It should be called |
927 | * when a disk has been changed -- either by a media change or online | 934 | * when a disk has been changed -- either by a media change or online |
928 | * resize. | 935 | * resize. |
929 | */ | 936 | */ |
930 | static void flush_disk(struct block_device *bdev) | 937 | static void flush_disk(struct block_device *bdev, bool kill_dirty) |
931 | { | 938 | { |
932 | if (__invalidate_device(bdev)) { | 939 | if (__invalidate_device(bdev, kill_dirty)) { |
933 | char name[BDEVNAME_SIZE] = ""; | 940 | char name[BDEVNAME_SIZE] = ""; |
934 | 941 | ||
935 | if (bdev->bd_disk) | 942 | if (bdev->bd_disk) |
@@ -966,7 +973,7 @@ void check_disk_size_change(struct gendisk *disk, struct block_device *bdev) | |||
966 | "%s: detected capacity change from %lld to %lld\n", | 973 | "%s: detected capacity change from %lld to %lld\n", |
967 | name, bdev_size, disk_size); | 974 | name, bdev_size, disk_size); |
968 | i_size_write(bdev->bd_inode, disk_size); | 975 | i_size_write(bdev->bd_inode, disk_size); |
969 | flush_disk(bdev); | 976 | flush_disk(bdev, false); |
970 | } | 977 | } |
971 | } | 978 | } |
972 | EXPORT_SYMBOL(check_disk_size_change); | 979 | EXPORT_SYMBOL(check_disk_size_change); |
@@ -1019,7 +1026,7 @@ int check_disk_change(struct block_device *bdev) | |||
1019 | if (!(events & DISK_EVENT_MEDIA_CHANGE)) | 1026 | if (!(events & DISK_EVENT_MEDIA_CHANGE)) |
1020 | return 0; | 1027 | return 0; |
1021 | 1028 | ||
1022 | flush_disk(bdev); | 1029 | flush_disk(bdev, true); |
1023 | if (bdops->revalidate_disk) | 1030 | if (bdops->revalidate_disk) |
1024 | bdops->revalidate_disk(bdev->bd_disk); | 1031 | bdops->revalidate_disk(bdev->bd_disk); |
1025 | return 1; | 1032 | return 1; |
@@ -1080,6 +1087,7 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part) | |||
1080 | if (!disk) | 1087 | if (!disk) |
1081 | goto out; | 1088 | goto out; |
1082 | 1089 | ||
1090 | disk_block_events(disk); | ||
1083 | mutex_lock_nested(&bdev->bd_mutex, for_part); | 1091 | mutex_lock_nested(&bdev->bd_mutex, for_part); |
1084 | if (!bdev->bd_openers) { | 1092 | if (!bdev->bd_openers) { |
1085 | bdev->bd_disk = disk; | 1093 | bdev->bd_disk = disk; |
@@ -1101,10 +1109,11 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part) | |||
1101 | */ | 1109 | */ |
1102 | disk_put_part(bdev->bd_part); | 1110 | disk_put_part(bdev->bd_part); |
1103 | bdev->bd_part = NULL; | 1111 | bdev->bd_part = NULL; |
1104 | module_put(disk->fops->owner); | ||
1105 | put_disk(disk); | ||
1106 | bdev->bd_disk = NULL; | 1112 | bdev->bd_disk = NULL; |
1107 | mutex_unlock(&bdev->bd_mutex); | 1113 | mutex_unlock(&bdev->bd_mutex); |
1114 | disk_unblock_events(disk); | ||
1115 | module_put(disk->fops->owner); | ||
1116 | put_disk(disk); | ||
1108 | goto restart; | 1117 | goto restart; |
1109 | } | 1118 | } |
1110 | if (ret) | 1119 | if (ret) |
@@ -1141,9 +1150,6 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part) | |||
1141 | bd_set_size(bdev, (loff_t)bdev->bd_part->nr_sects << 9); | 1150 | bd_set_size(bdev, (loff_t)bdev->bd_part->nr_sects << 9); |
1142 | } | 1151 | } |
1143 | } else { | 1152 | } else { |
1144 | module_put(disk->fops->owner); | ||
1145 | put_disk(disk); | ||
1146 | disk = NULL; | ||
1147 | if (bdev->bd_contains == bdev) { | 1153 | if (bdev->bd_contains == bdev) { |
1148 | if (bdev->bd_disk->fops->open) { | 1154 | if (bdev->bd_disk->fops->open) { |
1149 | ret = bdev->bd_disk->fops->open(bdev, mode); | 1155 | ret = bdev->bd_disk->fops->open(bdev, mode); |
@@ -1153,11 +1159,15 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part) | |||
1153 | if (bdev->bd_invalidated) | 1159 | if (bdev->bd_invalidated) |
1154 | rescan_partitions(bdev->bd_disk, bdev); | 1160 | rescan_partitions(bdev->bd_disk, bdev); |
1155 | } | 1161 | } |
1162 | /* only one opener holds refs to the module and disk */ | ||
1163 | module_put(disk->fops->owner); | ||
1164 | put_disk(disk); | ||
1156 | } | 1165 | } |
1157 | bdev->bd_openers++; | 1166 | bdev->bd_openers++; |
1158 | if (for_part) | 1167 | if (for_part) |
1159 | bdev->bd_part_count++; | 1168 | bdev->bd_part_count++; |
1160 | mutex_unlock(&bdev->bd_mutex); | 1169 | mutex_unlock(&bdev->bd_mutex); |
1170 | disk_unblock_events(disk); | ||
1161 | return 0; | 1171 | return 0; |
1162 | 1172 | ||
1163 | out_clear: | 1173 | out_clear: |
@@ -1170,9 +1180,9 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part) | |||
1170 | bdev->bd_contains = NULL; | 1180 | bdev->bd_contains = NULL; |
1171 | out_unlock_bdev: | 1181 | out_unlock_bdev: |
1172 | mutex_unlock(&bdev->bd_mutex); | 1182 | mutex_unlock(&bdev->bd_mutex); |
1183 | disk_unblock_events(disk); | ||
1173 | out: | 1184 | out: |
1174 | if (disk) | 1185 | module_put(disk->fops->owner); |
1175 | module_put(disk->fops->owner); | ||
1176 | put_disk(disk); | 1186 | put_disk(disk); |
1177 | bdput(bdev); | 1187 | bdput(bdev); |
1178 | 1188 | ||
@@ -1439,14 +1449,13 @@ int blkdev_put(struct block_device *bdev, fmode_t mode) | |||
1439 | if (bdev_free) { | 1449 | if (bdev_free) { |
1440 | if (bdev->bd_write_holder) { | 1450 | if (bdev->bd_write_holder) { |
1441 | disk_unblock_events(bdev->bd_disk); | 1451 | disk_unblock_events(bdev->bd_disk); |
1442 | bdev->bd_write_holder = false; | ||
1443 | } else | ||
1444 | disk_check_events(bdev->bd_disk); | 1452 | disk_check_events(bdev->bd_disk); |
1453 | bdev->bd_write_holder = false; | ||
1454 | } | ||
1445 | } | 1455 | } |
1446 | 1456 | ||
1447 | mutex_unlock(&bdev->bd_mutex); | 1457 | mutex_unlock(&bdev->bd_mutex); |
1448 | } else | 1458 | } |
1449 | disk_check_events(bdev->bd_disk); | ||
1450 | 1459 | ||
1451 | return __blkdev_put(bdev, mode, 0); | 1460 | return __blkdev_put(bdev, mode, 0); |
1452 | } | 1461 | } |
@@ -1599,7 +1608,7 @@ fail: | |||
1599 | } | 1608 | } |
1600 | EXPORT_SYMBOL(lookup_bdev); | 1609 | EXPORT_SYMBOL(lookup_bdev); |
1601 | 1610 | ||
1602 | int __invalidate_device(struct block_device *bdev) | 1611 | int __invalidate_device(struct block_device *bdev, bool kill_dirty) |
1603 | { | 1612 | { |
1604 | struct super_block *sb = get_super(bdev); | 1613 | struct super_block *sb = get_super(bdev); |
1605 | int res = 0; | 1614 | int res = 0; |
@@ -1612,7 +1621,7 @@ int __invalidate_device(struct block_device *bdev) | |||
1612 | * hold). | 1621 | * hold). |
1613 | */ | 1622 | */ |
1614 | shrink_dcache_sb(sb); | 1623 | shrink_dcache_sb(sb); |
1615 | res = invalidate_inodes(sb); | 1624 | res = invalidate_inodes(sb, kill_dirty); |
1616 | drop_super(sb); | 1625 | drop_super(sb); |
1617 | } | 1626 | } |
1618 | invalidate_bdev(bdev); | 1627 | invalidate_bdev(bdev); |
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 2c98b3af6052..6f820fa23df4 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
@@ -1254,6 +1254,7 @@ struct btrfs_root { | |||
1254 | #define BTRFS_MOUNT_SPACE_CACHE (1 << 12) | 1254 | #define BTRFS_MOUNT_SPACE_CACHE (1 << 12) |
1255 | #define BTRFS_MOUNT_CLEAR_CACHE (1 << 13) | 1255 | #define BTRFS_MOUNT_CLEAR_CACHE (1 << 13) |
1256 | #define BTRFS_MOUNT_USER_SUBVOL_RM_ALLOWED (1 << 14) | 1256 | #define BTRFS_MOUNT_USER_SUBVOL_RM_ALLOWED (1 << 14) |
1257 | #define BTRFS_MOUNT_ENOSPC_DEBUG (1 << 15) | ||
1257 | 1258 | ||
1258 | #define btrfs_clear_opt(o, opt) ((o) &= ~BTRFS_MOUNT_##opt) | 1259 | #define btrfs_clear_opt(o, opt) ((o) &= ~BTRFS_MOUNT_##opt) |
1259 | #define btrfs_set_opt(o, opt) ((o) |= BTRFS_MOUNT_##opt) | 1260 | #define btrfs_set_opt(o, opt) ((o) |= BTRFS_MOUNT_##opt) |
@@ -2218,6 +2219,8 @@ int btrfs_error_unpin_extent_range(struct btrfs_root *root, | |||
2218 | u64 start, u64 end); | 2219 | u64 start, u64 end); |
2219 | int btrfs_error_discard_extent(struct btrfs_root *root, u64 bytenr, | 2220 | int btrfs_error_discard_extent(struct btrfs_root *root, u64 bytenr, |
2220 | u64 num_bytes); | 2221 | u64 num_bytes); |
2222 | int btrfs_force_chunk_alloc(struct btrfs_trans_handle *trans, | ||
2223 | struct btrfs_root *root, u64 type); | ||
2221 | 2224 | ||
2222 | /* ctree.c */ | 2225 | /* ctree.c */ |
2223 | int btrfs_bin_search(struct extent_buffer *eb, struct btrfs_key *key, | 2226 | int btrfs_bin_search(struct extent_buffer *eb, struct btrfs_key *key, |
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index f3c96fc01439..588ff9849873 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -5376,7 +5376,7 @@ again: | |||
5376 | num_bytes, data, 1); | 5376 | num_bytes, data, 1); |
5377 | goto again; | 5377 | goto again; |
5378 | } | 5378 | } |
5379 | if (ret == -ENOSPC) { | 5379 | if (ret == -ENOSPC && btrfs_test_opt(root, ENOSPC_DEBUG)) { |
5380 | struct btrfs_space_info *sinfo; | 5380 | struct btrfs_space_info *sinfo; |
5381 | 5381 | ||
5382 | sinfo = __find_space_info(root->fs_info, data); | 5382 | sinfo = __find_space_info(root->fs_info, data); |
@@ -8065,6 +8065,13 @@ out: | |||
8065 | return ret; | 8065 | return ret; |
8066 | } | 8066 | } |
8067 | 8067 | ||
8068 | int btrfs_force_chunk_alloc(struct btrfs_trans_handle *trans, | ||
8069 | struct btrfs_root *root, u64 type) | ||
8070 | { | ||
8071 | u64 alloc_flags = get_alloc_profile(root, type); | ||
8072 | return do_chunk_alloc(trans, root, 2 * 1024 * 1024, alloc_flags, 1); | ||
8073 | } | ||
8074 | |||
8068 | /* | 8075 | /* |
8069 | * helper to account the unused space of all the readonly block group in the | 8076 | * helper to account the unused space of all the readonly block group in the |
8070 | * list. takes mirrors into account. | 8077 | * list. takes mirrors into account. |
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index b76f7cd47401..00497d551e51 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c | |||
@@ -1433,12 +1433,13 @@ int extent_clear_unlock_delalloc(struct inode *inode, | |||
1433 | */ | 1433 | */ |
1434 | u64 count_range_bits(struct extent_io_tree *tree, | 1434 | u64 count_range_bits(struct extent_io_tree *tree, |
1435 | u64 *start, u64 search_end, u64 max_bytes, | 1435 | u64 *start, u64 search_end, u64 max_bytes, |
1436 | unsigned long bits) | 1436 | unsigned long bits, int contig) |
1437 | { | 1437 | { |
1438 | struct rb_node *node; | 1438 | struct rb_node *node; |
1439 | struct extent_state *state; | 1439 | struct extent_state *state; |
1440 | u64 cur_start = *start; | 1440 | u64 cur_start = *start; |
1441 | u64 total_bytes = 0; | 1441 | u64 total_bytes = 0; |
1442 | u64 last = 0; | ||
1442 | int found = 0; | 1443 | int found = 0; |
1443 | 1444 | ||
1444 | if (search_end <= cur_start) { | 1445 | if (search_end <= cur_start) { |
@@ -1463,7 +1464,9 @@ u64 count_range_bits(struct extent_io_tree *tree, | |||
1463 | state = rb_entry(node, struct extent_state, rb_node); | 1464 | state = rb_entry(node, struct extent_state, rb_node); |
1464 | if (state->start > search_end) | 1465 | if (state->start > search_end) |
1465 | break; | 1466 | break; |
1466 | if (state->end >= cur_start && (state->state & bits)) { | 1467 | if (contig && found && state->start > last + 1) |
1468 | break; | ||
1469 | if (state->end >= cur_start && (state->state & bits) == bits) { | ||
1467 | total_bytes += min(search_end, state->end) + 1 - | 1470 | total_bytes += min(search_end, state->end) + 1 - |
1468 | max(cur_start, state->start); | 1471 | max(cur_start, state->start); |
1469 | if (total_bytes >= max_bytes) | 1472 | if (total_bytes >= max_bytes) |
@@ -1472,6 +1475,9 @@ u64 count_range_bits(struct extent_io_tree *tree, | |||
1472 | *start = state->start; | 1475 | *start = state->start; |
1473 | found = 1; | 1476 | found = 1; |
1474 | } | 1477 | } |
1478 | last = state->end; | ||
1479 | } else if (contig && found) { | ||
1480 | break; | ||
1475 | } | 1481 | } |
1476 | node = rb_next(node); | 1482 | node = rb_next(node); |
1477 | if (!node) | 1483 | if (!node) |
@@ -2912,6 +2918,46 @@ out: | |||
2912 | return sector; | 2918 | return sector; |
2913 | } | 2919 | } |
2914 | 2920 | ||
2921 | /* | ||
2922 | * helper function for fiemap, which doesn't want to see any holes. | ||
2923 | * This maps until we find something past 'last' | ||
2924 | */ | ||
2925 | static struct extent_map *get_extent_skip_holes(struct inode *inode, | ||
2926 | u64 offset, | ||
2927 | u64 last, | ||
2928 | get_extent_t *get_extent) | ||
2929 | { | ||
2930 | u64 sectorsize = BTRFS_I(inode)->root->sectorsize; | ||
2931 | struct extent_map *em; | ||
2932 | u64 len; | ||
2933 | |||
2934 | if (offset >= last) | ||
2935 | return NULL; | ||
2936 | |||
2937 | while(1) { | ||
2938 | len = last - offset; | ||
2939 | if (len == 0) | ||
2940 | break; | ||
2941 | len = (len + sectorsize - 1) & ~(sectorsize - 1); | ||
2942 | em = get_extent(inode, NULL, 0, offset, len, 0); | ||
2943 | if (!em || IS_ERR(em)) | ||
2944 | return em; | ||
2945 | |||
2946 | /* if this isn't a hole return it */ | ||
2947 | if (!test_bit(EXTENT_FLAG_VACANCY, &em->flags) && | ||
2948 | em->block_start != EXTENT_MAP_HOLE) { | ||
2949 | return em; | ||
2950 | } | ||
2951 | |||
2952 | /* this is a hole, advance to the next extent */ | ||
2953 | offset = extent_map_end(em); | ||
2954 | free_extent_map(em); | ||
2955 | if (offset >= last) | ||
2956 | break; | ||
2957 | } | ||
2958 | return NULL; | ||
2959 | } | ||
2960 | |||
2915 | int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, | 2961 | int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, |
2916 | __u64 start, __u64 len, get_extent_t *get_extent) | 2962 | __u64 start, __u64 len, get_extent_t *get_extent) |
2917 | { | 2963 | { |
@@ -2921,16 +2967,19 @@ int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, | |||
2921 | u32 flags = 0; | 2967 | u32 flags = 0; |
2922 | u32 found_type; | 2968 | u32 found_type; |
2923 | u64 last; | 2969 | u64 last; |
2970 | u64 last_for_get_extent = 0; | ||
2924 | u64 disko = 0; | 2971 | u64 disko = 0; |
2972 | u64 isize = i_size_read(inode); | ||
2925 | struct btrfs_key found_key; | 2973 | struct btrfs_key found_key; |
2926 | struct extent_map *em = NULL; | 2974 | struct extent_map *em = NULL; |
2927 | struct extent_state *cached_state = NULL; | 2975 | struct extent_state *cached_state = NULL; |
2928 | struct btrfs_path *path; | 2976 | struct btrfs_path *path; |
2929 | struct btrfs_file_extent_item *item; | 2977 | struct btrfs_file_extent_item *item; |
2930 | int end = 0; | 2978 | int end = 0; |
2931 | u64 em_start = 0, em_len = 0; | 2979 | u64 em_start = 0; |
2980 | u64 em_len = 0; | ||
2981 | u64 em_end = 0; | ||
2932 | unsigned long emflags; | 2982 | unsigned long emflags; |
2933 | int hole = 0; | ||
2934 | 2983 | ||
2935 | if (len == 0) | 2984 | if (len == 0) |
2936 | return -EINVAL; | 2985 | return -EINVAL; |
@@ -2940,6 +2989,10 @@ int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, | |||
2940 | return -ENOMEM; | 2989 | return -ENOMEM; |
2941 | path->leave_spinning = 1; | 2990 | path->leave_spinning = 1; |
2942 | 2991 | ||
2992 | /* | ||
2993 | * lookup the last file extent. We're not using i_size here | ||
2994 | * because there might be preallocation past i_size | ||
2995 | */ | ||
2943 | ret = btrfs_lookup_file_extent(NULL, BTRFS_I(inode)->root, | 2996 | ret = btrfs_lookup_file_extent(NULL, BTRFS_I(inode)->root, |
2944 | path, inode->i_ino, -1, 0); | 2997 | path, inode->i_ino, -1, 0); |
2945 | if (ret < 0) { | 2998 | if (ret < 0) { |
@@ -2953,18 +3006,38 @@ int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, | |||
2953 | btrfs_item_key_to_cpu(path->nodes[0], &found_key, path->slots[0]); | 3006 | btrfs_item_key_to_cpu(path->nodes[0], &found_key, path->slots[0]); |
2954 | found_type = btrfs_key_type(&found_key); | 3007 | found_type = btrfs_key_type(&found_key); |
2955 | 3008 | ||
2956 | /* No extents, just return */ | 3009 | /* No extents, but there might be delalloc bits */ |
2957 | if (found_key.objectid != inode->i_ino || | 3010 | if (found_key.objectid != inode->i_ino || |
2958 | found_type != BTRFS_EXTENT_DATA_KEY) { | 3011 | found_type != BTRFS_EXTENT_DATA_KEY) { |
2959 | btrfs_free_path(path); | 3012 | /* have to trust i_size as the end */ |
2960 | return 0; | 3013 | last = (u64)-1; |
3014 | last_for_get_extent = isize; | ||
3015 | } else { | ||
3016 | /* | ||
3017 | * remember the start of the last extent. There are a | ||
3018 | * bunch of different factors that go into the length of the | ||
3019 | * extent, so its much less complex to remember where it started | ||
3020 | */ | ||
3021 | last = found_key.offset; | ||
3022 | last_for_get_extent = last + 1; | ||
2961 | } | 3023 | } |
2962 | last = found_key.offset; | ||
2963 | btrfs_free_path(path); | 3024 | btrfs_free_path(path); |
2964 | 3025 | ||
3026 | /* | ||
3027 | * we might have some extents allocated but more delalloc past those | ||
3028 | * extents. so, we trust isize unless the start of the last extent is | ||
3029 | * beyond isize | ||
3030 | */ | ||
3031 | if (last < isize) { | ||
3032 | last = (u64)-1; | ||
3033 | last_for_get_extent = isize; | ||
3034 | } | ||
3035 | |||
2965 | lock_extent_bits(&BTRFS_I(inode)->io_tree, start, start + len, 0, | 3036 | lock_extent_bits(&BTRFS_I(inode)->io_tree, start, start + len, 0, |
2966 | &cached_state, GFP_NOFS); | 3037 | &cached_state, GFP_NOFS); |
2967 | em = get_extent(inode, NULL, 0, off, max - off, 0); | 3038 | |
3039 | em = get_extent_skip_holes(inode, off, last_for_get_extent, | ||
3040 | get_extent); | ||
2968 | if (!em) | 3041 | if (!em) |
2969 | goto out; | 3042 | goto out; |
2970 | if (IS_ERR(em)) { | 3043 | if (IS_ERR(em)) { |
@@ -2973,19 +3046,14 @@ int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, | |||
2973 | } | 3046 | } |
2974 | 3047 | ||
2975 | while (!end) { | 3048 | while (!end) { |
2976 | hole = 0; | 3049 | off = extent_map_end(em); |
2977 | off = em->start + em->len; | ||
2978 | if (off >= max) | 3050 | if (off >= max) |
2979 | end = 1; | 3051 | end = 1; |
2980 | 3052 | ||
2981 | if (em->block_start == EXTENT_MAP_HOLE) { | ||
2982 | hole = 1; | ||
2983 | goto next; | ||
2984 | } | ||
2985 | |||
2986 | em_start = em->start; | 3053 | em_start = em->start; |
2987 | em_len = em->len; | 3054 | em_len = em->len; |
2988 | 3055 | em_end = extent_map_end(em); | |
3056 | emflags = em->flags; | ||
2989 | disko = 0; | 3057 | disko = 0; |
2990 | flags = 0; | 3058 | flags = 0; |
2991 | 3059 | ||
@@ -3004,37 +3072,29 @@ int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, | |||
3004 | if (test_bit(EXTENT_FLAG_COMPRESSED, &em->flags)) | 3072 | if (test_bit(EXTENT_FLAG_COMPRESSED, &em->flags)) |
3005 | flags |= FIEMAP_EXTENT_ENCODED; | 3073 | flags |= FIEMAP_EXTENT_ENCODED; |
3006 | 3074 | ||
3007 | next: | ||
3008 | emflags = em->flags; | ||
3009 | free_extent_map(em); | 3075 | free_extent_map(em); |
3010 | em = NULL; | 3076 | em = NULL; |
3011 | if (!end) { | 3077 | if ((em_start >= last) || em_len == (u64)-1 || |
3012 | em = get_extent(inode, NULL, 0, off, max - off, 0); | 3078 | (last == (u64)-1 && isize <= em_end)) { |
3013 | if (!em) | ||
3014 | goto out; | ||
3015 | if (IS_ERR(em)) { | ||
3016 | ret = PTR_ERR(em); | ||
3017 | goto out; | ||
3018 | } | ||
3019 | emflags = em->flags; | ||
3020 | } | ||
3021 | |||
3022 | if (test_bit(EXTENT_FLAG_VACANCY, &emflags)) { | ||
3023 | flags |= FIEMAP_EXTENT_LAST; | 3079 | flags |= FIEMAP_EXTENT_LAST; |
3024 | end = 1; | 3080 | end = 1; |
3025 | } | 3081 | } |
3026 | 3082 | ||
3027 | if (em_start == last) { | 3083 | /* now scan forward to see if this is really the last extent. */ |
3084 | em = get_extent_skip_holes(inode, off, last_for_get_extent, | ||
3085 | get_extent); | ||
3086 | if (IS_ERR(em)) { | ||
3087 | ret = PTR_ERR(em); | ||
3088 | goto out; | ||
3089 | } | ||
3090 | if (!em) { | ||
3028 | flags |= FIEMAP_EXTENT_LAST; | 3091 | flags |= FIEMAP_EXTENT_LAST; |
3029 | end = 1; | 3092 | end = 1; |
3030 | } | 3093 | } |
3031 | 3094 | ret = fiemap_fill_next_extent(fieinfo, em_start, disko, | |
3032 | if (!hole) { | 3095 | em_len, flags); |
3033 | ret = fiemap_fill_next_extent(fieinfo, em_start, disko, | 3096 | if (ret) |
3034 | em_len, flags); | 3097 | goto out_free; |
3035 | if (ret) | ||
3036 | goto out_free; | ||
3037 | } | ||
3038 | } | 3098 | } |
3039 | out_free: | 3099 | out_free: |
3040 | free_extent_map(em); | 3100 | free_extent_map(em); |
diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h index 7083cfafd061..9318dfefd59c 100644 --- a/fs/btrfs/extent_io.h +++ b/fs/btrfs/extent_io.h | |||
@@ -191,7 +191,7 @@ void extent_io_exit(void); | |||
191 | 191 | ||
192 | u64 count_range_bits(struct extent_io_tree *tree, | 192 | u64 count_range_bits(struct extent_io_tree *tree, |
193 | u64 *start, u64 search_end, | 193 | u64 *start, u64 search_end, |
194 | u64 max_bytes, unsigned long bits); | 194 | u64 max_bytes, unsigned long bits, int contig); |
195 | 195 | ||
196 | void free_extent_state(struct extent_state *state); | 196 | void free_extent_state(struct extent_state *state); |
197 | int test_range_bit(struct extent_io_tree *tree, u64 start, u64 end, | 197 | int test_range_bit(struct extent_io_tree *tree, u64 start, u64 end, |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 462e08e724b0..02438c917923 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -1913,7 +1913,7 @@ static int btrfs_clean_io_failures(struct inode *inode, u64 start) | |||
1913 | 1913 | ||
1914 | private = 0; | 1914 | private = 0; |
1915 | if (count_range_bits(&BTRFS_I(inode)->io_failure_tree, &private, | 1915 | if (count_range_bits(&BTRFS_I(inode)->io_failure_tree, &private, |
1916 | (u64)-1, 1, EXTENT_DIRTY)) { | 1916 | (u64)-1, 1, EXTENT_DIRTY, 0)) { |
1917 | ret = get_state_private(&BTRFS_I(inode)->io_failure_tree, | 1917 | ret = get_state_private(&BTRFS_I(inode)->io_failure_tree, |
1918 | start, &private_failure); | 1918 | start, &private_failure); |
1919 | if (ret == 0) { | 1919 | if (ret == 0) { |
@@ -5280,6 +5280,128 @@ out: | |||
5280 | return em; | 5280 | return em; |
5281 | } | 5281 | } |
5282 | 5282 | ||
5283 | struct extent_map *btrfs_get_extent_fiemap(struct inode *inode, struct page *page, | ||
5284 | size_t pg_offset, u64 start, u64 len, | ||
5285 | int create) | ||
5286 | { | ||
5287 | struct extent_map *em; | ||
5288 | struct extent_map *hole_em = NULL; | ||
5289 | u64 range_start = start; | ||
5290 | u64 end; | ||
5291 | u64 found; | ||
5292 | u64 found_end; | ||
5293 | int err = 0; | ||
5294 | |||
5295 | em = btrfs_get_extent(inode, page, pg_offset, start, len, create); | ||
5296 | if (IS_ERR(em)) | ||
5297 | return em; | ||
5298 | if (em) { | ||
5299 | /* | ||
5300 | * if our em maps to a hole, there might | ||
5301 | * actually be delalloc bytes behind it | ||
5302 | */ | ||
5303 | if (em->block_start != EXTENT_MAP_HOLE) | ||
5304 | return em; | ||
5305 | else | ||
5306 | hole_em = em; | ||
5307 | } | ||
5308 | |||
5309 | /* check to see if we've wrapped (len == -1 or similar) */ | ||
5310 | end = start + len; | ||
5311 | if (end < start) | ||
5312 | end = (u64)-1; | ||
5313 | else | ||
5314 | end -= 1; | ||
5315 | |||
5316 | em = NULL; | ||
5317 | |||
5318 | /* ok, we didn't find anything, lets look for delalloc */ | ||
5319 | found = count_range_bits(&BTRFS_I(inode)->io_tree, &range_start, | ||
5320 | end, len, EXTENT_DELALLOC, 1); | ||
5321 | found_end = range_start + found; | ||
5322 | if (found_end < range_start) | ||
5323 | found_end = (u64)-1; | ||
5324 | |||
5325 | /* | ||
5326 | * we didn't find anything useful, return | ||
5327 | * the original results from get_extent() | ||
5328 | */ | ||
5329 | if (range_start > end || found_end <= start) { | ||
5330 | em = hole_em; | ||
5331 | hole_em = NULL; | ||
5332 | goto out; | ||
5333 | } | ||
5334 | |||
5335 | /* adjust the range_start to make sure it doesn't | ||
5336 | * go backwards from the start they passed in | ||
5337 | */ | ||
5338 | range_start = max(start,range_start); | ||
5339 | found = found_end - range_start; | ||
5340 | |||
5341 | if (found > 0) { | ||
5342 | u64 hole_start = start; | ||
5343 | u64 hole_len = len; | ||
5344 | |||
5345 | em = alloc_extent_map(GFP_NOFS); | ||
5346 | if (!em) { | ||
5347 | err = -ENOMEM; | ||
5348 | goto out; | ||
5349 | } | ||
5350 | /* | ||
5351 | * when btrfs_get_extent can't find anything it | ||
5352 | * returns one huge hole | ||
5353 | * | ||
5354 | * make sure what it found really fits our range, and | ||
5355 | * adjust to make sure it is based on the start from | ||
5356 | * the caller | ||
5357 | */ | ||
5358 | if (hole_em) { | ||
5359 | u64 calc_end = extent_map_end(hole_em); | ||
5360 | |||
5361 | if (calc_end <= start || (hole_em->start > end)) { | ||
5362 | free_extent_map(hole_em); | ||
5363 | hole_em = NULL; | ||
5364 | } else { | ||
5365 | hole_start = max(hole_em->start, start); | ||
5366 | hole_len = calc_end - hole_start; | ||
5367 | } | ||
5368 | } | ||
5369 | em->bdev = NULL; | ||
5370 | if (hole_em && range_start > hole_start) { | ||
5371 | /* our hole starts before our delalloc, so we | ||
5372 | * have to return just the parts of the hole | ||
5373 | * that go until the delalloc starts | ||
5374 | */ | ||
5375 | em->len = min(hole_len, | ||
5376 | range_start - hole_start); | ||
5377 | em->start = hole_start; | ||
5378 | em->orig_start = hole_start; | ||
5379 | /* | ||
5380 | * don't adjust block start at all, | ||
5381 | * it is fixed at EXTENT_MAP_HOLE | ||
5382 | */ | ||
5383 | em->block_start = hole_em->block_start; | ||
5384 | em->block_len = hole_len; | ||
5385 | } else { | ||
5386 | em->start = range_start; | ||
5387 | em->len = found; | ||
5388 | em->orig_start = range_start; | ||
5389 | em->block_start = EXTENT_MAP_DELALLOC; | ||
5390 | em->block_len = found; | ||
5391 | } | ||
5392 | } else if (hole_em) { | ||
5393 | return hole_em; | ||
5394 | } | ||
5395 | out: | ||
5396 | |||
5397 | free_extent_map(hole_em); | ||
5398 | if (err) { | ||
5399 | free_extent_map(em); | ||
5400 | return ERR_PTR(err); | ||
5401 | } | ||
5402 | return em; | ||
5403 | } | ||
5404 | |||
5283 | static struct extent_map *btrfs_new_extent_direct(struct inode *inode, | 5405 | static struct extent_map *btrfs_new_extent_direct(struct inode *inode, |
5284 | u64 start, u64 len) | 5406 | u64 start, u64 len) |
5285 | { | 5407 | { |
@@ -6102,7 +6224,7 @@ out: | |||
6102 | static int btrfs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, | 6224 | static int btrfs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, |
6103 | __u64 start, __u64 len) | 6225 | __u64 start, __u64 len) |
6104 | { | 6226 | { |
6105 | return extent_fiemap(inode, fieinfo, start, len, btrfs_get_extent); | 6227 | return extent_fiemap(inode, fieinfo, start, len, btrfs_get_extent_fiemap); |
6106 | } | 6228 | } |
6107 | 6229 | ||
6108 | int btrfs_readpage(struct file *file, struct page *page) | 6230 | int btrfs_readpage(struct file *file, struct page *page) |
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index be2d4f6aaa5e..5fdb2abc4fa7 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
@@ -1071,12 +1071,15 @@ static noinline int btrfs_ioctl_subvol_setflags(struct file *file, | |||
1071 | if (copy_from_user(&flags, arg, sizeof(flags))) | 1071 | if (copy_from_user(&flags, arg, sizeof(flags))) |
1072 | return -EFAULT; | 1072 | return -EFAULT; |
1073 | 1073 | ||
1074 | if (flags & ~BTRFS_SUBVOL_CREATE_ASYNC) | 1074 | if (flags & BTRFS_SUBVOL_CREATE_ASYNC) |
1075 | return -EINVAL; | 1075 | return -EINVAL; |
1076 | 1076 | ||
1077 | if (flags & ~BTRFS_SUBVOL_RDONLY) | 1077 | if (flags & ~BTRFS_SUBVOL_RDONLY) |
1078 | return -EOPNOTSUPP; | 1078 | return -EOPNOTSUPP; |
1079 | 1079 | ||
1080 | if (!is_owner_or_cap(inode)) | ||
1081 | return -EACCES; | ||
1082 | |||
1080 | down_write(&root->fs_info->subvol_sem); | 1083 | down_write(&root->fs_info->subvol_sem); |
1081 | 1084 | ||
1082 | /* nothing to do */ | 1085 | /* nothing to do */ |
@@ -1097,7 +1100,7 @@ static noinline int btrfs_ioctl_subvol_setflags(struct file *file, | |||
1097 | goto out_reset; | 1100 | goto out_reset; |
1098 | } | 1101 | } |
1099 | 1102 | ||
1100 | ret = btrfs_update_root(trans, root, | 1103 | ret = btrfs_update_root(trans, root->fs_info->tree_root, |
1101 | &root->root_key, &root->root_item); | 1104 | &root->root_key, &root->root_item); |
1102 | 1105 | ||
1103 | btrfs_commit_transaction(trans, root); | 1106 | btrfs_commit_transaction(trans, root); |
diff --git a/fs/btrfs/lzo.c b/fs/btrfs/lzo.c index cc9b450399df..a178f5ebea78 100644 --- a/fs/btrfs/lzo.c +++ b/fs/btrfs/lzo.c | |||
@@ -280,6 +280,7 @@ static int lzo_decompress_biovec(struct list_head *ws, | |||
280 | unsigned long tot_out; | 280 | unsigned long tot_out; |
281 | unsigned long tot_len; | 281 | unsigned long tot_len; |
282 | char *buf; | 282 | char *buf; |
283 | bool may_late_unmap, need_unmap; | ||
283 | 284 | ||
284 | data_in = kmap(pages_in[0]); | 285 | data_in = kmap(pages_in[0]); |
285 | tot_len = read_compress_length(data_in); | 286 | tot_len = read_compress_length(data_in); |
@@ -300,11 +301,13 @@ static int lzo_decompress_biovec(struct list_head *ws, | |||
300 | 301 | ||
301 | tot_in += in_len; | 302 | tot_in += in_len; |
302 | working_bytes = in_len; | 303 | working_bytes = in_len; |
304 | may_late_unmap = need_unmap = false; | ||
303 | 305 | ||
304 | /* fast path: avoid using the working buffer */ | 306 | /* fast path: avoid using the working buffer */ |
305 | if (in_page_bytes_left >= in_len) { | 307 | if (in_page_bytes_left >= in_len) { |
306 | buf = data_in + in_offset; | 308 | buf = data_in + in_offset; |
307 | bytes = in_len; | 309 | bytes = in_len; |
310 | may_late_unmap = true; | ||
308 | goto cont; | 311 | goto cont; |
309 | } | 312 | } |
310 | 313 | ||
@@ -329,14 +332,17 @@ cont: | |||
329 | if (working_bytes == 0 && tot_in >= tot_len) | 332 | if (working_bytes == 0 && tot_in >= tot_len) |
330 | break; | 333 | break; |
331 | 334 | ||
332 | kunmap(pages_in[page_in_index]); | 335 | if (page_in_index + 1 >= total_pages_in) { |
333 | page_in_index++; | ||
334 | if (page_in_index >= total_pages_in) { | ||
335 | ret = -1; | 336 | ret = -1; |
336 | data_in = NULL; | ||
337 | goto done; | 337 | goto done; |
338 | } | 338 | } |
339 | data_in = kmap(pages_in[page_in_index]); | 339 | |
340 | if (may_late_unmap) | ||
341 | need_unmap = true; | ||
342 | else | ||
343 | kunmap(pages_in[page_in_index]); | ||
344 | |||
345 | data_in = kmap(pages_in[++page_in_index]); | ||
340 | 346 | ||
341 | in_page_bytes_left = PAGE_CACHE_SIZE; | 347 | in_page_bytes_left = PAGE_CACHE_SIZE; |
342 | in_offset = 0; | 348 | in_offset = 0; |
@@ -346,6 +352,8 @@ cont: | |||
346 | out_len = lzo1x_worst_compress(PAGE_CACHE_SIZE); | 352 | out_len = lzo1x_worst_compress(PAGE_CACHE_SIZE); |
347 | ret = lzo1x_decompress_safe(buf, in_len, workspace->buf, | 353 | ret = lzo1x_decompress_safe(buf, in_len, workspace->buf, |
348 | &out_len); | 354 | &out_len); |
355 | if (need_unmap) | ||
356 | kunmap(pages_in[page_in_index - 1]); | ||
349 | if (ret != LZO_E_OK) { | 357 | if (ret != LZO_E_OK) { |
350 | printk(KERN_WARNING "btrfs decompress failed\n"); | 358 | printk(KERN_WARNING "btrfs decompress failed\n"); |
351 | ret = -1; | 359 | ret = -1; |
@@ -363,8 +371,7 @@ cont: | |||
363 | break; | 371 | break; |
364 | } | 372 | } |
365 | done: | 373 | done: |
366 | if (data_in) | 374 | kunmap(pages_in[page_in_index]); |
367 | kunmap(pages_in[page_in_index]); | ||
368 | return ret; | 375 | return ret; |
369 | } | 376 | } |
370 | 377 | ||
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index 0825e4ed9447..31ade5802ae8 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c | |||
@@ -3654,6 +3654,7 @@ static noinline_for_stack int relocate_block_group(struct reloc_control *rc) | |||
3654 | u32 item_size; | 3654 | u32 item_size; |
3655 | int ret; | 3655 | int ret; |
3656 | int err = 0; | 3656 | int err = 0; |
3657 | int progress = 0; | ||
3657 | 3658 | ||
3658 | path = btrfs_alloc_path(); | 3659 | path = btrfs_alloc_path(); |
3659 | if (!path) | 3660 | if (!path) |
@@ -3666,9 +3667,10 @@ static noinline_for_stack int relocate_block_group(struct reloc_control *rc) | |||
3666 | } | 3667 | } |
3667 | 3668 | ||
3668 | while (1) { | 3669 | while (1) { |
3670 | progress++; | ||
3669 | trans = btrfs_start_transaction(rc->extent_root, 0); | 3671 | trans = btrfs_start_transaction(rc->extent_root, 0); |
3670 | BUG_ON(IS_ERR(trans)); | 3672 | BUG_ON(IS_ERR(trans)); |
3671 | 3673 | restart: | |
3672 | if (update_backref_cache(trans, &rc->backref_cache)) { | 3674 | if (update_backref_cache(trans, &rc->backref_cache)) { |
3673 | btrfs_end_transaction(trans, rc->extent_root); | 3675 | btrfs_end_transaction(trans, rc->extent_root); |
3674 | continue; | 3676 | continue; |
@@ -3781,6 +3783,15 @@ static noinline_for_stack int relocate_block_group(struct reloc_control *rc) | |||
3781 | } | 3783 | } |
3782 | } | 3784 | } |
3783 | } | 3785 | } |
3786 | if (trans && progress && err == -ENOSPC) { | ||
3787 | ret = btrfs_force_chunk_alloc(trans, rc->extent_root, | ||
3788 | rc->block_group->flags); | ||
3789 | if (ret == 0) { | ||
3790 | err = 0; | ||
3791 | progress = 0; | ||
3792 | goto restart; | ||
3793 | } | ||
3794 | } | ||
3784 | 3795 | ||
3785 | btrfs_release_path(rc->extent_root, path); | 3796 | btrfs_release_path(rc->extent_root, path); |
3786 | clear_extent_bits(&rc->processed_blocks, 0, (u64)-1, EXTENT_DIRTY, | 3797 | clear_extent_bits(&rc->processed_blocks, 0, (u64)-1, EXTENT_DIRTY, |
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index a004008f7d28..d39a9895d932 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c | |||
@@ -155,7 +155,8 @@ enum { | |||
155 | Opt_nossd, Opt_ssd_spread, Opt_thread_pool, Opt_noacl, Opt_compress, | 155 | Opt_nossd, Opt_ssd_spread, Opt_thread_pool, Opt_noacl, Opt_compress, |
156 | Opt_compress_type, Opt_compress_force, Opt_compress_force_type, | 156 | Opt_compress_type, Opt_compress_force, Opt_compress_force_type, |
157 | Opt_notreelog, Opt_ratio, Opt_flushoncommit, Opt_discard, | 157 | Opt_notreelog, Opt_ratio, Opt_flushoncommit, Opt_discard, |
158 | Opt_space_cache, Opt_clear_cache, Opt_user_subvol_rm_allowed, Opt_err, | 158 | Opt_space_cache, Opt_clear_cache, Opt_user_subvol_rm_allowed, |
159 | Opt_enospc_debug, Opt_err, | ||
159 | }; | 160 | }; |
160 | 161 | ||
161 | static match_table_t tokens = { | 162 | static match_table_t tokens = { |
@@ -184,6 +185,7 @@ static match_table_t tokens = { | |||
184 | {Opt_space_cache, "space_cache"}, | 185 | {Opt_space_cache, "space_cache"}, |
185 | {Opt_clear_cache, "clear_cache"}, | 186 | {Opt_clear_cache, "clear_cache"}, |
186 | {Opt_user_subvol_rm_allowed, "user_subvol_rm_allowed"}, | 187 | {Opt_user_subvol_rm_allowed, "user_subvol_rm_allowed"}, |
188 | {Opt_enospc_debug, "enospc_debug"}, | ||
187 | {Opt_err, NULL}, | 189 | {Opt_err, NULL}, |
188 | }; | 190 | }; |
189 | 191 | ||
@@ -358,6 +360,9 @@ int btrfs_parse_options(struct btrfs_root *root, char *options) | |||
358 | case Opt_user_subvol_rm_allowed: | 360 | case Opt_user_subvol_rm_allowed: |
359 | btrfs_set_opt(info->mount_opt, USER_SUBVOL_RM_ALLOWED); | 361 | btrfs_set_opt(info->mount_opt, USER_SUBVOL_RM_ALLOWED); |
360 | break; | 362 | break; |
363 | case Opt_enospc_debug: | ||
364 | btrfs_set_opt(info->mount_opt, ENOSPC_DEBUG); | ||
365 | break; | ||
361 | case Opt_err: | 366 | case Opt_err: |
362 | printk(KERN_INFO "btrfs: unrecognized mount option " | 367 | printk(KERN_INFO "btrfs: unrecognized mount option " |
363 | "'%s'\n", p); | 368 | "'%s'\n", p); |
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 6e0e82a1b188..9d554e8e6583 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
@@ -1294,11 +1294,11 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path) | |||
1294 | 1294 | ||
1295 | ret = btrfs_shrink_device(device, 0); | 1295 | ret = btrfs_shrink_device(device, 0); |
1296 | if (ret) | 1296 | if (ret) |
1297 | goto error_brelse; | 1297 | goto error_undo; |
1298 | 1298 | ||
1299 | ret = btrfs_rm_dev_item(root->fs_info->chunk_root, device); | 1299 | ret = btrfs_rm_dev_item(root->fs_info->chunk_root, device); |
1300 | if (ret) | 1300 | if (ret) |
1301 | goto error_brelse; | 1301 | goto error_undo; |
1302 | 1302 | ||
1303 | device->in_fs_metadata = 0; | 1303 | device->in_fs_metadata = 0; |
1304 | 1304 | ||
@@ -1372,6 +1372,13 @@ out: | |||
1372 | mutex_unlock(&root->fs_info->volume_mutex); | 1372 | mutex_unlock(&root->fs_info->volume_mutex); |
1373 | mutex_unlock(&uuid_mutex); | 1373 | mutex_unlock(&uuid_mutex); |
1374 | return ret; | 1374 | return ret; |
1375 | error_undo: | ||
1376 | if (device->writeable) { | ||
1377 | list_add(&device->dev_alloc_list, | ||
1378 | &root->fs_info->fs_devices->alloc_list); | ||
1379 | root->fs_info->fs_devices->rw_devices++; | ||
1380 | } | ||
1381 | goto error_brelse; | ||
1375 | } | 1382 | } |
1376 | 1383 | ||
1377 | /* | 1384 | /* |
@@ -1589,7 +1596,7 @@ int btrfs_init_new_device(struct btrfs_root *root, char *device_path) | |||
1589 | device->dev_root = root->fs_info->dev_root; | 1596 | device->dev_root = root->fs_info->dev_root; |
1590 | device->bdev = bdev; | 1597 | device->bdev = bdev; |
1591 | device->in_fs_metadata = 1; | 1598 | device->in_fs_metadata = 1; |
1592 | device->mode = 0; | 1599 | device->mode = FMODE_EXCL; |
1593 | set_blocksize(device->bdev, 4096); | 1600 | set_blocksize(device->bdev, 4096); |
1594 | 1601 | ||
1595 | if (seeding_dev) { | 1602 | if (seeding_dev) { |
diff --git a/fs/eventpoll.c b/fs/eventpoll.c index 267d0ada4541..4a09af9e9a63 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c | |||
@@ -63,6 +63,13 @@ | |||
63 | * cleanup path and it is also acquired by eventpoll_release_file() | 63 | * cleanup path and it is also acquired by eventpoll_release_file() |
64 | * if a file has been pushed inside an epoll set and it is then | 64 | * if a file has been pushed inside an epoll set and it is then |
65 | * close()d without a previous call toepoll_ctl(EPOLL_CTL_DEL). | 65 | * close()d without a previous call toepoll_ctl(EPOLL_CTL_DEL). |
66 | * It is also acquired when inserting an epoll fd onto another epoll | ||
67 | * fd. We do this so that we walk the epoll tree and ensure that this | ||
68 | * insertion does not create a cycle of epoll file descriptors, which | ||
69 | * could lead to deadlock. We need a global mutex to prevent two | ||
70 | * simultaneous inserts (A into B and B into A) from racing and | ||
71 | * constructing a cycle without either insert observing that it is | ||
72 | * going to. | ||
66 | * It is possible to drop the "ep->mtx" and to use the global | 73 | * It is possible to drop the "ep->mtx" and to use the global |
67 | * mutex "epmutex" (together with "ep->lock") to have it working, | 74 | * mutex "epmutex" (together with "ep->lock") to have it working, |
68 | * but having "ep->mtx" will make the interface more scalable. | 75 | * but having "ep->mtx" will make the interface more scalable. |
@@ -224,6 +231,9 @@ static long max_user_watches __read_mostly; | |||
224 | */ | 231 | */ |
225 | static DEFINE_MUTEX(epmutex); | 232 | static DEFINE_MUTEX(epmutex); |
226 | 233 | ||
234 | /* Used to check for epoll file descriptor inclusion loops */ | ||
235 | static struct nested_calls poll_loop_ncalls; | ||
236 | |||
227 | /* Used for safe wake up implementation */ | 237 | /* Used for safe wake up implementation */ |
228 | static struct nested_calls poll_safewake_ncalls; | 238 | static struct nested_calls poll_safewake_ncalls; |
229 | 239 | ||
@@ -1198,6 +1208,62 @@ retry: | |||
1198 | return res; | 1208 | return res; |
1199 | } | 1209 | } |
1200 | 1210 | ||
1211 | /** | ||
1212 | * ep_loop_check_proc - Callback function to be passed to the @ep_call_nested() | ||
1213 | * API, to verify that adding an epoll file inside another | ||
1214 | * epoll structure, does not violate the constraints, in | ||
1215 | * terms of closed loops, or too deep chains (which can | ||
1216 | * result in excessive stack usage). | ||
1217 | * | ||
1218 | * @priv: Pointer to the epoll file to be currently checked. | ||
1219 | * @cookie: Original cookie for this call. This is the top-of-the-chain epoll | ||
1220 | * data structure pointer. | ||
1221 | * @call_nests: Current dept of the @ep_call_nested() call stack. | ||
1222 | * | ||
1223 | * Returns: Returns zero if adding the epoll @file inside current epoll | ||
1224 | * structure @ep does not violate the constraints, or -1 otherwise. | ||
1225 | */ | ||
1226 | static int ep_loop_check_proc(void *priv, void *cookie, int call_nests) | ||
1227 | { | ||
1228 | int error = 0; | ||
1229 | struct file *file = priv; | ||
1230 | struct eventpoll *ep = file->private_data; | ||
1231 | struct rb_node *rbp; | ||
1232 | struct epitem *epi; | ||
1233 | |||
1234 | mutex_lock(&ep->mtx); | ||
1235 | for (rbp = rb_first(&ep->rbr); rbp; rbp = rb_next(rbp)) { | ||
1236 | epi = rb_entry(rbp, struct epitem, rbn); | ||
1237 | if (unlikely(is_file_epoll(epi->ffd.file))) { | ||
1238 | error = ep_call_nested(&poll_loop_ncalls, EP_MAX_NESTS, | ||
1239 | ep_loop_check_proc, epi->ffd.file, | ||
1240 | epi->ffd.file->private_data, current); | ||
1241 | if (error != 0) | ||
1242 | break; | ||
1243 | } | ||
1244 | } | ||
1245 | mutex_unlock(&ep->mtx); | ||
1246 | |||
1247 | return error; | ||
1248 | } | ||
1249 | |||
1250 | /** | ||
1251 | * ep_loop_check - Performs a check to verify that adding an epoll file (@file) | ||
1252 | * another epoll file (represented by @ep) does not create | ||
1253 | * closed loops or too deep chains. | ||
1254 | * | ||
1255 | * @ep: Pointer to the epoll private data structure. | ||
1256 | * @file: Pointer to the epoll file to be checked. | ||
1257 | * | ||
1258 | * Returns: Returns zero if adding the epoll @file inside current epoll | ||
1259 | * structure @ep does not violate the constraints, or -1 otherwise. | ||
1260 | */ | ||
1261 | static int ep_loop_check(struct eventpoll *ep, struct file *file) | ||
1262 | { | ||
1263 | return ep_call_nested(&poll_loop_ncalls, EP_MAX_NESTS, | ||
1264 | ep_loop_check_proc, file, ep, current); | ||
1265 | } | ||
1266 | |||
1201 | /* | 1267 | /* |
1202 | * Open an eventpoll file descriptor. | 1268 | * Open an eventpoll file descriptor. |
1203 | */ | 1269 | */ |
@@ -1246,6 +1312,7 @@ SYSCALL_DEFINE4(epoll_ctl, int, epfd, int, op, int, fd, | |||
1246 | struct epoll_event __user *, event) | 1312 | struct epoll_event __user *, event) |
1247 | { | 1313 | { |
1248 | int error; | 1314 | int error; |
1315 | int did_lock_epmutex = 0; | ||
1249 | struct file *file, *tfile; | 1316 | struct file *file, *tfile; |
1250 | struct eventpoll *ep; | 1317 | struct eventpoll *ep; |
1251 | struct epitem *epi; | 1318 | struct epitem *epi; |
@@ -1287,6 +1354,25 @@ SYSCALL_DEFINE4(epoll_ctl, int, epfd, int, op, int, fd, | |||
1287 | */ | 1354 | */ |
1288 | ep = file->private_data; | 1355 | ep = file->private_data; |
1289 | 1356 | ||
1357 | /* | ||
1358 | * When we insert an epoll file descriptor, inside another epoll file | ||
1359 | * descriptor, there is the change of creating closed loops, which are | ||
1360 | * better be handled here, than in more critical paths. | ||
1361 | * | ||
1362 | * We hold epmutex across the loop check and the insert in this case, in | ||
1363 | * order to prevent two separate inserts from racing and each doing the | ||
1364 | * insert "at the same time" such that ep_loop_check passes on both | ||
1365 | * before either one does the insert, thereby creating a cycle. | ||
1366 | */ | ||
1367 | if (unlikely(is_file_epoll(tfile) && op == EPOLL_CTL_ADD)) { | ||
1368 | mutex_lock(&epmutex); | ||
1369 | did_lock_epmutex = 1; | ||
1370 | error = -ELOOP; | ||
1371 | if (ep_loop_check(ep, tfile) != 0) | ||
1372 | goto error_tgt_fput; | ||
1373 | } | ||
1374 | |||
1375 | |||
1290 | mutex_lock(&ep->mtx); | 1376 | mutex_lock(&ep->mtx); |
1291 | 1377 | ||
1292 | /* | 1378 | /* |
@@ -1322,6 +1408,9 @@ SYSCALL_DEFINE4(epoll_ctl, int, epfd, int, op, int, fd, | |||
1322 | mutex_unlock(&ep->mtx); | 1408 | mutex_unlock(&ep->mtx); |
1323 | 1409 | ||
1324 | error_tgt_fput: | 1410 | error_tgt_fput: |
1411 | if (unlikely(did_lock_epmutex)) | ||
1412 | mutex_unlock(&epmutex); | ||
1413 | |||
1325 | fput(tfile); | 1414 | fput(tfile); |
1326 | error_fput: | 1415 | error_fput: |
1327 | fput(file); | 1416 | fput(file); |
@@ -1441,6 +1530,12 @@ static int __init eventpoll_init(void) | |||
1441 | EP_ITEM_COST; | 1530 | EP_ITEM_COST; |
1442 | BUG_ON(max_user_watches < 0); | 1531 | BUG_ON(max_user_watches < 0); |
1443 | 1532 | ||
1533 | /* | ||
1534 | * Initialize the structure used to perform epoll file descriptor | ||
1535 | * inclusion loops checks. | ||
1536 | */ | ||
1537 | ep_nested_calls_init(&poll_loop_ncalls); | ||
1538 | |||
1444 | /* Initialize the structure used to perform safe poll wait head wake ups */ | 1539 | /* Initialize the structure used to perform safe poll wait head wake ups */ |
1445 | ep_nested_calls_init(&poll_safewake_ncalls); | 1540 | ep_nested_calls_init(&poll_safewake_ncalls); |
1446 | 1541 | ||
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index bfed8447ed80..83543b5ff941 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c | |||
@@ -1283,8 +1283,11 @@ static int fuse_do_setattr(struct dentry *entry, struct iattr *attr, | |||
1283 | if (err) | 1283 | if (err) |
1284 | return err; | 1284 | return err; |
1285 | 1285 | ||
1286 | if ((attr->ia_valid & ATTR_OPEN) && fc->atomic_o_trunc) | 1286 | if (attr->ia_valid & ATTR_OPEN) { |
1287 | return 0; | 1287 | if (fc->atomic_o_trunc) |
1288 | return 0; | ||
1289 | file = NULL; | ||
1290 | } | ||
1288 | 1291 | ||
1289 | if (attr->ia_valid & ATTR_SIZE) | 1292 | if (attr->ia_valid & ATTR_SIZE) |
1290 | is_truncate = true; | 1293 | is_truncate = true; |
diff --git a/fs/fuse/file.c b/fs/fuse/file.c index 95da1bc1c826..9e0832dbb1e3 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c | |||
@@ -86,18 +86,52 @@ struct fuse_file *fuse_file_get(struct fuse_file *ff) | |||
86 | return ff; | 86 | return ff; |
87 | } | 87 | } |
88 | 88 | ||
89 | static void fuse_release_async(struct work_struct *work) | ||
90 | { | ||
91 | struct fuse_req *req; | ||
92 | struct fuse_conn *fc; | ||
93 | struct path path; | ||
94 | |||
95 | req = container_of(work, struct fuse_req, misc.release.work); | ||
96 | path = req->misc.release.path; | ||
97 | fc = get_fuse_conn(path.dentry->d_inode); | ||
98 | |||
99 | fuse_put_request(fc, req); | ||
100 | path_put(&path); | ||
101 | } | ||
102 | |||
89 | static void fuse_release_end(struct fuse_conn *fc, struct fuse_req *req) | 103 | static void fuse_release_end(struct fuse_conn *fc, struct fuse_req *req) |
90 | { | 104 | { |
91 | path_put(&req->misc.release.path); | 105 | if (fc->destroy_req) { |
106 | /* | ||
107 | * If this is a fuseblk mount, then it's possible that | ||
108 | * releasing the path will result in releasing the | ||
109 | * super block and sending the DESTROY request. If | ||
110 | * the server is single threaded, this would hang. | ||
111 | * For this reason do the path_put() in a separate | ||
112 | * thread. | ||
113 | */ | ||
114 | atomic_inc(&req->count); | ||
115 | INIT_WORK(&req->misc.release.work, fuse_release_async); | ||
116 | schedule_work(&req->misc.release.work); | ||
117 | } else { | ||
118 | path_put(&req->misc.release.path); | ||
119 | } | ||
92 | } | 120 | } |
93 | 121 | ||
94 | static void fuse_file_put(struct fuse_file *ff) | 122 | static void fuse_file_put(struct fuse_file *ff, bool sync) |
95 | { | 123 | { |
96 | if (atomic_dec_and_test(&ff->count)) { | 124 | if (atomic_dec_and_test(&ff->count)) { |
97 | struct fuse_req *req = ff->reserved_req; | 125 | struct fuse_req *req = ff->reserved_req; |
98 | 126 | ||
99 | req->end = fuse_release_end; | 127 | if (sync) { |
100 | fuse_request_send_background(ff->fc, req); | 128 | fuse_request_send(ff->fc, req); |
129 | path_put(&req->misc.release.path); | ||
130 | fuse_put_request(ff->fc, req); | ||
131 | } else { | ||
132 | req->end = fuse_release_end; | ||
133 | fuse_request_send_background(ff->fc, req); | ||
134 | } | ||
101 | kfree(ff); | 135 | kfree(ff); |
102 | } | 136 | } |
103 | } | 137 | } |
@@ -219,8 +253,12 @@ void fuse_release_common(struct file *file, int opcode) | |||
219 | * Normally this will send the RELEASE request, however if | 253 | * Normally this will send the RELEASE request, however if |
220 | * some asynchronous READ or WRITE requests are outstanding, | 254 | * some asynchronous READ or WRITE requests are outstanding, |
221 | * the sending will be delayed. | 255 | * the sending will be delayed. |
256 | * | ||
257 | * Make the release synchronous if this is a fuseblk mount, | ||
258 | * synchronous RELEASE is allowed (and desirable) in this case | ||
259 | * because the server can be trusted not to screw up. | ||
222 | */ | 260 | */ |
223 | fuse_file_put(ff); | 261 | fuse_file_put(ff, ff->fc->destroy_req != NULL); |
224 | } | 262 | } |
225 | 263 | ||
226 | static int fuse_open(struct inode *inode, struct file *file) | 264 | static int fuse_open(struct inode *inode, struct file *file) |
@@ -558,7 +596,7 @@ static void fuse_readpages_end(struct fuse_conn *fc, struct fuse_req *req) | |||
558 | page_cache_release(page); | 596 | page_cache_release(page); |
559 | } | 597 | } |
560 | if (req->ff) | 598 | if (req->ff) |
561 | fuse_file_put(req->ff); | 599 | fuse_file_put(req->ff, false); |
562 | } | 600 | } |
563 | 601 | ||
564 | static void fuse_send_readpages(struct fuse_req *req, struct file *file) | 602 | static void fuse_send_readpages(struct fuse_req *req, struct file *file) |
@@ -1137,7 +1175,7 @@ static ssize_t fuse_direct_write(struct file *file, const char __user *buf, | |||
1137 | static void fuse_writepage_free(struct fuse_conn *fc, struct fuse_req *req) | 1175 | static void fuse_writepage_free(struct fuse_conn *fc, struct fuse_req *req) |
1138 | { | 1176 | { |
1139 | __free_page(req->pages[0]); | 1177 | __free_page(req->pages[0]); |
1140 | fuse_file_put(req->ff); | 1178 | fuse_file_put(req->ff, false); |
1141 | } | 1179 | } |
1142 | 1180 | ||
1143 | static void fuse_writepage_finish(struct fuse_conn *fc, struct fuse_req *req) | 1181 | static void fuse_writepage_finish(struct fuse_conn *fc, struct fuse_req *req) |
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index ae5744a2f9e9..d4286947bc2c 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/rwsem.h> | 21 | #include <linux/rwsem.h> |
22 | #include <linux/rbtree.h> | 22 | #include <linux/rbtree.h> |
23 | #include <linux/poll.h> | 23 | #include <linux/poll.h> |
24 | #include <linux/workqueue.h> | ||
24 | 25 | ||
25 | /** Max number of pages that can be used in a single read request */ | 26 | /** Max number of pages that can be used in a single read request */ |
26 | #define FUSE_MAX_PAGES_PER_REQ 32 | 27 | #define FUSE_MAX_PAGES_PER_REQ 32 |
@@ -262,7 +263,10 @@ struct fuse_req { | |||
262 | /** Data for asynchronous requests */ | 263 | /** Data for asynchronous requests */ |
263 | union { | 264 | union { |
264 | struct { | 265 | struct { |
265 | struct fuse_release_in in; | 266 | union { |
267 | struct fuse_release_in in; | ||
268 | struct work_struct work; | ||
269 | }; | ||
266 | struct path path; | 270 | struct path path; |
267 | } release; | 271 | } release; |
268 | struct fuse_init_in init_in; | 272 | struct fuse_init_in init_in; |
diff --git a/fs/gfs2/main.c b/fs/gfs2/main.c index 85ba027d1c4d..72c31a315d96 100644 --- a/fs/gfs2/main.c +++ b/fs/gfs2/main.c | |||
@@ -59,14 +59,7 @@ static void gfs2_init_gl_aspace_once(void *foo) | |||
59 | struct address_space *mapping = (struct address_space *)(gl + 1); | 59 | struct address_space *mapping = (struct address_space *)(gl + 1); |
60 | 60 | ||
61 | gfs2_init_glock_once(gl); | 61 | gfs2_init_glock_once(gl); |
62 | memset(mapping, 0, sizeof(*mapping)); | 62 | address_space_init_once(mapping); |
63 | INIT_RADIX_TREE(&mapping->page_tree, GFP_ATOMIC); | ||
64 | spin_lock_init(&mapping->tree_lock); | ||
65 | spin_lock_init(&mapping->i_mmap_lock); | ||
66 | INIT_LIST_HEAD(&mapping->private_list); | ||
67 | spin_lock_init(&mapping->private_lock); | ||
68 | INIT_RAW_PRIO_TREE_ROOT(&mapping->i_mmap); | ||
69 | INIT_LIST_HEAD(&mapping->i_mmap_nonlinear); | ||
70 | } | 63 | } |
71 | 64 | ||
72 | /** | 65 | /** |
diff --git a/fs/inode.c b/fs/inode.c index da85e56378f3..0647d80accf6 100644 --- a/fs/inode.c +++ b/fs/inode.c | |||
@@ -295,6 +295,20 @@ static void destroy_inode(struct inode *inode) | |||
295 | call_rcu(&inode->i_rcu, i_callback); | 295 | call_rcu(&inode->i_rcu, i_callback); |
296 | } | 296 | } |
297 | 297 | ||
298 | void address_space_init_once(struct address_space *mapping) | ||
299 | { | ||
300 | memset(mapping, 0, sizeof(*mapping)); | ||
301 | INIT_RADIX_TREE(&mapping->page_tree, GFP_ATOMIC); | ||
302 | spin_lock_init(&mapping->tree_lock); | ||
303 | spin_lock_init(&mapping->i_mmap_lock); | ||
304 | INIT_LIST_HEAD(&mapping->private_list); | ||
305 | spin_lock_init(&mapping->private_lock); | ||
306 | INIT_RAW_PRIO_TREE_ROOT(&mapping->i_mmap); | ||
307 | INIT_LIST_HEAD(&mapping->i_mmap_nonlinear); | ||
308 | mutex_init(&mapping->unmap_mutex); | ||
309 | } | ||
310 | EXPORT_SYMBOL(address_space_init_once); | ||
311 | |||
298 | /* | 312 | /* |
299 | * These are initializations that only need to be done | 313 | * These are initializations that only need to be done |
300 | * once, because the fields are idempotent across use | 314 | * once, because the fields are idempotent across use |
@@ -308,13 +322,7 @@ void inode_init_once(struct inode *inode) | |||
308 | INIT_LIST_HEAD(&inode->i_devices); | 322 | INIT_LIST_HEAD(&inode->i_devices); |
309 | INIT_LIST_HEAD(&inode->i_wb_list); | 323 | INIT_LIST_HEAD(&inode->i_wb_list); |
310 | INIT_LIST_HEAD(&inode->i_lru); | 324 | INIT_LIST_HEAD(&inode->i_lru); |
311 | INIT_RADIX_TREE(&inode->i_data.page_tree, GFP_ATOMIC); | 325 | address_space_init_once(&inode->i_data); |
312 | spin_lock_init(&inode->i_data.tree_lock); | ||
313 | spin_lock_init(&inode->i_data.i_mmap_lock); | ||
314 | INIT_LIST_HEAD(&inode->i_data.private_list); | ||
315 | spin_lock_init(&inode->i_data.private_lock); | ||
316 | INIT_RAW_PRIO_TREE_ROOT(&inode->i_data.i_mmap); | ||
317 | INIT_LIST_HEAD(&inode->i_data.i_mmap_nonlinear); | ||
318 | i_size_ordered_init(inode); | 326 | i_size_ordered_init(inode); |
319 | #ifdef CONFIG_FSNOTIFY | 327 | #ifdef CONFIG_FSNOTIFY |
320 | INIT_HLIST_HEAD(&inode->i_fsnotify_marks); | 328 | INIT_HLIST_HEAD(&inode->i_fsnotify_marks); |
@@ -540,11 +548,14 @@ void evict_inodes(struct super_block *sb) | |||
540 | /** | 548 | /** |
541 | * invalidate_inodes - attempt to free all inodes on a superblock | 549 | * invalidate_inodes - attempt to free all inodes on a superblock |
542 | * @sb: superblock to operate on | 550 | * @sb: superblock to operate on |
551 | * @kill_dirty: flag to guide handling of dirty inodes | ||
543 | * | 552 | * |
544 | * Attempts to free all inodes for a given superblock. If there were any | 553 | * Attempts to free all inodes for a given superblock. If there were any |
545 | * busy inodes return a non-zero value, else zero. | 554 | * busy inodes return a non-zero value, else zero. |
555 | * If @kill_dirty is set, discard dirty inodes too, otherwise treat | ||
556 | * them as busy. | ||
546 | */ | 557 | */ |
547 | int invalidate_inodes(struct super_block *sb) | 558 | int invalidate_inodes(struct super_block *sb, bool kill_dirty) |
548 | { | 559 | { |
549 | int busy = 0; | 560 | int busy = 0; |
550 | struct inode *inode, *next; | 561 | struct inode *inode, *next; |
@@ -556,6 +567,10 @@ int invalidate_inodes(struct super_block *sb) | |||
556 | list_for_each_entry_safe(inode, next, &sb->s_inodes, i_sb_list) { | 567 | list_for_each_entry_safe(inode, next, &sb->s_inodes, i_sb_list) { |
557 | if (inode->i_state & (I_NEW | I_FREEING | I_WILL_FREE)) | 568 | if (inode->i_state & (I_NEW | I_FREEING | I_WILL_FREE)) |
558 | continue; | 569 | continue; |
570 | if (inode->i_state & I_DIRTY && !kill_dirty) { | ||
571 | busy = 1; | ||
572 | continue; | ||
573 | } | ||
559 | if (atomic_read(&inode->i_count)) { | 574 | if (atomic_read(&inode->i_count)) { |
560 | busy = 1; | 575 | busy = 1; |
561 | continue; | 576 | continue; |
diff --git a/fs/internal.h b/fs/internal.h index 0663568b1247..9b976b57d7fe 100644 --- a/fs/internal.h +++ b/fs/internal.h | |||
@@ -112,4 +112,4 @@ extern void release_open_intent(struct nameidata *); | |||
112 | */ | 112 | */ |
113 | extern int get_nr_dirty_inodes(void); | 113 | extern int get_nr_dirty_inodes(void); |
114 | extern void evict_inodes(struct super_block *); | 114 | extern void evict_inodes(struct super_block *); |
115 | extern int invalidate_inodes(struct super_block *); | 115 | extern int invalidate_inodes(struct super_block *, bool); |
diff --git a/fs/namespace.c b/fs/namespace.c index 7b0b95371696..d1edf26025dc 100644 --- a/fs/namespace.c +++ b/fs/namespace.c | |||
@@ -1244,7 +1244,7 @@ static int do_umount(struct vfsmount *mnt, int flags) | |||
1244 | */ | 1244 | */ |
1245 | br_write_lock(vfsmount_lock); | 1245 | br_write_lock(vfsmount_lock); |
1246 | if (mnt_get_count(mnt) != 2) { | 1246 | if (mnt_get_count(mnt) != 2) { |
1247 | br_write_lock(vfsmount_lock); | 1247 | br_write_unlock(vfsmount_lock); |
1248 | return -EBUSY; | 1248 | return -EBUSY; |
1249 | } | 1249 | } |
1250 | br_write_unlock(vfsmount_lock); | 1250 | br_write_unlock(vfsmount_lock); |
diff --git a/fs/nilfs2/btnode.c b/fs/nilfs2/btnode.c index f4f1c08807ed..609cd223eea8 100644 --- a/fs/nilfs2/btnode.c +++ b/fs/nilfs2/btnode.c | |||
@@ -34,12 +34,6 @@ | |||
34 | #include "page.h" | 34 | #include "page.h" |
35 | #include "btnode.h" | 35 | #include "btnode.h" |
36 | 36 | ||
37 | |||
38 | void nilfs_btnode_cache_init_once(struct address_space *btnc) | ||
39 | { | ||
40 | nilfs_mapping_init_once(btnc); | ||
41 | } | ||
42 | |||
43 | void nilfs_btnode_cache_init(struct address_space *btnc, | 37 | void nilfs_btnode_cache_init(struct address_space *btnc, |
44 | struct backing_dev_info *bdi) | 38 | struct backing_dev_info *bdi) |
45 | { | 39 | { |
diff --git a/fs/nilfs2/btnode.h b/fs/nilfs2/btnode.h index 79037494f1e0..1b8ebd888c28 100644 --- a/fs/nilfs2/btnode.h +++ b/fs/nilfs2/btnode.h | |||
@@ -37,7 +37,6 @@ struct nilfs_btnode_chkey_ctxt { | |||
37 | struct buffer_head *newbh; | 37 | struct buffer_head *newbh; |
38 | }; | 38 | }; |
39 | 39 | ||
40 | void nilfs_btnode_cache_init_once(struct address_space *); | ||
41 | void nilfs_btnode_cache_init(struct address_space *, struct backing_dev_info *); | 40 | void nilfs_btnode_cache_init(struct address_space *, struct backing_dev_info *); |
42 | void nilfs_btnode_cache_clear(struct address_space *); | 41 | void nilfs_btnode_cache_clear(struct address_space *); |
43 | struct buffer_head *nilfs_btnode_create_block(struct address_space *btnc, | 42 | struct buffer_head *nilfs_btnode_create_block(struct address_space *btnc, |
diff --git a/fs/nilfs2/mdt.c b/fs/nilfs2/mdt.c index 3fdb61d79c9a..a649b05f7069 100644 --- a/fs/nilfs2/mdt.c +++ b/fs/nilfs2/mdt.c | |||
@@ -449,9 +449,9 @@ int nilfs_mdt_setup_shadow_map(struct inode *inode, | |||
449 | struct backing_dev_info *bdi = inode->i_sb->s_bdi; | 449 | struct backing_dev_info *bdi = inode->i_sb->s_bdi; |
450 | 450 | ||
451 | INIT_LIST_HEAD(&shadow->frozen_buffers); | 451 | INIT_LIST_HEAD(&shadow->frozen_buffers); |
452 | nilfs_mapping_init_once(&shadow->frozen_data); | 452 | address_space_init_once(&shadow->frozen_data); |
453 | nilfs_mapping_init(&shadow->frozen_data, bdi); | 453 | nilfs_mapping_init(&shadow->frozen_data, bdi); |
454 | nilfs_mapping_init_once(&shadow->frozen_btnodes); | 454 | address_space_init_once(&shadow->frozen_btnodes); |
455 | nilfs_mapping_init(&shadow->frozen_btnodes, bdi); | 455 | nilfs_mapping_init(&shadow->frozen_btnodes, bdi); |
456 | mi->mi_shadow = shadow; | 456 | mi->mi_shadow = shadow; |
457 | return 0; | 457 | return 0; |
diff --git a/fs/nilfs2/page.c b/fs/nilfs2/page.c index 3da37cc5de34..4d2a1ee0eb47 100644 --- a/fs/nilfs2/page.c +++ b/fs/nilfs2/page.c | |||
@@ -492,19 +492,6 @@ unsigned nilfs_page_count_clean_buffers(struct page *page, | |||
492 | return nc; | 492 | return nc; |
493 | } | 493 | } |
494 | 494 | ||
495 | void nilfs_mapping_init_once(struct address_space *mapping) | ||
496 | { | ||
497 | memset(mapping, 0, sizeof(*mapping)); | ||
498 | INIT_RADIX_TREE(&mapping->page_tree, GFP_ATOMIC); | ||
499 | spin_lock_init(&mapping->tree_lock); | ||
500 | INIT_LIST_HEAD(&mapping->private_list); | ||
501 | spin_lock_init(&mapping->private_lock); | ||
502 | |||
503 | spin_lock_init(&mapping->i_mmap_lock); | ||
504 | INIT_RAW_PRIO_TREE_ROOT(&mapping->i_mmap); | ||
505 | INIT_LIST_HEAD(&mapping->i_mmap_nonlinear); | ||
506 | } | ||
507 | |||
508 | void nilfs_mapping_init(struct address_space *mapping, | 495 | void nilfs_mapping_init(struct address_space *mapping, |
509 | struct backing_dev_info *bdi) | 496 | struct backing_dev_info *bdi) |
510 | { | 497 | { |
diff --git a/fs/nilfs2/page.h b/fs/nilfs2/page.h index ba4d6fd40b04..f06b79ad7493 100644 --- a/fs/nilfs2/page.h +++ b/fs/nilfs2/page.h | |||
@@ -61,7 +61,6 @@ void nilfs_free_private_page(struct page *); | |||
61 | int nilfs_copy_dirty_pages(struct address_space *, struct address_space *); | 61 | int nilfs_copy_dirty_pages(struct address_space *, struct address_space *); |
62 | void nilfs_copy_back_pages(struct address_space *, struct address_space *); | 62 | void nilfs_copy_back_pages(struct address_space *, struct address_space *); |
63 | void nilfs_clear_dirty_pages(struct address_space *); | 63 | void nilfs_clear_dirty_pages(struct address_space *); |
64 | void nilfs_mapping_init_once(struct address_space *mapping); | ||
65 | void nilfs_mapping_init(struct address_space *mapping, | 64 | void nilfs_mapping_init(struct address_space *mapping, |
66 | struct backing_dev_info *bdi); | 65 | struct backing_dev_info *bdi); |
67 | unsigned nilfs_page_count_clean_buffers(struct page *, unsigned, unsigned); | 66 | unsigned nilfs_page_count_clean_buffers(struct page *, unsigned, unsigned); |
diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c index 58fd707174e1..1673b3d99842 100644 --- a/fs/nilfs2/super.c +++ b/fs/nilfs2/super.c | |||
@@ -1279,7 +1279,7 @@ static void nilfs_inode_init_once(void *obj) | |||
1279 | #ifdef CONFIG_NILFS_XATTR | 1279 | #ifdef CONFIG_NILFS_XATTR |
1280 | init_rwsem(&ii->xattr_sem); | 1280 | init_rwsem(&ii->xattr_sem); |
1281 | #endif | 1281 | #endif |
1282 | nilfs_btnode_cache_init_once(&ii->i_btnode_cache); | 1282 | address_space_init_once(&ii->i_btnode_cache); |
1283 | ii->i_bmap = &ii->i_bmap_data; | 1283 | ii->i_bmap = &ii->i_bmap_data; |
1284 | inode_init_once(&ii->vfs_inode); | 1284 | inode_init_once(&ii->vfs_inode); |
1285 | } | 1285 | } |
diff --git a/fs/ocfs2/journal.h b/fs/ocfs2/journal.h index 43e56b97f9c0..6180da1e37e6 100644 --- a/fs/ocfs2/journal.h +++ b/fs/ocfs2/journal.h | |||
@@ -405,9 +405,9 @@ static inline int ocfs2_remove_extent_credits(struct super_block *sb) | |||
405 | ocfs2_quota_trans_credits(sb); | 405 | ocfs2_quota_trans_credits(sb); |
406 | } | 406 | } |
407 | 407 | ||
408 | /* data block for new dir/symlink, 2 for bitmap updates (bitmap fe + | 408 | /* data block for new dir/symlink, allocation of directory block, dx_root |
409 | * bitmap block for the new bit) dx_root update for free list */ | 409 | * update for free list */ |
410 | #define OCFS2_DIR_LINK_ADDITIONAL_CREDITS (1 + 2 + 1) | 410 | #define OCFS2_DIR_LINK_ADDITIONAL_CREDITS (1 + OCFS2_SUBALLOC_ALLOC + 1) |
411 | 411 | ||
412 | static inline int ocfs2_add_dir_index_credits(struct super_block *sb) | 412 | static inline int ocfs2_add_dir_index_credits(struct super_block *sb) |
413 | { | 413 | { |
diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c index b5f9160e93e9..19ebc5aad391 100644 --- a/fs/ocfs2/refcounttree.c +++ b/fs/ocfs2/refcounttree.c | |||
@@ -3228,7 +3228,7 @@ static int ocfs2_make_clusters_writable(struct super_block *sb, | |||
3228 | u32 num_clusters, unsigned int e_flags) | 3228 | u32 num_clusters, unsigned int e_flags) |
3229 | { | 3229 | { |
3230 | int ret, delete, index, credits = 0; | 3230 | int ret, delete, index, credits = 0; |
3231 | u32 new_bit, new_len; | 3231 | u32 new_bit, new_len, orig_num_clusters; |
3232 | unsigned int set_len; | 3232 | unsigned int set_len; |
3233 | struct ocfs2_super *osb = OCFS2_SB(sb); | 3233 | struct ocfs2_super *osb = OCFS2_SB(sb); |
3234 | handle_t *handle; | 3234 | handle_t *handle; |
@@ -3261,6 +3261,8 @@ static int ocfs2_make_clusters_writable(struct super_block *sb, | |||
3261 | goto out; | 3261 | goto out; |
3262 | } | 3262 | } |
3263 | 3263 | ||
3264 | orig_num_clusters = num_clusters; | ||
3265 | |||
3264 | while (num_clusters) { | 3266 | while (num_clusters) { |
3265 | ret = ocfs2_get_refcount_rec(ref_ci, context->ref_root_bh, | 3267 | ret = ocfs2_get_refcount_rec(ref_ci, context->ref_root_bh, |
3266 | p_cluster, num_clusters, | 3268 | p_cluster, num_clusters, |
@@ -3348,7 +3350,8 @@ static int ocfs2_make_clusters_writable(struct super_block *sb, | |||
3348 | * in write-back mode. | 3350 | * in write-back mode. |
3349 | */ | 3351 | */ |
3350 | if (context->get_clusters == ocfs2_di_get_clusters) { | 3352 | if (context->get_clusters == ocfs2_di_get_clusters) { |
3351 | ret = ocfs2_cow_sync_writeback(sb, context, cpos, num_clusters); | 3353 | ret = ocfs2_cow_sync_writeback(sb, context, cpos, |
3354 | orig_num_clusters); | ||
3352 | if (ret) | 3355 | if (ret) |
3353 | mlog_errno(ret); | 3356 | mlog_errno(ret); |
3354 | } | 3357 | } |
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index 38f986d2447e..36c423fb0635 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c | |||
@@ -1316,7 +1316,7 @@ static int ocfs2_parse_options(struct super_block *sb, | |||
1316 | struct mount_options *mopt, | 1316 | struct mount_options *mopt, |
1317 | int is_remount) | 1317 | int is_remount) |
1318 | { | 1318 | { |
1319 | int status; | 1319 | int status, user_stack = 0; |
1320 | char *p; | 1320 | char *p; |
1321 | u32 tmp; | 1321 | u32 tmp; |
1322 | 1322 | ||
@@ -1459,6 +1459,15 @@ static int ocfs2_parse_options(struct super_block *sb, | |||
1459 | memcpy(mopt->cluster_stack, args[0].from, | 1459 | memcpy(mopt->cluster_stack, args[0].from, |
1460 | OCFS2_STACK_LABEL_LEN); | 1460 | OCFS2_STACK_LABEL_LEN); |
1461 | mopt->cluster_stack[OCFS2_STACK_LABEL_LEN] = '\0'; | 1461 | mopt->cluster_stack[OCFS2_STACK_LABEL_LEN] = '\0'; |
1462 | /* | ||
1463 | * Open code the memcmp here as we don't have | ||
1464 | * an osb to pass to | ||
1465 | * ocfs2_userspace_stack(). | ||
1466 | */ | ||
1467 | if (memcmp(mopt->cluster_stack, | ||
1468 | OCFS2_CLASSIC_CLUSTER_STACK, | ||
1469 | OCFS2_STACK_LABEL_LEN)) | ||
1470 | user_stack = 1; | ||
1462 | break; | 1471 | break; |
1463 | case Opt_inode64: | 1472 | case Opt_inode64: |
1464 | mopt->mount_opt |= OCFS2_MOUNT_INODE64; | 1473 | mopt->mount_opt |= OCFS2_MOUNT_INODE64; |
@@ -1514,13 +1523,16 @@ static int ocfs2_parse_options(struct super_block *sb, | |||
1514 | } | 1523 | } |
1515 | } | 1524 | } |
1516 | 1525 | ||
1517 | /* Ensure only one heartbeat mode */ | 1526 | if (user_stack == 0) { |
1518 | tmp = mopt->mount_opt & (OCFS2_MOUNT_HB_LOCAL | OCFS2_MOUNT_HB_GLOBAL | | 1527 | /* Ensure only one heartbeat mode */ |
1519 | OCFS2_MOUNT_HB_NONE); | 1528 | tmp = mopt->mount_opt & (OCFS2_MOUNT_HB_LOCAL | |
1520 | if (hweight32(tmp) != 1) { | 1529 | OCFS2_MOUNT_HB_GLOBAL | |
1521 | mlog(ML_ERROR, "Invalid heartbeat mount options\n"); | 1530 | OCFS2_MOUNT_HB_NONE); |
1522 | status = 0; | 1531 | if (hweight32(tmp) != 1) { |
1523 | goto bail; | 1532 | mlog(ML_ERROR, "Invalid heartbeat mount options\n"); |
1533 | status = 0; | ||
1534 | goto bail; | ||
1535 | } | ||
1524 | } | 1536 | } |
1525 | 1537 | ||
1526 | status = 1; | 1538 | status = 1; |
diff --git a/fs/partitions/ldm.c b/fs/partitions/ldm.c index 789c625c7aa5..b10e3540d5b7 100644 --- a/fs/partitions/ldm.c +++ b/fs/partitions/ldm.c | |||
@@ -251,6 +251,11 @@ static bool ldm_parse_vmdb (const u8 *data, struct vmdb *vm) | |||
251 | } | 251 | } |
252 | 252 | ||
253 | vm->vblk_size = get_unaligned_be32(data + 0x08); | 253 | vm->vblk_size = get_unaligned_be32(data + 0x08); |
254 | if (vm->vblk_size == 0) { | ||
255 | ldm_error ("Illegal VBLK size"); | ||
256 | return false; | ||
257 | } | ||
258 | |||
254 | vm->vblk_offset = get_unaligned_be32(data + 0x0C); | 259 | vm->vblk_offset = get_unaligned_be32(data + 0x0C); |
255 | vm->last_vblk_seq = get_unaligned_be32(data + 0x04); | 260 | vm->last_vblk_seq = get_unaligned_be32(data + 0x04); |
256 | 261 | ||
diff --git a/fs/xfs/linux-2.6/xfs_discard.c b/fs/xfs/linux-2.6/xfs_discard.c index 05201ae719e5..d61611c88012 100644 --- a/fs/xfs/linux-2.6/xfs_discard.c +++ b/fs/xfs/linux-2.6/xfs_discard.c | |||
@@ -152,6 +152,8 @@ xfs_ioc_trim( | |||
152 | 152 | ||
153 | if (!capable(CAP_SYS_ADMIN)) | 153 | if (!capable(CAP_SYS_ADMIN)) |
154 | return -XFS_ERROR(EPERM); | 154 | return -XFS_ERROR(EPERM); |
155 | if (!blk_queue_discard(q)) | ||
156 | return -XFS_ERROR(EOPNOTSUPP); | ||
155 | if (copy_from_user(&range, urange, sizeof(range))) | 157 | if (copy_from_user(&range, urange, sizeof(range))) |
156 | return -XFS_ERROR(EFAULT); | 158 | return -XFS_ERROR(EFAULT); |
157 | 159 | ||
diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c index cec89dd5d7d2..85668efb3e3e 100644 --- a/fs/xfs/xfs_fsops.c +++ b/fs/xfs/xfs_fsops.c | |||
@@ -53,6 +53,9 @@ xfs_fs_geometry( | |||
53 | xfs_fsop_geom_t *geo, | 53 | xfs_fsop_geom_t *geo, |
54 | int new_version) | 54 | int new_version) |
55 | { | 55 | { |
56 | |||
57 | memset(geo, 0, sizeof(*geo)); | ||
58 | |||
56 | geo->blocksize = mp->m_sb.sb_blocksize; | 59 | geo->blocksize = mp->m_sb.sb_blocksize; |
57 | geo->rtextsize = mp->m_sb.sb_rextsize; | 60 | geo->rtextsize = mp->m_sb.sb_rextsize; |
58 | geo->agblocks = mp->m_sb.sb_agblocks; | 61 | geo->agblocks = mp->m_sb.sb_agblocks; |
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h index 31b6188df221..b4bfe338ea0e 100644 --- a/include/asm-generic/pgtable.h +++ b/include/asm-generic/pgtable.h | |||
@@ -4,6 +4,8 @@ | |||
4 | #ifndef __ASSEMBLY__ | 4 | #ifndef __ASSEMBLY__ |
5 | #ifdef CONFIG_MMU | 5 | #ifdef CONFIG_MMU |
6 | 6 | ||
7 | #include <linux/mm_types.h> | ||
8 | |||
7 | #ifndef __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS | 9 | #ifndef __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS |
8 | extern int ptep_set_access_flags(struct vm_area_struct *vma, | 10 | extern int ptep_set_access_flags(struct vm_area_struct *vma, |
9 | unsigned long address, pte_t *ptep, | 11 | unsigned long address, pte_t *ptep, |
diff --git a/include/drm/drmP.h b/include/drm/drmP.h index fe29aadb129d..348843b80150 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h | |||
@@ -1101,7 +1101,7 @@ struct drm_device { | |||
1101 | struct platform_device *platformdev; /**< Platform device struture */ | 1101 | struct platform_device *platformdev; /**< Platform device struture */ |
1102 | 1102 | ||
1103 | struct drm_sg_mem *sg; /**< Scatter gather memory */ | 1103 | struct drm_sg_mem *sg; /**< Scatter gather memory */ |
1104 | int num_crtcs; /**< Number of CRTCs on this device */ | 1104 | unsigned int num_crtcs; /**< Number of CRTCs on this device */ |
1105 | void *dev_private; /**< device private data */ | 1105 | void *dev_private; /**< device private data */ |
1106 | void *mm_private; | 1106 | void *mm_private; |
1107 | struct address_space *dev_mapping; | 1107 | struct address_space *dev_mapping; |
diff --git a/include/linux/bio.h b/include/linux/bio.h index 35dcdb3589bc..ce33e6868a2f 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h | |||
@@ -304,7 +304,6 @@ struct biovec_slab { | |||
304 | }; | 304 | }; |
305 | 305 | ||
306 | extern struct bio_set *fs_bio_set; | 306 | extern struct bio_set *fs_bio_set; |
307 | extern struct biovec_slab bvec_slabs[BIOVEC_NR_POOLS] __read_mostly; | ||
308 | 307 | ||
309 | /* | 308 | /* |
310 | * a small number of entries is fine, not going to be performance critical. | 309 | * a small number of entries is fine, not going to be performance critical. |
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 64ab2a1bb167..91fa428fa2c1 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -697,7 +697,7 @@ extern void blk_start_queue(struct request_queue *q); | |||
697 | extern void blk_stop_queue(struct request_queue *q); | 697 | extern void blk_stop_queue(struct request_queue *q); |
698 | extern void blk_sync_queue(struct request_queue *q); | 698 | extern void blk_sync_queue(struct request_queue *q); |
699 | extern void __blk_stop_queue(struct request_queue *q); | 699 | extern void __blk_stop_queue(struct request_queue *q); |
700 | extern void __blk_run_queue(struct request_queue *); | 700 | extern void __blk_run_queue(struct request_queue *q, bool force_kblockd); |
701 | extern void blk_run_queue(struct request_queue *); | 701 | extern void blk_run_queue(struct request_queue *); |
702 | extern int blk_rq_map_user(struct request_queue *, struct request *, | 702 | extern int blk_rq_map_user(struct request_queue *, struct request *, |
703 | struct rq_map_data *, void __user *, unsigned long, | 703 | struct rq_map_data *, void __user *, unsigned long, |
@@ -1109,7 +1109,6 @@ static inline void put_dev_sector(Sector p) | |||
1109 | 1109 | ||
1110 | struct work_struct; | 1110 | struct work_struct; |
1111 | int kblockd_schedule_work(struct request_queue *q, struct work_struct *work); | 1111 | int kblockd_schedule_work(struct request_queue *q, struct work_struct *work); |
1112 | int kblockd_schedule_delayed_work(struct request_queue *q, struct delayed_work *dwork, unsigned long delay); | ||
1113 | 1112 | ||
1114 | #ifdef CONFIG_BLK_CGROUP | 1113 | #ifdef CONFIG_BLK_CGROUP |
1115 | /* | 1114 | /* |
@@ -1157,8 +1156,6 @@ static inline uint64_t rq_io_start_time_ns(struct request *req) | |||
1157 | extern int blk_throtl_init(struct request_queue *q); | 1156 | extern int blk_throtl_init(struct request_queue *q); |
1158 | extern void blk_throtl_exit(struct request_queue *q); | 1157 | extern void blk_throtl_exit(struct request_queue *q); |
1159 | extern int blk_throtl_bio(struct request_queue *q, struct bio **bio); | 1158 | extern int blk_throtl_bio(struct request_queue *q, struct bio **bio); |
1160 | extern void throtl_schedule_delayed_work(struct request_queue *q, unsigned long delay); | ||
1161 | extern void throtl_shutdown_timer_wq(struct request_queue *q); | ||
1162 | #else /* CONFIG_BLK_DEV_THROTTLING */ | 1159 | #else /* CONFIG_BLK_DEV_THROTTLING */ |
1163 | static inline int blk_throtl_bio(struct request_queue *q, struct bio **bio) | 1160 | static inline int blk_throtl_bio(struct request_queue *q, struct bio **bio) |
1164 | { | 1161 | { |
@@ -1167,8 +1164,6 @@ static inline int blk_throtl_bio(struct request_queue *q, struct bio **bio) | |||
1167 | 1164 | ||
1168 | static inline int blk_throtl_init(struct request_queue *q) { return 0; } | 1165 | static inline int blk_throtl_init(struct request_queue *q) { return 0; } |
1169 | static inline int blk_throtl_exit(struct request_queue *q) { return 0; } | 1166 | static inline int blk_throtl_exit(struct request_queue *q) { return 0; } |
1170 | static inline void throtl_schedule_delayed_work(struct request_queue *q, unsigned long delay) {} | ||
1171 | static inline void throtl_shutdown_timer_wq(struct request_queue *q) {} | ||
1172 | #endif /* CONFIG_BLK_DEV_THROTTLING */ | 1167 | #endif /* CONFIG_BLK_DEV_THROTTLING */ |
1173 | 1168 | ||
1174 | #define MODULE_ALIAS_BLOCKDEV(major,minor) \ | 1169 | #define MODULE_ALIAS_BLOCKDEV(major,minor) \ |
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h index 3395cf7130f5..b22fb0d3db0f 100644 --- a/include/linux/blktrace_api.h +++ b/include/linux/blktrace_api.h | |||
@@ -245,7 +245,6 @@ static inline int blk_cmd_buf_len(struct request *rq) | |||
245 | 245 | ||
246 | extern void blk_dump_cmd(char *buf, struct request *rq); | 246 | extern void blk_dump_cmd(char *buf, struct request *rq); |
247 | extern void blk_fill_rwbs(char *rwbs, u32 rw, int bytes); | 247 | extern void blk_fill_rwbs(char *rwbs, u32 rw, int bytes); |
248 | extern void blk_fill_rwbs_rq(char *rwbs, struct request *rq); | ||
249 | 248 | ||
250 | #endif /* CONFIG_EVENT_TRACING && CONFIG_BLOCK */ | 249 | #endif /* CONFIG_EVENT_TRACING && CONFIG_BLOCK */ |
251 | 250 | ||
diff --git a/include/linux/dcbnl.h b/include/linux/dcbnl.h index 68cd248f6d3e..66900e3c6eb1 100644 --- a/include/linux/dcbnl.h +++ b/include/linux/dcbnl.h | |||
@@ -101,8 +101,8 @@ struct ieee_pfc { | |||
101 | */ | 101 | */ |
102 | struct dcb_app { | 102 | struct dcb_app { |
103 | __u8 selector; | 103 | __u8 selector; |
104 | __u32 protocol; | ||
105 | __u8 priority; | 104 | __u8 priority; |
105 | __u16 protocol; | ||
106 | }; | 106 | }; |
107 | 107 | ||
108 | struct dcbmsg { | 108 | struct dcbmsg { |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 543e226ea6a3..b95199daa5eb 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -638,6 +638,7 @@ struct address_space { | |||
638 | spinlock_t private_lock; /* for use by the address_space */ | 638 | spinlock_t private_lock; /* for use by the address_space */ |
639 | struct list_head private_list; /* ditto */ | 639 | struct list_head private_list; /* ditto */ |
640 | struct address_space *assoc_mapping; /* ditto */ | 640 | struct address_space *assoc_mapping; /* ditto */ |
641 | struct mutex unmap_mutex; /* to protect unmapping */ | ||
641 | } __attribute__((aligned(sizeof(long)))); | 642 | } __attribute__((aligned(sizeof(long)))); |
642 | /* | 643 | /* |
643 | * On most architectures that alignment is already the case; but | 644 | * On most architectures that alignment is already the case; but |
@@ -2128,7 +2129,7 @@ extern void check_disk_size_change(struct gendisk *disk, | |||
2128 | struct block_device *bdev); | 2129 | struct block_device *bdev); |
2129 | extern int revalidate_disk(struct gendisk *); | 2130 | extern int revalidate_disk(struct gendisk *); |
2130 | extern int check_disk_change(struct block_device *); | 2131 | extern int check_disk_change(struct block_device *); |
2131 | extern int __invalidate_device(struct block_device *); | 2132 | extern int __invalidate_device(struct block_device *, bool); |
2132 | extern int invalidate_partition(struct gendisk *, int); | 2133 | extern int invalidate_partition(struct gendisk *, int); |
2133 | #endif | 2134 | #endif |
2134 | unsigned long invalidate_mapping_pages(struct address_space *mapping, | 2135 | unsigned long invalidate_mapping_pages(struct address_space *mapping, |
@@ -2214,6 +2215,7 @@ extern loff_t vfs_llseek(struct file *file, loff_t offset, int origin); | |||
2214 | 2215 | ||
2215 | extern int inode_init_always(struct super_block *, struct inode *); | 2216 | extern int inode_init_always(struct super_block *, struct inode *); |
2216 | extern void inode_init_once(struct inode *); | 2217 | extern void inode_init_once(struct inode *); |
2218 | extern void address_space_init_once(struct address_space *mapping); | ||
2217 | extern void ihold(struct inode * inode); | 2219 | extern void ihold(struct inode * inode); |
2218 | extern void iput(struct inode *); | 2220 | extern void iput(struct inode *); |
2219 | extern struct inode * igrab(struct inode *); | 2221 | extern struct inode * igrab(struct inode *); |
diff --git a/include/linux/pm.h b/include/linux/pm.h index dd9c7ab38270..21415cc91cbb 100644 --- a/include/linux/pm.h +++ b/include/linux/pm.h | |||
@@ -431,6 +431,8 @@ struct dev_pm_info { | |||
431 | struct list_head entry; | 431 | struct list_head entry; |
432 | struct completion completion; | 432 | struct completion completion; |
433 | struct wakeup_source *wakeup; | 433 | struct wakeup_source *wakeup; |
434 | #else | ||
435 | unsigned int should_wakeup:1; | ||
434 | #endif | 436 | #endif |
435 | #ifdef CONFIG_PM_RUNTIME | 437 | #ifdef CONFIG_PM_RUNTIME |
436 | struct timer_list suspend_timer; | 438 | struct timer_list suspend_timer; |
diff --git a/include/linux/pm_wakeup.h b/include/linux/pm_wakeup.h index 9cff00dd6b63..03a67db03d01 100644 --- a/include/linux/pm_wakeup.h +++ b/include/linux/pm_wakeup.h | |||
@@ -109,11 +109,6 @@ static inline bool device_can_wakeup(struct device *dev) | |||
109 | return dev->power.can_wakeup; | 109 | return dev->power.can_wakeup; |
110 | } | 110 | } |
111 | 111 | ||
112 | static inline bool device_may_wakeup(struct device *dev) | ||
113 | { | ||
114 | return false; | ||
115 | } | ||
116 | |||
117 | static inline struct wakeup_source *wakeup_source_create(const char *name) | 112 | static inline struct wakeup_source *wakeup_source_create(const char *name) |
118 | { | 113 | { |
119 | return NULL; | 114 | return NULL; |
@@ -134,24 +129,32 @@ static inline void wakeup_source_unregister(struct wakeup_source *ws) {} | |||
134 | 129 | ||
135 | static inline int device_wakeup_enable(struct device *dev) | 130 | static inline int device_wakeup_enable(struct device *dev) |
136 | { | 131 | { |
137 | return -EINVAL; | 132 | dev->power.should_wakeup = true; |
133 | return 0; | ||
138 | } | 134 | } |
139 | 135 | ||
140 | static inline int device_wakeup_disable(struct device *dev) | 136 | static inline int device_wakeup_disable(struct device *dev) |
141 | { | 137 | { |
138 | dev->power.should_wakeup = false; | ||
142 | return 0; | 139 | return 0; |
143 | } | 140 | } |
144 | 141 | ||
145 | static inline int device_init_wakeup(struct device *dev, bool val) | 142 | static inline int device_set_wakeup_enable(struct device *dev, bool enable) |
146 | { | 143 | { |
147 | dev->power.can_wakeup = val; | 144 | dev->power.should_wakeup = enable; |
148 | return val ? -EINVAL : 0; | 145 | return 0; |
149 | } | 146 | } |
150 | 147 | ||
148 | static inline int device_init_wakeup(struct device *dev, bool val) | ||
149 | { | ||
150 | device_set_wakeup_capable(dev, val); | ||
151 | device_set_wakeup_enable(dev, val); | ||
152 | return 0; | ||
153 | } | ||
151 | 154 | ||
152 | static inline int device_set_wakeup_enable(struct device *dev, bool enable) | 155 | static inline bool device_may_wakeup(struct device *dev) |
153 | { | 156 | { |
154 | return -EINVAL; | 157 | return dev->power.can_wakeup && dev->power.should_wakeup; |
155 | } | 158 | } |
156 | 159 | ||
157 | static inline void __pm_stay_awake(struct wakeup_source *ws) {} | 160 | static inline void __pm_stay_awake(struct wakeup_source *ws) {} |
diff --git a/include/linux/rio_regs.h b/include/linux/rio_regs.h index d63dcbaea169..9026b30238f3 100644 --- a/include/linux/rio_regs.h +++ b/include/linux/rio_regs.h | |||
@@ -14,10 +14,12 @@ | |||
14 | #define LINUX_RIO_REGS_H | 14 | #define LINUX_RIO_REGS_H |
15 | 15 | ||
16 | /* | 16 | /* |
17 | * In RapidIO, each device has a 2MB configuration space that is | 17 | * In RapidIO, each device has a 16MB configuration space that is |
18 | * accessed via maintenance transactions. Portions of configuration | 18 | * accessed via maintenance transactions. Portions of configuration |
19 | * space are standardized and/or reserved. | 19 | * space are standardized and/or reserved. |
20 | */ | 20 | */ |
21 | #define RIO_MAINT_SPACE_SZ 0x1000000 /* 16MB of RapidIO mainenance space */ | ||
22 | |||
21 | #define RIO_DEV_ID_CAR 0x00 /* [I] Device Identity CAR */ | 23 | #define RIO_DEV_ID_CAR 0x00 /* [I] Device Identity CAR */ |
22 | #define RIO_DEV_INFO_CAR 0x04 /* [I] Device Information CAR */ | 24 | #define RIO_DEV_INFO_CAR 0x04 /* [I] Device Information CAR */ |
23 | #define RIO_ASM_ID_CAR 0x08 /* [I] Assembly Identity CAR */ | 25 | #define RIO_ASM_ID_CAR 0x08 /* [I] Assembly Identity CAR */ |
diff --git a/include/linux/thermal.h b/include/linux/thermal.h index 8651556dbd52..d3ec89fb4122 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h | |||
@@ -172,6 +172,14 @@ void thermal_zone_device_update(struct thermal_zone_device *); | |||
172 | struct thermal_cooling_device *thermal_cooling_device_register(char *, void *, | 172 | struct thermal_cooling_device *thermal_cooling_device_register(char *, void *, |
173 | const struct thermal_cooling_device_ops *); | 173 | const struct thermal_cooling_device_ops *); |
174 | void thermal_cooling_device_unregister(struct thermal_cooling_device *); | 174 | void thermal_cooling_device_unregister(struct thermal_cooling_device *); |
175 | |||
176 | #ifdef CONFIG_NET | ||
175 | extern int generate_netlink_event(u32 orig, enum events event); | 177 | extern int generate_netlink_event(u32 orig, enum events event); |
178 | #else | ||
179 | static inline int generate_netlink_event(u32 orig, enum events event) | ||
180 | { | ||
181 | return 0; | ||
182 | } | ||
183 | #endif | ||
176 | 184 | ||
177 | #endif /* __THERMAL_H__ */ | 185 | #endif /* __THERMAL_H__ */ |
diff --git a/include/net/ipv6.h b/include/net/ipv6.h index 4a3cd2cd2f5e..96e50e0ce3ca 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h | |||
@@ -89,6 +89,18 @@ | |||
89 | #define IPV6_ADDR_SCOPE_GLOBAL 0x0e | 89 | #define IPV6_ADDR_SCOPE_GLOBAL 0x0e |
90 | 90 | ||
91 | /* | 91 | /* |
92 | * Addr flags | ||
93 | */ | ||
94 | #ifdef __KERNEL__ | ||
95 | #define IPV6_ADDR_MC_FLAG_TRANSIENT(a) \ | ||
96 | ((a)->s6_addr[1] & 0x10) | ||
97 | #define IPV6_ADDR_MC_FLAG_PREFIX(a) \ | ||
98 | ((a)->s6_addr[1] & 0x20) | ||
99 | #define IPV6_ADDR_MC_FLAG_RENDEZVOUS(a) \ | ||
100 | ((a)->s6_addr[1] & 0x40) | ||
101 | #endif | ||
102 | |||
103 | /* | ||
92 | * fragmentation header | 104 | * fragmentation header |
93 | */ | 105 | */ |
94 | 106 | ||
diff --git a/include/net/netfilter/nf_tproxy_core.h b/include/net/netfilter/nf_tproxy_core.h index cd85b3bc8327..e505358d8999 100644 --- a/include/net/netfilter/nf_tproxy_core.h +++ b/include/net/netfilter/nf_tproxy_core.h | |||
@@ -201,18 +201,8 @@ nf_tproxy_get_sock_v6(struct net *net, const u8 protocol, | |||
201 | } | 201 | } |
202 | #endif | 202 | #endif |
203 | 203 | ||
204 | static inline void | ||
205 | nf_tproxy_put_sock(struct sock *sk) | ||
206 | { | ||
207 | /* TIME_WAIT inet sockets have to be handled differently */ | ||
208 | if ((sk->sk_protocol == IPPROTO_TCP) && (sk->sk_state == TCP_TIME_WAIT)) | ||
209 | inet_twsk_put(inet_twsk(sk)); | ||
210 | else | ||
211 | sock_put(sk); | ||
212 | } | ||
213 | |||
214 | /* assign a socket to the skb -- consumes sk */ | 204 | /* assign a socket to the skb -- consumes sk */ |
215 | int | 205 | void |
216 | nf_tproxy_assign_sock(struct sk_buff *skb, struct sock *sk); | 206 | nf_tproxy_assign_sock(struct sk_buff *skb, struct sock *sk); |
217 | 207 | ||
218 | #endif | 208 | #endif |
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index 160a407c1963..04f8556313d5 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h | |||
@@ -199,7 +199,7 @@ struct tcf_proto { | |||
199 | 199 | ||
200 | struct qdisc_skb_cb { | 200 | struct qdisc_skb_cb { |
201 | unsigned int pkt_len; | 201 | unsigned int pkt_len; |
202 | char data[]; | 202 | long data[]; |
203 | }; | 203 | }; |
204 | 204 | ||
205 | static inline int qdisc_qlen(struct Qdisc *q) | 205 | static inline int qdisc_qlen(struct Qdisc *q) |
diff --git a/include/pcmcia/ds.h b/include/pcmcia/ds.h index 8479b66c067b..3fd5064dd43a 100644 --- a/include/pcmcia/ds.h +++ b/include/pcmcia/ds.h | |||
@@ -261,6 +261,7 @@ void pcmcia_disable_device(struct pcmcia_device *p_dev); | |||
261 | #define CONF_ENABLE_ESR 0x0008 | 261 | #define CONF_ENABLE_ESR 0x0008 |
262 | #define CONF_ENABLE_IOCARD 0x0010 /* auto-enabled if IO resources or IRQ | 262 | #define CONF_ENABLE_IOCARD 0x0010 /* auto-enabled if IO resources or IRQ |
263 | * (CONF_ENABLE_IRQ) in use */ | 263 | * (CONF_ENABLE_IRQ) in use */ |
264 | #define CONF_ENABLE_ZVCARD 0x0020 | ||
264 | 265 | ||
265 | /* flags used by pcmcia_loop_config() autoconfiguration */ | 266 | /* flags used by pcmcia_loop_config() autoconfiguration */ |
266 | #define CONF_AUTO_CHECK_VCC 0x0100 /* check for matching Vcc? */ | 267 | #define CONF_AUTO_CHECK_VCC 0x0100 /* check for matching Vcc? */ |
diff --git a/include/sound/wm8903.h b/include/sound/wm8903.h index b4a0db2307ef..1eeebd534f7e 100644 --- a/include/sound/wm8903.h +++ b/include/sound/wm8903.h | |||
@@ -17,13 +17,9 @@ | |||
17 | /* | 17 | /* |
18 | * R6 (0x06) - Mic Bias Control 0 | 18 | * R6 (0x06) - Mic Bias Control 0 |
19 | */ | 19 | */ |
20 | #define WM8903_MICDET_HYST_ENA 0x0080 /* MICDET_HYST_ENA */ | 20 | #define WM8903_MICDET_THR_MASK 0x0030 /* MICDET_THR - [5:4] */ |
21 | #define WM8903_MICDET_HYST_ENA_MASK 0x0080 /* MICDET_HYST_ENA */ | 21 | #define WM8903_MICDET_THR_SHIFT 4 /* MICDET_THR - [5:4] */ |
22 | #define WM8903_MICDET_HYST_ENA_SHIFT 7 /* MICDET_HYST_ENA */ | 22 | #define WM8903_MICDET_THR_WIDTH 2 /* MICDET_THR - [5:4] */ |
23 | #define WM8903_MICDET_HYST_ENA_WIDTH 1 /* MICDET_HYST_ENA */ | ||
24 | #define WM8903_MICDET_THR_MASK 0x0070 /* MICDET_THR - [6:4] */ | ||
25 | #define WM8903_MICDET_THR_SHIFT 4 /* MICDET_THR - [6:4] */ | ||
26 | #define WM8903_MICDET_THR_WIDTH 3 /* MICDET_THR - [6:4] */ | ||
27 | #define WM8903_MICSHORT_THR_MASK 0x000C /* MICSHORT_THR - [3:2] */ | 23 | #define WM8903_MICSHORT_THR_MASK 0x000C /* MICSHORT_THR - [3:2] */ |
28 | #define WM8903_MICSHORT_THR_SHIFT 2 /* MICSHORT_THR - [3:2] */ | 24 | #define WM8903_MICSHORT_THR_SHIFT 2 /* MICSHORT_THR - [3:2] */ |
29 | #define WM8903_MICSHORT_THR_WIDTH 2 /* MICSHORT_THR - [3:2] */ | 25 | #define WM8903_MICSHORT_THR_WIDTH 2 /* MICSHORT_THR - [3:2] */ |
diff --git a/include/trace/events/block.h b/include/trace/events/block.h index aba421d68f6f..78f18adb49c8 100644 --- a/include/trace/events/block.h +++ b/include/trace/events/block.h | |||
@@ -31,7 +31,7 @@ DECLARE_EVENT_CLASS(block_rq_with_error, | |||
31 | 0 : blk_rq_sectors(rq); | 31 | 0 : blk_rq_sectors(rq); |
32 | __entry->errors = rq->errors; | 32 | __entry->errors = rq->errors; |
33 | 33 | ||
34 | blk_fill_rwbs_rq(__entry->rwbs, rq); | 34 | blk_fill_rwbs(__entry->rwbs, rq->cmd_flags, blk_rq_bytes(rq)); |
35 | blk_dump_cmd(__get_str(cmd), rq); | 35 | blk_dump_cmd(__get_str(cmd), rq); |
36 | ), | 36 | ), |
37 | 37 | ||
@@ -118,7 +118,7 @@ DECLARE_EVENT_CLASS(block_rq, | |||
118 | __entry->bytes = (rq->cmd_type == REQ_TYPE_BLOCK_PC) ? | 118 | __entry->bytes = (rq->cmd_type == REQ_TYPE_BLOCK_PC) ? |
119 | blk_rq_bytes(rq) : 0; | 119 | blk_rq_bytes(rq) : 0; |
120 | 120 | ||
121 | blk_fill_rwbs_rq(__entry->rwbs, rq); | 121 | blk_fill_rwbs(__entry->rwbs, rq->cmd_flags, blk_rq_bytes(rq)); |
122 | blk_dump_cmd(__get_str(cmd), rq); | 122 | blk_dump_cmd(__get_str(cmd), rq); |
123 | memcpy(__entry->comm, current->comm, TASK_COMM_LEN); | 123 | memcpy(__entry->comm, current->comm, TASK_COMM_LEN); |
124 | ), | 124 | ), |
@@ -563,7 +563,7 @@ TRACE_EVENT(block_rq_remap, | |||
563 | __entry->nr_sector = blk_rq_sectors(rq); | 563 | __entry->nr_sector = blk_rq_sectors(rq); |
564 | __entry->old_dev = dev; | 564 | __entry->old_dev = dev; |
565 | __entry->old_sector = from; | 565 | __entry->old_sector = from; |
566 | blk_fill_rwbs_rq(__entry->rwbs, rq); | 566 | blk_fill_rwbs(__entry->rwbs, rq->cmd_flags, blk_rq_bytes(rq)); |
567 | ), | 567 | ), |
568 | 568 | ||
569 | TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu", | 569 | TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu", |
diff --git a/kernel/irq/internals.h b/kernel/irq/internals.h index 4571ae7e085a..99c3bc8a6fb4 100644 --- a/kernel/irq/internals.h +++ b/kernel/irq/internals.h | |||
@@ -3,6 +3,12 @@ | |||
3 | */ | 3 | */ |
4 | #include <linux/irqdesc.h> | 4 | #include <linux/irqdesc.h> |
5 | 5 | ||
6 | #ifdef CONFIG_SPARSE_IRQ | ||
7 | # define IRQ_BITMAP_BITS (NR_IRQS + 8196) | ||
8 | #else | ||
9 | # define IRQ_BITMAP_BITS NR_IRQS | ||
10 | #endif | ||
11 | |||
6 | extern int noirqdebug; | 12 | extern int noirqdebug; |
7 | 13 | ||
8 | #define irq_data_to_desc(data) container_of(data, struct irq_desc, irq_data) | 14 | #define irq_data_to_desc(data) container_of(data, struct irq_desc, irq_data) |
diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c index 282f20230e67..2039bea31bdf 100644 --- a/kernel/irq/irqdesc.c +++ b/kernel/irq/irqdesc.c | |||
@@ -94,7 +94,7 @@ int nr_irqs = NR_IRQS; | |||
94 | EXPORT_SYMBOL_GPL(nr_irqs); | 94 | EXPORT_SYMBOL_GPL(nr_irqs); |
95 | 95 | ||
96 | static DEFINE_MUTEX(sparse_irq_lock); | 96 | static DEFINE_MUTEX(sparse_irq_lock); |
97 | static DECLARE_BITMAP(allocated_irqs, NR_IRQS); | 97 | static DECLARE_BITMAP(allocated_irqs, IRQ_BITMAP_BITS); |
98 | 98 | ||
99 | #ifdef CONFIG_SPARSE_IRQ | 99 | #ifdef CONFIG_SPARSE_IRQ |
100 | 100 | ||
@@ -217,6 +217,15 @@ int __init early_irq_init(void) | |||
217 | initcnt = arch_probe_nr_irqs(); | 217 | initcnt = arch_probe_nr_irqs(); |
218 | printk(KERN_INFO "NR_IRQS:%d nr_irqs:%d %d\n", NR_IRQS, nr_irqs, initcnt); | 218 | printk(KERN_INFO "NR_IRQS:%d nr_irqs:%d %d\n", NR_IRQS, nr_irqs, initcnt); |
219 | 219 | ||
220 | if (WARN_ON(nr_irqs > IRQ_BITMAP_BITS)) | ||
221 | nr_irqs = IRQ_BITMAP_BITS; | ||
222 | |||
223 | if (WARN_ON(initcnt > IRQ_BITMAP_BITS)) | ||
224 | initcnt = IRQ_BITMAP_BITS; | ||
225 | |||
226 | if (initcnt > nr_irqs) | ||
227 | nr_irqs = initcnt; | ||
228 | |||
220 | for (i = 0; i < initcnt; i++) { | 229 | for (i = 0; i < initcnt; i++) { |
221 | desc = alloc_desc(i, node); | 230 | desc = alloc_desc(i, node); |
222 | set_bit(i, allocated_irqs); | 231 | set_bit(i, allocated_irqs); |
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c index 0caa59f747dd..9033c1c70828 100644 --- a/kernel/irq/manage.c +++ b/kernel/irq/manage.c | |||
@@ -1100,7 +1100,7 @@ int request_threaded_irq(unsigned int irq, irq_handler_t handler, | |||
1100 | if (retval) | 1100 | if (retval) |
1101 | kfree(action); | 1101 | kfree(action); |
1102 | 1102 | ||
1103 | #ifdef CONFIG_DEBUG_SHIRQ | 1103 | #ifdef CONFIG_DEBUG_SHIRQ_FIXME |
1104 | if (!retval && (irqflags & IRQF_SHARED)) { | 1104 | if (!retval && (irqflags & IRQF_SHARED)) { |
1105 | /* | 1105 | /* |
1106 | * It's a shared IRQ -- the driver ought to be prepared for it | 1106 | * It's a shared IRQ -- the driver ought to be prepared for it |
diff --git a/kernel/irq/resend.c b/kernel/irq/resend.c index 891115a929aa..dc49358b73fa 100644 --- a/kernel/irq/resend.c +++ b/kernel/irq/resend.c | |||
@@ -23,7 +23,7 @@ | |||
23 | #ifdef CONFIG_HARDIRQS_SW_RESEND | 23 | #ifdef CONFIG_HARDIRQS_SW_RESEND |
24 | 24 | ||
25 | /* Bitmap to handle software resend of interrupts: */ | 25 | /* Bitmap to handle software resend of interrupts: */ |
26 | static DECLARE_BITMAP(irqs_resend, NR_IRQS); | 26 | static DECLARE_BITMAP(irqs_resend, IRQ_BITMAP_BITS); |
27 | 27 | ||
28 | /* | 28 | /* |
29 | * Run software resends of IRQ's | 29 | * Run software resends of IRQ's |
diff --git a/kernel/perf_event.c b/kernel/perf_event.c index 999835b6112b..656222fcf767 100644 --- a/kernel/perf_event.c +++ b/kernel/perf_event.c | |||
@@ -782,6 +782,10 @@ retry: | |||
782 | raw_spin_unlock_irq(&ctx->lock); | 782 | raw_spin_unlock_irq(&ctx->lock); |
783 | } | 783 | } |
784 | 784 | ||
785 | #define MAX_INTERRUPTS (~0ULL) | ||
786 | |||
787 | static void perf_log_throttle(struct perf_event *event, int enable); | ||
788 | |||
785 | static int | 789 | static int |
786 | event_sched_in(struct perf_event *event, | 790 | event_sched_in(struct perf_event *event, |
787 | struct perf_cpu_context *cpuctx, | 791 | struct perf_cpu_context *cpuctx, |
@@ -794,6 +798,17 @@ event_sched_in(struct perf_event *event, | |||
794 | 798 | ||
795 | event->state = PERF_EVENT_STATE_ACTIVE; | 799 | event->state = PERF_EVENT_STATE_ACTIVE; |
796 | event->oncpu = smp_processor_id(); | 800 | event->oncpu = smp_processor_id(); |
801 | |||
802 | /* | ||
803 | * Unthrottle events, since we scheduled we might have missed several | ||
804 | * ticks already, also for a heavily scheduling task there is little | ||
805 | * guarantee it'll get a tick in a timely manner. | ||
806 | */ | ||
807 | if (unlikely(event->hw.interrupts == MAX_INTERRUPTS)) { | ||
808 | perf_log_throttle(event, 1); | ||
809 | event->hw.interrupts = 0; | ||
810 | } | ||
811 | |||
797 | /* | 812 | /* |
798 | * The new state must be visible before we turn it on in the hardware: | 813 | * The new state must be visible before we turn it on in the hardware: |
799 | */ | 814 | */ |
@@ -1596,10 +1611,6 @@ void __perf_event_task_sched_in(struct task_struct *task) | |||
1596 | } | 1611 | } |
1597 | } | 1612 | } |
1598 | 1613 | ||
1599 | #define MAX_INTERRUPTS (~0ULL) | ||
1600 | |||
1601 | static void perf_log_throttle(struct perf_event *event, int enable); | ||
1602 | |||
1603 | static u64 perf_calculate_period(struct perf_event *event, u64 nsec, u64 count) | 1614 | static u64 perf_calculate_period(struct perf_event *event, u64 nsec, u64 count) |
1604 | { | 1615 | { |
1605 | u64 frequency = event->attr.sample_freq; | 1616 | u64 frequency = event->attr.sample_freq; |
diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c index 48b2761b5668..a3b5aff62606 100644 --- a/kernel/time/tick-broadcast.c +++ b/kernel/time/tick-broadcast.c | |||
@@ -600,4 +600,14 @@ int tick_broadcast_oneshot_active(void) | |||
600 | return tick_broadcast_device.mode == TICKDEV_MODE_ONESHOT; | 600 | return tick_broadcast_device.mode == TICKDEV_MODE_ONESHOT; |
601 | } | 601 | } |
602 | 602 | ||
603 | /* | ||
604 | * Check whether the broadcast device supports oneshot. | ||
605 | */ | ||
606 | bool tick_broadcast_oneshot_available(void) | ||
607 | { | ||
608 | struct clock_event_device *bc = tick_broadcast_device.evtdev; | ||
609 | |||
610 | return bc ? bc->features & CLOCK_EVT_FEAT_ONESHOT : false; | ||
611 | } | ||
612 | |||
603 | #endif | 613 | #endif |
diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c index 051bc80a0c43..ed228ef6f6b8 100644 --- a/kernel/time/tick-common.c +++ b/kernel/time/tick-common.c | |||
@@ -51,7 +51,11 @@ int tick_is_oneshot_available(void) | |||
51 | { | 51 | { |
52 | struct clock_event_device *dev = __this_cpu_read(tick_cpu_device.evtdev); | 52 | struct clock_event_device *dev = __this_cpu_read(tick_cpu_device.evtdev); |
53 | 53 | ||
54 | return dev && (dev->features & CLOCK_EVT_FEAT_ONESHOT); | 54 | if (!dev || !(dev->features & CLOCK_EVT_FEAT_ONESHOT)) |
55 | return 0; | ||
56 | if (!(dev->features & CLOCK_EVT_FEAT_C3STOP)) | ||
57 | return 1; | ||
58 | return tick_broadcast_oneshot_available(); | ||
55 | } | 59 | } |
56 | 60 | ||
57 | /* | 61 | /* |
diff --git a/kernel/time/tick-internal.h b/kernel/time/tick-internal.h index 290eefbc1f60..f65d3a723a64 100644 --- a/kernel/time/tick-internal.h +++ b/kernel/time/tick-internal.h | |||
@@ -36,6 +36,7 @@ extern void tick_shutdown_broadcast_oneshot(unsigned int *cpup); | |||
36 | extern int tick_resume_broadcast_oneshot(struct clock_event_device *bc); | 36 | extern int tick_resume_broadcast_oneshot(struct clock_event_device *bc); |
37 | extern int tick_broadcast_oneshot_active(void); | 37 | extern int tick_broadcast_oneshot_active(void); |
38 | extern void tick_check_oneshot_broadcast(int cpu); | 38 | extern void tick_check_oneshot_broadcast(int cpu); |
39 | bool tick_broadcast_oneshot_available(void); | ||
39 | # else /* BROADCAST */ | 40 | # else /* BROADCAST */ |
40 | static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc) | 41 | static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc) |
41 | { | 42 | { |
@@ -46,6 +47,7 @@ static inline void tick_broadcast_switch_to_oneshot(void) { } | |||
46 | static inline void tick_shutdown_broadcast_oneshot(unsigned int *cpup) { } | 47 | static inline void tick_shutdown_broadcast_oneshot(unsigned int *cpup) { } |
47 | static inline int tick_broadcast_oneshot_active(void) { return 0; } | 48 | static inline int tick_broadcast_oneshot_active(void) { return 0; } |
48 | static inline void tick_check_oneshot_broadcast(int cpu) { } | 49 | static inline void tick_check_oneshot_broadcast(int cpu) { } |
50 | static inline bool tick_broadcast_oneshot_available(void) { return true; } | ||
49 | # endif /* !BROADCAST */ | 51 | # endif /* !BROADCAST */ |
50 | 52 | ||
51 | #else /* !ONESHOT */ | 53 | #else /* !ONESHOT */ |
@@ -76,6 +78,7 @@ static inline int tick_resume_broadcast_oneshot(struct clock_event_device *bc) | |||
76 | return 0; | 78 | return 0; |
77 | } | 79 | } |
78 | static inline int tick_broadcast_oneshot_active(void) { return 0; } | 80 | static inline int tick_broadcast_oneshot_active(void) { return 0; } |
81 | static inline bool tick_broadcast_oneshot_available(void) { return false; } | ||
79 | #endif /* !TICK_ONESHOT */ | 82 | #endif /* !TICK_ONESHOT */ |
80 | 83 | ||
81 | /* | 84 | /* |
diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index d95721f33702..cbafed7d4f38 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c | |||
@@ -1827,21 +1827,5 @@ void blk_fill_rwbs(char *rwbs, u32 rw, int bytes) | |||
1827 | rwbs[i] = '\0'; | 1827 | rwbs[i] = '\0'; |
1828 | } | 1828 | } |
1829 | 1829 | ||
1830 | void blk_fill_rwbs_rq(char *rwbs, struct request *rq) | ||
1831 | { | ||
1832 | int rw = rq->cmd_flags & 0x03; | ||
1833 | int bytes; | ||
1834 | |||
1835 | if (rq->cmd_flags & REQ_DISCARD) | ||
1836 | rw |= REQ_DISCARD; | ||
1837 | |||
1838 | if (rq->cmd_flags & REQ_SECURE) | ||
1839 | rw |= REQ_SECURE; | ||
1840 | |||
1841 | bytes = blk_rq_bytes(rq); | ||
1842 | |||
1843 | blk_fill_rwbs(rwbs, rw, bytes); | ||
1844 | } | ||
1845 | |||
1846 | #endif /* CONFIG_EVENT_TRACING */ | 1830 | #endif /* CONFIG_EVENT_TRACING */ |
1847 | 1831 | ||
diff --git a/lib/swiotlb.c b/lib/swiotlb.c index c47bbe11b804..93ca08b8a451 100644 --- a/lib/swiotlb.c +++ b/lib/swiotlb.c | |||
@@ -686,8 +686,10 @@ dma_addr_t swiotlb_map_page(struct device *dev, struct page *page, | |||
686 | /* | 686 | /* |
687 | * Ensure that the address returned is DMA'ble | 687 | * Ensure that the address returned is DMA'ble |
688 | */ | 688 | */ |
689 | if (!dma_capable(dev, dev_addr, size)) | 689 | if (!dma_capable(dev, dev_addr, size)) { |
690 | panic("map_single: bounce buffer is not DMA'ble"); | 690 | swiotlb_tbl_unmap_single(dev, map, size, dir); |
691 | dev_addr = swiotlb_virt_to_bus(dev, io_tlb_overflow_buffer); | ||
692 | } | ||
691 | 693 | ||
692 | return dev_addr; | 694 | return dev_addr; |
693 | } | 695 | } |
diff --git a/mm/memory.c b/mm/memory.c index 8e8c18324863..5823698c2b71 100644 --- a/mm/memory.c +++ b/mm/memory.c | |||
@@ -2648,6 +2648,7 @@ void unmap_mapping_range(struct address_space *mapping, | |||
2648 | details.last_index = ULONG_MAX; | 2648 | details.last_index = ULONG_MAX; |
2649 | details.i_mmap_lock = &mapping->i_mmap_lock; | 2649 | details.i_mmap_lock = &mapping->i_mmap_lock; |
2650 | 2650 | ||
2651 | mutex_lock(&mapping->unmap_mutex); | ||
2651 | spin_lock(&mapping->i_mmap_lock); | 2652 | spin_lock(&mapping->i_mmap_lock); |
2652 | 2653 | ||
2653 | /* Protect against endless unmapping loops */ | 2654 | /* Protect against endless unmapping loops */ |
@@ -2664,6 +2665,7 @@ void unmap_mapping_range(struct address_space *mapping, | |||
2664 | if (unlikely(!list_empty(&mapping->i_mmap_nonlinear))) | 2665 | if (unlikely(!list_empty(&mapping->i_mmap_nonlinear))) |
2665 | unmap_mapping_range_list(&mapping->i_mmap_nonlinear, &details); | 2666 | unmap_mapping_range_list(&mapping->i_mmap_nonlinear, &details); |
2666 | spin_unlock(&mapping->i_mmap_lock); | 2667 | spin_unlock(&mapping->i_mmap_lock); |
2668 | mutex_unlock(&mapping->unmap_mutex); | ||
2667 | } | 2669 | } |
2668 | EXPORT_SYMBOL(unmap_mapping_range); | 2670 | EXPORT_SYMBOL(unmap_mapping_range); |
2669 | 2671 | ||
diff --git a/mm/mempolicy.c b/mm/mempolicy.c index 368fc9d23610..49355a970be2 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c | |||
@@ -1830,7 +1830,7 @@ alloc_pages_vma(gfp_t gfp, int order, struct vm_area_struct *vma, | |||
1830 | if (unlikely(pol->mode == MPOL_INTERLEAVE)) { | 1830 | if (unlikely(pol->mode == MPOL_INTERLEAVE)) { |
1831 | unsigned nid; | 1831 | unsigned nid; |
1832 | 1832 | ||
1833 | nid = interleave_nid(pol, vma, addr, PAGE_SHIFT); | 1833 | nid = interleave_nid(pol, vma, addr, PAGE_SHIFT + order); |
1834 | mpol_cond_put(pol); | 1834 | mpol_cond_put(pol); |
1835 | page = alloc_page_interleave(gfp, order, nid); | 1835 | page = alloc_page_interleave(gfp, order, nid); |
1836 | put_mems_allowed(); | 1836 | put_mems_allowed(); |
diff --git a/mm/migrate.c b/mm/migrate.c index 766115253807..352de555626c 100644 --- a/mm/migrate.c +++ b/mm/migrate.c | |||
@@ -1287,14 +1287,14 @@ SYSCALL_DEFINE6(move_pages, pid_t, pid, unsigned long, nr_pages, | |||
1287 | return -EPERM; | 1287 | return -EPERM; |
1288 | 1288 | ||
1289 | /* Find the mm_struct */ | 1289 | /* Find the mm_struct */ |
1290 | read_lock(&tasklist_lock); | 1290 | rcu_read_lock(); |
1291 | task = pid ? find_task_by_vpid(pid) : current; | 1291 | task = pid ? find_task_by_vpid(pid) : current; |
1292 | if (!task) { | 1292 | if (!task) { |
1293 | read_unlock(&tasklist_lock); | 1293 | rcu_read_unlock(); |
1294 | return -ESRCH; | 1294 | return -ESRCH; |
1295 | } | 1295 | } |
1296 | mm = get_task_mm(task); | 1296 | mm = get_task_mm(task); |
1297 | read_unlock(&tasklist_lock); | 1297 | rcu_read_unlock(); |
1298 | 1298 | ||
1299 | if (!mm) | 1299 | if (!mm) |
1300 | return -EINVAL; | 1300 | return -EINVAL; |
diff --git a/mm/mremap.c b/mm/mremap.c index 9925b6391b80..1de98d492ddc 100644 --- a/mm/mremap.c +++ b/mm/mremap.c | |||
@@ -94,9 +94,7 @@ static void move_ptes(struct vm_area_struct *vma, pmd_t *old_pmd, | |||
94 | */ | 94 | */ |
95 | mapping = vma->vm_file->f_mapping; | 95 | mapping = vma->vm_file->f_mapping; |
96 | spin_lock(&mapping->i_mmap_lock); | 96 | spin_lock(&mapping->i_mmap_lock); |
97 | if (new_vma->vm_truncate_count && | 97 | new_vma->vm_truncate_count = 0; |
98 | new_vma->vm_truncate_count != vma->vm_truncate_count) | ||
99 | new_vma->vm_truncate_count = 0; | ||
100 | } | 98 | } |
101 | 99 | ||
102 | /* | 100 | /* |
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index a873e61e312e..cdef1d4b4e47 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -5376,10 +5376,9 @@ __count_immobile_pages(struct zone *zone, struct page *page, int count) | |||
5376 | for (found = 0, iter = 0; iter < pageblock_nr_pages; iter++) { | 5376 | for (found = 0, iter = 0; iter < pageblock_nr_pages; iter++) { |
5377 | unsigned long check = pfn + iter; | 5377 | unsigned long check = pfn + iter; |
5378 | 5378 | ||
5379 | if (!pfn_valid_within(check)) { | 5379 | if (!pfn_valid_within(check)) |
5380 | iter++; | ||
5381 | continue; | 5380 | continue; |
5382 | } | 5381 | |
5383 | page = pfn_to_page(check); | 5382 | page = pfn_to_page(check); |
5384 | if (!page_count(page)) { | 5383 | if (!page_count(page)) { |
5385 | if (PageBuddy(page)) | 5384 | if (PageBuddy(page)) |
diff --git a/mm/swapfile.c b/mm/swapfile.c index 7ceea78ceb20..64d627ab624c 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c | |||
@@ -1903,7 +1903,7 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags) | |||
1903 | 1903 | ||
1904 | error = -EINVAL; | 1904 | error = -EINVAL; |
1905 | if (S_ISBLK(inode->i_mode)) { | 1905 | if (S_ISBLK(inode->i_mode)) { |
1906 | bdev = I_BDEV(inode); | 1906 | bdev = bdgrab(I_BDEV(inode)); |
1907 | error = blkdev_get(bdev, FMODE_READ | FMODE_WRITE | FMODE_EXCL, | 1907 | error = blkdev_get(bdev, FMODE_READ | FMODE_WRITE | FMODE_EXCL, |
1908 | sys_swapon); | 1908 | sys_swapon); |
1909 | if (error < 0) { | 1909 | if (error < 0) { |
diff --git a/mm/truncate.c b/mm/truncate.c index 49feb46e77b8..d64296be00d3 100644 --- a/mm/truncate.c +++ b/mm/truncate.c | |||
@@ -225,6 +225,7 @@ void truncate_inode_pages_range(struct address_space *mapping, | |||
225 | next = start; | 225 | next = start; |
226 | while (next <= end && | 226 | while (next <= end && |
227 | pagevec_lookup(&pvec, mapping, next, PAGEVEC_SIZE)) { | 227 | pagevec_lookup(&pvec, mapping, next, PAGEVEC_SIZE)) { |
228 | mem_cgroup_uncharge_start(); | ||
228 | for (i = 0; i < pagevec_count(&pvec); i++) { | 229 | for (i = 0; i < pagevec_count(&pvec); i++) { |
229 | struct page *page = pvec.pages[i]; | 230 | struct page *page = pvec.pages[i]; |
230 | pgoff_t page_index = page->index; | 231 | pgoff_t page_index = page->index; |
@@ -247,6 +248,7 @@ void truncate_inode_pages_range(struct address_space *mapping, | |||
247 | unlock_page(page); | 248 | unlock_page(page); |
248 | } | 249 | } |
249 | pagevec_release(&pvec); | 250 | pagevec_release(&pvec); |
251 | mem_cgroup_uncharge_end(); | ||
250 | cond_resched(); | 252 | cond_resched(); |
251 | } | 253 | } |
252 | 254 | ||
diff --git a/mm/vmscan.c b/mm/vmscan.c index 251bed73ac03..951cac21c2e7 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c | |||
@@ -1841,16 +1841,28 @@ static inline bool should_continue_reclaim(struct zone *zone, | |||
1841 | if (!(sc->reclaim_mode & RECLAIM_MODE_COMPACTION)) | 1841 | if (!(sc->reclaim_mode & RECLAIM_MODE_COMPACTION)) |
1842 | return false; | 1842 | return false; |
1843 | 1843 | ||
1844 | /* | 1844 | /* Consider stopping depending on scan and reclaim activity */ |
1845 | * If we failed to reclaim and have scanned the full list, stop. | 1845 | if (sc->gfp_mask & __GFP_REPEAT) { |
1846 | * NOTE: Checking just nr_reclaimed would exit reclaim/compaction far | 1846 | /* |
1847 | * faster but obviously would be less likely to succeed | 1847 | * For __GFP_REPEAT allocations, stop reclaiming if the |
1848 | * allocation. If this is desirable, use GFP_REPEAT to decide | 1848 | * full LRU list has been scanned and we are still failing |
1849 | * if both reclaimed and scanned should be checked or just | 1849 | * to reclaim pages. This full LRU scan is potentially |
1850 | * reclaimed | 1850 | * expensive but a __GFP_REPEAT caller really wants to succeed |
1851 | */ | 1851 | */ |
1852 | if (!nr_reclaimed && !nr_scanned) | 1852 | if (!nr_reclaimed && !nr_scanned) |
1853 | return false; | 1853 | return false; |
1854 | } else { | ||
1855 | /* | ||
1856 | * For non-__GFP_REPEAT allocations which can presumably | ||
1857 | * fail without consequence, stop if we failed to reclaim | ||
1858 | * any pages from the last SWAP_CLUSTER_MAX number of | ||
1859 | * pages that were scanned. This will return to the | ||
1860 | * caller faster at the risk reclaim/compaction and | ||
1861 | * the resulting allocation attempt fails | ||
1862 | */ | ||
1863 | if (!nr_reclaimed) | ||
1864 | return false; | ||
1865 | } | ||
1854 | 1866 | ||
1855 | /* | 1867 | /* |
1856 | * If we have not reclaimed enough pages for compaction and the | 1868 | * If we have not reclaimed enough pages for compaction and the |
diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c index 2575c2db6404..d7b9af4703d0 100644 --- a/net/bluetooth/rfcomm/tty.c +++ b/net/bluetooth/rfcomm/tty.c | |||
@@ -727,7 +727,9 @@ static int rfcomm_tty_open(struct tty_struct *tty, struct file *filp) | |||
727 | break; | 727 | break; |
728 | } | 728 | } |
729 | 729 | ||
730 | tty_unlock(); | ||
730 | schedule(); | 731 | schedule(); |
732 | tty_lock(); | ||
731 | } | 733 | } |
732 | set_current_state(TASK_RUNNING); | 734 | set_current_state(TASK_RUNNING); |
733 | remove_wait_queue(&dev->wait, &wait); | 735 | remove_wait_queue(&dev->wait, &wait); |
diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c index 09d5c0987925..030a002ff8ee 100644 --- a/net/bridge/br_multicast.c +++ b/net/bridge/br_multicast.c | |||
@@ -37,10 +37,9 @@ | |||
37 | rcu_dereference_protected(X, lockdep_is_held(&br->multicast_lock)) | 37 | rcu_dereference_protected(X, lockdep_is_held(&br->multicast_lock)) |
38 | 38 | ||
39 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | 39 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) |
40 | static inline int ipv6_is_local_multicast(const struct in6_addr *addr) | 40 | static inline int ipv6_is_transient_multicast(const struct in6_addr *addr) |
41 | { | 41 | { |
42 | if (ipv6_addr_is_multicast(addr) && | 42 | if (ipv6_addr_is_multicast(addr) && IPV6_ADDR_MC_FLAG_TRANSIENT(addr)) |
43 | IPV6_ADDR_MC_SCOPE(addr) <= IPV6_ADDR_SCOPE_LINKLOCAL) | ||
44 | return 1; | 43 | return 1; |
45 | return 0; | 44 | return 0; |
46 | } | 45 | } |
@@ -435,7 +434,6 @@ static struct sk_buff *br_ip6_multicast_alloc_query(struct net_bridge *br, | |||
435 | eth = eth_hdr(skb); | 434 | eth = eth_hdr(skb); |
436 | 435 | ||
437 | memcpy(eth->h_source, br->dev->dev_addr, 6); | 436 | memcpy(eth->h_source, br->dev->dev_addr, 6); |
438 | ipv6_eth_mc_map(group, eth->h_dest); | ||
439 | eth->h_proto = htons(ETH_P_IPV6); | 437 | eth->h_proto = htons(ETH_P_IPV6); |
440 | skb_put(skb, sizeof(*eth)); | 438 | skb_put(skb, sizeof(*eth)); |
441 | 439 | ||
@@ -447,8 +445,10 @@ static struct sk_buff *br_ip6_multicast_alloc_query(struct net_bridge *br, | |||
447 | ip6h->payload_len = htons(8 + sizeof(*mldq)); | 445 | ip6h->payload_len = htons(8 + sizeof(*mldq)); |
448 | ip6h->nexthdr = IPPROTO_HOPOPTS; | 446 | ip6h->nexthdr = IPPROTO_HOPOPTS; |
449 | ip6h->hop_limit = 1; | 447 | ip6h->hop_limit = 1; |
450 | ipv6_addr_set(&ip6h->saddr, 0, 0, 0, 0); | 448 | ipv6_dev_get_saddr(dev_net(br->dev), br->dev, &ip6h->daddr, 0, |
449 | &ip6h->saddr); | ||
451 | ipv6_addr_set(&ip6h->daddr, htonl(0xff020000), 0, 0, htonl(1)); | 450 | ipv6_addr_set(&ip6h->daddr, htonl(0xff020000), 0, 0, htonl(1)); |
451 | ipv6_eth_mc_map(&ip6h->daddr, eth->h_dest); | ||
452 | 452 | ||
453 | hopopt = (u8 *)(ip6h + 1); | 453 | hopopt = (u8 *)(ip6h + 1); |
454 | hopopt[0] = IPPROTO_ICMPV6; /* next hdr */ | 454 | hopopt[0] = IPPROTO_ICMPV6; /* next hdr */ |
@@ -780,11 +780,11 @@ static int br_ip6_multicast_add_group(struct net_bridge *br, | |||
780 | { | 780 | { |
781 | struct br_ip br_group; | 781 | struct br_ip br_group; |
782 | 782 | ||
783 | if (ipv6_is_local_multicast(group)) | 783 | if (!ipv6_is_transient_multicast(group)) |
784 | return 0; | 784 | return 0; |
785 | 785 | ||
786 | ipv6_addr_copy(&br_group.u.ip6, group); | 786 | ipv6_addr_copy(&br_group.u.ip6, group); |
787 | br_group.proto = htons(ETH_P_IP); | 787 | br_group.proto = htons(ETH_P_IPV6); |
788 | 788 | ||
789 | return br_multicast_add_group(br, port, &br_group); | 789 | return br_multicast_add_group(br, port, &br_group); |
790 | } | 790 | } |
@@ -1013,18 +1013,19 @@ static int br_ip6_multicast_mld2_report(struct net_bridge *br, | |||
1013 | 1013 | ||
1014 | nsrcs = skb_header_pointer(skb, | 1014 | nsrcs = skb_header_pointer(skb, |
1015 | len + offsetof(struct mld2_grec, | 1015 | len + offsetof(struct mld2_grec, |
1016 | grec_mca), | 1016 | grec_nsrcs), |
1017 | sizeof(_nsrcs), &_nsrcs); | 1017 | sizeof(_nsrcs), &_nsrcs); |
1018 | if (!nsrcs) | 1018 | if (!nsrcs) |
1019 | return -EINVAL; | 1019 | return -EINVAL; |
1020 | 1020 | ||
1021 | if (!pskb_may_pull(skb, | 1021 | if (!pskb_may_pull(skb, |
1022 | len + sizeof(*grec) + | 1022 | len + sizeof(*grec) + |
1023 | sizeof(struct in6_addr) * (*nsrcs))) | 1023 | sizeof(struct in6_addr) * ntohs(*nsrcs))) |
1024 | return -EINVAL; | 1024 | return -EINVAL; |
1025 | 1025 | ||
1026 | grec = (struct mld2_grec *)(skb->data + len); | 1026 | grec = (struct mld2_grec *)(skb->data + len); |
1027 | len += sizeof(*grec) + sizeof(struct in6_addr) * (*nsrcs); | 1027 | len += sizeof(*grec) + |
1028 | sizeof(struct in6_addr) * ntohs(*nsrcs); | ||
1028 | 1029 | ||
1029 | /* We treat these as MLDv1 reports for now. */ | 1030 | /* We treat these as MLDv1 reports for now. */ |
1030 | switch (grec->grec_type) { | 1031 | switch (grec->grec_type) { |
@@ -1340,7 +1341,7 @@ static void br_ip6_multicast_leave_group(struct net_bridge *br, | |||
1340 | { | 1341 | { |
1341 | struct br_ip br_group; | 1342 | struct br_ip br_group; |
1342 | 1343 | ||
1343 | if (ipv6_is_local_multicast(group)) | 1344 | if (!ipv6_is_transient_multicast(group)) |
1344 | return; | 1345 | return; |
1345 | 1346 | ||
1346 | ipv6_addr_copy(&br_group.u.ip6, group); | 1347 | ipv6_addr_copy(&br_group.u.ip6, group); |
diff --git a/net/ipv4/inet_timewait_sock.c b/net/ipv4/inet_timewait_sock.c index c5af909cf701..3c8dfa16614d 100644 --- a/net/ipv4/inet_timewait_sock.c +++ b/net/ipv4/inet_timewait_sock.c | |||
@@ -505,7 +505,9 @@ restart: | |||
505 | } | 505 | } |
506 | 506 | ||
507 | rcu_read_unlock(); | 507 | rcu_read_unlock(); |
508 | local_bh_disable(); | ||
508 | inet_twsk_deschedule(tw, twdr); | 509 | inet_twsk_deschedule(tw, twdr); |
510 | local_bh_enable(); | ||
509 | inet_twsk_put(tw); | 511 | inet_twsk_put(tw); |
510 | goto restart_rcu; | 512 | goto restart_rcu; |
511 | } | 513 | } |
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index eb7f82ebf4a3..65f6c0406245 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -1222,7 +1222,7 @@ static int tcp_check_dsack(struct sock *sk, struct sk_buff *ack_skb, | |||
1222 | } | 1222 | } |
1223 | 1223 | ||
1224 | /* D-SACK for already forgotten data... Do dumb counting. */ | 1224 | /* D-SACK for already forgotten data... Do dumb counting. */ |
1225 | if (dup_sack && | 1225 | if (dup_sack && tp->undo_marker && tp->undo_retrans && |
1226 | !after(end_seq_0, prior_snd_una) && | 1226 | !after(end_seq_0, prior_snd_una) && |
1227 | after(end_seq_0, tp->undo_marker)) | 1227 | after(end_seq_0, tp->undo_marker)) |
1228 | tp->undo_retrans--; | 1228 | tp->undo_retrans--; |
@@ -1299,7 +1299,8 @@ static u8 tcp_sacktag_one(struct sk_buff *skb, struct sock *sk, | |||
1299 | 1299 | ||
1300 | /* Account D-SACK for retransmitted packet. */ | 1300 | /* Account D-SACK for retransmitted packet. */ |
1301 | if (dup_sack && (sacked & TCPCB_RETRANS)) { | 1301 | if (dup_sack && (sacked & TCPCB_RETRANS)) { |
1302 | if (after(TCP_SKB_CB(skb)->end_seq, tp->undo_marker)) | 1302 | if (tp->undo_marker && tp->undo_retrans && |
1303 | after(TCP_SKB_CB(skb)->end_seq, tp->undo_marker)) | ||
1303 | tp->undo_retrans--; | 1304 | tp->undo_retrans--; |
1304 | if (sacked & TCPCB_SACKED_ACKED) | 1305 | if (sacked & TCPCB_SACKED_ACKED) |
1305 | state->reord = min(fack_count, state->reord); | 1306 | state->reord = min(fack_count, state->reord); |
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 406f320336e6..dfa5beb0c1c8 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
@@ -2162,7 +2162,7 @@ int tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb) | |||
2162 | if (!tp->retrans_stamp) | 2162 | if (!tp->retrans_stamp) |
2163 | tp->retrans_stamp = TCP_SKB_CB(skb)->when; | 2163 | tp->retrans_stamp = TCP_SKB_CB(skb)->when; |
2164 | 2164 | ||
2165 | tp->undo_retrans++; | 2165 | tp->undo_retrans += tcp_skb_pcount(skb); |
2166 | 2166 | ||
2167 | /* snd_nxt is stored to detect loss of retransmitted segment, | 2167 | /* snd_nxt is stored to detect loss of retransmitted segment, |
2168 | * see tcp_input.c tcp_sacktag_write_queue(). | 2168 | * see tcp_input.c tcp_sacktag_write_queue(). |
diff --git a/net/ipv6/netfilter/ip6t_LOG.c b/net/ipv6/netfilter/ip6t_LOG.c index 09c88891a753..de338037a736 100644 --- a/net/ipv6/netfilter/ip6t_LOG.c +++ b/net/ipv6/netfilter/ip6t_LOG.c | |||
@@ -410,7 +410,7 @@ fallback: | |||
410 | if (p != NULL) { | 410 | if (p != NULL) { |
411 | sb_add(m, "%02x", *p++); | 411 | sb_add(m, "%02x", *p++); |
412 | for (i = 1; i < len; i++) | 412 | for (i = 1; i < len; i++) |
413 | sb_add(m, ":%02x", p[i]); | 413 | sb_add(m, ":%02x", *p++); |
414 | } | 414 | } |
415 | sb_add(m, " "); | 415 | sb_add(m, " "); |
416 | 416 | ||
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index 8acba456744e..7a10a8d1b2d0 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c | |||
@@ -1229,6 +1229,7 @@ void ieee80211_remove_interfaces(struct ieee80211_local *local) | |||
1229 | } | 1229 | } |
1230 | mutex_unlock(&local->iflist_mtx); | 1230 | mutex_unlock(&local->iflist_mtx); |
1231 | unregister_netdevice_many(&unreg_list); | 1231 | unregister_netdevice_many(&unreg_list); |
1232 | list_del(&unreg_list); | ||
1232 | } | 1233 | } |
1233 | 1234 | ||
1234 | static u32 ieee80211_idle_off(struct ieee80211_local *local, | 1235 | static u32 ieee80211_idle_off(struct ieee80211_local *local, |
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 45fbb9e33746..c9ceb4d57ab0 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c | |||
@@ -1033,6 +1033,12 @@ void ieee80211_sta_rx_notify(struct ieee80211_sub_if_data *sdata, | |||
1033 | if (is_multicast_ether_addr(hdr->addr1)) | 1033 | if (is_multicast_ether_addr(hdr->addr1)) |
1034 | return; | 1034 | return; |
1035 | 1035 | ||
1036 | /* | ||
1037 | * In case we receive frames after disassociation. | ||
1038 | */ | ||
1039 | if (!sdata->u.mgd.associated) | ||
1040 | return; | ||
1041 | |||
1036 | ieee80211_sta_reset_conn_monitor(sdata); | 1042 | ieee80211_sta_reset_conn_monitor(sdata); |
1037 | } | 1043 | } |
1038 | 1044 | ||
diff --git a/net/netfilter/nf_tproxy_core.c b/net/netfilter/nf_tproxy_core.c index 4d87befb04c0..474d621cbc2e 100644 --- a/net/netfilter/nf_tproxy_core.c +++ b/net/netfilter/nf_tproxy_core.c | |||
@@ -28,26 +28,23 @@ nf_tproxy_destructor(struct sk_buff *skb) | |||
28 | skb->destructor = NULL; | 28 | skb->destructor = NULL; |
29 | 29 | ||
30 | if (sk) | 30 | if (sk) |
31 | nf_tproxy_put_sock(sk); | 31 | sock_put(sk); |
32 | } | 32 | } |
33 | 33 | ||
34 | /* consumes sk */ | 34 | /* consumes sk */ |
35 | int | 35 | void |
36 | nf_tproxy_assign_sock(struct sk_buff *skb, struct sock *sk) | 36 | nf_tproxy_assign_sock(struct sk_buff *skb, struct sock *sk) |
37 | { | 37 | { |
38 | bool transparent = (sk->sk_state == TCP_TIME_WAIT) ? | 38 | /* assigning tw sockets complicates things; most |
39 | inet_twsk(sk)->tw_transparent : | 39 | * skb->sk->X checks would have to test sk->sk_state first */ |
40 | inet_sk(sk)->transparent; | 40 | if (sk->sk_state == TCP_TIME_WAIT) { |
41 | 41 | inet_twsk_put(inet_twsk(sk)); | |
42 | if (transparent) { | 42 | return; |
43 | skb_orphan(skb); | 43 | } |
44 | skb->sk = sk; | 44 | |
45 | skb->destructor = nf_tproxy_destructor; | 45 | skb_orphan(skb); |
46 | return 1; | 46 | skb->sk = sk; |
47 | } else | 47 | skb->destructor = nf_tproxy_destructor; |
48 | nf_tproxy_put_sock(sk); | ||
49 | |||
50 | return 0; | ||
51 | } | 48 | } |
52 | EXPORT_SYMBOL_GPL(nf_tproxy_assign_sock); | 49 | EXPORT_SYMBOL_GPL(nf_tproxy_assign_sock); |
53 | 50 | ||
diff --git a/net/netfilter/xt_TPROXY.c b/net/netfilter/xt_TPROXY.c index 640678f47a2a..dcfd57eb9d02 100644 --- a/net/netfilter/xt_TPROXY.c +++ b/net/netfilter/xt_TPROXY.c | |||
@@ -33,6 +33,20 @@ | |||
33 | #include <net/netfilter/nf_tproxy_core.h> | 33 | #include <net/netfilter/nf_tproxy_core.h> |
34 | #include <linux/netfilter/xt_TPROXY.h> | 34 | #include <linux/netfilter/xt_TPROXY.h> |
35 | 35 | ||
36 | static bool tproxy_sk_is_transparent(struct sock *sk) | ||
37 | { | ||
38 | if (sk->sk_state != TCP_TIME_WAIT) { | ||
39 | if (inet_sk(sk)->transparent) | ||
40 | return true; | ||
41 | sock_put(sk); | ||
42 | } else { | ||
43 | if (inet_twsk(sk)->tw_transparent) | ||
44 | return true; | ||
45 | inet_twsk_put(inet_twsk(sk)); | ||
46 | } | ||
47 | return false; | ||
48 | } | ||
49 | |||
36 | static inline __be32 | 50 | static inline __be32 |
37 | tproxy_laddr4(struct sk_buff *skb, __be32 user_laddr, __be32 daddr) | 51 | tproxy_laddr4(struct sk_buff *skb, __be32 user_laddr, __be32 daddr) |
38 | { | 52 | { |
@@ -141,7 +155,7 @@ tproxy_tg4(struct sk_buff *skb, __be32 laddr, __be16 lport, | |||
141 | skb->dev, NFT_LOOKUP_LISTENER); | 155 | skb->dev, NFT_LOOKUP_LISTENER); |
142 | 156 | ||
143 | /* NOTE: assign_sock consumes our sk reference */ | 157 | /* NOTE: assign_sock consumes our sk reference */ |
144 | if (sk && nf_tproxy_assign_sock(skb, sk)) { | 158 | if (sk && tproxy_sk_is_transparent(sk)) { |
145 | /* This should be in a separate target, but we don't do multiple | 159 | /* This should be in a separate target, but we don't do multiple |
146 | targets on the same rule yet */ | 160 | targets on the same rule yet */ |
147 | skb->mark = (skb->mark & ~mark_mask) ^ mark_value; | 161 | skb->mark = (skb->mark & ~mark_mask) ^ mark_value; |
@@ -149,6 +163,8 @@ tproxy_tg4(struct sk_buff *skb, __be32 laddr, __be16 lport, | |||
149 | pr_debug("redirecting: proto %hhu %pI4:%hu -> %pI4:%hu, mark: %x\n", | 163 | pr_debug("redirecting: proto %hhu %pI4:%hu -> %pI4:%hu, mark: %x\n", |
150 | iph->protocol, &iph->daddr, ntohs(hp->dest), | 164 | iph->protocol, &iph->daddr, ntohs(hp->dest), |
151 | &laddr, ntohs(lport), skb->mark); | 165 | &laddr, ntohs(lport), skb->mark); |
166 | |||
167 | nf_tproxy_assign_sock(skb, sk); | ||
152 | return NF_ACCEPT; | 168 | return NF_ACCEPT; |
153 | } | 169 | } |
154 | 170 | ||
@@ -306,7 +322,7 @@ tproxy_tg6_v1(struct sk_buff *skb, const struct xt_action_param *par) | |||
306 | par->in, NFT_LOOKUP_LISTENER); | 322 | par->in, NFT_LOOKUP_LISTENER); |
307 | 323 | ||
308 | /* NOTE: assign_sock consumes our sk reference */ | 324 | /* NOTE: assign_sock consumes our sk reference */ |
309 | if (sk && nf_tproxy_assign_sock(skb, sk)) { | 325 | if (sk && tproxy_sk_is_transparent(sk)) { |
310 | /* This should be in a separate target, but we don't do multiple | 326 | /* This should be in a separate target, but we don't do multiple |
311 | targets on the same rule yet */ | 327 | targets on the same rule yet */ |
312 | skb->mark = (skb->mark & ~tgi->mark_mask) ^ tgi->mark_value; | 328 | skb->mark = (skb->mark & ~tgi->mark_mask) ^ tgi->mark_value; |
@@ -314,6 +330,8 @@ tproxy_tg6_v1(struct sk_buff *skb, const struct xt_action_param *par) | |||
314 | pr_debug("redirecting: proto %hhu %pI6:%hu -> %pI6:%hu, mark: %x\n", | 330 | pr_debug("redirecting: proto %hhu %pI6:%hu -> %pI6:%hu, mark: %x\n", |
315 | tproto, &iph->saddr, ntohs(hp->source), | 331 | tproto, &iph->saddr, ntohs(hp->source), |
316 | laddr, ntohs(lport), skb->mark); | 332 | laddr, ntohs(lport), skb->mark); |
333 | |||
334 | nf_tproxy_assign_sock(skb, sk); | ||
317 | return NF_ACCEPT; | 335 | return NF_ACCEPT; |
318 | } | 336 | } |
319 | 337 | ||
diff --git a/net/netfilter/xt_socket.c b/net/netfilter/xt_socket.c index 00d6ae838303..9cc46356b577 100644 --- a/net/netfilter/xt_socket.c +++ b/net/netfilter/xt_socket.c | |||
@@ -35,6 +35,15 @@ | |||
35 | #include <net/netfilter/nf_conntrack.h> | 35 | #include <net/netfilter/nf_conntrack.h> |
36 | #endif | 36 | #endif |
37 | 37 | ||
38 | static void | ||
39 | xt_socket_put_sk(struct sock *sk) | ||
40 | { | ||
41 | if (sk->sk_state == TCP_TIME_WAIT) | ||
42 | inet_twsk_put(inet_twsk(sk)); | ||
43 | else | ||
44 | sock_put(sk); | ||
45 | } | ||
46 | |||
38 | static int | 47 | static int |
39 | extract_icmp4_fields(const struct sk_buff *skb, | 48 | extract_icmp4_fields(const struct sk_buff *skb, |
40 | u8 *protocol, | 49 | u8 *protocol, |
@@ -164,7 +173,7 @@ socket_match(const struct sk_buff *skb, struct xt_action_param *par, | |||
164 | (sk->sk_state == TCP_TIME_WAIT && | 173 | (sk->sk_state == TCP_TIME_WAIT && |
165 | inet_twsk(sk)->tw_transparent)); | 174 | inet_twsk(sk)->tw_transparent)); |
166 | 175 | ||
167 | nf_tproxy_put_sock(sk); | 176 | xt_socket_put_sk(sk); |
168 | 177 | ||
169 | if (wildcard || !transparent) | 178 | if (wildcard || !transparent) |
170 | sk = NULL; | 179 | sk = NULL; |
@@ -298,7 +307,7 @@ socket_mt6_v1(const struct sk_buff *skb, struct xt_action_param *par) | |||
298 | (sk->sk_state == TCP_TIME_WAIT && | 307 | (sk->sk_state == TCP_TIME_WAIT && |
299 | inet_twsk(sk)->tw_transparent)); | 308 | inet_twsk(sk)->tw_transparent)); |
300 | 309 | ||
301 | nf_tproxy_put_sock(sk); | 310 | xt_socket_put_sk(sk); |
302 | 311 | ||
303 | if (wildcard || !transparent) | 312 | if (wildcard || !transparent) |
304 | sk = NULL; | 313 | sk = NULL; |
diff --git a/net/rxrpc/ar-key.c b/net/rxrpc/ar-key.c index 5ee16f0353fe..d763793d39de 100644 --- a/net/rxrpc/ar-key.c +++ b/net/rxrpc/ar-key.c | |||
@@ -89,11 +89,11 @@ static int rxrpc_instantiate_xdr_rxkad(struct key *key, const __be32 *xdr, | |||
89 | return ret; | 89 | return ret; |
90 | 90 | ||
91 | plen -= sizeof(*token); | 91 | plen -= sizeof(*token); |
92 | token = kmalloc(sizeof(*token), GFP_KERNEL); | 92 | token = kzalloc(sizeof(*token), GFP_KERNEL); |
93 | if (!token) | 93 | if (!token) |
94 | return -ENOMEM; | 94 | return -ENOMEM; |
95 | 95 | ||
96 | token->kad = kmalloc(plen, GFP_KERNEL); | 96 | token->kad = kzalloc(plen, GFP_KERNEL); |
97 | if (!token->kad) { | 97 | if (!token->kad) { |
98 | kfree(token); | 98 | kfree(token); |
99 | return -ENOMEM; | 99 | return -ENOMEM; |
@@ -731,10 +731,10 @@ static int rxrpc_instantiate(struct key *key, const void *data, size_t datalen) | |||
731 | goto error; | 731 | goto error; |
732 | 732 | ||
733 | ret = -ENOMEM; | 733 | ret = -ENOMEM; |
734 | token = kmalloc(sizeof(*token), GFP_KERNEL); | 734 | token = kzalloc(sizeof(*token), GFP_KERNEL); |
735 | if (!token) | 735 | if (!token) |
736 | goto error; | 736 | goto error; |
737 | token->kad = kmalloc(plen, GFP_KERNEL); | 737 | token->kad = kzalloc(plen, GFP_KERNEL); |
738 | if (!token->kad) | 738 | if (!token->kad) |
739 | goto error_free; | 739 | goto error_free; |
740 | 740 | ||
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c index 34dc598440a2..1bc698039ae2 100644 --- a/net/sched/sch_generic.c +++ b/net/sched/sch_generic.c | |||
@@ -839,6 +839,7 @@ void dev_deactivate(struct net_device *dev) | |||
839 | 839 | ||
840 | list_add(&dev->unreg_list, &single); | 840 | list_add(&dev->unreg_list, &single); |
841 | dev_deactivate_many(&single); | 841 | dev_deactivate_many(&single); |
842 | list_del(&single); | ||
842 | } | 843 | } |
843 | 844 | ||
844 | static void dev_init_scheduler_queue(struct net_device *dev, | 845 | static void dev_init_scheduler_queue(struct net_device *dev, |
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c index 2cc46f0962ca..b23428f3c0dd 100644 --- a/net/sctp/sm_make_chunk.c +++ b/net/sctp/sm_make_chunk.c | |||
@@ -2029,11 +2029,11 @@ static sctp_ierror_t sctp_process_unk_param(const struct sctp_association *asoc, | |||
2029 | *errp = sctp_make_op_error_fixed(asoc, chunk); | 2029 | *errp = sctp_make_op_error_fixed(asoc, chunk); |
2030 | 2030 | ||
2031 | if (*errp) { | 2031 | if (*errp) { |
2032 | sctp_init_cause_fixed(*errp, SCTP_ERROR_UNKNOWN_PARAM, | 2032 | if (!sctp_init_cause_fixed(*errp, SCTP_ERROR_UNKNOWN_PARAM, |
2033 | WORD_ROUND(ntohs(param.p->length))); | 2033 | WORD_ROUND(ntohs(param.p->length)))) |
2034 | sctp_addto_chunk_fixed(*errp, | 2034 | sctp_addto_chunk_fixed(*errp, |
2035 | WORD_ROUND(ntohs(param.p->length)), | 2035 | WORD_ROUND(ntohs(param.p->length)), |
2036 | param.v); | 2036 | param.v); |
2037 | } else { | 2037 | } else { |
2038 | /* If there is no memory for generating the ERROR | 2038 | /* If there is no memory for generating the ERROR |
2039 | * report as specified, an ABORT will be triggered | 2039 | * report as specified, an ABORT will be triggered |
diff --git a/net/wireless/wext-compat.c b/net/wireless/wext-compat.c index 3e5dbd4e4cd5..d112f038edf0 100644 --- a/net/wireless/wext-compat.c +++ b/net/wireless/wext-compat.c | |||
@@ -802,11 +802,11 @@ int cfg80211_wext_siwfreq(struct net_device *dev, | |||
802 | return freq; | 802 | return freq; |
803 | if (freq == 0) | 803 | if (freq == 0) |
804 | return -EINVAL; | 804 | return -EINVAL; |
805 | wdev_lock(wdev); | ||
806 | mutex_lock(&rdev->devlist_mtx); | 805 | mutex_lock(&rdev->devlist_mtx); |
806 | wdev_lock(wdev); | ||
807 | err = cfg80211_set_freq(rdev, wdev, freq, NL80211_CHAN_NO_HT); | 807 | err = cfg80211_set_freq(rdev, wdev, freq, NL80211_CHAN_NO_HT); |
808 | mutex_unlock(&rdev->devlist_mtx); | ||
809 | wdev_unlock(wdev); | 808 | wdev_unlock(wdev); |
809 | mutex_unlock(&rdev->devlist_mtx); | ||
810 | return err; | 810 | return err; |
811 | default: | 811 | default: |
812 | return -EOPNOTSUPP; | 812 | return -EOPNOTSUPP; |
diff --git a/sound/core/jack.c b/sound/core/jack.c index 4902ae568730..53b53e97c896 100644 --- a/sound/core/jack.c +++ b/sound/core/jack.c | |||
@@ -141,6 +141,7 @@ int snd_jack_new(struct snd_card *card, const char *id, int type, | |||
141 | 141 | ||
142 | fail_input: | 142 | fail_input: |
143 | input_free_device(jack->input_dev); | 143 | input_free_device(jack->input_dev); |
144 | kfree(jack->id); | ||
144 | kfree(jack); | 145 | kfree(jack); |
145 | return err; | 146 | return err; |
146 | } | 147 | } |
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index dd7c5c12225d..4d5004e693f0 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c | |||
@@ -3114,6 +3114,8 @@ static struct snd_pci_quirk cxt5066_cfg_tbl[] = { | |||
3114 | SND_PCI_QUIRK(0x1028, 0x0401, "Dell Vostro 1014", CXT5066_DELL_VOSTRO), | 3114 | SND_PCI_QUIRK(0x1028, 0x0401, "Dell Vostro 1014", CXT5066_DELL_VOSTRO), |
3115 | SND_PCI_QUIRK(0x1028, 0x0402, "Dell Vostro", CXT5066_DELL_VOSTRO), | 3115 | SND_PCI_QUIRK(0x1028, 0x0402, "Dell Vostro", CXT5066_DELL_VOSTRO), |
3116 | SND_PCI_QUIRK(0x1028, 0x0408, "Dell Inspiron One 19T", CXT5066_IDEAPAD), | 3116 | SND_PCI_QUIRK(0x1028, 0x0408, "Dell Inspiron One 19T", CXT5066_IDEAPAD), |
3117 | SND_PCI_QUIRK(0x1028, 0x050f, "Dell Inspiron", CXT5066_IDEAPAD), | ||
3118 | SND_PCI_QUIRK(0x1028, 0x0510, "Dell Vostro", CXT5066_IDEAPAD), | ||
3117 | SND_PCI_QUIRK(0x103c, 0x360b, "HP G60", CXT5066_HP_LAPTOP), | 3119 | SND_PCI_QUIRK(0x103c, 0x360b, "HP G60", CXT5066_HP_LAPTOP), |
3118 | SND_PCI_QUIRK(0x1043, 0x13f3, "Asus A52J", CXT5066_ASUS), | 3120 | SND_PCI_QUIRK(0x1043, 0x13f3, "Asus A52J", CXT5066_ASUS), |
3119 | SND_PCI_QUIRK(0x1043, 0x1643, "Asus K52JU", CXT5066_ASUS), | 3121 | SND_PCI_QUIRK(0x1043, 0x1643, "Asus K52JU", CXT5066_ASUS), |
@@ -3937,6 +3939,8 @@ static struct hda_codec_preset snd_hda_preset_conexant[] = { | |||
3937 | .patch = patch_cxt5066 }, | 3939 | .patch = patch_cxt5066 }, |
3938 | { .id = 0x14f15069, .name = "CX20585", | 3940 | { .id = 0x14f15069, .name = "CX20585", |
3939 | .patch = patch_cxt5066 }, | 3941 | .patch = patch_cxt5066 }, |
3942 | { .id = 0x14f1506e, .name = "CX20590", | ||
3943 | .patch = patch_cxt5066 }, | ||
3940 | { .id = 0x14f15097, .name = "CX20631", | 3944 | { .id = 0x14f15097, .name = "CX20631", |
3941 | .patch = patch_conexant_auto }, | 3945 | .patch = patch_conexant_auto }, |
3942 | { .id = 0x14f15098, .name = "CX20632", | 3946 | { .id = 0x14f15098, .name = "CX20632", |
@@ -3963,6 +3967,7 @@ MODULE_ALIAS("snd-hda-codec-id:14f15066"); | |||
3963 | MODULE_ALIAS("snd-hda-codec-id:14f15067"); | 3967 | MODULE_ALIAS("snd-hda-codec-id:14f15067"); |
3964 | MODULE_ALIAS("snd-hda-codec-id:14f15068"); | 3968 | MODULE_ALIAS("snd-hda-codec-id:14f15068"); |
3965 | MODULE_ALIAS("snd-hda-codec-id:14f15069"); | 3969 | MODULE_ALIAS("snd-hda-codec-id:14f15069"); |
3970 | MODULE_ALIAS("snd-hda-codec-id:14f1506e"); | ||
3966 | MODULE_ALIAS("snd-hda-codec-id:14f15097"); | 3971 | MODULE_ALIAS("snd-hda-codec-id:14f15097"); |
3967 | MODULE_ALIAS("snd-hda-codec-id:14f15098"); | 3972 | MODULE_ALIAS("snd-hda-codec-id:14f15098"); |
3968 | MODULE_ALIAS("snd-hda-codec-id:14f150a1"); | 3973 | MODULE_ALIAS("snd-hda-codec-id:14f150a1"); |
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 9ea48b425d0b..bd7b123f6440 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -586,7 +586,12 @@ static hda_nid_t stac92hd83xxx_pin_nids[10] = { | |||
586 | 0x0f, 0x10, 0x11, 0x1f, 0x20, | 586 | 0x0f, 0x10, 0x11, 0x1f, 0x20, |
587 | }; | 587 | }; |
588 | 588 | ||
589 | static hda_nid_t stac92hd88xxx_pin_nids[10] = { | 589 | static hda_nid_t stac92hd87xxx_pin_nids[6] = { |
590 | 0x0a, 0x0b, 0x0c, 0x0d, | ||
591 | 0x0f, 0x11, | ||
592 | }; | ||
593 | |||
594 | static hda_nid_t stac92hd88xxx_pin_nids[8] = { | ||
590 | 0x0a, 0x0b, 0x0c, 0x0d, | 595 | 0x0a, 0x0b, 0x0c, 0x0d, |
591 | 0x0f, 0x11, 0x1f, 0x20, | 596 | 0x0f, 0x11, 0x1f, 0x20, |
592 | }; | 597 | }; |
@@ -5430,12 +5435,13 @@ again: | |||
5430 | switch (codec->vendor_id) { | 5435 | switch (codec->vendor_id) { |
5431 | case 0x111d76d1: | 5436 | case 0x111d76d1: |
5432 | case 0x111d76d9: | 5437 | case 0x111d76d9: |
5438 | case 0x111d76e5: | ||
5433 | spec->dmic_nids = stac92hd87b_dmic_nids; | 5439 | spec->dmic_nids = stac92hd87b_dmic_nids; |
5434 | spec->num_dmics = stac92xx_connected_ports(codec, | 5440 | spec->num_dmics = stac92xx_connected_ports(codec, |
5435 | stac92hd87b_dmic_nids, | 5441 | stac92hd87b_dmic_nids, |
5436 | STAC92HD87B_NUM_DMICS); | 5442 | STAC92HD87B_NUM_DMICS); |
5437 | spec->num_pins = ARRAY_SIZE(stac92hd88xxx_pin_nids); | 5443 | spec->num_pins = ARRAY_SIZE(stac92hd87xxx_pin_nids); |
5438 | spec->pin_nids = stac92hd88xxx_pin_nids; | 5444 | spec->pin_nids = stac92hd87xxx_pin_nids; |
5439 | spec->mono_nid = 0; | 5445 | spec->mono_nid = 0; |
5440 | spec->num_pwrs = 0; | 5446 | spec->num_pwrs = 0; |
5441 | break; | 5447 | break; |
@@ -5443,6 +5449,7 @@ again: | |||
5443 | case 0x111d7667: | 5449 | case 0x111d7667: |
5444 | case 0x111d7668: | 5450 | case 0x111d7668: |
5445 | case 0x111d7669: | 5451 | case 0x111d7669: |
5452 | case 0x111d76e3: | ||
5446 | spec->num_dmics = stac92xx_connected_ports(codec, | 5453 | spec->num_dmics = stac92xx_connected_ports(codec, |
5447 | stac92hd88xxx_dmic_nids, | 5454 | stac92hd88xxx_dmic_nids, |
5448 | STAC92HD88XXX_NUM_DMICS); | 5455 | STAC92HD88XXX_NUM_DMICS); |
@@ -6387,6 +6394,8 @@ static struct hda_codec_preset snd_hda_preset_sigmatel[] = { | |||
6387 | { .id = 0x111d76cd, .name = "92HD89F2", .patch = patch_stac92hd73xx }, | 6394 | { .id = 0x111d76cd, .name = "92HD89F2", .patch = patch_stac92hd73xx }, |
6388 | { .id = 0x111d76ce, .name = "92HD89F1", .patch = patch_stac92hd73xx }, | 6395 | { .id = 0x111d76ce, .name = "92HD89F1", .patch = patch_stac92hd73xx }, |
6389 | { .id = 0x111d76e0, .name = "92HD91BXX", .patch = patch_stac92hd83xxx}, | 6396 | { .id = 0x111d76e0, .name = "92HD91BXX", .patch = patch_stac92hd83xxx}, |
6397 | { .id = 0x111d76e3, .name = "92HD98BXX", .patch = patch_stac92hd83xxx}, | ||
6398 | { .id = 0x111d76e5, .name = "92HD99BXX", .patch = patch_stac92hd83xxx}, | ||
6390 | { .id = 0x111d76e7, .name = "92HD90BXX", .patch = patch_stac92hd83xxx}, | 6399 | { .id = 0x111d76e7, .name = "92HD90BXX", .patch = patch_stac92hd83xxx}, |
6391 | {} /* terminator */ | 6400 | {} /* terminator */ |
6392 | }; | 6401 | }; |
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c index a76c3260d941..63b0054200a8 100644 --- a/sound/pci/hda/patch_via.c +++ b/sound/pci/hda/patch_via.c | |||
@@ -567,7 +567,7 @@ static void via_auto_init_analog_input(struct hda_codec *codec) | |||
567 | hda_nid_t nid = cfg->inputs[i].pin; | 567 | hda_nid_t nid = cfg->inputs[i].pin; |
568 | if (spec->smart51_enabled && is_smart51_pins(spec, nid)) | 568 | if (spec->smart51_enabled && is_smart51_pins(spec, nid)) |
569 | ctl = PIN_OUT; | 569 | ctl = PIN_OUT; |
570 | else if (i == AUTO_PIN_MIC) | 570 | else if (cfg->inputs[i].type == AUTO_PIN_MIC) |
571 | ctl = PIN_VREF50; | 571 | ctl = PIN_VREF50; |
572 | else | 572 | else |
573 | ctl = PIN_IN; | 573 | ctl = PIN_IN; |
diff --git a/sound/soc/codecs/cx20442.c b/sound/soc/codecs/cx20442.c index bb4bf65b9e7e..0bb424af956f 100644 --- a/sound/soc/codecs/cx20442.c +++ b/sound/soc/codecs/cx20442.c | |||
@@ -367,7 +367,7 @@ static int cx20442_codec_remove(struct snd_soc_codec *codec) | |||
367 | return 0; | 367 | return 0; |
368 | } | 368 | } |
369 | 369 | ||
370 | static const u8 cx20442_reg = CX20442_TELOUT | CX20442_MIC; | 370 | static const u8 cx20442_reg; |
371 | 371 | ||
372 | static struct snd_soc_codec_driver cx20442_codec_dev = { | 372 | static struct snd_soc_codec_driver cx20442_codec_dev = { |
373 | .probe = cx20442_codec_probe, | 373 | .probe = cx20442_codec_probe, |
diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c index 987476a5895f..017d99ceb42e 100644 --- a/sound/soc/codecs/wm8903.c +++ b/sound/soc/codecs/wm8903.c | |||
@@ -1482,7 +1482,7 @@ int wm8903_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack, | |||
1482 | WM8903_MICDET_EINT | WM8903_MICSHRT_EINT, | 1482 | WM8903_MICDET_EINT | WM8903_MICSHRT_EINT, |
1483 | irq_mask); | 1483 | irq_mask); |
1484 | 1484 | ||
1485 | if (det && shrt) { | 1485 | if (det || shrt) { |
1486 | /* Enable mic detection, this may not have been set through | 1486 | /* Enable mic detection, this may not have been set through |
1487 | * platform data (eg, if the defaults are OK). */ | 1487 | * platform data (eg, if the defaults are OK). */ |
1488 | snd_soc_update_bits(codec, WM8903_WRITE_SEQUENCER_0, | 1488 | snd_soc_update_bits(codec, WM8903_WRITE_SEQUENCER_0, |
diff --git a/sound/soc/codecs/wm8903.h b/sound/soc/codecs/wm8903.h index e8490f3edd03..e3ec2433b215 100644 --- a/sound/soc/codecs/wm8903.h +++ b/sound/soc/codecs/wm8903.h | |||
@@ -165,7 +165,7 @@ extern int wm8903_mic_detect(struct snd_soc_codec *codec, | |||
165 | 165 | ||
166 | #define WM8903_VMID_RES_50K 2 | 166 | #define WM8903_VMID_RES_50K 2 |
167 | #define WM8903_VMID_RES_250K 3 | 167 | #define WM8903_VMID_RES_250K 3 |
168 | #define WM8903_VMID_RES_5K 4 | 168 | #define WM8903_VMID_RES_5K 6 |
169 | 169 | ||
170 | /* | 170 | /* |
171 | * R8 (0x08) - Analogue DAC 0 | 171 | * R8 (0x08) - Analogue DAC 0 |
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index 37b8aa8a680f..ebaee5ca7434 100644 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c | |||
@@ -107,6 +107,9 @@ struct wm8994_priv { | |||
107 | 107 | ||
108 | int revision; | 108 | int revision; |
109 | struct wm8994_pdata *pdata; | 109 | struct wm8994_pdata *pdata; |
110 | |||
111 | unsigned int aif1clk_enable:1; | ||
112 | unsigned int aif2clk_enable:1; | ||
110 | }; | 113 | }; |
111 | 114 | ||
112 | static int wm8994_readable(unsigned int reg) | 115 | static int wm8994_readable(unsigned int reg) |
@@ -1004,6 +1007,93 @@ static void wm8994_update_class_w(struct snd_soc_codec *codec) | |||
1004 | } | 1007 | } |
1005 | } | 1008 | } |
1006 | 1009 | ||
1010 | static int late_enable_ev(struct snd_soc_dapm_widget *w, | ||
1011 | struct snd_kcontrol *kcontrol, int event) | ||
1012 | { | ||
1013 | struct snd_soc_codec *codec = w->codec; | ||
1014 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | ||
1015 | |||
1016 | switch (event) { | ||
1017 | case SND_SOC_DAPM_PRE_PMU: | ||
1018 | if (wm8994->aif1clk_enable) | ||
1019 | snd_soc_update_bits(codec, WM8994_AIF1_CLOCKING_1, | ||
1020 | WM8994_AIF1CLK_ENA_MASK, | ||
1021 | WM8994_AIF1CLK_ENA); | ||
1022 | if (wm8994->aif2clk_enable) | ||
1023 | snd_soc_update_bits(codec, WM8994_AIF2_CLOCKING_1, | ||
1024 | WM8994_AIF2CLK_ENA_MASK, | ||
1025 | WM8994_AIF2CLK_ENA); | ||
1026 | break; | ||
1027 | } | ||
1028 | |||
1029 | return 0; | ||
1030 | } | ||
1031 | |||
1032 | static int late_disable_ev(struct snd_soc_dapm_widget *w, | ||
1033 | struct snd_kcontrol *kcontrol, int event) | ||
1034 | { | ||
1035 | struct snd_soc_codec *codec = w->codec; | ||
1036 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | ||
1037 | |||
1038 | switch (event) { | ||
1039 | case SND_SOC_DAPM_POST_PMD: | ||
1040 | if (wm8994->aif1clk_enable) { | ||
1041 | snd_soc_update_bits(codec, WM8994_AIF1_CLOCKING_1, | ||
1042 | WM8994_AIF1CLK_ENA_MASK, 0); | ||
1043 | wm8994->aif1clk_enable = 0; | ||
1044 | } | ||
1045 | if (wm8994->aif2clk_enable) { | ||
1046 | snd_soc_update_bits(codec, WM8994_AIF2_CLOCKING_1, | ||
1047 | WM8994_AIF2CLK_ENA_MASK, 0); | ||
1048 | wm8994->aif2clk_enable = 0; | ||
1049 | } | ||
1050 | break; | ||
1051 | } | ||
1052 | |||
1053 | return 0; | ||
1054 | } | ||
1055 | |||
1056 | static int aif1clk_ev(struct snd_soc_dapm_widget *w, | ||
1057 | struct snd_kcontrol *kcontrol, int event) | ||
1058 | { | ||
1059 | struct snd_soc_codec *codec = w->codec; | ||
1060 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | ||
1061 | |||
1062 | switch (event) { | ||
1063 | case SND_SOC_DAPM_PRE_PMU: | ||
1064 | wm8994->aif1clk_enable = 1; | ||
1065 | break; | ||
1066 | } | ||
1067 | |||
1068 | return 0; | ||
1069 | } | ||
1070 | |||
1071 | static int aif2clk_ev(struct snd_soc_dapm_widget *w, | ||
1072 | struct snd_kcontrol *kcontrol, int event) | ||
1073 | { | ||
1074 | struct snd_soc_codec *codec = w->codec; | ||
1075 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | ||
1076 | |||
1077 | switch (event) { | ||
1078 | case SND_SOC_DAPM_PRE_PMU: | ||
1079 | wm8994->aif2clk_enable = 1; | ||
1080 | break; | ||
1081 | } | ||
1082 | |||
1083 | return 0; | ||
1084 | } | ||
1085 | |||
1086 | static int dac_ev(struct snd_soc_dapm_widget *w, | ||
1087 | struct snd_kcontrol *kcontrol, int event) | ||
1088 | { | ||
1089 | struct snd_soc_codec *codec = w->codec; | ||
1090 | unsigned int mask = 1 << w->shift; | ||
1091 | |||
1092 | snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5, | ||
1093 | mask, mask); | ||
1094 | return 0; | ||
1095 | } | ||
1096 | |||
1007 | static const char *hp_mux_text[] = { | 1097 | static const char *hp_mux_text[] = { |
1008 | "Mixer", | 1098 | "Mixer", |
1009 | "DAC", | 1099 | "DAC", |
@@ -1272,6 +1362,47 @@ static const struct soc_enum aif2dacr_src_enum = | |||
1272 | static const struct snd_kcontrol_new aif2dacr_src_mux = | 1362 | static const struct snd_kcontrol_new aif2dacr_src_mux = |
1273 | SOC_DAPM_ENUM("AIF2DACR Mux", aif2dacr_src_enum); | 1363 | SOC_DAPM_ENUM("AIF2DACR Mux", aif2dacr_src_enum); |
1274 | 1364 | ||
1365 | static const struct snd_soc_dapm_widget wm8994_lateclk_revd_widgets[] = { | ||
1366 | SND_SOC_DAPM_SUPPLY("AIF1CLK", SND_SOC_NOPM, 0, 0, aif1clk_ev, | ||
1367 | SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), | ||
1368 | SND_SOC_DAPM_SUPPLY("AIF2CLK", SND_SOC_NOPM, 0, 0, aif2clk_ev, | ||
1369 | SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), | ||
1370 | |||
1371 | SND_SOC_DAPM_PGA_E("Late DAC1L Enable PGA", SND_SOC_NOPM, 0, 0, NULL, 0, | ||
1372 | late_enable_ev, SND_SOC_DAPM_PRE_PMU), | ||
1373 | SND_SOC_DAPM_PGA_E("Late DAC1R Enable PGA", SND_SOC_NOPM, 0, 0, NULL, 0, | ||
1374 | late_enable_ev, SND_SOC_DAPM_PRE_PMU), | ||
1375 | SND_SOC_DAPM_PGA_E("Late DAC2L Enable PGA", SND_SOC_NOPM, 0, 0, NULL, 0, | ||
1376 | late_enable_ev, SND_SOC_DAPM_PRE_PMU), | ||
1377 | SND_SOC_DAPM_PGA_E("Late DAC2R Enable PGA", SND_SOC_NOPM, 0, 0, NULL, 0, | ||
1378 | late_enable_ev, SND_SOC_DAPM_PRE_PMU), | ||
1379 | |||
1380 | SND_SOC_DAPM_POST("Late Disable PGA", late_disable_ev) | ||
1381 | }; | ||
1382 | |||
1383 | static const struct snd_soc_dapm_widget wm8994_lateclk_widgets[] = { | ||
1384 | SND_SOC_DAPM_SUPPLY("AIF1CLK", WM8994_AIF1_CLOCKING_1, 0, 0, NULL, 0), | ||
1385 | SND_SOC_DAPM_SUPPLY("AIF2CLK", WM8994_AIF2_CLOCKING_1, 0, 0, NULL, 0) | ||
1386 | }; | ||
1387 | |||
1388 | static const struct snd_soc_dapm_widget wm8994_dac_revd_widgets[] = { | ||
1389 | SND_SOC_DAPM_DAC_E("DAC2L", NULL, SND_SOC_NOPM, 3, 0, | ||
1390 | dac_ev, SND_SOC_DAPM_PRE_PMU), | ||
1391 | SND_SOC_DAPM_DAC_E("DAC2R", NULL, SND_SOC_NOPM, 2, 0, | ||
1392 | dac_ev, SND_SOC_DAPM_PRE_PMU), | ||
1393 | SND_SOC_DAPM_DAC_E("DAC1L", NULL, SND_SOC_NOPM, 1, 0, | ||
1394 | dac_ev, SND_SOC_DAPM_PRE_PMU), | ||
1395 | SND_SOC_DAPM_DAC_E("DAC1R", NULL, SND_SOC_NOPM, 0, 0, | ||
1396 | dac_ev, SND_SOC_DAPM_PRE_PMU), | ||
1397 | }; | ||
1398 | |||
1399 | static const struct snd_soc_dapm_widget wm8994_dac_widgets[] = { | ||
1400 | SND_SOC_DAPM_DAC("DAC2L", NULL, WM8994_POWER_MANAGEMENT_5, 3, 0), | ||
1401 | SND_SOC_DAPM_DAC("DAC1R", NULL, WM8994_POWER_MANAGEMENT_5, 2, 0), | ||
1402 | SND_SOC_DAPM_DAC("DAC1L", NULL, WM8994_POWER_MANAGEMENT_5, 1, 0), | ||
1403 | SND_SOC_DAPM_DAC("DAC1R", NULL, WM8994_POWER_MANAGEMENT_5, 0, 0), | ||
1404 | }; | ||
1405 | |||
1275 | static const struct snd_soc_dapm_widget wm8994_dapm_widgets[] = { | 1406 | static const struct snd_soc_dapm_widget wm8994_dapm_widgets[] = { |
1276 | SND_SOC_DAPM_INPUT("DMIC1DAT"), | 1407 | SND_SOC_DAPM_INPUT("DMIC1DAT"), |
1277 | SND_SOC_DAPM_INPUT("DMIC2DAT"), | 1408 | SND_SOC_DAPM_INPUT("DMIC2DAT"), |
@@ -1284,9 +1415,6 @@ SND_SOC_DAPM_SUPPLY("DSP1CLK", WM8994_CLOCKING_1, 3, 0, NULL, 0), | |||
1284 | SND_SOC_DAPM_SUPPLY("DSP2CLK", WM8994_CLOCKING_1, 2, 0, NULL, 0), | 1415 | SND_SOC_DAPM_SUPPLY("DSP2CLK", WM8994_CLOCKING_1, 2, 0, NULL, 0), |
1285 | SND_SOC_DAPM_SUPPLY("DSPINTCLK", WM8994_CLOCKING_1, 1, 0, NULL, 0), | 1416 | SND_SOC_DAPM_SUPPLY("DSPINTCLK", WM8994_CLOCKING_1, 1, 0, NULL, 0), |
1286 | 1417 | ||
1287 | SND_SOC_DAPM_SUPPLY("AIF1CLK", WM8994_AIF1_CLOCKING_1, 0, 0, NULL, 0), | ||
1288 | SND_SOC_DAPM_SUPPLY("AIF2CLK", WM8994_AIF2_CLOCKING_1, 0, 0, NULL, 0), | ||
1289 | |||
1290 | SND_SOC_DAPM_AIF_OUT("AIF1ADC1L", NULL, | 1418 | SND_SOC_DAPM_AIF_OUT("AIF1ADC1L", NULL, |
1291 | 0, WM8994_POWER_MANAGEMENT_4, 9, 0), | 1419 | 0, WM8994_POWER_MANAGEMENT_4, 9, 0), |
1292 | SND_SOC_DAPM_AIF_OUT("AIF1ADC1R", NULL, | 1420 | SND_SOC_DAPM_AIF_OUT("AIF1ADC1R", NULL, |
@@ -1372,11 +1500,6 @@ SND_SOC_DAPM_ADC("ADCR", NULL, SND_SOC_NOPM, 0, 0), | |||
1372 | SND_SOC_DAPM_MUX("ADCL Mux", WM8994_POWER_MANAGEMENT_4, 1, 0, &adcl_mux), | 1500 | SND_SOC_DAPM_MUX("ADCL Mux", WM8994_POWER_MANAGEMENT_4, 1, 0, &adcl_mux), |
1373 | SND_SOC_DAPM_MUX("ADCR Mux", WM8994_POWER_MANAGEMENT_4, 0, 0, &adcr_mux), | 1501 | SND_SOC_DAPM_MUX("ADCR Mux", WM8994_POWER_MANAGEMENT_4, 0, 0, &adcr_mux), |
1374 | 1502 | ||
1375 | SND_SOC_DAPM_DAC("DAC2L", NULL, WM8994_POWER_MANAGEMENT_5, 3, 0), | ||
1376 | SND_SOC_DAPM_DAC("DAC2R", NULL, WM8994_POWER_MANAGEMENT_5, 2, 0), | ||
1377 | SND_SOC_DAPM_DAC("DAC1L", NULL, WM8994_POWER_MANAGEMENT_5, 1, 0), | ||
1378 | SND_SOC_DAPM_DAC("DAC1R", NULL, WM8994_POWER_MANAGEMENT_5, 0, 0), | ||
1379 | |||
1380 | SND_SOC_DAPM_MUX("Left Headphone Mux", SND_SOC_NOPM, 0, 0, &hpl_mux), | 1503 | SND_SOC_DAPM_MUX("Left Headphone Mux", SND_SOC_NOPM, 0, 0, &hpl_mux), |
1381 | SND_SOC_DAPM_MUX("Right Headphone Mux", SND_SOC_NOPM, 0, 0, &hpr_mux), | 1504 | SND_SOC_DAPM_MUX("Right Headphone Mux", SND_SOC_NOPM, 0, 0, &hpr_mux), |
1382 | 1505 | ||
@@ -1516,14 +1639,12 @@ static const struct snd_soc_dapm_route intercon[] = { | |||
1516 | { "AIF2ADC Mux", "AIF3DACDAT", "AIF3ADCDAT" }, | 1639 | { "AIF2ADC Mux", "AIF3DACDAT", "AIF3ADCDAT" }, |
1517 | 1640 | ||
1518 | /* DAC1 inputs */ | 1641 | /* DAC1 inputs */ |
1519 | { "DAC1L", NULL, "DAC1L Mixer" }, | ||
1520 | { "DAC1L Mixer", "AIF2 Switch", "AIF2DACL" }, | 1642 | { "DAC1L Mixer", "AIF2 Switch", "AIF2DACL" }, |
1521 | { "DAC1L Mixer", "AIF1.2 Switch", "AIF1DAC2L" }, | 1643 | { "DAC1L Mixer", "AIF1.2 Switch", "AIF1DAC2L" }, |
1522 | { "DAC1L Mixer", "AIF1.1 Switch", "AIF1DAC1L" }, | 1644 | { "DAC1L Mixer", "AIF1.1 Switch", "AIF1DAC1L" }, |
1523 | { "DAC1L Mixer", "Left Sidetone Switch", "Left Sidetone" }, | 1645 | { "DAC1L Mixer", "Left Sidetone Switch", "Left Sidetone" }, |
1524 | { "DAC1L Mixer", "Right Sidetone Switch", "Right Sidetone" }, | 1646 | { "DAC1L Mixer", "Right Sidetone Switch", "Right Sidetone" }, |
1525 | 1647 | ||
1526 | { "DAC1R", NULL, "DAC1R Mixer" }, | ||
1527 | { "DAC1R Mixer", "AIF2 Switch", "AIF2DACR" }, | 1648 | { "DAC1R Mixer", "AIF2 Switch", "AIF2DACR" }, |
1528 | { "DAC1R Mixer", "AIF1.2 Switch", "AIF1DAC2R" }, | 1649 | { "DAC1R Mixer", "AIF1.2 Switch", "AIF1DAC2R" }, |
1529 | { "DAC1R Mixer", "AIF1.1 Switch", "AIF1DAC1R" }, | 1650 | { "DAC1R Mixer", "AIF1.1 Switch", "AIF1DAC1R" }, |
@@ -1532,7 +1653,6 @@ static const struct snd_soc_dapm_route intercon[] = { | |||
1532 | 1653 | ||
1533 | /* DAC2/AIF2 outputs */ | 1654 | /* DAC2/AIF2 outputs */ |
1534 | { "AIF2ADCL", NULL, "AIF2DAC2L Mixer" }, | 1655 | { "AIF2ADCL", NULL, "AIF2DAC2L Mixer" }, |
1535 | { "DAC2L", NULL, "AIF2DAC2L Mixer" }, | ||
1536 | { "AIF2DAC2L Mixer", "AIF2 Switch", "AIF2DACL" }, | 1656 | { "AIF2DAC2L Mixer", "AIF2 Switch", "AIF2DACL" }, |
1537 | { "AIF2DAC2L Mixer", "AIF1.2 Switch", "AIF1DAC2L" }, | 1657 | { "AIF2DAC2L Mixer", "AIF1.2 Switch", "AIF1DAC2L" }, |
1538 | { "AIF2DAC2L Mixer", "AIF1.1 Switch", "AIF1DAC1L" }, | 1658 | { "AIF2DAC2L Mixer", "AIF1.1 Switch", "AIF1DAC1L" }, |
@@ -1540,7 +1660,6 @@ static const struct snd_soc_dapm_route intercon[] = { | |||
1540 | { "AIF2DAC2L Mixer", "Right Sidetone Switch", "Right Sidetone" }, | 1660 | { "AIF2DAC2L Mixer", "Right Sidetone Switch", "Right Sidetone" }, |
1541 | 1661 | ||
1542 | { "AIF2ADCR", NULL, "AIF2DAC2R Mixer" }, | 1662 | { "AIF2ADCR", NULL, "AIF2DAC2R Mixer" }, |
1543 | { "DAC2R", NULL, "AIF2DAC2R Mixer" }, | ||
1544 | { "AIF2DAC2R Mixer", "AIF2 Switch", "AIF2DACR" }, | 1663 | { "AIF2DAC2R Mixer", "AIF2 Switch", "AIF2DACR" }, |
1545 | { "AIF2DAC2R Mixer", "AIF1.2 Switch", "AIF1DAC2R" }, | 1664 | { "AIF2DAC2R Mixer", "AIF1.2 Switch", "AIF1DAC2R" }, |
1546 | { "AIF2DAC2R Mixer", "AIF1.1 Switch", "AIF1DAC1R" }, | 1665 | { "AIF2DAC2R Mixer", "AIF1.1 Switch", "AIF1DAC1R" }, |
@@ -1584,6 +1703,24 @@ static const struct snd_soc_dapm_route intercon[] = { | |||
1584 | { "Right Headphone Mux", "DAC", "DAC1R" }, | 1703 | { "Right Headphone Mux", "DAC", "DAC1R" }, |
1585 | }; | 1704 | }; |
1586 | 1705 | ||
1706 | static const struct snd_soc_dapm_route wm8994_lateclk_revd_intercon[] = { | ||
1707 | { "DAC1L", NULL, "Late DAC1L Enable PGA" }, | ||
1708 | { "Late DAC1L Enable PGA", NULL, "DAC1L Mixer" }, | ||
1709 | { "DAC1R", NULL, "Late DAC1R Enable PGA" }, | ||
1710 | { "Late DAC1R Enable PGA", NULL, "DAC1R Mixer" }, | ||
1711 | { "DAC2L", NULL, "Late DAC2L Enable PGA" }, | ||
1712 | { "Late DAC2L Enable PGA", NULL, "AIF2DAC2L Mixer" }, | ||
1713 | { "DAC2R", NULL, "Late DAC2R Enable PGA" }, | ||
1714 | { "Late DAC2R Enable PGA", NULL, "AIF2DAC2R Mixer" } | ||
1715 | }; | ||
1716 | |||
1717 | static const struct snd_soc_dapm_route wm8994_lateclk_intercon[] = { | ||
1718 | { "DAC1L", NULL, "DAC1L Mixer" }, | ||
1719 | { "DAC1R", NULL, "DAC1R Mixer" }, | ||
1720 | { "DAC2L", NULL, "AIF2DAC2L Mixer" }, | ||
1721 | { "DAC2R", NULL, "AIF2DAC2R Mixer" }, | ||
1722 | }; | ||
1723 | |||
1587 | static const struct snd_soc_dapm_route wm8994_revd_intercon[] = { | 1724 | static const struct snd_soc_dapm_route wm8994_revd_intercon[] = { |
1588 | { "AIF1DACDAT", NULL, "AIF2DACDAT" }, | 1725 | { "AIF1DACDAT", NULL, "AIF2DACDAT" }, |
1589 | { "AIF2DACDAT", NULL, "AIF1DACDAT" }, | 1726 | { "AIF2DACDAT", NULL, "AIF1DACDAT" }, |
@@ -2514,6 +2651,22 @@ static int wm8994_resume(struct snd_soc_codec *codec) | |||
2514 | { | 2651 | { |
2515 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | 2652 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); |
2516 | int i, ret; | 2653 | int i, ret; |
2654 | unsigned int val, mask; | ||
2655 | |||
2656 | if (wm8994->revision < 4) { | ||
2657 | /* force a HW read */ | ||
2658 | val = wm8994_reg_read(codec->control_data, | ||
2659 | WM8994_POWER_MANAGEMENT_5); | ||
2660 | |||
2661 | /* modify the cache only */ | ||
2662 | codec->cache_only = 1; | ||
2663 | mask = WM8994_DAC1R_ENA | WM8994_DAC1L_ENA | | ||
2664 | WM8994_DAC2R_ENA | WM8994_DAC2L_ENA; | ||
2665 | val &= mask; | ||
2666 | snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5, | ||
2667 | mask, val); | ||
2668 | codec->cache_only = 0; | ||
2669 | } | ||
2517 | 2670 | ||
2518 | /* Restore the registers */ | 2671 | /* Restore the registers */ |
2519 | ret = snd_soc_cache_sync(codec); | 2672 | ret = snd_soc_cache_sync(codec); |
@@ -2847,11 +3000,10 @@ static void wm8958_default_micdet(u16 status, void *data) | |||
2847 | report |= SND_JACK_BTN_5; | 3000 | report |= SND_JACK_BTN_5; |
2848 | 3001 | ||
2849 | done: | 3002 | done: |
2850 | snd_soc_jack_report(wm8994->micdet[0].jack, | 3003 | snd_soc_jack_report(wm8994->micdet[0].jack, report, |
2851 | SND_JACK_BTN_0 | SND_JACK_BTN_1 | SND_JACK_BTN_2 | | 3004 | SND_JACK_BTN_0 | SND_JACK_BTN_1 | SND_JACK_BTN_2 | |
2852 | SND_JACK_BTN_3 | SND_JACK_BTN_4 | SND_JACK_BTN_5 | | 3005 | SND_JACK_BTN_3 | SND_JACK_BTN_4 | SND_JACK_BTN_5 | |
2853 | SND_JACK_MICROPHONE | SND_JACK_VIDEOOUT, | 3006 | SND_JACK_MICROPHONE | SND_JACK_VIDEOOUT); |
2854 | report); | ||
2855 | } | 3007 | } |
2856 | 3008 | ||
2857 | /** | 3009 | /** |
@@ -3125,6 +3277,17 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec) | |||
3125 | case WM8994: | 3277 | case WM8994: |
3126 | snd_soc_dapm_new_controls(dapm, wm8994_specific_dapm_widgets, | 3278 | snd_soc_dapm_new_controls(dapm, wm8994_specific_dapm_widgets, |
3127 | ARRAY_SIZE(wm8994_specific_dapm_widgets)); | 3279 | ARRAY_SIZE(wm8994_specific_dapm_widgets)); |
3280 | if (wm8994->revision < 4) { | ||
3281 | snd_soc_dapm_new_controls(dapm, wm8994_lateclk_revd_widgets, | ||
3282 | ARRAY_SIZE(wm8994_lateclk_revd_widgets)); | ||
3283 | snd_soc_dapm_new_controls(dapm, wm8994_dac_revd_widgets, | ||
3284 | ARRAY_SIZE(wm8994_dac_revd_widgets)); | ||
3285 | } else { | ||
3286 | snd_soc_dapm_new_controls(dapm, wm8994_lateclk_widgets, | ||
3287 | ARRAY_SIZE(wm8994_lateclk_widgets)); | ||
3288 | snd_soc_dapm_new_controls(dapm, wm8994_dac_widgets, | ||
3289 | ARRAY_SIZE(wm8994_dac_widgets)); | ||
3290 | } | ||
3128 | break; | 3291 | break; |
3129 | case WM8958: | 3292 | case WM8958: |
3130 | snd_soc_add_controls(codec, wm8958_snd_controls, | 3293 | snd_soc_add_controls(codec, wm8958_snd_controls, |
@@ -3143,10 +3306,15 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec) | |||
3143 | snd_soc_dapm_add_routes(dapm, wm8994_intercon, | 3306 | snd_soc_dapm_add_routes(dapm, wm8994_intercon, |
3144 | ARRAY_SIZE(wm8994_intercon)); | 3307 | ARRAY_SIZE(wm8994_intercon)); |
3145 | 3308 | ||
3146 | if (wm8994->revision < 4) | 3309 | if (wm8994->revision < 4) { |
3147 | snd_soc_dapm_add_routes(dapm, wm8994_revd_intercon, | 3310 | snd_soc_dapm_add_routes(dapm, wm8994_revd_intercon, |
3148 | ARRAY_SIZE(wm8994_revd_intercon)); | 3311 | ARRAY_SIZE(wm8994_revd_intercon)); |
3149 | 3312 | snd_soc_dapm_add_routes(dapm, wm8994_lateclk_revd_intercon, | |
3313 | ARRAY_SIZE(wm8994_lateclk_revd_intercon)); | ||
3314 | } else { | ||
3315 | snd_soc_dapm_add_routes(dapm, wm8994_lateclk_intercon, | ||
3316 | ARRAY_SIZE(wm8994_lateclk_intercon)); | ||
3317 | } | ||
3150 | break; | 3318 | break; |
3151 | case WM8958: | 3319 | case WM8958: |
3152 | snd_soc_dapm_add_routes(dapm, wm8958_intercon, | 3320 | snd_soc_dapm_add_routes(dapm, wm8958_intercon, |
diff --git a/sound/soc/codecs/wm_hubs.c b/sound/soc/codecs/wm_hubs.c index 613df5db0b32..516892706063 100644 --- a/sound/soc/codecs/wm_hubs.c +++ b/sound/soc/codecs/wm_hubs.c | |||
@@ -674,6 +674,9 @@ SND_SOC_DAPM_OUTPUT("LINEOUT2N"), | |||
674 | }; | 674 | }; |
675 | 675 | ||
676 | static const struct snd_soc_dapm_route analogue_routes[] = { | 676 | static const struct snd_soc_dapm_route analogue_routes[] = { |
677 | { "MICBIAS1", NULL, "CLK_SYS" }, | ||
678 | { "MICBIAS2", NULL, "CLK_SYS" }, | ||
679 | |||
677 | { "IN1L PGA", "IN1LP Switch", "IN1LP" }, | 680 | { "IN1L PGA", "IN1LP Switch", "IN1LP" }, |
678 | { "IN1L PGA", "IN1LN Switch", "IN1LN" }, | 681 | { "IN1L PGA", "IN1LN Switch", "IN1LN" }, |
679 | 682 | ||
diff --git a/sound/soc/imx/eukrea-tlv320.c b/sound/soc/imx/eukrea-tlv320.c index e20c9e1457c0..1e9bccae4e80 100644 --- a/sound/soc/imx/eukrea-tlv320.c +++ b/sound/soc/imx/eukrea-tlv320.c | |||
@@ -79,7 +79,7 @@ static struct snd_soc_dai_link eukrea_tlv320_dai = { | |||
79 | .name = "tlv320aic23", | 79 | .name = "tlv320aic23", |
80 | .stream_name = "TLV320AIC23", | 80 | .stream_name = "TLV320AIC23", |
81 | .codec_dai_name = "tlv320aic23-hifi", | 81 | .codec_dai_name = "tlv320aic23-hifi", |
82 | .platform_name = "imx-pcm-audio.0", | 82 | .platform_name = "imx-fiq-pcm-audio.0", |
83 | .codec_name = "tlv320aic23-codec.0-001a", | 83 | .codec_name = "tlv320aic23-codec.0-001a", |
84 | .cpu_dai_name = "imx-ssi.0", | 84 | .cpu_dai_name = "imx-ssi.0", |
85 | .ops = &eukrea_tlv320_snd_ops, | 85 | .ops = &eukrea_tlv320_snd_ops, |
diff --git a/sound/soc/pxa/e740_wm9705.c b/sound/soc/pxa/e740_wm9705.c index 28333e7d9c50..dc65650a6fa1 100644 --- a/sound/soc/pxa/e740_wm9705.c +++ b/sound/soc/pxa/e740_wm9705.c | |||
@@ -117,7 +117,7 @@ static struct snd_soc_dai_link e740_dai[] = { | |||
117 | { | 117 | { |
118 | .name = "AC97", | 118 | .name = "AC97", |
119 | .stream_name = "AC97 HiFi", | 119 | .stream_name = "AC97 HiFi", |
120 | .cpu_dai_name = "pxa-ac97.0", | 120 | .cpu_dai_name = "pxa2xx-ac97", |
121 | .codec_dai_name = "wm9705-hifi", | 121 | .codec_dai_name = "wm9705-hifi", |
122 | .platform_name = "pxa-pcm-audio", | 122 | .platform_name = "pxa-pcm-audio", |
123 | .codec_name = "wm9705-codec", | 123 | .codec_name = "wm9705-codec", |
@@ -126,7 +126,7 @@ static struct snd_soc_dai_link e740_dai[] = { | |||
126 | { | 126 | { |
127 | .name = "AC97 Aux", | 127 | .name = "AC97 Aux", |
128 | .stream_name = "AC97 Aux", | 128 | .stream_name = "AC97 Aux", |
129 | .cpu_dai_name = "pxa-ac97.1", | 129 | .cpu_dai_name = "pxa2xx-ac97-aux", |
130 | .codec_dai_name = "wm9705-aux", | 130 | .codec_dai_name = "wm9705-aux", |
131 | .platform_name = "pxa-pcm-audio", | 131 | .platform_name = "pxa-pcm-audio", |
132 | .codec_name = "wm9705-codec", | 132 | .codec_name = "wm9705-codec", |
diff --git a/sound/soc/pxa/e750_wm9705.c b/sound/soc/pxa/e750_wm9705.c index 01bf31675c55..51897fcd911b 100644 --- a/sound/soc/pxa/e750_wm9705.c +++ b/sound/soc/pxa/e750_wm9705.c | |||
@@ -99,7 +99,7 @@ static struct snd_soc_dai_link e750_dai[] = { | |||
99 | { | 99 | { |
100 | .name = "AC97", | 100 | .name = "AC97", |
101 | .stream_name = "AC97 HiFi", | 101 | .stream_name = "AC97 HiFi", |
102 | .cpu_dai_name = "pxa-ac97.0", | 102 | .cpu_dai_name = "pxa2xx-ac97", |
103 | .codec_dai_name = "wm9705-hifi", | 103 | .codec_dai_name = "wm9705-hifi", |
104 | .platform_name = "pxa-pcm-audio", | 104 | .platform_name = "pxa-pcm-audio", |
105 | .codec_name = "wm9705-codec", | 105 | .codec_name = "wm9705-codec", |
@@ -109,7 +109,7 @@ static struct snd_soc_dai_link e750_dai[] = { | |||
109 | { | 109 | { |
110 | .name = "AC97 Aux", | 110 | .name = "AC97 Aux", |
111 | .stream_name = "AC97 Aux", | 111 | .stream_name = "AC97 Aux", |
112 | .cpu_dai_name = "pxa-ac97.1", | 112 | .cpu_dai_name = "pxa2xx-ac97-aux", |
113 | .codec_dai_name ="wm9705-aux", | 113 | .codec_dai_name ="wm9705-aux", |
114 | .platform_name = "pxa-pcm-audio", | 114 | .platform_name = "pxa-pcm-audio", |
115 | .codec_name = "wm9705-codec", | 115 | .codec_name = "wm9705-codec", |
diff --git a/sound/soc/pxa/e800_wm9712.c b/sound/soc/pxa/e800_wm9712.c index c6a37c6ef23b..053ed208e59f 100644 --- a/sound/soc/pxa/e800_wm9712.c +++ b/sound/soc/pxa/e800_wm9712.c | |||
@@ -89,7 +89,7 @@ static struct snd_soc_dai_link e800_dai[] = { | |||
89 | { | 89 | { |
90 | .name = "AC97", | 90 | .name = "AC97", |
91 | .stream_name = "AC97 HiFi", | 91 | .stream_name = "AC97 HiFi", |
92 | .cpu_dai_name = "pxa-ac97.0", | 92 | .cpu_dai_name = "pxa2xx-ac97", |
93 | .codec_dai_name = "wm9712-hifi", | 93 | .codec_dai_name = "wm9712-hifi", |
94 | .platform_name = "pxa-pcm-audio", | 94 | .platform_name = "pxa-pcm-audio", |
95 | .codec_name = "wm9712-codec", | 95 | .codec_name = "wm9712-codec", |
@@ -98,7 +98,7 @@ static struct snd_soc_dai_link e800_dai[] = { | |||
98 | { | 98 | { |
99 | .name = "AC97 Aux", | 99 | .name = "AC97 Aux", |
100 | .stream_name = "AC97 Aux", | 100 | .stream_name = "AC97 Aux", |
101 | .cpu_dai_name = "pxa-ac97.1", | 101 | .cpu_dai_name = "pxa2xx-ac97-aux", |
102 | .codec_dai_name ="wm9712-aux", | 102 | .codec_dai_name ="wm9712-aux", |
103 | .platform_name = "pxa-pcm-audio", | 103 | .platform_name = "pxa-pcm-audio", |
104 | .codec_name = "wm9712-codec", | 104 | .codec_name = "wm9712-codec", |
diff --git a/sound/soc/pxa/em-x270.c b/sound/soc/pxa/em-x270.c index fc22e6eefc98..b13a4252812d 100644 --- a/sound/soc/pxa/em-x270.c +++ b/sound/soc/pxa/em-x270.c | |||
@@ -37,7 +37,7 @@ static struct snd_soc_dai_link em_x270_dai[] = { | |||
37 | { | 37 | { |
38 | .name = "AC97", | 38 | .name = "AC97", |
39 | .stream_name = "AC97 HiFi", | 39 | .stream_name = "AC97 HiFi", |
40 | .cpu_dai_name = "pxa-ac97.0", | 40 | .cpu_dai_name = "pxa2xx-ac97", |
41 | .codec_dai_name = "wm9712-hifi", | 41 | .codec_dai_name = "wm9712-hifi", |
42 | .platform_name = "pxa-pcm-audio", | 42 | .platform_name = "pxa-pcm-audio", |
43 | .codec_name = "wm9712-codec", | 43 | .codec_name = "wm9712-codec", |
@@ -45,7 +45,7 @@ static struct snd_soc_dai_link em_x270_dai[] = { | |||
45 | { | 45 | { |
46 | .name = "AC97 Aux", | 46 | .name = "AC97 Aux", |
47 | .stream_name = "AC97 Aux", | 47 | .stream_name = "AC97 Aux", |
48 | .cpu_dai_name = "pxa-ac97.1", | 48 | .cpu_dai_name = "pxa2xx-ac97-aux", |
49 | .codec_dai_name ="wm9712-aux", | 49 | .codec_dai_name ="wm9712-aux", |
50 | .platform_name = "pxa-pcm-audio", | 50 | .platform_name = "pxa-pcm-audio", |
51 | .codec_name = "wm9712-codec", | 51 | .codec_name = "wm9712-codec", |
diff --git a/sound/soc/pxa/mioa701_wm9713.c b/sound/soc/pxa/mioa701_wm9713.c index 0d70fc8c12bd..38ca6759907e 100644 --- a/sound/soc/pxa/mioa701_wm9713.c +++ b/sound/soc/pxa/mioa701_wm9713.c | |||
@@ -162,7 +162,7 @@ static struct snd_soc_dai_link mioa701_dai[] = { | |||
162 | { | 162 | { |
163 | .name = "AC97", | 163 | .name = "AC97", |
164 | .stream_name = "AC97 HiFi", | 164 | .stream_name = "AC97 HiFi", |
165 | .cpu_dai_name = "pxa-ac97.0", | 165 | .cpu_dai_name = "pxa2xx-ac97", |
166 | .codec_dai_name = "wm9713-hifi", | 166 | .codec_dai_name = "wm9713-hifi", |
167 | .codec_name = "wm9713-codec", | 167 | .codec_name = "wm9713-codec", |
168 | .init = mioa701_wm9713_init, | 168 | .init = mioa701_wm9713_init, |
@@ -172,7 +172,7 @@ static struct snd_soc_dai_link mioa701_dai[] = { | |||
172 | { | 172 | { |
173 | .name = "AC97 Aux", | 173 | .name = "AC97 Aux", |
174 | .stream_name = "AC97 Aux", | 174 | .stream_name = "AC97 Aux", |
175 | .cpu_dai_name = "pxa-ac97.1", | 175 | .cpu_dai_name = "pxa2xx-ac97-aux", |
176 | .codec_dai_name ="wm9713-aux", | 176 | .codec_dai_name ="wm9713-aux", |
177 | .codec_name = "wm9713-codec", | 177 | .codec_name = "wm9713-codec", |
178 | .platform_name = "pxa-pcm-audio", | 178 | .platform_name = "pxa-pcm-audio", |
diff --git a/sound/soc/pxa/palm27x.c b/sound/soc/pxa/palm27x.c index 857db96d4a4f..504e4004f004 100644 --- a/sound/soc/pxa/palm27x.c +++ b/sound/soc/pxa/palm27x.c | |||
@@ -132,7 +132,7 @@ static struct snd_soc_dai_link palm27x_dai[] = { | |||
132 | { | 132 | { |
133 | .name = "AC97 HiFi", | 133 | .name = "AC97 HiFi", |
134 | .stream_name = "AC97 HiFi", | 134 | .stream_name = "AC97 HiFi", |
135 | .cpu_dai_name = "pxa-ac97.0", | 135 | .cpu_dai_name = "pxa2xx-ac97", |
136 | .codec_dai_name = "wm9712-hifi", | 136 | .codec_dai_name = "wm9712-hifi", |
137 | .codec_name = "wm9712-codec", | 137 | .codec_name = "wm9712-codec", |
138 | .platform_name = "pxa-pcm-audio", | 138 | .platform_name = "pxa-pcm-audio", |
@@ -141,7 +141,7 @@ static struct snd_soc_dai_link palm27x_dai[] = { | |||
141 | { | 141 | { |
142 | .name = "AC97 Aux", | 142 | .name = "AC97 Aux", |
143 | .stream_name = "AC97 Aux", | 143 | .stream_name = "AC97 Aux", |
144 | .cpu_dai_name = "pxa-ac97.1", | 144 | .cpu_dai_name = "pxa2xx-ac97-aux", |
145 | .codec_dai_name = "wm9712-aux", | 145 | .codec_dai_name = "wm9712-aux", |
146 | .codec_name = "wm9712-codec", | 146 | .codec_name = "wm9712-codec", |
147 | .platform_name = "pxa-pcm-audio", | 147 | .platform_name = "pxa-pcm-audio", |
diff --git a/sound/soc/pxa/tosa.c b/sound/soc/pxa/tosa.c index f75804ef0897..4b6e5d608b42 100644 --- a/sound/soc/pxa/tosa.c +++ b/sound/soc/pxa/tosa.c | |||
@@ -219,7 +219,7 @@ static struct snd_soc_dai_link tosa_dai[] = { | |||
219 | { | 219 | { |
220 | .name = "AC97", | 220 | .name = "AC97", |
221 | .stream_name = "AC97 HiFi", | 221 | .stream_name = "AC97 HiFi", |
222 | .cpu_dai_name = "pxa-ac97.0", | 222 | .cpu_dai_name = "pxa2xx-ac97", |
223 | .codec_dai_name = "wm9712-hifi", | 223 | .codec_dai_name = "wm9712-hifi", |
224 | .platform_name = "pxa-pcm-audio", | 224 | .platform_name = "pxa-pcm-audio", |
225 | .codec_name = "wm9712-codec", | 225 | .codec_name = "wm9712-codec", |
@@ -229,7 +229,7 @@ static struct snd_soc_dai_link tosa_dai[] = { | |||
229 | { | 229 | { |
230 | .name = "AC97 Aux", | 230 | .name = "AC97 Aux", |
231 | .stream_name = "AC97 Aux", | 231 | .stream_name = "AC97 Aux", |
232 | .cpu_dai_name = "pxa-ac97.1", | 232 | .cpu_dai_name = "pxa2xx-ac97-aux", |
233 | .codec_dai_name = "wm9712-aux", | 233 | .codec_dai_name = "wm9712-aux", |
234 | .platform_name = "pxa-pcm-audio", | 234 | .platform_name = "pxa-pcm-audio", |
235 | .codec_name = "wm9712-codec", | 235 | .codec_name = "wm9712-codec", |
diff --git a/sound/soc/pxa/zylonite.c b/sound/soc/pxa/zylonite.c index b222a7d72027..25bba108fea3 100644 --- a/sound/soc/pxa/zylonite.c +++ b/sound/soc/pxa/zylonite.c | |||
@@ -166,7 +166,7 @@ static struct snd_soc_dai_link zylonite_dai[] = { | |||
166 | .stream_name = "AC97 HiFi", | 166 | .stream_name = "AC97 HiFi", |
167 | .codec_name = "wm9713-codec", | 167 | .codec_name = "wm9713-codec", |
168 | .platform_name = "pxa-pcm-audio", | 168 | .platform_name = "pxa-pcm-audio", |
169 | .cpu_dai_name = "pxa-ac97.0", | 169 | .cpu_dai_name = "pxa2xx-ac97", |
170 | .codec_name = "wm9713-hifi", | 170 | .codec_name = "wm9713-hifi", |
171 | .init = zylonite_wm9713_init, | 171 | .init = zylonite_wm9713_init, |
172 | }, | 172 | }, |
@@ -175,7 +175,7 @@ static struct snd_soc_dai_link zylonite_dai[] = { | |||
175 | .stream_name = "AC97 Aux", | 175 | .stream_name = "AC97 Aux", |
176 | .codec_name = "wm9713-codec", | 176 | .codec_name = "wm9713-codec", |
177 | .platform_name = "pxa-pcm-audio", | 177 | .platform_name = "pxa-pcm-audio", |
178 | .cpu_dai_name = "pxa-ac97.1", | 178 | .cpu_dai_name = "pxa2xx-ac97-aux", |
179 | .codec_name = "wm9713-aux", | 179 | .codec_name = "wm9713-aux", |
180 | }, | 180 | }, |
181 | { | 181 | { |
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 8194f150bab7..25e54230cc6a 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
@@ -712,7 +712,15 @@ static int dapm_supply_check_power(struct snd_soc_dapm_widget *w) | |||
712 | !path->connected(path->source, path->sink)) | 712 | !path->connected(path->source, path->sink)) |
713 | continue; | 713 | continue; |
714 | 714 | ||
715 | if (path->sink && path->sink->power_check && | 715 | if (!path->sink) |
716 | continue; | ||
717 | |||
718 | if (path->sink->force) { | ||
719 | power = 1; | ||
720 | break; | ||
721 | } | ||
722 | |||
723 | if (path->sink->power_check && | ||
716 | path->sink->power_check(path->sink)) { | 724 | path->sink->power_check(path->sink)) { |
717 | power = 1; | 725 | power = 1; |
718 | break; | 726 | break; |
@@ -1627,6 +1635,7 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_add_routes); | |||
1627 | int snd_soc_dapm_new_widgets(struct snd_soc_dapm_context *dapm) | 1635 | int snd_soc_dapm_new_widgets(struct snd_soc_dapm_context *dapm) |
1628 | { | 1636 | { |
1629 | struct snd_soc_dapm_widget *w; | 1637 | struct snd_soc_dapm_widget *w; |
1638 | unsigned int val; | ||
1630 | 1639 | ||
1631 | list_for_each_entry(w, &dapm->card->widgets, list) | 1640 | list_for_each_entry(w, &dapm->card->widgets, list) |
1632 | { | 1641 | { |
@@ -1675,6 +1684,18 @@ int snd_soc_dapm_new_widgets(struct snd_soc_dapm_context *dapm) | |||
1675 | case snd_soc_dapm_post: | 1684 | case snd_soc_dapm_post: |
1676 | break; | 1685 | break; |
1677 | } | 1686 | } |
1687 | |||
1688 | /* Read the initial power state from the device */ | ||
1689 | if (w->reg >= 0) { | ||
1690 | val = snd_soc_read(w->codec, w->reg); | ||
1691 | val &= 1 << w->shift; | ||
1692 | if (w->invert) | ||
1693 | val = !val; | ||
1694 | |||
1695 | if (val) | ||
1696 | w->power = 1; | ||
1697 | } | ||
1698 | |||
1678 | w->new = 1; | 1699 | w->new = 1; |
1679 | } | 1700 | } |
1680 | 1701 | ||
diff --git a/sound/usb/card.c b/sound/usb/card.c index 800f7cb4f251..c0f8270bc199 100644 --- a/sound/usb/card.c +++ b/sound/usb/card.c | |||
@@ -323,6 +323,7 @@ static int snd_usb_audio_create(struct usb_device *dev, int idx, | |||
323 | return -ENOMEM; | 323 | return -ENOMEM; |
324 | } | 324 | } |
325 | 325 | ||
326 | mutex_init(&chip->shutdown_mutex); | ||
326 | chip->index = idx; | 327 | chip->index = idx; |
327 | chip->dev = dev; | 328 | chip->dev = dev; |
328 | chip->card = card; | 329 | chip->card = card; |
@@ -531,6 +532,7 @@ static void snd_usb_audio_disconnect(struct usb_device *dev, void *ptr) | |||
531 | chip = ptr; | 532 | chip = ptr; |
532 | card = chip->card; | 533 | card = chip->card; |
533 | mutex_lock(®ister_mutex); | 534 | mutex_lock(®ister_mutex); |
535 | mutex_lock(&chip->shutdown_mutex); | ||
534 | chip->shutdown = 1; | 536 | chip->shutdown = 1; |
535 | chip->num_interfaces--; | 537 | chip->num_interfaces--; |
536 | if (chip->num_interfaces <= 0) { | 538 | if (chip->num_interfaces <= 0) { |
@@ -548,9 +550,11 @@ static void snd_usb_audio_disconnect(struct usb_device *dev, void *ptr) | |||
548 | snd_usb_mixer_disconnect(p); | 550 | snd_usb_mixer_disconnect(p); |
549 | } | 551 | } |
550 | usb_chip[chip->index] = NULL; | 552 | usb_chip[chip->index] = NULL; |
553 | mutex_unlock(&chip->shutdown_mutex); | ||
551 | mutex_unlock(®ister_mutex); | 554 | mutex_unlock(®ister_mutex); |
552 | snd_card_free_when_closed(card); | 555 | snd_card_free_when_closed(card); |
553 | } else { | 556 | } else { |
557 | mutex_unlock(&chip->shutdown_mutex); | ||
554 | mutex_unlock(®ister_mutex); | 558 | mutex_unlock(®ister_mutex); |
555 | } | 559 | } |
556 | } | 560 | } |
diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c index 4132522ac90f..e3f680526cb5 100644 --- a/sound/usb/pcm.c +++ b/sound/usb/pcm.c | |||
@@ -361,6 +361,7 @@ static int snd_usb_hw_params(struct snd_pcm_substream *substream, | |||
361 | } | 361 | } |
362 | 362 | ||
363 | if (changed) { | 363 | if (changed) { |
364 | mutex_lock(&subs->stream->chip->shutdown_mutex); | ||
364 | /* format changed */ | 365 | /* format changed */ |
365 | snd_usb_release_substream_urbs(subs, 0); | 366 | snd_usb_release_substream_urbs(subs, 0); |
366 | /* influenced: period_bytes, channels, rate, format, */ | 367 | /* influenced: period_bytes, channels, rate, format, */ |
@@ -368,6 +369,7 @@ static int snd_usb_hw_params(struct snd_pcm_substream *substream, | |||
368 | params_rate(hw_params), | 369 | params_rate(hw_params), |
369 | snd_pcm_format_physical_width(params_format(hw_params)) * | 370 | snd_pcm_format_physical_width(params_format(hw_params)) * |
370 | params_channels(hw_params)); | 371 | params_channels(hw_params)); |
372 | mutex_unlock(&subs->stream->chip->shutdown_mutex); | ||
371 | } | 373 | } |
372 | 374 | ||
373 | return ret; | 375 | return ret; |
@@ -385,8 +387,9 @@ static int snd_usb_hw_free(struct snd_pcm_substream *substream) | |||
385 | subs->cur_audiofmt = NULL; | 387 | subs->cur_audiofmt = NULL; |
386 | subs->cur_rate = 0; | 388 | subs->cur_rate = 0; |
387 | subs->period_bytes = 0; | 389 | subs->period_bytes = 0; |
388 | if (!subs->stream->chip->shutdown) | 390 | mutex_lock(&subs->stream->chip->shutdown_mutex); |
389 | snd_usb_release_substream_urbs(subs, 0); | 391 | snd_usb_release_substream_urbs(subs, 0); |
392 | mutex_unlock(&subs->stream->chip->shutdown_mutex); | ||
390 | return snd_pcm_lib_free_vmalloc_buffer(substream); | 393 | return snd_pcm_lib_free_vmalloc_buffer(substream); |
391 | } | 394 | } |
392 | 395 | ||
diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h index db3eb21627ee..6e66fffe87f5 100644 --- a/sound/usb/usbaudio.h +++ b/sound/usb/usbaudio.h | |||
@@ -36,6 +36,7 @@ struct snd_usb_audio { | |||
36 | struct snd_card *card; | 36 | struct snd_card *card; |
37 | u32 usb_id; | 37 | u32 usb_id; |
38 | int shutdown; | 38 | int shutdown; |
39 | struct mutex shutdown_mutex; | ||
39 | unsigned int txfr_quirk:1; /* Subframe boundaries on transfers */ | 40 | unsigned int txfr_quirk:1; /* Subframe boundaries on transfers */ |
40 | int num_interfaces; | 41 | int num_interfaces; |
41 | int num_suspended_intf; | 42 | int num_suspended_intf; |
diff --git a/tools/perf/builtin-timechart.c b/tools/perf/builtin-timechart.c index 746cf03cb05d..0ace786e83e0 100644 --- a/tools/perf/builtin-timechart.c +++ b/tools/perf/builtin-timechart.c | |||
@@ -264,9 +264,6 @@ pid_put_sample(int pid, int type, unsigned int cpu, u64 start, u64 end) | |||
264 | c->start_time = start; | 264 | c->start_time = start; |
265 | if (p->start_time == 0 || p->start_time > start) | 265 | if (p->start_time == 0 || p->start_time > start) |
266 | p->start_time = start; | 266 | p->start_time = start; |
267 | |||
268 | if (cpu > numcpus) | ||
269 | numcpus = cpu; | ||
270 | } | 267 | } |
271 | 268 | ||
272 | #define MAX_CPUS 4096 | 269 | #define MAX_CPUS 4096 |
@@ -511,6 +508,9 @@ static int process_sample_event(event_t *event __used, | |||
511 | if (!event_str) | 508 | if (!event_str) |
512 | return 0; | 509 | return 0; |
513 | 510 | ||
511 | if (sample->cpu > numcpus) | ||
512 | numcpus = sample->cpu; | ||
513 | |||
514 | if (strcmp(event_str, "power:cpu_idle") == 0) { | 514 | if (strcmp(event_str, "power:cpu_idle") == 0) { |
515 | struct power_processor_entry *ppe = (void *)te; | 515 | struct power_processor_entry *ppe = (void *)te; |
516 | if (ppe->state == (u32)PWR_EVENT_EXIT) | 516 | if (ppe->state == (u32)PWR_EVENT_EXIT) |
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index 32f4f1f2f6e4..df51560f16f7 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c | |||
@@ -585,6 +585,7 @@ int hist_entry__snprintf(struct hist_entry *self, char *s, size_t size, | |||
585 | { | 585 | { |
586 | struct sort_entry *se; | 586 | struct sort_entry *se; |
587 | u64 period, total, period_sys, period_us, period_guest_sys, period_guest_us; | 587 | u64 period, total, period_sys, period_us, period_guest_sys, period_guest_us; |
588 | u64 nr_events; | ||
588 | const char *sep = symbol_conf.field_sep; | 589 | const char *sep = symbol_conf.field_sep; |
589 | int ret; | 590 | int ret; |
590 | 591 | ||
@@ -593,6 +594,7 @@ int hist_entry__snprintf(struct hist_entry *self, char *s, size_t size, | |||
593 | 594 | ||
594 | if (pair_hists) { | 595 | if (pair_hists) { |
595 | period = self->pair ? self->pair->period : 0; | 596 | period = self->pair ? self->pair->period : 0; |
597 | nr_events = self->pair ? self->pair->nr_events : 0; | ||
596 | total = pair_hists->stats.total_period; | 598 | total = pair_hists->stats.total_period; |
597 | period_sys = self->pair ? self->pair->period_sys : 0; | 599 | period_sys = self->pair ? self->pair->period_sys : 0; |
598 | period_us = self->pair ? self->pair->period_us : 0; | 600 | period_us = self->pair ? self->pair->period_us : 0; |
@@ -600,6 +602,7 @@ int hist_entry__snprintf(struct hist_entry *self, char *s, size_t size, | |||
600 | period_guest_us = self->pair ? self->pair->period_guest_us : 0; | 602 | period_guest_us = self->pair ? self->pair->period_guest_us : 0; |
601 | } else { | 603 | } else { |
602 | period = self->period; | 604 | period = self->period; |
605 | nr_events = self->nr_events; | ||
603 | total = session_total; | 606 | total = session_total; |
604 | period_sys = self->period_sys; | 607 | period_sys = self->period_sys; |
605 | period_us = self->period_us; | 608 | period_us = self->period_us; |
@@ -640,9 +643,9 @@ int hist_entry__snprintf(struct hist_entry *self, char *s, size_t size, | |||
640 | 643 | ||
641 | if (symbol_conf.show_nr_samples) { | 644 | if (symbol_conf.show_nr_samples) { |
642 | if (sep) | 645 | if (sep) |
643 | ret += snprintf(s + ret, size - ret, "%c%" PRIu64, *sep, period); | 646 | ret += snprintf(s + ret, size - ret, "%c%" PRIu64, *sep, nr_events); |
644 | else | 647 | else |
645 | ret += snprintf(s + ret, size - ret, "%11" PRIu64, period); | 648 | ret += snprintf(s + ret, size - ret, "%11" PRIu64, nr_events); |
646 | } | 649 | } |
647 | 650 | ||
648 | if (pair_hists) { | 651 | if (pair_hists) { |
diff --git a/tools/perf/util/svghelper.c b/tools/perf/util/svghelper.c index fb737fe9be91..96c866045d60 100644 --- a/tools/perf/util/svghelper.c +++ b/tools/perf/util/svghelper.c | |||
@@ -456,9 +456,9 @@ void svg_legenda(void) | |||
456 | return; | 456 | return; |
457 | 457 | ||
458 | svg_legenda_box(0, "Running", "sample"); | 458 | svg_legenda_box(0, "Running", "sample"); |
459 | svg_legenda_box(100, "Idle","rect.c1"); | 459 | svg_legenda_box(100, "Idle","c1"); |
460 | svg_legenda_box(200, "Deeper Idle", "rect.c3"); | 460 | svg_legenda_box(200, "Deeper Idle", "c3"); |
461 | svg_legenda_box(350, "Deepest Idle", "rect.c6"); | 461 | svg_legenda_box(350, "Deepest Idle", "c6"); |
462 | svg_legenda_box(550, "Sleeping", "process2"); | 462 | svg_legenda_box(550, "Sleeping", "process2"); |
463 | svg_legenda_box(650, "Waiting for cpu", "waiting"); | 463 | svg_legenda_box(650, "Waiting for cpu", "waiting"); |
464 | svg_legenda_box(800, "Blocked on IO", "blocked"); | 464 | svg_legenda_box(800, "Blocked on IO", "blocked"); |