diff options
92 files changed, 979 insertions, 478 deletions
diff --git a/Documentation/sound/alsa/HD-Audio-Models.txt b/Documentation/sound/alsa/HD-Audio-Models.txt index 16ae4300c747..0caf77e59be4 100644 --- a/Documentation/sound/alsa/HD-Audio-Models.txt +++ b/Documentation/sound/alsa/HD-Audio-Models.txt | |||
@@ -296,6 +296,7 @@ Conexant 5066 | |||
296 | ============= | 296 | ============= |
297 | laptop Basic Laptop config (default) | 297 | laptop Basic Laptop config (default) |
298 | hp-laptop HP laptops, e g G60 | 298 | hp-laptop HP laptops, e g G60 |
299 | asus Asus K52JU, Lenovo G560 | ||
299 | dell-laptop Dell laptops | 300 | dell-laptop Dell laptops |
300 | dell-vostro Dell Vostro | 301 | dell-vostro Dell Vostro |
301 | olpc-xo-1_5 OLPC XO 1.5 | 302 | olpc-xo-1_5 OLPC XO 1.5 |
@@ -1,7 +1,7 @@ | |||
1 | VERSION = 2 | 1 | VERSION = 2 |
2 | PATCHLEVEL = 6 | 2 | PATCHLEVEL = 6 |
3 | SUBLEVEL = 38 | 3 | SUBLEVEL = 38 |
4 | EXTRAVERSION = -rc3 | 4 | EXTRAVERSION = -rc4 |
5 | NAME = Flesh-Eating Bats with Fangs | 5 | NAME = Flesh-Eating Bats with Fangs |
6 | 6 | ||
7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
diff --git a/arch/arm/mach-ep93xx/core.c b/arch/arm/mach-ep93xx/core.c index ffdf87be2958..82079545adc4 100644 --- a/arch/arm/mach-ep93xx/core.c +++ b/arch/arm/mach-ep93xx/core.c | |||
@@ -838,7 +838,7 @@ EXPORT_SYMBOL(ep93xx_i2s_release); | |||
838 | static struct resource ep93xx_ac97_resources[] = { | 838 | static struct resource ep93xx_ac97_resources[] = { |
839 | { | 839 | { |
840 | .start = EP93XX_AAC_PHYS_BASE, | 840 | .start = EP93XX_AAC_PHYS_BASE, |
841 | .end = EP93XX_AAC_PHYS_BASE + 0xb0 - 1, | 841 | .end = EP93XX_AAC_PHYS_BASE + 0xac - 1, |
842 | .flags = IORESOURCE_MEM, | 842 | .flags = IORESOURCE_MEM, |
843 | }, | 843 | }, |
844 | { | 844 | { |
diff --git a/arch/arm/mach-imx/mach-mx25_3ds.c b/arch/arm/mach-imx/mach-mx25_3ds.c index aa76cfd9f348..8382e7902078 100644 --- a/arch/arm/mach-imx/mach-mx25_3ds.c +++ b/arch/arm/mach-imx/mach-mx25_3ds.c | |||
@@ -180,7 +180,7 @@ static const uint32_t mx25pdk_keymap[] = { | |||
180 | KEY(3, 3, KEY_POWER), | 180 | KEY(3, 3, KEY_POWER), |
181 | }; | 181 | }; |
182 | 182 | ||
183 | static const struct matrix_keymap_data mx25pdk_keymap_data __initdata = { | 183 | static const struct matrix_keymap_data mx25pdk_keymap_data __initconst = { |
184 | .keymap = mx25pdk_keymap, | 184 | .keymap = mx25pdk_keymap, |
185 | .keymap_size = ARRAY_SIZE(mx25pdk_keymap), | 185 | .keymap_size = ARRAY_SIZE(mx25pdk_keymap), |
186 | }; | 186 | }; |
diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c index 4dc68d6bb6be..9fd894271d5d 100644 --- a/arch/arm/mach-ixp4xx/common.c +++ b/arch/arm/mach-ixp4xx/common.c | |||
@@ -432,7 +432,7 @@ static struct clocksource clocksource_ixp4xx = { | |||
432 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, | 432 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, |
433 | }; | 433 | }; |
434 | 434 | ||
435 | unsigned long ixp4xx_timer_freq = FREQ; | 435 | unsigned long ixp4xx_timer_freq = IXP4XX_TIMER_FREQ; |
436 | EXPORT_SYMBOL(ixp4xx_timer_freq); | 436 | EXPORT_SYMBOL(ixp4xx_timer_freq); |
437 | static void __init ixp4xx_clocksource_init(void) | 437 | static void __init ixp4xx_clocksource_init(void) |
438 | { | 438 | { |
@@ -496,7 +496,7 @@ static struct clock_event_device clockevent_ixp4xx = { | |||
496 | 496 | ||
497 | static void __init ixp4xx_clockevent_init(void) | 497 | static void __init ixp4xx_clockevent_init(void) |
498 | { | 498 | { |
499 | clockevent_ixp4xx.mult = div_sc(FREQ, NSEC_PER_SEC, | 499 | clockevent_ixp4xx.mult = div_sc(IXP4XX_TIMER_FREQ, NSEC_PER_SEC, |
500 | clockevent_ixp4xx.shift); | 500 | clockevent_ixp4xx.shift); |
501 | clockevent_ixp4xx.max_delta_ns = | 501 | clockevent_ixp4xx.max_delta_ns = |
502 | clockevent_delta2ns(0xfffffffe, &clockevent_ixp4xx); | 502 | clockevent_delta2ns(0xfffffffe, &clockevent_ixp4xx); |
diff --git a/arch/arm/mach-ixp4xx/include/mach/timex.h b/arch/arm/mach-ixp4xx/include/mach/timex.h index 2c3f93c3eb79..c9e930f29339 100644 --- a/arch/arm/mach-ixp4xx/include/mach/timex.h +++ b/arch/arm/mach-ixp4xx/include/mach/timex.h | |||
@@ -10,6 +10,7 @@ | |||
10 | * 66.66... MHz. We do a convulted calculation of CLOCK_TICK_RATE b/c the | 10 | * 66.66... MHz. We do a convulted calculation of CLOCK_TICK_RATE b/c the |
11 | * timer register ignores the bottom 2 bits of the LATCH value. | 11 | * timer register ignores the bottom 2 bits of the LATCH value. |
12 | */ | 12 | */ |
13 | #define FREQ 66666000 | 13 | #define IXP4XX_TIMER_FREQ 66666000 |
14 | #define CLOCK_TICK_RATE (((FREQ / HZ & ~IXP4XX_OST_RELOAD_MASK) + 1) * HZ) | 14 | #define CLOCK_TICK_RATE \ |
15 | (((IXP4XX_TIMER_FREQ / HZ & ~IXP4XX_OST_RELOAD_MASK) + 1) * HZ) | ||
15 | 16 | ||
diff --git a/arch/arm/mach-ixp4xx/ixp4xx_qmgr.c b/arch/arm/mach-ixp4xx/ixp4xx_qmgr.c index bfdbe4b5a3cc..852f7c9f87d0 100644 --- a/arch/arm/mach-ixp4xx/ixp4xx_qmgr.c +++ b/arch/arm/mach-ixp4xx/ixp4xx_qmgr.c | |||
@@ -265,6 +265,11 @@ void qmgr_release_queue(unsigned int queue) | |||
265 | qmgr_queue_descs[queue], queue); | 265 | qmgr_queue_descs[queue], queue); |
266 | qmgr_queue_descs[queue][0] = '\x0'; | 266 | qmgr_queue_descs[queue][0] = '\x0'; |
267 | #endif | 267 | #endif |
268 | |||
269 | while ((addr = qmgr_get_entry(queue))) | ||
270 | printk(KERN_ERR "qmgr: released queue %i not empty: 0x%08X\n", | ||
271 | queue, addr); | ||
272 | |||
268 | __raw_writel(0, &qmgr_regs->sram[queue]); | 273 | __raw_writel(0, &qmgr_regs->sram[queue]); |
269 | 274 | ||
270 | used_sram_bitmap[0] &= ~mask[0]; | 275 | used_sram_bitmap[0] &= ~mask[0]; |
@@ -275,10 +280,6 @@ void qmgr_release_queue(unsigned int queue) | |||
275 | spin_unlock_irq(&qmgr_lock); | 280 | spin_unlock_irq(&qmgr_lock); |
276 | 281 | ||
277 | module_put(THIS_MODULE); | 282 | module_put(THIS_MODULE); |
278 | |||
279 | while ((addr = qmgr_get_entry(queue))) | ||
280 | printk(KERN_ERR "qmgr: released queue %i not empty: 0x%08X\n", | ||
281 | queue, addr); | ||
282 | } | 283 | } |
283 | 284 | ||
284 | static int qmgr_init(void) | 285 | static int qmgr_init(void) |
diff --git a/arch/arm/mach-mxs/clock-mx23.c b/arch/arm/mach-mxs/clock-mx23.c index b1a362ebfded..ca72a05ed9c1 100644 --- a/arch/arm/mach-mxs/clock-mx23.c +++ b/arch/arm/mach-mxs/clock-mx23.c | |||
@@ -304,7 +304,7 @@ static int name##_set_rate(struct clk *clk, unsigned long rate) \ | |||
304 | reg = __raw_readl(CLKCTRL_BASE_ADDR + HW_CLKCTRL_##dr); \ | 304 | reg = __raw_readl(CLKCTRL_BASE_ADDR + HW_CLKCTRL_##dr); \ |
305 | reg &= ~BM_CLKCTRL_##dr##_DIV; \ | 305 | reg &= ~BM_CLKCTRL_##dr##_DIV; \ |
306 | reg |= div << BP_CLKCTRL_##dr##_DIV; \ | 306 | reg |= div << BP_CLKCTRL_##dr##_DIV; \ |
307 | if (reg | (1 << clk->enable_shift)) { \ | 307 | if (reg & (1 << clk->enable_shift)) { \ |
308 | pr_err("%s: clock is gated\n", __func__); \ | 308 | pr_err("%s: clock is gated\n", __func__); \ |
309 | return -EINVAL; \ | 309 | return -EINVAL; \ |
310 | } \ | 310 | } \ |
@@ -347,7 +347,7 @@ static int name##_set_parent(struct clk *clk, struct clk *parent) \ | |||
347 | { \ | 347 | { \ |
348 | if (parent != clk->parent) { \ | 348 | if (parent != clk->parent) { \ |
349 | __raw_writel(BM_CLKCTRL_CLKSEQ_BYPASS_##bit, \ | 349 | __raw_writel(BM_CLKCTRL_CLKSEQ_BYPASS_##bit, \ |
350 | HW_CLKCTRL_CLKSEQ_TOG); \ | 350 | CLKCTRL_BASE_ADDR + HW_CLKCTRL_CLKSEQ_TOG); \ |
351 | clk->parent = parent; \ | 351 | clk->parent = parent; \ |
352 | } \ | 352 | } \ |
353 | \ | 353 | \ |
diff --git a/arch/arm/mach-mxs/clock-mx28.c b/arch/arm/mach-mxs/clock-mx28.c index 56312c092a9e..fd1c4c54b8e5 100644 --- a/arch/arm/mach-mxs/clock-mx28.c +++ b/arch/arm/mach-mxs/clock-mx28.c | |||
@@ -355,12 +355,12 @@ static int name##_set_rate(struct clk *clk, unsigned long rate) \ | |||
355 | } else { \ | 355 | } else { \ |
356 | reg &= ~BM_CLKCTRL_##dr##_DIV; \ | 356 | reg &= ~BM_CLKCTRL_##dr##_DIV; \ |
357 | reg |= div << BP_CLKCTRL_##dr##_DIV; \ | 357 | reg |= div << BP_CLKCTRL_##dr##_DIV; \ |
358 | if (reg | (1 << clk->enable_shift)) { \ | 358 | if (reg & (1 << clk->enable_shift)) { \ |
359 | pr_err("%s: clock is gated\n", __func__); \ | 359 | pr_err("%s: clock is gated\n", __func__); \ |
360 | return -EINVAL; \ | 360 | return -EINVAL; \ |
361 | } \ | 361 | } \ |
362 | } \ | 362 | } \ |
363 | __raw_writel(reg, CLKCTRL_BASE_ADDR + HW_CLKCTRL_CPU); \ | 363 | __raw_writel(reg, CLKCTRL_BASE_ADDR + HW_CLKCTRL_##dr); \ |
364 | \ | 364 | \ |
365 | for (i = 10000; i; i--) \ | 365 | for (i = 10000; i; i--) \ |
366 | if (!(__raw_readl(CLKCTRL_BASE_ADDR + \ | 366 | if (!(__raw_readl(CLKCTRL_BASE_ADDR + \ |
@@ -483,7 +483,7 @@ static int name##_set_parent(struct clk *clk, struct clk *parent) \ | |||
483 | { \ | 483 | { \ |
484 | if (parent != clk->parent) { \ | 484 | if (parent != clk->parent) { \ |
485 | __raw_writel(BM_CLKCTRL_CLKSEQ_BYPASS_##bit, \ | 485 | __raw_writel(BM_CLKCTRL_CLKSEQ_BYPASS_##bit, \ |
486 | HW_CLKCTRL_CLKSEQ_TOG); \ | 486 | CLKCTRL_BASE_ADDR + HW_CLKCTRL_CLKSEQ_TOG); \ |
487 | clk->parent = parent; \ | 487 | clk->parent = parent; \ |
488 | } \ | 488 | } \ |
489 | \ | 489 | \ |
@@ -609,7 +609,6 @@ static struct clk_lookup lookups[] = { | |||
609 | _REGISTER_CLOCK("duart", NULL, uart_clk) | 609 | _REGISTER_CLOCK("duart", NULL, uart_clk) |
610 | _REGISTER_CLOCK("imx28-fec.0", NULL, fec_clk) | 610 | _REGISTER_CLOCK("imx28-fec.0", NULL, fec_clk) |
611 | _REGISTER_CLOCK("imx28-fec.1", NULL, fec_clk) | 611 | _REGISTER_CLOCK("imx28-fec.1", NULL, fec_clk) |
612 | _REGISTER_CLOCK("fec.0", NULL, fec_clk) | ||
613 | _REGISTER_CLOCK("rtc", NULL, rtc_clk) | 612 | _REGISTER_CLOCK("rtc", NULL, rtc_clk) |
614 | _REGISTER_CLOCK("pll2", NULL, pll2_clk) | 613 | _REGISTER_CLOCK("pll2", NULL, pll2_clk) |
615 | _REGISTER_CLOCK(NULL, "hclk", hbus_clk) | 614 | _REGISTER_CLOCK(NULL, "hclk", hbus_clk) |
diff --git a/arch/arm/mach-mxs/clock.c b/arch/arm/mach-mxs/clock.c index e7d2269cf70e..a7093c88e6a6 100644 --- a/arch/arm/mach-mxs/clock.c +++ b/arch/arm/mach-mxs/clock.c | |||
@@ -57,7 +57,6 @@ static void __clk_disable(struct clk *clk) | |||
57 | if (clk->disable) | 57 | if (clk->disable) |
58 | clk->disable(clk); | 58 | clk->disable(clk); |
59 | __clk_disable(clk->parent); | 59 | __clk_disable(clk->parent); |
60 | __clk_disable(clk->secondary); | ||
61 | } | 60 | } |
62 | } | 61 | } |
63 | 62 | ||
@@ -68,7 +67,6 @@ static int __clk_enable(struct clk *clk) | |||
68 | 67 | ||
69 | if (clk->usecount++ == 0) { | 68 | if (clk->usecount++ == 0) { |
70 | __clk_enable(clk->parent); | 69 | __clk_enable(clk->parent); |
71 | __clk_enable(clk->secondary); | ||
72 | 70 | ||
73 | if (clk->enable) | 71 | if (clk->enable) |
74 | clk->enable(clk); | 72 | clk->enable(clk); |
diff --git a/arch/arm/mach-mxs/gpio.c b/arch/arm/mach-mxs/gpio.c index d7ad7a61366d..cb0c0e83a527 100644 --- a/arch/arm/mach-mxs/gpio.c +++ b/arch/arm/mach-mxs/gpio.c | |||
@@ -139,6 +139,8 @@ static void mxs_gpio_irq_handler(u32 irq, struct irq_desc *desc) | |||
139 | struct mxs_gpio_port *port = (struct mxs_gpio_port *)get_irq_data(irq); | 139 | struct mxs_gpio_port *port = (struct mxs_gpio_port *)get_irq_data(irq); |
140 | u32 gpio_irq_no_base = port->virtual_irq_start; | 140 | u32 gpio_irq_no_base = port->virtual_irq_start; |
141 | 141 | ||
142 | desc->irq_data.chip->irq_ack(&desc->irq_data); | ||
143 | |||
142 | irq_stat = __raw_readl(port->base + PINCTRL_IRQSTAT(port->id)) & | 144 | irq_stat = __raw_readl(port->base + PINCTRL_IRQSTAT(port->id)) & |
143 | __raw_readl(port->base + PINCTRL_IRQEN(port->id)); | 145 | __raw_readl(port->base + PINCTRL_IRQEN(port->id)); |
144 | 146 | ||
diff --git a/arch/arm/mach-mxs/include/mach/clock.h b/arch/arm/mach-mxs/include/mach/clock.h index 041e276d8a32..592c9ab5d760 100644 --- a/arch/arm/mach-mxs/include/mach/clock.h +++ b/arch/arm/mach-mxs/include/mach/clock.h | |||
@@ -29,8 +29,6 @@ struct clk { | |||
29 | int id; | 29 | int id; |
30 | /* Source clock this clk depends on */ | 30 | /* Source clock this clk depends on */ |
31 | struct clk *parent; | 31 | struct clk *parent; |
32 | /* Secondary clock to enable/disable with this clock */ | ||
33 | struct clk *secondary; | ||
34 | /* Reference count of clock enable/disable */ | 32 | /* Reference count of clock enable/disable */ |
35 | __s8 usecount; | 33 | __s8 usecount; |
36 | /* Register bit position for clock's enable/disable control. */ | 34 | /* Register bit position for clock's enable/disable control. */ |
diff --git a/arch/arm/mach-omap1/lcd_dma.c b/arch/arm/mach-omap1/lcd_dma.c index c9088d85da04..453809359ba6 100644 --- a/arch/arm/mach-omap1/lcd_dma.c +++ b/arch/arm/mach-omap1/lcd_dma.c | |||
@@ -37,7 +37,7 @@ int omap_lcd_dma_running(void) | |||
37 | * On OMAP1510, internal LCD controller will start the transfer | 37 | * On OMAP1510, internal LCD controller will start the transfer |
38 | * when it gets enabled, so assume DMA running if LCD enabled. | 38 | * when it gets enabled, so assume DMA running if LCD enabled. |
39 | */ | 39 | */ |
40 | if (cpu_is_omap1510()) | 40 | if (cpu_is_omap15xx()) |
41 | if (omap_readw(OMAP_LCDC_CONTROL) & OMAP_LCDC_CTRL_LCD_EN) | 41 | if (omap_readw(OMAP_LCDC_CONTROL) & OMAP_LCDC_CTRL_LCD_EN) |
42 | return 1; | 42 | return 1; |
43 | 43 | ||
@@ -95,7 +95,7 @@ EXPORT_SYMBOL(omap_set_lcd_dma_single_transfer); | |||
95 | 95 | ||
96 | void omap_set_lcd_dma_b1_rotation(int rotate) | 96 | void omap_set_lcd_dma_b1_rotation(int rotate) |
97 | { | 97 | { |
98 | if (cpu_is_omap1510()) { | 98 | if (cpu_is_omap15xx()) { |
99 | printk(KERN_ERR "DMA rotation is not supported in 1510 mode\n"); | 99 | printk(KERN_ERR "DMA rotation is not supported in 1510 mode\n"); |
100 | BUG(); | 100 | BUG(); |
101 | return; | 101 | return; |
@@ -106,7 +106,7 @@ EXPORT_SYMBOL(omap_set_lcd_dma_b1_rotation); | |||
106 | 106 | ||
107 | void omap_set_lcd_dma_b1_mirror(int mirror) | 107 | void omap_set_lcd_dma_b1_mirror(int mirror) |
108 | { | 108 | { |
109 | if (cpu_is_omap1510()) { | 109 | if (cpu_is_omap15xx()) { |
110 | printk(KERN_ERR "DMA mirror is not supported in 1510 mode\n"); | 110 | printk(KERN_ERR "DMA mirror is not supported in 1510 mode\n"); |
111 | BUG(); | 111 | BUG(); |
112 | } | 112 | } |
@@ -116,7 +116,7 @@ EXPORT_SYMBOL(omap_set_lcd_dma_b1_mirror); | |||
116 | 116 | ||
117 | void omap_set_lcd_dma_b1_vxres(unsigned long vxres) | 117 | void omap_set_lcd_dma_b1_vxres(unsigned long vxres) |
118 | { | 118 | { |
119 | if (cpu_is_omap1510()) { | 119 | if (cpu_is_omap15xx()) { |
120 | printk(KERN_ERR "DMA virtual resulotion is not supported " | 120 | printk(KERN_ERR "DMA virtual resulotion is not supported " |
121 | "in 1510 mode\n"); | 121 | "in 1510 mode\n"); |
122 | BUG(); | 122 | BUG(); |
@@ -127,7 +127,7 @@ EXPORT_SYMBOL(omap_set_lcd_dma_b1_vxres); | |||
127 | 127 | ||
128 | void omap_set_lcd_dma_b1_scale(unsigned int xscale, unsigned int yscale) | 128 | void omap_set_lcd_dma_b1_scale(unsigned int xscale, unsigned int yscale) |
129 | { | 129 | { |
130 | if (cpu_is_omap1510()) { | 130 | if (cpu_is_omap15xx()) { |
131 | printk(KERN_ERR "DMA scale is not supported in 1510 mode\n"); | 131 | printk(KERN_ERR "DMA scale is not supported in 1510 mode\n"); |
132 | BUG(); | 132 | BUG(); |
133 | } | 133 | } |
@@ -177,7 +177,7 @@ static void set_b1_regs(void) | |||
177 | bottom = PIXADDR(lcd_dma.xres - 1, lcd_dma.yres - 1); | 177 | bottom = PIXADDR(lcd_dma.xres - 1, lcd_dma.yres - 1); |
178 | /* 1510 DMA requires the bottom address to be 2 more | 178 | /* 1510 DMA requires the bottom address to be 2 more |
179 | * than the actual last memory access location. */ | 179 | * than the actual last memory access location. */ |
180 | if (cpu_is_omap1510() && | 180 | if (cpu_is_omap15xx() && |
181 | lcd_dma.data_type == OMAP_DMA_DATA_TYPE_S32) | 181 | lcd_dma.data_type == OMAP_DMA_DATA_TYPE_S32) |
182 | bottom += 2; | 182 | bottom += 2; |
183 | ei = PIXSTEP(0, 0, 1, 0); | 183 | ei = PIXSTEP(0, 0, 1, 0); |
@@ -241,7 +241,7 @@ static void set_b1_regs(void) | |||
241 | return; /* Suppress warning about uninitialized vars */ | 241 | return; /* Suppress warning about uninitialized vars */ |
242 | } | 242 | } |
243 | 243 | ||
244 | if (cpu_is_omap1510()) { | 244 | if (cpu_is_omap15xx()) { |
245 | omap_writew(top >> 16, OMAP1510_DMA_LCD_TOP_F1_U); | 245 | omap_writew(top >> 16, OMAP1510_DMA_LCD_TOP_F1_U); |
246 | omap_writew(top, OMAP1510_DMA_LCD_TOP_F1_L); | 246 | omap_writew(top, OMAP1510_DMA_LCD_TOP_F1_L); |
247 | omap_writew(bottom >> 16, OMAP1510_DMA_LCD_BOT_F1_U); | 247 | omap_writew(bottom >> 16, OMAP1510_DMA_LCD_BOT_F1_U); |
@@ -343,7 +343,7 @@ void omap_free_lcd_dma(void) | |||
343 | BUG(); | 343 | BUG(); |
344 | return; | 344 | return; |
345 | } | 345 | } |
346 | if (!cpu_is_omap1510()) | 346 | if (!cpu_is_omap15xx()) |
347 | omap_writew(omap_readw(OMAP1610_DMA_LCD_CCR) & ~1, | 347 | omap_writew(omap_readw(OMAP1610_DMA_LCD_CCR) & ~1, |
348 | OMAP1610_DMA_LCD_CCR); | 348 | OMAP1610_DMA_LCD_CCR); |
349 | lcd_dma.reserved = 0; | 349 | lcd_dma.reserved = 0; |
@@ -360,7 +360,7 @@ void omap_enable_lcd_dma(void) | |||
360 | * connected. Otherwise the OMAP internal controller will | 360 | * connected. Otherwise the OMAP internal controller will |
361 | * start the transfer when it gets enabled. | 361 | * start the transfer when it gets enabled. |
362 | */ | 362 | */ |
363 | if (cpu_is_omap1510() || !lcd_dma.ext_ctrl) | 363 | if (cpu_is_omap15xx() || !lcd_dma.ext_ctrl) |
364 | return; | 364 | return; |
365 | 365 | ||
366 | w = omap_readw(OMAP1610_DMA_LCD_CTRL); | 366 | w = omap_readw(OMAP1610_DMA_LCD_CTRL); |
@@ -378,14 +378,14 @@ EXPORT_SYMBOL(omap_enable_lcd_dma); | |||
378 | void omap_setup_lcd_dma(void) | 378 | void omap_setup_lcd_dma(void) |
379 | { | 379 | { |
380 | BUG_ON(lcd_dma.active); | 380 | BUG_ON(lcd_dma.active); |
381 | if (!cpu_is_omap1510()) { | 381 | if (!cpu_is_omap15xx()) { |
382 | /* Set some reasonable defaults */ | 382 | /* Set some reasonable defaults */ |
383 | omap_writew(0x5440, OMAP1610_DMA_LCD_CCR); | 383 | omap_writew(0x5440, OMAP1610_DMA_LCD_CCR); |
384 | omap_writew(0x9102, OMAP1610_DMA_LCD_CSDP); | 384 | omap_writew(0x9102, OMAP1610_DMA_LCD_CSDP); |
385 | omap_writew(0x0004, OMAP1610_DMA_LCD_LCH_CTRL); | 385 | omap_writew(0x0004, OMAP1610_DMA_LCD_LCH_CTRL); |
386 | } | 386 | } |
387 | set_b1_regs(); | 387 | set_b1_regs(); |
388 | if (!cpu_is_omap1510()) { | 388 | if (!cpu_is_omap15xx()) { |
389 | u16 w; | 389 | u16 w; |
390 | 390 | ||
391 | w = omap_readw(OMAP1610_DMA_LCD_CCR); | 391 | w = omap_readw(OMAP1610_DMA_LCD_CCR); |
@@ -407,7 +407,7 @@ void omap_stop_lcd_dma(void) | |||
407 | u16 w; | 407 | u16 w; |
408 | 408 | ||
409 | lcd_dma.active = 0; | 409 | lcd_dma.active = 0; |
410 | if (cpu_is_omap1510() || !lcd_dma.ext_ctrl) | 410 | if (cpu_is_omap15xx() || !lcd_dma.ext_ctrl) |
411 | return; | 411 | return; |
412 | 412 | ||
413 | w = omap_readw(OMAP1610_DMA_LCD_CCR); | 413 | w = omap_readw(OMAP1610_DMA_LCD_CCR); |
diff --git a/arch/arm/mach-omap1/time.c b/arch/arm/mach-omap1/time.c index f83fc335c613..6885d2fac183 100644 --- a/arch/arm/mach-omap1/time.c +++ b/arch/arm/mach-omap1/time.c | |||
@@ -44,7 +44,6 @@ | |||
44 | #include <linux/clocksource.h> | 44 | #include <linux/clocksource.h> |
45 | #include <linux/clockchips.h> | 45 | #include <linux/clockchips.h> |
46 | #include <linux/io.h> | 46 | #include <linux/io.h> |
47 | #include <linux/sched.h> | ||
48 | 47 | ||
49 | #include <asm/system.h> | 48 | #include <asm/system.h> |
50 | #include <mach/hardware.h> | 49 | #include <mach/hardware.h> |
diff --git a/arch/arm/mach-omap2/board-devkit8000.c b/arch/arm/mach-omap2/board-devkit8000.c index e906e05bb41b..9a2a31e011ce 100644 --- a/arch/arm/mach-omap2/board-devkit8000.c +++ b/arch/arm/mach-omap2/board-devkit8000.c | |||
@@ -115,9 +115,6 @@ static struct omap2_hsmmc_info mmc[] = { | |||
115 | 115 | ||
116 | static int devkit8000_panel_enable_lcd(struct omap_dss_device *dssdev) | 116 | static int devkit8000_panel_enable_lcd(struct omap_dss_device *dssdev) |
117 | { | 117 | { |
118 | twl_i2c_write_u8(TWL4030_MODULE_GPIO, 0x80, REG_GPIODATADIR1); | ||
119 | twl_i2c_write_u8(TWL4030_MODULE_LED, 0x0, 0x0); | ||
120 | |||
121 | if (gpio_is_valid(dssdev->reset_gpio)) | 118 | if (gpio_is_valid(dssdev->reset_gpio)) |
122 | gpio_set_value_cansleep(dssdev->reset_gpio, 1); | 119 | gpio_set_value_cansleep(dssdev->reset_gpio, 1); |
123 | return 0; | 120 | return 0; |
@@ -247,6 +244,8 @@ static struct gpio_led gpio_leds[]; | |||
247 | static int devkit8000_twl_gpio_setup(struct device *dev, | 244 | static int devkit8000_twl_gpio_setup(struct device *dev, |
248 | unsigned gpio, unsigned ngpio) | 245 | unsigned gpio, unsigned ngpio) |
249 | { | 246 | { |
247 | int ret; | ||
248 | |||
250 | omap_mux_init_gpio(29, OMAP_PIN_INPUT); | 249 | omap_mux_init_gpio(29, OMAP_PIN_INPUT); |
251 | /* gpio + 0 is "mmc0_cd" (input/IRQ) */ | 250 | /* gpio + 0 is "mmc0_cd" (input/IRQ) */ |
252 | mmc[0].gpio_cd = gpio + 0; | 251 | mmc[0].gpio_cd = gpio + 0; |
@@ -255,17 +254,23 @@ static int devkit8000_twl_gpio_setup(struct device *dev, | |||
255 | /* TWL4030_GPIO_MAX + 1 == ledB, PMU_STAT (out, active low LED) */ | 254 | /* TWL4030_GPIO_MAX + 1 == ledB, PMU_STAT (out, active low LED) */ |
256 | gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1; | 255 | gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1; |
257 | 256 | ||
258 | /* gpio + 1 is "LCD_PWREN" (out, active high) */ | 257 | /* TWL4030_GPIO_MAX + 0 is "LCD_PWREN" (out, active high) */ |
259 | devkit8000_lcd_device.reset_gpio = gpio + 1; | 258 | devkit8000_lcd_device.reset_gpio = gpio + TWL4030_GPIO_MAX + 0; |
260 | gpio_request(devkit8000_lcd_device.reset_gpio, "LCD_PWREN"); | 259 | ret = gpio_request_one(devkit8000_lcd_device.reset_gpio, |
261 | /* Disable until needed */ | 260 | GPIOF_DIR_OUT | GPIOF_INIT_LOW, "LCD_PWREN"); |
262 | gpio_direction_output(devkit8000_lcd_device.reset_gpio, 0); | 261 | if (ret < 0) { |
262 | devkit8000_lcd_device.reset_gpio = -EINVAL; | ||
263 | printk(KERN_ERR "Failed to request GPIO for LCD_PWRN\n"); | ||
264 | } | ||
263 | 265 | ||
264 | /* gpio + 7 is "DVI_PD" (out, active low) */ | 266 | /* gpio + 7 is "DVI_PD" (out, active low) */ |
265 | devkit8000_dvi_device.reset_gpio = gpio + 7; | 267 | devkit8000_dvi_device.reset_gpio = gpio + 7; |
266 | gpio_request(devkit8000_dvi_device.reset_gpio, "DVI PowerDown"); | 268 | ret = gpio_request_one(devkit8000_dvi_device.reset_gpio, |
267 | /* Disable until needed */ | 269 | GPIOF_DIR_OUT | GPIOF_INIT_LOW, "DVI PowerDown"); |
268 | gpio_direction_output(devkit8000_dvi_device.reset_gpio, 0); | 270 | if (ret < 0) { |
271 | devkit8000_dvi_device.reset_gpio = -EINVAL; | ||
272 | printk(KERN_ERR "Failed to request GPIO for DVI PowerDown\n"); | ||
273 | } | ||
269 | 274 | ||
270 | return 0; | 275 | return 0; |
271 | } | 276 | } |
diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c index e001a048dc0c..e944025d5ef8 100644 --- a/arch/arm/mach-omap2/board-omap4panda.c +++ b/arch/arm/mach-omap2/board-omap4panda.c | |||
@@ -409,8 +409,6 @@ static void __init omap4_panda_init(void) | |||
409 | platform_add_devices(panda_devices, ARRAY_SIZE(panda_devices)); | 409 | platform_add_devices(panda_devices, ARRAY_SIZE(panda_devices)); |
410 | omap_serial_init(); | 410 | omap_serial_init(); |
411 | omap4_twl6030_hsmmc_init(mmc); | 411 | omap4_twl6030_hsmmc_init(mmc); |
412 | /* OMAP4 Panda uses internal transceiver so register nop transceiver */ | ||
413 | usb_nop_xceiv_register(); | ||
414 | omap4_ehci_init(); | 412 | omap4_ehci_init(); |
415 | usb_musb_init(&musb_board_data); | 413 | usb_musb_init(&musb_board_data); |
416 | } | 414 | } |
diff --git a/arch/arm/mach-omap2/board-rm680.c b/arch/arm/mach-omap2/board-rm680.c index cb77be7ac44f..39a71bb8a308 100644 --- a/arch/arm/mach-omap2/board-rm680.c +++ b/arch/arm/mach-omap2/board-rm680.c | |||
@@ -40,9 +40,6 @@ static struct regulator_consumer_supply rm680_vemmc_consumers[] = { | |||
40 | static struct regulator_init_data rm680_vemmc = { | 40 | static struct regulator_init_data rm680_vemmc = { |
41 | .constraints = { | 41 | .constraints = { |
42 | .name = "rm680_vemmc", | 42 | .name = "rm680_vemmc", |
43 | .min_uV = 2900000, | ||
44 | .max_uV = 2900000, | ||
45 | .apply_uV = 1, | ||
46 | .valid_modes_mask = REGULATOR_MODE_NORMAL | 43 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
47 | | REGULATOR_MODE_STANDBY, | 44 | | REGULATOR_MODE_STANDBY, |
48 | .valid_ops_mask = REGULATOR_CHANGE_STATUS | 45 | .valid_ops_mask = REGULATOR_CHANGE_STATUS |
diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c index fae49d12bc76..98148b6c36e9 100644 --- a/arch/arm/mach-omap2/mux.c +++ b/arch/arm/mach-omap2/mux.c | |||
@@ -1000,6 +1000,7 @@ int __init omap_mux_init(const char *name, u32 flags, | |||
1000 | if (!partition->base) { | 1000 | if (!partition->base) { |
1001 | pr_err("%s: Could not ioremap mux partition at 0x%08x\n", | 1001 | pr_err("%s: Could not ioremap mux partition at 0x%08x\n", |
1002 | __func__, partition->phys); | 1002 | __func__, partition->phys); |
1003 | kfree(partition); | ||
1003 | return -ENODEV; | 1004 | return -ENODEV; |
1004 | } | 1005 | } |
1005 | 1006 | ||
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c index a4aa1920a75c..2f864e4b085d 100644 --- a/arch/arm/mach-omap2/pm34xx.c +++ b/arch/arm/mach-omap2/pm34xx.c | |||
@@ -168,9 +168,10 @@ static void omap3_core_restore_context(void) | |||
168 | * once during boot sequence, but this works as we are not using secure | 168 | * once during boot sequence, but this works as we are not using secure |
169 | * services. | 169 | * services. |
170 | */ | 170 | */ |
171 | static void omap3_save_secure_ram_context(u32 target_mpu_state) | 171 | static void omap3_save_secure_ram_context(void) |
172 | { | 172 | { |
173 | u32 ret; | 173 | u32 ret; |
174 | int mpu_next_state = pwrdm_read_next_pwrst(mpu_pwrdm); | ||
174 | 175 | ||
175 | if (omap_type() != OMAP2_DEVICE_TYPE_GP) { | 176 | if (omap_type() != OMAP2_DEVICE_TYPE_GP) { |
176 | /* | 177 | /* |
@@ -181,7 +182,7 @@ static void omap3_save_secure_ram_context(u32 target_mpu_state) | |||
181 | pwrdm_set_next_pwrst(mpu_pwrdm, PWRDM_POWER_ON); | 182 | pwrdm_set_next_pwrst(mpu_pwrdm, PWRDM_POWER_ON); |
182 | ret = _omap_save_secure_sram((u32 *) | 183 | ret = _omap_save_secure_sram((u32 *) |
183 | __pa(omap3_secure_ram_storage)); | 184 | __pa(omap3_secure_ram_storage)); |
184 | pwrdm_set_next_pwrst(mpu_pwrdm, target_mpu_state); | 185 | pwrdm_set_next_pwrst(mpu_pwrdm, mpu_next_state); |
185 | /* Following is for error tracking, it should not happen */ | 186 | /* Following is for error tracking, it should not happen */ |
186 | if (ret) { | 187 | if (ret) { |
187 | printk(KERN_ERR "save_secure_sram() returns %08x\n", | 188 | printk(KERN_ERR "save_secure_sram() returns %08x\n", |
@@ -1094,7 +1095,7 @@ static int __init omap3_pm_init(void) | |||
1094 | local_fiq_disable(); | 1095 | local_fiq_disable(); |
1095 | 1096 | ||
1096 | omap_dma_global_context_save(); | 1097 | omap_dma_global_context_save(); |
1097 | omap3_save_secure_ram_context(PWRDM_POWER_ON); | 1098 | omap3_save_secure_ram_context(); |
1098 | omap_dma_global_context_restore(); | 1099 | omap_dma_global_context_restore(); |
1099 | 1100 | ||
1100 | local_irq_enable(); | 1101 | local_irq_enable(); |
diff --git a/arch/arm/mach-omap2/smartreflex.c b/arch/arm/mach-omap2/smartreflex.c index 77ecebf3fae2..c37e823266d3 100644 --- a/arch/arm/mach-omap2/smartreflex.c +++ b/arch/arm/mach-omap2/smartreflex.c | |||
@@ -780,8 +780,7 @@ static int omap_sr_autocomp_show(void *data, u64 *val) | |||
780 | struct omap_sr *sr_info = (struct omap_sr *) data; | 780 | struct omap_sr *sr_info = (struct omap_sr *) data; |
781 | 781 | ||
782 | if (!sr_info) { | 782 | if (!sr_info) { |
783 | pr_warning("%s: omap_sr struct for sr_%s not found\n", | 783 | pr_warning("%s: omap_sr struct not found\n", __func__); |
784 | __func__, sr_info->voltdm->name); | ||
785 | return -EINVAL; | 784 | return -EINVAL; |
786 | } | 785 | } |
787 | 786 | ||
@@ -795,8 +794,7 @@ static int omap_sr_autocomp_store(void *data, u64 val) | |||
795 | struct omap_sr *sr_info = (struct omap_sr *) data; | 794 | struct omap_sr *sr_info = (struct omap_sr *) data; |
796 | 795 | ||
797 | if (!sr_info) { | 796 | if (!sr_info) { |
798 | pr_warning("%s: omap_sr struct for sr_%s not found\n", | 797 | pr_warning("%s: omap_sr struct not found\n", __func__); |
799 | __func__, sr_info->voltdm->name); | ||
800 | return -EINVAL; | 798 | return -EINVAL; |
801 | } | 799 | } |
802 | 800 | ||
@@ -834,7 +832,8 @@ static int __init omap_sr_probe(struct platform_device *pdev) | |||
834 | 832 | ||
835 | if (!pdata) { | 833 | if (!pdata) { |
836 | dev_err(&pdev->dev, "%s: platform data missing\n", __func__); | 834 | dev_err(&pdev->dev, "%s: platform data missing\n", __func__); |
837 | return -EINVAL; | 835 | ret = -EINVAL; |
836 | goto err_free_devinfo; | ||
838 | } | 837 | } |
839 | 838 | ||
840 | mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 839 | mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
@@ -966,7 +965,7 @@ static int __devexit omap_sr_remove(struct platform_device *pdev) | |||
966 | } | 965 | } |
967 | 966 | ||
968 | sr_info = _sr_lookup(pdata->voltdm); | 967 | sr_info = _sr_lookup(pdata->voltdm); |
969 | if (!sr_info) { | 968 | if (IS_ERR(sr_info)) { |
970 | dev_warn(&pdev->dev, "%s: omap_sr struct not found\n", | 969 | dev_warn(&pdev->dev, "%s: omap_sr struct not found\n", |
971 | __func__); | 970 | __func__); |
972 | return -EINVAL; | 971 | return -EINVAL; |
diff --git a/arch/arm/mach-omap2/voltage.c b/arch/arm/mach-omap2/voltage.c index ed6079c94c57..12be525b8df4 100644 --- a/arch/arm/mach-omap2/voltage.c +++ b/arch/arm/mach-omap2/voltage.c | |||
@@ -471,6 +471,7 @@ static void __init vdd_debugfs_init(struct omap_vdd_info *vdd) | |||
471 | strcat(name, vdd->voltdm.name); | 471 | strcat(name, vdd->voltdm.name); |
472 | 472 | ||
473 | vdd->debug_dir = debugfs_create_dir(name, voltage_dir); | 473 | vdd->debug_dir = debugfs_create_dir(name, voltage_dir); |
474 | kfree(name); | ||
474 | if (IS_ERR(vdd->debug_dir)) { | 475 | if (IS_ERR(vdd->debug_dir)) { |
475 | pr_warning("%s: Unable to create debugfs directory for" | 476 | pr_warning("%s: Unable to create debugfs directory for" |
476 | " vdd_%s\n", __func__, vdd->voltdm.name); | 477 | " vdd_%s\n", __func__, vdd->voltdm.name); |
diff --git a/arch/arm/plat-mxc/include/mach/uncompress.h b/arch/arm/plat-mxc/include/mach/uncompress.h index 3a70ebf0477f..ff469c4f1d76 100644 --- a/arch/arm/plat-mxc/include/mach/uncompress.h +++ b/arch/arm/plat-mxc/include/mach/uncompress.h | |||
@@ -95,6 +95,7 @@ static __inline__ void __arch_decomp_setup(unsigned long arch_id) | |||
95 | case MACH_TYPE_MX35_3DS: | 95 | case MACH_TYPE_MX35_3DS: |
96 | case MACH_TYPE_PCM043: | 96 | case MACH_TYPE_PCM043: |
97 | case MACH_TYPE_LILLY1131: | 97 | case MACH_TYPE_LILLY1131: |
98 | case MACH_TYPE_VPR200: | ||
98 | uart_base = MX3X_UART1_BASE_ADDR; | 99 | uart_base = MX3X_UART1_BASE_ADDR; |
99 | break; | 100 | break; |
100 | case MACH_TYPE_MAGX_ZN5: | 101 | case MACH_TYPE_MAGX_ZN5: |
@@ -102,6 +103,7 @@ static __inline__ void __arch_decomp_setup(unsigned long arch_id) | |||
102 | break; | 103 | break; |
103 | case MACH_TYPE_MX51_BABBAGE: | 104 | case MACH_TYPE_MX51_BABBAGE: |
104 | case MACH_TYPE_EUKREA_CPUIMX51SD: | 105 | case MACH_TYPE_EUKREA_CPUIMX51SD: |
106 | case MACH_TYPE_MX51_3DS: | ||
105 | uart_base = MX51_UART1_BASE_ADDR; | 107 | uart_base = MX51_UART1_BASE_ADDR; |
106 | break; | 108 | break; |
107 | case MACH_TYPE_MX50_RDP: | 109 | case MACH_TYPE_MX50_RDP: |
diff --git a/arch/arm/tools/mach-types b/arch/arm/tools/mach-types index 2fea897ebeb1..9d6feaabbe7d 100644 --- a/arch/arm/tools/mach-types +++ b/arch/arm/tools/mach-types | |||
@@ -12,7 +12,7 @@ | |||
12 | # | 12 | # |
13 | # http://www.arm.linux.org.uk/developer/machines/?action=new | 13 | # http://www.arm.linux.org.uk/developer/machines/?action=new |
14 | # | 14 | # |
15 | # Last update: Sun Dec 12 23:24:27 2010 | 15 | # Last update: Mon Feb 7 08:59:27 2011 |
16 | # | 16 | # |
17 | # machine_is_xxx CONFIG_xxxx MACH_TYPE_xxx number | 17 | # machine_is_xxx CONFIG_xxxx MACH_TYPE_xxx number |
18 | # | 18 | # |
@@ -2240,7 +2240,7 @@ arm_ultimator2 MACH_ARM_ULTIMATOR2 ARM_ULTIMATOR2 2250 | |||
2240 | vs_v210 MACH_VS_V210 VS_V210 2252 | 2240 | vs_v210 MACH_VS_V210 VS_V210 2252 |
2241 | vs_v212 MACH_VS_V212 VS_V212 2253 | 2241 | vs_v212 MACH_VS_V212 VS_V212 2253 |
2242 | hmt MACH_HMT HMT 2254 | 2242 | hmt MACH_HMT HMT 2254 |
2243 | suen3 MACH_SUEN3 SUEN3 2255 | 2243 | km_kirkwood MACH_KM_KIRKWOOD KM_KIRKWOOD 2255 |
2244 | vesper MACH_VESPER VESPER 2256 | 2244 | vesper MACH_VESPER VESPER 2256 |
2245 | str9 MACH_STR9 STR9 2257 | 2245 | str9 MACH_STR9 STR9 2257 |
2246 | omap3_wl_ff MACH_OMAP3_WL_FF OMAP3_WL_FF 2258 | 2246 | omap3_wl_ff MACH_OMAP3_WL_FF OMAP3_WL_FF 2258 |
@@ -2987,7 +2987,7 @@ pxwnas_500_1000 MACH_PXWNAS_500_1000 PXWNAS_500_1000 3001 | |||
2987 | ea20 MACH_EA20 EA20 3002 | 2987 | ea20 MACH_EA20 EA20 3002 |
2988 | awm2 MACH_AWM2 AWM2 3003 | 2988 | awm2 MACH_AWM2 AWM2 3003 |
2989 | ti8148evm MACH_TI8148EVM TI8148EVM 3004 | 2989 | ti8148evm MACH_TI8148EVM TI8148EVM 3004 |
2990 | tegra_seaboard MACH_TEGRA_SEABOARD TEGRA_SEABOARD 3005 | 2990 | seaboard MACH_SEABOARD SEABOARD 3005 |
2991 | linkstation_chlv2 MACH_LINKSTATION_CHLV2 LINKSTATION_CHLV2 3006 | 2991 | linkstation_chlv2 MACH_LINKSTATION_CHLV2 LINKSTATION_CHLV2 3006 |
2992 | tera_pro2_rack MACH_TERA_PRO2_RACK TERA_PRO2_RACK 3007 | 2992 | tera_pro2_rack MACH_TERA_PRO2_RACK TERA_PRO2_RACK 3007 |
2993 | rubys MACH_RUBYS RUBYS 3008 | 2993 | rubys MACH_RUBYS RUBYS 3008 |
@@ -3190,7 +3190,7 @@ synergy MACH_SYNERGY SYNERGY 3205 | |||
3190 | ics_if_voip MACH_ICS_IF_VOIP ICS_IF_VOIP 3206 | 3190 | ics_if_voip MACH_ICS_IF_VOIP ICS_IF_VOIP 3206 |
3191 | wlf_cragg_6410 MACH_WLF_CRAGG_6410 WLF_CRAGG_6410 3207 | 3191 | wlf_cragg_6410 MACH_WLF_CRAGG_6410 WLF_CRAGG_6410 3207 |
3192 | punica MACH_PUNICA PUNICA 3208 | 3192 | punica MACH_PUNICA PUNICA 3208 |
3193 | sbc_nt250 MACH_SBC_NT250 SBC_NT250 3209 | 3193 | trimslice MACH_TRIMSLICE TRIMSLICE 3209 |
3194 | mx27_wmultra MACH_MX27_WMULTRA MX27_WMULTRA 3210 | 3194 | mx27_wmultra MACH_MX27_WMULTRA MX27_WMULTRA 3210 |
3195 | mackerel MACH_MACKEREL MACKEREL 3211 | 3195 | mackerel MACH_MACKEREL MACKEREL 3211 |
3196 | fa9x27 MACH_FA9X27 FA9X27 3213 | 3196 | fa9x27 MACH_FA9X27 FA9X27 3213 |
@@ -3219,3 +3219,100 @@ pivicc MACH_PIVICC PIVICC 3235 | |||
3219 | pcm048 MACH_PCM048 PCM048 3236 | 3219 | pcm048 MACH_PCM048 PCM048 3236 |
3220 | dds MACH_DDS DDS 3237 | 3220 | dds MACH_DDS DDS 3237 |
3221 | chalten_xa1 MACH_CHALTEN_XA1 CHALTEN_XA1 3238 | 3221 | chalten_xa1 MACH_CHALTEN_XA1 CHALTEN_XA1 3238 |
3222 | ts48xx MACH_TS48XX TS48XX 3239 | ||
3223 | tonga2_tfttimer MACH_TONGA2_TFTTIMER TONGA2_TFTTIMER 3240 | ||
3224 | whistler MACH_WHISTLER WHISTLER 3241 | ||
3225 | asl_phoenix MACH_ASL_PHOENIX ASL_PHOENIX 3242 | ||
3226 | at91sam9263otlite MACH_AT91SAM9263OTLITE AT91SAM9263OTLITE 3243 | ||
3227 | ddplug MACH_DDPLUG DDPLUG 3244 | ||
3228 | d2plug MACH_D2PLUG D2PLUG 3245 | ||
3229 | kzm9d MACH_KZM9D KZM9D 3246 | ||
3230 | verdi_lte MACH_VERDI_LTE VERDI_LTE 3247 | ||
3231 | nanozoom MACH_NANOZOOM NANOZOOM 3248 | ||
3232 | dm3730_som_lv MACH_DM3730_SOM_LV DM3730_SOM_LV 3249 | ||
3233 | dm3730_torpedo MACH_DM3730_TORPEDO DM3730_TORPEDO 3250 | ||
3234 | anchovy MACH_ANCHOVY ANCHOVY 3251 | ||
3235 | re2rev20 MACH_RE2REV20 RE2REV20 3253 | ||
3236 | re2rev21 MACH_RE2REV21 RE2REV21 3254 | ||
3237 | cns21xx MACH_CNS21XX CNS21XX 3255 | ||
3238 | rider MACH_RIDER RIDER 3257 | ||
3239 | nsk330 MACH_NSK330 NSK330 3258 | ||
3240 | cns2133evb MACH_CNS2133EVB CNS2133EVB 3259 | ||
3241 | z3_816x_mod MACH_Z3_816X_MOD Z3_816X_MOD 3260 | ||
3242 | z3_814x_mod MACH_Z3_814X_MOD Z3_814X_MOD 3261 | ||
3243 | beect MACH_BEECT BEECT 3262 | ||
3244 | dma_thunderbug MACH_DMA_THUNDERBUG DMA_THUNDERBUG 3263 | ||
3245 | omn_at91sam9g20 MACH_OMN_AT91SAM9G20 OMN_AT91SAM9G20 3264 | ||
3246 | mx25_e2s_uc MACH_MX25_E2S_UC MX25_E2S_UC 3265 | ||
3247 | mione MACH_MIONE MIONE 3266 | ||
3248 | top9000_tcu MACH_TOP9000_TCU TOP9000_TCU 3267 | ||
3249 | top9000_bsl MACH_TOP9000_BSL TOP9000_BSL 3268 | ||
3250 | kingdom MACH_KINGDOM KINGDOM 3269 | ||
3251 | armadillo460 MACH_ARMADILLO460 ARMADILLO460 3270 | ||
3252 | lq2 MACH_LQ2 LQ2 3271 | ||
3253 | sweda_tms2 MACH_SWEDA_TMS2 SWEDA_TMS2 3272 | ||
3254 | mx53_loco MACH_MX53_LOCO MX53_LOCO 3273 | ||
3255 | acer_a8 MACH_ACER_A8 ACER_A8 3275 | ||
3256 | acer_gauguin MACH_ACER_GAUGUIN ACER_GAUGUIN 3276 | ||
3257 | guppy MACH_GUPPY GUPPY 3277 | ||
3258 | mx61_ard MACH_MX61_ARD MX61_ARD 3278 | ||
3259 | tx53 MACH_TX53 TX53 3279 | ||
3260 | omapl138_case_a3 MACH_OMAPL138_CASE_A3 OMAPL138_CASE_A3 3280 | ||
3261 | uemd MACH_UEMD UEMD 3281 | ||
3262 | ccwmx51mut MACH_CCWMX51MUT CCWMX51MUT 3282 | ||
3263 | rockhopper MACH_ROCKHOPPER ROCKHOPPER 3283 | ||
3264 | nookcolor MACH_NOOKCOLOR NOOKCOLOR 3284 | ||
3265 | hkdkc100 MACH_HKDKC100 HKDKC100 3285 | ||
3266 | ts42xx MACH_TS42XX TS42XX 3286 | ||
3267 | aebl MACH_AEBL AEBL 3287 | ||
3268 | wario MACH_WARIO WARIO 3288 | ||
3269 | gfs_spm MACH_GFS_SPM GFS_SPM 3289 | ||
3270 | cm_t3730 MACH_CM_T3730 CM_T3730 3290 | ||
3271 | isc3 MACH_ISC3 ISC3 3291 | ||
3272 | rascal MACH_RASCAL RASCAL 3292 | ||
3273 | hrefv60 MACH_HREFV60 HREFV60 3293 | ||
3274 | tpt_2_0 MACH_TPT_2_0 TPT_2_0 3294 | ||
3275 | pyramid_td MACH_PYRAMID_TD PYRAMID_TD 3295 | ||
3276 | splendor MACH_SPLENDOR SPLENDOR 3296 | ||
3277 | guf_planet MACH_GUF_PLANET GUF_PLANET 3297 | ||
3278 | msm8x60_qt MACH_MSM8X60_QT MSM8X60_QT 3298 | ||
3279 | htc_hd_mini MACH_HTC_HD_MINI HTC_HD_MINI 3299 | ||
3280 | athene MACH_ATHENE ATHENE 3300 | ||
3281 | deep_r_ek_1 MACH_DEEP_R_EK_1 DEEP_R_EK_1 3301 | ||
3282 | vivow_ct MACH_VIVOW_CT VIVOW_CT 3302 | ||
3283 | nery_1000 MACH_NERY_1000 NERY_1000 3303 | ||
3284 | rfl109145_ssrv MACH_RFL109145_SSRV RFL109145_SSRV 3304 | ||
3285 | nmh MACH_NMH NMH 3305 | ||
3286 | wn802t MACH_WN802T WN802T 3306 | ||
3287 | dragonet MACH_DRAGONET DRAGONET 3307 | ||
3288 | geneva_b MACH_GENEVA_B GENEVA_B 3308 | ||
3289 | at91sam9263desk16l MACH_AT91SAM9263DESK16L AT91SAM9263DESK16L 3309 | ||
3290 | bcmhana_sv MACH_BCMHANA_SV BCMHANA_SV 3310 | ||
3291 | bcmhana_tablet MACH_BCMHANA_TABLET BCMHANA_TABLET 3311 | ||
3292 | koi MACH_KOI KOI 3312 | ||
3293 | ts4800 MACH_TS4800 TS4800 3313 | ||
3294 | tqma9263 MACH_TQMA9263 TQMA9263 3314 | ||
3295 | holiday MACH_HOLIDAY HOLIDAY 3315 | ||
3296 | dma_6410 MACH_DMA6410 DMA6410 3316 | ||
3297 | pcats_overlay MACH_PCATS_OVERLAY PCATS_OVERLAY 3317 | ||
3298 | hwgw6410 MACH_HWGW6410 HWGW6410 3318 | ||
3299 | shenzhou MACH_SHENZHOU SHENZHOU 3319 | ||
3300 | cwme9210 MACH_CWME9210 CWME9210 3320 | ||
3301 | cwme9210js MACH_CWME9210JS CWME9210JS 3321 | ||
3302 | pgs_v1 MACH_PGS_SITARA PGS_SITARA 3322 | ||
3303 | colibri_tegra2 MACH_COLIBRI_TEGRA2 COLIBRI_TEGRA2 3323 | ||
3304 | w21 MACH_W21 W21 3324 | ||
3305 | polysat1 MACH_POLYSAT1 POLYSAT1 3325 | ||
3306 | dataway MACH_DATAWAY DATAWAY 3326 | ||
3307 | cobral138 MACH_COBRAL138 COBRAL138 3327 | ||
3308 | roverpcs8 MACH_ROVERPCS8 ROVERPCS8 3328 | ||
3309 | marvelc MACH_MARVELC MARVELC 3329 | ||
3310 | navefihid MACH_NAVEFIHID NAVEFIHID 3330 | ||
3311 | dm365_cv100 MACH_DM365_CV100 DM365_CV100 3331 | ||
3312 | able MACH_ABLE ABLE 3332 | ||
3313 | legacy MACH_LEGACY LEGACY 3333 | ||
3314 | icong MACH_ICONG ICONG 3334 | ||
3315 | rover_g8 MACH_ROVER_G8 ROVER_G8 3335 | ||
3316 | t5388p MACH_T5388P T5388P 3336 | ||
3317 | dingo MACH_DINGO DINGO 3337 | ||
3318 | goflexhome MACH_GOFLEXHOME GOFLEXHOME 3338 | ||
diff --git a/arch/powerpc/include/asm/mmu-book3e.h b/arch/powerpc/include/asm/mmu-book3e.h index 8eaed81ea642..17194fcd4040 100644 --- a/arch/powerpc/include/asm/mmu-book3e.h +++ b/arch/powerpc/include/asm/mmu-book3e.h | |||
@@ -40,8 +40,8 @@ | |||
40 | 40 | ||
41 | /* MAS registers bit definitions */ | 41 | /* MAS registers bit definitions */ |
42 | 42 | ||
43 | #define MAS0_TLBSEL(x) ((x << 28) & 0x30000000) | 43 | #define MAS0_TLBSEL(x) (((x) << 28) & 0x30000000) |
44 | #define MAS0_ESEL(x) ((x << 16) & 0x0FFF0000) | 44 | #define MAS0_ESEL(x) (((x) << 16) & 0x0FFF0000) |
45 | #define MAS0_NV(x) ((x) & 0x00000FFF) | 45 | #define MAS0_NV(x) ((x) & 0x00000FFF) |
46 | #define MAS0_HES 0x00004000 | 46 | #define MAS0_HES 0x00004000 |
47 | #define MAS0_WQ_ALLWAYS 0x00000000 | 47 | #define MAS0_WQ_ALLWAYS 0x00000000 |
@@ -50,12 +50,12 @@ | |||
50 | 50 | ||
51 | #define MAS1_VALID 0x80000000 | 51 | #define MAS1_VALID 0x80000000 |
52 | #define MAS1_IPROT 0x40000000 | 52 | #define MAS1_IPROT 0x40000000 |
53 | #define MAS1_TID(x) ((x << 16) & 0x3FFF0000) | 53 | #define MAS1_TID(x) (((x) << 16) & 0x3FFF0000) |
54 | #define MAS1_IND 0x00002000 | 54 | #define MAS1_IND 0x00002000 |
55 | #define MAS1_TS 0x00001000 | 55 | #define MAS1_TS 0x00001000 |
56 | #define MAS1_TSIZE_MASK 0x00000f80 | 56 | #define MAS1_TSIZE_MASK 0x00000f80 |
57 | #define MAS1_TSIZE_SHIFT 7 | 57 | #define MAS1_TSIZE_SHIFT 7 |
58 | #define MAS1_TSIZE(x) ((x << MAS1_TSIZE_SHIFT) & MAS1_TSIZE_MASK) | 58 | #define MAS1_TSIZE(x) (((x) << MAS1_TSIZE_SHIFT) & MAS1_TSIZE_MASK) |
59 | 59 | ||
60 | #define MAS2_EPN 0xFFFFF000 | 60 | #define MAS2_EPN 0xFFFFF000 |
61 | #define MAS2_X0 0x00000040 | 61 | #define MAS2_X0 0x00000040 |
diff --git a/arch/powerpc/include/asm/page.h b/arch/powerpc/include/asm/page.h index 53b64be40eb2..da4b20008541 100644 --- a/arch/powerpc/include/asm/page.h +++ b/arch/powerpc/include/asm/page.h | |||
@@ -101,7 +101,7 @@ extern phys_addr_t kernstart_addr; | |||
101 | 101 | ||
102 | #ifdef CONFIG_FLATMEM | 102 | #ifdef CONFIG_FLATMEM |
103 | #define ARCH_PFN_OFFSET (MEMORY_START >> PAGE_SHIFT) | 103 | #define ARCH_PFN_OFFSET (MEMORY_START >> PAGE_SHIFT) |
104 | #define pfn_valid(pfn) ((pfn) >= ARCH_PFN_OFFSET && (pfn) < (ARCH_PFN_OFFSET + max_mapnr)) | 104 | #define pfn_valid(pfn) ((pfn) >= ARCH_PFN_OFFSET && (pfn) < max_mapnr) |
105 | #endif | 105 | #endif |
106 | 106 | ||
107 | #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) | 107 | #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) |
diff --git a/arch/powerpc/kernel/cpu_setup_6xx.S b/arch/powerpc/kernel/cpu_setup_6xx.S index 55cba4a8a959..f8cd9fba4d35 100644 --- a/arch/powerpc/kernel/cpu_setup_6xx.S +++ b/arch/powerpc/kernel/cpu_setup_6xx.S | |||
@@ -18,7 +18,7 @@ | |||
18 | #include <asm/mmu.h> | 18 | #include <asm/mmu.h> |
19 | 19 | ||
20 | _GLOBAL(__setup_cpu_603) | 20 | _GLOBAL(__setup_cpu_603) |
21 | mflr r4 | 21 | mflr r5 |
22 | BEGIN_MMU_FTR_SECTION | 22 | BEGIN_MMU_FTR_SECTION |
23 | li r10,0 | 23 | li r10,0 |
24 | mtspr SPRN_SPRG_603_LRU,r10 /* init SW LRU tracking */ | 24 | mtspr SPRN_SPRG_603_LRU,r10 /* init SW LRU tracking */ |
@@ -27,60 +27,60 @@ BEGIN_FTR_SECTION | |||
27 | bl __init_fpu_registers | 27 | bl __init_fpu_registers |
28 | END_FTR_SECTION_IFCLR(CPU_FTR_FPU_UNAVAILABLE) | 28 | END_FTR_SECTION_IFCLR(CPU_FTR_FPU_UNAVAILABLE) |
29 | bl setup_common_caches | 29 | bl setup_common_caches |
30 | mtlr r4 | 30 | mtlr r5 |
31 | blr | 31 | blr |
32 | _GLOBAL(__setup_cpu_604) | 32 | _GLOBAL(__setup_cpu_604) |
33 | mflr r4 | 33 | mflr r5 |
34 | bl setup_common_caches | 34 | bl setup_common_caches |
35 | bl setup_604_hid0 | 35 | bl setup_604_hid0 |
36 | mtlr r4 | 36 | mtlr r5 |
37 | blr | 37 | blr |
38 | _GLOBAL(__setup_cpu_750) | 38 | _GLOBAL(__setup_cpu_750) |
39 | mflr r4 | 39 | mflr r5 |
40 | bl __init_fpu_registers | 40 | bl __init_fpu_registers |
41 | bl setup_common_caches | 41 | bl setup_common_caches |
42 | bl setup_750_7400_hid0 | 42 | bl setup_750_7400_hid0 |
43 | mtlr r4 | 43 | mtlr r5 |
44 | blr | 44 | blr |
45 | _GLOBAL(__setup_cpu_750cx) | 45 | _GLOBAL(__setup_cpu_750cx) |
46 | mflr r4 | 46 | mflr r5 |
47 | bl __init_fpu_registers | 47 | bl __init_fpu_registers |
48 | bl setup_common_caches | 48 | bl setup_common_caches |
49 | bl setup_750_7400_hid0 | 49 | bl setup_750_7400_hid0 |
50 | bl setup_750cx | 50 | bl setup_750cx |
51 | mtlr r4 | 51 | mtlr r5 |
52 | blr | 52 | blr |
53 | _GLOBAL(__setup_cpu_750fx) | 53 | _GLOBAL(__setup_cpu_750fx) |
54 | mflr r4 | 54 | mflr r5 |
55 | bl __init_fpu_registers | 55 | bl __init_fpu_registers |
56 | bl setup_common_caches | 56 | bl setup_common_caches |
57 | bl setup_750_7400_hid0 | 57 | bl setup_750_7400_hid0 |
58 | bl setup_750fx | 58 | bl setup_750fx |
59 | mtlr r4 | 59 | mtlr r5 |
60 | blr | 60 | blr |
61 | _GLOBAL(__setup_cpu_7400) | 61 | _GLOBAL(__setup_cpu_7400) |
62 | mflr r4 | 62 | mflr r5 |
63 | bl __init_fpu_registers | 63 | bl __init_fpu_registers |
64 | bl setup_7400_workarounds | 64 | bl setup_7400_workarounds |
65 | bl setup_common_caches | 65 | bl setup_common_caches |
66 | bl setup_750_7400_hid0 | 66 | bl setup_750_7400_hid0 |
67 | mtlr r4 | 67 | mtlr r5 |
68 | blr | 68 | blr |
69 | _GLOBAL(__setup_cpu_7410) | 69 | _GLOBAL(__setup_cpu_7410) |
70 | mflr r4 | 70 | mflr r5 |
71 | bl __init_fpu_registers | 71 | bl __init_fpu_registers |
72 | bl setup_7410_workarounds | 72 | bl setup_7410_workarounds |
73 | bl setup_common_caches | 73 | bl setup_common_caches |
74 | bl setup_750_7400_hid0 | 74 | bl setup_750_7400_hid0 |
75 | li r3,0 | 75 | li r3,0 |
76 | mtspr SPRN_L2CR2,r3 | 76 | mtspr SPRN_L2CR2,r3 |
77 | mtlr r4 | 77 | mtlr r5 |
78 | blr | 78 | blr |
79 | _GLOBAL(__setup_cpu_745x) | 79 | _GLOBAL(__setup_cpu_745x) |
80 | mflr r4 | 80 | mflr r5 |
81 | bl setup_common_caches | 81 | bl setup_common_caches |
82 | bl setup_745x_specifics | 82 | bl setup_745x_specifics |
83 | mtlr r4 | 83 | mtlr r5 |
84 | blr | 84 | blr |
85 | 85 | ||
86 | /* Enable caches for 603's, 604, 750 & 7400 */ | 86 | /* Enable caches for 603's, 604, 750 & 7400 */ |
@@ -194,10 +194,10 @@ setup_750cx: | |||
194 | cror 4*cr0+eq,4*cr0+eq,4*cr1+eq | 194 | cror 4*cr0+eq,4*cr0+eq,4*cr1+eq |
195 | cror 4*cr0+eq,4*cr0+eq,4*cr2+eq | 195 | cror 4*cr0+eq,4*cr0+eq,4*cr2+eq |
196 | bnelr | 196 | bnelr |
197 | lwz r6,CPU_SPEC_FEATURES(r5) | 197 | lwz r6,CPU_SPEC_FEATURES(r4) |
198 | li r7,CPU_FTR_CAN_NAP | 198 | li r7,CPU_FTR_CAN_NAP |
199 | andc r6,r6,r7 | 199 | andc r6,r6,r7 |
200 | stw r6,CPU_SPEC_FEATURES(r5) | 200 | stw r6,CPU_SPEC_FEATURES(r4) |
201 | blr | 201 | blr |
202 | 202 | ||
203 | /* 750fx specific | 203 | /* 750fx specific |
@@ -225,12 +225,12 @@ BEGIN_FTR_SECTION | |||
225 | andis. r11,r11,L3CR_L3E@h | 225 | andis. r11,r11,L3CR_L3E@h |
226 | beq 1f | 226 | beq 1f |
227 | END_FTR_SECTION_IFSET(CPU_FTR_L3CR) | 227 | END_FTR_SECTION_IFSET(CPU_FTR_L3CR) |
228 | lwz r6,CPU_SPEC_FEATURES(r5) | 228 | lwz r6,CPU_SPEC_FEATURES(r4) |
229 | andi. r0,r6,CPU_FTR_L3_DISABLE_NAP | 229 | andi. r0,r6,CPU_FTR_L3_DISABLE_NAP |
230 | beq 1f | 230 | beq 1f |
231 | li r7,CPU_FTR_CAN_NAP | 231 | li r7,CPU_FTR_CAN_NAP |
232 | andc r6,r6,r7 | 232 | andc r6,r6,r7 |
233 | stw r6,CPU_SPEC_FEATURES(r5) | 233 | stw r6,CPU_SPEC_FEATURES(r4) |
234 | 1: | 234 | 1: |
235 | mfspr r11,SPRN_HID0 | 235 | mfspr r11,SPRN_HID0 |
236 | 236 | ||
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c index 8d74a24c5502..e8e915ce3d8d 100644 --- a/arch/powerpc/kernel/cputable.c +++ b/arch/powerpc/kernel/cputable.c | |||
@@ -2076,8 +2076,8 @@ static void __init setup_cpu_spec(unsigned long offset, struct cpu_spec *s) | |||
2076 | * pointer on ppc64 and booke as we are running at 0 in real mode | 2076 | * pointer on ppc64 and booke as we are running at 0 in real mode |
2077 | * on ppc64 and reloc_offset is always 0 on booke. | 2077 | * on ppc64 and reloc_offset is always 0 on booke. |
2078 | */ | 2078 | */ |
2079 | if (s->cpu_setup) { | 2079 | if (t->cpu_setup) { |
2080 | s->cpu_setup(offset, s); | 2080 | t->cpu_setup(offset, t); |
2081 | } | 2081 | } |
2082 | #endif /* CONFIG_PPC64 || CONFIG_BOOKE */ | 2082 | #endif /* CONFIG_PPC64 || CONFIG_BOOKE */ |
2083 | } | 2083 | } |
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c index bf5cb91f07de..fd4812329570 100644 --- a/arch/powerpc/mm/numa.c +++ b/arch/powerpc/mm/numa.c | |||
@@ -186,7 +186,7 @@ static void unmap_cpu_from_node(unsigned long cpu) | |||
186 | dbg("removing cpu %lu from node %d\n", cpu, node); | 186 | dbg("removing cpu %lu from node %d\n", cpu, node); |
187 | 187 | ||
188 | if (cpumask_test_cpu(cpu, node_to_cpumask_map[node])) { | 188 | if (cpumask_test_cpu(cpu, node_to_cpumask_map[node])) { |
189 | cpumask_set_cpu(cpu, node_to_cpumask_map[node]); | 189 | cpumask_clear_cpu(cpu, node_to_cpumask_map[node]); |
190 | } else { | 190 | } else { |
191 | printk(KERN_ERR "WARNING: cpu %lu not found in node %d\n", | 191 | printk(KERN_ERR "WARNING: cpu %lu not found in node %d\n", |
192 | cpu, node); | 192 | cpu, node); |
@@ -1289,10 +1289,9 @@ u64 memory_hotplug_max(void) | |||
1289 | } | 1289 | } |
1290 | #endif /* CONFIG_MEMORY_HOTPLUG */ | 1290 | #endif /* CONFIG_MEMORY_HOTPLUG */ |
1291 | 1291 | ||
1292 | /* Vrtual Processor Home Node (VPHN) support */ | 1292 | /* Virtual Processor Home Node (VPHN) support */ |
1293 | #ifdef CONFIG_PPC_SPLPAR | 1293 | #ifdef CONFIG_PPC_SPLPAR |
1294 | #define VPHN_NR_CHANGE_CTRS (8) | 1294 | static u8 vphn_cpu_change_counts[NR_CPUS][MAX_DISTANCE_REF_POINTS]; |
1295 | static u8 vphn_cpu_change_counts[NR_CPUS][VPHN_NR_CHANGE_CTRS]; | ||
1296 | static cpumask_t cpu_associativity_changes_mask; | 1295 | static cpumask_t cpu_associativity_changes_mask; |
1297 | static int vphn_enabled; | 1296 | static int vphn_enabled; |
1298 | static void set_topology_timer(void); | 1297 | static void set_topology_timer(void); |
@@ -1303,16 +1302,18 @@ static void set_topology_timer(void); | |||
1303 | */ | 1302 | */ |
1304 | static void setup_cpu_associativity_change_counters(void) | 1303 | static void setup_cpu_associativity_change_counters(void) |
1305 | { | 1304 | { |
1306 | int cpu = 0; | 1305 | int cpu; |
1306 | |||
1307 | /* The VPHN feature supports a maximum of 8 reference points */ | ||
1308 | BUILD_BUG_ON(MAX_DISTANCE_REF_POINTS > 8); | ||
1307 | 1309 | ||
1308 | for_each_possible_cpu(cpu) { | 1310 | for_each_possible_cpu(cpu) { |
1309 | int i = 0; | 1311 | int i; |
1310 | u8 *counts = vphn_cpu_change_counts[cpu]; | 1312 | u8 *counts = vphn_cpu_change_counts[cpu]; |
1311 | volatile u8 *hypervisor_counts = lppaca[cpu].vphn_assoc_counts; | 1313 | volatile u8 *hypervisor_counts = lppaca[cpu].vphn_assoc_counts; |
1312 | 1314 | ||
1313 | for (i = 0; i < VPHN_NR_CHANGE_CTRS; i++) { | 1315 | for (i = 0; i < distance_ref_points_depth; i++) |
1314 | counts[i] = hypervisor_counts[i]; | 1316 | counts[i] = hypervisor_counts[i]; |
1315 | } | ||
1316 | } | 1317 | } |
1317 | } | 1318 | } |
1318 | 1319 | ||
@@ -1329,7 +1330,7 @@ static void setup_cpu_associativity_change_counters(void) | |||
1329 | */ | 1330 | */ |
1330 | static int update_cpu_associativity_changes_mask(void) | 1331 | static int update_cpu_associativity_changes_mask(void) |
1331 | { | 1332 | { |
1332 | int cpu = 0, nr_cpus = 0; | 1333 | int cpu, nr_cpus = 0; |
1333 | cpumask_t *changes = &cpu_associativity_changes_mask; | 1334 | cpumask_t *changes = &cpu_associativity_changes_mask; |
1334 | 1335 | ||
1335 | cpumask_clear(changes); | 1336 | cpumask_clear(changes); |
@@ -1339,8 +1340,8 @@ static int update_cpu_associativity_changes_mask(void) | |||
1339 | u8 *counts = vphn_cpu_change_counts[cpu]; | 1340 | u8 *counts = vphn_cpu_change_counts[cpu]; |
1340 | volatile u8 *hypervisor_counts = lppaca[cpu].vphn_assoc_counts; | 1341 | volatile u8 *hypervisor_counts = lppaca[cpu].vphn_assoc_counts; |
1341 | 1342 | ||
1342 | for (i = 0; i < VPHN_NR_CHANGE_CTRS; i++) { | 1343 | for (i = 0; i < distance_ref_points_depth; i++) { |
1343 | if (hypervisor_counts[i] > counts[i]) { | 1344 | if (hypervisor_counts[i] != counts[i]) { |
1344 | counts[i] = hypervisor_counts[i]; | 1345 | counts[i] = hypervisor_counts[i]; |
1345 | changed = 1; | 1346 | changed = 1; |
1346 | } | 1347 | } |
@@ -1354,8 +1355,11 @@ static int update_cpu_associativity_changes_mask(void) | |||
1354 | return nr_cpus; | 1355 | return nr_cpus; |
1355 | } | 1356 | } |
1356 | 1357 | ||
1357 | /* 6 64-bit registers unpacked into 12 32-bit associativity values */ | 1358 | /* |
1358 | #define VPHN_ASSOC_BUFSIZE (6*sizeof(u64)/sizeof(u32)) | 1359 | * 6 64-bit registers unpacked into 12 32-bit associativity values. To form |
1360 | * the complete property we have to add the length in the first cell. | ||
1361 | */ | ||
1362 | #define VPHN_ASSOC_BUFSIZE (6*sizeof(u64)/sizeof(u32) + 1) | ||
1359 | 1363 | ||
1360 | /* | 1364 | /* |
1361 | * Convert the associativity domain numbers returned from the hypervisor | 1365 | * Convert the associativity domain numbers returned from the hypervisor |
@@ -1363,15 +1367,14 @@ static int update_cpu_associativity_changes_mask(void) | |||
1363 | */ | 1367 | */ |
1364 | static int vphn_unpack_associativity(const long *packed, unsigned int *unpacked) | 1368 | static int vphn_unpack_associativity(const long *packed, unsigned int *unpacked) |
1365 | { | 1369 | { |
1366 | int i = 0; | 1370 | int i, nr_assoc_doms = 0; |
1367 | int nr_assoc_doms = 0; | ||
1368 | const u16 *field = (const u16*) packed; | 1371 | const u16 *field = (const u16*) packed; |
1369 | 1372 | ||
1370 | #define VPHN_FIELD_UNUSED (0xffff) | 1373 | #define VPHN_FIELD_UNUSED (0xffff) |
1371 | #define VPHN_FIELD_MSB (0x8000) | 1374 | #define VPHN_FIELD_MSB (0x8000) |
1372 | #define VPHN_FIELD_MASK (~VPHN_FIELD_MSB) | 1375 | #define VPHN_FIELD_MASK (~VPHN_FIELD_MSB) |
1373 | 1376 | ||
1374 | for (i = 0; i < VPHN_ASSOC_BUFSIZE; i++) { | 1377 | for (i = 1; i < VPHN_ASSOC_BUFSIZE; i++) { |
1375 | if (*field == VPHN_FIELD_UNUSED) { | 1378 | if (*field == VPHN_FIELD_UNUSED) { |
1376 | /* All significant fields processed, and remaining | 1379 | /* All significant fields processed, and remaining |
1377 | * fields contain the reserved value of all 1's. | 1380 | * fields contain the reserved value of all 1's. |
@@ -1379,14 +1382,12 @@ static int vphn_unpack_associativity(const long *packed, unsigned int *unpacked) | |||
1379 | */ | 1382 | */ |
1380 | unpacked[i] = *((u32*)field); | 1383 | unpacked[i] = *((u32*)field); |
1381 | field += 2; | 1384 | field += 2; |
1382 | } | 1385 | } else if (*field & VPHN_FIELD_MSB) { |
1383 | else if (*field & VPHN_FIELD_MSB) { | ||
1384 | /* Data is in the lower 15 bits of this field */ | 1386 | /* Data is in the lower 15 bits of this field */ |
1385 | unpacked[i] = *field & VPHN_FIELD_MASK; | 1387 | unpacked[i] = *field & VPHN_FIELD_MASK; |
1386 | field++; | 1388 | field++; |
1387 | nr_assoc_doms++; | 1389 | nr_assoc_doms++; |
1388 | } | 1390 | } else { |
1389 | else { | ||
1390 | /* Data is in the lower 15 bits of this field | 1391 | /* Data is in the lower 15 bits of this field |
1391 | * concatenated with the next 16 bit field | 1392 | * concatenated with the next 16 bit field |
1392 | */ | 1393 | */ |
@@ -1396,6 +1397,9 @@ static int vphn_unpack_associativity(const long *packed, unsigned int *unpacked) | |||
1396 | } | 1397 | } |
1397 | } | 1398 | } |
1398 | 1399 | ||
1400 | /* The first cell contains the length of the property */ | ||
1401 | unpacked[0] = nr_assoc_doms; | ||
1402 | |||
1399 | return nr_assoc_doms; | 1403 | return nr_assoc_doms; |
1400 | } | 1404 | } |
1401 | 1405 | ||
@@ -1405,7 +1409,7 @@ static int vphn_unpack_associativity(const long *packed, unsigned int *unpacked) | |||
1405 | */ | 1409 | */ |
1406 | static long hcall_vphn(unsigned long cpu, unsigned int *associativity) | 1410 | static long hcall_vphn(unsigned long cpu, unsigned int *associativity) |
1407 | { | 1411 | { |
1408 | long rc = 0; | 1412 | long rc; |
1409 | long retbuf[PLPAR_HCALL9_BUFSIZE] = {0}; | 1413 | long retbuf[PLPAR_HCALL9_BUFSIZE] = {0}; |
1410 | u64 flags = 1; | 1414 | u64 flags = 1; |
1411 | int hwcpu = get_hard_smp_processor_id(cpu); | 1415 | int hwcpu = get_hard_smp_processor_id(cpu); |
@@ -1419,7 +1423,7 @@ static long hcall_vphn(unsigned long cpu, unsigned int *associativity) | |||
1419 | static long vphn_get_associativity(unsigned long cpu, | 1423 | static long vphn_get_associativity(unsigned long cpu, |
1420 | unsigned int *associativity) | 1424 | unsigned int *associativity) |
1421 | { | 1425 | { |
1422 | long rc = 0; | 1426 | long rc; |
1423 | 1427 | ||
1424 | rc = hcall_vphn(cpu, associativity); | 1428 | rc = hcall_vphn(cpu, associativity); |
1425 | 1429 | ||
@@ -1445,9 +1449,9 @@ static long vphn_get_associativity(unsigned long cpu, | |||
1445 | */ | 1449 | */ |
1446 | int arch_update_cpu_topology(void) | 1450 | int arch_update_cpu_topology(void) |
1447 | { | 1451 | { |
1448 | int cpu = 0, nid = 0, old_nid = 0; | 1452 | int cpu, nid, old_nid; |
1449 | unsigned int associativity[VPHN_ASSOC_BUFSIZE] = {0}; | 1453 | unsigned int associativity[VPHN_ASSOC_BUFSIZE] = {0}; |
1450 | struct sys_device *sysdev = NULL; | 1454 | struct sys_device *sysdev; |
1451 | 1455 | ||
1452 | for_each_cpu_mask(cpu, cpu_associativity_changes_mask) { | 1456 | for_each_cpu_mask(cpu, cpu_associativity_changes_mask) { |
1453 | vphn_get_associativity(cpu, associativity); | 1457 | vphn_get_associativity(cpu, associativity); |
@@ -1512,7 +1516,8 @@ int start_topology_update(void) | |||
1512 | { | 1516 | { |
1513 | int rc = 0; | 1517 | int rc = 0; |
1514 | 1518 | ||
1515 | if (firmware_has_feature(FW_FEATURE_VPHN)) { | 1519 | if (firmware_has_feature(FW_FEATURE_VPHN) && |
1520 | get_lppaca()->shared_proc) { | ||
1516 | vphn_enabled = 1; | 1521 | vphn_enabled = 1; |
1517 | setup_cpu_associativity_change_counters(); | 1522 | setup_cpu_associativity_change_counters(); |
1518 | init_timer_deferrable(&topology_timer); | 1523 | init_timer_deferrable(&topology_timer); |
diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c index 5d3ea9f60dd7..ca5d5898d320 100644 --- a/arch/powerpc/platforms/pseries/lpar.c +++ b/arch/powerpc/platforms/pseries/lpar.c | |||
@@ -713,6 +713,13 @@ EXPORT_SYMBOL(arch_free_page); | |||
713 | /* NB: reg/unreg are called while guarded with the tracepoints_mutex */ | 713 | /* NB: reg/unreg are called while guarded with the tracepoints_mutex */ |
714 | extern long hcall_tracepoint_refcount; | 714 | extern long hcall_tracepoint_refcount; |
715 | 715 | ||
716 | /* | ||
717 | * Since the tracing code might execute hcalls we need to guard against | ||
718 | * recursion. One example of this are spinlocks calling H_YIELD on | ||
719 | * shared processor partitions. | ||
720 | */ | ||
721 | static DEFINE_PER_CPU(unsigned int, hcall_trace_depth); | ||
722 | |||
716 | void hcall_tracepoint_regfunc(void) | 723 | void hcall_tracepoint_regfunc(void) |
717 | { | 724 | { |
718 | hcall_tracepoint_refcount++; | 725 | hcall_tracepoint_refcount++; |
@@ -725,12 +732,42 @@ void hcall_tracepoint_unregfunc(void) | |||
725 | 732 | ||
726 | void __trace_hcall_entry(unsigned long opcode, unsigned long *args) | 733 | void __trace_hcall_entry(unsigned long opcode, unsigned long *args) |
727 | { | 734 | { |
735 | unsigned long flags; | ||
736 | unsigned int *depth; | ||
737 | |||
738 | local_irq_save(flags); | ||
739 | |||
740 | depth = &__get_cpu_var(hcall_trace_depth); | ||
741 | |||
742 | if (*depth) | ||
743 | goto out; | ||
744 | |||
745 | (*depth)++; | ||
728 | trace_hcall_entry(opcode, args); | 746 | trace_hcall_entry(opcode, args); |
747 | (*depth)--; | ||
748 | |||
749 | out: | ||
750 | local_irq_restore(flags); | ||
729 | } | 751 | } |
730 | 752 | ||
731 | void __trace_hcall_exit(long opcode, unsigned long retval, | 753 | void __trace_hcall_exit(long opcode, unsigned long retval, |
732 | unsigned long *retbuf) | 754 | unsigned long *retbuf) |
733 | { | 755 | { |
756 | unsigned long flags; | ||
757 | unsigned int *depth; | ||
758 | |||
759 | local_irq_save(flags); | ||
760 | |||
761 | depth = &__get_cpu_var(hcall_trace_depth); | ||
762 | |||
763 | if (*depth) | ||
764 | goto out; | ||
765 | |||
766 | (*depth)++; | ||
734 | trace_hcall_exit(opcode, retval, retbuf); | 767 | trace_hcall_exit(opcode, retval, retbuf); |
768 | (*depth)--; | ||
769 | |||
770 | out: | ||
771 | local_irq_restore(flags); | ||
735 | } | 772 | } |
736 | #endif | 773 | #endif |
diff --git a/arch/x86/include/asm/smp.h b/arch/x86/include/asm/smp.h index 4c2f63c7fc1b..1f4695136776 100644 --- a/arch/x86/include/asm/smp.h +++ b/arch/x86/include/asm/smp.h | |||
@@ -40,10 +40,7 @@ DECLARE_EARLY_PER_CPU(u16, x86_cpu_to_apicid); | |||
40 | DECLARE_EARLY_PER_CPU(u16, x86_bios_cpu_apicid); | 40 | DECLARE_EARLY_PER_CPU(u16, x86_bios_cpu_apicid); |
41 | 41 | ||
42 | /* Static state in head.S used to set up a CPU */ | 42 | /* Static state in head.S used to set up a CPU */ |
43 | extern struct { | 43 | extern unsigned long stack_start; /* Initial stack pointer address */ |
44 | void *sp; | ||
45 | unsigned short ss; | ||
46 | } stack_start; | ||
47 | 44 | ||
48 | struct smp_ops { | 45 | struct smp_ops { |
49 | void (*smp_prepare_boot_cpu)(void); | 46 | void (*smp_prepare_boot_cpu)(void); |
diff --git a/arch/x86/kernel/acpi/sleep.c b/arch/x86/kernel/acpi/sleep.c index 69fd72aa5594..68d1537b8c81 100644 --- a/arch/x86/kernel/acpi/sleep.c +++ b/arch/x86/kernel/acpi/sleep.c | |||
@@ -12,10 +12,8 @@ | |||
12 | #include <linux/cpumask.h> | 12 | #include <linux/cpumask.h> |
13 | #include <asm/segment.h> | 13 | #include <asm/segment.h> |
14 | #include <asm/desc.h> | 14 | #include <asm/desc.h> |
15 | |||
16 | #ifdef CONFIG_X86_32 | ||
17 | #include <asm/pgtable.h> | 15 | #include <asm/pgtable.h> |
18 | #endif | 16 | #include <asm/cacheflush.h> |
19 | 17 | ||
20 | #include "realmode/wakeup.h" | 18 | #include "realmode/wakeup.h" |
21 | #include "sleep.h" | 19 | #include "sleep.h" |
@@ -100,7 +98,7 @@ int acpi_save_state_mem(void) | |||
100 | #else /* CONFIG_64BIT */ | 98 | #else /* CONFIG_64BIT */ |
101 | header->trampoline_segment = setup_trampoline() >> 4; | 99 | header->trampoline_segment = setup_trampoline() >> 4; |
102 | #ifdef CONFIG_SMP | 100 | #ifdef CONFIG_SMP |
103 | stack_start.sp = temp_stack + sizeof(temp_stack); | 101 | stack_start = (unsigned long)temp_stack + sizeof(temp_stack); |
104 | early_gdt_descr.address = | 102 | early_gdt_descr.address = |
105 | (unsigned long)get_cpu_gdt_table(smp_processor_id()); | 103 | (unsigned long)get_cpu_gdt_table(smp_processor_id()); |
106 | initial_gs = per_cpu_offset(smp_processor_id()); | 104 | initial_gs = per_cpu_offset(smp_processor_id()); |
@@ -149,6 +147,15 @@ void __init acpi_reserve_wakeup_memory(void) | |||
149 | memblock_x86_reserve_range(mem, mem + WAKEUP_SIZE, "ACPI WAKEUP"); | 147 | memblock_x86_reserve_range(mem, mem + WAKEUP_SIZE, "ACPI WAKEUP"); |
150 | } | 148 | } |
151 | 149 | ||
150 | int __init acpi_configure_wakeup_memory(void) | ||
151 | { | ||
152 | if (acpi_realmode) | ||
153 | set_memory_x(acpi_realmode, WAKEUP_SIZE >> PAGE_SHIFT); | ||
154 | |||
155 | return 0; | ||
156 | } | ||
157 | arch_initcall(acpi_configure_wakeup_memory); | ||
158 | |||
152 | 159 | ||
153 | static int __init acpi_sleep_setup(char *str) | 160 | static int __init acpi_sleep_setup(char *str) |
154 | { | 161 | { |
diff --git a/arch/x86/kernel/cpu/mtrr/main.c b/arch/x86/kernel/cpu/mtrr/main.c index 01c0f3ee6cc3..bebabec5b448 100644 --- a/arch/x86/kernel/cpu/mtrr/main.c +++ b/arch/x86/kernel/cpu/mtrr/main.c | |||
@@ -793,13 +793,21 @@ void set_mtrr_aps_delayed_init(void) | |||
793 | } | 793 | } |
794 | 794 | ||
795 | /* | 795 | /* |
796 | * MTRR initialization for all AP's | 796 | * Delayed MTRR initialization for all AP's |
797 | */ | 797 | */ |
798 | void mtrr_aps_init(void) | 798 | void mtrr_aps_init(void) |
799 | { | 799 | { |
800 | if (!use_intel()) | 800 | if (!use_intel()) |
801 | return; | 801 | return; |
802 | 802 | ||
803 | /* | ||
804 | * Check if someone has requested the delay of AP MTRR initialization, | ||
805 | * by doing set_mtrr_aps_delayed_init(), prior to this point. If not, | ||
806 | * then we are done. | ||
807 | */ | ||
808 | if (!mtrr_aps_delayed_init) | ||
809 | return; | ||
810 | |||
803 | set_mtrr(~0U, 0, 0, 0); | 811 | set_mtrr(~0U, 0, 0, 0); |
804 | mtrr_aps_delayed_init = false; | 812 | mtrr_aps_delayed_init = false; |
805 | } | 813 | } |
diff --git a/arch/x86/kernel/head_32.S b/arch/x86/kernel/head_32.S index fc293dc8dc35..767d6c43de37 100644 --- a/arch/x86/kernel/head_32.S +++ b/arch/x86/kernel/head_32.S | |||
@@ -85,6 +85,8 @@ RESERVE_BRK(pagetables, INIT_MAP_SIZE) | |||
85 | */ | 85 | */ |
86 | __HEAD | 86 | __HEAD |
87 | ENTRY(startup_32) | 87 | ENTRY(startup_32) |
88 | movl pa(stack_start),%ecx | ||
89 | |||
88 | /* test KEEP_SEGMENTS flag to see if the bootloader is asking | 90 | /* test KEEP_SEGMENTS flag to see if the bootloader is asking |
89 | us to not reload segments */ | 91 | us to not reload segments */ |
90 | testb $(1<<6), BP_loadflags(%esi) | 92 | testb $(1<<6), BP_loadflags(%esi) |
@@ -99,7 +101,9 @@ ENTRY(startup_32) | |||
99 | movl %eax,%es | 101 | movl %eax,%es |
100 | movl %eax,%fs | 102 | movl %eax,%fs |
101 | movl %eax,%gs | 103 | movl %eax,%gs |
104 | movl %eax,%ss | ||
102 | 2: | 105 | 2: |
106 | leal -__PAGE_OFFSET(%ecx),%esp | ||
103 | 107 | ||
104 | /* | 108 | /* |
105 | * Clear BSS first so that there are no surprises... | 109 | * Clear BSS first so that there are no surprises... |
@@ -145,8 +149,6 @@ ENTRY(startup_32) | |||
145 | * _brk_end is set up to point to the first "safe" location. | 149 | * _brk_end is set up to point to the first "safe" location. |
146 | * Mappings are created both at virtual address 0 (identity mapping) | 150 | * Mappings are created both at virtual address 0 (identity mapping) |
147 | * and PAGE_OFFSET for up to _end. | 151 | * and PAGE_OFFSET for up to _end. |
148 | * | ||
149 | * Note that the stack is not yet set up! | ||
150 | */ | 152 | */ |
151 | #ifdef CONFIG_X86_PAE | 153 | #ifdef CONFIG_X86_PAE |
152 | 154 | ||
@@ -282,6 +284,9 @@ ENTRY(startup_32_smp) | |||
282 | movl %eax,%es | 284 | movl %eax,%es |
283 | movl %eax,%fs | 285 | movl %eax,%fs |
284 | movl %eax,%gs | 286 | movl %eax,%gs |
287 | movl pa(stack_start),%ecx | ||
288 | movl %eax,%ss | ||
289 | leal -__PAGE_OFFSET(%ecx),%esp | ||
285 | #endif /* CONFIG_SMP */ | 290 | #endif /* CONFIG_SMP */ |
286 | default_entry: | 291 | default_entry: |
287 | 292 | ||
@@ -347,8 +352,8 @@ default_entry: | |||
347 | movl %eax,%cr0 /* ..and set paging (PG) bit */ | 352 | movl %eax,%cr0 /* ..and set paging (PG) bit */ |
348 | ljmp $__BOOT_CS,$1f /* Clear prefetch and normalize %eip */ | 353 | ljmp $__BOOT_CS,$1f /* Clear prefetch and normalize %eip */ |
349 | 1: | 354 | 1: |
350 | /* Set up the stack pointer */ | 355 | /* Shift the stack pointer to a virtual address */ |
351 | lss stack_start,%esp | 356 | addl $__PAGE_OFFSET, %esp |
352 | 357 | ||
353 | /* | 358 | /* |
354 | * Initialize eflags. Some BIOS's leave bits like NT set. This would | 359 | * Initialize eflags. Some BIOS's leave bits like NT set. This would |
@@ -360,9 +365,7 @@ default_entry: | |||
360 | 365 | ||
361 | #ifdef CONFIG_SMP | 366 | #ifdef CONFIG_SMP |
362 | cmpb $0, ready | 367 | cmpb $0, ready |
363 | jz 1f /* Initial CPU cleans BSS */ | 368 | jnz checkCPUtype |
364 | jmp checkCPUtype | ||
365 | 1: | ||
366 | #endif /* CONFIG_SMP */ | 369 | #endif /* CONFIG_SMP */ |
367 | 370 | ||
368 | /* | 371 | /* |
@@ -470,14 +473,7 @@ is386: movl $2,%ecx # set MP | |||
470 | 473 | ||
471 | cld # gcc2 wants the direction flag cleared at all times | 474 | cld # gcc2 wants the direction flag cleared at all times |
472 | pushl $0 # fake return address for unwinder | 475 | pushl $0 # fake return address for unwinder |
473 | #ifdef CONFIG_SMP | ||
474 | movb ready, %cl | ||
475 | movb $1, ready | 476 | movb $1, ready |
476 | cmpb $0,%cl # the first CPU calls start_kernel | ||
477 | je 1f | ||
478 | movl (stack_start), %esp | ||
479 | 1: | ||
480 | #endif /* CONFIG_SMP */ | ||
481 | jmp *(initial_code) | 477 | jmp *(initial_code) |
482 | 478 | ||
483 | /* | 479 | /* |
@@ -670,15 +666,15 @@ ENTRY(initial_page_table) | |||
670 | #endif | 666 | #endif |
671 | 667 | ||
672 | .data | 668 | .data |
669 | .balign 4 | ||
673 | ENTRY(stack_start) | 670 | ENTRY(stack_start) |
674 | .long init_thread_union+THREAD_SIZE | 671 | .long init_thread_union+THREAD_SIZE |
675 | .long __BOOT_DS | ||
676 | |||
677 | ready: .byte 0 | ||
678 | 672 | ||
679 | early_recursion_flag: | 673 | early_recursion_flag: |
680 | .long 0 | 674 | .long 0 |
681 | 675 | ||
676 | ready: .byte 0 | ||
677 | |||
682 | int_msg: | 678 | int_msg: |
683 | .asciz "Unknown interrupt or fault at: %p %p %p\n" | 679 | .asciz "Unknown interrupt or fault at: %p %p %p\n" |
684 | 680 | ||
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index 0cbe8c0b35ed..03273b6c272c 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c | |||
@@ -638,7 +638,7 @@ wakeup_secondary_cpu_via_init(int phys_apicid, unsigned long start_eip) | |||
638 | * target processor state. | 638 | * target processor state. |
639 | */ | 639 | */ |
640 | startup_ipi_hook(phys_apicid, (unsigned long) start_secondary, | 640 | startup_ipi_hook(phys_apicid, (unsigned long) start_secondary, |
641 | (unsigned long)stack_start.sp); | 641 | stack_start); |
642 | 642 | ||
643 | /* | 643 | /* |
644 | * Run STARTUP IPI loop. | 644 | * Run STARTUP IPI loop. |
@@ -785,7 +785,7 @@ do_rest: | |||
785 | #endif | 785 | #endif |
786 | early_gdt_descr.address = (unsigned long)get_cpu_gdt_table(cpu); | 786 | early_gdt_descr.address = (unsigned long)get_cpu_gdt_table(cpu); |
787 | initial_code = (unsigned long)start_secondary; | 787 | initial_code = (unsigned long)start_secondary; |
788 | stack_start.sp = (void *) c_idle.idle->thread.sp; | 788 | stack_start = c_idle.idle->thread.sp; |
789 | 789 | ||
790 | /* start_ip had better be page-aligned! */ | 790 | /* start_ip had better be page-aligned! */ |
791 | start_ip = setup_trampoline(); | 791 | start_ip = setup_trampoline(); |
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c index 8b830ca14ac4..d343b3c81f3c 100644 --- a/arch/x86/mm/pageattr.c +++ b/arch/x86/mm/pageattr.c | |||
@@ -256,7 +256,6 @@ static inline pgprot_t static_protections(pgprot_t prot, unsigned long address, | |||
256 | unsigned long pfn) | 256 | unsigned long pfn) |
257 | { | 257 | { |
258 | pgprot_t forbidden = __pgprot(0); | 258 | pgprot_t forbidden = __pgprot(0); |
259 | pgprot_t required = __pgprot(0); | ||
260 | 259 | ||
261 | /* | 260 | /* |
262 | * The BIOS area between 640k and 1Mb needs to be executable for | 261 | * The BIOS area between 640k and 1Mb needs to be executable for |
@@ -282,12 +281,6 @@ static inline pgprot_t static_protections(pgprot_t prot, unsigned long address, | |||
282 | if (within(pfn, __pa((unsigned long)__start_rodata) >> PAGE_SHIFT, | 281 | if (within(pfn, __pa((unsigned long)__start_rodata) >> PAGE_SHIFT, |
283 | __pa((unsigned long)__end_rodata) >> PAGE_SHIFT)) | 282 | __pa((unsigned long)__end_rodata) >> PAGE_SHIFT)) |
284 | pgprot_val(forbidden) |= _PAGE_RW; | 283 | pgprot_val(forbidden) |= _PAGE_RW; |
285 | /* | ||
286 | * .data and .bss should always be writable. | ||
287 | */ | ||
288 | if (within(address, (unsigned long)_sdata, (unsigned long)_edata) || | ||
289 | within(address, (unsigned long)__bss_start, (unsigned long)__bss_stop)) | ||
290 | pgprot_val(required) |= _PAGE_RW; | ||
291 | 284 | ||
292 | #if defined(CONFIG_X86_64) && defined(CONFIG_DEBUG_RODATA) | 285 | #if defined(CONFIG_X86_64) && defined(CONFIG_DEBUG_RODATA) |
293 | /* | 286 | /* |
@@ -327,7 +320,6 @@ static inline pgprot_t static_protections(pgprot_t prot, unsigned long address, | |||
327 | #endif | 320 | #endif |
328 | 321 | ||
329 | prot = __pgprot(pgprot_val(prot) & ~pgprot_val(forbidden)); | 322 | prot = __pgprot(pgprot_val(prot) & ~pgprot_val(forbidden)); |
330 | prot = __pgprot(pgprot_val(prot) | pgprot_val(required)); | ||
331 | 323 | ||
332 | return prot; | 324 | return prot; |
333 | } | 325 | } |
diff --git a/drivers/input/misc/ixp4xx-beeper.c b/drivers/input/misc/ixp4xx-beeper.c index 9dfd6e5f786f..1f38302a5951 100644 --- a/drivers/input/misc/ixp4xx-beeper.c +++ b/drivers/input/misc/ixp4xx-beeper.c | |||
@@ -69,11 +69,7 @@ static int ixp4xx_spkr_event(struct input_dev *dev, unsigned int type, unsigned | |||
69 | } | 69 | } |
70 | 70 | ||
71 | if (value > 20 && value < 32767) | 71 | if (value > 20 && value < 32767) |
72 | #ifndef FREQ | 72 | count = (IXP4XX_TIMER_FREQ / (value * 4)) - 1; |
73 | count = (ixp4xx_get_board_tick_rate() / (value * 4)) - 1; | ||
74 | #else | ||
75 | count = (FREQ / (value * 4)) - 1; | ||
76 | #endif | ||
77 | 73 | ||
78 | ixp4xx_spkr_control(pin, count); | 74 | ixp4xx_spkr_control(pin, count); |
79 | 75 | ||
diff --git a/drivers/rtc/class.c b/drivers/rtc/class.c index 9583cbcc6b79..c404b61386bf 100644 --- a/drivers/rtc/class.c +++ b/drivers/rtc/class.c | |||
@@ -143,6 +143,7 @@ struct rtc_device *rtc_device_register(const char *name, struct device *dev, | |||
143 | rtc->id = id; | 143 | rtc->id = id; |
144 | rtc->ops = ops; | 144 | rtc->ops = ops; |
145 | rtc->owner = owner; | 145 | rtc->owner = owner; |
146 | rtc->irq_freq = 1; | ||
146 | rtc->max_user_freq = 64; | 147 | rtc->max_user_freq = 64; |
147 | rtc->dev.parent = dev; | 148 | rtc->dev.parent = dev; |
148 | rtc->dev.class = rtc_class; | 149 | rtc->dev.class = rtc_class; |
diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c index 925006d33109..a0c01967244d 100644 --- a/drivers/rtc/interface.c +++ b/drivers/rtc/interface.c | |||
@@ -464,6 +464,9 @@ int rtc_irq_set_freq(struct rtc_device *rtc, struct rtc_task *task, int freq) | |||
464 | int err = 0; | 464 | int err = 0; |
465 | unsigned long flags; | 465 | unsigned long flags; |
466 | 466 | ||
467 | if (freq <= 0) | ||
468 | return -EINVAL; | ||
469 | |||
467 | spin_lock_irqsave(&rtc->irq_task_lock, flags); | 470 | spin_lock_irqsave(&rtc->irq_task_lock, flags); |
468 | if (rtc->irq_task != NULL && task == NULL) | 471 | if (rtc->irq_task != NULL && task == NULL) |
469 | err = -EBUSY; | 472 | err = -EBUSY; |
diff --git a/fs/btrfs/acl.c b/fs/btrfs/acl.c index 15b5ca2a2606..9c949348510b 100644 --- a/fs/btrfs/acl.c +++ b/fs/btrfs/acl.c | |||
@@ -37,6 +37,9 @@ static struct posix_acl *btrfs_get_acl(struct inode *inode, int type) | |||
37 | char *value = NULL; | 37 | char *value = NULL; |
38 | struct posix_acl *acl; | 38 | struct posix_acl *acl; |
39 | 39 | ||
40 | if (!IS_POSIXACL(inode)) | ||
41 | return NULL; | ||
42 | |||
40 | acl = get_cached_acl(inode, type); | 43 | acl = get_cached_acl(inode, type); |
41 | if (acl != ACL_NOT_CACHED) | 44 | if (acl != ACL_NOT_CACHED) |
42 | return acl; | 45 | return acl; |
@@ -84,6 +87,9 @@ static int btrfs_xattr_acl_get(struct dentry *dentry, const char *name, | |||
84 | struct posix_acl *acl; | 87 | struct posix_acl *acl; |
85 | int ret = 0; | 88 | int ret = 0; |
86 | 89 | ||
90 | if (!IS_POSIXACL(dentry->d_inode)) | ||
91 | return -EOPNOTSUPP; | ||
92 | |||
87 | acl = btrfs_get_acl(dentry->d_inode, type); | 93 | acl = btrfs_get_acl(dentry->d_inode, type); |
88 | 94 | ||
89 | if (IS_ERR(acl)) | 95 | if (IS_ERR(acl)) |
diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c index f745287fbf2e..4d2110eafe29 100644 --- a/fs/btrfs/compression.c +++ b/fs/btrfs/compression.c | |||
@@ -562,7 +562,7 @@ int btrfs_submit_compressed_read(struct inode *inode, struct bio *bio, | |||
562 | u64 em_len; | 562 | u64 em_len; |
563 | u64 em_start; | 563 | u64 em_start; |
564 | struct extent_map *em; | 564 | struct extent_map *em; |
565 | int ret; | 565 | int ret = -ENOMEM; |
566 | u32 *sums; | 566 | u32 *sums; |
567 | 567 | ||
568 | tree = &BTRFS_I(inode)->io_tree; | 568 | tree = &BTRFS_I(inode)->io_tree; |
@@ -577,6 +577,9 @@ int btrfs_submit_compressed_read(struct inode *inode, struct bio *bio, | |||
577 | 577 | ||
578 | compressed_len = em->block_len; | 578 | compressed_len = em->block_len; |
579 | cb = kmalloc(compressed_bio_size(root, compressed_len), GFP_NOFS); | 579 | cb = kmalloc(compressed_bio_size(root, compressed_len), GFP_NOFS); |
580 | if (!cb) | ||
581 | goto out; | ||
582 | |||
580 | atomic_set(&cb->pending_bios, 0); | 583 | atomic_set(&cb->pending_bios, 0); |
581 | cb->errors = 0; | 584 | cb->errors = 0; |
582 | cb->inode = inode; | 585 | cb->inode = inode; |
@@ -597,13 +600,18 @@ int btrfs_submit_compressed_read(struct inode *inode, struct bio *bio, | |||
597 | 600 | ||
598 | nr_pages = (compressed_len + PAGE_CACHE_SIZE - 1) / | 601 | nr_pages = (compressed_len + PAGE_CACHE_SIZE - 1) / |
599 | PAGE_CACHE_SIZE; | 602 | PAGE_CACHE_SIZE; |
600 | cb->compressed_pages = kmalloc(sizeof(struct page *) * nr_pages, | 603 | cb->compressed_pages = kzalloc(sizeof(struct page *) * nr_pages, |
601 | GFP_NOFS); | 604 | GFP_NOFS); |
605 | if (!cb->compressed_pages) | ||
606 | goto fail1; | ||
607 | |||
602 | bdev = BTRFS_I(inode)->root->fs_info->fs_devices->latest_bdev; | 608 | bdev = BTRFS_I(inode)->root->fs_info->fs_devices->latest_bdev; |
603 | 609 | ||
604 | for (page_index = 0; page_index < nr_pages; page_index++) { | 610 | for (page_index = 0; page_index < nr_pages; page_index++) { |
605 | cb->compressed_pages[page_index] = alloc_page(GFP_NOFS | | 611 | cb->compressed_pages[page_index] = alloc_page(GFP_NOFS | |
606 | __GFP_HIGHMEM); | 612 | __GFP_HIGHMEM); |
613 | if (!cb->compressed_pages[page_index]) | ||
614 | goto fail2; | ||
607 | } | 615 | } |
608 | cb->nr_pages = nr_pages; | 616 | cb->nr_pages = nr_pages; |
609 | 617 | ||
@@ -614,6 +622,8 @@ int btrfs_submit_compressed_read(struct inode *inode, struct bio *bio, | |||
614 | cb->len = uncompressed_len; | 622 | cb->len = uncompressed_len; |
615 | 623 | ||
616 | comp_bio = compressed_bio_alloc(bdev, cur_disk_byte, GFP_NOFS); | 624 | comp_bio = compressed_bio_alloc(bdev, cur_disk_byte, GFP_NOFS); |
625 | if (!comp_bio) | ||
626 | goto fail2; | ||
617 | comp_bio->bi_private = cb; | 627 | comp_bio->bi_private = cb; |
618 | comp_bio->bi_end_io = end_compressed_bio_read; | 628 | comp_bio->bi_end_io = end_compressed_bio_read; |
619 | atomic_inc(&cb->pending_bios); | 629 | atomic_inc(&cb->pending_bios); |
@@ -681,6 +691,17 @@ int btrfs_submit_compressed_read(struct inode *inode, struct bio *bio, | |||
681 | 691 | ||
682 | bio_put(comp_bio); | 692 | bio_put(comp_bio); |
683 | return 0; | 693 | return 0; |
694 | |||
695 | fail2: | ||
696 | for (page_index = 0; page_index < nr_pages; page_index++) | ||
697 | free_page((unsigned long)cb->compressed_pages[page_index]); | ||
698 | |||
699 | kfree(cb->compressed_pages); | ||
700 | fail1: | ||
701 | kfree(cb); | ||
702 | out: | ||
703 | free_extent_map(em); | ||
704 | return ret; | ||
684 | } | 705 | } |
685 | 706 | ||
686 | static struct list_head comp_idle_workspace[BTRFS_COMPRESS_TYPES]; | 707 | static struct list_head comp_idle_workspace[BTRFS_COMPRESS_TYPES]; |
@@ -900,7 +921,7 @@ int btrfs_decompress(int type, unsigned char *data_in, struct page *dest_page, | |||
900 | return ret; | 921 | return ret; |
901 | } | 922 | } |
902 | 923 | ||
903 | void __exit btrfs_exit_compress(void) | 924 | void btrfs_exit_compress(void) |
904 | { | 925 | { |
905 | free_workspaces(); | 926 | free_workspaces(); |
906 | } | 927 | } |
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index b531c36455d8..fdce8799b98d 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -1550,6 +1550,7 @@ static int transaction_kthread(void *arg) | |||
1550 | spin_unlock(&root->fs_info->new_trans_lock); | 1550 | spin_unlock(&root->fs_info->new_trans_lock); |
1551 | 1551 | ||
1552 | trans = btrfs_join_transaction(root, 1); | 1552 | trans = btrfs_join_transaction(root, 1); |
1553 | BUG_ON(IS_ERR(trans)); | ||
1553 | if (transid == trans->transid) { | 1554 | if (transid == trans->transid) { |
1554 | ret = btrfs_commit_transaction(trans, root); | 1555 | ret = btrfs_commit_transaction(trans, root); |
1555 | BUG_ON(ret); | 1556 | BUG_ON(ret); |
@@ -2453,10 +2454,14 @@ int btrfs_commit_super(struct btrfs_root *root) | |||
2453 | up_write(&root->fs_info->cleanup_work_sem); | 2454 | up_write(&root->fs_info->cleanup_work_sem); |
2454 | 2455 | ||
2455 | trans = btrfs_join_transaction(root, 1); | 2456 | trans = btrfs_join_transaction(root, 1); |
2457 | if (IS_ERR(trans)) | ||
2458 | return PTR_ERR(trans); | ||
2456 | ret = btrfs_commit_transaction(trans, root); | 2459 | ret = btrfs_commit_transaction(trans, root); |
2457 | BUG_ON(ret); | 2460 | BUG_ON(ret); |
2458 | /* run commit again to drop the original snapshot */ | 2461 | /* run commit again to drop the original snapshot */ |
2459 | trans = btrfs_join_transaction(root, 1); | 2462 | trans = btrfs_join_transaction(root, 1); |
2463 | if (IS_ERR(trans)) | ||
2464 | return PTR_ERR(trans); | ||
2460 | btrfs_commit_transaction(trans, root); | 2465 | btrfs_commit_transaction(trans, root); |
2461 | ret = btrfs_write_and_wait_transaction(NULL, root); | 2466 | ret = btrfs_write_and_wait_transaction(NULL, root); |
2462 | BUG_ON(ret); | 2467 | BUG_ON(ret); |
@@ -2554,6 +2559,8 @@ int close_ctree(struct btrfs_root *root) | |||
2554 | kfree(fs_info->chunk_root); | 2559 | kfree(fs_info->chunk_root); |
2555 | kfree(fs_info->dev_root); | 2560 | kfree(fs_info->dev_root); |
2556 | kfree(fs_info->csum_root); | 2561 | kfree(fs_info->csum_root); |
2562 | kfree(fs_info); | ||
2563 | |||
2557 | return 0; | 2564 | return 0; |
2558 | } | 2565 | } |
2559 | 2566 | ||
diff --git a/fs/btrfs/export.c b/fs/btrfs/export.c index 9786963b07e5..ff27d7a477b2 100644 --- a/fs/btrfs/export.c +++ b/fs/btrfs/export.c | |||
@@ -171,6 +171,8 @@ static struct dentry *btrfs_get_parent(struct dentry *child) | |||
171 | int ret; | 171 | int ret; |
172 | 172 | ||
173 | path = btrfs_alloc_path(); | 173 | path = btrfs_alloc_path(); |
174 | if (!path) | ||
175 | return ERR_PTR(-ENOMEM); | ||
174 | 176 | ||
175 | if (dir->i_ino == BTRFS_FIRST_FREE_OBJECTID) { | 177 | if (dir->i_ino == BTRFS_FIRST_FREE_OBJECTID) { |
176 | key.objectid = root->root_key.objectid; | 178 | key.objectid = root->root_key.objectid; |
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index b55269340cec..4e7e012ad667 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -320,11 +320,6 @@ static int caching_kthread(void *data) | |||
320 | if (!path) | 320 | if (!path) |
321 | return -ENOMEM; | 321 | return -ENOMEM; |
322 | 322 | ||
323 | exclude_super_stripes(extent_root, block_group); | ||
324 | spin_lock(&block_group->space_info->lock); | ||
325 | block_group->space_info->bytes_readonly += block_group->bytes_super; | ||
326 | spin_unlock(&block_group->space_info->lock); | ||
327 | |||
328 | last = max_t(u64, block_group->key.objectid, BTRFS_SUPER_INFO_OFFSET); | 323 | last = max_t(u64, block_group->key.objectid, BTRFS_SUPER_INFO_OFFSET); |
329 | 324 | ||
330 | /* | 325 | /* |
@@ -467,8 +462,10 @@ static int cache_block_group(struct btrfs_block_group_cache *cache, | |||
467 | cache->cached = BTRFS_CACHE_NO; | 462 | cache->cached = BTRFS_CACHE_NO; |
468 | } | 463 | } |
469 | spin_unlock(&cache->lock); | 464 | spin_unlock(&cache->lock); |
470 | if (ret == 1) | 465 | if (ret == 1) { |
466 | free_excluded_extents(fs_info->extent_root, cache); | ||
471 | return 0; | 467 | return 0; |
468 | } | ||
472 | } | 469 | } |
473 | 470 | ||
474 | if (load_cache_only) | 471 | if (load_cache_only) |
@@ -3344,8 +3341,10 @@ static int shrink_delalloc(struct btrfs_trans_handle *trans, | |||
3344 | u64 reserved; | 3341 | u64 reserved; |
3345 | u64 max_reclaim; | 3342 | u64 max_reclaim; |
3346 | u64 reclaimed = 0; | 3343 | u64 reclaimed = 0; |
3344 | long time_left; | ||
3347 | int pause = 1; | 3345 | int pause = 1; |
3348 | int nr_pages = (2 * 1024 * 1024) >> PAGE_CACHE_SHIFT; | 3346 | int nr_pages = (2 * 1024 * 1024) >> PAGE_CACHE_SHIFT; |
3347 | int loops = 0; | ||
3349 | 3348 | ||
3350 | block_rsv = &root->fs_info->delalloc_block_rsv; | 3349 | block_rsv = &root->fs_info->delalloc_block_rsv; |
3351 | space_info = block_rsv->space_info; | 3350 | space_info = block_rsv->space_info; |
@@ -3358,7 +3357,7 @@ static int shrink_delalloc(struct btrfs_trans_handle *trans, | |||
3358 | 3357 | ||
3359 | max_reclaim = min(reserved, to_reclaim); | 3358 | max_reclaim = min(reserved, to_reclaim); |
3360 | 3359 | ||
3361 | while (1) { | 3360 | while (loops < 1024) { |
3362 | /* have the flusher threads jump in and do some IO */ | 3361 | /* have the flusher threads jump in and do some IO */ |
3363 | smp_mb(); | 3362 | smp_mb(); |
3364 | nr_pages = min_t(unsigned long, nr_pages, | 3363 | nr_pages = min_t(unsigned long, nr_pages, |
@@ -3366,8 +3365,12 @@ static int shrink_delalloc(struct btrfs_trans_handle *trans, | |||
3366 | writeback_inodes_sb_nr_if_idle(root->fs_info->sb, nr_pages); | 3365 | writeback_inodes_sb_nr_if_idle(root->fs_info->sb, nr_pages); |
3367 | 3366 | ||
3368 | spin_lock(&space_info->lock); | 3367 | spin_lock(&space_info->lock); |
3369 | if (reserved > space_info->bytes_reserved) | 3368 | if (reserved > space_info->bytes_reserved) { |
3369 | loops = 0; | ||
3370 | reclaimed += reserved - space_info->bytes_reserved; | 3370 | reclaimed += reserved - space_info->bytes_reserved; |
3371 | } else { | ||
3372 | loops++; | ||
3373 | } | ||
3371 | reserved = space_info->bytes_reserved; | 3374 | reserved = space_info->bytes_reserved; |
3372 | spin_unlock(&space_info->lock); | 3375 | spin_unlock(&space_info->lock); |
3373 | 3376 | ||
@@ -3378,7 +3381,12 @@ static int shrink_delalloc(struct btrfs_trans_handle *trans, | |||
3378 | return -EAGAIN; | 3381 | return -EAGAIN; |
3379 | 3382 | ||
3380 | __set_current_state(TASK_INTERRUPTIBLE); | 3383 | __set_current_state(TASK_INTERRUPTIBLE); |
3381 | schedule_timeout(pause); | 3384 | time_left = schedule_timeout(pause); |
3385 | |||
3386 | /* We were interrupted, exit */ | ||
3387 | if (time_left) | ||
3388 | break; | ||
3389 | |||
3382 | pause <<= 1; | 3390 | pause <<= 1; |
3383 | if (pause > HZ / 10) | 3391 | if (pause > HZ / 10) |
3384 | pause = HZ / 10; | 3392 | pause = HZ / 10; |
@@ -3588,8 +3596,20 @@ void block_rsv_release_bytes(struct btrfs_block_rsv *block_rsv, | |||
3588 | 3596 | ||
3589 | if (num_bytes > 0) { | 3597 | if (num_bytes > 0) { |
3590 | if (dest) { | 3598 | if (dest) { |
3591 | block_rsv_add_bytes(dest, num_bytes, 0); | 3599 | spin_lock(&dest->lock); |
3592 | } else { | 3600 | if (!dest->full) { |
3601 | u64 bytes_to_add; | ||
3602 | |||
3603 | bytes_to_add = dest->size - dest->reserved; | ||
3604 | bytes_to_add = min(num_bytes, bytes_to_add); | ||
3605 | dest->reserved += bytes_to_add; | ||
3606 | if (dest->reserved >= dest->size) | ||
3607 | dest->full = 1; | ||
3608 | num_bytes -= bytes_to_add; | ||
3609 | } | ||
3610 | spin_unlock(&dest->lock); | ||
3611 | } | ||
3612 | if (num_bytes) { | ||
3593 | spin_lock(&space_info->lock); | 3613 | spin_lock(&space_info->lock); |
3594 | space_info->bytes_reserved -= num_bytes; | 3614 | space_info->bytes_reserved -= num_bytes; |
3595 | spin_unlock(&space_info->lock); | 3615 | spin_unlock(&space_info->lock); |
@@ -4012,6 +4032,7 @@ void btrfs_delalloc_release_metadata(struct inode *inode, u64 num_bytes) | |||
4012 | 4032 | ||
4013 | num_bytes = ALIGN(num_bytes, root->sectorsize); | 4033 | num_bytes = ALIGN(num_bytes, root->sectorsize); |
4014 | atomic_dec(&BTRFS_I(inode)->outstanding_extents); | 4034 | atomic_dec(&BTRFS_I(inode)->outstanding_extents); |
4035 | WARN_ON(atomic_read(&BTRFS_I(inode)->outstanding_extents) < 0); | ||
4015 | 4036 | ||
4016 | spin_lock(&BTRFS_I(inode)->accounting_lock); | 4037 | spin_lock(&BTRFS_I(inode)->accounting_lock); |
4017 | nr_extents = atomic_read(&BTRFS_I(inode)->outstanding_extents); | 4038 | nr_extents = atomic_read(&BTRFS_I(inode)->outstanding_extents); |
@@ -5633,6 +5654,7 @@ use_block_rsv(struct btrfs_trans_handle *trans, | |||
5633 | struct btrfs_root *root, u32 blocksize) | 5654 | struct btrfs_root *root, u32 blocksize) |
5634 | { | 5655 | { |
5635 | struct btrfs_block_rsv *block_rsv; | 5656 | struct btrfs_block_rsv *block_rsv; |
5657 | struct btrfs_block_rsv *global_rsv = &root->fs_info->global_block_rsv; | ||
5636 | int ret; | 5658 | int ret; |
5637 | 5659 | ||
5638 | block_rsv = get_block_rsv(trans, root); | 5660 | block_rsv = get_block_rsv(trans, root); |
@@ -5640,14 +5662,39 @@ use_block_rsv(struct btrfs_trans_handle *trans, | |||
5640 | if (block_rsv->size == 0) { | 5662 | if (block_rsv->size == 0) { |
5641 | ret = reserve_metadata_bytes(trans, root, block_rsv, | 5663 | ret = reserve_metadata_bytes(trans, root, block_rsv, |
5642 | blocksize, 0); | 5664 | blocksize, 0); |
5643 | if (ret) | 5665 | /* |
5666 | * If we couldn't reserve metadata bytes try and use some from | ||
5667 | * the global reserve. | ||
5668 | */ | ||
5669 | if (ret && block_rsv != global_rsv) { | ||
5670 | ret = block_rsv_use_bytes(global_rsv, blocksize); | ||
5671 | if (!ret) | ||
5672 | return global_rsv; | ||
5673 | return ERR_PTR(ret); | ||
5674 | } else if (ret) { | ||
5644 | return ERR_PTR(ret); | 5675 | return ERR_PTR(ret); |
5676 | } | ||
5645 | return block_rsv; | 5677 | return block_rsv; |
5646 | } | 5678 | } |
5647 | 5679 | ||
5648 | ret = block_rsv_use_bytes(block_rsv, blocksize); | 5680 | ret = block_rsv_use_bytes(block_rsv, blocksize); |
5649 | if (!ret) | 5681 | if (!ret) |
5650 | return block_rsv; | 5682 | return block_rsv; |
5683 | if (ret) { | ||
5684 | WARN_ON(1); | ||
5685 | ret = reserve_metadata_bytes(trans, root, block_rsv, blocksize, | ||
5686 | 0); | ||
5687 | if (!ret) { | ||
5688 | spin_lock(&block_rsv->lock); | ||
5689 | block_rsv->size += blocksize; | ||
5690 | spin_unlock(&block_rsv->lock); | ||
5691 | return block_rsv; | ||
5692 | } else if (ret && block_rsv != global_rsv) { | ||
5693 | ret = block_rsv_use_bytes(global_rsv, blocksize); | ||
5694 | if (!ret) | ||
5695 | return global_rsv; | ||
5696 | } | ||
5697 | } | ||
5651 | 5698 | ||
5652 | return ERR_PTR(-ENOSPC); | 5699 | return ERR_PTR(-ENOSPC); |
5653 | } | 5700 | } |
@@ -6221,6 +6268,8 @@ int btrfs_drop_snapshot(struct btrfs_root *root, | |||
6221 | BUG_ON(!wc); | 6268 | BUG_ON(!wc); |
6222 | 6269 | ||
6223 | trans = btrfs_start_transaction(tree_root, 0); | 6270 | trans = btrfs_start_transaction(tree_root, 0); |
6271 | BUG_ON(IS_ERR(trans)); | ||
6272 | |||
6224 | if (block_rsv) | 6273 | if (block_rsv) |
6225 | trans->block_rsv = block_rsv; | 6274 | trans->block_rsv = block_rsv; |
6226 | 6275 | ||
@@ -6318,6 +6367,7 @@ int btrfs_drop_snapshot(struct btrfs_root *root, | |||
6318 | 6367 | ||
6319 | btrfs_end_transaction_throttle(trans, tree_root); | 6368 | btrfs_end_transaction_throttle(trans, tree_root); |
6320 | trans = btrfs_start_transaction(tree_root, 0); | 6369 | trans = btrfs_start_transaction(tree_root, 0); |
6370 | BUG_ON(IS_ERR(trans)); | ||
6321 | if (block_rsv) | 6371 | if (block_rsv) |
6322 | trans->block_rsv = block_rsv; | 6372 | trans->block_rsv = block_rsv; |
6323 | } | 6373 | } |
@@ -6446,6 +6496,8 @@ static noinline int relocate_inode_pages(struct inode *inode, u64 start, | |||
6446 | int ret = 0; | 6496 | int ret = 0; |
6447 | 6497 | ||
6448 | ra = kzalloc(sizeof(*ra), GFP_NOFS); | 6498 | ra = kzalloc(sizeof(*ra), GFP_NOFS); |
6499 | if (!ra) | ||
6500 | return -ENOMEM; | ||
6449 | 6501 | ||
6450 | mutex_lock(&inode->i_mutex); | 6502 | mutex_lock(&inode->i_mutex); |
6451 | first_index = start >> PAGE_CACHE_SHIFT; | 6503 | first_index = start >> PAGE_CACHE_SHIFT; |
@@ -7477,7 +7529,7 @@ int btrfs_drop_dead_reloc_roots(struct btrfs_root *root) | |||
7477 | BUG_ON(reloc_root->commit_root != NULL); | 7529 | BUG_ON(reloc_root->commit_root != NULL); |
7478 | while (1) { | 7530 | while (1) { |
7479 | trans = btrfs_join_transaction(root, 1); | 7531 | trans = btrfs_join_transaction(root, 1); |
7480 | BUG_ON(!trans); | 7532 | BUG_ON(IS_ERR(trans)); |
7481 | 7533 | ||
7482 | mutex_lock(&root->fs_info->drop_mutex); | 7534 | mutex_lock(&root->fs_info->drop_mutex); |
7483 | ret = btrfs_drop_snapshot(trans, reloc_root); | 7535 | ret = btrfs_drop_snapshot(trans, reloc_root); |
@@ -7535,7 +7587,7 @@ int btrfs_cleanup_reloc_trees(struct btrfs_root *root) | |||
7535 | 7587 | ||
7536 | if (found) { | 7588 | if (found) { |
7537 | trans = btrfs_start_transaction(root, 1); | 7589 | trans = btrfs_start_transaction(root, 1); |
7538 | BUG_ON(!trans); | 7590 | BUG_ON(IS_ERR(trans)); |
7539 | ret = btrfs_commit_transaction(trans, root); | 7591 | ret = btrfs_commit_transaction(trans, root); |
7540 | BUG_ON(ret); | 7592 | BUG_ON(ret); |
7541 | } | 7593 | } |
@@ -7779,7 +7831,7 @@ static noinline int relocate_one_extent(struct btrfs_root *extent_root, | |||
7779 | 7831 | ||
7780 | 7832 | ||
7781 | trans = btrfs_start_transaction(extent_root, 1); | 7833 | trans = btrfs_start_transaction(extent_root, 1); |
7782 | BUG_ON(!trans); | 7834 | BUG_ON(IS_ERR(trans)); |
7783 | 7835 | ||
7784 | if (extent_key->objectid == 0) { | 7836 | if (extent_key->objectid == 0) { |
7785 | ret = del_extent_zero(trans, extent_root, path, extent_key); | 7837 | ret = del_extent_zero(trans, extent_root, path, extent_key); |
@@ -8270,6 +8322,13 @@ int btrfs_free_block_groups(struct btrfs_fs_info *info) | |||
8270 | if (block_group->cached == BTRFS_CACHE_STARTED) | 8322 | if (block_group->cached == BTRFS_CACHE_STARTED) |
8271 | wait_block_group_cache_done(block_group); | 8323 | wait_block_group_cache_done(block_group); |
8272 | 8324 | ||
8325 | /* | ||
8326 | * We haven't cached this block group, which means we could | ||
8327 | * possibly have excluded extents on this block group. | ||
8328 | */ | ||
8329 | if (block_group->cached == BTRFS_CACHE_NO) | ||
8330 | free_excluded_extents(info->extent_root, block_group); | ||
8331 | |||
8273 | btrfs_remove_free_space_cache(block_group); | 8332 | btrfs_remove_free_space_cache(block_group); |
8274 | btrfs_put_block_group(block_group); | 8333 | btrfs_put_block_group(block_group); |
8275 | 8334 | ||
@@ -8385,6 +8444,13 @@ int btrfs_read_block_groups(struct btrfs_root *root) | |||
8385 | cache->sectorsize = root->sectorsize; | 8444 | cache->sectorsize = root->sectorsize; |
8386 | 8445 | ||
8387 | /* | 8446 | /* |
8447 | * We need to exclude the super stripes now so that the space | ||
8448 | * info has super bytes accounted for, otherwise we'll think | ||
8449 | * we have more space than we actually do. | ||
8450 | */ | ||
8451 | exclude_super_stripes(root, cache); | ||
8452 | |||
8453 | /* | ||
8388 | * check for two cases, either we are full, and therefore | 8454 | * check for two cases, either we are full, and therefore |
8389 | * don't need to bother with the caching work since we won't | 8455 | * don't need to bother with the caching work since we won't |
8390 | * find any space, or we are empty, and we can just add all | 8456 | * find any space, or we are empty, and we can just add all |
@@ -8392,12 +8458,10 @@ int btrfs_read_block_groups(struct btrfs_root *root) | |||
8392 | * time, particularly in the full case. | 8458 | * time, particularly in the full case. |
8393 | */ | 8459 | */ |
8394 | if (found_key.offset == btrfs_block_group_used(&cache->item)) { | 8460 | if (found_key.offset == btrfs_block_group_used(&cache->item)) { |
8395 | exclude_super_stripes(root, cache); | ||
8396 | cache->last_byte_to_unpin = (u64)-1; | 8461 | cache->last_byte_to_unpin = (u64)-1; |
8397 | cache->cached = BTRFS_CACHE_FINISHED; | 8462 | cache->cached = BTRFS_CACHE_FINISHED; |
8398 | free_excluded_extents(root, cache); | 8463 | free_excluded_extents(root, cache); |
8399 | } else if (btrfs_block_group_used(&cache->item) == 0) { | 8464 | } else if (btrfs_block_group_used(&cache->item) == 0) { |
8400 | exclude_super_stripes(root, cache); | ||
8401 | cache->last_byte_to_unpin = (u64)-1; | 8465 | cache->last_byte_to_unpin = (u64)-1; |
8402 | cache->cached = BTRFS_CACHE_FINISHED; | 8466 | cache->cached = BTRFS_CACHE_FINISHED; |
8403 | add_new_free_space(cache, root->fs_info, | 8467 | add_new_free_space(cache, root->fs_info, |
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 2e993cf1766e..5e76a474cb7e 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c | |||
@@ -1865,7 +1865,7 @@ static int submit_one_bio(int rw, struct bio *bio, int mirror_num, | |||
1865 | bio_get(bio); | 1865 | bio_get(bio); |
1866 | 1866 | ||
1867 | if (tree->ops && tree->ops->submit_bio_hook) | 1867 | if (tree->ops && tree->ops->submit_bio_hook) |
1868 | tree->ops->submit_bio_hook(page->mapping->host, rw, bio, | 1868 | ret = tree->ops->submit_bio_hook(page->mapping->host, rw, bio, |
1869 | mirror_num, bio_flags, start); | 1869 | mirror_num, bio_flags, start); |
1870 | else | 1870 | else |
1871 | submit_bio(rw, bio); | 1871 | submit_bio(rw, bio); |
@@ -1920,6 +1920,8 @@ static int submit_extent_page(int rw, struct extent_io_tree *tree, | |||
1920 | nr = bio_get_nr_vecs(bdev); | 1920 | nr = bio_get_nr_vecs(bdev); |
1921 | 1921 | ||
1922 | bio = btrfs_bio_alloc(bdev, sector, nr, GFP_NOFS | __GFP_HIGH); | 1922 | bio = btrfs_bio_alloc(bdev, sector, nr, GFP_NOFS | __GFP_HIGH); |
1923 | if (!bio) | ||
1924 | return -ENOMEM; | ||
1923 | 1925 | ||
1924 | bio_add_page(bio, page, page_size, offset); | 1926 | bio_add_page(bio, page, page_size, offset); |
1925 | bio->bi_end_io = end_io_func; | 1927 | bio->bi_end_io = end_io_func; |
@@ -2126,7 +2128,7 @@ int extent_read_full_page(struct extent_io_tree *tree, struct page *page, | |||
2126 | ret = __extent_read_full_page(tree, page, get_extent, &bio, 0, | 2128 | ret = __extent_read_full_page(tree, page, get_extent, &bio, 0, |
2127 | &bio_flags); | 2129 | &bio_flags); |
2128 | if (bio) | 2130 | if (bio) |
2129 | submit_one_bio(READ, bio, 0, bio_flags); | 2131 | ret = submit_one_bio(READ, bio, 0, bio_flags); |
2130 | return ret; | 2132 | return ret; |
2131 | } | 2133 | } |
2132 | 2134 | ||
diff --git a/fs/btrfs/file-item.c b/fs/btrfs/file-item.c index a562a250ae77..4f19a3e1bf32 100644 --- a/fs/btrfs/file-item.c +++ b/fs/btrfs/file-item.c | |||
@@ -536,6 +536,8 @@ int btrfs_del_csums(struct btrfs_trans_handle *trans, | |||
536 | root = root->fs_info->csum_root; | 536 | root = root->fs_info->csum_root; |
537 | 537 | ||
538 | path = btrfs_alloc_path(); | 538 | path = btrfs_alloc_path(); |
539 | if (!path) | ||
540 | return -ENOMEM; | ||
539 | 541 | ||
540 | while (1) { | 542 | while (1) { |
541 | key.objectid = BTRFS_EXTENT_CSUM_OBJECTID; | 543 | key.objectid = BTRFS_EXTENT_CSUM_OBJECTID; |
@@ -548,7 +550,10 @@ int btrfs_del_csums(struct btrfs_trans_handle *trans, | |||
548 | if (path->slots[0] == 0) | 550 | if (path->slots[0] == 0) |
549 | goto out; | 551 | goto out; |
550 | path->slots[0]--; | 552 | path->slots[0]--; |
553 | } else if (ret < 0) { | ||
554 | goto out; | ||
551 | } | 555 | } |
556 | |||
552 | leaf = path->nodes[0]; | 557 | leaf = path->nodes[0]; |
553 | btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); | 558 | btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); |
554 | 559 | ||
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index c800d58f3013..c1d3a818731a 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c | |||
@@ -793,8 +793,12 @@ again: | |||
793 | for (i = 0; i < num_pages; i++) { | 793 | for (i = 0; i < num_pages; i++) { |
794 | pages[i] = grab_cache_page(inode->i_mapping, index + i); | 794 | pages[i] = grab_cache_page(inode->i_mapping, index + i); |
795 | if (!pages[i]) { | 795 | if (!pages[i]) { |
796 | err = -ENOMEM; | 796 | int c; |
797 | BUG_ON(1); | 797 | for (c = i - 1; c >= 0; c--) { |
798 | unlock_page(pages[c]); | ||
799 | page_cache_release(pages[c]); | ||
800 | } | ||
801 | return -ENOMEM; | ||
798 | } | 802 | } |
799 | wait_on_page_writeback(pages[i]); | 803 | wait_on_page_writeback(pages[i]); |
800 | } | 804 | } |
@@ -946,6 +950,10 @@ static ssize_t btrfs_file_aio_write(struct kiocb *iocb, | |||
946 | PAGE_CACHE_SIZE, PAGE_CACHE_SIZE / | 950 | PAGE_CACHE_SIZE, PAGE_CACHE_SIZE / |
947 | (sizeof(struct page *))); | 951 | (sizeof(struct page *))); |
948 | pages = kmalloc(nrptrs * sizeof(struct page *), GFP_KERNEL); | 952 | pages = kmalloc(nrptrs * sizeof(struct page *), GFP_KERNEL); |
953 | if (!pages) { | ||
954 | ret = -ENOMEM; | ||
955 | goto out; | ||
956 | } | ||
949 | 957 | ||
950 | /* generic_write_checks can change our pos */ | 958 | /* generic_write_checks can change our pos */ |
951 | start_pos = pos; | 959 | start_pos = pos; |
@@ -984,8 +992,8 @@ static ssize_t btrfs_file_aio_write(struct kiocb *iocb, | |||
984 | size_t write_bytes = min(iov_iter_count(&i), | 992 | size_t write_bytes = min(iov_iter_count(&i), |
985 | nrptrs * (size_t)PAGE_CACHE_SIZE - | 993 | nrptrs * (size_t)PAGE_CACHE_SIZE - |
986 | offset); | 994 | offset); |
987 | size_t num_pages = (write_bytes + PAGE_CACHE_SIZE - 1) >> | 995 | size_t num_pages = (write_bytes + offset + |
988 | PAGE_CACHE_SHIFT; | 996 | PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; |
989 | 997 | ||
990 | WARN_ON(num_pages > nrptrs); | 998 | WARN_ON(num_pages > nrptrs); |
991 | memset(pages, 0, sizeof(struct page *) * nrptrs); | 999 | memset(pages, 0, sizeof(struct page *) * nrptrs); |
@@ -1015,8 +1023,8 @@ static ssize_t btrfs_file_aio_write(struct kiocb *iocb, | |||
1015 | 1023 | ||
1016 | copied = btrfs_copy_from_user(pos, num_pages, | 1024 | copied = btrfs_copy_from_user(pos, num_pages, |
1017 | write_bytes, pages, &i); | 1025 | write_bytes, pages, &i); |
1018 | dirty_pages = (copied + PAGE_CACHE_SIZE - 1) >> | 1026 | dirty_pages = (copied + offset + PAGE_CACHE_SIZE - 1) >> |
1019 | PAGE_CACHE_SHIFT; | 1027 | PAGE_CACHE_SHIFT; |
1020 | 1028 | ||
1021 | if (num_pages > dirty_pages) { | 1029 | if (num_pages > dirty_pages) { |
1022 | if (copied > 0) | 1030 | if (copied > 0) |
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c index 60d684266959..a0390657451b 100644 --- a/fs/btrfs/free-space-cache.c +++ b/fs/btrfs/free-space-cache.c | |||
@@ -987,11 +987,18 @@ tree_search_offset(struct btrfs_block_group_cache *block_group, | |||
987 | return entry; | 987 | return entry; |
988 | } | 988 | } |
989 | 989 | ||
990 | static void unlink_free_space(struct btrfs_block_group_cache *block_group, | 990 | static inline void |
991 | struct btrfs_free_space *info) | 991 | __unlink_free_space(struct btrfs_block_group_cache *block_group, |
992 | struct btrfs_free_space *info) | ||
992 | { | 993 | { |
993 | rb_erase(&info->offset_index, &block_group->free_space_offset); | 994 | rb_erase(&info->offset_index, &block_group->free_space_offset); |
994 | block_group->free_extents--; | 995 | block_group->free_extents--; |
996 | } | ||
997 | |||
998 | static void unlink_free_space(struct btrfs_block_group_cache *block_group, | ||
999 | struct btrfs_free_space *info) | ||
1000 | { | ||
1001 | __unlink_free_space(block_group, info); | ||
995 | block_group->free_space -= info->bytes; | 1002 | block_group->free_space -= info->bytes; |
996 | } | 1003 | } |
997 | 1004 | ||
@@ -1016,14 +1023,18 @@ static void recalculate_thresholds(struct btrfs_block_group_cache *block_group) | |||
1016 | u64 max_bytes; | 1023 | u64 max_bytes; |
1017 | u64 bitmap_bytes; | 1024 | u64 bitmap_bytes; |
1018 | u64 extent_bytes; | 1025 | u64 extent_bytes; |
1026 | u64 size = block_group->key.offset; | ||
1019 | 1027 | ||
1020 | /* | 1028 | /* |
1021 | * The goal is to keep the total amount of memory used per 1gb of space | 1029 | * The goal is to keep the total amount of memory used per 1gb of space |
1022 | * at or below 32k, so we need to adjust how much memory we allow to be | 1030 | * at or below 32k, so we need to adjust how much memory we allow to be |
1023 | * used by extent based free space tracking | 1031 | * used by extent based free space tracking |
1024 | */ | 1032 | */ |
1025 | max_bytes = MAX_CACHE_BYTES_PER_GIG * | 1033 | if (size < 1024 * 1024 * 1024) |
1026 | (div64_u64(block_group->key.offset, 1024 * 1024 * 1024)); | 1034 | max_bytes = MAX_CACHE_BYTES_PER_GIG; |
1035 | else | ||
1036 | max_bytes = MAX_CACHE_BYTES_PER_GIG * | ||
1037 | div64_u64(size, 1024 * 1024 * 1024); | ||
1027 | 1038 | ||
1028 | /* | 1039 | /* |
1029 | * we want to account for 1 more bitmap than what we have so we can make | 1040 | * we want to account for 1 more bitmap than what we have so we can make |
@@ -1171,6 +1182,16 @@ static void add_new_bitmap(struct btrfs_block_group_cache *block_group, | |||
1171 | recalculate_thresholds(block_group); | 1182 | recalculate_thresholds(block_group); |
1172 | } | 1183 | } |
1173 | 1184 | ||
1185 | static void free_bitmap(struct btrfs_block_group_cache *block_group, | ||
1186 | struct btrfs_free_space *bitmap_info) | ||
1187 | { | ||
1188 | unlink_free_space(block_group, bitmap_info); | ||
1189 | kfree(bitmap_info->bitmap); | ||
1190 | kfree(bitmap_info); | ||
1191 | block_group->total_bitmaps--; | ||
1192 | recalculate_thresholds(block_group); | ||
1193 | } | ||
1194 | |||
1174 | static noinline int remove_from_bitmap(struct btrfs_block_group_cache *block_group, | 1195 | static noinline int remove_from_bitmap(struct btrfs_block_group_cache *block_group, |
1175 | struct btrfs_free_space *bitmap_info, | 1196 | struct btrfs_free_space *bitmap_info, |
1176 | u64 *offset, u64 *bytes) | 1197 | u64 *offset, u64 *bytes) |
@@ -1195,6 +1216,7 @@ again: | |||
1195 | */ | 1216 | */ |
1196 | search_start = *offset; | 1217 | search_start = *offset; |
1197 | search_bytes = *bytes; | 1218 | search_bytes = *bytes; |
1219 | search_bytes = min(search_bytes, end - search_start + 1); | ||
1198 | ret = search_bitmap(block_group, bitmap_info, &search_start, | 1220 | ret = search_bitmap(block_group, bitmap_info, &search_start, |
1199 | &search_bytes); | 1221 | &search_bytes); |
1200 | BUG_ON(ret < 0 || search_start != *offset); | 1222 | BUG_ON(ret < 0 || search_start != *offset); |
@@ -1211,13 +1233,8 @@ again: | |||
1211 | 1233 | ||
1212 | if (*bytes) { | 1234 | if (*bytes) { |
1213 | struct rb_node *next = rb_next(&bitmap_info->offset_index); | 1235 | struct rb_node *next = rb_next(&bitmap_info->offset_index); |
1214 | if (!bitmap_info->bytes) { | 1236 | if (!bitmap_info->bytes) |
1215 | unlink_free_space(block_group, bitmap_info); | 1237 | free_bitmap(block_group, bitmap_info); |
1216 | kfree(bitmap_info->bitmap); | ||
1217 | kfree(bitmap_info); | ||
1218 | block_group->total_bitmaps--; | ||
1219 | recalculate_thresholds(block_group); | ||
1220 | } | ||
1221 | 1238 | ||
1222 | /* | 1239 | /* |
1223 | * no entry after this bitmap, but we still have bytes to | 1240 | * no entry after this bitmap, but we still have bytes to |
@@ -1250,13 +1267,8 @@ again: | |||
1250 | return -EAGAIN; | 1267 | return -EAGAIN; |
1251 | 1268 | ||
1252 | goto again; | 1269 | goto again; |
1253 | } else if (!bitmap_info->bytes) { | 1270 | } else if (!bitmap_info->bytes) |
1254 | unlink_free_space(block_group, bitmap_info); | 1271 | free_bitmap(block_group, bitmap_info); |
1255 | kfree(bitmap_info->bitmap); | ||
1256 | kfree(bitmap_info); | ||
1257 | block_group->total_bitmaps--; | ||
1258 | recalculate_thresholds(block_group); | ||
1259 | } | ||
1260 | 1272 | ||
1261 | return 0; | 1273 | return 0; |
1262 | } | 1274 | } |
@@ -1359,22 +1371,14 @@ out: | |||
1359 | return ret; | 1371 | return ret; |
1360 | } | 1372 | } |
1361 | 1373 | ||
1362 | int btrfs_add_free_space(struct btrfs_block_group_cache *block_group, | 1374 | bool try_merge_free_space(struct btrfs_block_group_cache *block_group, |
1363 | u64 offset, u64 bytes) | 1375 | struct btrfs_free_space *info, bool update_stat) |
1364 | { | 1376 | { |
1365 | struct btrfs_free_space *right_info = NULL; | 1377 | struct btrfs_free_space *left_info; |
1366 | struct btrfs_free_space *left_info = NULL; | 1378 | struct btrfs_free_space *right_info; |
1367 | struct btrfs_free_space *info = NULL; | 1379 | bool merged = false; |
1368 | int ret = 0; | 1380 | u64 offset = info->offset; |
1369 | 1381 | u64 bytes = info->bytes; | |
1370 | info = kzalloc(sizeof(struct btrfs_free_space), GFP_NOFS); | ||
1371 | if (!info) | ||
1372 | return -ENOMEM; | ||
1373 | |||
1374 | info->offset = offset; | ||
1375 | info->bytes = bytes; | ||
1376 | |||
1377 | spin_lock(&block_group->tree_lock); | ||
1378 | 1382 | ||
1379 | /* | 1383 | /* |
1380 | * first we want to see if there is free space adjacent to the range we | 1384 | * first we want to see if there is free space adjacent to the range we |
@@ -1388,37 +1392,62 @@ int btrfs_add_free_space(struct btrfs_block_group_cache *block_group, | |||
1388 | else | 1392 | else |
1389 | left_info = tree_search_offset(block_group, offset - 1, 0, 0); | 1393 | left_info = tree_search_offset(block_group, offset - 1, 0, 0); |
1390 | 1394 | ||
1391 | /* | ||
1392 | * If there was no extent directly to the left or right of this new | ||
1393 | * extent then we know we're going to have to allocate a new extent, so | ||
1394 | * before we do that see if we need to drop this into a bitmap | ||
1395 | */ | ||
1396 | if ((!left_info || left_info->bitmap) && | ||
1397 | (!right_info || right_info->bitmap)) { | ||
1398 | ret = insert_into_bitmap(block_group, info); | ||
1399 | |||
1400 | if (ret < 0) { | ||
1401 | goto out; | ||
1402 | } else if (ret) { | ||
1403 | ret = 0; | ||
1404 | goto out; | ||
1405 | } | ||
1406 | } | ||
1407 | |||
1408 | if (right_info && !right_info->bitmap) { | 1395 | if (right_info && !right_info->bitmap) { |
1409 | unlink_free_space(block_group, right_info); | 1396 | if (update_stat) |
1397 | unlink_free_space(block_group, right_info); | ||
1398 | else | ||
1399 | __unlink_free_space(block_group, right_info); | ||
1410 | info->bytes += right_info->bytes; | 1400 | info->bytes += right_info->bytes; |
1411 | kfree(right_info); | 1401 | kfree(right_info); |
1402 | merged = true; | ||
1412 | } | 1403 | } |
1413 | 1404 | ||
1414 | if (left_info && !left_info->bitmap && | 1405 | if (left_info && !left_info->bitmap && |
1415 | left_info->offset + left_info->bytes == offset) { | 1406 | left_info->offset + left_info->bytes == offset) { |
1416 | unlink_free_space(block_group, left_info); | 1407 | if (update_stat) |
1408 | unlink_free_space(block_group, left_info); | ||
1409 | else | ||
1410 | __unlink_free_space(block_group, left_info); | ||
1417 | info->offset = left_info->offset; | 1411 | info->offset = left_info->offset; |
1418 | info->bytes += left_info->bytes; | 1412 | info->bytes += left_info->bytes; |
1419 | kfree(left_info); | 1413 | kfree(left_info); |
1414 | merged = true; | ||
1420 | } | 1415 | } |
1421 | 1416 | ||
1417 | return merged; | ||
1418 | } | ||
1419 | |||
1420 | int btrfs_add_free_space(struct btrfs_block_group_cache *block_group, | ||
1421 | u64 offset, u64 bytes) | ||
1422 | { | ||
1423 | struct btrfs_free_space *info; | ||
1424 | int ret = 0; | ||
1425 | |||
1426 | info = kzalloc(sizeof(struct btrfs_free_space), GFP_NOFS); | ||
1427 | if (!info) | ||
1428 | return -ENOMEM; | ||
1429 | |||
1430 | info->offset = offset; | ||
1431 | info->bytes = bytes; | ||
1432 | |||
1433 | spin_lock(&block_group->tree_lock); | ||
1434 | |||
1435 | if (try_merge_free_space(block_group, info, true)) | ||
1436 | goto link; | ||
1437 | |||
1438 | /* | ||
1439 | * There was no extent directly to the left or right of this new | ||
1440 | * extent then we know we're going to have to allocate a new extent, so | ||
1441 | * before we do that see if we need to drop this into a bitmap | ||
1442 | */ | ||
1443 | ret = insert_into_bitmap(block_group, info); | ||
1444 | if (ret < 0) { | ||
1445 | goto out; | ||
1446 | } else if (ret) { | ||
1447 | ret = 0; | ||
1448 | goto out; | ||
1449 | } | ||
1450 | link: | ||
1422 | ret = link_free_space(block_group, info); | 1451 | ret = link_free_space(block_group, info); |
1423 | if (ret) | 1452 | if (ret) |
1424 | kfree(info); | 1453 | kfree(info); |
@@ -1621,6 +1650,7 @@ __btrfs_return_cluster_to_free_space( | |||
1621 | node = rb_next(&entry->offset_index); | 1650 | node = rb_next(&entry->offset_index); |
1622 | rb_erase(&entry->offset_index, &cluster->root); | 1651 | rb_erase(&entry->offset_index, &cluster->root); |
1623 | BUG_ON(entry->bitmap); | 1652 | BUG_ON(entry->bitmap); |
1653 | try_merge_free_space(block_group, entry, false); | ||
1624 | tree_insert_offset(&block_group->free_space_offset, | 1654 | tree_insert_offset(&block_group->free_space_offset, |
1625 | entry->offset, &entry->offset_index, 0); | 1655 | entry->offset, &entry->offset_index, 0); |
1626 | } | 1656 | } |
@@ -1685,13 +1715,8 @@ u64 btrfs_find_space_for_alloc(struct btrfs_block_group_cache *block_group, | |||
1685 | ret = offset; | 1715 | ret = offset; |
1686 | if (entry->bitmap) { | 1716 | if (entry->bitmap) { |
1687 | bitmap_clear_bits(block_group, entry, offset, bytes); | 1717 | bitmap_clear_bits(block_group, entry, offset, bytes); |
1688 | if (!entry->bytes) { | 1718 | if (!entry->bytes) |
1689 | unlink_free_space(block_group, entry); | 1719 | free_bitmap(block_group, entry); |
1690 | kfree(entry->bitmap); | ||
1691 | kfree(entry); | ||
1692 | block_group->total_bitmaps--; | ||
1693 | recalculate_thresholds(block_group); | ||
1694 | } | ||
1695 | } else { | 1720 | } else { |
1696 | unlink_free_space(block_group, entry); | 1721 | unlink_free_space(block_group, entry); |
1697 | entry->offset += bytes; | 1722 | entry->offset += bytes; |
@@ -1789,6 +1814,8 @@ static u64 btrfs_alloc_from_bitmap(struct btrfs_block_group_cache *block_group, | |||
1789 | 1814 | ||
1790 | ret = search_start; | 1815 | ret = search_start; |
1791 | bitmap_clear_bits(block_group, entry, ret, bytes); | 1816 | bitmap_clear_bits(block_group, entry, ret, bytes); |
1817 | if (entry->bytes == 0) | ||
1818 | free_bitmap(block_group, entry); | ||
1792 | out: | 1819 | out: |
1793 | spin_unlock(&cluster->lock); | 1820 | spin_unlock(&cluster->lock); |
1794 | spin_unlock(&block_group->tree_lock); | 1821 | spin_unlock(&block_group->tree_lock); |
@@ -1842,15 +1869,26 @@ u64 btrfs_alloc_from_cluster(struct btrfs_block_group_cache *block_group, | |||
1842 | entry->offset += bytes; | 1869 | entry->offset += bytes; |
1843 | entry->bytes -= bytes; | 1870 | entry->bytes -= bytes; |
1844 | 1871 | ||
1845 | if (entry->bytes == 0) { | 1872 | if (entry->bytes == 0) |
1846 | rb_erase(&entry->offset_index, &cluster->root); | 1873 | rb_erase(&entry->offset_index, &cluster->root); |
1847 | kfree(entry); | ||
1848 | } | ||
1849 | break; | 1874 | break; |
1850 | } | 1875 | } |
1851 | out: | 1876 | out: |
1852 | spin_unlock(&cluster->lock); | 1877 | spin_unlock(&cluster->lock); |
1853 | 1878 | ||
1879 | if (!ret) | ||
1880 | return 0; | ||
1881 | |||
1882 | spin_lock(&block_group->tree_lock); | ||
1883 | |||
1884 | block_group->free_space -= bytes; | ||
1885 | if (entry->bytes == 0) { | ||
1886 | block_group->free_extents--; | ||
1887 | kfree(entry); | ||
1888 | } | ||
1889 | |||
1890 | spin_unlock(&block_group->tree_lock); | ||
1891 | |||
1854 | return ret; | 1892 | return ret; |
1855 | } | 1893 | } |
1856 | 1894 | ||
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 160b55b3e132..bcc461a9695f 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -416,7 +416,7 @@ again: | |||
416 | } | 416 | } |
417 | if (start == 0) { | 417 | if (start == 0) { |
418 | trans = btrfs_join_transaction(root, 1); | 418 | trans = btrfs_join_transaction(root, 1); |
419 | BUG_ON(!trans); | 419 | BUG_ON(IS_ERR(trans)); |
420 | btrfs_set_trans_block_group(trans, inode); | 420 | btrfs_set_trans_block_group(trans, inode); |
421 | trans->block_rsv = &root->fs_info->delalloc_block_rsv; | 421 | trans->block_rsv = &root->fs_info->delalloc_block_rsv; |
422 | 422 | ||
@@ -612,6 +612,7 @@ retry: | |||
612 | GFP_NOFS); | 612 | GFP_NOFS); |
613 | 613 | ||
614 | trans = btrfs_join_transaction(root, 1); | 614 | trans = btrfs_join_transaction(root, 1); |
615 | BUG_ON(IS_ERR(trans)); | ||
615 | ret = btrfs_reserve_extent(trans, root, | 616 | ret = btrfs_reserve_extent(trans, root, |
616 | async_extent->compressed_size, | 617 | async_extent->compressed_size, |
617 | async_extent->compressed_size, | 618 | async_extent->compressed_size, |
@@ -771,7 +772,7 @@ static noinline int cow_file_range(struct inode *inode, | |||
771 | 772 | ||
772 | BUG_ON(root == root->fs_info->tree_root); | 773 | BUG_ON(root == root->fs_info->tree_root); |
773 | trans = btrfs_join_transaction(root, 1); | 774 | trans = btrfs_join_transaction(root, 1); |
774 | BUG_ON(!trans); | 775 | BUG_ON(IS_ERR(trans)); |
775 | btrfs_set_trans_block_group(trans, inode); | 776 | btrfs_set_trans_block_group(trans, inode); |
776 | trans->block_rsv = &root->fs_info->delalloc_block_rsv; | 777 | trans->block_rsv = &root->fs_info->delalloc_block_rsv; |
777 | 778 | ||
@@ -1049,7 +1050,7 @@ static noinline int run_delalloc_nocow(struct inode *inode, | |||
1049 | } else { | 1050 | } else { |
1050 | trans = btrfs_join_transaction(root, 1); | 1051 | trans = btrfs_join_transaction(root, 1); |
1051 | } | 1052 | } |
1052 | BUG_ON(!trans); | 1053 | BUG_ON(IS_ERR(trans)); |
1053 | 1054 | ||
1054 | cow_start = (u64)-1; | 1055 | cow_start = (u64)-1; |
1055 | cur_offset = start; | 1056 | cur_offset = start; |
@@ -1557,6 +1558,7 @@ out: | |||
1557 | out_page: | 1558 | out_page: |
1558 | unlock_page(page); | 1559 | unlock_page(page); |
1559 | page_cache_release(page); | 1560 | page_cache_release(page); |
1561 | kfree(fixup); | ||
1560 | } | 1562 | } |
1561 | 1563 | ||
1562 | /* | 1564 | /* |
@@ -1703,7 +1705,7 @@ static int btrfs_finish_ordered_io(struct inode *inode, u64 start, u64 end) | |||
1703 | trans = btrfs_join_transaction_nolock(root, 1); | 1705 | trans = btrfs_join_transaction_nolock(root, 1); |
1704 | else | 1706 | else |
1705 | trans = btrfs_join_transaction(root, 1); | 1707 | trans = btrfs_join_transaction(root, 1); |
1706 | BUG_ON(!trans); | 1708 | BUG_ON(IS_ERR(trans)); |
1707 | btrfs_set_trans_block_group(trans, inode); | 1709 | btrfs_set_trans_block_group(trans, inode); |
1708 | trans->block_rsv = &root->fs_info->delalloc_block_rsv; | 1710 | trans->block_rsv = &root->fs_info->delalloc_block_rsv; |
1709 | ret = btrfs_update_inode(trans, root, inode); | 1711 | ret = btrfs_update_inode(trans, root, inode); |
@@ -1720,6 +1722,7 @@ static int btrfs_finish_ordered_io(struct inode *inode, u64 start, u64 end) | |||
1720 | trans = btrfs_join_transaction_nolock(root, 1); | 1722 | trans = btrfs_join_transaction_nolock(root, 1); |
1721 | else | 1723 | else |
1722 | trans = btrfs_join_transaction(root, 1); | 1724 | trans = btrfs_join_transaction(root, 1); |
1725 | BUG_ON(IS_ERR(trans)); | ||
1723 | btrfs_set_trans_block_group(trans, inode); | 1726 | btrfs_set_trans_block_group(trans, inode); |
1724 | trans->block_rsv = &root->fs_info->delalloc_block_rsv; | 1727 | trans->block_rsv = &root->fs_info->delalloc_block_rsv; |
1725 | 1728 | ||
@@ -2354,6 +2357,7 @@ void btrfs_orphan_cleanup(struct btrfs_root *root) | |||
2354 | */ | 2357 | */ |
2355 | if (is_bad_inode(inode)) { | 2358 | if (is_bad_inode(inode)) { |
2356 | trans = btrfs_start_transaction(root, 0); | 2359 | trans = btrfs_start_transaction(root, 0); |
2360 | BUG_ON(IS_ERR(trans)); | ||
2357 | btrfs_orphan_del(trans, inode); | 2361 | btrfs_orphan_del(trans, inode); |
2358 | btrfs_end_transaction(trans, root); | 2362 | btrfs_end_transaction(trans, root); |
2359 | iput(inode); | 2363 | iput(inode); |
@@ -2381,6 +2385,7 @@ void btrfs_orphan_cleanup(struct btrfs_root *root) | |||
2381 | 2385 | ||
2382 | if (root->orphan_block_rsv || root->orphan_item_inserted) { | 2386 | if (root->orphan_block_rsv || root->orphan_item_inserted) { |
2383 | trans = btrfs_join_transaction(root, 1); | 2387 | trans = btrfs_join_transaction(root, 1); |
2388 | BUG_ON(IS_ERR(trans)); | ||
2384 | btrfs_end_transaction(trans, root); | 2389 | btrfs_end_transaction(trans, root); |
2385 | } | 2390 | } |
2386 | 2391 | ||
@@ -2641,7 +2646,7 @@ int btrfs_unlink_inode(struct btrfs_trans_handle *trans, | |||
2641 | path = btrfs_alloc_path(); | 2646 | path = btrfs_alloc_path(); |
2642 | if (!path) { | 2647 | if (!path) { |
2643 | ret = -ENOMEM; | 2648 | ret = -ENOMEM; |
2644 | goto err; | 2649 | goto out; |
2645 | } | 2650 | } |
2646 | 2651 | ||
2647 | path->leave_spinning = 1; | 2652 | path->leave_spinning = 1; |
@@ -2714,9 +2719,10 @@ static int check_path_shared(struct btrfs_root *root, | |||
2714 | struct extent_buffer *eb; | 2719 | struct extent_buffer *eb; |
2715 | int level; | 2720 | int level; |
2716 | u64 refs = 1; | 2721 | u64 refs = 1; |
2717 | int uninitialized_var(ret); | ||
2718 | 2722 | ||
2719 | for (level = 0; level < BTRFS_MAX_LEVEL; level++) { | 2723 | for (level = 0; level < BTRFS_MAX_LEVEL; level++) { |
2724 | int ret; | ||
2725 | |||
2720 | if (!path->nodes[level]) | 2726 | if (!path->nodes[level]) |
2721 | break; | 2727 | break; |
2722 | eb = path->nodes[level]; | 2728 | eb = path->nodes[level]; |
@@ -2727,7 +2733,7 @@ static int check_path_shared(struct btrfs_root *root, | |||
2727 | if (refs > 1) | 2733 | if (refs > 1) |
2728 | return 1; | 2734 | return 1; |
2729 | } | 2735 | } |
2730 | return ret; /* XXX callers? */ | 2736 | return 0; |
2731 | } | 2737 | } |
2732 | 2738 | ||
2733 | /* | 2739 | /* |
@@ -4134,7 +4140,7 @@ struct inode *btrfs_lookup_dentry(struct inode *dir, struct dentry *dentry) | |||
4134 | } | 4140 | } |
4135 | srcu_read_unlock(&root->fs_info->subvol_srcu, index); | 4141 | srcu_read_unlock(&root->fs_info->subvol_srcu, index); |
4136 | 4142 | ||
4137 | if (root != sub_root) { | 4143 | if (!IS_ERR(inode) && root != sub_root) { |
4138 | down_read(&root->fs_info->cleanup_work_sem); | 4144 | down_read(&root->fs_info->cleanup_work_sem); |
4139 | if (!(inode->i_sb->s_flags & MS_RDONLY)) | 4145 | if (!(inode->i_sb->s_flags & MS_RDONLY)) |
4140 | btrfs_orphan_cleanup(sub_root); | 4146 | btrfs_orphan_cleanup(sub_root); |
@@ -4347,6 +4353,8 @@ int btrfs_write_inode(struct inode *inode, struct writeback_control *wbc) | |||
4347 | trans = btrfs_join_transaction_nolock(root, 1); | 4353 | trans = btrfs_join_transaction_nolock(root, 1); |
4348 | else | 4354 | else |
4349 | trans = btrfs_join_transaction(root, 1); | 4355 | trans = btrfs_join_transaction(root, 1); |
4356 | if (IS_ERR(trans)) | ||
4357 | return PTR_ERR(trans); | ||
4350 | btrfs_set_trans_block_group(trans, inode); | 4358 | btrfs_set_trans_block_group(trans, inode); |
4351 | if (nolock) | 4359 | if (nolock) |
4352 | ret = btrfs_end_transaction_nolock(trans, root); | 4360 | ret = btrfs_end_transaction_nolock(trans, root); |
@@ -4372,6 +4380,7 @@ void btrfs_dirty_inode(struct inode *inode) | |||
4372 | return; | 4380 | return; |
4373 | 4381 | ||
4374 | trans = btrfs_join_transaction(root, 1); | 4382 | trans = btrfs_join_transaction(root, 1); |
4383 | BUG_ON(IS_ERR(trans)); | ||
4375 | btrfs_set_trans_block_group(trans, inode); | 4384 | btrfs_set_trans_block_group(trans, inode); |
4376 | 4385 | ||
4377 | ret = btrfs_update_inode(trans, root, inode); | 4386 | ret = btrfs_update_inode(trans, root, inode); |
@@ -5176,6 +5185,8 @@ again: | |||
5176 | em = NULL; | 5185 | em = NULL; |
5177 | btrfs_release_path(root, path); | 5186 | btrfs_release_path(root, path); |
5178 | trans = btrfs_join_transaction(root, 1); | 5187 | trans = btrfs_join_transaction(root, 1); |
5188 | if (IS_ERR(trans)) | ||
5189 | return ERR_CAST(trans); | ||
5179 | goto again; | 5190 | goto again; |
5180 | } | 5191 | } |
5181 | map = kmap(page); | 5192 | map = kmap(page); |
@@ -5280,8 +5291,8 @@ static struct extent_map *btrfs_new_extent_direct(struct inode *inode, | |||
5280 | btrfs_drop_extent_cache(inode, start, start + len - 1, 0); | 5291 | btrfs_drop_extent_cache(inode, start, start + len - 1, 0); |
5281 | 5292 | ||
5282 | trans = btrfs_join_transaction(root, 0); | 5293 | trans = btrfs_join_transaction(root, 0); |
5283 | if (!trans) | 5294 | if (IS_ERR(trans)) |
5284 | return ERR_PTR(-ENOMEM); | 5295 | return ERR_CAST(trans); |
5285 | 5296 | ||
5286 | trans->block_rsv = &root->fs_info->delalloc_block_rsv; | 5297 | trans->block_rsv = &root->fs_info->delalloc_block_rsv; |
5287 | 5298 | ||
@@ -5505,7 +5516,7 @@ static int btrfs_get_blocks_direct(struct inode *inode, sector_t iblock, | |||
5505 | * while we look for nocow cross refs | 5516 | * while we look for nocow cross refs |
5506 | */ | 5517 | */ |
5507 | trans = btrfs_join_transaction(root, 0); | 5518 | trans = btrfs_join_transaction(root, 0); |
5508 | if (!trans) | 5519 | if (IS_ERR(trans)) |
5509 | goto must_cow; | 5520 | goto must_cow; |
5510 | 5521 | ||
5511 | if (can_nocow_odirect(trans, inode, start, len) == 1) { | 5522 | if (can_nocow_odirect(trans, inode, start, len) == 1) { |
@@ -5640,7 +5651,7 @@ again: | |||
5640 | BUG_ON(!ordered); | 5651 | BUG_ON(!ordered); |
5641 | 5652 | ||
5642 | trans = btrfs_join_transaction(root, 1); | 5653 | trans = btrfs_join_transaction(root, 1); |
5643 | if (!trans) { | 5654 | if (IS_ERR(trans)) { |
5644 | err = -ENOMEM; | 5655 | err = -ENOMEM; |
5645 | goto out; | 5656 | goto out; |
5646 | } | 5657 | } |
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index a506a22b522a..02d224e8c83f 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
@@ -203,7 +203,7 @@ static int btrfs_ioctl_setflags(struct file *file, void __user *arg) | |||
203 | 203 | ||
204 | 204 | ||
205 | trans = btrfs_join_transaction(root, 1); | 205 | trans = btrfs_join_transaction(root, 1); |
206 | BUG_ON(!trans); | 206 | BUG_ON(IS_ERR(trans)); |
207 | 207 | ||
208 | ret = btrfs_update_inode(trans, root, inode); | 208 | ret = btrfs_update_inode(trans, root, inode); |
209 | BUG_ON(ret); | 209 | BUG_ON(ret); |
@@ -907,6 +907,10 @@ static noinline int btrfs_ioctl_resize(struct btrfs_root *root, | |||
907 | 907 | ||
908 | if (new_size > old_size) { | 908 | if (new_size > old_size) { |
909 | trans = btrfs_start_transaction(root, 0); | 909 | trans = btrfs_start_transaction(root, 0); |
910 | if (IS_ERR(trans)) { | ||
911 | ret = PTR_ERR(trans); | ||
912 | goto out_unlock; | ||
913 | } | ||
910 | ret = btrfs_grow_device(trans, device, new_size); | 914 | ret = btrfs_grow_device(trans, device, new_size); |
911 | btrfs_commit_transaction(trans, root); | 915 | btrfs_commit_transaction(trans, root); |
912 | } else { | 916 | } else { |
@@ -1898,7 +1902,10 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd, | |||
1898 | 1902 | ||
1899 | memcpy(&new_key, &key, sizeof(new_key)); | 1903 | memcpy(&new_key, &key, sizeof(new_key)); |
1900 | new_key.objectid = inode->i_ino; | 1904 | new_key.objectid = inode->i_ino; |
1901 | new_key.offset = key.offset + destoff - off; | 1905 | if (off <= key.offset) |
1906 | new_key.offset = key.offset + destoff - off; | ||
1907 | else | ||
1908 | new_key.offset = destoff; | ||
1902 | 1909 | ||
1903 | trans = btrfs_start_transaction(root, 1); | 1910 | trans = btrfs_start_transaction(root, 1); |
1904 | if (IS_ERR(trans)) { | 1911 | if (IS_ERR(trans)) { |
@@ -2082,7 +2089,7 @@ static long btrfs_ioctl_trans_start(struct file *file) | |||
2082 | 2089 | ||
2083 | ret = -ENOMEM; | 2090 | ret = -ENOMEM; |
2084 | trans = btrfs_start_ioctl_transaction(root, 0); | 2091 | trans = btrfs_start_ioctl_transaction(root, 0); |
2085 | if (!trans) | 2092 | if (IS_ERR(trans)) |
2086 | goto out_drop; | 2093 | goto out_drop; |
2087 | 2094 | ||
2088 | file->private_data = trans; | 2095 | file->private_data = trans; |
@@ -2138,9 +2145,9 @@ static long btrfs_ioctl_default_subvol(struct file *file, void __user *argp) | |||
2138 | path->leave_spinning = 1; | 2145 | path->leave_spinning = 1; |
2139 | 2146 | ||
2140 | trans = btrfs_start_transaction(root, 1); | 2147 | trans = btrfs_start_transaction(root, 1); |
2141 | if (!trans) { | 2148 | if (IS_ERR(trans)) { |
2142 | btrfs_free_path(path); | 2149 | btrfs_free_path(path); |
2143 | return -ENOMEM; | 2150 | return PTR_ERR(trans); |
2144 | } | 2151 | } |
2145 | 2152 | ||
2146 | dir_id = btrfs_super_root_dir(&root->fs_info->super_copy); | 2153 | dir_id = btrfs_super_root_dir(&root->fs_info->super_copy); |
@@ -2334,6 +2341,8 @@ static noinline long btrfs_ioctl_start_sync(struct file *file, void __user *argp | |||
2334 | u64 transid; | 2341 | u64 transid; |
2335 | 2342 | ||
2336 | trans = btrfs_start_transaction(root, 0); | 2343 | trans = btrfs_start_transaction(root, 0); |
2344 | if (IS_ERR(trans)) | ||
2345 | return PTR_ERR(trans); | ||
2337 | transid = trans->transid; | 2346 | transid = trans->transid; |
2338 | btrfs_commit_transaction_async(trans, root, 0); | 2347 | btrfs_commit_transaction_async(trans, root, 0); |
2339 | 2348 | ||
diff --git a/fs/btrfs/ordered-data.c b/fs/btrfs/ordered-data.c index 2b61e1ddcd99..083a55477375 100644 --- a/fs/btrfs/ordered-data.c +++ b/fs/btrfs/ordered-data.c | |||
@@ -141,7 +141,7 @@ static inline struct rb_node *tree_search(struct btrfs_ordered_inode_tree *tree, | |||
141 | u64 file_offset) | 141 | u64 file_offset) |
142 | { | 142 | { |
143 | struct rb_root *root = &tree->tree; | 143 | struct rb_root *root = &tree->tree; |
144 | struct rb_node *prev; | 144 | struct rb_node *prev = NULL; |
145 | struct rb_node *ret; | 145 | struct rb_node *ret; |
146 | struct btrfs_ordered_extent *entry; | 146 | struct btrfs_ordered_extent *entry; |
147 | 147 | ||
diff --git a/fs/btrfs/print-tree.c b/fs/btrfs/print-tree.c index 0d126be22b63..fb2605d998e9 100644 --- a/fs/btrfs/print-tree.c +++ b/fs/btrfs/print-tree.c | |||
@@ -260,6 +260,7 @@ void btrfs_print_leaf(struct btrfs_root *root, struct extent_buffer *l) | |||
260 | #else | 260 | #else |
261 | BUG(); | 261 | BUG(); |
262 | #endif | 262 | #endif |
263 | break; | ||
263 | case BTRFS_BLOCK_GROUP_ITEM_KEY: | 264 | case BTRFS_BLOCK_GROUP_ITEM_KEY: |
264 | bi = btrfs_item_ptr(l, i, | 265 | bi = btrfs_item_ptr(l, i, |
265 | struct btrfs_block_group_item); | 266 | struct btrfs_block_group_item); |
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index 045c9c2b2d7e..1f5556acb530 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c | |||
@@ -2028,6 +2028,7 @@ static noinline_for_stack int merge_reloc_root(struct reloc_control *rc, | |||
2028 | 2028 | ||
2029 | while (1) { | 2029 | while (1) { |
2030 | trans = btrfs_start_transaction(root, 0); | 2030 | trans = btrfs_start_transaction(root, 0); |
2031 | BUG_ON(IS_ERR(trans)); | ||
2031 | trans->block_rsv = rc->block_rsv; | 2032 | trans->block_rsv = rc->block_rsv; |
2032 | 2033 | ||
2033 | ret = btrfs_block_rsv_check(trans, root, rc->block_rsv, | 2034 | ret = btrfs_block_rsv_check(trans, root, rc->block_rsv, |
@@ -2147,6 +2148,12 @@ again: | |||
2147 | } | 2148 | } |
2148 | 2149 | ||
2149 | trans = btrfs_join_transaction(rc->extent_root, 1); | 2150 | trans = btrfs_join_transaction(rc->extent_root, 1); |
2151 | if (IS_ERR(trans)) { | ||
2152 | if (!err) | ||
2153 | btrfs_block_rsv_release(rc->extent_root, | ||
2154 | rc->block_rsv, num_bytes); | ||
2155 | return PTR_ERR(trans); | ||
2156 | } | ||
2150 | 2157 | ||
2151 | if (!err) { | 2158 | if (!err) { |
2152 | if (num_bytes != rc->merging_rsv_size) { | 2159 | if (num_bytes != rc->merging_rsv_size) { |
@@ -3222,6 +3229,7 @@ truncate: | |||
3222 | trans = btrfs_join_transaction(root, 0); | 3229 | trans = btrfs_join_transaction(root, 0); |
3223 | if (IS_ERR(trans)) { | 3230 | if (IS_ERR(trans)) { |
3224 | btrfs_free_path(path); | 3231 | btrfs_free_path(path); |
3232 | ret = PTR_ERR(trans); | ||
3225 | goto out; | 3233 | goto out; |
3226 | } | 3234 | } |
3227 | 3235 | ||
@@ -3628,6 +3636,7 @@ int prepare_to_relocate(struct reloc_control *rc) | |||
3628 | set_reloc_control(rc); | 3636 | set_reloc_control(rc); |
3629 | 3637 | ||
3630 | trans = btrfs_join_transaction(rc->extent_root, 1); | 3638 | trans = btrfs_join_transaction(rc->extent_root, 1); |
3639 | BUG_ON(IS_ERR(trans)); | ||
3631 | btrfs_commit_transaction(trans, rc->extent_root); | 3640 | btrfs_commit_transaction(trans, rc->extent_root); |
3632 | return 0; | 3641 | return 0; |
3633 | } | 3642 | } |
@@ -3657,6 +3666,7 @@ static noinline_for_stack int relocate_block_group(struct reloc_control *rc) | |||
3657 | 3666 | ||
3658 | while (1) { | 3667 | while (1) { |
3659 | trans = btrfs_start_transaction(rc->extent_root, 0); | 3668 | trans = btrfs_start_transaction(rc->extent_root, 0); |
3669 | BUG_ON(IS_ERR(trans)); | ||
3660 | 3670 | ||
3661 | if (update_backref_cache(trans, &rc->backref_cache)) { | 3671 | if (update_backref_cache(trans, &rc->backref_cache)) { |
3662 | btrfs_end_transaction(trans, rc->extent_root); | 3672 | btrfs_end_transaction(trans, rc->extent_root); |
@@ -3804,7 +3814,10 @@ static noinline_for_stack int relocate_block_group(struct reloc_control *rc) | |||
3804 | 3814 | ||
3805 | /* get rid of pinned extents */ | 3815 | /* get rid of pinned extents */ |
3806 | trans = btrfs_join_transaction(rc->extent_root, 1); | 3816 | trans = btrfs_join_transaction(rc->extent_root, 1); |
3807 | btrfs_commit_transaction(trans, rc->extent_root); | 3817 | if (IS_ERR(trans)) |
3818 | err = PTR_ERR(trans); | ||
3819 | else | ||
3820 | btrfs_commit_transaction(trans, rc->extent_root); | ||
3808 | out_free: | 3821 | out_free: |
3809 | btrfs_free_block_rsv(rc->extent_root, rc->block_rsv); | 3822 | btrfs_free_block_rsv(rc->extent_root, rc->block_rsv); |
3810 | btrfs_free_path(path); | 3823 | btrfs_free_path(path); |
@@ -4022,6 +4035,7 @@ static noinline_for_stack int mark_garbage_root(struct btrfs_root *root) | |||
4022 | int ret; | 4035 | int ret; |
4023 | 4036 | ||
4024 | trans = btrfs_start_transaction(root->fs_info->tree_root, 0); | 4037 | trans = btrfs_start_transaction(root->fs_info->tree_root, 0); |
4038 | BUG_ON(IS_ERR(trans)); | ||
4025 | 4039 | ||
4026 | memset(&root->root_item.drop_progress, 0, | 4040 | memset(&root->root_item.drop_progress, 0, |
4027 | sizeof(root->root_item.drop_progress)); | 4041 | sizeof(root->root_item.drop_progress)); |
@@ -4125,6 +4139,11 @@ int btrfs_recover_relocation(struct btrfs_root *root) | |||
4125 | set_reloc_control(rc); | 4139 | set_reloc_control(rc); |
4126 | 4140 | ||
4127 | trans = btrfs_join_transaction(rc->extent_root, 1); | 4141 | trans = btrfs_join_transaction(rc->extent_root, 1); |
4142 | if (IS_ERR(trans)) { | ||
4143 | unset_reloc_control(rc); | ||
4144 | err = PTR_ERR(trans); | ||
4145 | goto out_free; | ||
4146 | } | ||
4128 | 4147 | ||
4129 | rc->merge_reloc_tree = 1; | 4148 | rc->merge_reloc_tree = 1; |
4130 | 4149 | ||
@@ -4154,9 +4173,13 @@ int btrfs_recover_relocation(struct btrfs_root *root) | |||
4154 | unset_reloc_control(rc); | 4173 | unset_reloc_control(rc); |
4155 | 4174 | ||
4156 | trans = btrfs_join_transaction(rc->extent_root, 1); | 4175 | trans = btrfs_join_transaction(rc->extent_root, 1); |
4157 | btrfs_commit_transaction(trans, rc->extent_root); | 4176 | if (IS_ERR(trans)) |
4158 | out: | 4177 | err = PTR_ERR(trans); |
4178 | else | ||
4179 | btrfs_commit_transaction(trans, rc->extent_root); | ||
4180 | out_free: | ||
4159 | kfree(rc); | 4181 | kfree(rc); |
4182 | out: | ||
4160 | while (!list_empty(&reloc_roots)) { | 4183 | while (!list_empty(&reloc_roots)) { |
4161 | reloc_root = list_entry(reloc_roots.next, | 4184 | reloc_root = list_entry(reloc_roots.next, |
4162 | struct btrfs_root, root_list); | 4185 | struct btrfs_root, root_list); |
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index b2130c46fdb5..a004008f7d28 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c | |||
@@ -383,7 +383,7 @@ static int btrfs_parse_early_options(const char *options, fmode_t flags, | |||
383 | struct btrfs_fs_devices **fs_devices) | 383 | struct btrfs_fs_devices **fs_devices) |
384 | { | 384 | { |
385 | substring_t args[MAX_OPT_ARGS]; | 385 | substring_t args[MAX_OPT_ARGS]; |
386 | char *opts, *p; | 386 | char *opts, *orig, *p; |
387 | int error = 0; | 387 | int error = 0; |
388 | int intarg; | 388 | int intarg; |
389 | 389 | ||
@@ -397,6 +397,7 @@ static int btrfs_parse_early_options(const char *options, fmode_t flags, | |||
397 | opts = kstrdup(options, GFP_KERNEL); | 397 | opts = kstrdup(options, GFP_KERNEL); |
398 | if (!opts) | 398 | if (!opts) |
399 | return -ENOMEM; | 399 | return -ENOMEM; |
400 | orig = opts; | ||
400 | 401 | ||
401 | while ((p = strsep(&opts, ",")) != NULL) { | 402 | while ((p = strsep(&opts, ",")) != NULL) { |
402 | int token; | 403 | int token; |
@@ -432,7 +433,7 @@ static int btrfs_parse_early_options(const char *options, fmode_t flags, | |||
432 | } | 433 | } |
433 | 434 | ||
434 | out_free_opts: | 435 | out_free_opts: |
435 | kfree(opts); | 436 | kfree(orig); |
436 | out: | 437 | out: |
437 | /* | 438 | /* |
438 | * If no subvolume name is specified we use the default one. Allocate | 439 | * If no subvolume name is specified we use the default one. Allocate |
@@ -623,6 +624,8 @@ int btrfs_sync_fs(struct super_block *sb, int wait) | |||
623 | btrfs_wait_ordered_extents(root, 0, 0); | 624 | btrfs_wait_ordered_extents(root, 0, 0); |
624 | 625 | ||
625 | trans = btrfs_start_transaction(root, 0); | 626 | trans = btrfs_start_transaction(root, 0); |
627 | if (IS_ERR(trans)) | ||
628 | return PTR_ERR(trans); | ||
626 | ret = btrfs_commit_transaction(trans, root); | 629 | ret = btrfs_commit_transaction(trans, root); |
627 | return ret; | 630 | return ret; |
628 | } | 631 | } |
@@ -761,6 +764,8 @@ static struct dentry *btrfs_mount(struct file_system_type *fs_type, int flags, | |||
761 | } | 764 | } |
762 | 765 | ||
763 | btrfs_close_devices(fs_devices); | 766 | btrfs_close_devices(fs_devices); |
767 | kfree(fs_info); | ||
768 | kfree(tree_root); | ||
764 | } else { | 769 | } else { |
765 | char b[BDEVNAME_SIZE]; | 770 | char b[BDEVNAME_SIZE]; |
766 | 771 | ||
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index bae5c7b8bbe2..3d73c8d93bbb 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c | |||
@@ -1161,6 +1161,11 @@ int btrfs_commit_transaction_async(struct btrfs_trans_handle *trans, | |||
1161 | INIT_DELAYED_WORK(&ac->work, do_async_commit); | 1161 | INIT_DELAYED_WORK(&ac->work, do_async_commit); |
1162 | ac->root = root; | 1162 | ac->root = root; |
1163 | ac->newtrans = btrfs_join_transaction(root, 0); | 1163 | ac->newtrans = btrfs_join_transaction(root, 0); |
1164 | if (IS_ERR(ac->newtrans)) { | ||
1165 | int err = PTR_ERR(ac->newtrans); | ||
1166 | kfree(ac); | ||
1167 | return err; | ||
1168 | } | ||
1164 | 1169 | ||
1165 | /* take transaction reference */ | 1170 | /* take transaction reference */ |
1166 | mutex_lock(&root->fs_info->trans_mutex); | 1171 | mutex_lock(&root->fs_info->trans_mutex); |
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index 054744ac5719..a4bbb854dfd2 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c | |||
@@ -338,6 +338,12 @@ static noinline int overwrite_item(struct btrfs_trans_handle *trans, | |||
338 | } | 338 | } |
339 | dst_copy = kmalloc(item_size, GFP_NOFS); | 339 | dst_copy = kmalloc(item_size, GFP_NOFS); |
340 | src_copy = kmalloc(item_size, GFP_NOFS); | 340 | src_copy = kmalloc(item_size, GFP_NOFS); |
341 | if (!dst_copy || !src_copy) { | ||
342 | btrfs_release_path(root, path); | ||
343 | kfree(dst_copy); | ||
344 | kfree(src_copy); | ||
345 | return -ENOMEM; | ||
346 | } | ||
341 | 347 | ||
342 | read_extent_buffer(eb, src_copy, src_ptr, item_size); | 348 | read_extent_buffer(eb, src_copy, src_ptr, item_size); |
343 | 349 | ||
@@ -665,6 +671,9 @@ static noinline int drop_one_dir_item(struct btrfs_trans_handle *trans, | |||
665 | btrfs_dir_item_key_to_cpu(leaf, di, &location); | 671 | btrfs_dir_item_key_to_cpu(leaf, di, &location); |
666 | name_len = btrfs_dir_name_len(leaf, di); | 672 | name_len = btrfs_dir_name_len(leaf, di); |
667 | name = kmalloc(name_len, GFP_NOFS); | 673 | name = kmalloc(name_len, GFP_NOFS); |
674 | if (!name) | ||
675 | return -ENOMEM; | ||
676 | |||
668 | read_extent_buffer(leaf, name, (unsigned long)(di + 1), name_len); | 677 | read_extent_buffer(leaf, name, (unsigned long)(di + 1), name_len); |
669 | btrfs_release_path(root, path); | 678 | btrfs_release_path(root, path); |
670 | 679 | ||
@@ -744,6 +753,9 @@ static noinline int backref_in_log(struct btrfs_root *log, | |||
744 | int match = 0; | 753 | int match = 0; |
745 | 754 | ||
746 | path = btrfs_alloc_path(); | 755 | path = btrfs_alloc_path(); |
756 | if (!path) | ||
757 | return -ENOMEM; | ||
758 | |||
747 | ret = btrfs_search_slot(NULL, log, key, path, 0, 0); | 759 | ret = btrfs_search_slot(NULL, log, key, path, 0, 0); |
748 | if (ret != 0) | 760 | if (ret != 0) |
749 | goto out; | 761 | goto out; |
@@ -967,6 +979,8 @@ static noinline int fixup_inode_link_count(struct btrfs_trans_handle *trans, | |||
967 | key.offset = (u64)-1; | 979 | key.offset = (u64)-1; |
968 | 980 | ||
969 | path = btrfs_alloc_path(); | 981 | path = btrfs_alloc_path(); |
982 | if (!path) | ||
983 | return -ENOMEM; | ||
970 | 984 | ||
971 | while (1) { | 985 | while (1) { |
972 | ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); | 986 | ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); |
@@ -1178,6 +1192,9 @@ static noinline int replay_one_name(struct btrfs_trans_handle *trans, | |||
1178 | 1192 | ||
1179 | name_len = btrfs_dir_name_len(eb, di); | 1193 | name_len = btrfs_dir_name_len(eb, di); |
1180 | name = kmalloc(name_len, GFP_NOFS); | 1194 | name = kmalloc(name_len, GFP_NOFS); |
1195 | if (!name) | ||
1196 | return -ENOMEM; | ||
1197 | |||
1181 | log_type = btrfs_dir_type(eb, di); | 1198 | log_type = btrfs_dir_type(eb, di); |
1182 | read_extent_buffer(eb, name, (unsigned long)(di + 1), | 1199 | read_extent_buffer(eb, name, (unsigned long)(di + 1), |
1183 | name_len); | 1200 | name_len); |
@@ -1692,6 +1709,8 @@ static noinline int walk_down_log_tree(struct btrfs_trans_handle *trans, | |||
1692 | root_owner = btrfs_header_owner(parent); | 1709 | root_owner = btrfs_header_owner(parent); |
1693 | 1710 | ||
1694 | next = btrfs_find_create_tree_block(root, bytenr, blocksize); | 1711 | next = btrfs_find_create_tree_block(root, bytenr, blocksize); |
1712 | if (!next) | ||
1713 | return -ENOMEM; | ||
1695 | 1714 | ||
1696 | if (*level == 1) { | 1715 | if (*level == 1) { |
1697 | wc->process_func(root, next, wc, ptr_gen); | 1716 | wc->process_func(root, next, wc, ptr_gen); |
@@ -2032,6 +2051,7 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans, | |||
2032 | wait_log_commit(trans, log_root_tree, | 2051 | wait_log_commit(trans, log_root_tree, |
2033 | log_root_tree->log_transid); | 2052 | log_root_tree->log_transid); |
2034 | mutex_unlock(&log_root_tree->log_mutex); | 2053 | mutex_unlock(&log_root_tree->log_mutex); |
2054 | ret = 0; | ||
2035 | goto out; | 2055 | goto out; |
2036 | } | 2056 | } |
2037 | atomic_set(&log_root_tree->log_commit[index2], 1); | 2057 | atomic_set(&log_root_tree->log_commit[index2], 1); |
@@ -2096,7 +2116,7 @@ out: | |||
2096 | smp_mb(); | 2116 | smp_mb(); |
2097 | if (waitqueue_active(&root->log_commit_wait[index1])) | 2117 | if (waitqueue_active(&root->log_commit_wait[index1])) |
2098 | wake_up(&root->log_commit_wait[index1]); | 2118 | wake_up(&root->log_commit_wait[index1]); |
2099 | return 0; | 2119 | return ret; |
2100 | } | 2120 | } |
2101 | 2121 | ||
2102 | static void free_log_tree(struct btrfs_trans_handle *trans, | 2122 | static void free_log_tree(struct btrfs_trans_handle *trans, |
@@ -2194,6 +2214,9 @@ int btrfs_del_dir_entries_in_log(struct btrfs_trans_handle *trans, | |||
2194 | 2214 | ||
2195 | log = root->log_root; | 2215 | log = root->log_root; |
2196 | path = btrfs_alloc_path(); | 2216 | path = btrfs_alloc_path(); |
2217 | if (!path) | ||
2218 | return -ENOMEM; | ||
2219 | |||
2197 | di = btrfs_lookup_dir_item(trans, log, path, dir->i_ino, | 2220 | di = btrfs_lookup_dir_item(trans, log, path, dir->i_ino, |
2198 | name, name_len, -1); | 2221 | name, name_len, -1); |
2199 | if (IS_ERR(di)) { | 2222 | if (IS_ERR(di)) { |
@@ -2594,6 +2617,9 @@ static noinline int copy_items(struct btrfs_trans_handle *trans, | |||
2594 | 2617 | ||
2595 | ins_data = kmalloc(nr * sizeof(struct btrfs_key) + | 2618 | ins_data = kmalloc(nr * sizeof(struct btrfs_key) + |
2596 | nr * sizeof(u32), GFP_NOFS); | 2619 | nr * sizeof(u32), GFP_NOFS); |
2620 | if (!ins_data) | ||
2621 | return -ENOMEM; | ||
2622 | |||
2597 | ins_sizes = (u32 *)ins_data; | 2623 | ins_sizes = (u32 *)ins_data; |
2598 | ins_keys = (struct btrfs_key *)(ins_data + nr * sizeof(u32)); | 2624 | ins_keys = (struct btrfs_key *)(ins_data + nr * sizeof(u32)); |
2599 | 2625 | ||
@@ -2725,7 +2751,13 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans, | |||
2725 | log = root->log_root; | 2751 | log = root->log_root; |
2726 | 2752 | ||
2727 | path = btrfs_alloc_path(); | 2753 | path = btrfs_alloc_path(); |
2754 | if (!path) | ||
2755 | return -ENOMEM; | ||
2728 | dst_path = btrfs_alloc_path(); | 2756 | dst_path = btrfs_alloc_path(); |
2757 | if (!dst_path) { | ||
2758 | btrfs_free_path(path); | ||
2759 | return -ENOMEM; | ||
2760 | } | ||
2729 | 2761 | ||
2730 | min_key.objectid = inode->i_ino; | 2762 | min_key.objectid = inode->i_ino; |
2731 | min_key.type = BTRFS_INODE_ITEM_KEY; | 2763 | min_key.type = BTRFS_INODE_ITEM_KEY; |
@@ -3080,6 +3112,7 @@ int btrfs_recover_log_trees(struct btrfs_root *log_root_tree) | |||
3080 | BUG_ON(!path); | 3112 | BUG_ON(!path); |
3081 | 3113 | ||
3082 | trans = btrfs_start_transaction(fs_info->tree_root, 0); | 3114 | trans = btrfs_start_transaction(fs_info->tree_root, 0); |
3115 | BUG_ON(IS_ERR(trans)); | ||
3083 | 3116 | ||
3084 | wc.trans = trans; | 3117 | wc.trans = trans; |
3085 | wc.pin = 1; | 3118 | wc.pin = 1; |
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index d158530233b7..2636a051e4b2 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
@@ -1213,6 +1213,10 @@ static int btrfs_rm_dev_item(struct btrfs_root *root, | |||
1213 | return -ENOMEM; | 1213 | return -ENOMEM; |
1214 | 1214 | ||
1215 | trans = btrfs_start_transaction(root, 0); | 1215 | trans = btrfs_start_transaction(root, 0); |
1216 | if (IS_ERR(trans)) { | ||
1217 | btrfs_free_path(path); | ||
1218 | return PTR_ERR(trans); | ||
1219 | } | ||
1216 | key.objectid = BTRFS_DEV_ITEMS_OBJECTID; | 1220 | key.objectid = BTRFS_DEV_ITEMS_OBJECTID; |
1217 | key.type = BTRFS_DEV_ITEM_KEY; | 1221 | key.type = BTRFS_DEV_ITEM_KEY; |
1218 | key.offset = device->devid; | 1222 | key.offset = device->devid; |
@@ -1606,6 +1610,12 @@ int btrfs_init_new_device(struct btrfs_root *root, char *device_path) | |||
1606 | } | 1610 | } |
1607 | 1611 | ||
1608 | trans = btrfs_start_transaction(root, 0); | 1612 | trans = btrfs_start_transaction(root, 0); |
1613 | if (IS_ERR(trans)) { | ||
1614 | kfree(device); | ||
1615 | ret = PTR_ERR(trans); | ||
1616 | goto error; | ||
1617 | } | ||
1618 | |||
1609 | lock_chunks(root); | 1619 | lock_chunks(root); |
1610 | 1620 | ||
1611 | device->writeable = 1; | 1621 | device->writeable = 1; |
@@ -1873,7 +1883,7 @@ static int btrfs_relocate_chunk(struct btrfs_root *root, | |||
1873 | return ret; | 1883 | return ret; |
1874 | 1884 | ||
1875 | trans = btrfs_start_transaction(root, 0); | 1885 | trans = btrfs_start_transaction(root, 0); |
1876 | BUG_ON(!trans); | 1886 | BUG_ON(IS_ERR(trans)); |
1877 | 1887 | ||
1878 | lock_chunks(root); | 1888 | lock_chunks(root); |
1879 | 1889 | ||
@@ -2047,7 +2057,7 @@ int btrfs_balance(struct btrfs_root *dev_root) | |||
2047 | BUG_ON(ret); | 2057 | BUG_ON(ret); |
2048 | 2058 | ||
2049 | trans = btrfs_start_transaction(dev_root, 0); | 2059 | trans = btrfs_start_transaction(dev_root, 0); |
2050 | BUG_ON(!trans); | 2060 | BUG_ON(IS_ERR(trans)); |
2051 | 2061 | ||
2052 | ret = btrfs_grow_device(trans, device, old_size); | 2062 | ret = btrfs_grow_device(trans, device, old_size); |
2053 | BUG_ON(ret); | 2063 | BUG_ON(ret); |
@@ -2213,6 +2223,11 @@ again: | |||
2213 | 2223 | ||
2214 | /* Shrinking succeeded, else we would be at "done". */ | 2224 | /* Shrinking succeeded, else we would be at "done". */ |
2215 | trans = btrfs_start_transaction(root, 0); | 2225 | trans = btrfs_start_transaction(root, 0); |
2226 | if (IS_ERR(trans)) { | ||
2227 | ret = PTR_ERR(trans); | ||
2228 | goto done; | ||
2229 | } | ||
2230 | |||
2216 | lock_chunks(root); | 2231 | lock_chunks(root); |
2217 | 2232 | ||
2218 | device->disk_total_bytes = new_size; | 2233 | device->disk_total_bytes = new_size; |
diff --git a/fs/cifs/cifsacl.c b/fs/cifs/cifsacl.c index 1e7636b145a8..beeebf194234 100644 --- a/fs/cifs/cifsacl.c +++ b/fs/cifs/cifsacl.c | |||
@@ -372,6 +372,10 @@ static void parse_dacl(struct cifs_acl *pdacl, char *end_of_acl, | |||
372 | 372 | ||
373 | ppace = kmalloc(num_aces * sizeof(struct cifs_ace *), | 373 | ppace = kmalloc(num_aces * sizeof(struct cifs_ace *), |
374 | GFP_KERNEL); | 374 | GFP_KERNEL); |
375 | if (!ppace) { | ||
376 | cERROR(1, "DACL memory allocation error"); | ||
377 | return; | ||
378 | } | ||
375 | 379 | ||
376 | for (i = 0; i < num_aces; ++i) { | 380 | for (i = 0; i < num_aces; ++i) { |
377 | ppace[i] = (struct cifs_ace *) (acl_base + acl_size); | 381 | ppace[i] = (struct cifs_ace *) (acl_base + acl_size); |
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index 46c66ed01af4..904aa47e3515 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c | |||
@@ -136,9 +136,6 @@ cifs_reconnect_tcon(struct cifsTconInfo *tcon, int smb_command) | |||
136 | } | 136 | } |
137 | } | 137 | } |
138 | 138 | ||
139 | if (ses->status == CifsExiting) | ||
140 | return -EIO; | ||
141 | |||
142 | /* | 139 | /* |
143 | * Give demultiplex thread up to 10 seconds to reconnect, should be | 140 | * Give demultiplex thread up to 10 seconds to reconnect, should be |
144 | * greater than cifs socket timeout which is 7 seconds | 141 | * greater than cifs socket timeout which is 7 seconds |
@@ -156,7 +153,7 @@ cifs_reconnect_tcon(struct cifsTconInfo *tcon, int smb_command) | |||
156 | * retrying until process is killed or server comes | 153 | * retrying until process is killed or server comes |
157 | * back on-line | 154 | * back on-line |
158 | */ | 155 | */ |
159 | if (!tcon->retry || ses->status == CifsExiting) { | 156 | if (!tcon->retry) { |
160 | cFYI(1, "gave up waiting on reconnect in smb_init"); | 157 | cFYI(1, "gave up waiting on reconnect in smb_init"); |
161 | return -EHOSTDOWN; | 158 | return -EHOSTDOWN; |
162 | } | 159 | } |
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 47d8ff623683..257b6d895e20 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -337,8 +337,12 @@ cifs_echo_request(struct work_struct *work) | |||
337 | struct TCP_Server_Info *server = container_of(work, | 337 | struct TCP_Server_Info *server = container_of(work, |
338 | struct TCP_Server_Info, echo.work); | 338 | struct TCP_Server_Info, echo.work); |
339 | 339 | ||
340 | /* no need to ping if we got a response recently */ | 340 | /* |
341 | if (time_before(jiffies, server->lstrp + SMB_ECHO_INTERVAL - HZ)) | 341 | * We cannot send an echo until the NEGOTIATE_PROTOCOL request is done. |
342 | * Also, no need to ping if we got a response recently | ||
343 | */ | ||
344 | if (server->tcpStatus != CifsGood || | ||
345 | time_before(jiffies, server->lstrp + SMB_ECHO_INTERVAL - HZ)) | ||
342 | goto requeue_echo; | 346 | goto requeue_echo; |
343 | 347 | ||
344 | rc = CIFSSMBEcho(server); | 348 | rc = CIFSSMBEcho(server); |
@@ -578,12 +582,12 @@ incomplete_rcv: | |||
578 | else if (reconnect == 1) | 582 | else if (reconnect == 1) |
579 | continue; | 583 | continue; |
580 | 584 | ||
581 | length += 4; /* account for rfc1002 hdr */ | 585 | total_read += 4; /* account for rfc1002 hdr */ |
582 | 586 | ||
583 | 587 | dump_smb(smb_buffer, total_read); | |
584 | dump_smb(smb_buffer, length); | 588 | if (checkSMB(smb_buffer, smb_buffer->Mid, total_read)) { |
585 | if (checkSMB(smb_buffer, smb_buffer->Mid, total_read+4)) { | 589 | cifs_dump_mem("Bad SMB: ", smb_buffer, |
586 | cifs_dump_mem("Bad SMB: ", smb_buffer, 48); | 590 | total_read < 48 ? total_read : 48); |
587 | continue; | 591 | continue; |
588 | } | 592 | } |
589 | 593 | ||
@@ -633,11 +637,11 @@ incomplete_rcv: | |||
633 | mid_entry->largeBuf = isLargeBuf; | 637 | mid_entry->largeBuf = isLargeBuf; |
634 | multi_t2_fnd: | 638 | multi_t2_fnd: |
635 | mid_entry->midState = MID_RESPONSE_RECEIVED; | 639 | mid_entry->midState = MID_RESPONSE_RECEIVED; |
636 | list_del_init(&mid_entry->qhead); | ||
637 | mid_entry->callback(mid_entry); | ||
638 | #ifdef CONFIG_CIFS_STATS2 | 640 | #ifdef CONFIG_CIFS_STATS2 |
639 | mid_entry->when_received = jiffies; | 641 | mid_entry->when_received = jiffies; |
640 | #endif | 642 | #endif |
643 | list_del_init(&mid_entry->qhead); | ||
644 | mid_entry->callback(mid_entry); | ||
641 | break; | 645 | break; |
642 | } | 646 | } |
643 | mid_entry = NULL; | 647 | mid_entry = NULL; |
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 74c0a282d012..e964b1cd5dd0 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -1662,10 +1662,10 @@ static ssize_t | |||
1662 | cifs_iovec_write(struct file *file, const struct iovec *iov, | 1662 | cifs_iovec_write(struct file *file, const struct iovec *iov, |
1663 | unsigned long nr_segs, loff_t *poffset) | 1663 | unsigned long nr_segs, loff_t *poffset) |
1664 | { | 1664 | { |
1665 | size_t total_written = 0; | 1665 | unsigned int written; |
1666 | unsigned int written = 0; | 1666 | unsigned long num_pages, npages, i; |
1667 | unsigned long num_pages, npages; | 1667 | size_t copied, len, cur_len; |
1668 | size_t copied, len, cur_len, i; | 1668 | ssize_t total_written = 0; |
1669 | struct kvec *to_send; | 1669 | struct kvec *to_send; |
1670 | struct page **pages; | 1670 | struct page **pages; |
1671 | struct iov_iter it; | 1671 | struct iov_iter it; |
@@ -1821,7 +1821,8 @@ cifs_iovec_read(struct file *file, const struct iovec *iov, | |||
1821 | { | 1821 | { |
1822 | int rc; | 1822 | int rc; |
1823 | int xid; | 1823 | int xid; |
1824 | unsigned int total_read, bytes_read = 0; | 1824 | ssize_t total_read; |
1825 | unsigned int bytes_read = 0; | ||
1825 | size_t len, cur_len; | 1826 | size_t len, cur_len; |
1826 | int iov_offset = 0; | 1827 | int iov_offset = 0; |
1827 | struct cifs_sb_info *cifs_sb; | 1828 | struct cifs_sb_info *cifs_sb; |
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c index b8c5e2eb43d0..fbc5aace54b1 100644 --- a/fs/cifs/transport.c +++ b/fs/cifs/transport.c | |||
@@ -359,6 +359,10 @@ cifs_call_async(struct TCP_Server_Info *server, struct smb_hdr *in_buf, | |||
359 | if (rc) | 359 | if (rc) |
360 | return rc; | 360 | return rc; |
361 | 361 | ||
362 | /* enable signing if server requires it */ | ||
363 | if (server->secMode & (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED)) | ||
364 | in_buf->Flags2 |= SMBFLG2_SECURITY_SIGNATURE; | ||
365 | |||
362 | mutex_lock(&server->srv_mutex); | 366 | mutex_lock(&server->srv_mutex); |
363 | mid = AllocMidQEntry(in_buf, server); | 367 | mid = AllocMidQEntry(in_buf, server); |
364 | if (mid == NULL) { | 368 | if (mid == NULL) { |
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index 6ebb81030d2d..fe77e3395b40 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h | |||
@@ -124,7 +124,8 @@ | |||
124 | #endif | 124 | #endif |
125 | 125 | ||
126 | #ifdef CONFIG_EVENT_TRACING | 126 | #ifdef CONFIG_EVENT_TRACING |
127 | #define FTRACE_EVENTS() VMLINUX_SYMBOL(__start_ftrace_events) = .; \ | 127 | #define FTRACE_EVENTS() . = ALIGN(8); \ |
128 | VMLINUX_SYMBOL(__start_ftrace_events) = .; \ | ||
128 | *(_ftrace_events) \ | 129 | *(_ftrace_events) \ |
129 | VMLINUX_SYMBOL(__stop_ftrace_events) = .; | 130 | VMLINUX_SYMBOL(__stop_ftrace_events) = .; |
130 | #else | 131 | #else |
@@ -140,7 +141,8 @@ | |||
140 | #endif | 141 | #endif |
141 | 142 | ||
142 | #ifdef CONFIG_FTRACE_SYSCALLS | 143 | #ifdef CONFIG_FTRACE_SYSCALLS |
143 | #define TRACE_SYSCALLS() VMLINUX_SYMBOL(__start_syscalls_metadata) = .; \ | 144 | #define TRACE_SYSCALLS() . = ALIGN(8); \ |
145 | VMLINUX_SYMBOL(__start_syscalls_metadata) = .; \ | ||
144 | *(__syscalls_metadata) \ | 146 | *(__syscalls_metadata) \ |
145 | VMLINUX_SYMBOL(__stop_syscalls_metadata) = .; | 147 | VMLINUX_SYMBOL(__stop_syscalls_metadata) = .; |
146 | #else | 148 | #else |
@@ -165,10 +167,8 @@ | |||
165 | CPU_KEEP(exit.data) \ | 167 | CPU_KEEP(exit.data) \ |
166 | MEM_KEEP(init.data) \ | 168 | MEM_KEEP(init.data) \ |
167 | MEM_KEEP(exit.data) \ | 169 | MEM_KEEP(exit.data) \ |
168 | . = ALIGN(32); \ | 170 | STRUCT_ALIGN(); \ |
169 | VMLINUX_SYMBOL(__start___tracepoints) = .; \ | ||
170 | *(__tracepoints) \ | 171 | *(__tracepoints) \ |
171 | VMLINUX_SYMBOL(__stop___tracepoints) = .; \ | ||
172 | /* implement dynamic printk debug */ \ | 172 | /* implement dynamic printk debug */ \ |
173 | . = ALIGN(8); \ | 173 | . = ALIGN(8); \ |
174 | VMLINUX_SYMBOL(__start___verbose) = .; \ | 174 | VMLINUX_SYMBOL(__start___verbose) = .; \ |
@@ -176,13 +176,7 @@ | |||
176 | VMLINUX_SYMBOL(__stop___verbose) = .; \ | 176 | VMLINUX_SYMBOL(__stop___verbose) = .; \ |
177 | LIKELY_PROFILE() \ | 177 | LIKELY_PROFILE() \ |
178 | BRANCH_PROFILE() \ | 178 | BRANCH_PROFILE() \ |
179 | TRACE_PRINTKS() \ | 179 | TRACE_PRINTKS() |
180 | \ | ||
181 | STRUCT_ALIGN(); \ | ||
182 | FTRACE_EVENTS() \ | ||
183 | \ | ||
184 | STRUCT_ALIGN(); \ | ||
185 | TRACE_SYSCALLS() | ||
186 | 180 | ||
187 | /* | 181 | /* |
188 | * Data section helpers | 182 | * Data section helpers |
@@ -220,6 +214,10 @@ | |||
220 | VMLINUX_SYMBOL(__start_rodata) = .; \ | 214 | VMLINUX_SYMBOL(__start_rodata) = .; \ |
221 | *(.rodata) *(.rodata.*) \ | 215 | *(.rodata) *(.rodata.*) \ |
222 | *(__vermagic) /* Kernel version magic */ \ | 216 | *(__vermagic) /* Kernel version magic */ \ |
217 | . = ALIGN(8); \ | ||
218 | VMLINUX_SYMBOL(__start___tracepoints_ptrs) = .; \ | ||
219 | *(__tracepoints_ptrs) /* Tracepoints: pointer array */\ | ||
220 | VMLINUX_SYMBOL(__stop___tracepoints_ptrs) = .; \ | ||
223 | *(__markers_strings) /* Markers: strings */ \ | 221 | *(__markers_strings) /* Markers: strings */ \ |
224 | *(__tracepoints_strings)/* Tracepoints: strings */ \ | 222 | *(__tracepoints_strings)/* Tracepoints: strings */ \ |
225 | } \ | 223 | } \ |
@@ -482,6 +480,8 @@ | |||
482 | KERNEL_CTORS() \ | 480 | KERNEL_CTORS() \ |
483 | *(.init.rodata) \ | 481 | *(.init.rodata) \ |
484 | MCOUNT_REC() \ | 482 | MCOUNT_REC() \ |
483 | FTRACE_EVENTS() \ | ||
484 | TRACE_SYSCALLS() \ | ||
485 | DEV_DISCARD(init.rodata) \ | 485 | DEV_DISCARD(init.rodata) \ |
486 | CPU_DISCARD(init.rodata) \ | 486 | CPU_DISCARD(init.rodata) \ |
487 | MEM_DISCARD(init.rodata) \ | 487 | MEM_DISCARD(init.rodata) \ |
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h index 63c5ad78e37c..56b7c97aaf0a 100644 --- a/include/linux/interrupt.h +++ b/include/linux/interrupt.h | |||
@@ -57,7 +57,7 @@ | |||
57 | * Used by threaded interrupts which need to keep the | 57 | * Used by threaded interrupts which need to keep the |
58 | * irq line disabled until the threaded handler has been run. | 58 | * irq line disabled until the threaded handler has been run. |
59 | * IRQF_NO_SUSPEND - Do not disable this IRQ during suspend | 59 | * IRQF_NO_SUSPEND - Do not disable this IRQ during suspend |
60 | * | 60 | * IRQF_FORCE_RESUME - Force enable it on resume even if IRQF_NO_SUSPEND is set |
61 | */ | 61 | */ |
62 | #define IRQF_DISABLED 0x00000020 | 62 | #define IRQF_DISABLED 0x00000020 |
63 | #define IRQF_SAMPLE_RANDOM 0x00000040 | 63 | #define IRQF_SAMPLE_RANDOM 0x00000040 |
@@ -69,6 +69,7 @@ | |||
69 | #define IRQF_IRQPOLL 0x00001000 | 69 | #define IRQF_IRQPOLL 0x00001000 |
70 | #define IRQF_ONESHOT 0x00002000 | 70 | #define IRQF_ONESHOT 0x00002000 |
71 | #define IRQF_NO_SUSPEND 0x00004000 | 71 | #define IRQF_NO_SUSPEND 0x00004000 |
72 | #define IRQF_FORCE_RESUME 0x00008000 | ||
72 | 73 | ||
73 | #define IRQF_TIMER (__IRQF_TIMER | IRQF_NO_SUSPEND) | 74 | #define IRQF_TIMER (__IRQF_TIMER | IRQF_NO_SUSPEND) |
74 | 75 | ||
diff --git a/include/linux/module.h b/include/linux/module.h index e7c6385c6683..9bdf27c7615b 100644 --- a/include/linux/module.h +++ b/include/linux/module.h | |||
@@ -377,7 +377,7 @@ struct module | |||
377 | keeping pointers to this stuff */ | 377 | keeping pointers to this stuff */ |
378 | char *args; | 378 | char *args; |
379 | #ifdef CONFIG_TRACEPOINTS | 379 | #ifdef CONFIG_TRACEPOINTS |
380 | struct tracepoint *tracepoints; | 380 | struct tracepoint * const *tracepoints_ptrs; |
381 | unsigned int num_tracepoints; | 381 | unsigned int num_tracepoints; |
382 | #endif | 382 | #endif |
383 | #ifdef HAVE_JUMP_LABEL | 383 | #ifdef HAVE_JUMP_LABEL |
@@ -389,7 +389,7 @@ struct module | |||
389 | unsigned int num_trace_bprintk_fmt; | 389 | unsigned int num_trace_bprintk_fmt; |
390 | #endif | 390 | #endif |
391 | #ifdef CONFIG_EVENT_TRACING | 391 | #ifdef CONFIG_EVENT_TRACING |
392 | struct ftrace_event_call *trace_events; | 392 | struct ftrace_event_call **trace_events; |
393 | unsigned int num_trace_events; | 393 | unsigned int num_trace_events; |
394 | #endif | 394 | #endif |
395 | #ifdef CONFIG_FTRACE_MCOUNT_RECORD | 395 | #ifdef CONFIG_FTRACE_MCOUNT_RECORD |
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index 18cd0684fc4e..98664db1be47 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h | |||
@@ -125,39 +125,37 @@ extern struct trace_event_functions enter_syscall_print_funcs; | |||
125 | extern struct trace_event_functions exit_syscall_print_funcs; | 125 | extern struct trace_event_functions exit_syscall_print_funcs; |
126 | 126 | ||
127 | #define SYSCALL_TRACE_ENTER_EVENT(sname) \ | 127 | #define SYSCALL_TRACE_ENTER_EVENT(sname) \ |
128 | static struct syscall_metadata \ | 128 | static struct syscall_metadata __syscall_meta_##sname; \ |
129 | __attribute__((__aligned__(4))) __syscall_meta_##sname; \ | ||
130 | static struct ftrace_event_call __used \ | 129 | static struct ftrace_event_call __used \ |
131 | __attribute__((__aligned__(4))) \ | ||
132 | __attribute__((section("_ftrace_events"))) \ | ||
133 | event_enter_##sname = { \ | 130 | event_enter_##sname = { \ |
134 | .name = "sys_enter"#sname, \ | 131 | .name = "sys_enter"#sname, \ |
135 | .class = &event_class_syscall_enter, \ | 132 | .class = &event_class_syscall_enter, \ |
136 | .event.funcs = &enter_syscall_print_funcs, \ | 133 | .event.funcs = &enter_syscall_print_funcs, \ |
137 | .data = (void *)&__syscall_meta_##sname,\ | 134 | .data = (void *)&__syscall_meta_##sname,\ |
138 | }; \ | 135 | }; \ |
136 | static struct ftrace_event_call __used \ | ||
137 | __attribute__((section("_ftrace_events"))) \ | ||
138 | *__event_enter_##sname = &event_enter_##sname; \ | ||
139 | __TRACE_EVENT_FLAGS(enter_##sname, TRACE_EVENT_FL_CAP_ANY) | 139 | __TRACE_EVENT_FLAGS(enter_##sname, TRACE_EVENT_FL_CAP_ANY) |
140 | 140 | ||
141 | #define SYSCALL_TRACE_EXIT_EVENT(sname) \ | 141 | #define SYSCALL_TRACE_EXIT_EVENT(sname) \ |
142 | static struct syscall_metadata \ | 142 | static struct syscall_metadata __syscall_meta_##sname; \ |
143 | __attribute__((__aligned__(4))) __syscall_meta_##sname; \ | ||
144 | static struct ftrace_event_call __used \ | 143 | static struct ftrace_event_call __used \ |
145 | __attribute__((__aligned__(4))) \ | ||
146 | __attribute__((section("_ftrace_events"))) \ | ||
147 | event_exit_##sname = { \ | 144 | event_exit_##sname = { \ |
148 | .name = "sys_exit"#sname, \ | 145 | .name = "sys_exit"#sname, \ |
149 | .class = &event_class_syscall_exit, \ | 146 | .class = &event_class_syscall_exit, \ |
150 | .event.funcs = &exit_syscall_print_funcs, \ | 147 | .event.funcs = &exit_syscall_print_funcs, \ |
151 | .data = (void *)&__syscall_meta_##sname,\ | 148 | .data = (void *)&__syscall_meta_##sname,\ |
152 | }; \ | 149 | }; \ |
150 | static struct ftrace_event_call __used \ | ||
151 | __attribute__((section("_ftrace_events"))) \ | ||
152 | *__event_exit_##sname = &event_exit_##sname; \ | ||
153 | __TRACE_EVENT_FLAGS(exit_##sname, TRACE_EVENT_FL_CAP_ANY) | 153 | __TRACE_EVENT_FLAGS(exit_##sname, TRACE_EVENT_FL_CAP_ANY) |
154 | 154 | ||
155 | #define SYSCALL_METADATA(sname, nb) \ | 155 | #define SYSCALL_METADATA(sname, nb) \ |
156 | SYSCALL_TRACE_ENTER_EVENT(sname); \ | 156 | SYSCALL_TRACE_ENTER_EVENT(sname); \ |
157 | SYSCALL_TRACE_EXIT_EVENT(sname); \ | 157 | SYSCALL_TRACE_EXIT_EVENT(sname); \ |
158 | static struct syscall_metadata __used \ | 158 | static struct syscall_metadata __used \ |
159 | __attribute__((__aligned__(4))) \ | ||
160 | __attribute__((section("__syscalls_metadata"))) \ | ||
161 | __syscall_meta_##sname = { \ | 159 | __syscall_meta_##sname = { \ |
162 | .name = "sys"#sname, \ | 160 | .name = "sys"#sname, \ |
163 | .nb_args = nb, \ | 161 | .nb_args = nb, \ |
@@ -166,14 +164,15 @@ extern struct trace_event_functions exit_syscall_print_funcs; | |||
166 | .enter_event = &event_enter_##sname, \ | 164 | .enter_event = &event_enter_##sname, \ |
167 | .exit_event = &event_exit_##sname, \ | 165 | .exit_event = &event_exit_##sname, \ |
168 | .enter_fields = LIST_HEAD_INIT(__syscall_meta_##sname.enter_fields), \ | 166 | .enter_fields = LIST_HEAD_INIT(__syscall_meta_##sname.enter_fields), \ |
169 | }; | 167 | }; \ |
168 | static struct syscall_metadata __used \ | ||
169 | __attribute__((section("__syscalls_metadata"))) \ | ||
170 | *__p_syscall_meta_##sname = &__syscall_meta_##sname; | ||
170 | 171 | ||
171 | #define SYSCALL_DEFINE0(sname) \ | 172 | #define SYSCALL_DEFINE0(sname) \ |
172 | SYSCALL_TRACE_ENTER_EVENT(_##sname); \ | 173 | SYSCALL_TRACE_ENTER_EVENT(_##sname); \ |
173 | SYSCALL_TRACE_EXIT_EVENT(_##sname); \ | 174 | SYSCALL_TRACE_EXIT_EVENT(_##sname); \ |
174 | static struct syscall_metadata __used \ | 175 | static struct syscall_metadata __used \ |
175 | __attribute__((__aligned__(4))) \ | ||
176 | __attribute__((section("__syscalls_metadata"))) \ | ||
177 | __syscall_meta__##sname = { \ | 176 | __syscall_meta__##sname = { \ |
178 | .name = "sys_"#sname, \ | 177 | .name = "sys_"#sname, \ |
179 | .nb_args = 0, \ | 178 | .nb_args = 0, \ |
@@ -181,6 +180,9 @@ extern struct trace_event_functions exit_syscall_print_funcs; | |||
181 | .exit_event = &event_exit__##sname, \ | 180 | .exit_event = &event_exit__##sname, \ |
182 | .enter_fields = LIST_HEAD_INIT(__syscall_meta__##sname.enter_fields), \ | 181 | .enter_fields = LIST_HEAD_INIT(__syscall_meta__##sname.enter_fields), \ |
183 | }; \ | 182 | }; \ |
183 | static struct syscall_metadata __used \ | ||
184 | __attribute__((section("__syscalls_metadata"))) \ | ||
185 | *__p_syscall_meta_##sname = &__syscall_meta__##sname; \ | ||
184 | asmlinkage long sys_##sname(void) | 186 | asmlinkage long sys_##sname(void) |
185 | #else | 187 | #else |
186 | #define SYSCALL_DEFINE0(name) asmlinkage long sys_##name(void) | 188 | #define SYSCALL_DEFINE0(name) asmlinkage long sys_##name(void) |
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h index c6814616653b..97c84a58efb8 100644 --- a/include/linux/tracepoint.h +++ b/include/linux/tracepoint.h | |||
@@ -33,12 +33,7 @@ struct tracepoint { | |||
33 | void (*regfunc)(void); | 33 | void (*regfunc)(void); |
34 | void (*unregfunc)(void); | 34 | void (*unregfunc)(void); |
35 | struct tracepoint_func __rcu *funcs; | 35 | struct tracepoint_func __rcu *funcs; |
36 | } __attribute__((aligned(32))); /* | 36 | }; |
37 | * Aligned on 32 bytes because it is | ||
38 | * globally visible and gcc happily | ||
39 | * align these on the structure size. | ||
40 | * Keep in sync with vmlinux.lds.h. | ||
41 | */ | ||
42 | 37 | ||
43 | /* | 38 | /* |
44 | * Connect a probe to a tracepoint. | 39 | * Connect a probe to a tracepoint. |
@@ -61,15 +56,15 @@ extern void tracepoint_probe_update_all(void); | |||
61 | 56 | ||
62 | struct tracepoint_iter { | 57 | struct tracepoint_iter { |
63 | struct module *module; | 58 | struct module *module; |
64 | struct tracepoint *tracepoint; | 59 | struct tracepoint * const *tracepoint; |
65 | }; | 60 | }; |
66 | 61 | ||
67 | extern void tracepoint_iter_start(struct tracepoint_iter *iter); | 62 | extern void tracepoint_iter_start(struct tracepoint_iter *iter); |
68 | extern void tracepoint_iter_next(struct tracepoint_iter *iter); | 63 | extern void tracepoint_iter_next(struct tracepoint_iter *iter); |
69 | extern void tracepoint_iter_stop(struct tracepoint_iter *iter); | 64 | extern void tracepoint_iter_stop(struct tracepoint_iter *iter); |
70 | extern void tracepoint_iter_reset(struct tracepoint_iter *iter); | 65 | extern void tracepoint_iter_reset(struct tracepoint_iter *iter); |
71 | extern int tracepoint_get_iter_range(struct tracepoint **tracepoint, | 66 | extern int tracepoint_get_iter_range(struct tracepoint * const **tracepoint, |
72 | struct tracepoint *begin, struct tracepoint *end); | 67 | struct tracepoint * const *begin, struct tracepoint * const *end); |
73 | 68 | ||
74 | /* | 69 | /* |
75 | * tracepoint_synchronize_unregister must be called between the last tracepoint | 70 | * tracepoint_synchronize_unregister must be called between the last tracepoint |
@@ -84,11 +79,13 @@ static inline void tracepoint_synchronize_unregister(void) | |||
84 | #define PARAMS(args...) args | 79 | #define PARAMS(args...) args |
85 | 80 | ||
86 | #ifdef CONFIG_TRACEPOINTS | 81 | #ifdef CONFIG_TRACEPOINTS |
87 | extern void tracepoint_update_probe_range(struct tracepoint *begin, | 82 | extern |
88 | struct tracepoint *end); | 83 | void tracepoint_update_probe_range(struct tracepoint * const *begin, |
84 | struct tracepoint * const *end); | ||
89 | #else | 85 | #else |
90 | static inline void tracepoint_update_probe_range(struct tracepoint *begin, | 86 | static inline |
91 | struct tracepoint *end) | 87 | void tracepoint_update_probe_range(struct tracepoint * const *begin, |
88 | struct tracepoint * const *end) | ||
92 | { } | 89 | { } |
93 | #endif /* CONFIG_TRACEPOINTS */ | 90 | #endif /* CONFIG_TRACEPOINTS */ |
94 | 91 | ||
@@ -174,12 +171,20 @@ do_trace: \ | |||
174 | { \ | 171 | { \ |
175 | } | 172 | } |
176 | 173 | ||
174 | /* | ||
175 | * We have no guarantee that gcc and the linker won't up-align the tracepoint | ||
176 | * structures, so we create an array of pointers that will be used for iteration | ||
177 | * on the tracepoints. | ||
178 | */ | ||
177 | #define DEFINE_TRACE_FN(name, reg, unreg) \ | 179 | #define DEFINE_TRACE_FN(name, reg, unreg) \ |
178 | static const char __tpstrtab_##name[] \ | 180 | static const char __tpstrtab_##name[] \ |
179 | __attribute__((section("__tracepoints_strings"))) = #name; \ | 181 | __attribute__((section("__tracepoints_strings"))) = #name; \ |
180 | struct tracepoint __tracepoint_##name \ | 182 | struct tracepoint __tracepoint_##name \ |
181 | __attribute__((section("__tracepoints"), aligned(32))) = \ | 183 | __attribute__((section("__tracepoints"))) = \ |
182 | { __tpstrtab_##name, 0, reg, unreg, NULL } | 184 | { __tpstrtab_##name, 0, reg, unreg, NULL }; \ |
185 | static struct tracepoint * const __tracepoint_ptr_##name __used \ | ||
186 | __attribute__((section("__tracepoints_ptrs"))) = \ | ||
187 | &__tracepoint_##name; | ||
183 | 188 | ||
184 | #define DEFINE_TRACE(name) \ | 189 | #define DEFINE_TRACE(name) \ |
185 | DEFINE_TRACE_FN(name, NULL, NULL); | 190 | DEFINE_TRACE_FN(name, NULL, NULL); |
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h index e16610c208c9..3e68366d485a 100644 --- a/include/trace/ftrace.h +++ b/include/trace/ftrace.h | |||
@@ -446,14 +446,16 @@ static inline notrace int ftrace_get_offsets_##call( \ | |||
446 | * .reg = ftrace_event_reg, | 446 | * .reg = ftrace_event_reg, |
447 | * }; | 447 | * }; |
448 | * | 448 | * |
449 | * static struct ftrace_event_call __used | 449 | * static struct ftrace_event_call event_<call> = { |
450 | * __attribute__((__aligned__(4))) | ||
451 | * __attribute__((section("_ftrace_events"))) event_<call> = { | ||
452 | * .name = "<call>", | 450 | * .name = "<call>", |
453 | * .class = event_class_<template>, | 451 | * .class = event_class_<template>, |
454 | * .event = &ftrace_event_type_<call>, | 452 | * .event = &ftrace_event_type_<call>, |
455 | * .print_fmt = print_fmt_<call>, | 453 | * .print_fmt = print_fmt_<call>, |
456 | * }; | 454 | * }; |
455 | * // its only safe to use pointers when doing linker tricks to | ||
456 | * // create an array. | ||
457 | * static struct ftrace_event_call __used | ||
458 | * __attribute__((section("_ftrace_events"))) *__event_<call> = &event_<call>; | ||
457 | * | 459 | * |
458 | */ | 460 | */ |
459 | 461 | ||
@@ -579,28 +581,28 @@ static struct ftrace_event_class __used event_class_##call = { \ | |||
579 | #undef DEFINE_EVENT | 581 | #undef DEFINE_EVENT |
580 | #define DEFINE_EVENT(template, call, proto, args) \ | 582 | #define DEFINE_EVENT(template, call, proto, args) \ |
581 | \ | 583 | \ |
582 | static struct ftrace_event_call __used \ | 584 | static struct ftrace_event_call __used event_##call = { \ |
583 | __attribute__((__aligned__(4))) \ | ||
584 | __attribute__((section("_ftrace_events"))) event_##call = { \ | ||
585 | .name = #call, \ | 585 | .name = #call, \ |
586 | .class = &event_class_##template, \ | 586 | .class = &event_class_##template, \ |
587 | .event.funcs = &ftrace_event_type_funcs_##template, \ | 587 | .event.funcs = &ftrace_event_type_funcs_##template, \ |
588 | .print_fmt = print_fmt_##template, \ | 588 | .print_fmt = print_fmt_##template, \ |
589 | }; | 589 | }; \ |
590 | static struct ftrace_event_call __used \ | ||
591 | __attribute__((section("_ftrace_events"))) *__event_##call = &event_##call | ||
590 | 592 | ||
591 | #undef DEFINE_EVENT_PRINT | 593 | #undef DEFINE_EVENT_PRINT |
592 | #define DEFINE_EVENT_PRINT(template, call, proto, args, print) \ | 594 | #define DEFINE_EVENT_PRINT(template, call, proto, args, print) \ |
593 | \ | 595 | \ |
594 | static const char print_fmt_##call[] = print; \ | 596 | static const char print_fmt_##call[] = print; \ |
595 | \ | 597 | \ |
596 | static struct ftrace_event_call __used \ | 598 | static struct ftrace_event_call __used event_##call = { \ |
597 | __attribute__((__aligned__(4))) \ | ||
598 | __attribute__((section("_ftrace_events"))) event_##call = { \ | ||
599 | .name = #call, \ | 599 | .name = #call, \ |
600 | .class = &event_class_##template, \ | 600 | .class = &event_class_##template, \ |
601 | .event.funcs = &ftrace_event_type_funcs_##call, \ | 601 | .event.funcs = &ftrace_event_type_funcs_##call, \ |
602 | .print_fmt = print_fmt_##call, \ | 602 | .print_fmt = print_fmt_##call, \ |
603 | } | 603 | }; \ |
604 | static struct ftrace_event_call __used \ | ||
605 | __attribute__((section("_ftrace_events"))) *__event_##call = &event_##call | ||
604 | 606 | ||
605 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) | 607 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) |
606 | 608 | ||
diff --git a/kernel/cred.c b/kernel/cred.c index 6a1aa004e376..3a9d6dd53a6c 100644 --- a/kernel/cred.c +++ b/kernel/cred.c | |||
@@ -252,13 +252,13 @@ struct cred *cred_alloc_blank(void) | |||
252 | #endif | 252 | #endif |
253 | 253 | ||
254 | atomic_set(&new->usage, 1); | 254 | atomic_set(&new->usage, 1); |
255 | #ifdef CONFIG_DEBUG_CREDENTIALS | ||
256 | new->magic = CRED_MAGIC; | ||
257 | #endif | ||
255 | 258 | ||
256 | if (security_cred_alloc_blank(new, GFP_KERNEL) < 0) | 259 | if (security_cred_alloc_blank(new, GFP_KERNEL) < 0) |
257 | goto error; | 260 | goto error; |
258 | 261 | ||
259 | #ifdef CONFIG_DEBUG_CREDENTIALS | ||
260 | new->magic = CRED_MAGIC; | ||
261 | #endif | ||
262 | return new; | 262 | return new; |
263 | 263 | ||
264 | error: | 264 | error: |
@@ -657,6 +657,8 @@ struct cred *prepare_kernel_cred(struct task_struct *daemon) | |||
657 | validate_creds(old); | 657 | validate_creds(old); |
658 | 658 | ||
659 | *new = *old; | 659 | *new = *old; |
660 | atomic_set(&new->usage, 1); | ||
661 | set_cred_subscribers(new, 0); | ||
660 | get_uid(new->user); | 662 | get_uid(new->user); |
661 | get_group_info(new->group_info); | 663 | get_group_info(new->group_info); |
662 | 664 | ||
@@ -674,8 +676,6 @@ struct cred *prepare_kernel_cred(struct task_struct *daemon) | |||
674 | if (security_prepare_creds(new, old, GFP_KERNEL) < 0) | 676 | if (security_prepare_creds(new, old, GFP_KERNEL) < 0) |
675 | goto error; | 677 | goto error; |
676 | 678 | ||
677 | atomic_set(&new->usage, 1); | ||
678 | set_cred_subscribers(new, 0); | ||
679 | put_cred(old); | 679 | put_cred(old); |
680 | validate_creds(new); | 680 | validate_creds(new); |
681 | return new; | 681 | return new; |
@@ -748,7 +748,11 @@ bool creds_are_invalid(const struct cred *cred) | |||
748 | if (cred->magic != CRED_MAGIC) | 748 | if (cred->magic != CRED_MAGIC) |
749 | return true; | 749 | return true; |
750 | #ifdef CONFIG_SECURITY_SELINUX | 750 | #ifdef CONFIG_SECURITY_SELINUX |
751 | if (selinux_is_enabled()) { | 751 | /* |
752 | * cred->security == NULL if security_cred_alloc_blank() or | ||
753 | * security_prepare_creds() returned an error. | ||
754 | */ | ||
755 | if (selinux_is_enabled() && cred->security) { | ||
752 | if ((unsigned long) cred->security < PAGE_SIZE) | 756 | if ((unsigned long) cred->security < PAGE_SIZE) |
753 | return true; | 757 | return true; |
754 | if ((*(u32 *)cred->security & 0xffffff00) == | 758 | if ((*(u32 *)cred->security & 0xffffff00) == |
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c index 538fce2db51c..a06b9b6d6b57 100644 --- a/kernel/irq/manage.c +++ b/kernel/irq/manage.c | |||
@@ -359,8 +359,17 @@ EXPORT_SYMBOL(disable_irq); | |||
359 | 359 | ||
360 | void __enable_irq(struct irq_desc *desc, unsigned int irq, bool resume) | 360 | void __enable_irq(struct irq_desc *desc, unsigned int irq, bool resume) |
361 | { | 361 | { |
362 | if (resume) | 362 | if (resume) { |
363 | if (!(desc->status & IRQ_SUSPENDED)) { | ||
364 | if (!desc->action) | ||
365 | return; | ||
366 | if (!(desc->action->flags & IRQF_FORCE_RESUME)) | ||
367 | return; | ||
368 | /* Pretend that it got disabled ! */ | ||
369 | desc->depth++; | ||
370 | } | ||
363 | desc->status &= ~IRQ_SUSPENDED; | 371 | desc->status &= ~IRQ_SUSPENDED; |
372 | } | ||
364 | 373 | ||
365 | switch (desc->depth) { | 374 | switch (desc->depth) { |
366 | case 0: | 375 | case 0: |
diff --git a/kernel/irq/pm.c b/kernel/irq/pm.c index 0d4005d85b03..d6bfb89cce91 100644 --- a/kernel/irq/pm.c +++ b/kernel/irq/pm.c | |||
@@ -53,9 +53,6 @@ void resume_device_irqs(void) | |||
53 | for_each_irq_desc(irq, desc) { | 53 | for_each_irq_desc(irq, desc) { |
54 | unsigned long flags; | 54 | unsigned long flags; |
55 | 55 | ||
56 | if (!(desc->status & IRQ_SUSPENDED)) | ||
57 | continue; | ||
58 | |||
59 | raw_spin_lock_irqsave(&desc->lock, flags); | 56 | raw_spin_lock_irqsave(&desc->lock, flags); |
60 | __enable_irq(desc, irq, true); | 57 | __enable_irq(desc, irq, true); |
61 | raw_spin_unlock_irqrestore(&desc->lock, flags); | 58 | raw_spin_unlock_irqrestore(&desc->lock, flags); |
diff --git a/kernel/module.c b/kernel/module.c index 34e00b708fad..efa290ea94bf 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -2460,9 +2460,9 @@ static void find_module_sections(struct module *mod, struct load_info *info) | |||
2460 | #endif | 2460 | #endif |
2461 | 2461 | ||
2462 | #ifdef CONFIG_TRACEPOINTS | 2462 | #ifdef CONFIG_TRACEPOINTS |
2463 | mod->tracepoints = section_objs(info, "__tracepoints", | 2463 | mod->tracepoints_ptrs = section_objs(info, "__tracepoints_ptrs", |
2464 | sizeof(*mod->tracepoints), | 2464 | sizeof(*mod->tracepoints_ptrs), |
2465 | &mod->num_tracepoints); | 2465 | &mod->num_tracepoints); |
2466 | #endif | 2466 | #endif |
2467 | #ifdef HAVE_JUMP_LABEL | 2467 | #ifdef HAVE_JUMP_LABEL |
2468 | mod->jump_entries = section_objs(info, "__jump_table", | 2468 | mod->jump_entries = section_objs(info, "__jump_table", |
@@ -3393,7 +3393,7 @@ void module_layout(struct module *mod, | |||
3393 | struct modversion_info *ver, | 3393 | struct modversion_info *ver, |
3394 | struct kernel_param *kp, | 3394 | struct kernel_param *kp, |
3395 | struct kernel_symbol *ks, | 3395 | struct kernel_symbol *ks, |
3396 | struct tracepoint *tp) | 3396 | struct tracepoint * const *tp) |
3397 | { | 3397 | { |
3398 | } | 3398 | } |
3399 | EXPORT_SYMBOL(module_layout); | 3399 | EXPORT_SYMBOL(module_layout); |
@@ -3407,8 +3407,8 @@ void module_update_tracepoints(void) | |||
3407 | mutex_lock(&module_mutex); | 3407 | mutex_lock(&module_mutex); |
3408 | list_for_each_entry(mod, &modules, list) | 3408 | list_for_each_entry(mod, &modules, list) |
3409 | if (!mod->taints) | 3409 | if (!mod->taints) |
3410 | tracepoint_update_probe_range(mod->tracepoints, | 3410 | tracepoint_update_probe_range(mod->tracepoints_ptrs, |
3411 | mod->tracepoints + mod->num_tracepoints); | 3411 | mod->tracepoints_ptrs + mod->num_tracepoints); |
3412 | mutex_unlock(&module_mutex); | 3412 | mutex_unlock(&module_mutex); |
3413 | } | 3413 | } |
3414 | 3414 | ||
@@ -3432,8 +3432,8 @@ int module_get_iter_tracepoints(struct tracepoint_iter *iter) | |||
3432 | else if (iter_mod > iter->module) | 3432 | else if (iter_mod > iter->module) |
3433 | iter->tracepoint = NULL; | 3433 | iter->tracepoint = NULL; |
3434 | found = tracepoint_get_iter_range(&iter->tracepoint, | 3434 | found = tracepoint_get_iter_range(&iter->tracepoint, |
3435 | iter_mod->tracepoints, | 3435 | iter_mod->tracepoints_ptrs, |
3436 | iter_mod->tracepoints | 3436 | iter_mod->tracepoints_ptrs |
3437 | + iter_mod->num_tracepoints); | 3437 | + iter_mod->num_tracepoints); |
3438 | if (found) { | 3438 | if (found) { |
3439 | iter->module = iter_mod; | 3439 | iter->module = iter_mod; |
diff --git a/kernel/timer.c b/kernel/timer.c index 43ca9936f2d0..d53ce66daea0 100644 --- a/kernel/timer.c +++ b/kernel/timer.c | |||
@@ -969,10 +969,14 @@ EXPORT_SYMBOL(try_to_del_timer_sync); | |||
969 | int del_timer_sync(struct timer_list *timer) | 969 | int del_timer_sync(struct timer_list *timer) |
970 | { | 970 | { |
971 | #ifdef CONFIG_LOCKDEP | 971 | #ifdef CONFIG_LOCKDEP |
972 | unsigned long flags; | ||
973 | |||
974 | raw_local_irq_save(flags); | ||
972 | local_bh_disable(); | 975 | local_bh_disable(); |
973 | lock_map_acquire(&timer->lockdep_map); | 976 | lock_map_acquire(&timer->lockdep_map); |
974 | lock_map_release(&timer->lockdep_map); | 977 | lock_map_release(&timer->lockdep_map); |
975 | local_bh_enable(); | 978 | _local_bh_enable(); |
979 | raw_local_irq_restore(flags); | ||
976 | #endif | 980 | #endif |
977 | /* | 981 | /* |
978 | * don't use it in hardirq context, because it | 982 | * don't use it in hardirq context, because it |
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index 35fde09b81de..5f499e0438a4 100644 --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c | |||
@@ -1284,7 +1284,7 @@ trace_create_file_ops(struct module *mod) | |||
1284 | static void trace_module_add_events(struct module *mod) | 1284 | static void trace_module_add_events(struct module *mod) |
1285 | { | 1285 | { |
1286 | struct ftrace_module_file_ops *file_ops = NULL; | 1286 | struct ftrace_module_file_ops *file_ops = NULL; |
1287 | struct ftrace_event_call *call, *start, *end; | 1287 | struct ftrace_event_call **call, **start, **end; |
1288 | 1288 | ||
1289 | start = mod->trace_events; | 1289 | start = mod->trace_events; |
1290 | end = mod->trace_events + mod->num_trace_events; | 1290 | end = mod->trace_events + mod->num_trace_events; |
@@ -1297,7 +1297,7 @@ static void trace_module_add_events(struct module *mod) | |||
1297 | return; | 1297 | return; |
1298 | 1298 | ||
1299 | for_each_event(call, start, end) { | 1299 | for_each_event(call, start, end) { |
1300 | __trace_add_event_call(call, mod, | 1300 | __trace_add_event_call(*call, mod, |
1301 | &file_ops->id, &file_ops->enable, | 1301 | &file_ops->id, &file_ops->enable, |
1302 | &file_ops->filter, &file_ops->format); | 1302 | &file_ops->filter, &file_ops->format); |
1303 | } | 1303 | } |
@@ -1367,8 +1367,8 @@ static struct notifier_block trace_module_nb = { | |||
1367 | .priority = 0, | 1367 | .priority = 0, |
1368 | }; | 1368 | }; |
1369 | 1369 | ||
1370 | extern struct ftrace_event_call __start_ftrace_events[]; | 1370 | extern struct ftrace_event_call *__start_ftrace_events[]; |
1371 | extern struct ftrace_event_call __stop_ftrace_events[]; | 1371 | extern struct ftrace_event_call *__stop_ftrace_events[]; |
1372 | 1372 | ||
1373 | static char bootup_event_buf[COMMAND_LINE_SIZE] __initdata; | 1373 | static char bootup_event_buf[COMMAND_LINE_SIZE] __initdata; |
1374 | 1374 | ||
@@ -1384,7 +1384,7 @@ __setup("trace_event=", setup_trace_event); | |||
1384 | 1384 | ||
1385 | static __init int event_trace_init(void) | 1385 | static __init int event_trace_init(void) |
1386 | { | 1386 | { |
1387 | struct ftrace_event_call *call; | 1387 | struct ftrace_event_call **call; |
1388 | struct dentry *d_tracer; | 1388 | struct dentry *d_tracer; |
1389 | struct dentry *entry; | 1389 | struct dentry *entry; |
1390 | struct dentry *d_events; | 1390 | struct dentry *d_events; |
@@ -1430,7 +1430,7 @@ static __init int event_trace_init(void) | |||
1430 | pr_warning("tracing: Failed to allocate common fields"); | 1430 | pr_warning("tracing: Failed to allocate common fields"); |
1431 | 1431 | ||
1432 | for_each_event(call, __start_ftrace_events, __stop_ftrace_events) { | 1432 | for_each_event(call, __start_ftrace_events, __stop_ftrace_events) { |
1433 | __trace_add_event_call(call, NULL, &ftrace_event_id_fops, | 1433 | __trace_add_event_call(*call, NULL, &ftrace_event_id_fops, |
1434 | &ftrace_enable_fops, | 1434 | &ftrace_enable_fops, |
1435 | &ftrace_event_filter_fops, | 1435 | &ftrace_event_filter_fops, |
1436 | &ftrace_event_format_fops); | 1436 | &ftrace_event_format_fops); |
diff --git a/kernel/trace/trace_export.c b/kernel/trace/trace_export.c index 4b74d71705c0..bbeec31e0ae3 100644 --- a/kernel/trace/trace_export.c +++ b/kernel/trace/trace_export.c | |||
@@ -161,13 +161,13 @@ struct ftrace_event_class event_class_ftrace_##call = { \ | |||
161 | .fields = LIST_HEAD_INIT(event_class_ftrace_##call.fields),\ | 161 | .fields = LIST_HEAD_INIT(event_class_ftrace_##call.fields),\ |
162 | }; \ | 162 | }; \ |
163 | \ | 163 | \ |
164 | struct ftrace_event_call __used \ | 164 | struct ftrace_event_call __used event_##call = { \ |
165 | __attribute__((__aligned__(4))) \ | ||
166 | __attribute__((section("_ftrace_events"))) event_##call = { \ | ||
167 | .name = #call, \ | 165 | .name = #call, \ |
168 | .event.type = etype, \ | 166 | .event.type = etype, \ |
169 | .class = &event_class_ftrace_##call, \ | 167 | .class = &event_class_ftrace_##call, \ |
170 | .print_fmt = print, \ | 168 | .print_fmt = print, \ |
171 | }; \ | 169 | }; \ |
170 | struct ftrace_event_call __used \ | ||
171 | __attribute__((section("_ftrace_events"))) *__event_##call = &event_##call; | ||
172 | 172 | ||
173 | #include "trace_entries.h" | 173 | #include "trace_entries.h" |
diff --git a/kernel/trace/trace_syscalls.c b/kernel/trace/trace_syscalls.c index b706529b4fc7..5c9fe08d2093 100644 --- a/kernel/trace/trace_syscalls.c +++ b/kernel/trace/trace_syscalls.c | |||
@@ -55,20 +55,21 @@ struct ftrace_event_class event_class_syscall_exit = { | |||
55 | .raw_init = init_syscall_trace, | 55 | .raw_init = init_syscall_trace, |
56 | }; | 56 | }; |
57 | 57 | ||
58 | extern unsigned long __start_syscalls_metadata[]; | 58 | extern struct syscall_metadata *__start_syscalls_metadata[]; |
59 | extern unsigned long __stop_syscalls_metadata[]; | 59 | extern struct syscall_metadata *__stop_syscalls_metadata[]; |
60 | 60 | ||
61 | static struct syscall_metadata **syscalls_metadata; | 61 | static struct syscall_metadata **syscalls_metadata; |
62 | 62 | ||
63 | static struct syscall_metadata *find_syscall_meta(unsigned long syscall) | 63 | static __init struct syscall_metadata * |
64 | find_syscall_meta(unsigned long syscall) | ||
64 | { | 65 | { |
65 | struct syscall_metadata *start; | 66 | struct syscall_metadata **start; |
66 | struct syscall_metadata *stop; | 67 | struct syscall_metadata **stop; |
67 | char str[KSYM_SYMBOL_LEN]; | 68 | char str[KSYM_SYMBOL_LEN]; |
68 | 69 | ||
69 | 70 | ||
70 | start = (struct syscall_metadata *)__start_syscalls_metadata; | 71 | start = __start_syscalls_metadata; |
71 | stop = (struct syscall_metadata *)__stop_syscalls_metadata; | 72 | stop = __stop_syscalls_metadata; |
72 | kallsyms_lookup(syscall, NULL, NULL, NULL, str); | 73 | kallsyms_lookup(syscall, NULL, NULL, NULL, str); |
73 | 74 | ||
74 | for ( ; start < stop; start++) { | 75 | for ( ; start < stop; start++) { |
@@ -78,8 +79,8 @@ static struct syscall_metadata *find_syscall_meta(unsigned long syscall) | |||
78 | * with "SyS" instead of "sys", leading to an unwanted | 79 | * with "SyS" instead of "sys", leading to an unwanted |
79 | * mismatch. | 80 | * mismatch. |
80 | */ | 81 | */ |
81 | if (start->name && !strcmp(start->name + 3, str + 3)) | 82 | if ((*start)->name && !strcmp((*start)->name + 3, str + 3)) |
82 | return start; | 83 | return *start; |
83 | } | 84 | } |
84 | return NULL; | 85 | return NULL; |
85 | } | 86 | } |
diff --git a/kernel/tracepoint.c b/kernel/tracepoint.c index e95ee7f31d43..68187af4889e 100644 --- a/kernel/tracepoint.c +++ b/kernel/tracepoint.c | |||
@@ -27,8 +27,8 @@ | |||
27 | #include <linux/sched.h> | 27 | #include <linux/sched.h> |
28 | #include <linux/jump_label.h> | 28 | #include <linux/jump_label.h> |
29 | 29 | ||
30 | extern struct tracepoint __start___tracepoints[]; | 30 | extern struct tracepoint * const __start___tracepoints_ptrs[]; |
31 | extern struct tracepoint __stop___tracepoints[]; | 31 | extern struct tracepoint * const __stop___tracepoints_ptrs[]; |
32 | 32 | ||
33 | /* Set to 1 to enable tracepoint debug output */ | 33 | /* Set to 1 to enable tracepoint debug output */ |
34 | static const int tracepoint_debug; | 34 | static const int tracepoint_debug; |
@@ -298,10 +298,10 @@ static void disable_tracepoint(struct tracepoint *elem) | |||
298 | * | 298 | * |
299 | * Updates the probe callback corresponding to a range of tracepoints. | 299 | * Updates the probe callback corresponding to a range of tracepoints. |
300 | */ | 300 | */ |
301 | void | 301 | void tracepoint_update_probe_range(struct tracepoint * const *begin, |
302 | tracepoint_update_probe_range(struct tracepoint *begin, struct tracepoint *end) | 302 | struct tracepoint * const *end) |
303 | { | 303 | { |
304 | struct tracepoint *iter; | 304 | struct tracepoint * const *iter; |
305 | struct tracepoint_entry *mark_entry; | 305 | struct tracepoint_entry *mark_entry; |
306 | 306 | ||
307 | if (!begin) | 307 | if (!begin) |
@@ -309,12 +309,12 @@ tracepoint_update_probe_range(struct tracepoint *begin, struct tracepoint *end) | |||
309 | 309 | ||
310 | mutex_lock(&tracepoints_mutex); | 310 | mutex_lock(&tracepoints_mutex); |
311 | for (iter = begin; iter < end; iter++) { | 311 | for (iter = begin; iter < end; iter++) { |
312 | mark_entry = get_tracepoint(iter->name); | 312 | mark_entry = get_tracepoint((*iter)->name); |
313 | if (mark_entry) { | 313 | if (mark_entry) { |
314 | set_tracepoint(&mark_entry, iter, | 314 | set_tracepoint(&mark_entry, *iter, |
315 | !!mark_entry->refcount); | 315 | !!mark_entry->refcount); |
316 | } else { | 316 | } else { |
317 | disable_tracepoint(iter); | 317 | disable_tracepoint(*iter); |
318 | } | 318 | } |
319 | } | 319 | } |
320 | mutex_unlock(&tracepoints_mutex); | 320 | mutex_unlock(&tracepoints_mutex); |
@@ -326,8 +326,8 @@ tracepoint_update_probe_range(struct tracepoint *begin, struct tracepoint *end) | |||
326 | static void tracepoint_update_probes(void) | 326 | static void tracepoint_update_probes(void) |
327 | { | 327 | { |
328 | /* Core kernel tracepoints */ | 328 | /* Core kernel tracepoints */ |
329 | tracepoint_update_probe_range(__start___tracepoints, | 329 | tracepoint_update_probe_range(__start___tracepoints_ptrs, |
330 | __stop___tracepoints); | 330 | __stop___tracepoints_ptrs); |
331 | /* tracepoints in modules. */ | 331 | /* tracepoints in modules. */ |
332 | module_update_tracepoints(); | 332 | module_update_tracepoints(); |
333 | } | 333 | } |
@@ -514,8 +514,8 @@ EXPORT_SYMBOL_GPL(tracepoint_probe_update_all); | |||
514 | * Will return the first tracepoint in the range if the input tracepoint is | 514 | * Will return the first tracepoint in the range if the input tracepoint is |
515 | * NULL. | 515 | * NULL. |
516 | */ | 516 | */ |
517 | int tracepoint_get_iter_range(struct tracepoint **tracepoint, | 517 | int tracepoint_get_iter_range(struct tracepoint * const **tracepoint, |
518 | struct tracepoint *begin, struct tracepoint *end) | 518 | struct tracepoint * const *begin, struct tracepoint * const *end) |
519 | { | 519 | { |
520 | if (!*tracepoint && begin != end) { | 520 | if (!*tracepoint && begin != end) { |
521 | *tracepoint = begin; | 521 | *tracepoint = begin; |
@@ -534,7 +534,8 @@ static void tracepoint_get_iter(struct tracepoint_iter *iter) | |||
534 | /* Core kernel tracepoints */ | 534 | /* Core kernel tracepoints */ |
535 | if (!iter->module) { | 535 | if (!iter->module) { |
536 | found = tracepoint_get_iter_range(&iter->tracepoint, | 536 | found = tracepoint_get_iter_range(&iter->tracepoint, |
537 | __start___tracepoints, __stop___tracepoints); | 537 | __start___tracepoints_ptrs, |
538 | __stop___tracepoints_ptrs); | ||
538 | if (found) | 539 | if (found) |
539 | goto end; | 540 | goto end; |
540 | } | 541 | } |
@@ -585,8 +586,8 @@ int tracepoint_module_notify(struct notifier_block *self, | |||
585 | switch (val) { | 586 | switch (val) { |
586 | case MODULE_STATE_COMING: | 587 | case MODULE_STATE_COMING: |
587 | case MODULE_STATE_GOING: | 588 | case MODULE_STATE_GOING: |
588 | tracepoint_update_probe_range(mod->tracepoints, | 589 | tracepoint_update_probe_range(mod->tracepoints_ptrs, |
589 | mod->tracepoints + mod->num_tracepoints); | 590 | mod->tracepoints_ptrs + mod->num_tracepoints); |
590 | break; | 591 | break; |
591 | } | 592 | } |
592 | return 0; | 593 | return 0; |
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index e276eb468536..c8d699270687 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c | |||
@@ -3198,7 +3198,11 @@ static void selinux_cred_free(struct cred *cred) | |||
3198 | { | 3198 | { |
3199 | struct task_security_struct *tsec = cred->security; | 3199 | struct task_security_struct *tsec = cred->security; |
3200 | 3200 | ||
3201 | BUG_ON((unsigned long) cred->security < PAGE_SIZE); | 3201 | /* |
3202 | * cred->security == NULL if security_cred_alloc_blank() or | ||
3203 | * security_prepare_creds() returned an error. | ||
3204 | */ | ||
3205 | BUG_ON(cred->security && (unsigned long) cred->security < PAGE_SIZE); | ||
3202 | cred->security = (void *) 0x7UL; | 3206 | cred->security = (void *) 0x7UL; |
3203 | kfree(tsec); | 3207 | kfree(tsec); |
3204 | } | 3208 | } |
diff --git a/sound/arm/aaci.c b/sound/arm/aaci.c index 24d3013c0231..7c1fc64cb53d 100644 --- a/sound/arm/aaci.c +++ b/sound/arm/aaci.c | |||
@@ -50,7 +50,11 @@ static void aaci_ac97_select_codec(struct aaci *aaci, struct snd_ac97 *ac97) | |||
50 | if (v & SLFR_1RXV) | 50 | if (v & SLFR_1RXV) |
51 | readl(aaci->base + AACI_SL1RX); | 51 | readl(aaci->base + AACI_SL1RX); |
52 | 52 | ||
53 | writel(maincr, aaci->base + AACI_MAINCR); | 53 | if (maincr != readl(aaci->base + AACI_MAINCR)) { |
54 | writel(maincr, aaci->base + AACI_MAINCR); | ||
55 | readl(aaci->base + AACI_MAINCR); | ||
56 | udelay(1); | ||
57 | } | ||
54 | } | 58 | } |
55 | 59 | ||
56 | /* | 60 | /* |
@@ -993,6 +997,8 @@ static unsigned int __devinit aaci_size_fifo(struct aaci *aaci) | |||
993 | * disabling the channel doesn't clear the FIFO. | 997 | * disabling the channel doesn't clear the FIFO. |
994 | */ | 998 | */ |
995 | writel(aaci->maincr & ~MAINCR_IE, aaci->base + AACI_MAINCR); | 999 | writel(aaci->maincr & ~MAINCR_IE, aaci->base + AACI_MAINCR); |
1000 | readl(aaci->base + AACI_MAINCR); | ||
1001 | udelay(1); | ||
996 | writel(aaci->maincr, aaci->base + AACI_MAINCR); | 1002 | writel(aaci->maincr, aaci->base + AACI_MAINCR); |
997 | 1003 | ||
998 | /* | 1004 | /* |
diff --git a/sound/drivers/mtpav.c b/sound/drivers/mtpav.c index da03597fc893..5c426df87678 100644 --- a/sound/drivers/mtpav.c +++ b/sound/drivers/mtpav.c | |||
@@ -55,14 +55,13 @@ | |||
55 | #include <linux/err.h> | 55 | #include <linux/err.h> |
56 | #include <linux/platform_device.h> | 56 | #include <linux/platform_device.h> |
57 | #include <linux/ioport.h> | 57 | #include <linux/ioport.h> |
58 | #include <linux/io.h> | ||
58 | #include <linux/moduleparam.h> | 59 | #include <linux/moduleparam.h> |
59 | #include <sound/core.h> | 60 | #include <sound/core.h> |
60 | #include <sound/initval.h> | 61 | #include <sound/initval.h> |
61 | #include <sound/rawmidi.h> | 62 | #include <sound/rawmidi.h> |
62 | #include <linux/delay.h> | 63 | #include <linux/delay.h> |
63 | 64 | ||
64 | #include <asm/io.h> | ||
65 | |||
66 | /* | 65 | /* |
67 | * globals | 66 | * globals |
68 | */ | 67 | */ |
diff --git a/sound/oss/Makefile b/sound/oss/Makefile index 96f14dcd0cd1..90ffb99c6b17 100644 --- a/sound/oss/Makefile +++ b/sound/oss/Makefile | |||
@@ -87,7 +87,7 @@ ifeq ($(CONFIG_PSS_HAVE_BOOT),y) | |||
87 | $(obj)/bin2hex pss_synth < $< > $@ | 87 | $(obj)/bin2hex pss_synth < $< > $@ |
88 | else | 88 | else |
89 | $(obj)/pss_boot.h: | 89 | $(obj)/pss_boot.h: |
90 | ( \ | 90 | $(Q)( \ |
91 | echo 'static unsigned char * pss_synth = NULL;'; \ | 91 | echo 'static unsigned char * pss_synth = NULL;'; \ |
92 | echo 'static int pss_synthLen = 0;'; \ | 92 | echo 'static int pss_synthLen = 0;'; \ |
93 | ) > $@ | 93 | ) > $@ |
@@ -102,7 +102,7 @@ ifeq ($(CONFIG_TRIX_HAVE_BOOT),y) | |||
102 | $(obj)/hex2hex -i trix_boot < $< > $@ | 102 | $(obj)/hex2hex -i trix_boot < $< > $@ |
103 | else | 103 | else |
104 | $(obj)/trix_boot.h: | 104 | $(obj)/trix_boot.h: |
105 | ( \ | 105 | $(Q)( \ |
106 | echo 'static unsigned char * trix_boot = NULL;'; \ | 106 | echo 'static unsigned char * trix_boot = NULL;'; \ |
107 | echo 'static int trix_boot_len = 0;'; \ | 107 | echo 'static int trix_boot_len = 0;'; \ |
108 | ) > $@ | 108 | ) > $@ |
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index 9bb030a469cd..fbe97d32140d 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c | |||
@@ -85,6 +85,7 @@ struct conexant_spec { | |||
85 | unsigned int auto_mic; | 85 | unsigned int auto_mic; |
86 | int auto_mic_ext; /* autocfg.inputs[] index for ext mic */ | 86 | int auto_mic_ext; /* autocfg.inputs[] index for ext mic */ |
87 | unsigned int need_dac_fix; | 87 | unsigned int need_dac_fix; |
88 | hda_nid_t slave_dig_outs[2]; | ||
88 | 89 | ||
89 | /* capture */ | 90 | /* capture */ |
90 | unsigned int num_adc_nids; | 91 | unsigned int num_adc_nids; |
@@ -127,6 +128,7 @@ struct conexant_spec { | |||
127 | unsigned int ideapad:1; | 128 | unsigned int ideapad:1; |
128 | unsigned int thinkpad:1; | 129 | unsigned int thinkpad:1; |
129 | unsigned int hp_laptop:1; | 130 | unsigned int hp_laptop:1; |
131 | unsigned int asus:1; | ||
130 | 132 | ||
131 | unsigned int ext_mic_present; | 133 | unsigned int ext_mic_present; |
132 | unsigned int recording; | 134 | unsigned int recording; |
@@ -352,6 +354,8 @@ static int conexant_build_pcms(struct hda_codec *codec) | |||
352 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = | 354 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
353 | spec->dig_in_nid; | 355 | spec->dig_in_nid; |
354 | } | 356 | } |
357 | if (spec->slave_dig_outs[0]) | ||
358 | codec->slave_dig_outs = spec->slave_dig_outs; | ||
355 | } | 359 | } |
356 | 360 | ||
357 | return 0; | 361 | return 0; |
@@ -403,10 +407,16 @@ static int conexant_add_jack(struct hda_codec *codec, | |||
403 | struct conexant_spec *spec; | 407 | struct conexant_spec *spec; |
404 | struct conexant_jack *jack; | 408 | struct conexant_jack *jack; |
405 | const char *name; | 409 | const char *name; |
406 | int err; | 410 | int i, err; |
407 | 411 | ||
408 | spec = codec->spec; | 412 | spec = codec->spec; |
409 | snd_array_init(&spec->jacks, sizeof(*jack), 32); | 413 | snd_array_init(&spec->jacks, sizeof(*jack), 32); |
414 | |||
415 | jack = spec->jacks.list; | ||
416 | for (i = 0; i < spec->jacks.used; i++, jack++) | ||
417 | if (jack->nid == nid) | ||
418 | return 0 ; /* already present */ | ||
419 | |||
410 | jack = snd_array_new(&spec->jacks); | 420 | jack = snd_array_new(&spec->jacks); |
411 | name = (type == SND_JACK_HEADPHONE) ? "Headphone" : "Mic" ; | 421 | name = (type == SND_JACK_HEADPHONE) ? "Headphone" : "Mic" ; |
412 | 422 | ||
@@ -2100,7 +2110,7 @@ static int patch_cxt5051(struct hda_codec *codec) | |||
2100 | static hda_nid_t cxt5066_dac_nids[1] = { 0x10 }; | 2110 | static hda_nid_t cxt5066_dac_nids[1] = { 0x10 }; |
2101 | static hda_nid_t cxt5066_adc_nids[3] = { 0x14, 0x15, 0x16 }; | 2111 | static hda_nid_t cxt5066_adc_nids[3] = { 0x14, 0x15, 0x16 }; |
2102 | static hda_nid_t cxt5066_capsrc_nids[1] = { 0x17 }; | 2112 | static hda_nid_t cxt5066_capsrc_nids[1] = { 0x17 }; |
2103 | #define CXT5066_SPDIF_OUT 0x21 | 2113 | static hda_nid_t cxt5066_digout_pin_nids[2] = { 0x20, 0x22 }; |
2104 | 2114 | ||
2105 | /* OLPC's microphone port is DC coupled for use with external sensors, | 2115 | /* OLPC's microphone port is DC coupled for use with external sensors, |
2106 | * therefore we use a 50% mic bias in order to center the input signal with | 2116 | * therefore we use a 50% mic bias in order to center the input signal with |
@@ -2312,6 +2322,19 @@ static void cxt5066_ideapad_automic(struct hda_codec *codec) | |||
2312 | } | 2322 | } |
2313 | } | 2323 | } |
2314 | 2324 | ||
2325 | |||
2326 | /* toggle input of built-in digital mic and mic jack appropriately */ | ||
2327 | static void cxt5066_asus_automic(struct hda_codec *codec) | ||
2328 | { | ||
2329 | unsigned int present; | ||
2330 | |||
2331 | present = snd_hda_jack_detect(codec, 0x1b); | ||
2332 | snd_printdd("CXT5066: external microphone present=%d\n", present); | ||
2333 | snd_hda_codec_write(codec, 0x17, 0, AC_VERB_SET_CONNECT_SEL, | ||
2334 | present ? 1 : 0); | ||
2335 | } | ||
2336 | |||
2337 | |||
2315 | /* toggle input of built-in digital mic and mic jack appropriately */ | 2338 | /* toggle input of built-in digital mic and mic jack appropriately */ |
2316 | static void cxt5066_hp_laptop_automic(struct hda_codec *codec) | 2339 | static void cxt5066_hp_laptop_automic(struct hda_codec *codec) |
2317 | { | 2340 | { |
@@ -2387,79 +2410,55 @@ static void cxt5066_hp_automute(struct hda_codec *codec) | |||
2387 | cxt5066_update_speaker(codec); | 2410 | cxt5066_update_speaker(codec); |
2388 | } | 2411 | } |
2389 | 2412 | ||
2390 | /* unsolicited event for jack sensing */ | 2413 | /* Dispatch the right mic autoswitch function */ |
2391 | static void cxt5066_olpc_unsol_event(struct hda_codec *codec, unsigned int res) | 2414 | static void cxt5066_automic(struct hda_codec *codec) |
2392 | { | 2415 | { |
2393 | struct conexant_spec *spec = codec->spec; | 2416 | struct conexant_spec *spec = codec->spec; |
2394 | snd_printdd("CXT5066: unsol event %x (%x)\n", res, res >> 26); | ||
2395 | switch (res >> 26) { | ||
2396 | case CONEXANT_HP_EVENT: | ||
2397 | cxt5066_hp_automute(codec); | ||
2398 | break; | ||
2399 | case CONEXANT_MIC_EVENT: | ||
2400 | /* ignore mic events in DC mode; we're always using the jack */ | ||
2401 | if (!spec->dc_enable) | ||
2402 | cxt5066_olpc_automic(codec); | ||
2403 | break; | ||
2404 | } | ||
2405 | } | ||
2406 | 2417 | ||
2407 | /* unsolicited event for jack sensing */ | 2418 | if (spec->dell_vostro) |
2408 | static void cxt5066_vostro_event(struct hda_codec *codec, unsigned int res) | ||
2409 | { | ||
2410 | snd_printdd("CXT5066_vostro: unsol event %x (%x)\n", res, res >> 26); | ||
2411 | switch (res >> 26) { | ||
2412 | case CONEXANT_HP_EVENT: | ||
2413 | cxt5066_hp_automute(codec); | ||
2414 | break; | ||
2415 | case CONEXANT_MIC_EVENT: | ||
2416 | cxt5066_vostro_automic(codec); | 2419 | cxt5066_vostro_automic(codec); |
2417 | break; | 2420 | else if (spec->ideapad) |
2418 | } | ||
2419 | } | ||
2420 | |||
2421 | /* unsolicited event for jack sensing */ | ||
2422 | static void cxt5066_ideapad_event(struct hda_codec *codec, unsigned int res) | ||
2423 | { | ||
2424 | snd_printdd("CXT5066_ideapad: unsol event %x (%x)\n", res, res >> 26); | ||
2425 | switch (res >> 26) { | ||
2426 | case CONEXANT_HP_EVENT: | ||
2427 | cxt5066_hp_automute(codec); | ||
2428 | break; | ||
2429 | case CONEXANT_MIC_EVENT: | ||
2430 | cxt5066_ideapad_automic(codec); | 2421 | cxt5066_ideapad_automic(codec); |
2431 | break; | 2422 | else if (spec->thinkpad) |
2432 | } | 2423 | cxt5066_thinkpad_automic(codec); |
2424 | else if (spec->hp_laptop) | ||
2425 | cxt5066_hp_laptop_automic(codec); | ||
2426 | else if (spec->asus) | ||
2427 | cxt5066_asus_automic(codec); | ||
2433 | } | 2428 | } |
2434 | 2429 | ||
2435 | /* unsolicited event for jack sensing */ | 2430 | /* unsolicited event for jack sensing */ |
2436 | static void cxt5066_hp_laptop_event(struct hda_codec *codec, unsigned int res) | 2431 | static void cxt5066_olpc_unsol_event(struct hda_codec *codec, unsigned int res) |
2437 | { | 2432 | { |
2438 | snd_printdd("CXT5066_hp_laptop: unsol event %x (%x)\n", res, res >> 26); | 2433 | struct conexant_spec *spec = codec->spec; |
2434 | snd_printdd("CXT5066: unsol event %x (%x)\n", res, res >> 26); | ||
2439 | switch (res >> 26) { | 2435 | switch (res >> 26) { |
2440 | case CONEXANT_HP_EVENT: | 2436 | case CONEXANT_HP_EVENT: |
2441 | cxt5066_hp_automute(codec); | 2437 | cxt5066_hp_automute(codec); |
2442 | break; | 2438 | break; |
2443 | case CONEXANT_MIC_EVENT: | 2439 | case CONEXANT_MIC_EVENT: |
2444 | cxt5066_hp_laptop_automic(codec); | 2440 | /* ignore mic events in DC mode; we're always using the jack */ |
2441 | if (!spec->dc_enable) | ||
2442 | cxt5066_olpc_automic(codec); | ||
2445 | break; | 2443 | break; |
2446 | } | 2444 | } |
2447 | } | 2445 | } |
2448 | 2446 | ||
2449 | /* unsolicited event for jack sensing */ | 2447 | /* unsolicited event for jack sensing */ |
2450 | static void cxt5066_thinkpad_event(struct hda_codec *codec, unsigned int res) | 2448 | static void cxt5066_unsol_event(struct hda_codec *codec, unsigned int res) |
2451 | { | 2449 | { |
2452 | snd_printdd("CXT5066_thinkpad: unsol event %x (%x)\n", res, res >> 26); | 2450 | snd_printdd("CXT5066: unsol event %x (%x)\n", res, res >> 26); |
2453 | switch (res >> 26) { | 2451 | switch (res >> 26) { |
2454 | case CONEXANT_HP_EVENT: | 2452 | case CONEXANT_HP_EVENT: |
2455 | cxt5066_hp_automute(codec); | 2453 | cxt5066_hp_automute(codec); |
2456 | break; | 2454 | break; |
2457 | case CONEXANT_MIC_EVENT: | 2455 | case CONEXANT_MIC_EVENT: |
2458 | cxt5066_thinkpad_automic(codec); | 2456 | cxt5066_automic(codec); |
2459 | break; | 2457 | break; |
2460 | } | 2458 | } |
2461 | } | 2459 | } |
2462 | 2460 | ||
2461 | |||
2463 | static const struct hda_input_mux cxt5066_analog_mic_boost = { | 2462 | static const struct hda_input_mux cxt5066_analog_mic_boost = { |
2464 | .num_items = 5, | 2463 | .num_items = 5, |
2465 | .items = { | 2464 | .items = { |
@@ -2633,6 +2632,27 @@ static void cxt5066_olpc_capture_cleanup(struct hda_codec *codec) | |||
2633 | spec->recording = 0; | 2632 | spec->recording = 0; |
2634 | } | 2633 | } |
2635 | 2634 | ||
2635 | static void conexant_check_dig_outs(struct hda_codec *codec, | ||
2636 | hda_nid_t *dig_pins, | ||
2637 | int num_pins) | ||
2638 | { | ||
2639 | struct conexant_spec *spec = codec->spec; | ||
2640 | hda_nid_t *nid_loc = &spec->multiout.dig_out_nid; | ||
2641 | int i; | ||
2642 | |||
2643 | for (i = 0; i < num_pins; i++, dig_pins++) { | ||
2644 | unsigned int cfg = snd_hda_codec_get_pincfg(codec, *dig_pins); | ||
2645 | if (get_defcfg_connect(cfg) == AC_JACK_PORT_NONE) | ||
2646 | continue; | ||
2647 | if (snd_hda_get_connections(codec, *dig_pins, nid_loc, 1) != 1) | ||
2648 | continue; | ||
2649 | if (spec->slave_dig_outs[0]) | ||
2650 | nid_loc++; | ||
2651 | else | ||
2652 | nid_loc = spec->slave_dig_outs; | ||
2653 | } | ||
2654 | } | ||
2655 | |||
2636 | static struct hda_input_mux cxt5066_capture_source = { | 2656 | static struct hda_input_mux cxt5066_capture_source = { |
2637 | .num_items = 4, | 2657 | .num_items = 4, |
2638 | .items = { | 2658 | .items = { |
@@ -3039,20 +3059,11 @@ static struct hda_verb cxt5066_init_verbs_hp_laptop[] = { | |||
3039 | /* initialize jack-sensing, too */ | 3059 | /* initialize jack-sensing, too */ |
3040 | static int cxt5066_init(struct hda_codec *codec) | 3060 | static int cxt5066_init(struct hda_codec *codec) |
3041 | { | 3061 | { |
3042 | struct conexant_spec *spec = codec->spec; | ||
3043 | |||
3044 | snd_printdd("CXT5066: init\n"); | 3062 | snd_printdd("CXT5066: init\n"); |
3045 | conexant_init(codec); | 3063 | conexant_init(codec); |
3046 | if (codec->patch_ops.unsol_event) { | 3064 | if (codec->patch_ops.unsol_event) { |
3047 | cxt5066_hp_automute(codec); | 3065 | cxt5066_hp_automute(codec); |
3048 | if (spec->dell_vostro) | 3066 | cxt5066_automic(codec); |
3049 | cxt5066_vostro_automic(codec); | ||
3050 | else if (spec->ideapad) | ||
3051 | cxt5066_ideapad_automic(codec); | ||
3052 | else if (spec->thinkpad) | ||
3053 | cxt5066_thinkpad_automic(codec); | ||
3054 | else if (spec->hp_laptop) | ||
3055 | cxt5066_hp_laptop_automic(codec); | ||
3056 | } | 3067 | } |
3057 | cxt5066_set_mic_boost(codec); | 3068 | cxt5066_set_mic_boost(codec); |
3058 | return 0; | 3069 | return 0; |
@@ -3080,6 +3091,7 @@ enum { | |||
3080 | CXT5066_DELL_VOSTRO, /* Dell Vostro 1015i */ | 3091 | CXT5066_DELL_VOSTRO, /* Dell Vostro 1015i */ |
3081 | CXT5066_IDEAPAD, /* Lenovo IdeaPad U150 */ | 3092 | CXT5066_IDEAPAD, /* Lenovo IdeaPad U150 */ |
3082 | CXT5066_THINKPAD, /* Lenovo ThinkPad T410s, others? */ | 3093 | CXT5066_THINKPAD, /* Lenovo ThinkPad T410s, others? */ |
3094 | CXT5066_ASUS, /* Asus K52JU, Lenovo G560 - Int mic at 0x1a and Ext mic at 0x1b */ | ||
3083 | CXT5066_HP_LAPTOP, /* HP Laptop */ | 3095 | CXT5066_HP_LAPTOP, /* HP Laptop */ |
3084 | CXT5066_MODELS | 3096 | CXT5066_MODELS |
3085 | }; | 3097 | }; |
@@ -3091,6 +3103,7 @@ static const char * const cxt5066_models[CXT5066_MODELS] = { | |||
3091 | [CXT5066_DELL_VOSTRO] = "dell-vostro", | 3103 | [CXT5066_DELL_VOSTRO] = "dell-vostro", |
3092 | [CXT5066_IDEAPAD] = "ideapad", | 3104 | [CXT5066_IDEAPAD] = "ideapad", |
3093 | [CXT5066_THINKPAD] = "thinkpad", | 3105 | [CXT5066_THINKPAD] = "thinkpad", |
3106 | [CXT5066_ASUS] = "asus", | ||
3094 | [CXT5066_HP_LAPTOP] = "hp-laptop", | 3107 | [CXT5066_HP_LAPTOP] = "hp-laptop", |
3095 | }; | 3108 | }; |
3096 | 3109 | ||
@@ -3102,7 +3115,9 @@ static struct snd_pci_quirk cxt5066_cfg_tbl[] = { | |||
3102 | SND_PCI_QUIRK(0x1028, 0x0402, "Dell Vostro", CXT5066_DELL_VOSTRO), | 3115 | SND_PCI_QUIRK(0x1028, 0x0402, "Dell Vostro", CXT5066_DELL_VOSTRO), |
3103 | SND_PCI_QUIRK(0x1028, 0x0408, "Dell Inspiron One 19T", CXT5066_IDEAPAD), | 3116 | SND_PCI_QUIRK(0x1028, 0x0408, "Dell Inspiron One 19T", CXT5066_IDEAPAD), |
3104 | SND_PCI_QUIRK(0x103c, 0x360b, "HP G60", CXT5066_HP_LAPTOP), | 3117 | SND_PCI_QUIRK(0x103c, 0x360b, "HP G60", CXT5066_HP_LAPTOP), |
3105 | SND_PCI_QUIRK(0x1043, 0x13f3, "Asus A52J", CXT5066_HP_LAPTOP), | 3118 | SND_PCI_QUIRK(0x1043, 0x13f3, "Asus A52J", CXT5066_ASUS), |
3119 | SND_PCI_QUIRK(0x1043, 0x1643, "Asus K52JU", CXT5066_ASUS), | ||
3120 | SND_PCI_QUIRK(0x1043, 0x1993, "Asus U50F", CXT5066_ASUS), | ||
3106 | SND_PCI_QUIRK(0x1179, 0xff1e, "Toshiba Satellite C650D", CXT5066_IDEAPAD), | 3121 | SND_PCI_QUIRK(0x1179, 0xff1e, "Toshiba Satellite C650D", CXT5066_IDEAPAD), |
3107 | SND_PCI_QUIRK(0x1179, 0xff50, "Toshiba Satellite P500-PSPGSC-01800T", CXT5066_OLPC_XO_1_5), | 3122 | SND_PCI_QUIRK(0x1179, 0xff50, "Toshiba Satellite P500-PSPGSC-01800T", CXT5066_OLPC_XO_1_5), |
3108 | SND_PCI_QUIRK(0x1179, 0xffe0, "Toshiba Satellite Pro T130-15F", CXT5066_OLPC_XO_1_5), | 3123 | SND_PCI_QUIRK(0x1179, 0xffe0, "Toshiba Satellite Pro T130-15F", CXT5066_OLPC_XO_1_5), |
@@ -3111,7 +3126,9 @@ static struct snd_pci_quirk cxt5066_cfg_tbl[] = { | |||
3111 | SND_PCI_QUIRK(0x152d, 0x0833, "OLPC XO-1.5", CXT5066_OLPC_XO_1_5), | 3126 | SND_PCI_QUIRK(0x152d, 0x0833, "OLPC XO-1.5", CXT5066_OLPC_XO_1_5), |
3112 | SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo T400s", CXT5066_THINKPAD), | 3127 | SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo T400s", CXT5066_THINKPAD), |
3113 | SND_PCI_QUIRK(0x17aa, 0x21c5, "Thinkpad Edge 13", CXT5066_THINKPAD), | 3128 | SND_PCI_QUIRK(0x17aa, 0x21c5, "Thinkpad Edge 13", CXT5066_THINKPAD), |
3129 | SND_PCI_QUIRK(0x17aa, 0x21c6, "Thinkpad Edge 13", CXT5066_ASUS), | ||
3114 | SND_PCI_QUIRK(0x17aa, 0x215e, "Lenovo Thinkpad", CXT5066_THINKPAD), | 3130 | SND_PCI_QUIRK(0x17aa, 0x215e, "Lenovo Thinkpad", CXT5066_THINKPAD), |
3131 | SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo G560", CXT5066_ASUS), | ||
3115 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", CXT5066_IDEAPAD), /* Fallback for Lenovos without dock mic */ | 3132 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", CXT5066_IDEAPAD), /* Fallback for Lenovos without dock mic */ |
3116 | {} | 3133 | {} |
3117 | }; | 3134 | }; |
@@ -3133,7 +3150,8 @@ static int patch_cxt5066(struct hda_codec *codec) | |||
3133 | spec->multiout.max_channels = 2; | 3150 | spec->multiout.max_channels = 2; |
3134 | spec->multiout.num_dacs = ARRAY_SIZE(cxt5066_dac_nids); | 3151 | spec->multiout.num_dacs = ARRAY_SIZE(cxt5066_dac_nids); |
3135 | spec->multiout.dac_nids = cxt5066_dac_nids; | 3152 | spec->multiout.dac_nids = cxt5066_dac_nids; |
3136 | spec->multiout.dig_out_nid = CXT5066_SPDIF_OUT; | 3153 | conexant_check_dig_outs(codec, cxt5066_digout_pin_nids, |
3154 | ARRAY_SIZE(cxt5066_digout_pin_nids)); | ||
3137 | spec->num_adc_nids = 1; | 3155 | spec->num_adc_nids = 1; |
3138 | spec->adc_nids = cxt5066_adc_nids; | 3156 | spec->adc_nids = cxt5066_adc_nids; |
3139 | spec->capsrc_nids = cxt5066_capsrc_nids; | 3157 | spec->capsrc_nids = cxt5066_capsrc_nids; |
@@ -3167,17 +3185,20 @@ static int patch_cxt5066(struct hda_codec *codec) | |||
3167 | spec->num_init_verbs++; | 3185 | spec->num_init_verbs++; |
3168 | spec->dell_automute = 1; | 3186 | spec->dell_automute = 1; |
3169 | break; | 3187 | break; |
3188 | case CXT5066_ASUS: | ||
3170 | case CXT5066_HP_LAPTOP: | 3189 | case CXT5066_HP_LAPTOP: |
3171 | codec->patch_ops.init = cxt5066_init; | 3190 | codec->patch_ops.init = cxt5066_init; |
3172 | codec->patch_ops.unsol_event = cxt5066_hp_laptop_event; | 3191 | codec->patch_ops.unsol_event = cxt5066_unsol_event; |
3173 | spec->init_verbs[spec->num_init_verbs] = | 3192 | spec->init_verbs[spec->num_init_verbs] = |
3174 | cxt5066_init_verbs_hp_laptop; | 3193 | cxt5066_init_verbs_hp_laptop; |
3175 | spec->num_init_verbs++; | 3194 | spec->num_init_verbs++; |
3176 | spec->hp_laptop = 1; | 3195 | spec->hp_laptop = board_config == CXT5066_HP_LAPTOP; |
3196 | spec->asus = board_config == CXT5066_ASUS; | ||
3177 | spec->mixers[spec->num_mixers++] = cxt5066_mixer_master; | 3197 | spec->mixers[spec->num_mixers++] = cxt5066_mixer_master; |
3178 | spec->mixers[spec->num_mixers++] = cxt5066_mixers; | 3198 | spec->mixers[spec->num_mixers++] = cxt5066_mixers; |
3179 | /* no S/PDIF out */ | 3199 | /* no S/PDIF out */ |
3180 | spec->multiout.dig_out_nid = 0; | 3200 | if (board_config == CXT5066_HP_LAPTOP) |
3201 | spec->multiout.dig_out_nid = 0; | ||
3181 | /* input source automatically selected */ | 3202 | /* input source automatically selected */ |
3182 | spec->input_mux = NULL; | 3203 | spec->input_mux = NULL; |
3183 | spec->port_d_mode = 0; | 3204 | spec->port_d_mode = 0; |
@@ -3207,7 +3228,7 @@ static int patch_cxt5066(struct hda_codec *codec) | |||
3207 | break; | 3228 | break; |
3208 | case CXT5066_DELL_VOSTRO: | 3229 | case CXT5066_DELL_VOSTRO: |
3209 | codec->patch_ops.init = cxt5066_init; | 3230 | codec->patch_ops.init = cxt5066_init; |
3210 | codec->patch_ops.unsol_event = cxt5066_vostro_event; | 3231 | codec->patch_ops.unsol_event = cxt5066_unsol_event; |
3211 | spec->init_verbs[0] = cxt5066_init_verbs_vostro; | 3232 | spec->init_verbs[0] = cxt5066_init_verbs_vostro; |
3212 | spec->mixers[spec->num_mixers++] = cxt5066_mixer_master_olpc; | 3233 | spec->mixers[spec->num_mixers++] = cxt5066_mixer_master_olpc; |
3213 | spec->mixers[spec->num_mixers++] = cxt5066_mixers; | 3234 | spec->mixers[spec->num_mixers++] = cxt5066_mixers; |
@@ -3224,7 +3245,7 @@ static int patch_cxt5066(struct hda_codec *codec) | |||
3224 | break; | 3245 | break; |
3225 | case CXT5066_IDEAPAD: | 3246 | case CXT5066_IDEAPAD: |
3226 | codec->patch_ops.init = cxt5066_init; | 3247 | codec->patch_ops.init = cxt5066_init; |
3227 | codec->patch_ops.unsol_event = cxt5066_ideapad_event; | 3248 | codec->patch_ops.unsol_event = cxt5066_unsol_event; |
3228 | spec->mixers[spec->num_mixers++] = cxt5066_mixer_master; | 3249 | spec->mixers[spec->num_mixers++] = cxt5066_mixer_master; |
3229 | spec->mixers[spec->num_mixers++] = cxt5066_mixers; | 3250 | spec->mixers[spec->num_mixers++] = cxt5066_mixers; |
3230 | spec->init_verbs[0] = cxt5066_init_verbs_ideapad; | 3251 | spec->init_verbs[0] = cxt5066_init_verbs_ideapad; |
@@ -3240,7 +3261,7 @@ static int patch_cxt5066(struct hda_codec *codec) | |||
3240 | break; | 3261 | break; |
3241 | case CXT5066_THINKPAD: | 3262 | case CXT5066_THINKPAD: |
3242 | codec->patch_ops.init = cxt5066_init; | 3263 | codec->patch_ops.init = cxt5066_init; |
3243 | codec->patch_ops.unsol_event = cxt5066_thinkpad_event; | 3264 | codec->patch_ops.unsol_event = cxt5066_unsol_event; |
3244 | spec->mixers[spec->num_mixers++] = cxt5066_mixer_master; | 3265 | spec->mixers[spec->num_mixers++] = cxt5066_mixer_master; |
3245 | spec->mixers[spec->num_mixers++] = cxt5066_mixers; | 3266 | spec->mixers[spec->num_mixers++] = cxt5066_mixers; |
3246 | spec->init_verbs[0] = cxt5066_init_verbs_thinkpad; | 3267 | spec->init_verbs[0] = cxt5066_init_verbs_thinkpad; |
diff --git a/sound/pci/oxygen/oxygen.h b/sound/pci/oxygen/oxygen.h index c2ae63d17cd2..f53897a708b4 100644 --- a/sound/pci/oxygen/oxygen.h +++ b/sound/pci/oxygen/oxygen.h | |||
@@ -92,6 +92,8 @@ struct oxygen_model { | |||
92 | void (*update_dac_volume)(struct oxygen *chip); | 92 | void (*update_dac_volume)(struct oxygen *chip); |
93 | void (*update_dac_mute)(struct oxygen *chip); | 93 | void (*update_dac_mute)(struct oxygen *chip); |
94 | void (*update_center_lfe_mix)(struct oxygen *chip, bool mixed); | 94 | void (*update_center_lfe_mix)(struct oxygen *chip, bool mixed); |
95 | unsigned int (*adjust_dac_routing)(struct oxygen *chip, | ||
96 | unsigned int play_routing); | ||
95 | void (*gpio_changed)(struct oxygen *chip); | 97 | void (*gpio_changed)(struct oxygen *chip); |
96 | void (*uart_input)(struct oxygen *chip); | 98 | void (*uart_input)(struct oxygen *chip); |
97 | void (*ac97_switch)(struct oxygen *chip, | 99 | void (*ac97_switch)(struct oxygen *chip, |
diff --git a/sound/pci/oxygen/oxygen_mixer.c b/sound/pci/oxygen/oxygen_mixer.c index 9bff14d5895d..26c7e8bcb229 100644 --- a/sound/pci/oxygen/oxygen_mixer.c +++ b/sound/pci/oxygen/oxygen_mixer.c | |||
@@ -180,6 +180,8 @@ void oxygen_update_dac_routing(struct oxygen *chip) | |||
180 | (1 << OXYGEN_PLAY_DAC1_SOURCE_SHIFT) | | 180 | (1 << OXYGEN_PLAY_DAC1_SOURCE_SHIFT) | |
181 | (2 << OXYGEN_PLAY_DAC2_SOURCE_SHIFT) | | 181 | (2 << OXYGEN_PLAY_DAC2_SOURCE_SHIFT) | |
182 | (3 << OXYGEN_PLAY_DAC3_SOURCE_SHIFT); | 182 | (3 << OXYGEN_PLAY_DAC3_SOURCE_SHIFT); |
183 | if (chip->model.adjust_dac_routing) | ||
184 | reg_value = chip->model.adjust_dac_routing(chip, reg_value); | ||
183 | oxygen_write16_masked(chip, OXYGEN_PLAY_ROUTING, reg_value, | 185 | oxygen_write16_masked(chip, OXYGEN_PLAY_ROUTING, reg_value, |
184 | OXYGEN_PLAY_DAC0_SOURCE_MASK | | 186 | OXYGEN_PLAY_DAC0_SOURCE_MASK | |
185 | OXYGEN_PLAY_DAC1_SOURCE_MASK | | 187 | OXYGEN_PLAY_DAC1_SOURCE_MASK | |
diff --git a/sound/pci/oxygen/xonar_dg.c b/sound/pci/oxygen/xonar_dg.c index e1fa602eba79..bc6eb58be380 100644 --- a/sound/pci/oxygen/xonar_dg.c +++ b/sound/pci/oxygen/xonar_dg.c | |||
@@ -24,6 +24,11 @@ | |||
24 | * | 24 | * |
25 | * SPI 0 -> CS4245 | 25 | * SPI 0 -> CS4245 |
26 | * | 26 | * |
27 | * I²S 1 -> CS4245 | ||
28 | * I²S 2 -> CS4361 (center/LFE) | ||
29 | * I²S 3 -> CS4361 (surround) | ||
30 | * I²S 4 -> CS4361 (front) | ||
31 | * | ||
27 | * GPIO 3 <- ? | 32 | * GPIO 3 <- ? |
28 | * GPIO 4 <- headphone detect | 33 | * GPIO 4 <- headphone detect |
29 | * GPIO 5 -> route input jack to line-in (0) or mic-in (1) | 34 | * GPIO 5 -> route input jack to line-in (0) or mic-in (1) |
@@ -36,6 +41,7 @@ | |||
36 | * input 1 <- aux | 41 | * input 1 <- aux |
37 | * input 2 <- front mic | 42 | * input 2 <- front mic |
38 | * input 4 <- line/mic | 43 | * input 4 <- line/mic |
44 | * DAC out -> headphones | ||
39 | * aux out -> front panel headphones | 45 | * aux out -> front panel headphones |
40 | */ | 46 | */ |
41 | 47 | ||
@@ -207,6 +213,35 @@ static void set_cs4245_adc_params(struct oxygen *chip, | |||
207 | cs4245_write_cached(chip, CS4245_ADC_CTRL, value); | 213 | cs4245_write_cached(chip, CS4245_ADC_CTRL, value); |
208 | } | 214 | } |
209 | 215 | ||
216 | static inline unsigned int shift_bits(unsigned int value, | ||
217 | unsigned int shift_from, | ||
218 | unsigned int shift_to, | ||
219 | unsigned int mask) | ||
220 | { | ||
221 | if (shift_from < shift_to) | ||
222 | return (value << (shift_to - shift_from)) & mask; | ||
223 | else | ||
224 | return (value >> (shift_from - shift_to)) & mask; | ||
225 | } | ||
226 | |||
227 | static unsigned int adjust_dg_dac_routing(struct oxygen *chip, | ||
228 | unsigned int play_routing) | ||
229 | { | ||
230 | return (play_routing & OXYGEN_PLAY_DAC0_SOURCE_MASK) | | ||
231 | shift_bits(play_routing, | ||
232 | OXYGEN_PLAY_DAC2_SOURCE_SHIFT, | ||
233 | OXYGEN_PLAY_DAC1_SOURCE_SHIFT, | ||
234 | OXYGEN_PLAY_DAC1_SOURCE_MASK) | | ||
235 | shift_bits(play_routing, | ||
236 | OXYGEN_PLAY_DAC1_SOURCE_SHIFT, | ||
237 | OXYGEN_PLAY_DAC2_SOURCE_SHIFT, | ||
238 | OXYGEN_PLAY_DAC2_SOURCE_MASK) | | ||
239 | shift_bits(play_routing, | ||
240 | OXYGEN_PLAY_DAC0_SOURCE_SHIFT, | ||
241 | OXYGEN_PLAY_DAC3_SOURCE_SHIFT, | ||
242 | OXYGEN_PLAY_DAC3_SOURCE_MASK); | ||
243 | } | ||
244 | |||
210 | static int output_switch_info(struct snd_kcontrol *ctl, | 245 | static int output_switch_info(struct snd_kcontrol *ctl, |
211 | struct snd_ctl_elem_info *info) | 246 | struct snd_ctl_elem_info *info) |
212 | { | 247 | { |
@@ -557,6 +592,7 @@ struct oxygen_model model_xonar_dg = { | |||
557 | .resume = dg_resume, | 592 | .resume = dg_resume, |
558 | .set_dac_params = set_cs4245_dac_params, | 593 | .set_dac_params = set_cs4245_dac_params, |
559 | .set_adc_params = set_cs4245_adc_params, | 594 | .set_adc_params = set_cs4245_adc_params, |
595 | .adjust_dac_routing = adjust_dg_dac_routing, | ||
560 | .dump_registers = dump_cs4245_registers, | 596 | .dump_registers = dump_cs4245_registers, |
561 | .model_data_size = sizeof(struct dg), | 597 | .model_data_size = sizeof(struct dg), |
562 | .device_config = PLAYBACK_0_TO_I2S | | 598 | .device_config = PLAYBACK_0_TO_I2S | |
diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf.h b/sound/pcmcia/pdaudiocf/pdaudiocf.h index bd26e092aead..6ce9ad700290 100644 --- a/sound/pcmcia/pdaudiocf/pdaudiocf.h +++ b/sound/pcmcia/pdaudiocf/pdaudiocf.h | |||
@@ -22,7 +22,7 @@ | |||
22 | #define __PDAUDIOCF_H | 22 | #define __PDAUDIOCF_H |
23 | 23 | ||
24 | #include <sound/pcm.h> | 24 | #include <sound/pcm.h> |
25 | #include <asm/io.h> | 25 | #include <linux/io.h> |
26 | #include <linux/interrupt.h> | 26 | #include <linux/interrupt.h> |
27 | #include <pcmcia/cistpl.h> | 27 | #include <pcmcia/cistpl.h> |
28 | #include <pcmcia/ds.h> | 28 | #include <pcmcia/ds.h> |
diff --git a/sound/pcmcia/vx/vxp_ops.c b/sound/pcmcia/vx/vxp_ops.c index 989e04abb520..fe33e122e372 100644 --- a/sound/pcmcia/vx/vxp_ops.c +++ b/sound/pcmcia/vx/vxp_ops.c | |||
@@ -23,8 +23,8 @@ | |||
23 | #include <linux/delay.h> | 23 | #include <linux/delay.h> |
24 | #include <linux/device.h> | 24 | #include <linux/device.h> |
25 | #include <linux/firmware.h> | 25 | #include <linux/firmware.h> |
26 | #include <linux/io.h> | ||
26 | #include <sound/core.h> | 27 | #include <sound/core.h> |
27 | #include <asm/io.h> | ||
28 | #include "vxpocket.h" | 28 | #include "vxpocket.h" |
29 | 29 | ||
30 | 30 | ||
diff --git a/sound/soc/codecs/cq93vc.c b/sound/soc/codecs/cq93vc.c index 46dbfd067f79..347a567b01e1 100644 --- a/sound/soc/codecs/cq93vc.c +++ b/sound/soc/codecs/cq93vc.c | |||
@@ -153,7 +153,7 @@ static int cq93vc_resume(struct snd_soc_codec *codec) | |||
153 | 153 | ||
154 | static int cq93vc_probe(struct snd_soc_codec *codec) | 154 | static int cq93vc_probe(struct snd_soc_codec *codec) |
155 | { | 155 | { |
156 | struct davinci_vc *davinci_vc = codec->dev->platform_data; | 156 | struct davinci_vc *davinci_vc = snd_soc_codec_get_drvdata(codec); |
157 | 157 | ||
158 | davinci_vc->cq93vc.codec = codec; | 158 | davinci_vc->cq93vc.codec = codec; |
159 | codec->control_data = davinci_vc; | 159 | codec->control_data = davinci_vc; |
diff --git a/sound/soc/codecs/cx20442.c b/sound/soc/codecs/cx20442.c index 03d1e860d229..bb4bf65b9e7e 100644 --- a/sound/soc/codecs/cx20442.c +++ b/sound/soc/codecs/cx20442.c | |||
@@ -367,9 +367,12 @@ static int cx20442_codec_remove(struct snd_soc_codec *codec) | |||
367 | return 0; | 367 | return 0; |
368 | } | 368 | } |
369 | 369 | ||
370 | static const u8 cx20442_reg = CX20442_TELOUT | CX20442_MIC; | ||
371 | |||
370 | static struct snd_soc_codec_driver cx20442_codec_dev = { | 372 | static struct snd_soc_codec_driver cx20442_codec_dev = { |
371 | .probe = cx20442_codec_probe, | 373 | .probe = cx20442_codec_probe, |
372 | .remove = cx20442_codec_remove, | 374 | .remove = cx20442_codec_remove, |
375 | .reg_cache_default = &cx20442_reg, | ||
373 | .reg_cache_size = 1, | 376 | .reg_cache_size = 1, |
374 | .reg_word_size = sizeof(u8), | 377 | .reg_word_size = sizeof(u8), |
375 | .read = cx20442_read_reg_cache, | 378 | .read = cx20442_read_reg_cache, |
diff --git a/sound/soc/omap/ams-delta.c b/sound/soc/omap/ams-delta.c index 2101bdcee21f..3167be689621 100644 --- a/sound/soc/omap/ams-delta.c +++ b/sound/soc/omap/ams-delta.c | |||
@@ -507,8 +507,6 @@ static int ams_delta_cx20442_init(struct snd_soc_pcm_runtime *rtd) | |||
507 | /* Set up digital mute if not provided by the codec */ | 507 | /* Set up digital mute if not provided by the codec */ |
508 | if (!codec_dai->driver->ops) { | 508 | if (!codec_dai->driver->ops) { |
509 | codec_dai->driver->ops = &ams_delta_dai_ops; | 509 | codec_dai->driver->ops = &ams_delta_dai_ops; |
510 | } else if (!codec_dai->driver->ops->digital_mute) { | ||
511 | codec_dai->driver->ops->digital_mute = ams_delta_digital_mute; | ||
512 | } else { | 510 | } else { |
513 | ams_delta_ops.startup = ams_delta_startup; | 511 | ams_delta_ops.startup = ams_delta_startup; |
514 | ams_delta_ops.shutdown = ams_delta_shutdown; | 512 | ams_delta_ops.shutdown = ams_delta_shutdown; |
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index bac7291b6ff6..c4b60610beb0 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -1664,9 +1664,6 @@ static int soc_probe_aux_dev(struct snd_soc_card *card, int num) | |||
1664 | goto out; | 1664 | goto out; |
1665 | 1665 | ||
1666 | found: | 1666 | found: |
1667 | if (!try_module_get(codec->dev->driver->owner)) | ||
1668 | return -ENODEV; | ||
1669 | |||
1670 | ret = soc_probe_codec(card, codec); | 1667 | ret = soc_probe_codec(card, codec); |
1671 | if (ret < 0) | 1668 | if (ret < 0) |
1672 | return ret; | 1669 | return ret; |
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 499730ab5638..8194f150bab7 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
@@ -1742,7 +1742,7 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol, | |||
1742 | int max = mc->max; | 1742 | int max = mc->max; |
1743 | unsigned int mask = (1 << fls(max)) - 1; | 1743 | unsigned int mask = (1 << fls(max)) - 1; |
1744 | unsigned int invert = mc->invert; | 1744 | unsigned int invert = mc->invert; |
1745 | unsigned int val, val_mask; | 1745 | unsigned int val; |
1746 | int connect, change; | 1746 | int connect, change; |
1747 | struct snd_soc_dapm_update update; | 1747 | struct snd_soc_dapm_update update; |
1748 | 1748 | ||
@@ -1750,13 +1750,13 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol, | |||
1750 | 1750 | ||
1751 | if (invert) | 1751 | if (invert) |
1752 | val = max - val; | 1752 | val = max - val; |
1753 | val_mask = mask << shift; | 1753 | mask = mask << shift; |
1754 | val = val << shift; | 1754 | val = val << shift; |
1755 | 1755 | ||
1756 | mutex_lock(&widget->codec->mutex); | 1756 | mutex_lock(&widget->codec->mutex); |
1757 | widget->value = val; | 1757 | widget->value = val; |
1758 | 1758 | ||
1759 | change = snd_soc_test_bits(widget->codec, reg, val_mask, val); | 1759 | change = snd_soc_test_bits(widget->codec, reg, mask, val); |
1760 | if (change) { | 1760 | if (change) { |
1761 | if (val) | 1761 | if (val) |
1762 | /* new connection */ | 1762 | /* new connection */ |
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index f5cfed60af98..d8575d31ee6c 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c | |||
@@ -90,7 +90,7 @@ int __perf_evsel__read(struct perf_evsel *evsel, | |||
90 | int cpu, thread; | 90 | int cpu, thread; |
91 | struct perf_counts_values *aggr = &evsel->counts->aggr, count; | 91 | struct perf_counts_values *aggr = &evsel->counts->aggr, count; |
92 | 92 | ||
93 | aggr->val = 0; | 93 | aggr->val = aggr->ena = aggr->run = 0; |
94 | 94 | ||
95 | for (cpu = 0; cpu < ncpus; cpu++) { | 95 | for (cpu = 0; cpu < ncpus; cpu++) { |
96 | for (thread = 0; thread < nthreads; thread++) { | 96 | for (thread = 0; thread < nthreads; thread++) { |