diff options
author | David S. Miller <davem@davemloft.net> | 2011-06-04 16:38:31 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-06-04 16:38:31 -0400 |
commit | e990b37b906b6137d353ef2a918e15e5763d70ec (patch) | |
tree | e802458ee43d4b0a2b6d39eb25929858ceb7fd61 | |
parent | 34624d6631b6b3a1df16407a847286bb6233a96b (diff) | |
parent | 23c79d31a3dd2602ee1a5ff31303b2d7a2d3c159 (diff) |
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
101 files changed, 914 insertions, 467 deletions
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 5438a2d7907f..d9a203b058f1 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
@@ -999,7 +999,10 @@ bytes respectively. Such letter suffixes can also be entirely omitted. | |||
999 | With this option on every unmap_single operation will | 999 | With this option on every unmap_single operation will |
1000 | result in a hardware IOTLB flush operation as opposed | 1000 | result in a hardware IOTLB flush operation as opposed |
1001 | to batching them for performance. | 1001 | to batching them for performance. |
1002 | 1002 | sp_off [Default Off] | |
1003 | By default, super page will be supported if Intel IOMMU | ||
1004 | has the capability. With this option, super page will | ||
1005 | not be supported. | ||
1003 | intremap= [X86-64, Intel-IOMMU] | 1006 | intremap= [X86-64, Intel-IOMMU] |
1004 | Format: { on (default) | off | nosid } | 1007 | Format: { on (default) | off | nosid } |
1005 | on enable Interrupt Remapping (default) | 1008 | on enable Interrupt Remapping (default) |
diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c index 08acb6ec8139..f6b687f61c28 100644 --- a/arch/arm/mach-shmobile/board-ap4evb.c +++ b/arch/arm/mach-shmobile/board-ap4evb.c | |||
@@ -249,6 +249,29 @@ static int slot_cn7_get_cd(struct platform_device *pdev) | |||
249 | { | 249 | { |
250 | return !gpio_get_value(GPIO_PORT41); | 250 | return !gpio_get_value(GPIO_PORT41); |
251 | } | 251 | } |
252 | /* MERAM */ | ||
253 | static struct sh_mobile_meram_info meram_info = { | ||
254 | .addr_mode = SH_MOBILE_MERAM_MODE1, | ||
255 | }; | ||
256 | |||
257 | static struct resource meram_resources[] = { | ||
258 | [0] = { | ||
259 | .name = "MERAM", | ||
260 | .start = 0xe8000000, | ||
261 | .end = 0xe81fffff, | ||
262 | .flags = IORESOURCE_MEM, | ||
263 | }, | ||
264 | }; | ||
265 | |||
266 | static struct platform_device meram_device = { | ||
267 | .name = "sh_mobile_meram", | ||
268 | .id = 0, | ||
269 | .num_resources = ARRAY_SIZE(meram_resources), | ||
270 | .resource = meram_resources, | ||
271 | .dev = { | ||
272 | .platform_data = &meram_info, | ||
273 | }, | ||
274 | }; | ||
252 | 275 | ||
253 | /* SH_MMCIF */ | 276 | /* SH_MMCIF */ |
254 | static struct resource sh_mmcif_resources[] = { | 277 | static struct resource sh_mmcif_resources[] = { |
@@ -447,13 +470,29 @@ const static struct fb_videomode ap4evb_lcdc_modes[] = { | |||
447 | #endif | 470 | #endif |
448 | }, | 471 | }, |
449 | }; | 472 | }; |
473 | static struct sh_mobile_meram_cfg lcd_meram_cfg = { | ||
474 | .icb[0] = { | ||
475 | .marker_icb = 28, | ||
476 | .cache_icb = 24, | ||
477 | .meram_offset = 0x0, | ||
478 | .meram_size = 0x40, | ||
479 | }, | ||
480 | .icb[1] = { | ||
481 | .marker_icb = 29, | ||
482 | .cache_icb = 25, | ||
483 | .meram_offset = 0x40, | ||
484 | .meram_size = 0x40, | ||
485 | }, | ||
486 | }; | ||
450 | 487 | ||
451 | static struct sh_mobile_lcdc_info lcdc_info = { | 488 | static struct sh_mobile_lcdc_info lcdc_info = { |
489 | .meram_dev = &meram_info, | ||
452 | .ch[0] = { | 490 | .ch[0] = { |
453 | .chan = LCDC_CHAN_MAINLCD, | 491 | .chan = LCDC_CHAN_MAINLCD, |
454 | .bpp = 16, | 492 | .bpp = 16, |
455 | .lcd_cfg = ap4evb_lcdc_modes, | 493 | .lcd_cfg = ap4evb_lcdc_modes, |
456 | .num_cfg = ARRAY_SIZE(ap4evb_lcdc_modes), | 494 | .num_cfg = ARRAY_SIZE(ap4evb_lcdc_modes), |
495 | .meram_cfg = &lcd_meram_cfg, | ||
457 | } | 496 | } |
458 | }; | 497 | }; |
459 | 498 | ||
@@ -724,15 +763,31 @@ static struct platform_device fsi_device = { | |||
724 | static struct platform_device fsi_ak4643_device = { | 763 | static struct platform_device fsi_ak4643_device = { |
725 | .name = "sh_fsi2_a_ak4643", | 764 | .name = "sh_fsi2_a_ak4643", |
726 | }; | 765 | }; |
766 | static struct sh_mobile_meram_cfg hdmi_meram_cfg = { | ||
767 | .icb[0] = { | ||
768 | .marker_icb = 30, | ||
769 | .cache_icb = 26, | ||
770 | .meram_offset = 0x80, | ||
771 | .meram_size = 0x100, | ||
772 | }, | ||
773 | .icb[1] = { | ||
774 | .marker_icb = 31, | ||
775 | .cache_icb = 27, | ||
776 | .meram_offset = 0x180, | ||
777 | .meram_size = 0x100, | ||
778 | }, | ||
779 | }; | ||
727 | 780 | ||
728 | static struct sh_mobile_lcdc_info sh_mobile_lcdc1_info = { | 781 | static struct sh_mobile_lcdc_info sh_mobile_lcdc1_info = { |
729 | .clock_source = LCDC_CLK_EXTERNAL, | 782 | .clock_source = LCDC_CLK_EXTERNAL, |
783 | .meram_dev = &meram_info, | ||
730 | .ch[0] = { | 784 | .ch[0] = { |
731 | .chan = LCDC_CHAN_MAINLCD, | 785 | .chan = LCDC_CHAN_MAINLCD, |
732 | .bpp = 16, | 786 | .bpp = 16, |
733 | .interface_type = RGB24, | 787 | .interface_type = RGB24, |
734 | .clock_divider = 1, | 788 | .clock_divider = 1, |
735 | .flags = LCDC_FLAGS_DWPOL, | 789 | .flags = LCDC_FLAGS_DWPOL, |
790 | .meram_cfg = &hdmi_meram_cfg, | ||
736 | } | 791 | } |
737 | }; | 792 | }; |
738 | 793 | ||
@@ -961,6 +1016,7 @@ static struct platform_device *ap4evb_devices[] __initdata = { | |||
961 | &csi2_device, | 1016 | &csi2_device, |
962 | &ceu_device, | 1017 | &ceu_device, |
963 | &ap4evb_camera, | 1018 | &ap4evb_camera, |
1019 | &meram_device, | ||
964 | }; | 1020 | }; |
965 | 1021 | ||
966 | static void __init hdmi_init_pm_clock(void) | 1022 | static void __init hdmi_init_pm_clock(void) |
diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c index 448ddbe43335..776f20560e72 100644 --- a/arch/arm/mach-shmobile/board-mackerel.c +++ b/arch/arm/mach-shmobile/board-mackerel.c | |||
@@ -39,6 +39,7 @@ | |||
39 | #include <linux/mtd/mtd.h> | 39 | #include <linux/mtd/mtd.h> |
40 | #include <linux/mtd/partitions.h> | 40 | #include <linux/mtd/partitions.h> |
41 | #include <linux/mtd/physmap.h> | 41 | #include <linux/mtd/physmap.h> |
42 | #include <linux/pm_runtime.h> | ||
42 | #include <linux/smsc911x.h> | 43 | #include <linux/smsc911x.h> |
43 | #include <linux/sh_intc.h> | 44 | #include <linux/sh_intc.h> |
44 | #include <linux/tca6416_keypad.h> | 45 | #include <linux/tca6416_keypad.h> |
@@ -314,6 +315,30 @@ static struct platform_device smc911x_device = { | |||
314 | }, | 315 | }, |
315 | }; | 316 | }; |
316 | 317 | ||
318 | /* MERAM */ | ||
319 | static struct sh_mobile_meram_info mackerel_meram_info = { | ||
320 | .addr_mode = SH_MOBILE_MERAM_MODE1, | ||
321 | }; | ||
322 | |||
323 | static struct resource meram_resources[] = { | ||
324 | [0] = { | ||
325 | .name = "MERAM", | ||
326 | .start = 0xe8000000, | ||
327 | .end = 0xe81fffff, | ||
328 | .flags = IORESOURCE_MEM, | ||
329 | }, | ||
330 | }; | ||
331 | |||
332 | static struct platform_device meram_device = { | ||
333 | .name = "sh_mobile_meram", | ||
334 | .id = 0, | ||
335 | .num_resources = ARRAY_SIZE(meram_resources), | ||
336 | .resource = meram_resources, | ||
337 | .dev = { | ||
338 | .platform_data = &mackerel_meram_info, | ||
339 | }, | ||
340 | }; | ||
341 | |||
317 | /* LCDC */ | 342 | /* LCDC */ |
318 | static struct fb_videomode mackerel_lcdc_modes[] = { | 343 | static struct fb_videomode mackerel_lcdc_modes[] = { |
319 | { | 344 | { |
@@ -342,7 +367,23 @@ static int mackerel_get_brightness(void *board_data) | |||
342 | return gpio_get_value(GPIO_PORT31); | 367 | return gpio_get_value(GPIO_PORT31); |
343 | } | 368 | } |
344 | 369 | ||
370 | static struct sh_mobile_meram_cfg lcd_meram_cfg = { | ||
371 | .icb[0] = { | ||
372 | .marker_icb = 28, | ||
373 | .cache_icb = 24, | ||
374 | .meram_offset = 0x0, | ||
375 | .meram_size = 0x40, | ||
376 | }, | ||
377 | .icb[1] = { | ||
378 | .marker_icb = 29, | ||
379 | .cache_icb = 25, | ||
380 | .meram_offset = 0x40, | ||
381 | .meram_size = 0x40, | ||
382 | }, | ||
383 | }; | ||
384 | |||
345 | static struct sh_mobile_lcdc_info lcdc_info = { | 385 | static struct sh_mobile_lcdc_info lcdc_info = { |
386 | .meram_dev = &mackerel_meram_info, | ||
346 | .clock_source = LCDC_CLK_BUS, | 387 | .clock_source = LCDC_CLK_BUS, |
347 | .ch[0] = { | 388 | .ch[0] = { |
348 | .chan = LCDC_CHAN_MAINLCD, | 389 | .chan = LCDC_CHAN_MAINLCD, |
@@ -362,6 +403,7 @@ static struct sh_mobile_lcdc_info lcdc_info = { | |||
362 | .name = "sh_mobile_lcdc_bl", | 403 | .name = "sh_mobile_lcdc_bl", |
363 | .max_brightness = 1, | 404 | .max_brightness = 1, |
364 | }, | 405 | }, |
406 | .meram_cfg = &lcd_meram_cfg, | ||
365 | } | 407 | } |
366 | }; | 408 | }; |
367 | 409 | ||
@@ -388,8 +430,23 @@ static struct platform_device lcdc_device = { | |||
388 | }, | 430 | }, |
389 | }; | 431 | }; |
390 | 432 | ||
433 | static struct sh_mobile_meram_cfg hdmi_meram_cfg = { | ||
434 | .icb[0] = { | ||
435 | .marker_icb = 30, | ||
436 | .cache_icb = 26, | ||
437 | .meram_offset = 0x80, | ||
438 | .meram_size = 0x100, | ||
439 | }, | ||
440 | .icb[1] = { | ||
441 | .marker_icb = 31, | ||
442 | .cache_icb = 27, | ||
443 | .meram_offset = 0x180, | ||
444 | .meram_size = 0x100, | ||
445 | }, | ||
446 | }; | ||
391 | /* HDMI */ | 447 | /* HDMI */ |
392 | static struct sh_mobile_lcdc_info hdmi_lcdc_info = { | 448 | static struct sh_mobile_lcdc_info hdmi_lcdc_info = { |
449 | .meram_dev = &mackerel_meram_info, | ||
393 | .clock_source = LCDC_CLK_EXTERNAL, | 450 | .clock_source = LCDC_CLK_EXTERNAL, |
394 | .ch[0] = { | 451 | .ch[0] = { |
395 | .chan = LCDC_CHAN_MAINLCD, | 452 | .chan = LCDC_CHAN_MAINLCD, |
@@ -397,6 +454,7 @@ static struct sh_mobile_lcdc_info hdmi_lcdc_info = { | |||
397 | .interface_type = RGB24, | 454 | .interface_type = RGB24, |
398 | .clock_divider = 1, | 455 | .clock_divider = 1, |
399 | .flags = LCDC_FLAGS_DWPOL, | 456 | .flags = LCDC_FLAGS_DWPOL, |
457 | .meram_cfg = &hdmi_meram_cfg, | ||
400 | } | 458 | } |
401 | }; | 459 | }; |
402 | 460 | ||
@@ -856,6 +914,17 @@ static int slot_cn7_get_cd(struct platform_device *pdev) | |||
856 | } | 914 | } |
857 | 915 | ||
858 | /* SDHI0 */ | 916 | /* SDHI0 */ |
917 | static irqreturn_t mackerel_sdhi0_gpio_cd(int irq, void *arg) | ||
918 | { | ||
919 | struct device *dev = arg; | ||
920 | struct sh_mobile_sdhi_info *info = dev->platform_data; | ||
921 | struct tmio_mmc_data *pdata = info->pdata; | ||
922 | |||
923 | tmio_mmc_cd_wakeup(pdata); | ||
924 | |||
925 | return IRQ_HANDLED; | ||
926 | } | ||
927 | |||
859 | static struct sh_mobile_sdhi_info sdhi0_info = { | 928 | static struct sh_mobile_sdhi_info sdhi0_info = { |
860 | .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX, | 929 | .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX, |
861 | .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX, | 930 | .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX, |
@@ -1150,6 +1219,7 @@ static struct platform_device *mackerel_devices[] __initdata = { | |||
1150 | &mackerel_camera, | 1219 | &mackerel_camera, |
1151 | &hdmi_lcdc_device, | 1220 | &hdmi_lcdc_device, |
1152 | &hdmi_device, | 1221 | &hdmi_device, |
1222 | &meram_device, | ||
1153 | }; | 1223 | }; |
1154 | 1224 | ||
1155 | /* Keypad Initialization */ | 1225 | /* Keypad Initialization */ |
@@ -1238,6 +1308,7 @@ static void __init mackerel_init(void) | |||
1238 | { | 1308 | { |
1239 | u32 srcr4; | 1309 | u32 srcr4; |
1240 | struct clk *clk; | 1310 | struct clk *clk; |
1311 | int ret; | ||
1241 | 1312 | ||
1242 | sh7372_pinmux_init(); | 1313 | sh7372_pinmux_init(); |
1243 | 1314 | ||
@@ -1343,6 +1414,13 @@ static void __init mackerel_init(void) | |||
1343 | gpio_request(GPIO_FN_SDHID0_1, NULL); | 1414 | gpio_request(GPIO_FN_SDHID0_1, NULL); |
1344 | gpio_request(GPIO_FN_SDHID0_0, NULL); | 1415 | gpio_request(GPIO_FN_SDHID0_0, NULL); |
1345 | 1416 | ||
1417 | ret = request_irq(evt2irq(0x3340), mackerel_sdhi0_gpio_cd, | ||
1418 | IRQF_TRIGGER_FALLING, "sdhi0 cd", &sdhi0_device.dev); | ||
1419 | if (!ret) | ||
1420 | sdhi0_info.tmio_flags |= TMIO_MMC_HAS_COLD_CD; | ||
1421 | else | ||
1422 | pr_err("Cannot get IRQ #%d: %d\n", evt2irq(0x3340), ret); | ||
1423 | |||
1346 | #if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE) | 1424 | #if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE) |
1347 | /* enable SDHI1 */ | 1425 | /* enable SDHI1 */ |
1348 | gpio_request(GPIO_FN_SDHICMD1, NULL); | 1426 | gpio_request(GPIO_FN_SDHICMD1, NULL); |
diff --git a/arch/arm/mach-shmobile/clock-sh7372.c b/arch/arm/mach-shmobile/clock-sh7372.c index d17eb66f4ac2..c0800d83971e 100644 --- a/arch/arm/mach-shmobile/clock-sh7372.c +++ b/arch/arm/mach-shmobile/clock-sh7372.c | |||
@@ -509,6 +509,7 @@ enum { MSTP001, | |||
509 | MSTP118, MSTP117, MSTP116, MSTP113, | 509 | MSTP118, MSTP117, MSTP116, MSTP113, |
510 | MSTP106, MSTP101, MSTP100, | 510 | MSTP106, MSTP101, MSTP100, |
511 | MSTP223, | 511 | MSTP223, |
512 | MSTP218, MSTP217, MSTP216, | ||
512 | MSTP207, MSTP206, MSTP204, MSTP203, MSTP202, MSTP201, MSTP200, | 513 | MSTP207, MSTP206, MSTP204, MSTP203, MSTP202, MSTP201, MSTP200, |
513 | MSTP329, MSTP328, MSTP323, MSTP322, MSTP314, MSTP313, MSTP312, | 514 | MSTP329, MSTP328, MSTP323, MSTP322, MSTP314, MSTP313, MSTP312, |
514 | MSTP423, MSTP415, MSTP413, MSTP411, MSTP410, MSTP406, MSTP403, | 515 | MSTP423, MSTP415, MSTP413, MSTP411, MSTP410, MSTP406, MSTP403, |
@@ -534,6 +535,9 @@ static struct clk mstp_clks[MSTP_NR] = { | |||
534 | [MSTP101] = MSTP(&div4_clks[DIV4_M1], SMSTPCR1, 1, 0), /* VPU */ | 535 | [MSTP101] = MSTP(&div4_clks[DIV4_M1], SMSTPCR1, 1, 0), /* VPU */ |
535 | [MSTP100] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 0, 0), /* LCDC0 */ | 536 | [MSTP100] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 0, 0), /* LCDC0 */ |
536 | [MSTP223] = MSTP(&div6_clks[DIV6_SPU], SMSTPCR2, 23, 0), /* SPU2 */ | 537 | [MSTP223] = MSTP(&div6_clks[DIV6_SPU], SMSTPCR2, 23, 0), /* SPU2 */ |
538 | [MSTP218] = MSTP(&div4_clks[DIV4_HP], SMSTPCR2, 18, 0), /* DMAC1 */ | ||
539 | [MSTP217] = MSTP(&div4_clks[DIV4_HP], SMSTPCR2, 17, 0), /* DMAC2 */ | ||
540 | [MSTP216] = MSTP(&div4_clks[DIV4_HP], SMSTPCR2, 16, 0), /* DMAC3 */ | ||
537 | [MSTP207] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 7, 0), /* SCIFA5 */ | 541 | [MSTP207] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 7, 0), /* SCIFA5 */ |
538 | [MSTP206] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 6, 0), /* SCIFB */ | 542 | [MSTP206] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 6, 0), /* SCIFB */ |
539 | [MSTP204] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 4, 0), /* SCIFA0 */ | 543 | [MSTP204] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 4, 0), /* SCIFA0 */ |
@@ -626,6 +630,9 @@ static struct clk_lookup lookups[] = { | |||
626 | CLKDEV_DEV_ID("sh_mobile_lcdc_fb.0", &mstp_clks[MSTP100]), /* LCDC0 */ | 630 | CLKDEV_DEV_ID("sh_mobile_lcdc_fb.0", &mstp_clks[MSTP100]), /* LCDC0 */ |
627 | CLKDEV_DEV_ID("uio_pdrv_genirq.6", &mstp_clks[MSTP223]), /* SPU2DSP0 */ | 631 | CLKDEV_DEV_ID("uio_pdrv_genirq.6", &mstp_clks[MSTP223]), /* SPU2DSP0 */ |
628 | CLKDEV_DEV_ID("uio_pdrv_genirq.7", &mstp_clks[MSTP223]), /* SPU2DSP1 */ | 632 | CLKDEV_DEV_ID("uio_pdrv_genirq.7", &mstp_clks[MSTP223]), /* SPU2DSP1 */ |
633 | CLKDEV_DEV_ID("sh-dma-engine.0", &mstp_clks[MSTP218]), /* DMAC1 */ | ||
634 | CLKDEV_DEV_ID("sh-dma-engine.1", &mstp_clks[MSTP217]), /* DMAC2 */ | ||
635 | CLKDEV_DEV_ID("sh-dma-engine.2", &mstp_clks[MSTP216]), /* DMAC3 */ | ||
629 | CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP207]), /* SCIFA5 */ | 636 | CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP207]), /* SCIFA5 */ |
630 | CLKDEV_DEV_ID("sh-sci.6", &mstp_clks[MSTP206]), /* SCIFB */ | 637 | CLKDEV_DEV_ID("sh-sci.6", &mstp_clks[MSTP206]), /* SCIFB */ |
631 | CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP204]), /* SCIFA0 */ | 638 | CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP204]), /* SCIFA0 */ |
diff --git a/arch/blackfin/lib/strncpy.S b/arch/blackfin/lib/strncpy.S index f3931d50b4a7..2c07dddac995 100644 --- a/arch/blackfin/lib/strncpy.S +++ b/arch/blackfin/lib/strncpy.S | |||
@@ -25,7 +25,7 @@ | |||
25 | 25 | ||
26 | ENTRY(_strncpy) | 26 | ENTRY(_strncpy) |
27 | CC = R2 == 0; | 27 | CC = R2 == 0; |
28 | if CC JUMP 4f; | 28 | if CC JUMP 6f; |
29 | 29 | ||
30 | P2 = R2 ; /* size */ | 30 | P2 = R2 ; /* size */ |
31 | P0 = R0 ; /* dst*/ | 31 | P0 = R0 ; /* dst*/ |
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig index 74495a5ea027..f03338c2f088 100644 --- a/arch/sh/Kconfig +++ b/arch/sh/Kconfig | |||
@@ -161,7 +161,7 @@ config ARCH_HAS_CPU_IDLE_WAIT | |||
161 | 161 | ||
162 | config NO_IOPORT | 162 | config NO_IOPORT |
163 | def_bool !PCI | 163 | def_bool !PCI |
164 | depends on !SH_CAYMAN && !SH_SH4202_MICRODEV | 164 | depends on !SH_CAYMAN && !SH_SH4202_MICRODEV && !SH_SHMIN |
165 | 165 | ||
166 | config IO_TRAPPED | 166 | config IO_TRAPPED |
167 | bool | 167 | bool |
diff --git a/arch/sh/boards/mach-ap325rxa/setup.c b/arch/sh/boards/mach-ap325rxa/setup.c index 618bd566cf53..969421f64a15 100644 --- a/arch/sh/boards/mach-ap325rxa/setup.c +++ b/arch/sh/boards/mach-ap325rxa/setup.c | |||
@@ -359,37 +359,31 @@ static struct soc_camera_link camera_link = { | |||
359 | .priv = &camera_info, | 359 | .priv = &camera_info, |
360 | }; | 360 | }; |
361 | 361 | ||
362 | static void dummy_release(struct device *dev) | 362 | static struct platform_device *camera_device; |
363 | |||
364 | static void ap325rxa_camera_release(struct device *dev) | ||
363 | { | 365 | { |
366 | soc_camera_platform_release(&camera_device); | ||
364 | } | 367 | } |
365 | 368 | ||
366 | static struct platform_device camera_device = { | ||
367 | .name = "soc_camera_platform", | ||
368 | .dev = { | ||
369 | .platform_data = &camera_info, | ||
370 | .release = dummy_release, | ||
371 | }, | ||
372 | }; | ||
373 | |||
374 | static int ap325rxa_camera_add(struct soc_camera_link *icl, | 369 | static int ap325rxa_camera_add(struct soc_camera_link *icl, |
375 | struct device *dev) | 370 | struct device *dev) |
376 | { | 371 | { |
377 | if (icl != &camera_link || camera_probe() <= 0) | 372 | int ret = soc_camera_platform_add(icl, dev, &camera_device, &camera_link, |
378 | return -ENODEV; | 373 | ap325rxa_camera_release, 0); |
374 | if (ret < 0) | ||
375 | return ret; | ||
379 | 376 | ||
380 | camera_info.dev = dev; | 377 | ret = camera_probe(); |
378 | if (ret < 0) | ||
379 | soc_camera_platform_del(icl, camera_device, &camera_link); | ||
381 | 380 | ||
382 | return platform_device_register(&camera_device); | 381 | return ret; |
383 | } | 382 | } |
384 | 383 | ||
385 | static void ap325rxa_camera_del(struct soc_camera_link *icl) | 384 | static void ap325rxa_camera_del(struct soc_camera_link *icl) |
386 | { | 385 | { |
387 | if (icl != &camera_link) | 386 | soc_camera_platform_del(icl, camera_device, &camera_link); |
388 | return; | ||
389 | |||
390 | platform_device_unregister(&camera_device); | ||
391 | memset(&camera_device.dev.kobj, 0, | ||
392 | sizeof(camera_device.dev.kobj)); | ||
393 | } | 387 | } |
394 | #endif /* CONFIG_I2C */ | 388 | #endif /* CONFIG_I2C */ |
395 | 389 | ||
diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c index bb13d0e1b964..3a32741cc0ac 100644 --- a/arch/sh/boards/mach-ecovec24/setup.c +++ b/arch/sh/boards/mach-ecovec24/setup.c | |||
@@ -885,6 +885,9 @@ static struct platform_device sh_mmcif_device = { | |||
885 | }, | 885 | }, |
886 | .num_resources = ARRAY_SIZE(sh_mmcif_resources), | 886 | .num_resources = ARRAY_SIZE(sh_mmcif_resources), |
887 | .resource = sh_mmcif_resources, | 887 | .resource = sh_mmcif_resources, |
888 | .archdata = { | ||
889 | .hwblk_id = HWBLK_MMC, | ||
890 | }, | ||
888 | }; | 891 | }; |
889 | #endif | 892 | #endif |
890 | 893 | ||
diff --git a/arch/sh/include/asm/pgtable.h b/arch/sh/include/asm/pgtable.h index db85916b9e95..9210e93a92c3 100644 --- a/arch/sh/include/asm/pgtable.h +++ b/arch/sh/include/asm/pgtable.h | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <asm/pgtable-2level.h> | 18 | #include <asm/pgtable-2level.h> |
19 | #endif | 19 | #endif |
20 | #include <asm/page.h> | 20 | #include <asm/page.h> |
21 | #include <asm/mmu.h> | ||
21 | 22 | ||
22 | #ifndef __ASSEMBLY__ | 23 | #ifndef __ASSEMBLY__ |
23 | #include <asm/addrspace.h> | 24 | #include <asm/addrspace.h> |
diff --git a/arch/sh/include/asm/ptrace.h b/arch/sh/include/asm/ptrace.h index 40725b4a8018..88bd6be168a9 100644 --- a/arch/sh/include/asm/ptrace.h +++ b/arch/sh/include/asm/ptrace.h | |||
@@ -41,7 +41,9 @@ | |||
41 | 41 | ||
42 | #define user_mode(regs) (((regs)->sr & 0x40000000)==0) | 42 | #define user_mode(regs) (((regs)->sr & 0x40000000)==0) |
43 | #define kernel_stack_pointer(_regs) ((unsigned long)(_regs)->regs[15]) | 43 | #define kernel_stack_pointer(_regs) ((unsigned long)(_regs)->regs[15]) |
44 | #define GET_USP(regs) ((regs)->regs[15]) | 44 | |
45 | #define GET_FP(regs) ((regs)->regs[14]) | ||
46 | #define GET_USP(regs) ((regs)->regs[15]) | ||
45 | 47 | ||
46 | extern void show_regs(struct pt_regs *); | 48 | extern void show_regs(struct pt_regs *); |
47 | 49 | ||
@@ -131,7 +133,7 @@ extern void ptrace_triggered(struct perf_event *bp, int nmi, | |||
131 | 133 | ||
132 | static inline unsigned long profile_pc(struct pt_regs *regs) | 134 | static inline unsigned long profile_pc(struct pt_regs *regs) |
133 | { | 135 | { |
134 | unsigned long pc = instruction_pointer(regs); | 136 | unsigned long pc = regs->pc; |
135 | 137 | ||
136 | if (virt_addr_uncached(pc)) | 138 | if (virt_addr_uncached(pc)) |
137 | return CAC_ADDR(pc); | 139 | return CAC_ADDR(pc); |
diff --git a/arch/sh/include/asm/tlb.h b/arch/sh/include/asm/tlb.h index 6c308d8b9a50..ec88bfcdf7ce 100644 --- a/arch/sh/include/asm/tlb.h +++ b/arch/sh/include/asm/tlb.h | |||
@@ -9,6 +9,7 @@ | |||
9 | #include <linux/pagemap.h> | 9 | #include <linux/pagemap.h> |
10 | 10 | ||
11 | #ifdef CONFIG_MMU | 11 | #ifdef CONFIG_MMU |
12 | #include <linux/swap.h> | ||
12 | #include <asm/pgalloc.h> | 13 | #include <asm/pgalloc.h> |
13 | #include <asm/tlbflush.h> | 14 | #include <asm/tlbflush.h> |
14 | #include <asm/mmu_context.h> | 15 | #include <asm/mmu_context.h> |
diff --git a/arch/sh/include/cpu-sh4/cpu/sh7722.h b/arch/sh/include/cpu-sh4/cpu/sh7722.h index 7a5b8a331b4a..bd0622788d64 100644 --- a/arch/sh/include/cpu-sh4/cpu/sh7722.h +++ b/arch/sh/include/cpu-sh4/cpu/sh7722.h | |||
@@ -236,6 +236,7 @@ enum { | |||
236 | }; | 236 | }; |
237 | 237 | ||
238 | enum { | 238 | enum { |
239 | SHDMA_SLAVE_INVALID, | ||
239 | SHDMA_SLAVE_SCIF0_TX, | 240 | SHDMA_SLAVE_SCIF0_TX, |
240 | SHDMA_SLAVE_SCIF0_RX, | 241 | SHDMA_SLAVE_SCIF0_RX, |
241 | SHDMA_SLAVE_SCIF1_TX, | 242 | SHDMA_SLAVE_SCIF1_TX, |
diff --git a/arch/sh/include/cpu-sh4/cpu/sh7724.h b/arch/sh/include/cpu-sh4/cpu/sh7724.h index 7eb435999426..3daef8ecbc63 100644 --- a/arch/sh/include/cpu-sh4/cpu/sh7724.h +++ b/arch/sh/include/cpu-sh4/cpu/sh7724.h | |||
@@ -285,6 +285,7 @@ enum { | |||
285 | }; | 285 | }; |
286 | 286 | ||
287 | enum { | 287 | enum { |
288 | SHDMA_SLAVE_INVALID, | ||
288 | SHDMA_SLAVE_SCIF0_TX, | 289 | SHDMA_SLAVE_SCIF0_TX, |
289 | SHDMA_SLAVE_SCIF0_RX, | 290 | SHDMA_SLAVE_SCIF0_RX, |
290 | SHDMA_SLAVE_SCIF1_TX, | 291 | SHDMA_SLAVE_SCIF1_TX, |
diff --git a/arch/sh/include/cpu-sh4/cpu/sh7757.h b/arch/sh/include/cpu-sh4/cpu/sh7757.h index 05b8196c7753..41f9f8b9db73 100644 --- a/arch/sh/include/cpu-sh4/cpu/sh7757.h +++ b/arch/sh/include/cpu-sh4/cpu/sh7757.h | |||
@@ -252,6 +252,7 @@ enum { | |||
252 | }; | 252 | }; |
253 | 253 | ||
254 | enum { | 254 | enum { |
255 | SHDMA_SLAVE_INVALID, | ||
255 | SHDMA_SLAVE_SDHI_TX, | 256 | SHDMA_SLAVE_SDHI_TX, |
256 | SHDMA_SLAVE_SDHI_RX, | 257 | SHDMA_SLAVE_SDHI_RX, |
257 | SHDMA_SLAVE_MMCIF_TX, | 258 | SHDMA_SLAVE_MMCIF_TX, |
diff --git a/arch/sh/kernel/process_32.c b/arch/sh/kernel/process_32.c index 762a13984bbd..b473f0c06fbc 100644 --- a/arch/sh/kernel/process_32.c +++ b/arch/sh/kernel/process_32.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/fs.h> | 21 | #include <linux/fs.h> |
22 | #include <linux/ftrace.h> | 22 | #include <linux/ftrace.h> |
23 | #include <linux/hw_breakpoint.h> | 23 | #include <linux/hw_breakpoint.h> |
24 | #include <linux/prefetch.h> | ||
24 | #include <asm/uaccess.h> | 25 | #include <asm/uaccess.h> |
25 | #include <asm/mmu_context.h> | 26 | #include <asm/mmu_context.h> |
26 | #include <asm/system.h> | 27 | #include <asm/system.h> |
diff --git a/arch/sh/mm/consistent.c b/arch/sh/mm/consistent.c index 40733a952402..f251b5f27652 100644 --- a/arch/sh/mm/consistent.c +++ b/arch/sh/mm/consistent.c | |||
@@ -82,7 +82,7 @@ void dma_cache_sync(struct device *dev, void *vaddr, size_t size, | |||
82 | void *addr; | 82 | void *addr; |
83 | 83 | ||
84 | addr = __in_29bit_mode() ? | 84 | addr = __in_29bit_mode() ? |
85 | (void *)P1SEGADDR((unsigned long)vaddr) : vaddr; | 85 | (void *)CAC_ADDR((unsigned long)vaddr) : vaddr; |
86 | 86 | ||
87 | switch (direction) { | 87 | switch (direction) { |
88 | case DMA_FROM_DEVICE: /* invalidate only */ | 88 | case DMA_FROM_DEVICE: /* invalidate only */ |
diff --git a/block/blk-ioc.c b/block/blk-ioc.c index c898049dafd5..342eae9b0d3c 100644 --- a/block/blk-ioc.c +++ b/block/blk-ioc.c | |||
@@ -21,7 +21,7 @@ static void cfq_dtor(struct io_context *ioc) | |||
21 | if (!hlist_empty(&ioc->cic_list)) { | 21 | if (!hlist_empty(&ioc->cic_list)) { |
22 | struct cfq_io_context *cic; | 22 | struct cfq_io_context *cic; |
23 | 23 | ||
24 | cic = list_entry(ioc->cic_list.first, struct cfq_io_context, | 24 | cic = hlist_entry(ioc->cic_list.first, struct cfq_io_context, |
25 | cic_list); | 25 | cic_list); |
26 | cic->dtor(ioc); | 26 | cic->dtor(ioc); |
27 | } | 27 | } |
@@ -57,7 +57,7 @@ static void cfq_exit(struct io_context *ioc) | |||
57 | if (!hlist_empty(&ioc->cic_list)) { | 57 | if (!hlist_empty(&ioc->cic_list)) { |
58 | struct cfq_io_context *cic; | 58 | struct cfq_io_context *cic; |
59 | 59 | ||
60 | cic = list_entry(ioc->cic_list.first, struct cfq_io_context, | 60 | cic = hlist_entry(ioc->cic_list.first, struct cfq_io_context, |
61 | cic_list); | 61 | cic_list); |
62 | cic->exit(ioc); | 62 | cic->exit(ioc); |
63 | } | 63 | } |
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index 7c52d6888924..3c7b537bf908 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c | |||
@@ -185,7 +185,7 @@ struct cfq_group { | |||
185 | int nr_cfqq; | 185 | int nr_cfqq; |
186 | 186 | ||
187 | /* | 187 | /* |
188 | * Per group busy queus average. Useful for workload slice calc. We | 188 | * Per group busy queues average. Useful for workload slice calc. We |
189 | * create the array for each prio class but at run time it is used | 189 | * create the array for each prio class but at run time it is used |
190 | * only for RT and BE class and slot for IDLE class remains unused. | 190 | * only for RT and BE class and slot for IDLE class remains unused. |
191 | * This is primarily done to avoid confusion and a gcc warning. | 191 | * This is primarily done to avoid confusion and a gcc warning. |
@@ -369,16 +369,16 @@ CFQ_CFQQ_FNS(wait_busy); | |||
369 | #define cfq_log_cfqq(cfqd, cfqq, fmt, args...) \ | 369 | #define cfq_log_cfqq(cfqd, cfqq, fmt, args...) \ |
370 | blk_add_trace_msg((cfqd)->queue, "cfq%d%c %s " fmt, (cfqq)->pid, \ | 370 | blk_add_trace_msg((cfqd)->queue, "cfq%d%c %s " fmt, (cfqq)->pid, \ |
371 | cfq_cfqq_sync((cfqq)) ? 'S' : 'A', \ | 371 | cfq_cfqq_sync((cfqq)) ? 'S' : 'A', \ |
372 | blkg_path(&(cfqq)->cfqg->blkg), ##args); | 372 | blkg_path(&(cfqq)->cfqg->blkg), ##args) |
373 | 373 | ||
374 | #define cfq_log_cfqg(cfqd, cfqg, fmt, args...) \ | 374 | #define cfq_log_cfqg(cfqd, cfqg, fmt, args...) \ |
375 | blk_add_trace_msg((cfqd)->queue, "%s " fmt, \ | 375 | blk_add_trace_msg((cfqd)->queue, "%s " fmt, \ |
376 | blkg_path(&(cfqg)->blkg), ##args); \ | 376 | blkg_path(&(cfqg)->blkg), ##args) \ |
377 | 377 | ||
378 | #else | 378 | #else |
379 | #define cfq_log_cfqq(cfqd, cfqq, fmt, args...) \ | 379 | #define cfq_log_cfqq(cfqd, cfqq, fmt, args...) \ |
380 | blk_add_trace_msg((cfqd)->queue, "cfq%d " fmt, (cfqq)->pid, ##args) | 380 | blk_add_trace_msg((cfqd)->queue, "cfq%d " fmt, (cfqq)->pid, ##args) |
381 | #define cfq_log_cfqg(cfqd, cfqg, fmt, args...) do {} while (0); | 381 | #define cfq_log_cfqg(cfqd, cfqg, fmt, args...) do {} while (0) |
382 | #endif | 382 | #endif |
383 | #define cfq_log(cfqd, fmt, args...) \ | 383 | #define cfq_log(cfqd, fmt, args...) \ |
384 | blk_add_trace_msg((cfqd)->queue, "cfq " fmt, ##args) | 384 | blk_add_trace_msg((cfqd)->queue, "cfq " fmt, ##args) |
@@ -3786,9 +3786,6 @@ new_queue: | |||
3786 | return 0; | 3786 | return 0; |
3787 | 3787 | ||
3788 | queue_fail: | 3788 | queue_fail: |
3789 | if (cic) | ||
3790 | put_io_context(cic->ioc); | ||
3791 | |||
3792 | cfq_schedule_dispatch(cfqd); | 3789 | cfq_schedule_dispatch(cfqd); |
3793 | spin_unlock_irqrestore(q->queue_lock, flags); | 3790 | spin_unlock_irqrestore(q->queue_lock, flags); |
3794 | cfq_log(cfqd, "set_request fail"); | 3791 | cfq_log(cfqd, "set_request fail"); |
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index e6fc716aca45..f533f3375e24 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c | |||
@@ -192,7 +192,8 @@ static int sock_xmit(struct nbd_device *lo, int send, void *buf, int size, | |||
192 | if (lo->xmit_timeout) | 192 | if (lo->xmit_timeout) |
193 | del_timer_sync(&ti); | 193 | del_timer_sync(&ti); |
194 | } else | 194 | } else |
195 | result = kernel_recvmsg(sock, &msg, &iov, 1, size, 0); | 195 | result = kernel_recvmsg(sock, &msg, &iov, 1, size, |
196 | msg.msg_flags); | ||
196 | 197 | ||
197 | if (signal_pending(current)) { | 198 | if (signal_pending(current)) { |
198 | siginfo_t info; | 199 | siginfo_t info; |
@@ -753,9 +754,26 @@ static int __init nbd_init(void) | |||
753 | return -ENOMEM; | 754 | return -ENOMEM; |
754 | 755 | ||
755 | part_shift = 0; | 756 | part_shift = 0; |
756 | if (max_part > 0) | 757 | if (max_part > 0) { |
757 | part_shift = fls(max_part); | 758 | part_shift = fls(max_part); |
758 | 759 | ||
760 | /* | ||
761 | * Adjust max_part according to part_shift as it is exported | ||
762 | * to user space so that user can know the max number of | ||
763 | * partition kernel should be able to manage. | ||
764 | * | ||
765 | * Note that -1 is required because partition 0 is reserved | ||
766 | * for the whole disk. | ||
767 | */ | ||
768 | max_part = (1UL << part_shift) - 1; | ||
769 | } | ||
770 | |||
771 | if ((1UL << part_shift) > DISK_MAX_PARTS) | ||
772 | return -EINVAL; | ||
773 | |||
774 | if (nbds_max > 1UL << (MINORBITS - part_shift)) | ||
775 | return -EINVAL; | ||
776 | |||
759 | for (i = 0; i < nbds_max; i++) { | 777 | for (i = 0; i < nbds_max; i++) { |
760 | struct gendisk *disk = alloc_disk(1 << part_shift); | 778 | struct gendisk *disk = alloc_disk(1 << part_shift); |
761 | if (!disk) | 779 | if (!disk) |
diff --git a/drivers/block/paride/pcd.c b/drivers/block/paride/pcd.c index a0aabd904a51..46b8136c31bb 100644 --- a/drivers/block/paride/pcd.c +++ b/drivers/block/paride/pcd.c | |||
@@ -321,7 +321,6 @@ static void pcd_init_units(void) | |||
321 | strcpy(disk->disk_name, cd->name); /* umm... */ | 321 | strcpy(disk->disk_name, cd->name); /* umm... */ |
322 | disk->fops = &pcd_bdops; | 322 | disk->fops = &pcd_bdops; |
323 | disk->flags = GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE; | 323 | disk->flags = GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE; |
324 | disk->events = DISK_EVENT_MEDIA_CHANGE; | ||
325 | } | 324 | } |
326 | } | 325 | } |
327 | 326 | ||
diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c index c73910cc28c9..5cf2993a8338 100644 --- a/drivers/block/xen-blkback/blkback.c +++ b/drivers/block/xen-blkback/blkback.c | |||
@@ -809,11 +809,13 @@ static int __init xen_blkif_init(void) | |||
809 | failed_init: | 809 | failed_init: |
810 | kfree(blkbk->pending_reqs); | 810 | kfree(blkbk->pending_reqs); |
811 | kfree(blkbk->pending_grant_handles); | 811 | kfree(blkbk->pending_grant_handles); |
812 | for (i = 0; i < mmap_pages; i++) { | 812 | if (blkbk->pending_pages) { |
813 | if (blkbk->pending_pages[i]) | 813 | for (i = 0; i < mmap_pages; i++) { |
814 | __free_page(blkbk->pending_pages[i]); | 814 | if (blkbk->pending_pages[i]) |
815 | __free_page(blkbk->pending_pages[i]); | ||
816 | } | ||
817 | kfree(blkbk->pending_pages); | ||
815 | } | 818 | } |
816 | kfree(blkbk->pending_pages); | ||
817 | kfree(blkbk); | 819 | kfree(blkbk); |
818 | blkbk = NULL; | 820 | blkbk = NULL; |
819 | return rc; | 821 | return rc; |
diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c index 34570823355b..6cc0db1bf522 100644 --- a/drivers/block/xen-blkback/xenbus.c +++ b/drivers/block/xen-blkback/xenbus.c | |||
@@ -357,14 +357,13 @@ static int xen_vbd_create(struct xen_blkif *blkif, blkif_vdev_t handle, | |||
357 | } | 357 | } |
358 | 358 | ||
359 | vbd->bdev = bdev; | 359 | vbd->bdev = bdev; |
360 | vbd->size = vbd_sz(vbd); | ||
361 | |||
362 | if (vbd->bdev->bd_disk == NULL) { | 360 | if (vbd->bdev->bd_disk == NULL) { |
363 | DPRINTK("xen_vbd_create: device %08x doesn't exist.\n", | 361 | DPRINTK("xen_vbd_create: device %08x doesn't exist.\n", |
364 | vbd->pdevice); | 362 | vbd->pdevice); |
365 | xen_vbd_free(vbd); | 363 | xen_vbd_free(vbd); |
366 | return -ENOENT; | 364 | return -ENOENT; |
367 | } | 365 | } |
366 | vbd->size = vbd_sz(vbd); | ||
368 | 367 | ||
369 | if (vbd->bdev->bd_disk->flags & GENHD_FL_CD || cdrom) | 368 | if (vbd->bdev->bd_disk->flags & GENHD_FL_CD || cdrom) |
370 | vbd->type |= VDISK_CDROM; | 369 | vbd->type |= VDISK_CDROM; |
diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c index b3f01996318f..48ad2a7ab080 100644 --- a/drivers/bluetooth/hci_ldisc.c +++ b/drivers/bluetooth/hci_ldisc.c | |||
@@ -355,29 +355,24 @@ static void hci_uart_tty_wakeup(struct tty_struct *tty) | |||
355 | * flags pointer to flags for data | 355 | * flags pointer to flags for data |
356 | * count count of received data in bytes | 356 | * count count of received data in bytes |
357 | * | 357 | * |
358 | * Return Value: Number of bytes received | 358 | * Return Value: None |
359 | */ | 359 | */ |
360 | static unsigned int hci_uart_tty_receive(struct tty_struct *tty, | 360 | static void hci_uart_tty_receive(struct tty_struct *tty, const u8 *data, char *flags, int count) |
361 | const u8 *data, char *flags, int count) | ||
362 | { | 361 | { |
363 | struct hci_uart *hu = (void *)tty->disc_data; | 362 | struct hci_uart *hu = (void *)tty->disc_data; |
364 | int received; | ||
365 | 363 | ||
366 | if (!hu || tty != hu->tty) | 364 | if (!hu || tty != hu->tty) |
367 | return -ENODEV; | 365 | return; |
368 | 366 | ||
369 | if (!test_bit(HCI_UART_PROTO_SET, &hu->flags)) | 367 | if (!test_bit(HCI_UART_PROTO_SET, &hu->flags)) |
370 | return -EINVAL; | 368 | return; |
371 | 369 | ||
372 | spin_lock(&hu->rx_lock); | 370 | spin_lock(&hu->rx_lock); |
373 | received = hu->proto->recv(hu, (void *) data, count); | 371 | hu->proto->recv(hu, (void *) data, count); |
374 | if (received > 0) | 372 | hu->hdev->stat.byte_rx += count; |
375 | hu->hdev->stat.byte_rx += received; | ||
376 | spin_unlock(&hu->rx_lock); | 373 | spin_unlock(&hu->rx_lock); |
377 | 374 | ||
378 | tty_unthrottle(tty); | 375 | tty_unthrottle(tty); |
379 | |||
380 | return received; | ||
381 | } | 376 | } |
382 | 377 | ||
383 | static int hci_uart_register_dev(struct hci_uart *hu) | 378 | static int hci_uart_register_dev(struct hci_uart *hu) |
diff --git a/drivers/cdrom/viocd.c b/drivers/cdrom/viocd.c index ae15a4ddaa9b..7878da89d29e 100644 --- a/drivers/cdrom/viocd.c +++ b/drivers/cdrom/viocd.c | |||
@@ -627,7 +627,6 @@ static int viocd_probe(struct vio_dev *vdev, const struct vio_device_id *id) | |||
627 | gendisk->fops = &viocd_fops; | 627 | gendisk->fops = &viocd_fops; |
628 | gendisk->flags = GENHD_FL_CD | GENHD_FL_REMOVABLE | | 628 | gendisk->flags = GENHD_FL_CD | GENHD_FL_REMOVABLE | |
629 | GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE; | 629 | GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE; |
630 | gendisk->events = DISK_EVENT_MEDIA_CHANGE; | ||
631 | set_capacity(gendisk, 0); | 630 | set_capacity(gendisk, 0); |
632 | gendisk->private_data = d; | 631 | gendisk->private_data = d; |
633 | d->viocd_disk = gendisk; | 632 | d->viocd_disk = gendisk; |
diff --git a/drivers/clocksource/sh_cmt.c b/drivers/clocksource/sh_cmt.c index 036e5865eb40..dc7c033ef587 100644 --- a/drivers/clocksource/sh_cmt.c +++ b/drivers/clocksource/sh_cmt.c | |||
@@ -24,7 +24,6 @@ | |||
24 | #include <linux/ioport.h> | 24 | #include <linux/ioport.h> |
25 | #include <linux/io.h> | 25 | #include <linux/io.h> |
26 | #include <linux/clk.h> | 26 | #include <linux/clk.h> |
27 | #include <linux/pm_runtime.h> | ||
28 | #include <linux/irq.h> | 27 | #include <linux/irq.h> |
29 | #include <linux/err.h> | 28 | #include <linux/err.h> |
30 | #include <linux/clocksource.h> | 29 | #include <linux/clocksource.h> |
@@ -153,12 +152,10 @@ static int sh_cmt_enable(struct sh_cmt_priv *p, unsigned long *rate) | |||
153 | { | 152 | { |
154 | int ret; | 153 | int ret; |
155 | 154 | ||
156 | /* wake up device and enable clock */ | 155 | /* enable clock */ |
157 | pm_runtime_get_sync(&p->pdev->dev); | ||
158 | ret = clk_enable(p->clk); | 156 | ret = clk_enable(p->clk); |
159 | if (ret) { | 157 | if (ret) { |
160 | dev_err(&p->pdev->dev, "cannot enable clock\n"); | 158 | dev_err(&p->pdev->dev, "cannot enable clock\n"); |
161 | pm_runtime_put_sync(&p->pdev->dev); | ||
162 | return ret; | 159 | return ret; |
163 | } | 160 | } |
164 | 161 | ||
@@ -190,9 +187,8 @@ static void sh_cmt_disable(struct sh_cmt_priv *p) | |||
190 | /* disable interrupts in CMT block */ | 187 | /* disable interrupts in CMT block */ |
191 | sh_cmt_write(p, CMCSR, 0); | 188 | sh_cmt_write(p, CMCSR, 0); |
192 | 189 | ||
193 | /* stop clock and mark device as idle */ | 190 | /* stop clock */ |
194 | clk_disable(p->clk); | 191 | clk_disable(p->clk); |
195 | pm_runtime_put_sync(&p->pdev->dev); | ||
196 | } | 192 | } |
197 | 193 | ||
198 | /* private flags */ | 194 | /* private flags */ |
@@ -664,7 +660,6 @@ static int __devinit sh_cmt_probe(struct platform_device *pdev) | |||
664 | 660 | ||
665 | if (p) { | 661 | if (p) { |
666 | dev_info(&pdev->dev, "kept as earlytimer\n"); | 662 | dev_info(&pdev->dev, "kept as earlytimer\n"); |
667 | pm_runtime_enable(&pdev->dev); | ||
668 | return 0; | 663 | return 0; |
669 | } | 664 | } |
670 | 665 | ||
@@ -679,9 +674,6 @@ static int __devinit sh_cmt_probe(struct platform_device *pdev) | |||
679 | kfree(p); | 674 | kfree(p); |
680 | platform_set_drvdata(pdev, NULL); | 675 | platform_set_drvdata(pdev, NULL); |
681 | } | 676 | } |
682 | |||
683 | if (!is_early_platform_device(pdev)) | ||
684 | pm_runtime_enable(&pdev->dev); | ||
685 | return ret; | 677 | return ret; |
686 | } | 678 | } |
687 | 679 | ||
diff --git a/drivers/clocksource/sh_tmu.c b/drivers/clocksource/sh_tmu.c index 17296288a205..808135768617 100644 --- a/drivers/clocksource/sh_tmu.c +++ b/drivers/clocksource/sh_tmu.c | |||
@@ -25,7 +25,6 @@ | |||
25 | #include <linux/delay.h> | 25 | #include <linux/delay.h> |
26 | #include <linux/io.h> | 26 | #include <linux/io.h> |
27 | #include <linux/clk.h> | 27 | #include <linux/clk.h> |
28 | #include <linux/pm_runtime.h> | ||
29 | #include <linux/irq.h> | 28 | #include <linux/irq.h> |
30 | #include <linux/err.h> | 29 | #include <linux/err.h> |
31 | #include <linux/clocksource.h> | 30 | #include <linux/clocksource.h> |
@@ -110,12 +109,10 @@ static int sh_tmu_enable(struct sh_tmu_priv *p) | |||
110 | { | 109 | { |
111 | int ret; | 110 | int ret; |
112 | 111 | ||
113 | /* wake up device and enable clock */ | 112 | /* enable clock */ |
114 | pm_runtime_get_sync(&p->pdev->dev); | ||
115 | ret = clk_enable(p->clk); | 113 | ret = clk_enable(p->clk); |
116 | if (ret) { | 114 | if (ret) { |
117 | dev_err(&p->pdev->dev, "cannot enable clock\n"); | 115 | dev_err(&p->pdev->dev, "cannot enable clock\n"); |
118 | pm_runtime_put_sync(&p->pdev->dev); | ||
119 | return ret; | 116 | return ret; |
120 | } | 117 | } |
121 | 118 | ||
@@ -144,9 +141,8 @@ static void sh_tmu_disable(struct sh_tmu_priv *p) | |||
144 | /* disable interrupts in TMU block */ | 141 | /* disable interrupts in TMU block */ |
145 | sh_tmu_write(p, TCR, 0x0000); | 142 | sh_tmu_write(p, TCR, 0x0000); |
146 | 143 | ||
147 | /* stop clock and mark device as idle */ | 144 | /* stop clock */ |
148 | clk_disable(p->clk); | 145 | clk_disable(p->clk); |
149 | pm_runtime_put_sync(&p->pdev->dev); | ||
150 | } | 146 | } |
151 | 147 | ||
152 | static void sh_tmu_set_next(struct sh_tmu_priv *p, unsigned long delta, | 148 | static void sh_tmu_set_next(struct sh_tmu_priv *p, unsigned long delta, |
@@ -415,7 +411,6 @@ static int __devinit sh_tmu_probe(struct platform_device *pdev) | |||
415 | 411 | ||
416 | if (p) { | 412 | if (p) { |
417 | dev_info(&pdev->dev, "kept as earlytimer\n"); | 413 | dev_info(&pdev->dev, "kept as earlytimer\n"); |
418 | pm_runtime_enable(&pdev->dev); | ||
419 | return 0; | 414 | return 0; |
420 | } | 415 | } |
421 | 416 | ||
@@ -430,9 +425,6 @@ static int __devinit sh_tmu_probe(struct platform_device *pdev) | |||
430 | kfree(p); | 425 | kfree(p); |
431 | platform_set_drvdata(pdev, NULL); | 426 | platform_set_drvdata(pdev, NULL); |
432 | } | 427 | } |
433 | |||
434 | if (!is_early_platform_device(pdev)) | ||
435 | pm_runtime_enable(&pdev->dev); | ||
436 | return ret; | 428 | return ret; |
437 | } | 429 | } |
438 | 430 | ||
diff --git a/drivers/dma/shdma.c b/drivers/dma/shdma.c index 636e40925b16..2a638f9f09a2 100644 --- a/drivers/dma/shdma.c +++ b/drivers/dma/shdma.c | |||
@@ -343,7 +343,7 @@ static int sh_dmae_alloc_chan_resources(struct dma_chan *chan) | |||
343 | 343 | ||
344 | dmae_set_dmars(sh_chan, cfg->mid_rid); | 344 | dmae_set_dmars(sh_chan, cfg->mid_rid); |
345 | dmae_set_chcr(sh_chan, cfg->chcr); | 345 | dmae_set_chcr(sh_chan, cfg->chcr); |
346 | } else if ((sh_dmae_readl(sh_chan, CHCR) & 0xf00) != 0x400) { | 346 | } else { |
347 | dmae_init(sh_chan); | 347 | dmae_init(sh_chan); |
348 | } | 348 | } |
349 | 349 | ||
@@ -1144,6 +1144,8 @@ static int __init sh_dmae_probe(struct platform_device *pdev) | |||
1144 | /* platform data */ | 1144 | /* platform data */ |
1145 | shdev->pdata = pdata; | 1145 | shdev->pdata = pdata; |
1146 | 1146 | ||
1147 | platform_set_drvdata(pdev, shdev); | ||
1148 | |||
1147 | pm_runtime_enable(&pdev->dev); | 1149 | pm_runtime_enable(&pdev->dev); |
1148 | pm_runtime_get_sync(&pdev->dev); | 1150 | pm_runtime_get_sync(&pdev->dev); |
1149 | 1151 | ||
@@ -1256,7 +1258,6 @@ static int __init sh_dmae_probe(struct platform_device *pdev) | |||
1256 | 1258 | ||
1257 | pm_runtime_put(&pdev->dev); | 1259 | pm_runtime_put(&pdev->dev); |
1258 | 1260 | ||
1259 | platform_set_drvdata(pdev, shdev); | ||
1260 | dma_async_device_register(&shdev->common); | 1261 | dma_async_device_register(&shdev->common); |
1261 | 1262 | ||
1262 | return err; | 1263 | return err; |
@@ -1278,6 +1279,8 @@ rst_err: | |||
1278 | 1279 | ||
1279 | if (dmars) | 1280 | if (dmars) |
1280 | iounmap(shdev->dmars); | 1281 | iounmap(shdev->dmars); |
1282 | |||
1283 | platform_set_drvdata(pdev, NULL); | ||
1281 | emapdmars: | 1284 | emapdmars: |
1282 | iounmap(shdev->chan_reg); | 1285 | iounmap(shdev->chan_reg); |
1283 | synchronize_rcu(); | 1286 | synchronize_rcu(); |
@@ -1316,6 +1319,8 @@ static int __exit sh_dmae_remove(struct platform_device *pdev) | |||
1316 | iounmap(shdev->dmars); | 1319 | iounmap(shdev->dmars); |
1317 | iounmap(shdev->chan_reg); | 1320 | iounmap(shdev->chan_reg); |
1318 | 1321 | ||
1322 | platform_set_drvdata(pdev, NULL); | ||
1323 | |||
1319 | synchronize_rcu(); | 1324 | synchronize_rcu(); |
1320 | kfree(shdev); | 1325 | kfree(shdev); |
1321 | 1326 | ||
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index 6e5123b1d341..144d27261e43 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c | |||
@@ -1782,7 +1782,6 @@ static int ide_cd_probe(ide_drive_t *drive) | |||
1782 | ide_cd_read_toc(drive, &sense); | 1782 | ide_cd_read_toc(drive, &sense); |
1783 | g->fops = &idecd_ops; | 1783 | g->fops = &idecd_ops; |
1784 | g->flags |= GENHD_FL_REMOVABLE | GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE; | 1784 | g->flags |= GENHD_FL_REMOVABLE | GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE; |
1785 | g->events = DISK_EVENT_MEDIA_CHANGE; | ||
1786 | add_disk(g); | 1785 | add_disk(g); |
1787 | return 0; | 1786 | return 0; |
1788 | 1787 | ||
diff --git a/drivers/input/serio/serport.c b/drivers/input/serio/serport.c index f3698967edf6..8755f5f3ad37 100644 --- a/drivers/input/serio/serport.c +++ b/drivers/input/serio/serport.c | |||
@@ -120,21 +120,17 @@ static void serport_ldisc_close(struct tty_struct *tty) | |||
120 | * 'interrupt' routine. | 120 | * 'interrupt' routine. |
121 | */ | 121 | */ |
122 | 122 | ||
123 | static unsigned int serport_ldisc_receive(struct tty_struct *tty, | 123 | static void serport_ldisc_receive(struct tty_struct *tty, const unsigned char *cp, char *fp, int count) |
124 | const unsigned char *cp, char *fp, int count) | ||
125 | { | 124 | { |
126 | struct serport *serport = (struct serport*) tty->disc_data; | 125 | struct serport *serport = (struct serport*) tty->disc_data; |
127 | unsigned long flags; | 126 | unsigned long flags; |
128 | unsigned int ch_flags; | 127 | unsigned int ch_flags; |
129 | int ret = 0; | ||
130 | int i; | 128 | int i; |
131 | 129 | ||
132 | spin_lock_irqsave(&serport->lock, flags); | 130 | spin_lock_irqsave(&serport->lock, flags); |
133 | 131 | ||
134 | if (!test_bit(SERPORT_ACTIVE, &serport->flags)) { | 132 | if (!test_bit(SERPORT_ACTIVE, &serport->flags)) |
135 | ret = -EINVAL; | ||
136 | goto out; | 133 | goto out; |
137 | } | ||
138 | 134 | ||
139 | for (i = 0; i < count; i++) { | 135 | for (i = 0; i < count; i++) { |
140 | switch (fp[i]) { | 136 | switch (fp[i]) { |
@@ -156,8 +152,6 @@ static unsigned int serport_ldisc_receive(struct tty_struct *tty, | |||
156 | 152 | ||
157 | out: | 153 | out: |
158 | spin_unlock_irqrestore(&serport->lock, flags); | 154 | spin_unlock_irqrestore(&serport->lock, flags); |
159 | |||
160 | return ret == 0 ? count : ret; | ||
161 | } | 155 | } |
162 | 156 | ||
163 | /* | 157 | /* |
diff --git a/drivers/isdn/gigaset/ser-gigaset.c b/drivers/isdn/gigaset/ser-gigaset.c index 1d44d470897c..86a5c4f7775e 100644 --- a/drivers/isdn/gigaset/ser-gigaset.c +++ b/drivers/isdn/gigaset/ser-gigaset.c | |||
@@ -674,7 +674,7 @@ gigaset_tty_ioctl(struct tty_struct *tty, struct file *file, | |||
674 | * cflags buffer containing error flags for received characters (ignored) | 674 | * cflags buffer containing error flags for received characters (ignored) |
675 | * count number of received characters | 675 | * count number of received characters |
676 | */ | 676 | */ |
677 | static unsigned int | 677 | static void |
678 | gigaset_tty_receive(struct tty_struct *tty, const unsigned char *buf, | 678 | gigaset_tty_receive(struct tty_struct *tty, const unsigned char *buf, |
679 | char *cflags, int count) | 679 | char *cflags, int count) |
680 | { | 680 | { |
@@ -683,12 +683,12 @@ gigaset_tty_receive(struct tty_struct *tty, const unsigned char *buf, | |||
683 | struct inbuf_t *inbuf; | 683 | struct inbuf_t *inbuf; |
684 | 684 | ||
685 | if (!cs) | 685 | if (!cs) |
686 | return -ENODEV; | 686 | return; |
687 | inbuf = cs->inbuf; | 687 | inbuf = cs->inbuf; |
688 | if (!inbuf) { | 688 | if (!inbuf) { |
689 | dev_err(cs->dev, "%s: no inbuf\n", __func__); | 689 | dev_err(cs->dev, "%s: no inbuf\n", __func__); |
690 | cs_put(cs); | 690 | cs_put(cs); |
691 | return -EINVAL; | 691 | return; |
692 | } | 692 | } |
693 | 693 | ||
694 | tail = inbuf->tail; | 694 | tail = inbuf->tail; |
@@ -725,8 +725,6 @@ gigaset_tty_receive(struct tty_struct *tty, const unsigned char *buf, | |||
725 | gig_dbg(DEBUG_INTR, "%s-->BH", __func__); | 725 | gig_dbg(DEBUG_INTR, "%s-->BH", __func__); |
726 | gigaset_schedule_event(cs); | 726 | gigaset_schedule_event(cs); |
727 | cs_put(cs); | 727 | cs_put(cs); |
728 | |||
729 | return count; | ||
730 | } | 728 | } |
731 | 729 | ||
732 | /* | 730 | /* |
diff --git a/drivers/misc/kgdbts.c b/drivers/misc/kgdbts.c index b0c56313dbbb..8cebec5e85ee 100644 --- a/drivers/misc/kgdbts.c +++ b/drivers/misc/kgdbts.c | |||
@@ -304,7 +304,10 @@ static int check_and_rewind_pc(char *put_str, char *arg) | |||
304 | return 1; | 304 | return 1; |
305 | } | 305 | } |
306 | /* Readjust the instruction pointer if needed */ | 306 | /* Readjust the instruction pointer if needed */ |
307 | instruction_pointer_set(&kgdbts_regs, ip + offset); | 307 | ip += offset; |
308 | #ifdef GDB_ADJUSTS_BREAK_OFFSET | ||
309 | instruction_pointer_set(&kgdbts_regs, ip); | ||
310 | #endif | ||
308 | return 0; | 311 | return 0; |
309 | } | 312 | } |
310 | 313 | ||
diff --git a/drivers/misc/ti-st/st_core.c b/drivers/misc/ti-st/st_core.c index 1a05fe08e2cb..f91f82eabda7 100644 --- a/drivers/misc/ti-st/st_core.c +++ b/drivers/misc/ti-st/st_core.c | |||
@@ -747,8 +747,8 @@ static void st_tty_close(struct tty_struct *tty) | |||
747 | pr_debug("%s: done ", __func__); | 747 | pr_debug("%s: done ", __func__); |
748 | } | 748 | } |
749 | 749 | ||
750 | static unsigned int st_tty_receive(struct tty_struct *tty, | 750 | static void st_tty_receive(struct tty_struct *tty, const unsigned char *data, |
751 | const unsigned char *data, char *tty_flags, int count) | 751 | char *tty_flags, int count) |
752 | { | 752 | { |
753 | #ifdef VERBOSE | 753 | #ifdef VERBOSE |
754 | print_hex_dump(KERN_DEBUG, ">in>", DUMP_PREFIX_NONE, | 754 | print_hex_dump(KERN_DEBUG, ">in>", DUMP_PREFIX_NONE, |
@@ -761,8 +761,6 @@ static unsigned int st_tty_receive(struct tty_struct *tty, | |||
761 | */ | 761 | */ |
762 | st_recv(tty->disc_data, data, count); | 762 | st_recv(tty->disc_data, data, count); |
763 | pr_debug("done %s", __func__); | 763 | pr_debug("done %s", __func__); |
764 | |||
765 | return count; | ||
766 | } | 764 | } |
767 | 765 | ||
768 | /* wake-up function called in from the TTY layer | 766 | /* wake-up function called in from the TTY layer |
diff --git a/drivers/net/caif/caif_serial.c b/drivers/net/caif/caif_serial.c index 73c7e03617ec..3df0c0f8b8bf 100644 --- a/drivers/net/caif/caif_serial.c +++ b/drivers/net/caif/caif_serial.c | |||
@@ -167,8 +167,8 @@ static inline void debugfs_tx(struct ser_device *ser, const u8 *data, int size) | |||
167 | 167 | ||
168 | #endif | 168 | #endif |
169 | 169 | ||
170 | static unsigned int ldisc_receive(struct tty_struct *tty, | 170 | static void ldisc_receive(struct tty_struct *tty, const u8 *data, |
171 | const u8 *data, char *flags, int count) | 171 | char *flags, int count) |
172 | { | 172 | { |
173 | struct sk_buff *skb = NULL; | 173 | struct sk_buff *skb = NULL; |
174 | struct ser_device *ser; | 174 | struct ser_device *ser; |
@@ -215,8 +215,6 @@ static unsigned int ldisc_receive(struct tty_struct *tty, | |||
215 | } else | 215 | } else |
216 | ++ser->dev->stats.rx_dropped; | 216 | ++ser->dev->stats.rx_dropped; |
217 | update_tty_status(ser); | 217 | update_tty_status(ser); |
218 | |||
219 | return count; | ||
220 | } | 218 | } |
221 | 219 | ||
222 | static int handle_tx(struct ser_device *ser) | 220 | static int handle_tx(struct ser_device *ser) |
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c index d4990568baee..17678117ed69 100644 --- a/drivers/net/can/flexcan.c +++ b/drivers/net/can/flexcan.c | |||
@@ -923,7 +923,7 @@ static int __devinit flexcan_probe(struct platform_device *pdev) | |||
923 | mem_size = resource_size(mem); | 923 | mem_size = resource_size(mem); |
924 | if (!request_mem_region(mem->start, mem_size, pdev->name)) { | 924 | if (!request_mem_region(mem->start, mem_size, pdev->name)) { |
925 | err = -EBUSY; | 925 | err = -EBUSY; |
926 | goto failed_req; | 926 | goto failed_get; |
927 | } | 927 | } |
928 | 928 | ||
929 | base = ioremap(mem->start, mem_size); | 929 | base = ioremap(mem->start, mem_size); |
@@ -977,9 +977,8 @@ static int __devinit flexcan_probe(struct platform_device *pdev) | |||
977 | iounmap(base); | 977 | iounmap(base); |
978 | failed_map: | 978 | failed_map: |
979 | release_mem_region(mem->start, mem_size); | 979 | release_mem_region(mem->start, mem_size); |
980 | failed_req: | ||
981 | clk_put(clk); | ||
982 | failed_get: | 980 | failed_get: |
981 | clk_put(clk); | ||
983 | failed_clock: | 982 | failed_clock: |
984 | return err; | 983 | return err; |
985 | } | 984 | } |
diff --git a/drivers/net/can/slcan.c b/drivers/net/can/slcan.c index 75622d54581f..1b49df6b2470 100644 --- a/drivers/net/can/slcan.c +++ b/drivers/net/can/slcan.c | |||
@@ -425,17 +425,16 @@ static void slc_setup(struct net_device *dev) | |||
425 | * in parallel | 425 | * in parallel |
426 | */ | 426 | */ |
427 | 427 | ||
428 | static unsigned int slcan_receive_buf(struct tty_struct *tty, | 428 | static void slcan_receive_buf(struct tty_struct *tty, |
429 | const unsigned char *cp, char *fp, int count) | 429 | const unsigned char *cp, char *fp, int count) |
430 | { | 430 | { |
431 | struct slcan *sl = (struct slcan *) tty->disc_data; | 431 | struct slcan *sl = (struct slcan *) tty->disc_data; |
432 | int bytes = count; | ||
433 | 432 | ||
434 | if (!sl || sl->magic != SLCAN_MAGIC || !netif_running(sl->dev)) | 433 | if (!sl || sl->magic != SLCAN_MAGIC || !netif_running(sl->dev)) |
435 | return -ENODEV; | 434 | return; |
436 | 435 | ||
437 | /* Read the characters out of the buffer */ | 436 | /* Read the characters out of the buffer */ |
438 | while (bytes--) { | 437 | while (count--) { |
439 | if (fp && *fp++) { | 438 | if (fp && *fp++) { |
440 | if (!test_and_set_bit(SLF_ERROR, &sl->flags)) | 439 | if (!test_and_set_bit(SLF_ERROR, &sl->flags)) |
441 | sl->dev->stats.rx_errors++; | 440 | sl->dev->stats.rx_errors++; |
@@ -444,8 +443,6 @@ static unsigned int slcan_receive_buf(struct tty_struct *tty, | |||
444 | } | 443 | } |
445 | slcan_unesc(sl, *cp++); | 444 | slcan_unesc(sl, *cp++); |
446 | } | 445 | } |
447 | |||
448 | return count; | ||
449 | } | 446 | } |
450 | 447 | ||
451 | /************************************ | 448 | /************************************ |
diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c index 29a4f06fbfcf..dcc4a170b0f3 100644 --- a/drivers/net/davinci_emac.c +++ b/drivers/net/davinci_emac.c | |||
@@ -1781,8 +1781,8 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev) | |||
1781 | ndev = alloc_etherdev(sizeof(struct emac_priv)); | 1781 | ndev = alloc_etherdev(sizeof(struct emac_priv)); |
1782 | if (!ndev) { | 1782 | if (!ndev) { |
1783 | dev_err(&pdev->dev, "error allocating net_device\n"); | 1783 | dev_err(&pdev->dev, "error allocating net_device\n"); |
1784 | clk_put(emac_clk); | 1784 | rc = -ENOMEM; |
1785 | return -ENOMEM; | 1785 | goto free_clk; |
1786 | } | 1786 | } |
1787 | 1787 | ||
1788 | platform_set_drvdata(pdev, ndev); | 1788 | platform_set_drvdata(pdev, ndev); |
@@ -1796,7 +1796,8 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev) | |||
1796 | pdata = pdev->dev.platform_data; | 1796 | pdata = pdev->dev.platform_data; |
1797 | if (!pdata) { | 1797 | if (!pdata) { |
1798 | dev_err(&pdev->dev, "no platform data\n"); | 1798 | dev_err(&pdev->dev, "no platform data\n"); |
1799 | return -ENODEV; | 1799 | rc = -ENODEV; |
1800 | goto probe_quit; | ||
1800 | } | 1801 | } |
1801 | 1802 | ||
1802 | /* MAC addr and PHY mask , RMII enable info from platform_data */ | 1803 | /* MAC addr and PHY mask , RMII enable info from platform_data */ |
@@ -1929,8 +1930,9 @@ no_dma: | |||
1929 | iounmap(priv->remap_addr); | 1930 | iounmap(priv->remap_addr); |
1930 | 1931 | ||
1931 | probe_quit: | 1932 | probe_quit: |
1932 | clk_put(emac_clk); | ||
1933 | free_netdev(ndev); | 1933 | free_netdev(ndev); |
1934 | free_clk: | ||
1935 | clk_put(emac_clk); | ||
1934 | return rc; | 1936 | return rc; |
1935 | } | 1937 | } |
1936 | 1938 | ||
diff --git a/drivers/net/dm9000.c b/drivers/net/dm9000.c index fbaff3584bd4..ee597e676ee5 100644 --- a/drivers/net/dm9000.c +++ b/drivers/net/dm9000.c | |||
@@ -1157,9 +1157,6 @@ dm9000_open(struct net_device *dev) | |||
1157 | 1157 | ||
1158 | irqflags |= IRQF_SHARED; | 1158 | irqflags |= IRQF_SHARED; |
1159 | 1159 | ||
1160 | if (request_irq(dev->irq, dm9000_interrupt, irqflags, dev->name, dev)) | ||
1161 | return -EAGAIN; | ||
1162 | |||
1163 | /* GPIO0 on pre-activate PHY, Reg 1F is not set by reset */ | 1160 | /* GPIO0 on pre-activate PHY, Reg 1F is not set by reset */ |
1164 | iow(db, DM9000_GPR, 0); /* REG_1F bit0 activate phyxcer */ | 1161 | iow(db, DM9000_GPR, 0); /* REG_1F bit0 activate phyxcer */ |
1165 | mdelay(1); /* delay needs by DM9000B */ | 1162 | mdelay(1); /* delay needs by DM9000B */ |
@@ -1168,6 +1165,9 @@ dm9000_open(struct net_device *dev) | |||
1168 | dm9000_reset(db); | 1165 | dm9000_reset(db); |
1169 | dm9000_init_dm9000(dev); | 1166 | dm9000_init_dm9000(dev); |
1170 | 1167 | ||
1168 | if (request_irq(dev->irq, dm9000_interrupt, irqflags, dev->name, dev)) | ||
1169 | return -EAGAIN; | ||
1170 | |||
1171 | /* Init driver variable */ | 1171 | /* Init driver variable */ |
1172 | db->dbug_cnt = 0; | 1172 | db->dbug_cnt = 0; |
1173 | 1173 | ||
diff --git a/drivers/net/hamradio/6pack.c b/drivers/net/hamradio/6pack.c index 992089639ea4..3e5d0b6b6516 100644 --- a/drivers/net/hamradio/6pack.c +++ b/drivers/net/hamradio/6pack.c | |||
@@ -456,7 +456,7 @@ out: | |||
456 | * a block of 6pack data has been received, which can now be decapsulated | 456 | * a block of 6pack data has been received, which can now be decapsulated |
457 | * and sent on to some IP layer for further processing. | 457 | * and sent on to some IP layer for further processing. |
458 | */ | 458 | */ |
459 | static unsigned int sixpack_receive_buf(struct tty_struct *tty, | 459 | static void sixpack_receive_buf(struct tty_struct *tty, |
460 | const unsigned char *cp, char *fp, int count) | 460 | const unsigned char *cp, char *fp, int count) |
461 | { | 461 | { |
462 | struct sixpack *sp; | 462 | struct sixpack *sp; |
@@ -464,11 +464,11 @@ static unsigned int sixpack_receive_buf(struct tty_struct *tty, | |||
464 | int count1; | 464 | int count1; |
465 | 465 | ||
466 | if (!count) | 466 | if (!count) |
467 | return 0; | 467 | return; |
468 | 468 | ||
469 | sp = sp_get(tty); | 469 | sp = sp_get(tty); |
470 | if (!sp) | 470 | if (!sp) |
471 | return -ENODEV; | 471 | return; |
472 | 472 | ||
473 | memcpy(buf, cp, count < sizeof(buf) ? count : sizeof(buf)); | 473 | memcpy(buf, cp, count < sizeof(buf) ? count : sizeof(buf)); |
474 | 474 | ||
@@ -487,8 +487,6 @@ static unsigned int sixpack_receive_buf(struct tty_struct *tty, | |||
487 | 487 | ||
488 | sp_put(sp); | 488 | sp_put(sp); |
489 | tty_unthrottle(tty); | 489 | tty_unthrottle(tty); |
490 | |||
491 | return count1; | ||
492 | } | 490 | } |
493 | 491 | ||
494 | /* | 492 | /* |
diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c index 0e4f23531140..4c628393c8b1 100644 --- a/drivers/net/hamradio/mkiss.c +++ b/drivers/net/hamradio/mkiss.c | |||
@@ -923,14 +923,13 @@ static long mkiss_compat_ioctl(struct tty_struct *tty, struct file *file, | |||
923 | * a block of data has been received, which can now be decapsulated | 923 | * a block of data has been received, which can now be decapsulated |
924 | * and sent on to the AX.25 layer for further processing. | 924 | * and sent on to the AX.25 layer for further processing. |
925 | */ | 925 | */ |
926 | static unsigned int mkiss_receive_buf(struct tty_struct *tty, | 926 | static void mkiss_receive_buf(struct tty_struct *tty, const unsigned char *cp, |
927 | const unsigned char *cp, char *fp, int count) | 927 | char *fp, int count) |
928 | { | 928 | { |
929 | struct mkiss *ax = mkiss_get(tty); | 929 | struct mkiss *ax = mkiss_get(tty); |
930 | int bytes = count; | ||
931 | 930 | ||
932 | if (!ax) | 931 | if (!ax) |
933 | return -ENODEV; | 932 | return; |
934 | 933 | ||
935 | /* | 934 | /* |
936 | * Argh! mtu change time! - costs us the packet part received | 935 | * Argh! mtu change time! - costs us the packet part received |
@@ -940,7 +939,7 @@ static unsigned int mkiss_receive_buf(struct tty_struct *tty, | |||
940 | ax_changedmtu(ax); | 939 | ax_changedmtu(ax); |
941 | 940 | ||
942 | /* Read the characters out of the buffer */ | 941 | /* Read the characters out of the buffer */ |
943 | while (bytes--) { | 942 | while (count--) { |
944 | if (fp != NULL && *fp++) { | 943 | if (fp != NULL && *fp++) { |
945 | if (!test_and_set_bit(AXF_ERROR, &ax->flags)) | 944 | if (!test_and_set_bit(AXF_ERROR, &ax->flags)) |
946 | ax->dev->stats.rx_errors++; | 945 | ax->dev->stats.rx_errors++; |
@@ -953,8 +952,6 @@ static unsigned int mkiss_receive_buf(struct tty_struct *tty, | |||
953 | 952 | ||
954 | mkiss_put(ax); | 953 | mkiss_put(ax); |
955 | tty_unthrottle(tty); | 954 | tty_unthrottle(tty); |
956 | |||
957 | return count; | ||
958 | } | 955 | } |
959 | 956 | ||
960 | /* | 957 | /* |
diff --git a/drivers/net/irda/irtty-sir.c b/drivers/net/irda/irtty-sir.c index 035861d8acb1..3352b2443e58 100644 --- a/drivers/net/irda/irtty-sir.c +++ b/drivers/net/irda/irtty-sir.c | |||
@@ -216,23 +216,23 @@ static int irtty_do_write(struct sir_dev *dev, const unsigned char *ptr, size_t | |||
216 | * usbserial: urb-complete-interrupt / softint | 216 | * usbserial: urb-complete-interrupt / softint |
217 | */ | 217 | */ |
218 | 218 | ||
219 | static unsigned int irtty_receive_buf(struct tty_struct *tty, | 219 | static void irtty_receive_buf(struct tty_struct *tty, const unsigned char *cp, |
220 | const unsigned char *cp, char *fp, int count) | 220 | char *fp, int count) |
221 | { | 221 | { |
222 | struct sir_dev *dev; | 222 | struct sir_dev *dev; |
223 | struct sirtty_cb *priv = tty->disc_data; | 223 | struct sirtty_cb *priv = tty->disc_data; |
224 | int i; | 224 | int i; |
225 | 225 | ||
226 | IRDA_ASSERT(priv != NULL, return -ENODEV;); | 226 | IRDA_ASSERT(priv != NULL, return;); |
227 | IRDA_ASSERT(priv->magic == IRTTY_MAGIC, return -EINVAL;); | 227 | IRDA_ASSERT(priv->magic == IRTTY_MAGIC, return;); |
228 | 228 | ||
229 | if (unlikely(count==0)) /* yes, this happens */ | 229 | if (unlikely(count==0)) /* yes, this happens */ |
230 | return 0; | 230 | return; |
231 | 231 | ||
232 | dev = priv->dev; | 232 | dev = priv->dev; |
233 | if (!dev) { | 233 | if (!dev) { |
234 | IRDA_WARNING("%s(), not ready yet!\n", __func__); | 234 | IRDA_WARNING("%s(), not ready yet!\n", __func__); |
235 | return -ENODEV; | 235 | return; |
236 | } | 236 | } |
237 | 237 | ||
238 | for (i = 0; i < count; i++) { | 238 | for (i = 0; i < count; i++) { |
@@ -242,13 +242,11 @@ static unsigned int irtty_receive_buf(struct tty_struct *tty, | |||
242 | if (fp && *fp++) { | 242 | if (fp && *fp++) { |
243 | IRDA_DEBUG(0, "Framing or parity error!\n"); | 243 | IRDA_DEBUG(0, "Framing or parity error!\n"); |
244 | sirdev_receive(dev, NULL, 0); /* notify sir_dev (updating stats) */ | 244 | sirdev_receive(dev, NULL, 0); /* notify sir_dev (updating stats) */ |
245 | return -EINVAL; | 245 | return; |
246 | } | 246 | } |
247 | } | 247 | } |
248 | 248 | ||
249 | sirdev_receive(dev, cp, count); | 249 | sirdev_receive(dev, cp, count); |
250 | |||
251 | return count; | ||
252 | } | 250 | } |
253 | 251 | ||
254 | /* | 252 | /* |
diff --git a/drivers/net/ppp_async.c b/drivers/net/ppp_async.c index 53872d7d7382..a1b82c9c67d2 100644 --- a/drivers/net/ppp_async.c +++ b/drivers/net/ppp_async.c | |||
@@ -340,7 +340,7 @@ ppp_asynctty_poll(struct tty_struct *tty, struct file *file, poll_table *wait) | |||
340 | } | 340 | } |
341 | 341 | ||
342 | /* May sleep, don't call from interrupt level or with interrupts disabled */ | 342 | /* May sleep, don't call from interrupt level or with interrupts disabled */ |
343 | static unsigned int | 343 | static void |
344 | ppp_asynctty_receive(struct tty_struct *tty, const unsigned char *buf, | 344 | ppp_asynctty_receive(struct tty_struct *tty, const unsigned char *buf, |
345 | char *cflags, int count) | 345 | char *cflags, int count) |
346 | { | 346 | { |
@@ -348,7 +348,7 @@ ppp_asynctty_receive(struct tty_struct *tty, const unsigned char *buf, | |||
348 | unsigned long flags; | 348 | unsigned long flags; |
349 | 349 | ||
350 | if (!ap) | 350 | if (!ap) |
351 | return -ENODEV; | 351 | return; |
352 | spin_lock_irqsave(&ap->recv_lock, flags); | 352 | spin_lock_irqsave(&ap->recv_lock, flags); |
353 | ppp_async_input(ap, buf, cflags, count); | 353 | ppp_async_input(ap, buf, cflags, count); |
354 | spin_unlock_irqrestore(&ap->recv_lock, flags); | 354 | spin_unlock_irqrestore(&ap->recv_lock, flags); |
@@ -356,8 +356,6 @@ ppp_asynctty_receive(struct tty_struct *tty, const unsigned char *buf, | |||
356 | tasklet_schedule(&ap->tsk); | 356 | tasklet_schedule(&ap->tsk); |
357 | ap_put(ap); | 357 | ap_put(ap); |
358 | tty_unthrottle(tty); | 358 | tty_unthrottle(tty); |
359 | |||
360 | return count; | ||
361 | } | 359 | } |
362 | 360 | ||
363 | static void | 361 | static void |
diff --git a/drivers/net/ppp_synctty.c b/drivers/net/ppp_synctty.c index 0815790a5cf9..2573f525f11c 100644 --- a/drivers/net/ppp_synctty.c +++ b/drivers/net/ppp_synctty.c | |||
@@ -381,7 +381,7 @@ ppp_sync_poll(struct tty_struct *tty, struct file *file, poll_table *wait) | |||
381 | } | 381 | } |
382 | 382 | ||
383 | /* May sleep, don't call from interrupt level or with interrupts disabled */ | 383 | /* May sleep, don't call from interrupt level or with interrupts disabled */ |
384 | static unsigned int | 384 | static void |
385 | ppp_sync_receive(struct tty_struct *tty, const unsigned char *buf, | 385 | ppp_sync_receive(struct tty_struct *tty, const unsigned char *buf, |
386 | char *cflags, int count) | 386 | char *cflags, int count) |
387 | { | 387 | { |
@@ -389,7 +389,7 @@ ppp_sync_receive(struct tty_struct *tty, const unsigned char *buf, | |||
389 | unsigned long flags; | 389 | unsigned long flags; |
390 | 390 | ||
391 | if (!ap) | 391 | if (!ap) |
392 | return -ENODEV; | 392 | return; |
393 | spin_lock_irqsave(&ap->recv_lock, flags); | 393 | spin_lock_irqsave(&ap->recv_lock, flags); |
394 | ppp_sync_input(ap, buf, cflags, count); | 394 | ppp_sync_input(ap, buf, cflags, count); |
395 | spin_unlock_irqrestore(&ap->recv_lock, flags); | 395 | spin_unlock_irqrestore(&ap->recv_lock, flags); |
@@ -397,8 +397,6 @@ ppp_sync_receive(struct tty_struct *tty, const unsigned char *buf, | |||
397 | tasklet_schedule(&ap->tsk); | 397 | tasklet_schedule(&ap->tsk); |
398 | sp_put(ap); | 398 | sp_put(ap); |
399 | tty_unthrottle(tty); | 399 | tty_unthrottle(tty); |
400 | |||
401 | return count; | ||
402 | } | 400 | } |
403 | 401 | ||
404 | static void | 402 | static void |
diff --git a/drivers/net/slip.c b/drivers/net/slip.c index 584809c656d5..8ec1a9a0bb9a 100644 --- a/drivers/net/slip.c +++ b/drivers/net/slip.c | |||
@@ -670,17 +670,16 @@ static void sl_setup(struct net_device *dev) | |||
670 | * in parallel | 670 | * in parallel |
671 | */ | 671 | */ |
672 | 672 | ||
673 | static unsigned int slip_receive_buf(struct tty_struct *tty, | 673 | static void slip_receive_buf(struct tty_struct *tty, const unsigned char *cp, |
674 | const unsigned char *cp, char *fp, int count) | 674 | char *fp, int count) |
675 | { | 675 | { |
676 | struct slip *sl = tty->disc_data; | 676 | struct slip *sl = tty->disc_data; |
677 | int bytes = count; | ||
678 | 677 | ||
679 | if (!sl || sl->magic != SLIP_MAGIC || !netif_running(sl->dev)) | 678 | if (!sl || sl->magic != SLIP_MAGIC || !netif_running(sl->dev)) |
680 | return -ENODEV; | 679 | return; |
681 | 680 | ||
682 | /* Read the characters out of the buffer */ | 681 | /* Read the characters out of the buffer */ |
683 | while (bytes--) { | 682 | while (count--) { |
684 | if (fp && *fp++) { | 683 | if (fp && *fp++) { |
685 | if (!test_and_set_bit(SLF_ERROR, &sl->flags)) | 684 | if (!test_and_set_bit(SLF_ERROR, &sl->flags)) |
686 | sl->dev->stats.rx_errors++; | 685 | sl->dev->stats.rx_errors++; |
@@ -694,8 +693,6 @@ static unsigned int slip_receive_buf(struct tty_struct *tty, | |||
694 | #endif | 693 | #endif |
695 | slip_unesc(sl, *cp++); | 694 | slip_unesc(sl, *cp++); |
696 | } | 695 | } |
697 | |||
698 | return count; | ||
699 | } | 696 | } |
700 | 697 | ||
701 | /************************************ | 698 | /************************************ |
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index f4b01c638a33..a1f9f9eef37d 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -5774,7 +5774,7 @@ static void tg3_skb_error_unmap(struct tg3_napi *tnapi, | |||
5774 | dma_unmap_addr(txb, mapping), | 5774 | dma_unmap_addr(txb, mapping), |
5775 | skb_headlen(skb), | 5775 | skb_headlen(skb), |
5776 | PCI_DMA_TODEVICE); | 5776 | PCI_DMA_TODEVICE); |
5777 | for (i = 0; i <= last; i++) { | 5777 | for (i = 0; i < last; i++) { |
5778 | skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; | 5778 | skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; |
5779 | 5779 | ||
5780 | entry = NEXT_TX(entry); | 5780 | entry = NEXT_TX(entry); |
diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c index cdd3ae486109..f33ca6aa29e9 100644 --- a/drivers/net/usb/cdc_ncm.c +++ b/drivers/net/usb/cdc_ncm.c | |||
@@ -54,7 +54,7 @@ | |||
54 | #include <linux/usb/usbnet.h> | 54 | #include <linux/usb/usbnet.h> |
55 | #include <linux/usb/cdc.h> | 55 | #include <linux/usb/cdc.h> |
56 | 56 | ||
57 | #define DRIVER_VERSION "24-May-2011" | 57 | #define DRIVER_VERSION "01-June-2011" |
58 | 58 | ||
59 | /* CDC NCM subclass 3.2.1 */ | 59 | /* CDC NCM subclass 3.2.1 */ |
60 | #define USB_CDC_NCM_NDP16_LENGTH_MIN 0x10 | 60 | #define USB_CDC_NCM_NDP16_LENGTH_MIN 0x10 |
@@ -1234,6 +1234,7 @@ static struct usb_driver cdc_ncm_driver = { | |||
1234 | .disconnect = cdc_ncm_disconnect, | 1234 | .disconnect = cdc_ncm_disconnect, |
1235 | .suspend = usbnet_suspend, | 1235 | .suspend = usbnet_suspend, |
1236 | .resume = usbnet_resume, | 1236 | .resume = usbnet_resume, |
1237 | .reset_resume = usbnet_resume, | ||
1237 | .supports_autosuspend = 1, | 1238 | .supports_autosuspend = 1, |
1238 | }; | 1239 | }; |
1239 | 1240 | ||
diff --git a/drivers/net/wan/x25_asy.c b/drivers/net/wan/x25_asy.c index 40398bf7d036..24297b274cd4 100644 --- a/drivers/net/wan/x25_asy.c +++ b/drivers/net/wan/x25_asy.c | |||
@@ -517,18 +517,17 @@ static int x25_asy_close(struct net_device *dev) | |||
517 | * and sent on to some IP layer for further processing. | 517 | * and sent on to some IP layer for further processing. |
518 | */ | 518 | */ |
519 | 519 | ||
520 | static unsigned int x25_asy_receive_buf(struct tty_struct *tty, | 520 | static void x25_asy_receive_buf(struct tty_struct *tty, |
521 | const unsigned char *cp, char *fp, int count) | 521 | const unsigned char *cp, char *fp, int count) |
522 | { | 522 | { |
523 | struct x25_asy *sl = tty->disc_data; | 523 | struct x25_asy *sl = tty->disc_data; |
524 | int bytes = count; | ||
525 | 524 | ||
526 | if (!sl || sl->magic != X25_ASY_MAGIC || !netif_running(sl->dev)) | 525 | if (!sl || sl->magic != X25_ASY_MAGIC || !netif_running(sl->dev)) |
527 | return; | 526 | return; |
528 | 527 | ||
529 | 528 | ||
530 | /* Read the characters out of the buffer */ | 529 | /* Read the characters out of the buffer */ |
531 | while (bytes--) { | 530 | while (count--) { |
532 | if (fp && *fp++) { | 531 | if (fp && *fp++) { |
533 | if (!test_and_set_bit(SLF_ERROR, &sl->flags)) | 532 | if (!test_and_set_bit(SLF_ERROR, &sl->flags)) |
534 | sl->dev->stats.rx_errors++; | 533 | sl->dev->stats.rx_errors++; |
@@ -537,8 +536,6 @@ static unsigned int x25_asy_receive_buf(struct tty_struct *tty, | |||
537 | } | 536 | } |
538 | x25_asy_unesc(sl, *cp++); | 537 | x25_asy_unesc(sl, *cp++); |
539 | } | 538 | } |
540 | |||
541 | return count; | ||
542 | } | 539 | } |
543 | 540 | ||
544 | /* | 541 | /* |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c index 0ca7635d0669..ff8150e46f0e 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | |||
@@ -4645,10 +4645,16 @@ static void ar9003_hw_set_power_per_rate_table(struct ath_hw *ah, | |||
4645 | case 1: | 4645 | case 1: |
4646 | break; | 4646 | break; |
4647 | case 2: | 4647 | case 2: |
4648 | scaledPower -= REDUCE_SCALED_POWER_BY_TWO_CHAIN; | 4648 | if (scaledPower > REDUCE_SCALED_POWER_BY_TWO_CHAIN) |
4649 | scaledPower -= REDUCE_SCALED_POWER_BY_TWO_CHAIN; | ||
4650 | else | ||
4651 | scaledPower = 0; | ||
4649 | break; | 4652 | break; |
4650 | case 3: | 4653 | case 3: |
4651 | scaledPower -= REDUCE_SCALED_POWER_BY_THREE_CHAIN; | 4654 | if (scaledPower > REDUCE_SCALED_POWER_BY_THREE_CHAIN) |
4655 | scaledPower -= REDUCE_SCALED_POWER_BY_THREE_CHAIN; | ||
4656 | else | ||
4657 | scaledPower = 0; | ||
4652 | break; | 4658 | break; |
4653 | } | 4659 | } |
4654 | 4660 | ||
diff --git a/drivers/net/wireless/ath/ath9k/eeprom_9287.c b/drivers/net/wireless/ath/ath9k/eeprom_9287.c index 7856f0d4512d..343fc9f946db 100644 --- a/drivers/net/wireless/ath/ath9k/eeprom_9287.c +++ b/drivers/net/wireless/ath/ath9k/eeprom_9287.c | |||
@@ -524,10 +524,16 @@ static void ath9k_hw_set_ar9287_power_per_rate_table(struct ath_hw *ah, | |||
524 | case 1: | 524 | case 1: |
525 | break; | 525 | break; |
526 | case 2: | 526 | case 2: |
527 | scaledPower -= REDUCE_SCALED_POWER_BY_TWO_CHAIN; | 527 | if (scaledPower > REDUCE_SCALED_POWER_BY_TWO_CHAIN) |
528 | scaledPower -= REDUCE_SCALED_POWER_BY_TWO_CHAIN; | ||
529 | else | ||
530 | scaledPower = 0; | ||
528 | break; | 531 | break; |
529 | case 3: | 532 | case 3: |
530 | scaledPower -= REDUCE_SCALED_POWER_BY_THREE_CHAIN; | 533 | if (scaledPower > REDUCE_SCALED_POWER_BY_THREE_CHAIN) |
534 | scaledPower -= REDUCE_SCALED_POWER_BY_THREE_CHAIN; | ||
535 | else | ||
536 | scaledPower = 0; | ||
531 | break; | 537 | break; |
532 | } | 538 | } |
533 | scaledPower = max((u16)0, scaledPower); | 539 | scaledPower = max((u16)0, scaledPower); |
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965.c b/drivers/net/wireless/iwlegacy/iwl-4965.c index f5433c74b845..f9db25bb35c3 100644 --- a/drivers/net/wireless/iwlegacy/iwl-4965.c +++ b/drivers/net/wireless/iwlegacy/iwl-4965.c | |||
@@ -1543,7 +1543,7 @@ static void iwl4965_temperature_calib(struct iwl_priv *priv) | |||
1543 | s32 temp; | 1543 | s32 temp; |
1544 | 1544 | ||
1545 | temp = iwl4965_hw_get_temperature(priv); | 1545 | temp = iwl4965_hw_get_temperature(priv); |
1546 | if (temp < 0) | 1546 | if (IWL_TX_POWER_TEMPERATURE_OUT_OF_RANGE(temp)) |
1547 | return; | 1547 | return; |
1548 | 1548 | ||
1549 | if (priv->temperature != temp) { | 1549 | if (priv->temperature != temp) { |
diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c index f8c710db6e6f..fda6fe08cf91 100644 --- a/drivers/net/wireless/iwlwifi/iwl-6000.c +++ b/drivers/net/wireless/iwlwifi/iwl-6000.c | |||
@@ -603,19 +603,27 @@ struct iwl_cfg iwl6050_2abg_cfg = { | |||
603 | IWL_DEVICE_6050, | 603 | IWL_DEVICE_6050, |
604 | }; | 604 | }; |
605 | 605 | ||
606 | #define IWL_DEVICE_6150 \ | ||
607 | .fw_name_pre = IWL6050_FW_PRE, \ | ||
608 | .ucode_api_max = IWL6050_UCODE_API_MAX, \ | ||
609 | .ucode_api_min = IWL6050_UCODE_API_MIN, \ | ||
610 | .ops = &iwl6150_ops, \ | ||
611 | .eeprom_ver = EEPROM_6150_EEPROM_VERSION, \ | ||
612 | .eeprom_calib_ver = EEPROM_6150_TX_POWER_VERSION, \ | ||
613 | .base_params = &iwl6050_base_params, \ | ||
614 | .need_dc_calib = true, \ | ||
615 | .led_mode = IWL_LED_BLINK, \ | ||
616 | .internal_wimax_coex = true | ||
617 | |||
606 | struct iwl_cfg iwl6150_bgn_cfg = { | 618 | struct iwl_cfg iwl6150_bgn_cfg = { |
607 | .name = "Intel(R) Centrino(R) Wireless-N + WiMAX 6150 BGN", | 619 | .name = "Intel(R) Centrino(R) Wireless-N + WiMAX 6150 BGN", |
608 | .fw_name_pre = IWL6050_FW_PRE, | 620 | IWL_DEVICE_6150, |
609 | .ucode_api_max = IWL6050_UCODE_API_MAX, | ||
610 | .ucode_api_min = IWL6050_UCODE_API_MIN, | ||
611 | .eeprom_ver = EEPROM_6150_EEPROM_VERSION, | ||
612 | .eeprom_calib_ver = EEPROM_6150_TX_POWER_VERSION, | ||
613 | .ops = &iwl6150_ops, | ||
614 | .base_params = &iwl6050_base_params, | ||
615 | .ht_params = &iwl6000_ht_params, | 621 | .ht_params = &iwl6000_ht_params, |
616 | .need_dc_calib = true, | 622 | }; |
617 | .led_mode = IWL_LED_RF_STATE, | 623 | |
618 | .internal_wimax_coex = true, | 624 | struct iwl_cfg iwl6150_bg_cfg = { |
625 | .name = "Intel(R) Centrino(R) Wireless-N + WiMAX 6150 BG", | ||
626 | IWL_DEVICE_6150, | ||
619 | }; | 627 | }; |
620 | 628 | ||
621 | struct iwl_cfg iwl6000_3agn_cfg = { | 629 | struct iwl_cfg iwl6000_3agn_cfg = { |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index 11c6c1169e78..a662adcb2adb 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c | |||
@@ -3831,11 +3831,11 @@ static DEFINE_PCI_DEVICE_TABLE(iwl_hw_card_ids) = { | |||
3831 | 3831 | ||
3832 | /* 6150 WiFi/WiMax Series */ | 3832 | /* 6150 WiFi/WiMax Series */ |
3833 | {IWL_PCI_DEVICE(0x0885, 0x1305, iwl6150_bgn_cfg)}, | 3833 | {IWL_PCI_DEVICE(0x0885, 0x1305, iwl6150_bgn_cfg)}, |
3834 | {IWL_PCI_DEVICE(0x0885, 0x1306, iwl6150_bgn_cfg)}, | 3834 | {IWL_PCI_DEVICE(0x0885, 0x1307, iwl6150_bg_cfg)}, |
3835 | {IWL_PCI_DEVICE(0x0885, 0x1325, iwl6150_bgn_cfg)}, | 3835 | {IWL_PCI_DEVICE(0x0885, 0x1325, iwl6150_bgn_cfg)}, |
3836 | {IWL_PCI_DEVICE(0x0885, 0x1326, iwl6150_bgn_cfg)}, | 3836 | {IWL_PCI_DEVICE(0x0885, 0x1327, iwl6150_bg_cfg)}, |
3837 | {IWL_PCI_DEVICE(0x0886, 0x1315, iwl6150_bgn_cfg)}, | 3837 | {IWL_PCI_DEVICE(0x0886, 0x1315, iwl6150_bgn_cfg)}, |
3838 | {IWL_PCI_DEVICE(0x0886, 0x1316, iwl6150_bgn_cfg)}, | 3838 | {IWL_PCI_DEVICE(0x0886, 0x1317, iwl6150_bg_cfg)}, |
3839 | 3839 | ||
3840 | /* 1000 Series WiFi */ | 3840 | /* 1000 Series WiFi */ |
3841 | {IWL_PCI_DEVICE(0x0083, 0x1205, iwl1000_bgn_cfg)}, | 3841 | {IWL_PCI_DEVICE(0x0083, 0x1205, iwl1000_bgn_cfg)}, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.h b/drivers/net/wireless/iwlwifi/iwl-agn.h index 2495fe7a58cb..d1716844002e 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.h +++ b/drivers/net/wireless/iwlwifi/iwl-agn.h | |||
@@ -89,6 +89,7 @@ extern struct iwl_cfg iwl6000_3agn_cfg; | |||
89 | extern struct iwl_cfg iwl6050_2agn_cfg; | 89 | extern struct iwl_cfg iwl6050_2agn_cfg; |
90 | extern struct iwl_cfg iwl6050_2abg_cfg; | 90 | extern struct iwl_cfg iwl6050_2abg_cfg; |
91 | extern struct iwl_cfg iwl6150_bgn_cfg; | 91 | extern struct iwl_cfg iwl6150_bgn_cfg; |
92 | extern struct iwl_cfg iwl6150_bg_cfg; | ||
92 | extern struct iwl_cfg iwl1000_bgn_cfg; | 93 | extern struct iwl_cfg iwl1000_bgn_cfg; |
93 | extern struct iwl_cfg iwl1000_bg_cfg; | 94 | extern struct iwl_cfg iwl1000_bg_cfg; |
94 | extern struct iwl_cfg iwl100_bgn_cfg; | 95 | extern struct iwl_cfg iwl100_bgn_cfg; |
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index 84566db486d2..71c8f3fccfa1 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c | |||
@@ -994,6 +994,8 @@ static void lbs_submit_command(struct lbs_private *priv, | |||
994 | cmd = cmdnode->cmdbuf; | 994 | cmd = cmdnode->cmdbuf; |
995 | 995 | ||
996 | spin_lock_irqsave(&priv->driver_lock, flags); | 996 | spin_lock_irqsave(&priv->driver_lock, flags); |
997 | priv->seqnum++; | ||
998 | cmd->seqnum = cpu_to_le16(priv->seqnum); | ||
997 | priv->cur_cmd = cmdnode; | 999 | priv->cur_cmd = cmdnode; |
998 | spin_unlock_irqrestore(&priv->driver_lock, flags); | 1000 | spin_unlock_irqrestore(&priv->driver_lock, flags); |
999 | 1001 | ||
@@ -1621,11 +1623,9 @@ struct cmd_ctrl_node *__lbs_cmd_async(struct lbs_private *priv, | |||
1621 | /* Copy the incoming command to the buffer */ | 1623 | /* Copy the incoming command to the buffer */ |
1622 | memcpy(cmdnode->cmdbuf, in_cmd, in_cmd_size); | 1624 | memcpy(cmdnode->cmdbuf, in_cmd, in_cmd_size); |
1623 | 1625 | ||
1624 | /* Set sequence number, clean result, move to buffer */ | 1626 | /* Set command, clean result, move to buffer */ |
1625 | priv->seqnum++; | ||
1626 | cmdnode->cmdbuf->command = cpu_to_le16(command); | 1627 | cmdnode->cmdbuf->command = cpu_to_le16(command); |
1627 | cmdnode->cmdbuf->size = cpu_to_le16(in_cmd_size); | 1628 | cmdnode->cmdbuf->size = cpu_to_le16(in_cmd_size); |
1628 | cmdnode->cmdbuf->seqnum = cpu_to_le16(priv->seqnum); | ||
1629 | cmdnode->cmdbuf->result = 0; | 1629 | cmdnode->cmdbuf->result = 0; |
1630 | 1630 | ||
1631 | lbs_deb_host("PREP_CMD: command 0x%04x\n", command); | 1631 | lbs_deb_host("PREP_CMD: command 0x%04x\n", command); |
diff --git a/drivers/net/wireless/wl12xx/conf.h b/drivers/net/wireless/wl12xx/conf.h index 1ab6c86aac40..c83fefb6662f 100644 --- a/drivers/net/wireless/wl12xx/conf.h +++ b/drivers/net/wireless/wl12xx/conf.h | |||
@@ -1157,6 +1157,9 @@ struct conf_sched_scan_settings { | |||
1157 | /* time to wait on the channel for passive scans (in TUs) */ | 1157 | /* time to wait on the channel for passive scans (in TUs) */ |
1158 | u32 dwell_time_passive; | 1158 | u32 dwell_time_passive; |
1159 | 1159 | ||
1160 | /* time to wait on the channel for DFS scans (in TUs) */ | ||
1161 | u32 dwell_time_dfs; | ||
1162 | |||
1160 | /* number of probe requests to send on each channel in active scans */ | 1163 | /* number of probe requests to send on each channel in active scans */ |
1161 | u8 num_probe_reqs; | 1164 | u8 num_probe_reqs; |
1162 | 1165 | ||
diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c index bc00e52f6445..e6497dc669df 100644 --- a/drivers/net/wireless/wl12xx/main.c +++ b/drivers/net/wireless/wl12xx/main.c | |||
@@ -311,6 +311,7 @@ static struct conf_drv_settings default_conf = { | |||
311 | .min_dwell_time_active = 8, | 311 | .min_dwell_time_active = 8, |
312 | .max_dwell_time_active = 30, | 312 | .max_dwell_time_active = 30, |
313 | .dwell_time_passive = 100, | 313 | .dwell_time_passive = 100, |
314 | .dwell_time_dfs = 150, | ||
314 | .num_probe_reqs = 2, | 315 | .num_probe_reqs = 2, |
315 | .rssi_threshold = -90, | 316 | .rssi_threshold = -90, |
316 | .snr_threshold = 0, | 317 | .snr_threshold = 0, |
diff --git a/drivers/net/wireless/wl12xx/scan.c b/drivers/net/wireless/wl12xx/scan.c index f37e5a391976..56f76abc754d 100644 --- a/drivers/net/wireless/wl12xx/scan.c +++ b/drivers/net/wireless/wl12xx/scan.c | |||
@@ -331,16 +331,22 @@ wl1271_scan_get_sched_scan_channels(struct wl1271 *wl, | |||
331 | struct conf_sched_scan_settings *c = &wl->conf.sched_scan; | 331 | struct conf_sched_scan_settings *c = &wl->conf.sched_scan; |
332 | int i, j; | 332 | int i, j; |
333 | u32 flags; | 333 | u32 flags; |
334 | bool force_passive = !req->n_ssids; | ||
334 | 335 | ||
335 | for (i = 0, j = start; | 336 | for (i = 0, j = start; |
336 | i < req->n_channels && j < MAX_CHANNELS_ALL_BANDS; | 337 | i < req->n_channels && j < MAX_CHANNELS_ALL_BANDS; |
337 | i++) { | 338 | i++) { |
338 | flags = req->channels[i]->flags; | 339 | flags = req->channels[i]->flags; |
339 | 340 | ||
340 | if (!(flags & IEEE80211_CHAN_DISABLED) && | 341 | if (force_passive) |
341 | ((flags & IEEE80211_CHAN_PASSIVE_SCAN) == passive) && | 342 | flags |= IEEE80211_CHAN_PASSIVE_SCAN; |
342 | ((flags & IEEE80211_CHAN_RADAR) == radar) && | 343 | |
343 | (req->channels[i]->band == band)) { | 344 | if ((req->channels[i]->band == band) && |
345 | !(flags & IEEE80211_CHAN_DISABLED) && | ||
346 | (!!(flags & IEEE80211_CHAN_RADAR) == radar) && | ||
347 | /* if radar is set, we ignore the passive flag */ | ||
348 | (radar || | ||
349 | !!(flags & IEEE80211_CHAN_PASSIVE_SCAN) == passive)) { | ||
344 | wl1271_debug(DEBUG_SCAN, "band %d, center_freq %d ", | 350 | wl1271_debug(DEBUG_SCAN, "band %d, center_freq %d ", |
345 | req->channels[i]->band, | 351 | req->channels[i]->band, |
346 | req->channels[i]->center_freq); | 352 | req->channels[i]->center_freq); |
@@ -350,7 +356,12 @@ wl1271_scan_get_sched_scan_channels(struct wl1271 *wl, | |||
350 | wl1271_debug(DEBUG_SCAN, "max_power %d", | 356 | wl1271_debug(DEBUG_SCAN, "max_power %d", |
351 | req->channels[i]->max_power); | 357 | req->channels[i]->max_power); |
352 | 358 | ||
353 | if (flags & IEEE80211_CHAN_PASSIVE_SCAN) { | 359 | if (flags & IEEE80211_CHAN_RADAR) { |
360 | channels[j].flags |= SCAN_CHANNEL_FLAGS_DFS; | ||
361 | channels[j].passive_duration = | ||
362 | cpu_to_le16(c->dwell_time_dfs); | ||
363 | } | ||
364 | else if (flags & IEEE80211_CHAN_PASSIVE_SCAN) { | ||
354 | channels[j].passive_duration = | 365 | channels[j].passive_duration = |
355 | cpu_to_le16(c->dwell_time_passive); | 366 | cpu_to_le16(c->dwell_time_passive); |
356 | } else { | 367 | } else { |
@@ -359,7 +370,7 @@ wl1271_scan_get_sched_scan_channels(struct wl1271 *wl, | |||
359 | channels[j].max_duration = | 370 | channels[j].max_duration = |
360 | cpu_to_le16(c->max_dwell_time_active); | 371 | cpu_to_le16(c->max_dwell_time_active); |
361 | } | 372 | } |
362 | channels[j].tx_power_att = req->channels[j]->max_power; | 373 | channels[j].tx_power_att = req->channels[i]->max_power; |
363 | channels[j].channel = req->channels[i]->hw_value; | 374 | channels[j].channel = req->channels[i]->hw_value; |
364 | 375 | ||
365 | j++; | 376 | j++; |
@@ -386,7 +397,11 @@ wl1271_scan_sched_scan_channels(struct wl1271 *wl, | |||
386 | wl1271_scan_get_sched_scan_channels(wl, req, cfg->channels, | 397 | wl1271_scan_get_sched_scan_channels(wl, req, cfg->channels, |
387 | IEEE80211_BAND_2GHZ, | 398 | IEEE80211_BAND_2GHZ, |
388 | false, false, idx); | 399 | false, false, idx); |
389 | idx += cfg->active[0]; | 400 | /* |
401 | * 5GHz channels always start at position 14, not immediately | ||
402 | * after the last 2.4GHz channel | ||
403 | */ | ||
404 | idx = 14; | ||
390 | 405 | ||
391 | cfg->passive[1] = | 406 | cfg->passive[1] = |
392 | wl1271_scan_get_sched_scan_channels(wl, req, cfg->channels, | 407 | wl1271_scan_get_sched_scan_channels(wl, req, cfg->channels, |
@@ -394,22 +409,23 @@ wl1271_scan_sched_scan_channels(struct wl1271 *wl, | |||
394 | false, true, idx); | 409 | false, true, idx); |
395 | idx += cfg->passive[1]; | 410 | idx += cfg->passive[1]; |
396 | 411 | ||
397 | cfg->active[1] = | 412 | cfg->dfs = |
398 | wl1271_scan_get_sched_scan_channels(wl, req, cfg->channels, | 413 | wl1271_scan_get_sched_scan_channels(wl, req, cfg->channels, |
399 | IEEE80211_BAND_5GHZ, | 414 | IEEE80211_BAND_5GHZ, |
400 | false, false, 14); | 415 | true, true, idx); |
401 | idx += cfg->active[1]; | 416 | idx += cfg->dfs; |
402 | 417 | ||
403 | cfg->dfs = | 418 | cfg->active[1] = |
404 | wl1271_scan_get_sched_scan_channels(wl, req, cfg->channels, | 419 | wl1271_scan_get_sched_scan_channels(wl, req, cfg->channels, |
405 | IEEE80211_BAND_5GHZ, | 420 | IEEE80211_BAND_5GHZ, |
406 | true, false, idx); | 421 | false, false, idx); |
407 | idx += cfg->dfs; | 422 | idx += cfg->active[1]; |
408 | 423 | ||
409 | wl1271_debug(DEBUG_SCAN, " 2.4GHz: active %d passive %d", | 424 | wl1271_debug(DEBUG_SCAN, " 2.4GHz: active %d passive %d", |
410 | cfg->active[0], cfg->passive[0]); | 425 | cfg->active[0], cfg->passive[0]); |
411 | wl1271_debug(DEBUG_SCAN, " 5GHz: active %d passive %d", | 426 | wl1271_debug(DEBUG_SCAN, " 5GHz: active %d passive %d", |
412 | cfg->active[1], cfg->passive[1]); | 427 | cfg->active[1], cfg->passive[1]); |
428 | wl1271_debug(DEBUG_SCAN, " DFS: %d", cfg->dfs); | ||
413 | 429 | ||
414 | return idx; | 430 | return idx; |
415 | } | 431 | } |
@@ -421,6 +437,7 @@ int wl1271_scan_sched_scan_config(struct wl1271 *wl, | |||
421 | struct wl1271_cmd_sched_scan_config *cfg = NULL; | 437 | struct wl1271_cmd_sched_scan_config *cfg = NULL; |
422 | struct conf_sched_scan_settings *c = &wl->conf.sched_scan; | 438 | struct conf_sched_scan_settings *c = &wl->conf.sched_scan; |
423 | int i, total_channels, ret; | 439 | int i, total_channels, ret; |
440 | bool force_passive = !req->n_ssids; | ||
424 | 441 | ||
425 | wl1271_debug(DEBUG_CMD, "cmd sched_scan scan config"); | 442 | wl1271_debug(DEBUG_CMD, "cmd sched_scan scan config"); |
426 | 443 | ||
@@ -444,7 +461,7 @@ int wl1271_scan_sched_scan_config(struct wl1271 *wl, | |||
444 | for (i = 0; i < SCAN_MAX_CYCLE_INTERVALS; i++) | 461 | for (i = 0; i < SCAN_MAX_CYCLE_INTERVALS; i++) |
445 | cfg->intervals[i] = cpu_to_le32(req->interval); | 462 | cfg->intervals[i] = cpu_to_le32(req->interval); |
446 | 463 | ||
447 | if (req->ssids[0].ssid_len && req->ssids[0].ssid) { | 464 | if (!force_passive && req->ssids[0].ssid_len && req->ssids[0].ssid) { |
448 | cfg->filter_type = SCAN_SSID_FILTER_SPECIFIC; | 465 | cfg->filter_type = SCAN_SSID_FILTER_SPECIFIC; |
449 | cfg->ssid_len = req->ssids[0].ssid_len; | 466 | cfg->ssid_len = req->ssids[0].ssid_len; |
450 | memcpy(cfg->ssid, req->ssids[0].ssid, | 467 | memcpy(cfg->ssid, req->ssids[0].ssid, |
@@ -461,7 +478,7 @@ int wl1271_scan_sched_scan_config(struct wl1271 *wl, | |||
461 | goto out; | 478 | goto out; |
462 | } | 479 | } |
463 | 480 | ||
464 | if (cfg->active[0]) { | 481 | if (!force_passive && cfg->active[0]) { |
465 | ret = wl1271_cmd_build_probe_req(wl, req->ssids[0].ssid, | 482 | ret = wl1271_cmd_build_probe_req(wl, req->ssids[0].ssid, |
466 | req->ssids[0].ssid_len, | 483 | req->ssids[0].ssid_len, |
467 | ies->ie[IEEE80211_BAND_2GHZ], | 484 | ies->ie[IEEE80211_BAND_2GHZ], |
@@ -473,7 +490,7 @@ int wl1271_scan_sched_scan_config(struct wl1271 *wl, | |||
473 | } | 490 | } |
474 | } | 491 | } |
475 | 492 | ||
476 | if (cfg->active[1]) { | 493 | if (!force_passive && cfg->active[1]) { |
477 | ret = wl1271_cmd_build_probe_req(wl, req->ssids[0].ssid, | 494 | ret = wl1271_cmd_build_probe_req(wl, req->ssids[0].ssid, |
478 | req->ssids[0].ssid_len, | 495 | req->ssids[0].ssid_len, |
479 | ies->ie[IEEE80211_BAND_5GHZ], | 496 | ies->ie[IEEE80211_BAND_5GHZ], |
diff --git a/drivers/net/wireless/wl12xx/scan.h b/drivers/net/wireless/wl12xx/scan.h index c83319579ca3..a0b6c5d67b07 100644 --- a/drivers/net/wireless/wl12xx/scan.h +++ b/drivers/net/wireless/wl12xx/scan.h | |||
@@ -137,6 +137,9 @@ enum { | |||
137 | SCAN_BSS_TYPE_ANY, | 137 | SCAN_BSS_TYPE_ANY, |
138 | }; | 138 | }; |
139 | 139 | ||
140 | #define SCAN_CHANNEL_FLAGS_DFS BIT(0) | ||
141 | #define SCAN_CHANNEL_FLAGS_DFS_ENABLED BIT(1) | ||
142 | |||
140 | struct conn_scan_ch_params { | 143 | struct conn_scan_ch_params { |
141 | __le16 min_duration; | 144 | __le16 min_duration; |
142 | __le16 max_duration; | 145 | __le16 max_duration; |
diff --git a/drivers/net/wireless/zd1211rw/zd_usb.c b/drivers/net/wireless/zd1211rw/zd_usb.c index 0e819943b9e4..631194d49828 100644 --- a/drivers/net/wireless/zd1211rw/zd_usb.c +++ b/drivers/net/wireless/zd1211rw/zd_usb.c | |||
@@ -1533,6 +1533,31 @@ static void __exit usb_exit(void) | |||
1533 | module_init(usb_init); | 1533 | module_init(usb_init); |
1534 | module_exit(usb_exit); | 1534 | module_exit(usb_exit); |
1535 | 1535 | ||
1536 | static int zd_ep_regs_out_msg(struct usb_device *udev, void *data, int len, | ||
1537 | int *actual_length, int timeout) | ||
1538 | { | ||
1539 | /* In USB 2.0 mode EP_REGS_OUT endpoint is interrupt type. However in | ||
1540 | * USB 1.1 mode endpoint is bulk. Select correct type URB by endpoint | ||
1541 | * descriptor. | ||
1542 | */ | ||
1543 | struct usb_host_endpoint *ep; | ||
1544 | unsigned int pipe; | ||
1545 | |||
1546 | pipe = usb_sndintpipe(udev, EP_REGS_OUT); | ||
1547 | ep = usb_pipe_endpoint(udev, pipe); | ||
1548 | if (!ep) | ||
1549 | return -EINVAL; | ||
1550 | |||
1551 | if (usb_endpoint_xfer_int(&ep->desc)) { | ||
1552 | return usb_interrupt_msg(udev, pipe, data, len, | ||
1553 | actual_length, timeout); | ||
1554 | } else { | ||
1555 | pipe = usb_sndbulkpipe(udev, EP_REGS_OUT); | ||
1556 | return usb_bulk_msg(udev, pipe, data, len, actual_length, | ||
1557 | timeout); | ||
1558 | } | ||
1559 | } | ||
1560 | |||
1536 | static int usb_int_regs_length(unsigned int count) | 1561 | static int usb_int_regs_length(unsigned int count) |
1537 | { | 1562 | { |
1538 | return sizeof(struct usb_int_regs) + count * sizeof(struct reg_data); | 1563 | return sizeof(struct usb_int_regs) + count * sizeof(struct reg_data); |
@@ -1648,15 +1673,14 @@ int zd_usb_ioread16v(struct zd_usb *usb, u16 *values, | |||
1648 | 1673 | ||
1649 | udev = zd_usb_to_usbdev(usb); | 1674 | udev = zd_usb_to_usbdev(usb); |
1650 | prepare_read_regs_int(usb); | 1675 | prepare_read_regs_int(usb); |
1651 | r = usb_interrupt_msg(udev, usb_sndintpipe(udev, EP_REGS_OUT), | 1676 | r = zd_ep_regs_out_msg(udev, req, req_len, &actual_req_len, 50 /*ms*/); |
1652 | req, req_len, &actual_req_len, 50 /* ms */); | ||
1653 | if (r) { | 1677 | if (r) { |
1654 | dev_dbg_f(zd_usb_dev(usb), | 1678 | dev_dbg_f(zd_usb_dev(usb), |
1655 | "error in usb_interrupt_msg(). Error number %d\n", r); | 1679 | "error in zd_ep_regs_out_msg(). Error number %d\n", r); |
1656 | goto error; | 1680 | goto error; |
1657 | } | 1681 | } |
1658 | if (req_len != actual_req_len) { | 1682 | if (req_len != actual_req_len) { |
1659 | dev_dbg_f(zd_usb_dev(usb), "error in usb_interrupt_msg()\n" | 1683 | dev_dbg_f(zd_usb_dev(usb), "error in zd_ep_regs_out_msg()\n" |
1660 | " req_len %d != actual_req_len %d\n", | 1684 | " req_len %d != actual_req_len %d\n", |
1661 | req_len, actual_req_len); | 1685 | req_len, actual_req_len); |
1662 | r = -EIO; | 1686 | r = -EIO; |
@@ -1818,9 +1842,17 @@ int zd_usb_iowrite16v_async(struct zd_usb *usb, const struct zd_ioreq16 *ioreqs, | |||
1818 | rw->value = cpu_to_le16(ioreqs[i].value); | 1842 | rw->value = cpu_to_le16(ioreqs[i].value); |
1819 | } | 1843 | } |
1820 | 1844 | ||
1821 | usb_fill_int_urb(urb, udev, usb_sndintpipe(udev, EP_REGS_OUT), | 1845 | /* In USB 2.0 mode endpoint is interrupt type. However in USB 1.1 mode |
1822 | req, req_len, iowrite16v_urb_complete, usb, | 1846 | * endpoint is bulk. Select correct type URB by endpoint descriptor. |
1823 | ep->desc.bInterval); | 1847 | */ |
1848 | if (usb_endpoint_xfer_int(&ep->desc)) | ||
1849 | usb_fill_int_urb(urb, udev, usb_sndintpipe(udev, EP_REGS_OUT), | ||
1850 | req, req_len, iowrite16v_urb_complete, usb, | ||
1851 | ep->desc.bInterval); | ||
1852 | else | ||
1853 | usb_fill_bulk_urb(urb, udev, usb_sndbulkpipe(udev, EP_REGS_OUT), | ||
1854 | req, req_len, iowrite16v_urb_complete, usb); | ||
1855 | |||
1824 | urb->transfer_flags |= URB_FREE_BUFFER; | 1856 | urb->transfer_flags |= URB_FREE_BUFFER; |
1825 | 1857 | ||
1826 | /* Submit previous URB */ | 1858 | /* Submit previous URB */ |
@@ -1924,15 +1956,14 @@ int zd_usb_rfwrite(struct zd_usb *usb, u32 value, u8 bits) | |||
1924 | } | 1956 | } |
1925 | 1957 | ||
1926 | udev = zd_usb_to_usbdev(usb); | 1958 | udev = zd_usb_to_usbdev(usb); |
1927 | r = usb_interrupt_msg(udev, usb_sndintpipe(udev, EP_REGS_OUT), | 1959 | r = zd_ep_regs_out_msg(udev, req, req_len, &actual_req_len, 50 /*ms*/); |
1928 | req, req_len, &actual_req_len, 50 /* ms */); | ||
1929 | if (r) { | 1960 | if (r) { |
1930 | dev_dbg_f(zd_usb_dev(usb), | 1961 | dev_dbg_f(zd_usb_dev(usb), |
1931 | "error in usb_interrupt_msg(). Error number %d\n", r); | 1962 | "error in zd_ep_regs_out_msg(). Error number %d\n", r); |
1932 | goto out; | 1963 | goto out; |
1933 | } | 1964 | } |
1934 | if (req_len != actual_req_len) { | 1965 | if (req_len != actual_req_len) { |
1935 | dev_dbg_f(zd_usb_dev(usb), "error in usb_interrupt_msg()" | 1966 | dev_dbg_f(zd_usb_dev(usb), "error in zd_ep_regs_out_msg()" |
1936 | " req_len %d != actual_req_len %d\n", | 1967 | " req_len %d != actual_req_len %d\n", |
1937 | req_len, actual_req_len); | 1968 | req_len, actual_req_len); |
1938 | r = -EIO; | 1969 | r = -EIO; |
diff --git a/drivers/pci/dmar.c b/drivers/pci/dmar.c index 12e02bf92c4a..3dc9befa5aec 100644 --- a/drivers/pci/dmar.c +++ b/drivers/pci/dmar.c | |||
@@ -698,12 +698,7 @@ int __init detect_intel_iommu(void) | |||
698 | { | 698 | { |
699 | #ifdef CONFIG_INTR_REMAP | 699 | #ifdef CONFIG_INTR_REMAP |
700 | struct acpi_table_dmar *dmar; | 700 | struct acpi_table_dmar *dmar; |
701 | /* | 701 | |
702 | * for now we will disable dma-remapping when interrupt | ||
703 | * remapping is enabled. | ||
704 | * When support for queued invalidation for IOTLB invalidation | ||
705 | * is added, we will not need this any more. | ||
706 | */ | ||
707 | dmar = (struct acpi_table_dmar *) dmar_tbl; | 702 | dmar = (struct acpi_table_dmar *) dmar_tbl; |
708 | if (ret && cpu_has_x2apic && dmar->flags & 0x1) | 703 | if (ret && cpu_has_x2apic && dmar->flags & 0x1) |
709 | printk(KERN_INFO | 704 | printk(KERN_INFO |
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c index 6af6b628175b..59f17acf7f68 100644 --- a/drivers/pci/intel-iommu.c +++ b/drivers/pci/intel-iommu.c | |||
@@ -47,6 +47,8 @@ | |||
47 | #define ROOT_SIZE VTD_PAGE_SIZE | 47 | #define ROOT_SIZE VTD_PAGE_SIZE |
48 | #define CONTEXT_SIZE VTD_PAGE_SIZE | 48 | #define CONTEXT_SIZE VTD_PAGE_SIZE |
49 | 49 | ||
50 | #define IS_BRIDGE_HOST_DEVICE(pdev) \ | ||
51 | ((pdev->class >> 8) == PCI_CLASS_BRIDGE_HOST) | ||
50 | #define IS_GFX_DEVICE(pdev) ((pdev->class >> 16) == PCI_BASE_CLASS_DISPLAY) | 52 | #define IS_GFX_DEVICE(pdev) ((pdev->class >> 16) == PCI_BASE_CLASS_DISPLAY) |
51 | #define IS_ISA_DEVICE(pdev) ((pdev->class >> 8) == PCI_CLASS_BRIDGE_ISA) | 53 | #define IS_ISA_DEVICE(pdev) ((pdev->class >> 8) == PCI_CLASS_BRIDGE_ISA) |
52 | #define IS_AZALIA(pdev) ((pdev)->vendor == 0x8086 && (pdev)->device == 0x3a3e) | 54 | #define IS_AZALIA(pdev) ((pdev)->vendor == 0x8086 && (pdev)->device == 0x3a3e) |
@@ -116,6 +118,11 @@ static inline unsigned long align_to_level(unsigned long pfn, int level) | |||
116 | return (pfn + level_size(level) - 1) & level_mask(level); | 118 | return (pfn + level_size(level) - 1) & level_mask(level); |
117 | } | 119 | } |
118 | 120 | ||
121 | static inline unsigned long lvl_to_nr_pages(unsigned int lvl) | ||
122 | { | ||
123 | return 1 << ((lvl - 1) * LEVEL_STRIDE); | ||
124 | } | ||
125 | |||
119 | /* VT-d pages must always be _smaller_ than MM pages. Otherwise things | 126 | /* VT-d pages must always be _smaller_ than MM pages. Otherwise things |
120 | are never going to work. */ | 127 | are never going to work. */ |
121 | static inline unsigned long dma_to_mm_pfn(unsigned long dma_pfn) | 128 | static inline unsigned long dma_to_mm_pfn(unsigned long dma_pfn) |
@@ -143,6 +150,12 @@ static void __init check_tylersburg_isoch(void); | |||
143 | static int rwbf_quirk; | 150 | static int rwbf_quirk; |
144 | 151 | ||
145 | /* | 152 | /* |
153 | * set to 1 to panic kernel if can't successfully enable VT-d | ||
154 | * (used when kernel is launched w/ TXT) | ||
155 | */ | ||
156 | static int force_on = 0; | ||
157 | |||
158 | /* | ||
146 | * 0: Present | 159 | * 0: Present |
147 | * 1-11: Reserved | 160 | * 1-11: Reserved |
148 | * 12-63: Context Ptr (12 - (haw-1)) | 161 | * 12-63: Context Ptr (12 - (haw-1)) |
@@ -338,6 +351,9 @@ struct dmar_domain { | |||
338 | int iommu_coherency;/* indicate coherency of iommu access */ | 351 | int iommu_coherency;/* indicate coherency of iommu access */ |
339 | int iommu_snooping; /* indicate snooping control feature*/ | 352 | int iommu_snooping; /* indicate snooping control feature*/ |
340 | int iommu_count; /* reference count of iommu */ | 353 | int iommu_count; /* reference count of iommu */ |
354 | int iommu_superpage;/* Level of superpages supported: | ||
355 | 0 == 4KiB (no superpages), 1 == 2MiB, | ||
356 | 2 == 1GiB, 3 == 512GiB, 4 == 1TiB */ | ||
341 | spinlock_t iommu_lock; /* protect iommu set in domain */ | 357 | spinlock_t iommu_lock; /* protect iommu set in domain */ |
342 | u64 max_addr; /* maximum mapped address */ | 358 | u64 max_addr; /* maximum mapped address */ |
343 | }; | 359 | }; |
@@ -387,6 +403,7 @@ int dmar_disabled = 1; | |||
387 | static int dmar_map_gfx = 1; | 403 | static int dmar_map_gfx = 1; |
388 | static int dmar_forcedac; | 404 | static int dmar_forcedac; |
389 | static int intel_iommu_strict; | 405 | static int intel_iommu_strict; |
406 | static int intel_iommu_superpage = 1; | ||
390 | 407 | ||
391 | #define DUMMY_DEVICE_DOMAIN_INFO ((struct device_domain_info *)(-1)) | 408 | #define DUMMY_DEVICE_DOMAIN_INFO ((struct device_domain_info *)(-1)) |
392 | static DEFINE_SPINLOCK(device_domain_lock); | 409 | static DEFINE_SPINLOCK(device_domain_lock); |
@@ -417,6 +434,10 @@ static int __init intel_iommu_setup(char *str) | |||
417 | printk(KERN_INFO | 434 | printk(KERN_INFO |
418 | "Intel-IOMMU: disable batched IOTLB flush\n"); | 435 | "Intel-IOMMU: disable batched IOTLB flush\n"); |
419 | intel_iommu_strict = 1; | 436 | intel_iommu_strict = 1; |
437 | } else if (!strncmp(str, "sp_off", 6)) { | ||
438 | printk(KERN_INFO | ||
439 | "Intel-IOMMU: disable supported super page\n"); | ||
440 | intel_iommu_superpage = 0; | ||
420 | } | 441 | } |
421 | 442 | ||
422 | str += strcspn(str, ","); | 443 | str += strcspn(str, ","); |
@@ -555,11 +576,32 @@ static void domain_update_iommu_snooping(struct dmar_domain *domain) | |||
555 | } | 576 | } |
556 | } | 577 | } |
557 | 578 | ||
579 | static void domain_update_iommu_superpage(struct dmar_domain *domain) | ||
580 | { | ||
581 | int i, mask = 0xf; | ||
582 | |||
583 | if (!intel_iommu_superpage) { | ||
584 | domain->iommu_superpage = 0; | ||
585 | return; | ||
586 | } | ||
587 | |||
588 | domain->iommu_superpage = 4; /* 1TiB */ | ||
589 | |||
590 | for_each_set_bit(i, &domain->iommu_bmp, g_num_of_iommus) { | ||
591 | mask |= cap_super_page_val(g_iommus[i]->cap); | ||
592 | if (!mask) { | ||
593 | break; | ||
594 | } | ||
595 | } | ||
596 | domain->iommu_superpage = fls(mask); | ||
597 | } | ||
598 | |||
558 | /* Some capabilities may be different across iommus */ | 599 | /* Some capabilities may be different across iommus */ |
559 | static void domain_update_iommu_cap(struct dmar_domain *domain) | 600 | static void domain_update_iommu_cap(struct dmar_domain *domain) |
560 | { | 601 | { |
561 | domain_update_iommu_coherency(domain); | 602 | domain_update_iommu_coherency(domain); |
562 | domain_update_iommu_snooping(domain); | 603 | domain_update_iommu_snooping(domain); |
604 | domain_update_iommu_superpage(domain); | ||
563 | } | 605 | } |
564 | 606 | ||
565 | static struct intel_iommu *device_to_iommu(int segment, u8 bus, u8 devfn) | 607 | static struct intel_iommu *device_to_iommu(int segment, u8 bus, u8 devfn) |
@@ -689,23 +731,31 @@ out: | |||
689 | } | 731 | } |
690 | 732 | ||
691 | static struct dma_pte *pfn_to_dma_pte(struct dmar_domain *domain, | 733 | static struct dma_pte *pfn_to_dma_pte(struct dmar_domain *domain, |
692 | unsigned long pfn) | 734 | unsigned long pfn, int large_level) |
693 | { | 735 | { |
694 | int addr_width = agaw_to_width(domain->agaw) - VTD_PAGE_SHIFT; | 736 | int addr_width = agaw_to_width(domain->agaw) - VTD_PAGE_SHIFT; |
695 | struct dma_pte *parent, *pte = NULL; | 737 | struct dma_pte *parent, *pte = NULL; |
696 | int level = agaw_to_level(domain->agaw); | 738 | int level = agaw_to_level(domain->agaw); |
697 | int offset; | 739 | int offset, target_level; |
698 | 740 | ||
699 | BUG_ON(!domain->pgd); | 741 | BUG_ON(!domain->pgd); |
700 | BUG_ON(addr_width < BITS_PER_LONG && pfn >> addr_width); | 742 | BUG_ON(addr_width < BITS_PER_LONG && pfn >> addr_width); |
701 | parent = domain->pgd; | 743 | parent = domain->pgd; |
702 | 744 | ||
745 | /* Search pte */ | ||
746 | if (!large_level) | ||
747 | target_level = 1; | ||
748 | else | ||
749 | target_level = large_level; | ||
750 | |||
703 | while (level > 0) { | 751 | while (level > 0) { |
704 | void *tmp_page; | 752 | void *tmp_page; |
705 | 753 | ||
706 | offset = pfn_level_offset(pfn, level); | 754 | offset = pfn_level_offset(pfn, level); |
707 | pte = &parent[offset]; | 755 | pte = &parent[offset]; |
708 | if (level == 1) | 756 | if (!large_level && (pte->val & DMA_PTE_LARGE_PAGE)) |
757 | break; | ||
758 | if (level == target_level) | ||
709 | break; | 759 | break; |
710 | 760 | ||
711 | if (!dma_pte_present(pte)) { | 761 | if (!dma_pte_present(pte)) { |
@@ -733,10 +783,11 @@ static struct dma_pte *pfn_to_dma_pte(struct dmar_domain *domain, | |||
733 | return pte; | 783 | return pte; |
734 | } | 784 | } |
735 | 785 | ||
786 | |||
736 | /* return address's pte at specific level */ | 787 | /* return address's pte at specific level */ |
737 | static struct dma_pte *dma_pfn_level_pte(struct dmar_domain *domain, | 788 | static struct dma_pte *dma_pfn_level_pte(struct dmar_domain *domain, |
738 | unsigned long pfn, | 789 | unsigned long pfn, |
739 | int level) | 790 | int level, int *large_page) |
740 | { | 791 | { |
741 | struct dma_pte *parent, *pte = NULL; | 792 | struct dma_pte *parent, *pte = NULL; |
742 | int total = agaw_to_level(domain->agaw); | 793 | int total = agaw_to_level(domain->agaw); |
@@ -749,8 +800,16 @@ static struct dma_pte *dma_pfn_level_pte(struct dmar_domain *domain, | |||
749 | if (level == total) | 800 | if (level == total) |
750 | return pte; | 801 | return pte; |
751 | 802 | ||
752 | if (!dma_pte_present(pte)) | 803 | if (!dma_pte_present(pte)) { |
804 | *large_page = total; | ||
753 | break; | 805 | break; |
806 | } | ||
807 | |||
808 | if (pte->val & DMA_PTE_LARGE_PAGE) { | ||
809 | *large_page = total; | ||
810 | return pte; | ||
811 | } | ||
812 | |||
754 | parent = phys_to_virt(dma_pte_addr(pte)); | 813 | parent = phys_to_virt(dma_pte_addr(pte)); |
755 | total--; | 814 | total--; |
756 | } | 815 | } |
@@ -763,6 +822,7 @@ static void dma_pte_clear_range(struct dmar_domain *domain, | |||
763 | unsigned long last_pfn) | 822 | unsigned long last_pfn) |
764 | { | 823 | { |
765 | int addr_width = agaw_to_width(domain->agaw) - VTD_PAGE_SHIFT; | 824 | int addr_width = agaw_to_width(domain->agaw) - VTD_PAGE_SHIFT; |
825 | unsigned int large_page = 1; | ||
766 | struct dma_pte *first_pte, *pte; | 826 | struct dma_pte *first_pte, *pte; |
767 | 827 | ||
768 | BUG_ON(addr_width < BITS_PER_LONG && start_pfn >> addr_width); | 828 | BUG_ON(addr_width < BITS_PER_LONG && start_pfn >> addr_width); |
@@ -771,14 +831,15 @@ static void dma_pte_clear_range(struct dmar_domain *domain, | |||
771 | 831 | ||
772 | /* we don't need lock here; nobody else touches the iova range */ | 832 | /* we don't need lock here; nobody else touches the iova range */ |
773 | do { | 833 | do { |
774 | first_pte = pte = dma_pfn_level_pte(domain, start_pfn, 1); | 834 | large_page = 1; |
835 | first_pte = pte = dma_pfn_level_pte(domain, start_pfn, 1, &large_page); | ||
775 | if (!pte) { | 836 | if (!pte) { |
776 | start_pfn = align_to_level(start_pfn + 1, 2); | 837 | start_pfn = align_to_level(start_pfn + 1, large_page + 1); |
777 | continue; | 838 | continue; |
778 | } | 839 | } |
779 | do { | 840 | do { |
780 | dma_clear_pte(pte); | 841 | dma_clear_pte(pte); |
781 | start_pfn++; | 842 | start_pfn += lvl_to_nr_pages(large_page); |
782 | pte++; | 843 | pte++; |
783 | } while (start_pfn <= last_pfn && !first_pte_in_page(pte)); | 844 | } while (start_pfn <= last_pfn && !first_pte_in_page(pte)); |
784 | 845 | ||
@@ -798,6 +859,7 @@ static void dma_pte_free_pagetable(struct dmar_domain *domain, | |||
798 | int total = agaw_to_level(domain->agaw); | 859 | int total = agaw_to_level(domain->agaw); |
799 | int level; | 860 | int level; |
800 | unsigned long tmp; | 861 | unsigned long tmp; |
862 | int large_page = 2; | ||
801 | 863 | ||
802 | BUG_ON(addr_width < BITS_PER_LONG && start_pfn >> addr_width); | 864 | BUG_ON(addr_width < BITS_PER_LONG && start_pfn >> addr_width); |
803 | BUG_ON(addr_width < BITS_PER_LONG && last_pfn >> addr_width); | 865 | BUG_ON(addr_width < BITS_PER_LONG && last_pfn >> addr_width); |
@@ -813,7 +875,10 @@ static void dma_pte_free_pagetable(struct dmar_domain *domain, | |||
813 | return; | 875 | return; |
814 | 876 | ||
815 | do { | 877 | do { |
816 | first_pte = pte = dma_pfn_level_pte(domain, tmp, level); | 878 | large_page = level; |
879 | first_pte = pte = dma_pfn_level_pte(domain, tmp, level, &large_page); | ||
880 | if (large_page > level) | ||
881 | level = large_page + 1; | ||
817 | if (!pte) { | 882 | if (!pte) { |
818 | tmp = align_to_level(tmp + 1, level + 1); | 883 | tmp = align_to_level(tmp + 1, level + 1); |
819 | continue; | 884 | continue; |
@@ -1397,6 +1462,7 @@ static int domain_init(struct dmar_domain *domain, int guest_width) | |||
1397 | else | 1462 | else |
1398 | domain->iommu_snooping = 0; | 1463 | domain->iommu_snooping = 0; |
1399 | 1464 | ||
1465 | domain->iommu_superpage = fls(cap_super_page_val(iommu->cap)); | ||
1400 | domain->iommu_count = 1; | 1466 | domain->iommu_count = 1; |
1401 | domain->nid = iommu->node; | 1467 | domain->nid = iommu->node; |
1402 | 1468 | ||
@@ -1417,6 +1483,10 @@ static void domain_exit(struct dmar_domain *domain) | |||
1417 | if (!domain) | 1483 | if (!domain) |
1418 | return; | 1484 | return; |
1419 | 1485 | ||
1486 | /* Flush any lazy unmaps that may reference this domain */ | ||
1487 | if (!intel_iommu_strict) | ||
1488 | flush_unmaps_timeout(0); | ||
1489 | |||
1420 | domain_remove_dev_info(domain); | 1490 | domain_remove_dev_info(domain); |
1421 | /* destroy iovas */ | 1491 | /* destroy iovas */ |
1422 | put_iova_domain(&domain->iovad); | 1492 | put_iova_domain(&domain->iovad); |
@@ -1648,6 +1718,34 @@ static inline unsigned long aligned_nrpages(unsigned long host_addr, | |||
1648 | return PAGE_ALIGN(host_addr + size) >> VTD_PAGE_SHIFT; | 1718 | return PAGE_ALIGN(host_addr + size) >> VTD_PAGE_SHIFT; |
1649 | } | 1719 | } |
1650 | 1720 | ||
1721 | /* Return largest possible superpage level for a given mapping */ | ||
1722 | static inline int hardware_largepage_caps(struct dmar_domain *domain, | ||
1723 | unsigned long iov_pfn, | ||
1724 | unsigned long phy_pfn, | ||
1725 | unsigned long pages) | ||
1726 | { | ||
1727 | int support, level = 1; | ||
1728 | unsigned long pfnmerge; | ||
1729 | |||
1730 | support = domain->iommu_superpage; | ||
1731 | |||
1732 | /* To use a large page, the virtual *and* physical addresses | ||
1733 | must be aligned to 2MiB/1GiB/etc. Lower bits set in either | ||
1734 | of them will mean we have to use smaller pages. So just | ||
1735 | merge them and check both at once. */ | ||
1736 | pfnmerge = iov_pfn | phy_pfn; | ||
1737 | |||
1738 | while (support && !(pfnmerge & ~VTD_STRIDE_MASK)) { | ||
1739 | pages >>= VTD_STRIDE_SHIFT; | ||
1740 | if (!pages) | ||
1741 | break; | ||
1742 | pfnmerge >>= VTD_STRIDE_SHIFT; | ||
1743 | level++; | ||
1744 | support--; | ||
1745 | } | ||
1746 | return level; | ||
1747 | } | ||
1748 | |||
1651 | static int __domain_mapping(struct dmar_domain *domain, unsigned long iov_pfn, | 1749 | static int __domain_mapping(struct dmar_domain *domain, unsigned long iov_pfn, |
1652 | struct scatterlist *sg, unsigned long phys_pfn, | 1750 | struct scatterlist *sg, unsigned long phys_pfn, |
1653 | unsigned long nr_pages, int prot) | 1751 | unsigned long nr_pages, int prot) |
@@ -1656,6 +1754,8 @@ static int __domain_mapping(struct dmar_domain *domain, unsigned long iov_pfn, | |||
1656 | phys_addr_t uninitialized_var(pteval); | 1754 | phys_addr_t uninitialized_var(pteval); |
1657 | int addr_width = agaw_to_width(domain->agaw) - VTD_PAGE_SHIFT; | 1755 | int addr_width = agaw_to_width(domain->agaw) - VTD_PAGE_SHIFT; |
1658 | unsigned long sg_res; | 1756 | unsigned long sg_res; |
1757 | unsigned int largepage_lvl = 0; | ||
1758 | unsigned long lvl_pages = 0; | ||
1659 | 1759 | ||
1660 | BUG_ON(addr_width < BITS_PER_LONG && (iov_pfn + nr_pages - 1) >> addr_width); | 1760 | BUG_ON(addr_width < BITS_PER_LONG && (iov_pfn + nr_pages - 1) >> addr_width); |
1661 | 1761 | ||
@@ -1671,7 +1771,7 @@ static int __domain_mapping(struct dmar_domain *domain, unsigned long iov_pfn, | |||
1671 | pteval = ((phys_addr_t)phys_pfn << VTD_PAGE_SHIFT) | prot; | 1771 | pteval = ((phys_addr_t)phys_pfn << VTD_PAGE_SHIFT) | prot; |
1672 | } | 1772 | } |
1673 | 1773 | ||
1674 | while (nr_pages--) { | 1774 | while (nr_pages > 0) { |
1675 | uint64_t tmp; | 1775 | uint64_t tmp; |
1676 | 1776 | ||
1677 | if (!sg_res) { | 1777 | if (!sg_res) { |
@@ -1679,11 +1779,21 @@ static int __domain_mapping(struct dmar_domain *domain, unsigned long iov_pfn, | |||
1679 | sg->dma_address = ((dma_addr_t)iov_pfn << VTD_PAGE_SHIFT) + sg->offset; | 1779 | sg->dma_address = ((dma_addr_t)iov_pfn << VTD_PAGE_SHIFT) + sg->offset; |
1680 | sg->dma_length = sg->length; | 1780 | sg->dma_length = sg->length; |
1681 | pteval = page_to_phys(sg_page(sg)) | prot; | 1781 | pteval = page_to_phys(sg_page(sg)) | prot; |
1782 | phys_pfn = pteval >> VTD_PAGE_SHIFT; | ||
1682 | } | 1783 | } |
1784 | |||
1683 | if (!pte) { | 1785 | if (!pte) { |
1684 | first_pte = pte = pfn_to_dma_pte(domain, iov_pfn); | 1786 | largepage_lvl = hardware_largepage_caps(domain, iov_pfn, phys_pfn, sg_res); |
1787 | |||
1788 | first_pte = pte = pfn_to_dma_pte(domain, iov_pfn, largepage_lvl); | ||
1685 | if (!pte) | 1789 | if (!pte) |
1686 | return -ENOMEM; | 1790 | return -ENOMEM; |
1791 | /* It is large page*/ | ||
1792 | if (largepage_lvl > 1) | ||
1793 | pteval |= DMA_PTE_LARGE_PAGE; | ||
1794 | else | ||
1795 | pteval &= ~(uint64_t)DMA_PTE_LARGE_PAGE; | ||
1796 | |||
1687 | } | 1797 | } |
1688 | /* We don't need lock here, nobody else | 1798 | /* We don't need lock here, nobody else |
1689 | * touches the iova range | 1799 | * touches the iova range |
@@ -1699,16 +1809,38 @@ static int __domain_mapping(struct dmar_domain *domain, unsigned long iov_pfn, | |||
1699 | } | 1809 | } |
1700 | WARN_ON(1); | 1810 | WARN_ON(1); |
1701 | } | 1811 | } |
1812 | |||
1813 | lvl_pages = lvl_to_nr_pages(largepage_lvl); | ||
1814 | |||
1815 | BUG_ON(nr_pages < lvl_pages); | ||
1816 | BUG_ON(sg_res < lvl_pages); | ||
1817 | |||
1818 | nr_pages -= lvl_pages; | ||
1819 | iov_pfn += lvl_pages; | ||
1820 | phys_pfn += lvl_pages; | ||
1821 | pteval += lvl_pages * VTD_PAGE_SIZE; | ||
1822 | sg_res -= lvl_pages; | ||
1823 | |||
1824 | /* If the next PTE would be the first in a new page, then we | ||
1825 | need to flush the cache on the entries we've just written. | ||
1826 | And then we'll need to recalculate 'pte', so clear it and | ||
1827 | let it get set again in the if (!pte) block above. | ||
1828 | |||
1829 | If we're done (!nr_pages) we need to flush the cache too. | ||
1830 | |||
1831 | Also if we've been setting superpages, we may need to | ||
1832 | recalculate 'pte' and switch back to smaller pages for the | ||
1833 | end of the mapping, if the trailing size is not enough to | ||
1834 | use another superpage (i.e. sg_res < lvl_pages). */ | ||
1702 | pte++; | 1835 | pte++; |
1703 | if (!nr_pages || first_pte_in_page(pte)) { | 1836 | if (!nr_pages || first_pte_in_page(pte) || |
1837 | (largepage_lvl > 1 && sg_res < lvl_pages)) { | ||
1704 | domain_flush_cache(domain, first_pte, | 1838 | domain_flush_cache(domain, first_pte, |
1705 | (void *)pte - (void *)first_pte); | 1839 | (void *)pte - (void *)first_pte); |
1706 | pte = NULL; | 1840 | pte = NULL; |
1707 | } | 1841 | } |
1708 | iov_pfn++; | 1842 | |
1709 | pteval += VTD_PAGE_SIZE; | 1843 | if (!sg_res && nr_pages) |
1710 | sg_res--; | ||
1711 | if (!sg_res) | ||
1712 | sg = sg_next(sg); | 1844 | sg = sg_next(sg); |
1713 | } | 1845 | } |
1714 | return 0; | 1846 | return 0; |
@@ -2016,7 +2148,7 @@ static inline int iommu_prepare_rmrr_dev(struct dmar_rmrr_unit *rmrr, | |||
2016 | if (pdev->dev.archdata.iommu == DUMMY_DEVICE_DOMAIN_INFO) | 2148 | if (pdev->dev.archdata.iommu == DUMMY_DEVICE_DOMAIN_INFO) |
2017 | return 0; | 2149 | return 0; |
2018 | return iommu_prepare_identity_map(pdev, rmrr->base_address, | 2150 | return iommu_prepare_identity_map(pdev, rmrr->base_address, |
2019 | rmrr->end_address + 1); | 2151 | rmrr->end_address); |
2020 | } | 2152 | } |
2021 | 2153 | ||
2022 | #ifdef CONFIG_DMAR_FLOPPY_WA | 2154 | #ifdef CONFIG_DMAR_FLOPPY_WA |
@@ -2030,7 +2162,7 @@ static inline void iommu_prepare_isa(void) | |||
2030 | return; | 2162 | return; |
2031 | 2163 | ||
2032 | printk(KERN_INFO "IOMMU: Prepare 0-16MiB unity mapping for LPC\n"); | 2164 | printk(KERN_INFO "IOMMU: Prepare 0-16MiB unity mapping for LPC\n"); |
2033 | ret = iommu_prepare_identity_map(pdev, 0, 16*1024*1024); | 2165 | ret = iommu_prepare_identity_map(pdev, 0, 16*1024*1024 - 1); |
2034 | 2166 | ||
2035 | if (ret) | 2167 | if (ret) |
2036 | printk(KERN_ERR "IOMMU: Failed to create 0-16MiB identity map; " | 2168 | printk(KERN_ERR "IOMMU: Failed to create 0-16MiB identity map; " |
@@ -2106,10 +2238,10 @@ static int identity_mapping(struct pci_dev *pdev) | |||
2106 | if (likely(!iommu_identity_mapping)) | 2238 | if (likely(!iommu_identity_mapping)) |
2107 | return 0; | 2239 | return 0; |
2108 | 2240 | ||
2241 | info = pdev->dev.archdata.iommu; | ||
2242 | if (info && info != DUMMY_DEVICE_DOMAIN_INFO) | ||
2243 | return (info->domain == si_domain); | ||
2109 | 2244 | ||
2110 | list_for_each_entry(info, &si_domain->devices, link) | ||
2111 | if (info->dev == pdev) | ||
2112 | return 1; | ||
2113 | return 0; | 2245 | return 0; |
2114 | } | 2246 | } |
2115 | 2247 | ||
@@ -2187,8 +2319,19 @@ static int iommu_should_identity_map(struct pci_dev *pdev, int startup) | |||
2187 | * Assume that they will -- if they turn out not to be, then we can | 2319 | * Assume that they will -- if they turn out not to be, then we can |
2188 | * take them out of the 1:1 domain later. | 2320 | * take them out of the 1:1 domain later. |
2189 | */ | 2321 | */ |
2190 | if (!startup) | 2322 | if (!startup) { |
2191 | return pdev->dma_mask > DMA_BIT_MASK(32); | 2323 | /* |
2324 | * If the device's dma_mask is less than the system's memory | ||
2325 | * size then this is not a candidate for identity mapping. | ||
2326 | */ | ||
2327 | u64 dma_mask = pdev->dma_mask; | ||
2328 | |||
2329 | if (pdev->dev.coherent_dma_mask && | ||
2330 | pdev->dev.coherent_dma_mask < dma_mask) | ||
2331 | dma_mask = pdev->dev.coherent_dma_mask; | ||
2332 | |||
2333 | return dma_mask >= dma_get_required_mask(&pdev->dev); | ||
2334 | } | ||
2192 | 2335 | ||
2193 | return 1; | 2336 | return 1; |
2194 | } | 2337 | } |
@@ -2203,6 +2346,9 @@ static int __init iommu_prepare_static_identity_mapping(int hw) | |||
2203 | return -EFAULT; | 2346 | return -EFAULT; |
2204 | 2347 | ||
2205 | for_each_pci_dev(pdev) { | 2348 | for_each_pci_dev(pdev) { |
2349 | /* Skip Host/PCI Bridge devices */ | ||
2350 | if (IS_BRIDGE_HOST_DEVICE(pdev)) | ||
2351 | continue; | ||
2206 | if (iommu_should_identity_map(pdev, 1)) { | 2352 | if (iommu_should_identity_map(pdev, 1)) { |
2207 | printk(KERN_INFO "IOMMU: %s identity mapping for device %s\n", | 2353 | printk(KERN_INFO "IOMMU: %s identity mapping for device %s\n", |
2208 | hw ? "hardware" : "software", pci_name(pdev)); | 2354 | hw ? "hardware" : "software", pci_name(pdev)); |
@@ -2218,7 +2364,7 @@ static int __init iommu_prepare_static_identity_mapping(int hw) | |||
2218 | return 0; | 2364 | return 0; |
2219 | } | 2365 | } |
2220 | 2366 | ||
2221 | static int __init init_dmars(int force_on) | 2367 | static int __init init_dmars(void) |
2222 | { | 2368 | { |
2223 | struct dmar_drhd_unit *drhd; | 2369 | struct dmar_drhd_unit *drhd; |
2224 | struct dmar_rmrr_unit *rmrr; | 2370 | struct dmar_rmrr_unit *rmrr; |
@@ -2592,8 +2738,7 @@ static dma_addr_t __intel_map_single(struct device *hwdev, phys_addr_t paddr, | |||
2592 | iommu = domain_get_iommu(domain); | 2738 | iommu = domain_get_iommu(domain); |
2593 | size = aligned_nrpages(paddr, size); | 2739 | size = aligned_nrpages(paddr, size); |
2594 | 2740 | ||
2595 | iova = intel_alloc_iova(hwdev, domain, dma_to_mm_pfn(size), | 2741 | iova = intel_alloc_iova(hwdev, domain, dma_to_mm_pfn(size), dma_mask); |
2596 | pdev->dma_mask); | ||
2597 | if (!iova) | 2742 | if (!iova) |
2598 | goto error; | 2743 | goto error; |
2599 | 2744 | ||
@@ -3118,7 +3263,17 @@ static int init_iommu_hw(void) | |||
3118 | if (iommu->qi) | 3263 | if (iommu->qi) |
3119 | dmar_reenable_qi(iommu); | 3264 | dmar_reenable_qi(iommu); |
3120 | 3265 | ||
3121 | for_each_active_iommu(iommu, drhd) { | 3266 | for_each_iommu(iommu, drhd) { |
3267 | if (drhd->ignored) { | ||
3268 | /* | ||
3269 | * we always have to disable PMRs or DMA may fail on | ||
3270 | * this device | ||
3271 | */ | ||
3272 | if (force_on) | ||
3273 | iommu_disable_protect_mem_regions(iommu); | ||
3274 | continue; | ||
3275 | } | ||
3276 | |||
3122 | iommu_flush_write_buffer(iommu); | 3277 | iommu_flush_write_buffer(iommu); |
3123 | 3278 | ||
3124 | iommu_set_root_entry(iommu); | 3279 | iommu_set_root_entry(iommu); |
@@ -3127,7 +3282,8 @@ static int init_iommu_hw(void) | |||
3127 | DMA_CCMD_GLOBAL_INVL); | 3282 | DMA_CCMD_GLOBAL_INVL); |
3128 | iommu->flush.flush_iotlb(iommu, 0, 0, 0, | 3283 | iommu->flush.flush_iotlb(iommu, 0, 0, 0, |
3129 | DMA_TLB_GLOBAL_FLUSH); | 3284 | DMA_TLB_GLOBAL_FLUSH); |
3130 | iommu_enable_translation(iommu); | 3285 | if (iommu_enable_translation(iommu)) |
3286 | return 1; | ||
3131 | iommu_disable_protect_mem_regions(iommu); | 3287 | iommu_disable_protect_mem_regions(iommu); |
3132 | } | 3288 | } |
3133 | 3289 | ||
@@ -3194,7 +3350,10 @@ static void iommu_resume(void) | |||
3194 | unsigned long flag; | 3350 | unsigned long flag; |
3195 | 3351 | ||
3196 | if (init_iommu_hw()) { | 3352 | if (init_iommu_hw()) { |
3197 | WARN(1, "IOMMU setup failed, DMAR can not resume!\n"); | 3353 | if (force_on) |
3354 | panic("tboot: IOMMU setup failed, DMAR can not resume!\n"); | ||
3355 | else | ||
3356 | WARN(1, "IOMMU setup failed, DMAR can not resume!\n"); | ||
3198 | return; | 3357 | return; |
3199 | } | 3358 | } |
3200 | 3359 | ||
@@ -3271,7 +3430,6 @@ static struct notifier_block device_nb = { | |||
3271 | int __init intel_iommu_init(void) | 3430 | int __init intel_iommu_init(void) |
3272 | { | 3431 | { |
3273 | int ret = 0; | 3432 | int ret = 0; |
3274 | int force_on = 0; | ||
3275 | 3433 | ||
3276 | /* VT-d is required for a TXT/tboot launch, so enforce that */ | 3434 | /* VT-d is required for a TXT/tboot launch, so enforce that */ |
3277 | force_on = tboot_force_iommu(); | 3435 | force_on = tboot_force_iommu(); |
@@ -3309,7 +3467,7 @@ int __init intel_iommu_init(void) | |||
3309 | 3467 | ||
3310 | init_no_remapping_devices(); | 3468 | init_no_remapping_devices(); |
3311 | 3469 | ||
3312 | ret = init_dmars(force_on); | 3470 | ret = init_dmars(); |
3313 | if (ret) { | 3471 | if (ret) { |
3314 | if (force_on) | 3472 | if (force_on) |
3315 | panic("tboot: Failed to initialize DMARs\n"); | 3473 | panic("tboot: Failed to initialize DMARs\n"); |
@@ -3380,8 +3538,8 @@ static void domain_remove_one_dev_info(struct dmar_domain *domain, | |||
3380 | spin_lock_irqsave(&device_domain_lock, flags); | 3538 | spin_lock_irqsave(&device_domain_lock, flags); |
3381 | list_for_each_safe(entry, tmp, &domain->devices) { | 3539 | list_for_each_safe(entry, tmp, &domain->devices) { |
3382 | info = list_entry(entry, struct device_domain_info, link); | 3540 | info = list_entry(entry, struct device_domain_info, link); |
3383 | /* No need to compare PCI domain; it has to be the same */ | 3541 | if (info->segment == pci_domain_nr(pdev->bus) && |
3384 | if (info->bus == pdev->bus->number && | 3542 | info->bus == pdev->bus->number && |
3385 | info->devfn == pdev->devfn) { | 3543 | info->devfn == pdev->devfn) { |
3386 | list_del(&info->link); | 3544 | list_del(&info->link); |
3387 | list_del(&info->global); | 3545 | list_del(&info->global); |
@@ -3419,10 +3577,13 @@ static void domain_remove_one_dev_info(struct dmar_domain *domain, | |||
3419 | domain_update_iommu_cap(domain); | 3577 | domain_update_iommu_cap(domain); |
3420 | spin_unlock_irqrestore(&domain->iommu_lock, tmp_flags); | 3578 | spin_unlock_irqrestore(&domain->iommu_lock, tmp_flags); |
3421 | 3579 | ||
3422 | spin_lock_irqsave(&iommu->lock, tmp_flags); | 3580 | if (!(domain->flags & DOMAIN_FLAG_VIRTUAL_MACHINE) && |
3423 | clear_bit(domain->id, iommu->domain_ids); | 3581 | !(domain->flags & DOMAIN_FLAG_STATIC_IDENTITY)) { |
3424 | iommu->domains[domain->id] = NULL; | 3582 | spin_lock_irqsave(&iommu->lock, tmp_flags); |
3425 | spin_unlock_irqrestore(&iommu->lock, tmp_flags); | 3583 | clear_bit(domain->id, iommu->domain_ids); |
3584 | iommu->domains[domain->id] = NULL; | ||
3585 | spin_unlock_irqrestore(&iommu->lock, tmp_flags); | ||
3586 | } | ||
3426 | } | 3587 | } |
3427 | 3588 | ||
3428 | spin_unlock_irqrestore(&device_domain_lock, flags); | 3589 | spin_unlock_irqrestore(&device_domain_lock, flags); |
@@ -3505,6 +3666,7 @@ static int md_domain_init(struct dmar_domain *domain, int guest_width) | |||
3505 | domain->iommu_count = 0; | 3666 | domain->iommu_count = 0; |
3506 | domain->iommu_coherency = 0; | 3667 | domain->iommu_coherency = 0; |
3507 | domain->iommu_snooping = 0; | 3668 | domain->iommu_snooping = 0; |
3669 | domain->iommu_superpage = 0; | ||
3508 | domain->max_addr = 0; | 3670 | domain->max_addr = 0; |
3509 | domain->nid = -1; | 3671 | domain->nid = -1; |
3510 | 3672 | ||
@@ -3720,7 +3882,7 @@ static phys_addr_t intel_iommu_iova_to_phys(struct iommu_domain *domain, | |||
3720 | struct dma_pte *pte; | 3882 | struct dma_pte *pte; |
3721 | u64 phys = 0; | 3883 | u64 phys = 0; |
3722 | 3884 | ||
3723 | pte = pfn_to_dma_pte(dmar_domain, iova >> VTD_PAGE_SHIFT); | 3885 | pte = pfn_to_dma_pte(dmar_domain, iova >> VTD_PAGE_SHIFT, 0); |
3724 | if (pte) | 3886 | if (pte) |
3725 | phys = dma_pte_addr(pte); | 3887 | phys = dma_pte_addr(pte); |
3726 | 3888 | ||
diff --git a/drivers/pci/iova.c b/drivers/pci/iova.c index 9606e599a475..c5c274ab5c5a 100644 --- a/drivers/pci/iova.c +++ b/drivers/pci/iova.c | |||
@@ -63,8 +63,16 @@ __cached_rbnode_delete_update(struct iova_domain *iovad, struct iova *free) | |||
63 | curr = iovad->cached32_node; | 63 | curr = iovad->cached32_node; |
64 | cached_iova = container_of(curr, struct iova, node); | 64 | cached_iova = container_of(curr, struct iova, node); |
65 | 65 | ||
66 | if (free->pfn_lo >= cached_iova->pfn_lo) | 66 | if (free->pfn_lo >= cached_iova->pfn_lo) { |
67 | iovad->cached32_node = rb_next(&free->node); | 67 | struct rb_node *node = rb_next(&free->node); |
68 | struct iova *iova = container_of(node, struct iova, node); | ||
69 | |||
70 | /* only cache if it's below 32bit pfn */ | ||
71 | if (node && iova->pfn_lo < iovad->dma_32bit_pfn) | ||
72 | iovad->cached32_node = node; | ||
73 | else | ||
74 | iovad->cached32_node = NULL; | ||
75 | } | ||
68 | } | 76 | } |
69 | 77 | ||
70 | /* Computes the padding size required, to make the | 78 | /* Computes the padding size required, to make the |
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index 58584dc0724a..44e8ca398efa 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c | |||
@@ -297,7 +297,7 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget, | |||
297 | kfree(sdev); | 297 | kfree(sdev); |
298 | goto out; | 298 | goto out; |
299 | } | 299 | } |
300 | 300 | blk_get_queue(sdev->request_queue); | |
301 | sdev->request_queue->queuedata = sdev; | 301 | sdev->request_queue->queuedata = sdev; |
302 | scsi_adjust_queue_depth(sdev, 0, sdev->host->cmd_per_lun); | 302 | scsi_adjust_queue_depth(sdev, 0, sdev->host->cmd_per_lun); |
303 | 303 | ||
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c index e63912510fb9..e0bd3f790fca 100644 --- a/drivers/scsi/scsi_sysfs.c +++ b/drivers/scsi/scsi_sysfs.c | |||
@@ -322,6 +322,7 @@ static void scsi_device_dev_release_usercontext(struct work_struct *work) | |||
322 | kfree(evt); | 322 | kfree(evt); |
323 | } | 323 | } |
324 | 324 | ||
325 | blk_put_queue(sdev->request_queue); | ||
325 | /* NULL queue means the device can't be used */ | 326 | /* NULL queue means the device can't be used */ |
326 | sdev->request_queue = NULL; | 327 | sdev->request_queue = NULL; |
327 | 328 | ||
diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index a4c42a75a3bf..09e8c7d53af3 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c | |||
@@ -2128,8 +2128,8 @@ static void gsmld_detach_gsm(struct tty_struct *tty, struct gsm_mux *gsm) | |||
2128 | gsm->tty = NULL; | 2128 | gsm->tty = NULL; |
2129 | } | 2129 | } |
2130 | 2130 | ||
2131 | static unsigned int gsmld_receive_buf(struct tty_struct *tty, | 2131 | static void gsmld_receive_buf(struct tty_struct *tty, const unsigned char *cp, |
2132 | const unsigned char *cp, char *fp, int count) | 2132 | char *fp, int count) |
2133 | { | 2133 | { |
2134 | struct gsm_mux *gsm = tty->disc_data; | 2134 | struct gsm_mux *gsm = tty->disc_data; |
2135 | const unsigned char *dp; | 2135 | const unsigned char *dp; |
@@ -2162,8 +2162,6 @@ static unsigned int gsmld_receive_buf(struct tty_struct *tty, | |||
2162 | } | 2162 | } |
2163 | /* FASYNC if needed ? */ | 2163 | /* FASYNC if needed ? */ |
2164 | /* If clogged call tty_throttle(tty); */ | 2164 | /* If clogged call tty_throttle(tty); */ |
2165 | |||
2166 | return count; | ||
2167 | } | 2165 | } |
2168 | 2166 | ||
2169 | /** | 2167 | /** |
diff --git a/drivers/tty/n_hdlc.c b/drivers/tty/n_hdlc.c index cac666314aef..cea56033b34c 100644 --- a/drivers/tty/n_hdlc.c +++ b/drivers/tty/n_hdlc.c | |||
@@ -188,8 +188,8 @@ static unsigned int n_hdlc_tty_poll(struct tty_struct *tty, struct file *filp, | |||
188 | poll_table *wait); | 188 | poll_table *wait); |
189 | static int n_hdlc_tty_open(struct tty_struct *tty); | 189 | static int n_hdlc_tty_open(struct tty_struct *tty); |
190 | static void n_hdlc_tty_close(struct tty_struct *tty); | 190 | static void n_hdlc_tty_close(struct tty_struct *tty); |
191 | static unsigned int n_hdlc_tty_receive(struct tty_struct *tty, | 191 | static void n_hdlc_tty_receive(struct tty_struct *tty, const __u8 *cp, |
192 | const __u8 *cp, char *fp, int count); | 192 | char *fp, int count); |
193 | static void n_hdlc_tty_wakeup(struct tty_struct *tty); | 193 | static void n_hdlc_tty_wakeup(struct tty_struct *tty); |
194 | 194 | ||
195 | #define bset(p,b) ((p)[(b) >> 5] |= (1 << ((b) & 0x1f))) | 195 | #define bset(p,b) ((p)[(b) >> 5] |= (1 << ((b) & 0x1f))) |
@@ -509,8 +509,8 @@ static void n_hdlc_tty_wakeup(struct tty_struct *tty) | |||
509 | * Called by tty low level driver when receive data is available. Data is | 509 | * Called by tty low level driver when receive data is available. Data is |
510 | * interpreted as one HDLC frame. | 510 | * interpreted as one HDLC frame. |
511 | */ | 511 | */ |
512 | static unsigned int n_hdlc_tty_receive(struct tty_struct *tty, | 512 | static void n_hdlc_tty_receive(struct tty_struct *tty, const __u8 *data, |
513 | const __u8 *data, char *flags, int count) | 513 | char *flags, int count) |
514 | { | 514 | { |
515 | register struct n_hdlc *n_hdlc = tty2n_hdlc (tty); | 515 | register struct n_hdlc *n_hdlc = tty2n_hdlc (tty); |
516 | register struct n_hdlc_buf *buf; | 516 | register struct n_hdlc_buf *buf; |
@@ -521,20 +521,20 @@ static unsigned int n_hdlc_tty_receive(struct tty_struct *tty, | |||
521 | 521 | ||
522 | /* This can happen if stuff comes in on the backup tty */ | 522 | /* This can happen if stuff comes in on the backup tty */ |
523 | if (!n_hdlc || tty != n_hdlc->tty) | 523 | if (!n_hdlc || tty != n_hdlc->tty) |
524 | return -ENODEV; | 524 | return; |
525 | 525 | ||
526 | /* verify line is using HDLC discipline */ | 526 | /* verify line is using HDLC discipline */ |
527 | if (n_hdlc->magic != HDLC_MAGIC) { | 527 | if (n_hdlc->magic != HDLC_MAGIC) { |
528 | printk("%s(%d) line not using HDLC discipline\n", | 528 | printk("%s(%d) line not using HDLC discipline\n", |
529 | __FILE__,__LINE__); | 529 | __FILE__,__LINE__); |
530 | return -EINVAL; | 530 | return; |
531 | } | 531 | } |
532 | 532 | ||
533 | if ( count>maxframe ) { | 533 | if ( count>maxframe ) { |
534 | if (debuglevel >= DEBUG_LEVEL_INFO) | 534 | if (debuglevel >= DEBUG_LEVEL_INFO) |
535 | printk("%s(%d) rx count>maxframesize, data discarded\n", | 535 | printk("%s(%d) rx count>maxframesize, data discarded\n", |
536 | __FILE__,__LINE__); | 536 | __FILE__,__LINE__); |
537 | return -EINVAL; | 537 | return; |
538 | } | 538 | } |
539 | 539 | ||
540 | /* get a free HDLC buffer */ | 540 | /* get a free HDLC buffer */ |
@@ -550,7 +550,7 @@ static unsigned int n_hdlc_tty_receive(struct tty_struct *tty, | |||
550 | if (debuglevel >= DEBUG_LEVEL_INFO) | 550 | if (debuglevel >= DEBUG_LEVEL_INFO) |
551 | printk("%s(%d) no more rx buffers, data discarded\n", | 551 | printk("%s(%d) no more rx buffers, data discarded\n", |
552 | __FILE__,__LINE__); | 552 | __FILE__,__LINE__); |
553 | return -EINVAL; | 553 | return; |
554 | } | 554 | } |
555 | 555 | ||
556 | /* copy received data to HDLC buffer */ | 556 | /* copy received data to HDLC buffer */ |
@@ -565,8 +565,6 @@ static unsigned int n_hdlc_tty_receive(struct tty_struct *tty, | |||
565 | if (n_hdlc->tty->fasync != NULL) | 565 | if (n_hdlc->tty->fasync != NULL) |
566 | kill_fasync (&n_hdlc->tty->fasync, SIGIO, POLL_IN); | 566 | kill_fasync (&n_hdlc->tty->fasync, SIGIO, POLL_IN); |
567 | 567 | ||
568 | return count; | ||
569 | |||
570 | } /* end of n_hdlc_tty_receive() */ | 568 | } /* end of n_hdlc_tty_receive() */ |
571 | 569 | ||
572 | /** | 570 | /** |
diff --git a/drivers/tty/n_r3964.c b/drivers/tty/n_r3964.c index a4bc39c21a43..5c6c31459a2f 100644 --- a/drivers/tty/n_r3964.c +++ b/drivers/tty/n_r3964.c | |||
@@ -139,8 +139,8 @@ static int r3964_ioctl(struct tty_struct *tty, struct file *file, | |||
139 | static void r3964_set_termios(struct tty_struct *tty, struct ktermios *old); | 139 | static void r3964_set_termios(struct tty_struct *tty, struct ktermios *old); |
140 | static unsigned int r3964_poll(struct tty_struct *tty, struct file *file, | 140 | static unsigned int r3964_poll(struct tty_struct *tty, struct file *file, |
141 | struct poll_table_struct *wait); | 141 | struct poll_table_struct *wait); |
142 | static unsigned int r3964_receive_buf(struct tty_struct *tty, | 142 | static void r3964_receive_buf(struct tty_struct *tty, const unsigned char *cp, |
143 | const unsigned char *cp, char *fp, int count); | 143 | char *fp, int count); |
144 | 144 | ||
145 | static struct tty_ldisc_ops tty_ldisc_N_R3964 = { | 145 | static struct tty_ldisc_ops tty_ldisc_N_R3964 = { |
146 | .owner = THIS_MODULE, | 146 | .owner = THIS_MODULE, |
@@ -1239,8 +1239,8 @@ static unsigned int r3964_poll(struct tty_struct *tty, struct file *file, | |||
1239 | return result; | 1239 | return result; |
1240 | } | 1240 | } |
1241 | 1241 | ||
1242 | static unsigned int r3964_receive_buf(struct tty_struct *tty, | 1242 | static void r3964_receive_buf(struct tty_struct *tty, const unsigned char *cp, |
1243 | const unsigned char *cp, char *fp, int count) | 1243 | char *fp, int count) |
1244 | { | 1244 | { |
1245 | struct r3964_info *pInfo = tty->disc_data; | 1245 | struct r3964_info *pInfo = tty->disc_data; |
1246 | const unsigned char *p; | 1246 | const unsigned char *p; |
@@ -1257,8 +1257,6 @@ static unsigned int r3964_receive_buf(struct tty_struct *tty, | |||
1257 | } | 1257 | } |
1258 | 1258 | ||
1259 | } | 1259 | } |
1260 | |||
1261 | return count; | ||
1262 | } | 1260 | } |
1263 | 1261 | ||
1264 | MODULE_LICENSE("GPL"); | 1262 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c index 95d0a9c2dd13..0ad32888091c 100644 --- a/drivers/tty/n_tty.c +++ b/drivers/tty/n_tty.c | |||
@@ -81,6 +81,38 @@ static inline int tty_put_user(struct tty_struct *tty, unsigned char x, | |||
81 | return put_user(x, ptr); | 81 | return put_user(x, ptr); |
82 | } | 82 | } |
83 | 83 | ||
84 | /** | ||
85 | * n_tty_set__room - receive space | ||
86 | * @tty: terminal | ||
87 | * | ||
88 | * Called by the driver to find out how much data it is | ||
89 | * permitted to feed to the line discipline without any being lost | ||
90 | * and thus to manage flow control. Not serialized. Answers for the | ||
91 | * "instant". | ||
92 | */ | ||
93 | |||
94 | static void n_tty_set_room(struct tty_struct *tty) | ||
95 | { | ||
96 | /* tty->read_cnt is not read locked ? */ | ||
97 | int left = N_TTY_BUF_SIZE - tty->read_cnt - 1; | ||
98 | int old_left; | ||
99 | |||
100 | /* | ||
101 | * If we are doing input canonicalization, and there are no | ||
102 | * pending newlines, let characters through without limit, so | ||
103 | * that erase characters will be handled. Other excess | ||
104 | * characters will be beeped. | ||
105 | */ | ||
106 | if (left <= 0) | ||
107 | left = tty->icanon && !tty->canon_data; | ||
108 | old_left = tty->receive_room; | ||
109 | tty->receive_room = left; | ||
110 | |||
111 | /* Did this open up the receive buffer? We may need to flip */ | ||
112 | if (left && !old_left) | ||
113 | schedule_work(&tty->buf.work); | ||
114 | } | ||
115 | |||
84 | static void put_tty_queue_nolock(unsigned char c, struct tty_struct *tty) | 116 | static void put_tty_queue_nolock(unsigned char c, struct tty_struct *tty) |
85 | { | 117 | { |
86 | if (tty->read_cnt < N_TTY_BUF_SIZE) { | 118 | if (tty->read_cnt < N_TTY_BUF_SIZE) { |
@@ -152,6 +184,7 @@ static void reset_buffer_flags(struct tty_struct *tty) | |||
152 | 184 | ||
153 | tty->canon_head = tty->canon_data = tty->erasing = 0; | 185 | tty->canon_head = tty->canon_data = tty->erasing = 0; |
154 | memset(&tty->read_flags, 0, sizeof tty->read_flags); | 186 | memset(&tty->read_flags, 0, sizeof tty->read_flags); |
187 | n_tty_set_room(tty); | ||
155 | check_unthrottle(tty); | 188 | check_unthrottle(tty); |
156 | } | 189 | } |
157 | 190 | ||
@@ -1327,19 +1360,17 @@ static void n_tty_write_wakeup(struct tty_struct *tty) | |||
1327 | * calls one at a time and in order (or using flush_to_ldisc) | 1360 | * calls one at a time and in order (or using flush_to_ldisc) |
1328 | */ | 1361 | */ |
1329 | 1362 | ||
1330 | static unsigned int n_tty_receive_buf(struct tty_struct *tty, | 1363 | static void n_tty_receive_buf(struct tty_struct *tty, const unsigned char *cp, |
1331 | const unsigned char *cp, char *fp, int count) | 1364 | char *fp, int count) |
1332 | { | 1365 | { |
1333 | const unsigned char *p; | 1366 | const unsigned char *p; |
1334 | char *f, flags = TTY_NORMAL; | 1367 | char *f, flags = TTY_NORMAL; |
1335 | int i; | 1368 | int i; |
1336 | char buf[64]; | 1369 | char buf[64]; |
1337 | unsigned long cpuflags; | 1370 | unsigned long cpuflags; |
1338 | int left; | ||
1339 | int ret = 0; | ||
1340 | 1371 | ||
1341 | if (!tty->read_buf) | 1372 | if (!tty->read_buf) |
1342 | return 0; | 1373 | return; |
1343 | 1374 | ||
1344 | if (tty->real_raw) { | 1375 | if (tty->real_raw) { |
1345 | spin_lock_irqsave(&tty->read_lock, cpuflags); | 1376 | spin_lock_irqsave(&tty->read_lock, cpuflags); |
@@ -1349,7 +1380,6 @@ static unsigned int n_tty_receive_buf(struct tty_struct *tty, | |||
1349 | memcpy(tty->read_buf + tty->read_head, cp, i); | 1380 | memcpy(tty->read_buf + tty->read_head, cp, i); |
1350 | tty->read_head = (tty->read_head + i) & (N_TTY_BUF_SIZE-1); | 1381 | tty->read_head = (tty->read_head + i) & (N_TTY_BUF_SIZE-1); |
1351 | tty->read_cnt += i; | 1382 | tty->read_cnt += i; |
1352 | ret += i; | ||
1353 | cp += i; | 1383 | cp += i; |
1354 | count -= i; | 1384 | count -= i; |
1355 | 1385 | ||
@@ -1359,10 +1389,8 @@ static unsigned int n_tty_receive_buf(struct tty_struct *tty, | |||
1359 | memcpy(tty->read_buf + tty->read_head, cp, i); | 1389 | memcpy(tty->read_buf + tty->read_head, cp, i); |
1360 | tty->read_head = (tty->read_head + i) & (N_TTY_BUF_SIZE-1); | 1390 | tty->read_head = (tty->read_head + i) & (N_TTY_BUF_SIZE-1); |
1361 | tty->read_cnt += i; | 1391 | tty->read_cnt += i; |
1362 | ret += i; | ||
1363 | spin_unlock_irqrestore(&tty->read_lock, cpuflags); | 1392 | spin_unlock_irqrestore(&tty->read_lock, cpuflags); |
1364 | } else { | 1393 | } else { |
1365 | ret = count; | ||
1366 | for (i = count, p = cp, f = fp; i; i--, p++) { | 1394 | for (i = count, p = cp, f = fp; i; i--, p++) { |
1367 | if (f) | 1395 | if (f) |
1368 | flags = *f++; | 1396 | flags = *f++; |
@@ -1390,6 +1418,8 @@ static unsigned int n_tty_receive_buf(struct tty_struct *tty, | |||
1390 | tty->ops->flush_chars(tty); | 1418 | tty->ops->flush_chars(tty); |
1391 | } | 1419 | } |
1392 | 1420 | ||
1421 | n_tty_set_room(tty); | ||
1422 | |||
1393 | if ((!tty->icanon && (tty->read_cnt >= tty->minimum_to_wake)) || | 1423 | if ((!tty->icanon && (tty->read_cnt >= tty->minimum_to_wake)) || |
1394 | L_EXTPROC(tty)) { | 1424 | L_EXTPROC(tty)) { |
1395 | kill_fasync(&tty->fasync, SIGIO, POLL_IN); | 1425 | kill_fasync(&tty->fasync, SIGIO, POLL_IN); |
@@ -1402,12 +1432,8 @@ static unsigned int n_tty_receive_buf(struct tty_struct *tty, | |||
1402 | * mode. We don't want to throttle the driver if we're in | 1432 | * mode. We don't want to throttle the driver if we're in |
1403 | * canonical mode and don't have a newline yet! | 1433 | * canonical mode and don't have a newline yet! |
1404 | */ | 1434 | */ |
1405 | left = N_TTY_BUF_SIZE - tty->read_cnt - 1; | 1435 | if (tty->receive_room < TTY_THRESHOLD_THROTTLE) |
1406 | |||
1407 | if (left < TTY_THRESHOLD_THROTTLE) | ||
1408 | tty_throttle(tty); | 1436 | tty_throttle(tty); |
1409 | |||
1410 | return ret; | ||
1411 | } | 1437 | } |
1412 | 1438 | ||
1413 | int is_ignored(int sig) | 1439 | int is_ignored(int sig) |
@@ -1451,6 +1477,7 @@ static void n_tty_set_termios(struct tty_struct *tty, struct ktermios *old) | |||
1451 | if (test_bit(TTY_HW_COOK_IN, &tty->flags)) { | 1477 | if (test_bit(TTY_HW_COOK_IN, &tty->flags)) { |
1452 | tty->raw = 1; | 1478 | tty->raw = 1; |
1453 | tty->real_raw = 1; | 1479 | tty->real_raw = 1; |
1480 | n_tty_set_room(tty); | ||
1454 | return; | 1481 | return; |
1455 | } | 1482 | } |
1456 | if (I_ISTRIP(tty) || I_IUCLC(tty) || I_IGNCR(tty) || | 1483 | if (I_ISTRIP(tty) || I_IUCLC(tty) || I_IGNCR(tty) || |
@@ -1503,6 +1530,7 @@ static void n_tty_set_termios(struct tty_struct *tty, struct ktermios *old) | |||
1503 | else | 1530 | else |
1504 | tty->real_raw = 0; | 1531 | tty->real_raw = 0; |
1505 | } | 1532 | } |
1533 | n_tty_set_room(tty); | ||
1506 | /* The termios change make the tty ready for I/O */ | 1534 | /* The termios change make the tty ready for I/O */ |
1507 | wake_up_interruptible(&tty->write_wait); | 1535 | wake_up_interruptible(&tty->write_wait); |
1508 | wake_up_interruptible(&tty->read_wait); | 1536 | wake_up_interruptible(&tty->read_wait); |
@@ -1784,6 +1812,8 @@ do_it_again: | |||
1784 | retval = -ERESTARTSYS; | 1812 | retval = -ERESTARTSYS; |
1785 | break; | 1813 | break; |
1786 | } | 1814 | } |
1815 | /* FIXME: does n_tty_set_room need locking ? */ | ||
1816 | n_tty_set_room(tty); | ||
1787 | timeout = schedule_timeout(timeout); | 1817 | timeout = schedule_timeout(timeout); |
1788 | continue; | 1818 | continue; |
1789 | } | 1819 | } |
@@ -1855,8 +1885,10 @@ do_it_again: | |||
1855 | * longer than TTY_THRESHOLD_UNTHROTTLE in canonical mode, | 1885 | * longer than TTY_THRESHOLD_UNTHROTTLE in canonical mode, |
1856 | * we won't get any more characters. | 1886 | * we won't get any more characters. |
1857 | */ | 1887 | */ |
1858 | if (n_tty_chars_in_buffer(tty) <= TTY_THRESHOLD_UNTHROTTLE) | 1888 | if (n_tty_chars_in_buffer(tty) <= TTY_THRESHOLD_UNTHROTTLE) { |
1889 | n_tty_set_room(tty); | ||
1859 | check_unthrottle(tty); | 1890 | check_unthrottle(tty); |
1891 | } | ||
1860 | 1892 | ||
1861 | if (b - buf >= minimum) | 1893 | if (b - buf >= minimum) |
1862 | break; | 1894 | break; |
@@ -1878,6 +1910,7 @@ do_it_again: | |||
1878 | } else if (test_and_clear_bit(TTY_PUSH, &tty->flags)) | 1910 | } else if (test_and_clear_bit(TTY_PUSH, &tty->flags)) |
1879 | goto do_it_again; | 1911 | goto do_it_again; |
1880 | 1912 | ||
1913 | n_tty_set_room(tty); | ||
1881 | return retval; | 1914 | return retval; |
1882 | } | 1915 | } |
1883 | 1916 | ||
diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c index 46de2e075dac..f1a7918d71aa 100644 --- a/drivers/tty/tty_buffer.c +++ b/drivers/tty/tty_buffer.c | |||
@@ -416,7 +416,6 @@ static void flush_to_ldisc(struct work_struct *work) | |||
416 | struct tty_buffer *head, *tail = tty->buf.tail; | 416 | struct tty_buffer *head, *tail = tty->buf.tail; |
417 | int seen_tail = 0; | 417 | int seen_tail = 0; |
418 | while ((head = tty->buf.head) != NULL) { | 418 | while ((head = tty->buf.head) != NULL) { |
419 | int copied; | ||
420 | int count; | 419 | int count; |
421 | char *char_buf; | 420 | char *char_buf; |
422 | unsigned char *flag_buf; | 421 | unsigned char *flag_buf; |
@@ -443,19 +442,17 @@ static void flush_to_ldisc(struct work_struct *work) | |||
443 | line discipline as we want to empty the queue */ | 442 | line discipline as we want to empty the queue */ |
444 | if (test_bit(TTY_FLUSHPENDING, &tty->flags)) | 443 | if (test_bit(TTY_FLUSHPENDING, &tty->flags)) |
445 | break; | 444 | break; |
445 | if (!tty->receive_room || seen_tail) | ||
446 | break; | ||
447 | if (count > tty->receive_room) | ||
448 | count = tty->receive_room; | ||
446 | char_buf = head->char_buf_ptr + head->read; | 449 | char_buf = head->char_buf_ptr + head->read; |
447 | flag_buf = head->flag_buf_ptr + head->read; | 450 | flag_buf = head->flag_buf_ptr + head->read; |
451 | head->read += count; | ||
448 | spin_unlock_irqrestore(&tty->buf.lock, flags); | 452 | spin_unlock_irqrestore(&tty->buf.lock, flags); |
449 | copied = disc->ops->receive_buf(tty, char_buf, | 453 | disc->ops->receive_buf(tty, char_buf, |
450 | flag_buf, count); | 454 | flag_buf, count); |
451 | spin_lock_irqsave(&tty->buf.lock, flags); | 455 | spin_lock_irqsave(&tty->buf.lock, flags); |
452 | |||
453 | head->read += copied; | ||
454 | |||
455 | if (copied == 0 || seen_tail) { | ||
456 | schedule_work(&tty->buf.work); | ||
457 | break; | ||
458 | } | ||
459 | } | 456 | } |
460 | clear_bit(TTY_FLUSHING, &tty->flags); | 457 | clear_bit(TTY_FLUSHING, &tty->flags); |
461 | } | 458 | } |
diff --git a/drivers/tty/vt/selection.c b/drivers/tty/vt/selection.c index 67b1d0d7c8ac..fb864e7fcd13 100644 --- a/drivers/tty/vt/selection.c +++ b/drivers/tty/vt/selection.c | |||
@@ -332,7 +332,8 @@ int paste_selection(struct tty_struct *tty) | |||
332 | continue; | 332 | continue; |
333 | } | 333 | } |
334 | count = sel_buffer_lth - pasted; | 334 | count = sel_buffer_lth - pasted; |
335 | count = tty->ldisc->ops->receive_buf(tty, sel_buffer + pasted, | 335 | count = min(count, tty->receive_room); |
336 | tty->ldisc->ops->receive_buf(tty, sel_buffer + pasted, | ||
336 | NULL, count); | 337 | NULL, count); |
337 | pasted += count; | 338 | pasted += count; |
338 | } | 339 | } |
diff --git a/fs/block_dev.c b/fs/block_dev.c index 1f2b19978333..1a2421f908f0 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c | |||
@@ -1272,8 +1272,8 @@ int blkdev_get(struct block_device *bdev, fmode_t mode, void *holder) | |||
1272 | * individual writeable reference is too fragile given the | 1272 | * individual writeable reference is too fragile given the |
1273 | * way @mode is used in blkdev_get/put(). | 1273 | * way @mode is used in blkdev_get/put(). |
1274 | */ | 1274 | */ |
1275 | if ((disk->flags & GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE) && | 1275 | if (!res && (mode & FMODE_WRITE) && !bdev->bd_write_holder && |
1276 | !res && (mode & FMODE_WRITE) && !bdev->bd_write_holder) { | 1276 | (disk->flags & GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE)) { |
1277 | bdev->bd_write_holder = true; | 1277 | bdev->bd_write_holder = true; |
1278 | disk_block_events(disk); | 1278 | disk_block_events(disk); |
1279 | } | 1279 | } |
diff --git a/fs/partitions/check.c b/fs/partitions/check.c index f82e762eeca2..d545e97d99c3 100644 --- a/fs/partitions/check.c +++ b/fs/partitions/check.c | |||
@@ -255,13 +255,7 @@ ssize_t part_discard_alignment_show(struct device *dev, | |||
255 | struct device_attribute *attr, char *buf) | 255 | struct device_attribute *attr, char *buf) |
256 | { | 256 | { |
257 | struct hd_struct *p = dev_to_part(dev); | 257 | struct hd_struct *p = dev_to_part(dev); |
258 | struct gendisk *disk = dev_to_disk(dev); | 258 | return sprintf(buf, "%u\n", p->discard_alignment); |
259 | unsigned int alignment = 0; | ||
260 | |||
261 | if (disk->queue) | ||
262 | alignment = queue_limit_discard_alignment(&disk->queue->limits, | ||
263 | p->start_sect); | ||
264 | return sprintf(buf, "%u\n", alignment); | ||
265 | } | 259 | } |
266 | 260 | ||
267 | ssize_t part_stat_show(struct device *dev, | 261 | ssize_t part_stat_show(struct device *dev, |
@@ -455,6 +449,8 @@ struct hd_struct *add_partition(struct gendisk *disk, int partno, | |||
455 | p->start_sect = start; | 449 | p->start_sect = start; |
456 | p->alignment_offset = | 450 | p->alignment_offset = |
457 | queue_limit_alignment_offset(&disk->queue->limits, start); | 451 | queue_limit_alignment_offset(&disk->queue->limits, start); |
452 | p->discard_alignment = | ||
453 | queue_limit_discard_alignment(&disk->queue->limits, start); | ||
458 | p->nr_sects = len; | 454 | p->nr_sects = len; |
459 | p->partno = partno; | 455 | p->partno = partno; |
460 | p->policy = get_disk_ro(disk); | 456 | p->policy = get_disk_ro(disk); |
diff --git a/fs/ubifs/io.c b/fs/ubifs/io.c index 166951e0dcd3..3be645e012c9 100644 --- a/fs/ubifs/io.c +++ b/fs/ubifs/io.c | |||
@@ -581,6 +581,7 @@ int ubifs_wbuf_write_nolock(struct ubifs_wbuf *wbuf, void *buf, int len) | |||
581 | ubifs_assert(wbuf->size % c->min_io_size == 0); | 581 | ubifs_assert(wbuf->size % c->min_io_size == 0); |
582 | ubifs_assert(mutex_is_locked(&wbuf->io_mutex)); | 582 | ubifs_assert(mutex_is_locked(&wbuf->io_mutex)); |
583 | ubifs_assert(!c->ro_media && !c->ro_mount); | 583 | ubifs_assert(!c->ro_media && !c->ro_mount); |
584 | ubifs_assert(!c->space_fixup); | ||
584 | if (c->leb_size - wbuf->offs >= c->max_write_size) | 585 | if (c->leb_size - wbuf->offs >= c->max_write_size) |
585 | ubifs_assert(!((wbuf->offs + wbuf->size) % c->max_write_size)); | 586 | ubifs_assert(!((wbuf->offs + wbuf->size) % c->max_write_size)); |
586 | 587 | ||
@@ -759,6 +760,7 @@ int ubifs_write_node(struct ubifs_info *c, void *buf, int len, int lnum, | |||
759 | ubifs_assert(lnum >= 0 && lnum < c->leb_cnt && offs >= 0); | 760 | ubifs_assert(lnum >= 0 && lnum < c->leb_cnt && offs >= 0); |
760 | ubifs_assert(offs % c->min_io_size == 0 && offs < c->leb_size); | 761 | ubifs_assert(offs % c->min_io_size == 0 && offs < c->leb_size); |
761 | ubifs_assert(!c->ro_media && !c->ro_mount); | 762 | ubifs_assert(!c->ro_media && !c->ro_mount); |
763 | ubifs_assert(!c->space_fixup); | ||
762 | 764 | ||
763 | if (c->ro_error) | 765 | if (c->ro_error) |
764 | return -EROFS; | 766 | return -EROFS; |
diff --git a/fs/ubifs/journal.c b/fs/ubifs/journal.c index 34b1679e6e3a..cef0460f4c54 100644 --- a/fs/ubifs/journal.c +++ b/fs/ubifs/journal.c | |||
@@ -669,6 +669,7 @@ out_free: | |||
669 | 669 | ||
670 | out_release: | 670 | out_release: |
671 | release_head(c, BASEHD); | 671 | release_head(c, BASEHD); |
672 | kfree(dent); | ||
672 | out_ro: | 673 | out_ro: |
673 | ubifs_ro_mode(c, err); | 674 | ubifs_ro_mode(c, err); |
674 | if (last_reference) | 675 | if (last_reference) |
diff --git a/fs/ubifs/orphan.c b/fs/ubifs/orphan.c index bd644bf587a8..a5422fffbd69 100644 --- a/fs/ubifs/orphan.c +++ b/fs/ubifs/orphan.c | |||
@@ -674,7 +674,7 @@ static int kill_orphans(struct ubifs_info *c) | |||
674 | if (IS_ERR(sleb)) { | 674 | if (IS_ERR(sleb)) { |
675 | if (PTR_ERR(sleb) == -EUCLEAN) | 675 | if (PTR_ERR(sleb) == -EUCLEAN) |
676 | sleb = ubifs_recover_leb(c, lnum, 0, | 676 | sleb = ubifs_recover_leb(c, lnum, 0, |
677 | c->sbuf, 0); | 677 | c->sbuf, -1); |
678 | if (IS_ERR(sleb)) { | 678 | if (IS_ERR(sleb)) { |
679 | err = PTR_ERR(sleb); | 679 | err = PTR_ERR(sleb); |
680 | break; | 680 | break; |
diff --git a/fs/ubifs/recovery.c b/fs/ubifs/recovery.c index 731d9e2e7b50..783d8e0beb76 100644 --- a/fs/ubifs/recovery.c +++ b/fs/ubifs/recovery.c | |||
@@ -564,19 +564,15 @@ static int fix_unclean_leb(struct ubifs_info *c, struct ubifs_scan_leb *sleb, | |||
564 | } | 564 | } |
565 | 565 | ||
566 | /** | 566 | /** |
567 | * drop_last_node - drop the last node or group of nodes. | 567 | * drop_last_group - drop the last group of nodes. |
568 | * @sleb: scanned LEB information | 568 | * @sleb: scanned LEB information |
569 | * @offs: offset of dropped nodes is returned here | 569 | * @offs: offset of dropped nodes is returned here |
570 | * @grouped: non-zero if whole group of nodes have to be dropped | ||
571 | * | 570 | * |
572 | * This is a helper function for 'ubifs_recover_leb()' which drops the last | 571 | * This is a helper function for 'ubifs_recover_leb()' which drops the last |
573 | * node of the scanned LEB or the last group of nodes if @grouped is not zero. | 572 | * group of nodes of the scanned LEB. |
574 | * This function returns %1 if a node was dropped and %0 otherwise. | ||
575 | */ | 573 | */ |
576 | static int drop_last_node(struct ubifs_scan_leb *sleb, int *offs, int grouped) | 574 | static void drop_last_group(struct ubifs_scan_leb *sleb, int *offs) |
577 | { | 575 | { |
578 | int dropped = 0; | ||
579 | |||
580 | while (!list_empty(&sleb->nodes)) { | 576 | while (!list_empty(&sleb->nodes)) { |
581 | struct ubifs_scan_node *snod; | 577 | struct ubifs_scan_node *snod; |
582 | struct ubifs_ch *ch; | 578 | struct ubifs_ch *ch; |
@@ -585,17 +581,40 @@ static int drop_last_node(struct ubifs_scan_leb *sleb, int *offs, int grouped) | |||
585 | list); | 581 | list); |
586 | ch = snod->node; | 582 | ch = snod->node; |
587 | if (ch->group_type != UBIFS_IN_NODE_GROUP) | 583 | if (ch->group_type != UBIFS_IN_NODE_GROUP) |
588 | return dropped; | 584 | break; |
589 | dbg_rcvry("dropping node at %d:%d", sleb->lnum, snod->offs); | 585 | |
586 | dbg_rcvry("dropping grouped node at %d:%d", | ||
587 | sleb->lnum, snod->offs); | ||
588 | *offs = snod->offs; | ||
589 | list_del(&snod->list); | ||
590 | kfree(snod); | ||
591 | sleb->nodes_cnt -= 1; | ||
592 | } | ||
593 | } | ||
594 | |||
595 | /** | ||
596 | * drop_last_node - drop the last node. | ||
597 | * @sleb: scanned LEB information | ||
598 | * @offs: offset of dropped nodes is returned here | ||
599 | * @grouped: non-zero if whole group of nodes have to be dropped | ||
600 | * | ||
601 | * This is a helper function for 'ubifs_recover_leb()' which drops the last | ||
602 | * node of the scanned LEB. | ||
603 | */ | ||
604 | static void drop_last_node(struct ubifs_scan_leb *sleb, int *offs) | ||
605 | { | ||
606 | struct ubifs_scan_node *snod; | ||
607 | |||
608 | if (!list_empty(&sleb->nodes)) { | ||
609 | snod = list_entry(sleb->nodes.prev, struct ubifs_scan_node, | ||
610 | list); | ||
611 | |||
612 | dbg_rcvry("dropping last node at %d:%d", sleb->lnum, snod->offs); | ||
590 | *offs = snod->offs; | 613 | *offs = snod->offs; |
591 | list_del(&snod->list); | 614 | list_del(&snod->list); |
592 | kfree(snod); | 615 | kfree(snod); |
593 | sleb->nodes_cnt -= 1; | 616 | sleb->nodes_cnt -= 1; |
594 | dropped = 1; | ||
595 | if (!grouped) | ||
596 | break; | ||
597 | } | 617 | } |
598 | return dropped; | ||
599 | } | 618 | } |
600 | 619 | ||
601 | /** | 620 | /** |
@@ -604,7 +623,8 @@ static int drop_last_node(struct ubifs_scan_leb *sleb, int *offs, int grouped) | |||
604 | * @lnum: LEB number | 623 | * @lnum: LEB number |
605 | * @offs: offset | 624 | * @offs: offset |
606 | * @sbuf: LEB-sized buffer to use | 625 | * @sbuf: LEB-sized buffer to use |
607 | * @grouped: nodes may be grouped for recovery | 626 | * @jhead: journal head number this LEB belongs to (%-1 if the LEB does not |
627 | * belong to any journal head) | ||
608 | * | 628 | * |
609 | * This function does a scan of a LEB, but caters for errors that might have | 629 | * This function does a scan of a LEB, but caters for errors that might have |
610 | * been caused by the unclean unmount from which we are attempting to recover. | 630 | * been caused by the unclean unmount from which we are attempting to recover. |
@@ -612,13 +632,14 @@ static int drop_last_node(struct ubifs_scan_leb *sleb, int *offs, int grouped) | |||
612 | * found, and a negative error code in case of failure. | 632 | * found, and a negative error code in case of failure. |
613 | */ | 633 | */ |
614 | struct ubifs_scan_leb *ubifs_recover_leb(struct ubifs_info *c, int lnum, | 634 | struct ubifs_scan_leb *ubifs_recover_leb(struct ubifs_info *c, int lnum, |
615 | int offs, void *sbuf, int grouped) | 635 | int offs, void *sbuf, int jhead) |
616 | { | 636 | { |
617 | int ret = 0, err, len = c->leb_size - offs, start = offs, min_io_unit; | 637 | int ret = 0, err, len = c->leb_size - offs, start = offs, min_io_unit; |
638 | int grouped = jhead == -1 ? 0 : c->jheads[jhead].grouped; | ||
618 | struct ubifs_scan_leb *sleb; | 639 | struct ubifs_scan_leb *sleb; |
619 | void *buf = sbuf + offs; | 640 | void *buf = sbuf + offs; |
620 | 641 | ||
621 | dbg_rcvry("%d:%d", lnum, offs); | 642 | dbg_rcvry("%d:%d, jhead %d, grouped %d", lnum, offs, jhead, grouped); |
622 | 643 | ||
623 | sleb = ubifs_start_scan(c, lnum, offs, sbuf); | 644 | sleb = ubifs_start_scan(c, lnum, offs, sbuf); |
624 | if (IS_ERR(sleb)) | 645 | if (IS_ERR(sleb)) |
@@ -635,7 +656,7 @@ struct ubifs_scan_leb *ubifs_recover_leb(struct ubifs_info *c, int lnum, | |||
635 | * Scan quietly until there is an error from which we cannot | 656 | * Scan quietly until there is an error from which we cannot |
636 | * recover | 657 | * recover |
637 | */ | 658 | */ |
638 | ret = ubifs_scan_a_node(c, buf, len, lnum, offs, 0); | 659 | ret = ubifs_scan_a_node(c, buf, len, lnum, offs, 1); |
639 | if (ret == SCANNED_A_NODE) { | 660 | if (ret == SCANNED_A_NODE) { |
640 | /* A valid node, and not a padding node */ | 661 | /* A valid node, and not a padding node */ |
641 | struct ubifs_ch *ch = buf; | 662 | struct ubifs_ch *ch = buf; |
@@ -695,59 +716,62 @@ struct ubifs_scan_leb *ubifs_recover_leb(struct ubifs_info *c, int lnum, | |||
695 | * If nodes are grouped, always drop the incomplete group at | 716 | * If nodes are grouped, always drop the incomplete group at |
696 | * the end. | 717 | * the end. |
697 | */ | 718 | */ |
698 | drop_last_node(sleb, &offs, 1); | 719 | drop_last_group(sleb, &offs); |
699 | 720 | ||
700 | /* | 721 | if (jhead == GCHD) { |
701 | * While we are in the middle of the same min. I/O unit keep dropping | 722 | /* |
702 | * nodes. So basically, what we want is to make sure that the last min. | 723 | * If this LEB belongs to the GC head then while we are in the |
703 | * I/O unit where we saw the corruption is dropped completely with all | 724 | * middle of the same min. I/O unit keep dropping nodes. So |
704 | * the uncorrupted node which may possibly sit there. | 725 | * basically, what we want is to make sure that the last min. |
705 | * | 726 | * I/O unit where we saw the corruption is dropped completely |
706 | * In other words, let's name the min. I/O unit where the corruption | 727 | * with all the uncorrupted nodes which may possibly sit there. |
707 | * starts B, and the previous min. I/O unit A. The below code tries to | 728 | * |
708 | * deal with a situation when half of B contains valid nodes or the end | 729 | * In other words, let's name the min. I/O unit where the |
709 | * of a valid node, and the second half of B contains corrupted data or | 730 | * corruption starts B, and the previous min. I/O unit A. The |
710 | * garbage. This means that UBIFS had been writing to B just before the | 731 | * below code tries to deal with a situation when half of B |
711 | * power cut happened. I do not know how realistic is this scenario | 732 | * contains valid nodes or the end of a valid node, and the |
712 | * that half of the min. I/O unit had been written successfully and the | 733 | * second half of B contains corrupted data or garbage. This |
713 | * other half not, but this is possible in our 'failure mode emulation' | 734 | * means that UBIFS had been writing to B just before the power |
714 | * infrastructure at least. | 735 | * cut happened. I do not know how realistic is this scenario |
715 | * | 736 | * that half of the min. I/O unit had been written successfully |
716 | * So what is the problem, why we need to drop those nodes? Whey can't | 737 | * and the other half not, but this is possible in our 'failure |
717 | * we just clean-up the second half of B by putting a padding node | 738 | * mode emulation' infrastructure at least. |
718 | * there? We can, and this works fine with one exception which was | 739 | * |
719 | * reproduced with power cut emulation testing and happens extremely | 740 | * So what is the problem, why we need to drop those nodes? Why |
720 | * rarely. The description follows, but it is worth noting that that is | 741 | * can't we just clean-up the second half of B by putting a |
721 | * only about the GC head, so we could do this trick only if the bud | 742 | * padding node there? We can, and this works fine with one |
722 | * belongs to the GC head, but it does not seem to be worth an | 743 | * exception which was reproduced with power cut emulation |
723 | * additional "if" statement. | 744 | * testing and happens extremely rarely. |
724 | * | 745 | * |
725 | * So, imagine the file-system is full, we run GC which is moving valid | 746 | * Imagine the file-system is full, we run GC which starts |
726 | * nodes from LEB X to LEB Y (obviously, LEB Y is the current GC head | 747 | * moving valid nodes from LEB X to LEB Y (obviously, LEB Y is |
727 | * LEB). The @c->gc_lnum is -1, which means that GC will retain LEB X | 748 | * the current GC head LEB). The @c->gc_lnum is -1, which means |
728 | * and will try to continue. Imagine that LEB X is currently the | 749 | * that GC will retain LEB X and will try to continue. Imagine |
729 | * dirtiest LEB, and the amount of used space in LEB Y is exactly the | 750 | * that LEB X is currently the dirtiest LEB, and the amount of |
730 | * same as amount of free space in LEB X. | 751 | * used space in LEB Y is exactly the same as amount of free |
731 | * | 752 | * space in LEB X. |
732 | * And a power cut happens when nodes are moved from LEB X to LEB Y. We | 753 | * |
733 | * are here trying to recover LEB Y which is the GC head LEB. We find | 754 | * And a power cut happens when nodes are moved from LEB X to |
734 | * the min. I/O unit B as described above. Then we clean-up LEB Y by | 755 | * LEB Y. We are here trying to recover LEB Y which is the GC |
735 | * padding min. I/O unit. And later 'ubifs_rcvry_gc_commit()' function | 756 | * head LEB. We find the min. I/O unit B as described above. |
736 | * fails, because it cannot find a dirty LEB which could be GC'd into | 757 | * Then we clean-up LEB Y by padding min. I/O unit. And later |
737 | * LEB Y! Even LEB X does not match because the amount of valid nodes | 758 | * 'ubifs_rcvry_gc_commit()' function fails, because it cannot |
738 | * there does not fit the free space in LEB Y any more! And this is | 759 | * find a dirty LEB which could be GC'd into LEB Y! Even LEB X |
739 | * because of the padding node which we added to LEB Y. The | 760 | * does not match because the amount of valid nodes there does |
740 | * user-visible effect of this which I once observed and analysed is | 761 | * not fit the free space in LEB Y any more! And this is |
741 | * that we cannot mount the file-system with -ENOSPC error. | 762 | * because of the padding node which we added to LEB Y. The |
742 | * | 763 | * user-visible effect of this which I once observed and |
743 | * So obviously, to make sure that situation does not happen we should | 764 | * analysed is that we cannot mount the file-system with |
744 | * free min. I/O unit B in LEB Y completely and the last used min. I/O | 765 | * -ENOSPC error. |
745 | * unit in LEB Y should be A. This is basically what the below code | 766 | * |
746 | * tries to do. | 767 | * So obviously, to make sure that situation does not happen we |
747 | */ | 768 | * should free min. I/O unit B in LEB Y completely and the last |
748 | while (min_io_unit == round_down(offs, c->min_io_size) && | 769 | * used min. I/O unit in LEB Y should be A. This is basically |
749 | min_io_unit != offs && | 770 | * what the below code tries to do. |
750 | drop_last_node(sleb, &offs, grouped)); | 771 | */ |
772 | while (offs > min_io_unit) | ||
773 | drop_last_node(sleb, &offs); | ||
774 | } | ||
751 | 775 | ||
752 | buf = sbuf + offs; | 776 | buf = sbuf + offs; |
753 | len = c->leb_size - offs; | 777 | len = c->leb_size - offs; |
@@ -881,7 +905,7 @@ struct ubifs_scan_leb *ubifs_recover_log_leb(struct ubifs_info *c, int lnum, | |||
881 | } | 905 | } |
882 | ubifs_scan_destroy(sleb); | 906 | ubifs_scan_destroy(sleb); |
883 | } | 907 | } |
884 | return ubifs_recover_leb(c, lnum, offs, sbuf, 0); | 908 | return ubifs_recover_leb(c, lnum, offs, sbuf, -1); |
885 | } | 909 | } |
886 | 910 | ||
887 | /** | 911 | /** |
diff --git a/fs/ubifs/replay.c b/fs/ubifs/replay.c index 6617280d1679..5e97161ce4d3 100644 --- a/fs/ubifs/replay.c +++ b/fs/ubifs/replay.c | |||
@@ -557,8 +557,7 @@ static int replay_bud(struct ubifs_info *c, struct bud_entry *b) | |||
557 | * these LEBs could possibly be written to at the power cut | 557 | * these LEBs could possibly be written to at the power cut |
558 | * time. | 558 | * time. |
559 | */ | 559 | */ |
560 | sleb = ubifs_recover_leb(c, lnum, offs, c->sbuf, | 560 | sleb = ubifs_recover_leb(c, lnum, offs, c->sbuf, b->bud->jhead); |
561 | b->bud->jhead != GCHD); | ||
562 | else | 561 | else |
563 | sleb = ubifs_scan(c, lnum, offs, c->sbuf, 0); | 562 | sleb = ubifs_scan(c, lnum, offs, c->sbuf, 0); |
564 | if (IS_ERR(sleb)) | 563 | if (IS_ERR(sleb)) |
diff --git a/fs/ubifs/shrinker.c b/fs/ubifs/shrinker.c index ca953a945029..9e1d05666fed 100644 --- a/fs/ubifs/shrinker.c +++ b/fs/ubifs/shrinker.c | |||
@@ -284,7 +284,11 @@ int ubifs_shrinker(struct shrinker *shrink, struct shrink_control *sc) | |||
284 | long clean_zn_cnt = atomic_long_read(&ubifs_clean_zn_cnt); | 284 | long clean_zn_cnt = atomic_long_read(&ubifs_clean_zn_cnt); |
285 | 285 | ||
286 | if (nr == 0) | 286 | if (nr == 0) |
287 | return clean_zn_cnt; | 287 | /* |
288 | * Due to the way UBIFS updates the clean znode counter it may | ||
289 | * temporarily be negative. | ||
290 | */ | ||
291 | return clean_zn_cnt >= 0 ? clean_zn_cnt : 1; | ||
288 | 292 | ||
289 | if (!clean_zn_cnt) { | 293 | if (!clean_zn_cnt) { |
290 | /* | 294 | /* |
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index 1ab0d22e4c94..b5aeb5a8ebed 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c | |||
@@ -811,15 +811,18 @@ static int alloc_wbufs(struct ubifs_info *c) | |||
811 | 811 | ||
812 | c->jheads[i].wbuf.sync_callback = &bud_wbuf_callback; | 812 | c->jheads[i].wbuf.sync_callback = &bud_wbuf_callback; |
813 | c->jheads[i].wbuf.jhead = i; | 813 | c->jheads[i].wbuf.jhead = i; |
814 | c->jheads[i].grouped = 1; | ||
814 | } | 815 | } |
815 | 816 | ||
816 | c->jheads[BASEHD].wbuf.dtype = UBI_SHORTTERM; | 817 | c->jheads[BASEHD].wbuf.dtype = UBI_SHORTTERM; |
817 | /* | 818 | /* |
818 | * Garbage Collector head likely contains long-term data and | 819 | * Garbage Collector head likely contains long-term data and |
819 | * does not need to be synchronized by timer. | 820 | * does not need to be synchronized by timer. Also GC head nodes are |
821 | * not grouped. | ||
820 | */ | 822 | */ |
821 | c->jheads[GCHD].wbuf.dtype = UBI_LONGTERM; | 823 | c->jheads[GCHD].wbuf.dtype = UBI_LONGTERM; |
822 | c->jheads[GCHD].wbuf.no_timer = 1; | 824 | c->jheads[GCHD].wbuf.no_timer = 1; |
825 | c->jheads[GCHD].grouped = 0; | ||
823 | 826 | ||
824 | return 0; | 827 | return 0; |
825 | } | 828 | } |
@@ -1284,12 +1287,25 @@ static int mount_ubifs(struct ubifs_info *c) | |||
1284 | if ((c->mst_node->flags & cpu_to_le32(UBIFS_MST_DIRTY)) != 0) { | 1287 | if ((c->mst_node->flags & cpu_to_le32(UBIFS_MST_DIRTY)) != 0) { |
1285 | ubifs_msg("recovery needed"); | 1288 | ubifs_msg("recovery needed"); |
1286 | c->need_recovery = 1; | 1289 | c->need_recovery = 1; |
1287 | if (!c->ro_mount) { | 1290 | } |
1288 | err = ubifs_recover_inl_heads(c, c->sbuf); | 1291 | |
1289 | if (err) | 1292 | if (c->need_recovery && !c->ro_mount) { |
1290 | goto out_master; | 1293 | err = ubifs_recover_inl_heads(c, c->sbuf); |
1291 | } | 1294 | if (err) |
1292 | } else if (!c->ro_mount) { | 1295 | goto out_master; |
1296 | } | ||
1297 | |||
1298 | err = ubifs_lpt_init(c, 1, !c->ro_mount); | ||
1299 | if (err) | ||
1300 | goto out_master; | ||
1301 | |||
1302 | if (!c->ro_mount && c->space_fixup) { | ||
1303 | err = ubifs_fixup_free_space(c); | ||
1304 | if (err) | ||
1305 | goto out_master; | ||
1306 | } | ||
1307 | |||
1308 | if (!c->ro_mount) { | ||
1293 | /* | 1309 | /* |
1294 | * Set the "dirty" flag so that if we reboot uncleanly we | 1310 | * Set the "dirty" flag so that if we reboot uncleanly we |
1295 | * will notice this immediately on the next mount. | 1311 | * will notice this immediately on the next mount. |
@@ -1297,13 +1313,9 @@ static int mount_ubifs(struct ubifs_info *c) | |||
1297 | c->mst_node->flags |= cpu_to_le32(UBIFS_MST_DIRTY); | 1313 | c->mst_node->flags |= cpu_to_le32(UBIFS_MST_DIRTY); |
1298 | err = ubifs_write_master(c); | 1314 | err = ubifs_write_master(c); |
1299 | if (err) | 1315 | if (err) |
1300 | goto out_master; | 1316 | goto out_lpt; |
1301 | } | 1317 | } |
1302 | 1318 | ||
1303 | err = ubifs_lpt_init(c, 1, !c->ro_mount); | ||
1304 | if (err) | ||
1305 | goto out_lpt; | ||
1306 | |||
1307 | err = dbg_check_idx_size(c, c->bi.old_idx_sz); | 1319 | err = dbg_check_idx_size(c, c->bi.old_idx_sz); |
1308 | if (err) | 1320 | if (err) |
1309 | goto out_lpt; | 1321 | goto out_lpt; |
@@ -1396,12 +1408,6 @@ static int mount_ubifs(struct ubifs_info *c) | |||
1396 | } else | 1408 | } else |
1397 | ubifs_assert(c->lst.taken_empty_lebs > 0); | 1409 | ubifs_assert(c->lst.taken_empty_lebs > 0); |
1398 | 1410 | ||
1399 | if (!c->ro_mount && c->space_fixup) { | ||
1400 | err = ubifs_fixup_free_space(c); | ||
1401 | if (err) | ||
1402 | goto out_infos; | ||
1403 | } | ||
1404 | |||
1405 | err = dbg_check_filesystem(c); | 1411 | err = dbg_check_filesystem(c); |
1406 | if (err) | 1412 | if (err) |
1407 | goto out_infos; | 1413 | goto out_infos; |
diff --git a/fs/ubifs/tnc.c b/fs/ubifs/tnc.c index 8119b1fd8d94..91b4213dde84 100644 --- a/fs/ubifs/tnc.c +++ b/fs/ubifs/tnc.c | |||
@@ -2876,12 +2876,13 @@ static void tnc_destroy_cnext(struct ubifs_info *c) | |||
2876 | */ | 2876 | */ |
2877 | void ubifs_tnc_close(struct ubifs_info *c) | 2877 | void ubifs_tnc_close(struct ubifs_info *c) |
2878 | { | 2878 | { |
2879 | long clean_freed; | ||
2880 | |||
2881 | tnc_destroy_cnext(c); | 2879 | tnc_destroy_cnext(c); |
2882 | if (c->zroot.znode) { | 2880 | if (c->zroot.znode) { |
2883 | clean_freed = ubifs_destroy_tnc_subtree(c->zroot.znode); | 2881 | long n; |
2884 | atomic_long_sub(clean_freed, &ubifs_clean_zn_cnt); | 2882 | |
2883 | ubifs_destroy_tnc_subtree(c->zroot.znode); | ||
2884 | n = atomic_long_read(&c->clean_zn_cnt); | ||
2885 | atomic_long_sub(n, &ubifs_clean_zn_cnt); | ||
2885 | } | 2886 | } |
2886 | kfree(c->gap_lebs); | 2887 | kfree(c->gap_lebs); |
2887 | kfree(c->ilebs); | 2888 | kfree(c->ilebs); |
diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h index a70d7b4ffb25..f79983d6f860 100644 --- a/fs/ubifs/ubifs.h +++ b/fs/ubifs/ubifs.h | |||
@@ -722,12 +722,14 @@ struct ubifs_bud { | |||
722 | * struct ubifs_jhead - journal head. | 722 | * struct ubifs_jhead - journal head. |
723 | * @wbuf: head's write-buffer | 723 | * @wbuf: head's write-buffer |
724 | * @buds_list: list of bud LEBs belonging to this journal head | 724 | * @buds_list: list of bud LEBs belonging to this journal head |
725 | * @grouped: non-zero if UBIFS groups nodes when writing to this journal head | ||
725 | * | 726 | * |
726 | * Note, the @buds list is protected by the @c->buds_lock. | 727 | * Note, the @buds list is protected by the @c->buds_lock. |
727 | */ | 728 | */ |
728 | struct ubifs_jhead { | 729 | struct ubifs_jhead { |
729 | struct ubifs_wbuf wbuf; | 730 | struct ubifs_wbuf wbuf; |
730 | struct list_head buds_list; | 731 | struct list_head buds_list; |
732 | unsigned int grouped:1; | ||
731 | }; | 733 | }; |
732 | 734 | ||
733 | /** | 735 | /** |
@@ -1742,7 +1744,7 @@ struct inode *ubifs_iget(struct super_block *sb, unsigned long inum); | |||
1742 | int ubifs_recover_master_node(struct ubifs_info *c); | 1744 | int ubifs_recover_master_node(struct ubifs_info *c); |
1743 | int ubifs_write_rcvrd_mst_node(struct ubifs_info *c); | 1745 | int ubifs_write_rcvrd_mst_node(struct ubifs_info *c); |
1744 | struct ubifs_scan_leb *ubifs_recover_leb(struct ubifs_info *c, int lnum, | 1746 | struct ubifs_scan_leb *ubifs_recover_leb(struct ubifs_info *c, int lnum, |
1745 | int offs, void *sbuf, int grouped); | 1747 | int offs, void *sbuf, int jhead); |
1746 | struct ubifs_scan_leb *ubifs_recover_log_leb(struct ubifs_info *c, int lnum, | 1748 | struct ubifs_scan_leb *ubifs_recover_log_leb(struct ubifs_info *c, int lnum, |
1747 | int offs, void *sbuf); | 1749 | int offs, void *sbuf); |
1748 | int ubifs_recover_inl_heads(const struct ubifs_info *c, void *sbuf); | 1750 | int ubifs_recover_inl_heads(const struct ubifs_info *c, void *sbuf); |
diff --git a/include/asm-generic/unistd.h b/include/asm-generic/unistd.h index ae90e0f63995..4f76959397fa 100644 --- a/include/asm-generic/unistd.h +++ b/include/asm-generic/unistd.h | |||
@@ -683,9 +683,11 @@ __SC_COMP(__NR_clock_adjtime, sys_clock_adjtime, compat_sys_clock_adjtime) | |||
683 | __SYSCALL(__NR_syncfs, sys_syncfs) | 683 | __SYSCALL(__NR_syncfs, sys_syncfs) |
684 | #define __NR_setns 268 | 684 | #define __NR_setns 268 |
685 | __SYSCALL(__NR_setns, sys_setns) | 685 | __SYSCALL(__NR_setns, sys_setns) |
686 | #define __NR_sendmmsg 269 | ||
687 | __SC_COMP(__NR_sendmmsg, sys_sendmmsg, compat_sys_sendmmsg) | ||
686 | 688 | ||
687 | #undef __NR_syscalls | 689 | #undef __NR_syscalls |
688 | #define __NR_syscalls 269 | 690 | #define __NR_syscalls 270 |
689 | 691 | ||
690 | /* | 692 | /* |
691 | * All syscalls below here should go away really, | 693 | * All syscalls below here should go away really, |
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index ae9091a68480..1a23722e8878 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -1282,8 +1282,8 @@ queue_max_integrity_segments(struct request_queue *q) | |||
1282 | #define blk_get_integrity(a) (0) | 1282 | #define blk_get_integrity(a) (0) |
1283 | #define blk_integrity_compare(a, b) (0) | 1283 | #define blk_integrity_compare(a, b) (0) |
1284 | #define blk_integrity_register(a, b) (0) | 1284 | #define blk_integrity_register(a, b) (0) |
1285 | #define blk_integrity_unregister(a) do { } while (0); | 1285 | #define blk_integrity_unregister(a) do { } while (0) |
1286 | #define blk_queue_max_integrity_segments(a, b) do { } while (0); | 1286 | #define blk_queue_max_integrity_segments(a, b) do { } while (0) |
1287 | #define queue_max_integrity_segments(a) (0) | 1287 | #define queue_max_integrity_segments(a) (0) |
1288 | #define blk_integrity_merge_rq(a, b, c) (0) | 1288 | #define blk_integrity_merge_rq(a, b, c) (0) |
1289 | #define blk_integrity_merge_bio(a, b, c) (0) | 1289 | #define blk_integrity_merge_bio(a, b, c) (0) |
diff --git a/include/linux/dma_remapping.h b/include/linux/dma_remapping.h index 5619f8522738..bbd8661b3473 100644 --- a/include/linux/dma_remapping.h +++ b/include/linux/dma_remapping.h | |||
@@ -9,8 +9,12 @@ | |||
9 | #define VTD_PAGE_MASK (((u64)-1) << VTD_PAGE_SHIFT) | 9 | #define VTD_PAGE_MASK (((u64)-1) << VTD_PAGE_SHIFT) |
10 | #define VTD_PAGE_ALIGN(addr) (((addr) + VTD_PAGE_SIZE - 1) & VTD_PAGE_MASK) | 10 | #define VTD_PAGE_ALIGN(addr) (((addr) + VTD_PAGE_SIZE - 1) & VTD_PAGE_MASK) |
11 | 11 | ||
12 | #define VTD_STRIDE_SHIFT (9) | ||
13 | #define VTD_STRIDE_MASK (((u64)-1) << VTD_STRIDE_SHIFT) | ||
14 | |||
12 | #define DMA_PTE_READ (1) | 15 | #define DMA_PTE_READ (1) |
13 | #define DMA_PTE_WRITE (2) | 16 | #define DMA_PTE_WRITE (2) |
17 | #define DMA_PTE_LARGE_PAGE (1 << 7) | ||
14 | #define DMA_PTE_SNP (1 << 11) | 18 | #define DMA_PTE_SNP (1 << 11) |
15 | 19 | ||
16 | #define CONTEXT_TT_MULTI_LEVEL 0 | 20 | #define CONTEXT_TT_MULTI_LEVEL 0 |
diff --git a/include/linux/genhd.h b/include/linux/genhd.h index b78956b3c2e7..300d7582006e 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h | |||
@@ -100,6 +100,7 @@ struct hd_struct { | |||
100 | sector_t start_sect; | 100 | sector_t start_sect; |
101 | sector_t nr_sects; | 101 | sector_t nr_sects; |
102 | sector_t alignment_offset; | 102 | sector_t alignment_offset; |
103 | unsigned int discard_alignment; | ||
103 | struct device __dev; | 104 | struct device __dev; |
104 | struct kobject *holder_dir; | 105 | struct kobject *holder_dir; |
105 | int policy, partno; | 106 | int policy, partno; |
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h index b2eee5879883..bf56b6f78270 100644 --- a/include/linux/ieee80211.h +++ b/include/linux/ieee80211.h | |||
@@ -1003,8 +1003,12 @@ struct ieee80211_ht_info { | |||
1003 | #define WLAN_CAPABILITY_ESS (1<<0) | 1003 | #define WLAN_CAPABILITY_ESS (1<<0) |
1004 | #define WLAN_CAPABILITY_IBSS (1<<1) | 1004 | #define WLAN_CAPABILITY_IBSS (1<<1) |
1005 | 1005 | ||
1006 | /* A mesh STA sets the ESS and IBSS capability bits to zero */ | 1006 | /* |
1007 | #define WLAN_CAPABILITY_IS_MBSS(cap) \ | 1007 | * A mesh STA sets the ESS and IBSS capability bits to zero. |
1008 | * however, this holds true for p2p probe responses (in the p2p_find | ||
1009 | * phase) as well. | ||
1010 | */ | ||
1011 | #define WLAN_CAPABILITY_IS_STA_BSS(cap) \ | ||
1008 | (!((cap) & (WLAN_CAPABILITY_ESS | WLAN_CAPABILITY_IBSS))) | 1012 | (!((cap) & (WLAN_CAPABILITY_ESS | WLAN_CAPABILITY_IBSS))) |
1009 | 1013 | ||
1010 | #define WLAN_CAPABILITY_CF_POLLABLE (1<<2) | 1014 | #define WLAN_CAPABILITY_CF_POLLABLE (1<<2) |
diff --git a/include/linux/if_packet.h b/include/linux/if_packet.h index 72bfa5a034dd..6d66ce1791a9 100644 --- a/include/linux/if_packet.h +++ b/include/linux/if_packet.h | |||
@@ -70,6 +70,7 @@ struct tpacket_auxdata { | |||
70 | #define TP_STATUS_COPY 0x2 | 70 | #define TP_STATUS_COPY 0x2 |
71 | #define TP_STATUS_LOSING 0x4 | 71 | #define TP_STATUS_LOSING 0x4 |
72 | #define TP_STATUS_CSUMNOTREADY 0x8 | 72 | #define TP_STATUS_CSUMNOTREADY 0x8 |
73 | #define TP_STATUS_VLAN_VALID 0x10 /* auxdata has valid tp_vlan_tci */ | ||
73 | 74 | ||
74 | /* Tx ring - header status */ | 75 | /* Tx ring - header status */ |
75 | #define TP_STATUS_AVAILABLE 0x0 | 76 | #define TP_STATUS_AVAILABLE 0x0 |
diff --git a/include/linux/mtd/physmap.h b/include/linux/mtd/physmap.h index d40bfa1d9c91..e5f21d293c70 100644 --- a/include/linux/mtd/physmap.h +++ b/include/linux/mtd/physmap.h | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/mtd/partitions.h> | 19 | #include <linux/mtd/partitions.h> |
20 | 20 | ||
21 | struct map_info; | 21 | struct map_info; |
22 | struct platform_device; | ||
22 | 23 | ||
23 | struct physmap_flash_data { | 24 | struct physmap_flash_data { |
24 | unsigned int width; | 25 | unsigned int width; |
diff --git a/include/linux/tty_ldisc.h b/include/linux/tty_ldisc.h index 5b07792ccb46..ff7dc08696a8 100644 --- a/include/linux/tty_ldisc.h +++ b/include/linux/tty_ldisc.h | |||
@@ -76,7 +76,7 @@ | |||
76 | * tty device. It is solely the responsibility of the line | 76 | * tty device. It is solely the responsibility of the line |
77 | * discipline to handle poll requests. | 77 | * discipline to handle poll requests. |
78 | * | 78 | * |
79 | * unsigned int (*receive_buf)(struct tty_struct *, const unsigned char *cp, | 79 | * void (*receive_buf)(struct tty_struct *, const unsigned char *cp, |
80 | * char *fp, int count); | 80 | * char *fp, int count); |
81 | * | 81 | * |
82 | * This function is called by the low-level tty driver to send | 82 | * This function is called by the low-level tty driver to send |
@@ -84,8 +84,7 @@ | |||
84 | * processing. <cp> is a pointer to the buffer of input | 84 | * processing. <cp> is a pointer to the buffer of input |
85 | * character received by the device. <fp> is a pointer to a | 85 | * character received by the device. <fp> is a pointer to a |
86 | * pointer of flag bytes which indicate whether a character was | 86 | * pointer of flag bytes which indicate whether a character was |
87 | * received with a parity error, etc. Returns the amount of bytes | 87 | * received with a parity error, etc. |
88 | * received. | ||
89 | * | 88 | * |
90 | * void (*write_wakeup)(struct tty_struct *); | 89 | * void (*write_wakeup)(struct tty_struct *); |
91 | * | 90 | * |
@@ -141,8 +140,8 @@ struct tty_ldisc_ops { | |||
141 | /* | 140 | /* |
142 | * The following routines are called from below. | 141 | * The following routines are called from below. |
143 | */ | 142 | */ |
144 | unsigned int (*receive_buf)(struct tty_struct *, | 143 | void (*receive_buf)(struct tty_struct *, const unsigned char *cp, |
145 | const unsigned char *cp, char *fp, int count); | 144 | char *fp, int count); |
146 | void (*write_wakeup)(struct tty_struct *); | 145 | void (*write_wakeup)(struct tty_struct *); |
147 | void (*dcd_change)(struct tty_struct *, unsigned int, | 146 | void (*dcd_change)(struct tty_struct *, unsigned int, |
148 | struct pps_event_time *); | 147 | struct pps_event_time *); |
diff --git a/include/trace/events/net.h b/include/trace/events/net.h index 5f247f5ffc56..f99645d05a8f 100644 --- a/include/trace/events/net.h +++ b/include/trace/events/net.h | |||
@@ -12,22 +12,24 @@ | |||
12 | TRACE_EVENT(net_dev_xmit, | 12 | TRACE_EVENT(net_dev_xmit, |
13 | 13 | ||
14 | TP_PROTO(struct sk_buff *skb, | 14 | TP_PROTO(struct sk_buff *skb, |
15 | int rc), | 15 | int rc, |
16 | struct net_device *dev, | ||
17 | unsigned int skb_len), | ||
16 | 18 | ||
17 | TP_ARGS(skb, rc), | 19 | TP_ARGS(skb, rc, dev, skb_len), |
18 | 20 | ||
19 | TP_STRUCT__entry( | 21 | TP_STRUCT__entry( |
20 | __field( void *, skbaddr ) | 22 | __field( void *, skbaddr ) |
21 | __field( unsigned int, len ) | 23 | __field( unsigned int, len ) |
22 | __field( int, rc ) | 24 | __field( int, rc ) |
23 | __string( name, skb->dev->name ) | 25 | __string( name, dev->name ) |
24 | ), | 26 | ), |
25 | 27 | ||
26 | TP_fast_assign( | 28 | TP_fast_assign( |
27 | __entry->skbaddr = skb; | 29 | __entry->skbaddr = skb; |
28 | __entry->len = skb->len; | 30 | __entry->len = skb_len; |
29 | __entry->rc = rc; | 31 | __entry->rc = rc; |
30 | __assign_str(name, skb->dev->name); | 32 | __assign_str(name, dev->name); |
31 | ), | 33 | ), |
32 | 34 | ||
33 | TP_printk("dev=%s skbaddr=%p len=%u rc=%d", | 35 | TP_printk("dev=%s skbaddr=%p len=%u rc=%d", |
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 28afa4c5333c..dd373c8ee943 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug | |||
@@ -697,7 +697,7 @@ config DEBUG_BUGVERBOSE | |||
697 | bool "Verbose BUG() reporting (adds 70K)" if DEBUG_KERNEL && EXPERT | 697 | bool "Verbose BUG() reporting (adds 70K)" if DEBUG_KERNEL && EXPERT |
698 | depends on BUG | 698 | depends on BUG |
699 | depends on ARM || AVR32 || M32R || M68K || SPARC32 || SPARC64 || \ | 699 | depends on ARM || AVR32 || M32R || M68K || SPARC32 || SPARC64 || \ |
700 | FRV || SUPERH || GENERIC_BUG || BLACKFIN || MN10300 | 700 | FRV || SUPERH || GENERIC_BUG || BLACKFIN || MN10300 || TILE |
701 | default y | 701 | default y |
702 | help | 702 | help |
703 | Say Y here to make BUG() panics output the file name and line number | 703 | Say Y here to make BUG() panics output the file name and line number |
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index a4e1db3f1981..4e8985acdab8 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -2247,10 +2247,6 @@ __alloc_pages_nodemask(gfp_t gfp_mask, unsigned int order, | |||
2247 | 2247 | ||
2248 | if (should_fail_alloc_page(gfp_mask, order)) | 2248 | if (should_fail_alloc_page(gfp_mask, order)) |
2249 | return NULL; | 2249 | return NULL; |
2250 | #ifndef CONFIG_ZONE_DMA | ||
2251 | if (WARN_ON_ONCE(gfp_mask & __GFP_DMA)) | ||
2252 | return NULL; | ||
2253 | #endif | ||
2254 | 2250 | ||
2255 | /* | 2251 | /* |
2256 | * Check the zones suitable for the gfp_mask contain at least one | 2252 | * Check the zones suitable for the gfp_mask contain at least one |
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c index 4225e24d0c21..1c9aa8c6a77d 100644 --- a/net/8021q/vlan_dev.c +++ b/net/8021q/vlan_dev.c | |||
@@ -167,7 +167,7 @@ static netdev_tx_t vlan_dev_hard_start_xmit(struct sk_buff *skb, | |||
167 | u64_stats_update_begin(&stats->syncp); | 167 | u64_stats_update_begin(&stats->syncp); |
168 | stats->tx_packets++; | 168 | stats->tx_packets++; |
169 | stats->tx_bytes += len; | 169 | stats->tx_bytes += len; |
170 | u64_stats_update_begin(&stats->syncp); | 170 | u64_stats_update_end(&stats->syncp); |
171 | } else { | 171 | } else { |
172 | this_cpu_inc(vlan_dev_info(dev)->vlan_pcpu_stats->tx_dropped); | 172 | this_cpu_inc(vlan_dev_info(dev)->vlan_pcpu_stats->tx_dropped); |
173 | } | 173 | } |
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c index a86f9ba4f05c..e64a1c2df238 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c | |||
@@ -906,7 +906,7 @@ static struct l2cap_chan *l2cap_global_chan_by_psm(int state, __le16 psm, bdaddr | |||
906 | if (c->psm == psm) { | 906 | if (c->psm == psm) { |
907 | /* Exact match. */ | 907 | /* Exact match. */ |
908 | if (!bacmp(&bt_sk(sk)->src, src)) { | 908 | if (!bacmp(&bt_sk(sk)->src, src)) { |
909 | read_unlock_bh(&chan_list_lock); | 909 | read_unlock(&chan_list_lock); |
910 | return c; | 910 | return c; |
911 | } | 911 | } |
912 | 912 | ||
diff --git a/net/caif/chnl_net.c b/net/caif/chnl_net.c index 649ebacaf6bc..adbb424403d4 100644 --- a/net/caif/chnl_net.c +++ b/net/caif/chnl_net.c | |||
@@ -139,17 +139,14 @@ static void close_work(struct work_struct *work) | |||
139 | struct chnl_net *dev = NULL; | 139 | struct chnl_net *dev = NULL; |
140 | struct list_head *list_node; | 140 | struct list_head *list_node; |
141 | struct list_head *_tmp; | 141 | struct list_head *_tmp; |
142 | /* May be called with or without RTNL lock held */ | 142 | |
143 | int islocked = rtnl_is_locked(); | 143 | rtnl_lock(); |
144 | if (!islocked) | ||
145 | rtnl_lock(); | ||
146 | list_for_each_safe(list_node, _tmp, &chnl_net_list) { | 144 | list_for_each_safe(list_node, _tmp, &chnl_net_list) { |
147 | dev = list_entry(list_node, struct chnl_net, list_field); | 145 | dev = list_entry(list_node, struct chnl_net, list_field); |
148 | if (dev->state == CAIF_SHUTDOWN) | 146 | if (dev->state == CAIF_SHUTDOWN) |
149 | dev_close(dev->netdev); | 147 | dev_close(dev->netdev); |
150 | } | 148 | } |
151 | if (!islocked) | 149 | rtnl_unlock(); |
152 | rtnl_unlock(); | ||
153 | } | 150 | } |
154 | static DECLARE_WORK(close_worker, close_work); | 151 | static DECLARE_WORK(close_worker, close_work); |
155 | 152 | ||
diff --git a/net/core/dev.c b/net/core/dev.c index c7e305d13b71..939307891e71 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -2096,6 +2096,7 @@ int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev, | |||
2096 | { | 2096 | { |
2097 | const struct net_device_ops *ops = dev->netdev_ops; | 2097 | const struct net_device_ops *ops = dev->netdev_ops; |
2098 | int rc = NETDEV_TX_OK; | 2098 | int rc = NETDEV_TX_OK; |
2099 | unsigned int skb_len; | ||
2099 | 2100 | ||
2100 | if (likely(!skb->next)) { | 2101 | if (likely(!skb->next)) { |
2101 | u32 features; | 2102 | u32 features; |
@@ -2146,8 +2147,9 @@ int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev, | |||
2146 | } | 2147 | } |
2147 | } | 2148 | } |
2148 | 2149 | ||
2150 | skb_len = skb->len; | ||
2149 | rc = ops->ndo_start_xmit(skb, dev); | 2151 | rc = ops->ndo_start_xmit(skb, dev); |
2150 | trace_net_dev_xmit(skb, rc); | 2152 | trace_net_dev_xmit(skb, rc, dev, skb_len); |
2151 | if (rc == NETDEV_TX_OK) | 2153 | if (rc == NETDEV_TX_OK) |
2152 | txq_trans_update(txq); | 2154 | txq_trans_update(txq); |
2153 | return rc; | 2155 | return rc; |
@@ -2167,8 +2169,9 @@ gso: | |||
2167 | if (dev->priv_flags & IFF_XMIT_DST_RELEASE) | 2169 | if (dev->priv_flags & IFF_XMIT_DST_RELEASE) |
2168 | skb_dst_drop(nskb); | 2170 | skb_dst_drop(nskb); |
2169 | 2171 | ||
2172 | skb_len = nskb->len; | ||
2170 | rc = ops->ndo_start_xmit(nskb, dev); | 2173 | rc = ops->ndo_start_xmit(nskb, dev); |
2171 | trace_net_dev_xmit(nskb, rc); | 2174 | trace_net_dev_xmit(nskb, rc, dev, skb_len); |
2172 | if (unlikely(rc != NETDEV_TX_OK)) { | 2175 | if (unlikely(rc != NETDEV_TX_OK)) { |
2173 | if (rc & ~NETDEV_TX_MASK) | 2176 | if (rc & ~NETDEV_TX_MASK) |
2174 | goto out_kfree_gso_skb; | 2177 | goto out_kfree_gso_skb; |
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index cc1463156cd0..9c1926027a26 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c | |||
@@ -465,6 +465,9 @@ int inet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) | |||
465 | if (addr_len < sizeof(struct sockaddr_in)) | 465 | if (addr_len < sizeof(struct sockaddr_in)) |
466 | goto out; | 466 | goto out; |
467 | 467 | ||
468 | if (addr->sin_family != AF_INET) | ||
469 | goto out; | ||
470 | |||
468 | chk_addr_ret = inet_addr_type(sock_net(sk), addr->sin_addr.s_addr); | 471 | chk_addr_ret = inet_addr_type(sock_net(sk), addr->sin_addr.s_addr); |
469 | 472 | ||
470 | /* Not specified by any standard per-se, however it breaks too | 473 | /* Not specified by any standard per-se, however it breaks too |
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index 925f715686a5..ba248d93399a 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c | |||
@@ -798,7 +798,12 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, | |||
798 | getnstimeofday(&ts); | 798 | getnstimeofday(&ts); |
799 | h.h2->tp_sec = ts.tv_sec; | 799 | h.h2->tp_sec = ts.tv_sec; |
800 | h.h2->tp_nsec = ts.tv_nsec; | 800 | h.h2->tp_nsec = ts.tv_nsec; |
801 | h.h2->tp_vlan_tci = vlan_tx_tag_get(skb); | 801 | if (vlan_tx_tag_present(skb)) { |
802 | h.h2->tp_vlan_tci = vlan_tx_tag_get(skb); | ||
803 | status |= TP_STATUS_VLAN_VALID; | ||
804 | } else { | ||
805 | h.h2->tp_vlan_tci = 0; | ||
806 | } | ||
802 | hdrlen = sizeof(*h.h2); | 807 | hdrlen = sizeof(*h.h2); |
803 | break; | 808 | break; |
804 | default: | 809 | default: |
@@ -1725,8 +1730,12 @@ static int packet_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
1725 | aux.tp_snaplen = skb->len; | 1730 | aux.tp_snaplen = skb->len; |
1726 | aux.tp_mac = 0; | 1731 | aux.tp_mac = 0; |
1727 | aux.tp_net = skb_network_offset(skb); | 1732 | aux.tp_net = skb_network_offset(skb); |
1728 | aux.tp_vlan_tci = vlan_tx_tag_get(skb); | 1733 | if (vlan_tx_tag_present(skb)) { |
1729 | 1734 | aux.tp_vlan_tci = vlan_tx_tag_get(skb); | |
1735 | aux.tp_status |= TP_STATUS_VLAN_VALID; | ||
1736 | } else { | ||
1737 | aux.tp_vlan_tci = 0; | ||
1738 | } | ||
1730 | put_cmsg(msg, SOL_PACKET, PACKET_AUXDATA, sizeof(aux), &aux); | 1739 | put_cmsg(msg, SOL_PACKET, PACKET_AUXDATA, sizeof(aux), &aux); |
1731 | } | 1740 | } |
1732 | 1741 | ||
diff --git a/net/wireless/scan.c b/net/wireless/scan.c index 73a441d237b5..7a6c67667d70 100644 --- a/net/wireless/scan.c +++ b/net/wireless/scan.c | |||
@@ -267,13 +267,35 @@ static bool is_bss(struct cfg80211_bss *a, | |||
267 | return memcmp(ssidie + 2, ssid, ssid_len) == 0; | 267 | return memcmp(ssidie + 2, ssid, ssid_len) == 0; |
268 | } | 268 | } |
269 | 269 | ||
270 | static bool is_mesh_bss(struct cfg80211_bss *a) | ||
271 | { | ||
272 | const u8 *ie; | ||
273 | |||
274 | if (!WLAN_CAPABILITY_IS_STA_BSS(a->capability)) | ||
275 | return false; | ||
276 | |||
277 | ie = cfg80211_find_ie(WLAN_EID_MESH_ID, | ||
278 | a->information_elements, | ||
279 | a->len_information_elements); | ||
280 | if (!ie) | ||
281 | return false; | ||
282 | |||
283 | ie = cfg80211_find_ie(WLAN_EID_MESH_CONFIG, | ||
284 | a->information_elements, | ||
285 | a->len_information_elements); | ||
286 | if (!ie) | ||
287 | return false; | ||
288 | |||
289 | return true; | ||
290 | } | ||
291 | |||
270 | static bool is_mesh(struct cfg80211_bss *a, | 292 | static bool is_mesh(struct cfg80211_bss *a, |
271 | const u8 *meshid, size_t meshidlen, | 293 | const u8 *meshid, size_t meshidlen, |
272 | const u8 *meshcfg) | 294 | const u8 *meshcfg) |
273 | { | 295 | { |
274 | const u8 *ie; | 296 | const u8 *ie; |
275 | 297 | ||
276 | if (!WLAN_CAPABILITY_IS_MBSS(a->capability)) | 298 | if (!WLAN_CAPABILITY_IS_STA_BSS(a->capability)) |
277 | return false; | 299 | return false; |
278 | 300 | ||
279 | ie = cfg80211_find_ie(WLAN_EID_MESH_ID, | 301 | ie = cfg80211_find_ie(WLAN_EID_MESH_ID, |
@@ -311,7 +333,7 @@ static int cmp_bss(struct cfg80211_bss *a, | |||
311 | if (a->channel != b->channel) | 333 | if (a->channel != b->channel) |
312 | return b->channel->center_freq - a->channel->center_freq; | 334 | return b->channel->center_freq - a->channel->center_freq; |
313 | 335 | ||
314 | if (WLAN_CAPABILITY_IS_MBSS(a->capability | b->capability)) { | 336 | if (is_mesh_bss(a) && is_mesh_bss(b)) { |
315 | r = cmp_ies(WLAN_EID_MESH_ID, | 337 | r = cmp_ies(WLAN_EID_MESH_ID, |
316 | a->information_elements, | 338 | a->information_elements, |
317 | a->len_information_elements, | 339 | a->len_information_elements, |
@@ -457,7 +479,6 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev, | |||
457 | struct cfg80211_internal_bss *res) | 479 | struct cfg80211_internal_bss *res) |
458 | { | 480 | { |
459 | struct cfg80211_internal_bss *found = NULL; | 481 | struct cfg80211_internal_bss *found = NULL; |
460 | const u8 *meshid, *meshcfg; | ||
461 | 482 | ||
462 | /* | 483 | /* |
463 | * The reference to "res" is donated to this function. | 484 | * The reference to "res" is donated to this function. |
@@ -470,22 +491,6 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev, | |||
470 | 491 | ||
471 | res->ts = jiffies; | 492 | res->ts = jiffies; |
472 | 493 | ||
473 | if (WLAN_CAPABILITY_IS_MBSS(res->pub.capability)) { | ||
474 | /* must be mesh, verify */ | ||
475 | meshid = cfg80211_find_ie(WLAN_EID_MESH_ID, | ||
476 | res->pub.information_elements, | ||
477 | res->pub.len_information_elements); | ||
478 | meshcfg = cfg80211_find_ie(WLAN_EID_MESH_CONFIG, | ||
479 | res->pub.information_elements, | ||
480 | res->pub.len_information_elements); | ||
481 | if (!meshid || !meshcfg || | ||
482 | meshcfg[1] != sizeof(struct ieee80211_meshconf_ie)) { | ||
483 | /* bogus mesh */ | ||
484 | kref_put(&res->ref, bss_release); | ||
485 | return NULL; | ||
486 | } | ||
487 | } | ||
488 | |||
489 | spin_lock_bh(&dev->bss_lock); | 494 | spin_lock_bh(&dev->bss_lock); |
490 | 495 | ||
491 | found = rb_find_bss(dev, res); | 496 | found = rb_find_bss(dev, res); |
diff --git a/security/apparmor/lsm.c b/security/apparmor/lsm.c index ae3a698415e6..ec1bcecf2cda 100644 --- a/security/apparmor/lsm.c +++ b/security/apparmor/lsm.c | |||
@@ -593,7 +593,8 @@ static int apparmor_setprocattr(struct task_struct *task, char *name, | |||
593 | sa.aad.op = OP_SETPROCATTR; | 593 | sa.aad.op = OP_SETPROCATTR; |
594 | sa.aad.info = name; | 594 | sa.aad.info = name; |
595 | sa.aad.error = -EINVAL; | 595 | sa.aad.error = -EINVAL; |
596 | return aa_audit(AUDIT_APPARMOR_DENIED, NULL, GFP_KERNEL, | 596 | return aa_audit(AUDIT_APPARMOR_DENIED, |
597 | __aa_current_profile(), GFP_KERNEL, | ||
597 | &sa, NULL); | 598 | &sa, NULL); |
598 | } | 599 | } |
599 | } else if (strcmp(name, "exec") == 0) { | 600 | } else if (strcmp(name, "exec") == 0) { |
diff --git a/sound/soc/codecs/cx20442.c b/sound/soc/codecs/cx20442.c index f8c663dcff02..d68ea532cc7f 100644 --- a/sound/soc/codecs/cx20442.c +++ b/sound/soc/codecs/cx20442.c | |||
@@ -262,14 +262,14 @@ static int v253_hangup(struct tty_struct *tty) | |||
262 | } | 262 | } |
263 | 263 | ||
264 | /* Line discipline .receive_buf() */ | 264 | /* Line discipline .receive_buf() */ |
265 | static unsigned int v253_receive(struct tty_struct *tty, | 265 | static void v253_receive(struct tty_struct *tty, |
266 | const unsigned char *cp, char *fp, int count) | 266 | const unsigned char *cp, char *fp, int count) |
267 | { | 267 | { |
268 | struct snd_soc_codec *codec = tty->disc_data; | 268 | struct snd_soc_codec *codec = tty->disc_data; |
269 | struct cx20442_priv *cx20442; | 269 | struct cx20442_priv *cx20442; |
270 | 270 | ||
271 | if (!codec) | 271 | if (!codec) |
272 | return count; | 272 | return; |
273 | 273 | ||
274 | cx20442 = snd_soc_codec_get_drvdata(codec); | 274 | cx20442 = snd_soc_codec_get_drvdata(codec); |
275 | 275 | ||
@@ -281,8 +281,6 @@ static unsigned int v253_receive(struct tty_struct *tty, | |||
281 | codec->hw_write = (hw_write_t)tty->ops->write; | 281 | codec->hw_write = (hw_write_t)tty->ops->write; |
282 | codec->card->pop_time = 1; | 282 | codec->card->pop_time = 1; |
283 | } | 283 | } |
284 | |||
285 | return count; | ||
286 | } | 284 | } |
287 | 285 | ||
288 | /* Line discipline .write_wakeup() */ | 286 | /* Line discipline .write_wakeup() */ |
diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl index 1fd29b2daa92..cef28e6632b9 100755 --- a/tools/testing/ktest/ktest.pl +++ b/tools/testing/ktest/ktest.pl | |||
@@ -788,7 +788,7 @@ sub wait_for_input | |||
788 | 788 | ||
789 | sub reboot_to { | 789 | sub reboot_to { |
790 | if ($reboot_type eq "grub") { | 790 | if ($reboot_type eq "grub") { |
791 | run_ssh "'(echo \"savedefault --default=$grub_number --once\" | grub --batch; reboot)'"; | 791 | run_ssh "'(echo \"savedefault --default=$grub_number --once\" | grub --batch && reboot)'"; |
792 | return; | 792 | return; |
793 | } | 793 | } |
794 | 794 | ||
@@ -1480,7 +1480,7 @@ sub process_config_ignore { | |||
1480 | or dodie "Failed to read $config"; | 1480 | or dodie "Failed to read $config"; |
1481 | 1481 | ||
1482 | while (<IN>) { | 1482 | while (<IN>) { |
1483 | if (/^(.*?(CONFIG\S*)(=.*| is not set))/) { | 1483 | if (/^((CONFIG\S*)=.*)/) { |
1484 | $config_ignore{$2} = $1; | 1484 | $config_ignore{$2} = $1; |
1485 | } | 1485 | } |
1486 | } | 1486 | } |
@@ -1638,7 +1638,7 @@ sub run_config_bisect { | |||
1638 | if (!$found) { | 1638 | if (!$found) { |
1639 | # try the other half | 1639 | # try the other half |
1640 | doprint "Top half produced no set configs, trying bottom half\n"; | 1640 | doprint "Top half produced no set configs, trying bottom half\n"; |
1641 | @tophalf = @start_list[$half .. $#start_list]; | 1641 | @tophalf = @start_list[$half + 1 .. $#start_list]; |
1642 | create_config @tophalf; | 1642 | create_config @tophalf; |
1643 | read_current_config \%current_config; | 1643 | read_current_config \%current_config; |
1644 | foreach my $config (@tophalf) { | 1644 | foreach my $config (@tophalf) { |
@@ -1690,7 +1690,7 @@ sub run_config_bisect { | |||
1690 | # remove half the configs we are looking at and see if | 1690 | # remove half the configs we are looking at and see if |
1691 | # they are good. | 1691 | # they are good. |
1692 | $half = int($#start_list / 2); | 1692 | $half = int($#start_list / 2); |
1693 | } while ($half > 0); | 1693 | } while ($#start_list > 0); |
1694 | 1694 | ||
1695 | # we found a single config, try it again unless we are running manually | 1695 | # we found a single config, try it again unless we are running manually |
1696 | 1696 | ||