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